v0.5.0 (20 days after v0.4.0) comes with a meaty set of features, API refinements and bugfixes.
Draggable blocks
One of the most beloved features of Notion is the ability to seamlessly move blocks within the same document. @LuciNyan has ported this behavior to Lexical under the DraggableBlockPlugin name. You can check it out in our playground!
2022-09-14.23.41.11.mov
LexicalTablePlugin makes its way to Meta production
We started our tables (@lexical/react/LexicalTablePlugin) development at the start of the year, one of the most ambitious and complex plugins we have built for rich text. We have blocked a good amount of time during this past month to work with multiple internal teams to identify and squash most of these (10+) high-pri bugs that make the experience unideal and we believe they are now in a good shape to meet their first internal users.
Shadow Root
We have introduced a new advanced concept for Lexical ElementNodes: [Shadow Root](https://lexical.dev/docs/api/classes/lexical.ElementNode#isshadowroot)
. A Shadow Root is a Node that behaves like a root (we stole the name from Shadow DOM). This method enables you to have complex deep rich text hierarchies where children node shouldn't see beyond the parent. For example, the cell node content.
$insertNodes with NodeSelection and GridSelection support
We introduced a seamless way to handle node insertion. We bundled {rangeSelection/nodeSelection/gridSelection}.insertNode
into just one method: $insertNodes
. We also added insertNodes support for NodeSelection and GridSelection that was previously not supported.
Screen.Recording.2022-07-13.at.3.37.18.pm.mov
Various API changes
- PlainTextPlugin and RichTextPlugin will no longer take an
initialEditorState
. We found that this is unintuitive to handle nested editors and harder to control SSR-enabled pages. Instead, MLCComposer will take and apply theinitialEditorState
on editor creation - We killed INERT nodes. We found them cumbersome to use, not accessible and they didn't meet the requirements for our one and only use case (AutocompletePlugin) where private node data is required. Instead, the recommended approach for now is to use a DecoratorNode.
- We deprecated the Grid API. The future of the Grid API is uncertain but if there's something we know is that it isn't a good fit in the
lexical
package, it serves a very specific use case and it's redundant for plain text. - Killed isTopElement in favor for isInline on ElementNodes to reflect what they do better.
- And some more (see [0.5] prefixed in the list below).
Lots of bugfixes
- Formatting, composition, MD, etc. (see changelog below for a complete list).
Release automation: nightly releases
We listened to your (mostly Discord) feedback, you want to have the latest, more frequently, especially when some of you are heavily involved into the development and growth of the Lexical framework.
The reality is, we didn't choose to postpone releases for 2 weeks. It has mostly been a lack of automation and making sure we bundle breaking API changes to avoid developer churn.
We know that there's no one-size-fits-all when it comes to developers, and that's why we want to offer different ways to play with the library, what we have now, a slow-ish but less time-consuming (for you) release cycle but also offer nightly releases that would happen automatically once per day and would include the very latest of the development.
The work is still under development but we plan to start this soon, stay tuned!
Changelog
- Fix bug where transforms are inherited by nested editors by @trueadm in #2947
- Add an experimental Table component in React by @trueadm in #2929
- Fix Changelog by @acywatson in #2956
- Add table cell menu back by @tylerjbainbridge in #2958
- Fix Flow Type by @acywatson in #2957
- fix typo on read-mode / edit-mode page by @digitalgopnik in #2962
- Fix link breaking when formatting on by @pgmccullough in #2954
- feat: allow escaped markdown within TextFormatTransformer by @digitalgopnik in #2964
- Fix bugs with isEditable by @trueadm in #2967
- Add empty comment in front of 'export' in a bundled file by @fantactuka in #2970
- Automated releases by @acywatson in #2949
- Update collab errors, related cleanup by @fantactuka in #2971
- Add npm install step by @acywatson in #2972
- Improve docs around the React plugins page by @trueadm in #2976
- Set up Git config by @acywatson in #2977
- Clean up redundant newlines during pasting by @fantactuka in #2969
- Push config by @acywatson in #2979
- Fix versioning for ff merge by @acywatson in #2983
- Remove ff merge from release by @acywatson in #2984
- Fixed exportDOM for paragraph node by @zifahm in #2981
- docs: Fix URL of rich-text and plain-text by @kimulaco in #2985
- docs: loadContent clarification by @ly3xqhl8g9 in #2989
- Fix Insert Column Header Bug by @tylerjbainbridge in #2995
- Fix WWW import rewrite for React by @zurfyx in #2996
- Fix www exports by @fantactuka in #2994
- [Automated Releases] Add logging and dry run to release script by @acywatson in #2986
- [0.5] Add DEPRECATED prefix to Grid APIs by @trueadm in #2966
- Rm unused helpers from older markdown code by @fantactuka in #2998
- ElementNode -> isTopLevel() by @zurfyx in #3001
- Capture pendingDecorators after garbage collecting detached decorators by @adri1wald in #2999
- Fix bad TypeaheadMenuPlugin prod build by @zurfyx in #3003
- Fix $insertTableColumn flow type by @zurfyx in #3005
- Trim content for newlines only by @fantactuka in #3006
- Strengthen RangeSelection dirty toggle by @trueadm in #3007
- add install step to release workflow by @acywatson in #3008
- Revert md changes from #3001 by @fantactuka in #3015
- [0.5] Correct definition of isTopLevel; introduce DecoratorNode->isInline, ElementNode->isShadowRoot by @zurfyx in #3009
- [0.5] Remove INERT mode by @zurfyx in #2421
- Add FAQ re: clearing editor by @acywatson in #3019
- $insertNodes: Selection-agnostic node insertion with Grid/Node selection support by @zurfyx in #2638
- Fix code highlighter race condition on transform by @zurfyx in #3014
- [0.5] Revise usage of root node vs shadow by @zurfyx in #3022
- getStyleObjectFromCSS to compute when cache miss by @zurfyx in #3024
- [0.5] $wrapLeafNodesInElements -> $wrapNodes by @zurfyx in #3020
- [0.5] Treat undefined selection the same as null in $generateNodesFromHtml by @acywatson in #2948
- Add optional cursors container prop for a better positioning in scrollable layouts by @fantactuka in #3025
- [0.5] Make $canShowPlaceholder isEditable mandatory by @zurfyx in #3030
- [0.5] Remove initialEditorState from Plain/RichTextPlugin by @zurfyx in #3032
- [0.5] Remove deprecated initialEditorState from OnChangePlugin by @zurfyx in #3031
- feat(lexical-react): add initialEditorState for LexicalCollaborationPlugin by @strdr4605 in #3011
- Update collab docs by @fantactuka in #3033
- Add position property to menus & disable floating link toolbar for autolink nodes by @tylerjbainbridge in #3035
- Fix nested mark creation when wrapping forward selection by @knpwrs in #3027
- Fix composition text boundary for canInsertTextAfter by @zurfyx in #3045
- Revise Vite compression by @zurfyx in #3036
- Fix (Known) Table Bugs by @tylerjbainbridge in #3000
- Add Selection View in DevTools by @noi5e in #2955
- Fix initialEditorState flow by @zurfyx in #3048
- Improve table selection handling when there are no siblings by @tylerjbainbridge in #3051
- Refine Typeahead isOpen logic. by @tylerjbainbridge in #3052
- Fix Table Deletion by @tylerjbainbridge in #3053
- Dispatch CAN_{REDO,UNDO}_COMMAND after clearing history by @wilbertom in #3056
- feat(lexical-playground): draggable block by @LuciNyan in #2860
- feat: add export/import DOM for horizontal rule node by @samuelmartineau in #3057
- v0.5.0 by @zurfyx in #3059
New Contributors
- @pgmccullough made their first contribution in #2954
- @zifahm made their first contribution in #2981
- @kimulaco made their first contribution in #2985
- @ly3xqhl8g9 made their first contribution in #2989
- @adri1wald made their first contribution in #2999
- @strdr4605 made their first contribution in #3011
- @knpwrs made their first contribution in #3027
- @wilbertom made their first contribution in #3056
Full Changelog: v0.4.1...v0.5.0
Thank you open-source community for your help shaping this brand new release, either via direct PR contributions, feedback or bug reports!