Happy halloween!
108 commits! That's 66% more than 0.5.0. This release comes with many many fixes. But let's go over the highlights first:
Nightly releases
We just introduced a semi-automated release process for those of you who want to be at the cutting edge (looking at you Discord folks). New versions with the latest on the main branch will be pushed Monday through Friday.
You can find on NPM tagged with next
(npm i lexical@next
)
These will likely be more unstable, informal and might contain undocumented breaking changes. That said, that's what we do internally at Meta where we sync the Lexical GitHub repository onto Mercurial multiple times per week.
Collapsible container
The possibility to do spoiler containers has been a highly requested feature. We prototyped an efficient React-agnostic playground plugin that you can find on the playground (CollapsiblePlugin). It may eventually make it to @lexical/react
Screen.Recording.2022-10-31.at.8.22.21.AM.mov
Drag, drop & paste
Having seen many and very similar drag & drop implementations at Meta, we have come to the conclusion that dragging, dropping and pasting media is a fundamental piece of rich text. Hence, it is now built-in into the RichTextPlugin and you no longer have to implement your own event handling.
198162758-c02516c7-3ed5-45ed-b4a1-7bdd177f9a2d.mov
See the DragDropPaste playground plugin for an example on how to validate and insert your media nodes into the editor.
Failsafe DecoratorNodes
Safety first! React Decorators will now be independently wrapped with an ErrorBoundary and Suspense.
We found that it is very easy to miss either of them when implementing custom DecoratorNodes, and when either is missed and the component either crashes or suspends this causes the editor to be unusable.
195731936-a30b2397-9bf8-4f1c-97d7-9893b083ed98.mov
Breaking change: you now have to provide an ErrorBoundary to RichTextPlugin (you can use ours).
import {LexicalErrorBoundary} from 'lexical/@react/LexicalErrorBoundary';
<RichTextEditor ... ErrorBoundary={LexicalErrorBoundary} />
Editor namespace on TreeView
From internal and open-source feedback, TreeView has become an indispensable tool to work with Lexical. It gives you the ability to glance over the current state and understand how plugins work with each other.
We added the namespace and the editable state, which we feel is important to complement the read-only mode version of Lexical.
Note that, while you can convert to HTML for the read-only view, Lexical size and the possibility to have high-fidelity rendering at no cost makes it a perfect candidate for to place in a read-only mode.
In any case, @im-adithya continues the work on the cross-browser extension, what will be the preferred and most complete approach for day-to-day development.
And some more
- Added the
discrete
property toeditor.update
to perform synchronous non-batched updates. Synchronous updates are often terrible performance-wise but there are concrete occasions where they can come useful. TL;DR be careful! - You can now have custom collaboration cursor color.
- Copying a Node and Grid selection (like one or multiple images) now works with Firefox.
- Various fixes for tables, remarkably mouse selection which was acting weird sometimes.
Changelog
- Update intro.md by @crisshaker in #3064
- Update theming.md by @crisshaker in #3067
- fix(lexical-clipboard): pasting from google docs by @LuciNyan in #3063
- Update faq.md to fix error of clearing contents by @Mark-Fenng in #3070
- chore(lexical-playground): add resizability back to regular tables by @Dattaya in #3068
- Add oncall annotation by @thegreatercurve in #3071
- Fix oncall annotation issue missing from some files by @thegreatercurve in #3075
- Fix Resize and Scroll Positioning on Typeahead/Node Menu by @tylerjbainbridge in #3079
- fix(lexical-playground): read-only mode by @LuciNyan in #3081
- Removed extra 'is' in line 9 by @Boye95 in #3083
- Add some inline documentation by @acywatson in #3076
- Merge markdown E2E tests into one file by @thegreatercurve in #3086
- Add open/close callbacks to menu plugins by @tylerjbainbridge in #3087
- Add logic to catch separators by @thegreatercurve in #3084
- Tweet fallback to text on copy by @zurfyx in #3088
- Double-trigger hack for high-fidelity Node/Grid selection by @zurfyx in #3080
- Add collapsible container plugin by @fantactuka in #3082
- Make onClose optional on Flow Types. by @tylerjbainbridge in #3091
- Fix flow for $insertGeneratedNodes by @zurfyx in #3101
- chore: add e2e test for draggable-block-plugin by @LuciNyan in #3090
- copyToClipboard to return success by @zurfyx in #3105
- Fix DOM availability check by @fantactuka in #3102
- Lower key navigation command priority for Tables by @tylerjbainbridge in #3107
- Typeaheads: Add scroll command and increase priority by @tylerjbainbridge in #3106
- Typeaheads: Remove hard-coded "bottom" alignment (Breaking change) by @tylerjbainbridge in #3104
- fix(lexical-playground): draggable blockplugin uses unexposed apis by @LuciNyan in #3109
- Update createHeadlessEditor to match createEditor typedef by @fantactuka in #3111
- Fix npm install on M1 macs by @Timebutt in #3114
- Fix typeahead import by @fantactuka in #3117
- [0.6] More Typeahead Changes by @tylerjbainbridge in #3112
- Fix GridSelection comparison by @zurfyx in #3118
- Fix table paste by @zurfyx in #3129
- Add className prop to typeahead plugin by @acywatson in #3124
- Fix typeahead ref typedef by @fantactuka in #3131
- Fix Dynamic Table Options on Playground Component Picker by @tylerjbainbridge in #3132
- Support multiple classes by @acywatson in #3134
- Typeahead Menu Flow types by @acywatson in #3133
- Ignore mutations which do not have target node by @Piliuta in #3120
- Add Emoji Picker to Playground by @tylerjbainbridge in #3122
- feat: add icons to extension and change build by @im-adithya in #3140
- FF Node/Grid copy-paste support by @zurfyx in #3147
- remove repeated comments by @Zuckjet in #3154
- Ignore empty class names in addClassNamesToElement by @acywatson in #3159
- ref(selection): separate @lexical/selection/index into multiple files by @tranqhuy46 in #3145
- Check if DOM is accessible when calling
getSelection
by @yongdamsh in #3162 - Fix linting error in EmojiPicker by @thegreatercurve in #3165
- Fix flow types for root.select() by @fantactuka in #3168
- Remove development notice by @trueadm in #3171
- TreeView editor basics by @zurfyx in #3153
- Fix copy-paste CodeBlock with BR by @zurfyx in #3174
- Fix nested editor cut by @fantactuka in #3177
- Fix insertNodes when replacing content adjacent to an inline element by @birtles in #3137
- docs: Fixed broken link by @SimonProper in #3190
- Make the ComponentPicker independent of the Toolbar by @EgonBolton in #3142
- Nightly and Dev releases by @acywatson in #3192
- Add flushSync option to update() by @fantactuka in #3119
- Built-in Error/SuspenseBoundaries for React DecoratorNodes by @zurfyx in #3178
- Add type to commands for logging by @thegreatercurve in #2942
- fix: play
time travel
after reaching maximum range by @shanpriyan in #3197 - v0.5.1-next.0 by @acywatson in #3201
- Change release workflows by @acywatson in #3203
- Fix when the selection is anchored to the end of a text node followed by a non-text node by @birtles in #3116
- chore: optimize svg by @harish-sethuraman in #3199
- Fix sample code (lexical-react) by @shinshin86 in #3206
- fix: draggable block icon is invisible in read-only mode by @karam-qaoud in #3198
- Fix frozen selection by @acywatson in #3204
- v0.5.1-next.1 by @acywatson in #3205
- Allow Block change with GridSelection by @tylerjbainbridge in #3212
- Refine backspace handling in Tables by @tylerjbainbridge in #3213
- fix: fixed dual text appearance problem and removed outline scrollbar by @karam-qaoud in #3207
- Don't apply element based offsets to text nodes in $patchStyleText by @birtles in #3126
- Fix TableSelection Mouse Up Propagation Bug by @tylerjbainbridge in #3223
- Memoize ErrorBoundary by @zurfyx in #3225
- Handle bad list item children gracefully by @zurfyx in #3226
- Add SerializedMarkNode flow type by @acywatson in #3228
- Allow overriding mark node create function by @acywatson in #3229
- Fix typos in Markdown documentation by @miktirr in #3236
- Fix list paste issue by @acywatson in #3239
- Expose Tokenizer interface to accept custom tokenizer other than Prism at @lexical/code by @saint1991 in #3243
- Handle left part of match by @Neewd in #3245
- chore: add new
eslint-plugin
with ruleno-optional-chaining
locally by @shanpriyan in #3233 - pref(lexical-playground): reduce rendering consumption by creating compositing layers by @LuciNyan in #3069
- Allow skipping auto-scroll action on selection change by @Piliuta in #3220
- Fix error boundary fallback by @fantactuka in #3249
- Improve logistics around table/grid selection by @tylerjbainbridge in #3251
- Allow clearing styles with $patchStyleText by @birtles in #3247
- Refactor
isHighlighting
flag into object literal by @thegreatercurve in #3256 - Select end if root has no children in focus logic by @thegreatercurve in #3254
- Add inline plugin example for images by @akmarzhan1 in #3216
- v0.5.1-next.2 by @acywatson in #3269
- Revert "v0.5.1-next.2" by @acywatson in #3272
- Do not reconcile terminating linebreak for inline elements by @fantactuka in #3268
- Use set for highlighting cache by @thegreatercurve in #3258
- Fix paste CodeNode leak and and empty links by @zurfyx in #3194
- Revert "Select end if root has no children in focus logic" by @acywatson in #3276
- Copy styles to new object when patching by @acywatson in #3273
- Fix nodesOfType return type by @acywatson in #3262
- Improve Collab cursor, add custom cursorColor by @strdr4605 in #3248
- Add root theme class by @fantactuka in #3277
- selection.modify to respect ShadowRoot by @zurfyx in #3279
- Fix initial content tables initialization by @fantactuka in #3281
- Drag & drop & paste with precision by @zurfyx in #3274
- Release on matching tag push to main by @acywatson in #3284
- filter by branch by @acywatson in #3285
- v0.5.1-next.2 by @acywatson in #3286
- Handle quotes in increment-version changelog by @zurfyx in #3291
- Preserve selection for pending state by @fantactuka in #3293
- Keep selection if state was not cloned by @fantactuka in #3294
- Optional decorator nodes selection with keyboard navigation by @Piliuta in #3292
- [0.6] Make RichTextPlugin ErrorBoundary mandatory by @zurfyx in #3295
- Release on push to main when ref contains pre-release identifier by @acywatson in #3297
- 0.6.0 by @zurfyx in #3296
New Contributors
- @crisshaker made their first contribution in #3064
- @Mark-Fenng made their first contribution in #3070
- @Boye95 made their first contribution in #3083
- @Timebutt made their first contribution in #3114
- @Piliuta made their first contribution in #3120
- @Zuckjet made their first contribution in #3154
- @tranqhuy46 made their first contribution in #3145
- @yongdamsh made their first contribution in #3162
- @birtles made their first contribution in #3137
- @SimonProper made their first contribution in #3190
- @EgonBolton made their first contribution in #3142
- @shinshin86 made their first contribution in #3206
- @miktirr made their first contribution in #3236
- @saint1991 made their first contribution in #3243
- @Neewd made their first contribution in #3245
- @akmarzhan1 made their first contribution in #3216
Full Changelog: v0.5.0...v0.6.0
Thank you open-source community for helping us shape yet another version! Happy halloween and back to coding 👨💻