Releases: facebook/lexical
v0.12.4
v0.12.3
v0.12.3 (2023-11-17)
This minor release is not so minor! New stuff and a scroll of bugfixes.
Overriding HTML serialization from the editor config (#4254)
Some months ago we introduced Node Overrides as a way to fully customize your Node. While this feature gives you the most flexibility, we realized (based on Discord's feedback) that most overrides are fairly simple and move around HTML. For this reason, we're bringing this closer to you and without the need to introduce new Nodes.
html: {
export: new Map([[TextNode, () => ({ element: document.createElement('figure') })]]),
import: { 'figure': () => ({ conversion: () => ({ node: $createTextNode('yolo') }), priority: 4 }) }
},
$insertNodes rewrite (#5002)
$insertNodes
is arguably the most complex function in the Lexical codebase. Or at least it was until @GermanJablo succesfully rewrote it from scratch!
For those of you who haven't had a chance to play with $insertNodes
yet, it places one or multiple Nodes at your selection, and is responsible for intelligently determining the end hiearchy (i.e. merged together or moved up to tree).
@GermanJablo's rewrite not only resolves some immediate issues but also the reduced complexity now enables us to perfect this function (and indirectly the clipboard paste behavior), previously blocked by its complexity.
Tables reliability
We closed more than 70% of the open tables issues since the last release. Kudos to @icrosil for being the main driver behind this effort!
What's Changed
- fix(lexical/html): missing @lexical/utils dependency by @liuweiGL in #4984
- Fix comment plugin selection rect top position by @vonsa in #4988
- Remove capital letter mentions by @acywatson in #4991
- Add nodes replacement support for nested composer by @fantactuka in #4992
- Add highlight to format types by @zurfyx in #5001
- Fix getTableSelectionFromTableElement flow by @zurfyx in #5005
- Fix TextNode override in 'Serialization & Deserialization' doc by @giacomoran in #5006
- Allow overriding HTML serialization behavior from the editor config. by @acywatson in #4254
- fix: LinkNode.importDOM should support all node content by @k-rajat19 in #5010
- Fix event handler removal in useDynamicPositioning, remove dupe code by @thorn0 in #5024
- Fix: pasting text that ends with an empty paragraph is ignored when the MaxLengthPlugin is enabled by @khsily in #5020
- Update setFloatingElemPosition.ts by @dirheimerb in #5027
- Update setFloatingElemPositionForLinkEditor.ts by @dirheimerb in #5028
- chore: fix typo in lexical-utils docs by @bbonamin in #5022
- fix(Playground): CMD +K improvements by @k-rajat19 in #5013
- feat: LexicalClickableLinkPlugin should support ctrl click mode #4565 by @sathishsridhar in #4839
- Nit: Floating toolbar by @zurfyx in #5038
- Transpile optional catch binding by @zurfyx in #5048
- Playground: refactor component picker plugin by @thorn0 in #4836
- Port List e2e test to unit tests by @acywatson in #5030
- Playground: embed twitter support x.com by @suhaotian in #5060
- MaxLength handle empty ElementNode by @zurfyx in #5029
- Allow LexicalTypeaheadMenuPlugin to work when inside an iframe by @lestertay in #5044
- fix : Add column shortcut gets hidden when mouse leave the table #4857 by @sathishsridhar in #5058
- Fix/floating formatter #5021 by @shubham168 in #5041
- Fix: ToolbarPlugin paste error with start, end format by @khsily in #5019
- fix(playground-text-format-toolbar): don't hide toolbar if current node is a paragraph by @mathieumetral in #4850
- Fix integrity by @zurfyx in #5068
- chore: fix typo by @AlessioGr in #5074
- Set up GA4 for website by @zpao in #5078
- Fix getting style via $getSelectionStyleValueForProperty when selection is collapsed by @Piliuta in #5082
- Fix tab replacement composition crash by @zurfyx in #5066
- chore: add typedefs for collab nodes and remove unused members by @zignis in #5071
- Revert Fix $transferStartingElementPointToTextPoint() #4756 by @thegreatercurve in #5094
- Fix insertNodes insert position at start of inline ElementNode by @zurfyx in #5110
- docs: fix typo in decorators.md by @CanRau in #5113
- fix(lexical-rich-text): correct comment typo by @jason89521 in #5116
- fix: fix android backspace bug by @cristopher-iov in #5077
- Fix: right click select images by @bencarletonn in #5056
- Consolidate docs across the repo by @ivailop7 in #5121
- chore(deps): bump @excalidraw/excalidraw from 0.14.2 to 0.15.3 by @dependabot in #5135
- Update anchor selection if split by patching style by @Piliuta in #5087
- Updated cell calculation based on cellspans by @icrosil in #5141
- Add Columns Layout to Typeahead menu by @ivailop7 in #5136
- Updated $insertTableColumn with batching by @icrosil in #5145
- chore(deps): bump @babel/traverse from 7.18.6 to 7.23.2 by @dependabot in #5155
- Add
commandPriority
option toLexicalMenu
and dependent components by @huw in #5123 - Update index.tsx by @dirheimerb in #5165
- Fix formatting selected table cells by @tahir606 in #5168
- Updated package-lock.json versions with 'npm audit fix'. by @Sparky338 in #5125
- Table resize fix by @AlexanderReznik in #5169
- Add Optional Chaining to
isNodePre
Method by @nickjmoss in #5157 - Fix
insertNodes
andinsertParagraph
by @GermanJablo in #5002 - Range utils by @zurfyx in #5153
- Fix insertNodes after selection swap by @zurfyx in #5175
- Add playwright-report to gitignore by @GermanJablo in #5173
- Fix insertNodes when anchor point is blank TextNode by @zurfyx in #5179
- Fix at() transpilation by @zurfyx in #5180
- fixed issue 5181 where link address is not shown if comment is set in… by @btezzxxt in #5188
- Improved LexicalMenu positioning relative to text by @9larsons in #5187
- Link title is correctly applied through the command by @petyosi in #5191
- fix Heading.insertNewAfter by @GermanJablo in #5198
- Update Modal.tsx by @dirheimerb in #5203
- Add conditional format setting, if the node is link fetch the parent paragraph node by @tahir606 in #5209
- Fix lexical-link typo s/_rel/__rel/ by @etrepum in #5221
- Fix "touple" typo to make it correctly "tuple" by @Jufrench in #5229
- fix: Make autolinks working for formatted text by @Constantiner in #5214
- refactor(playground): dry settings by @agriffis in #5225
- Fix iconRTL for center alignment by @ivailop7 in #5227
- Bug: Align list item do not change the export DOM by @trinhvinhtruong96 in #5160
- Fixes grid selection to be aware of nested tables by @icrosil in #5166
- chore(deps-dev): bump vite from 2.9.13 to 2.9.16 by @dependabot in #5133
- chore(deps): bump http-cache-semantics from 4.1.0 to 4.1.1 by @dependabot in #5129
- chore(deps): bump postcss from 8.4.27 to 8.4.31 by @dependabot in https://github.com/facebook/le...
v0.12.2
v0.12.1
v0.12.1 (2023-09-07)
Changelog
- Fix: font colors do not apply to text within table cells (#4934) Tahir Shakir
- fix #4526 (#4910) xyyjk
- fix: dispatching undo & redo states for collaboration; fixing up Point.getNode not a function (#4956) Nadine Nguyen
- Retain TextNode whitespace on export (#4969) Gerard Rovira
- Revert "Fix: fixes regex in YouTube AutoEmbedPlugin (#4916)" (#4966) Ivaylo Pavlov
- Fix: fixes regex in YouTube AutoEmbedPlugin (#4916) Rajat
- refactor: moved functions to
@lexical/utils
(#4923) Rajat - refactor: remove redundant styles from floating text format plugin (#4938) VelociRaptor
- 🐛 Fixed range selection splicing text (#4659) Steve Larson
- Added extra Yjs information to collaboration docs (#4951) Steven Fabre
- fix: disable spellcheck for code format (#4927) VelociRaptor
- Add column layout plugin example (#4937) Maksim Horbachevsky
- docs: fix example in getting-started/react (#4935) Mike
- Fix: MaxLengthPlugin crashes when the limit is reached and enter is pressed (#4871) Hansu Kim
- chore: prefer viewBox to width/height on SVG images (#4921) VelociRaptor
- Adds ElementFormatDropdown to the Toolbar plugin (#4904) itaquito
- Add iOS information to the website (#4899) amyworrall
- fix: Only append fragment when element is HTMLElement (#4490) lsbyerley
- Table unmerge (#4877) Peter Cook Bulukin
- Revert "Updated link markdown regex (#4461)" (#4896) Gerard Rovira
- Add missing flow def (#4889) Maksim Horbachevsky
- Handle undefined rows and columns in table utils after cell merge (#4874) Peter Cook Bulukin
- Updated link markdown regex (#4461) Ronald Langeveld
- Fix: Pressing enter now doesnot delete ImageNode from the ListItemNode (#4866) Takumi Uchida
New Contributors
- @mathieumetral made their first contribution in #4811
- @anton-kostiuchkov made their first contribution in #4852
- @Dias1c made their first contribution in #4842
- @9larsons made their first contribution in #4672
- @TAKU1022 made their first contribution in #4866
- @ronaldlangeveld made their first contribution in #4461
- @lsbyerley made their first contribution in #4490
- @itaquito made their first contribution in #4904
- @khsily made their first contribution in #4871
- @mmollick made their first contribution in #4935
- @stevenfabre made their first contribution in #4951
- @k-rajat19 made their first contribution in #4923
- @nadine-nguyen made their first contribution in #4956
Full Changelog: v0.11.3...v0.12.1
v0.12.0
v0.12.0 (2023-08-09)
Breaking Changes
#4818 moves "select all" behavior to the SELECT_ALL command, meaning anyone using setRootElement directly (i.e., not using PlainTextPlugin or RichTextPlugin or their underlying functions) would need to wire up command listeners for SELECT_ALL_COMMAND in order to preserve the default "select all" behavior after this version.
- Extract "select all" behavior to new
SELECT_ALL_COMMAND
(#4818) Chris Montrois - Paste decorators before empty text nodes (#4672) Steve Larson
- Added "Page Break" to Lexical Playground (#4842) Dias Kappassov
- fix editor ref types and use EditorRefPlugin in the playground (#4852) Anton Kostiuchkov
- Expand react docs (#4845) Acy Watson
- Port lexical.dev to Tailwind (#4827) Awjin
- Stop collapsing non-collapsible whitespace on paste (#4770) Brian Birtles
- feat(playground): add support for collapsed margins in draggable block (#4823) Mathieu Métral
- feat(playground): add support for drop block on empty area (#4811) Mathieu Métral
- docs: remove placeholder property from exampleTheme (#4802) Karam Qaoud%
v0.11.3
v0.11.3 (2023-07-18)
- Fix table imports (#4795) Maksim Horbachevsky
- RFC Add prev editor state for mutation listener (#4796) Maksim Horbachevsky
- Fix Cant convert paragraph into a header if the first child of the paragraph is a LineBreakNode (#4776) Naveen
- Add setStyle to Flow types (#4780) Acy Watson
- Fix width reflow in columns when resizing tables (#4775) Karam Qaoud
- package.lock (#4769) Gerard Rovira
- Remove duplicate declaration (#4772) Roman Gafiatullin
- fix Return LexicalEditorRefPlugin as valid JSX (#4771) Thomas Sauques
- Update TS to 5.1.x (#4695) Georgii Dolzhykov
New Contributors
- @aMoRRoMa made their first contribution in #4772
- @naveen8801 made their first contribution in #4776
Full Changelog: v0.11.2...v0.11.3
v0.11.2
v0.11.2 (2023-07-11)
Changelog
- Better Error Message for exportJSON type by @howlowck in #4556
- Another approach to fixing the className cache by @acywatson in #4582
- Fix a11y for ContentEditable by @maximshipko in #4580
- Allow native shift+arrow selection work over decorator nodes by @thegreatercurve in #4584
- use selection from state in insertNodeToNearestRoot and insertNodes by @kalvin807 in #4570
- Fix uuid bug in
AutocompleteNode.clone()
by @msdrigg in #4592 - Fix MenuTypeahead position by @aleksandr-kiliushin in #4597
- Update nodes.md by @navanshu in #4598
- mouseenter event typo fix by @agentraghav in #4588
- Add vercel analytics script by @acywatson in #4604
- Fix iOS newline insertion by @fantactuka in #4603
- TextNode docs by @acywatson in #4606
- fix: freeze get style object in DEV env to avoid mutations by @JatinRanka in #4616
- Don't throw error on format element by @thegreatercurve in #4611
- fix issue with dead keys (i.e. backticks) when converting markdown by @mbongard in #4620
- Fix issue with syncing yjs changes to Lexical by @ebads67 in #4621
- Add error formating params by @fantactuka in #4627
- Add clipboard documentation by @acywatson in #4631
- Add error formating params by @fantactuka in #4629
- Add missing ExportDOM to CodeNode by @ivailop7 in #4637
- Import alignment for Heading and Blockquote by @ivailop7 in #4625
- Fix ContentEditable Flow types by @zurfyx in #4652
- Check for specific excluded props by @fantactuka in #4655
- Fix reconciler recovery listeners by @fantactuka in #4654
- Fix clipboard if content editable is in an iframe. by @imdreamrunner in #4649
- Add columns next to selection by @PeterBul in #4663
- Normalize select all on NodeSelection by @zurfyx in #4664
- Override selectall on RangeSelection by @zurfyx in #4671
- feat: playground inline image plugin by @58bits in #4423
- Fix dropdown menu position in playground when scroll by @xinyuan0801 in #4496
- Remove delay from flakey E2E test by @thegreatercurve in #4676
- Remove outdated examples by @thegreatercurve in #4684
- Preserving language and indentation of code block when serialized/deserialized by @ebads67 in #4682
- Additional fix for editor._window in lexical-clipboard by @imdreamrunner in #4686
- Swap noopener for noreferrer by @acconrad in #4690
- Allow table selection when cells are already selected by @PeterBul in #4699
- correction : line 47 - create -> update by @abhishekkumar35 in #4704
- Table selection keyboard controls by @fantactuka in #4689
- Keeping local comments and sharedCommentsArray orders in sync by @ebads67 in #4721
- Image resizer fix by @fantactuka in #4722
- Fix: Use $createListItemNode within importJSON to override on deserialization by @kazukinagata in #4717
- Improve md error message by @acywatson in #4710
- Fixed drop down buttons to prevent sumbit by @Ou7law007 in #4727
- Show excalidraw edit button by @ibastawisi in #4731
- Context Menu Options Added by @Shubhankerism in #4713
- Remove instanceof checks in onPasteForPlainText by @acywatson in #4737
- Fix code block export by @fantactuka in #4702
- Fix multi-line token parsing by @fantactuka in #4741
- Add RangeSelection docs by @acywatson in #4742
- Fix flowtypes for cut/copy commands by @fantactuka in #4746
- Add EditorRef plugin by @acywatson in #4747
- Allow preventing text drag by @fantactuka in #4749
- Add selection adjustments for node removal by @fantactuka in #4745
- Fix missing token type by @fantactuka in #4751
- Add video links to Getting Started docs by @acywatson in #4752
- Fix $transferStartingElementPointToTextPoint() by @amyworrall in #4756
- Fixes broken trunk by @fantactuka in #4763
- Flow key down command by @zurfyx in #4766
- Reset editor state when setting null root by @fantactuka in #4762
- Update listeners.md by @mohammadreza490 in #4768
New Contributors
- @maximshipko made their first contribution in #4580
- @kalvin807 made their first contribution in #4570
- @msdrigg made their first contribution in #4592
- @navanshu made their first contribution in #4598
- @agentraghav made their first contribution in #4588
- @JatinRanka made their first contribution in #4616
- @mbongard made their first contribution in #4620
- @imdreamrunner made their first contribution in #4649
- @PeterBul made their first contribution in #4663
- @58bits made their first contribution in #4423
- @acconrad made their first contribution in #4690
- @abhishekkumar35 made their first contribution in #4704
- @kazukinagata made their first contribution in #4717
- @Ou7law007 made their first contribution in #4727
- @amyworrall made their first contribution in #4756
- @mohammadreza490 made their first contribution in #4768
Full Changelog: v0.11.1...v0.11.2
v0.11.1
0.11.1 (2023-05-26)
Changelog
- Fix update-changelog not finishing by @zurfyx in #4537
- Max length recalculation. Fix #4542 by @fantactuka in #4543
- Arrow up selection fix #4536 by @fantactuka in #4544
- Mutations to respect canInsertBeforeAfter by @zurfyx in #4553
- Add key to portal to avoid decorator component remounting by @fantactuka in #4554
- Fix flow by @zurfyx in #4549
- Fire selection change on decorator delete by @acywatson in #4555
- v0.11.1 by @zurfyx in #4563
Full Changelog: v0.11.0...v0.11.1
v0.11.0
v0.11.0
v0.11.0 (2023-05-23)
Arguably no major new features but this version comes with substantial bugfixes! Most notably:
- Proper support for tabs
- Remove redundant spaces on paste
- Revised triple click heuristics
- Fixed NodeSelection clicks on Android
- Revised deletion heuristics style retention
- Revised
createRectsFromDOMRange
for Mark-like plugins
(you can read more on these on the changelog below)
LexicalContextMenu (experimental)
While we strongly advocate for a11y and features that work across devices, there is significant demand for desktop users to have access to tooling via the right click. UX-wise, they're very familiar with it as it's common within other editors such as the well-known Google Docs, Pages and Microsoft Word and it's also the fastest.
LexicalContextMenu is a WIP and not ready for production but the prototype is already live in the Playground under a feature flag (see the gear on the bottom left to enable it /?shouldUseLexicalContextMenu=true
)
Changelog
- Change
MarkNode::clone
node
arg type tothis
by @potomak in #4363 - Fall back to url if parser fails by @acywatson in #4364
- Inherit format for text entity node by @fantactuka in #4382
- Collapsible enhancements by @fantactuka in #4257
- Improve responsiveness of the floating text format toolbar buttons by @ChronicLynx in #4298
- Setting initial state of isSmallWidthViewport by @ebads67 in #4398
- Make DecoratorBlockNode.isInline return false by @egonbolton in #4383
- Add docs for list package by @acywatson in #4393
- Flow table bg color types by @zurfyx in #4400
- Use provided selection when serializing to HTML by @acywatson in #4392
- Fix markdown list merging by @acywatson in #4387
- Fix list merging by @acywatson in #4386
- Optional colrowSpan serialization by @zurfyx in #4344
- Split test files and skip flaky tests in linux + collab by @acywatson in #4394
- Fix HistoryPlugin selection out of sync by @zurfyx in #4390
- Remove unused styles by @thorn0 in #4426
- simplify logic for the fix "Improve responsiveness of the floating text format toolbar buttons" by @AlessioGr in #4431
- Updated Toolbar Plugin to Add keyboard shortcut for adding hyperlinks by @AnuragBalhra in #4413
- Fix text click selection on touch devices #3098 by @ibastawisi in #4395
- Allow to pass all possible attributes to a content editable div by @kazimirchuk in #4450
- Revisit touch devices by @zurfyx in #4441
- fix: attach event listeners to initial nodes by @OriginalEXE in #4454
- Disable flaky test by @zurfyx in #4455
- Add documentation for TabIndentationPlugin by @mrPaintMan in #4453
- Select all adjustments by @fantactuka in #4425
- Handle empty element deletion by @fantactuka in #4380
- Tab support by @zurfyx in #4436
- Event delegation for NoteEventPlugin by @fantactuka in #4424
- Generalize Menu Logic by @tylerjbainbridge in #4284
- Sanitize floatingLinkEditor by @acywatson in #4462
- Improve rect deduplication by @acywatson in #4471
- Tests for inserting text either side of an inline element by @shirakaba in #4346
- exportDOM methods for HeadingNode, QuoteNode by @ivailop7 in #4445
- Sanitize url by @acywatson in #4483
- Add text/uri-list support in clipboard. by @xinyuan0801 in #4478
- Fix Flow types by @zurfyx in #4485
- TypeAheadMenu and TableActionMenu rendered off screen fixed. by @Shubhankerism in #4301
- Fix GC memory leak by @zurfyx in #4510
- Adjust selection after triple click by @fantactuka in #4512
- Fix GC memory leak (2) by @zurfyx in #4513
- Make tabs flexible in code by @zurfyx in #4520
- Allow arbitrary awareness fields in Collaboration plugin by @attnov in #4507
- Fix clickable link plugin #4514 by @fantactuka in #4519
- Add HTML deserialization recipe to docs by @ivailop7 in #4432
- Allow importing width and height from table cell and DOM nodes by @GMchris in #4521
- Basic Context Menu (behind Switch) by @tylerjbainbridge in #4285
- Auto embed fix #4530 by @fantactuka in #4535
- Tame wild white spaces by @zurfyx in #4467
- v0.11.0 by @zurfyx in #4539
New Contributors (since v0.9.1)
- @khanakia made their first contribution in #4209
- @donotlb made their first contribution in #4192
- @nemophrost made their first contribution in #4216
- @howlowck made their first contribution in #4229
- @bencarletonn made their first contribution in #4237
- @yjhtry made their first contribution in #4263
- @aleksandr-kiliushin made their first contribution in #4277
- @umaranis made their first contribution in #4310
- @MohitSinghChauhan made their first contribution in #4318
- @potomak made their first contribution in #4363
- @thorn0 made their first contribution in #4426
- @AnuragBalhra made their first contribution in #4413
- @ibastawisi made their first contribution in #4395
- @kazimirchuk made their first contribution in #4450
- @OriginalEXE made their first contribution in #4454
- @mrPaintMan made their first contribution in #4453
- @shirakaba made their first contribution in #4346
- @xinyuan0801 made their first contribution in #4478
- @Shubhankerism made their first contribution in #4301
- @attnov made their first contribution in #4507
- @GMchris made their first contribution in #4521
Full Changelog: v0.10.0...v0.11.0
v0.10.0
0.10.0 (2023-04-18)
Breaking Changes
@lexical/link will now sanitize anchor tag hrefs before rendering them to the DOM. This provides a measure of protection against XSS attacks
that rely on inlining javascript in that attribute. However, it means that links using less common protocols will now be sanitized (converted to about:blank),
which will be a breaking change for any existing links.
Like most other node-based logic in Lexical, the sanitization logic can be overriden by overriding LinkNode using the Node Overrides API and replacing it with a node that implements the sanitizeUrl method differently.
Fixes CVE-2023-30792
- Table feature: background color (#4345) Gerard Rovira
- Add @react/LexicalClickableLinkPlugin (#4316) Gerard Rovira
- TablePlugin feature: cell merge (#4343) Gerard Rovira
- Ban javascript URLs in @lexical/link (#4342) Acy Watson
- Table Cell Background Color (#4306) Gerard Rovira
- ExportDOM in Debug Tree View (#4307) Ivaylo Pavlov