v0.26.0
facebook/lexicalv0.26.0Mar 1, 2025by etrepum
AI Summary
A monthly release featuring the experimental NodeState API and significant refactoring of selection logic, including making CollapsibleContainerNode a shadowRoot.
Key Highlights
- Experimental NodeState API added to all nodes.
- Refactored `RangeSelection.getNodes()` using new NodeCaret APIs.
- CollapsibleContainerNode is now a shadowRoot.
- Removed deprecated default exports from `@lexical/react`.
Breaking Changes
- `ElementNode.collapseAtStart` now traverses inline elements under certain conditions.
- Deprecated default exports in `@lexical/react` have been removed.
- CollapsibleContainerNode is now a shadowRoot.
New Features
- NodeCaret API for tree traversal.
- Bullet item style matches text style.
- Unified vite dev/prod configurations.
Full Release Notes
v0.26.0 is a monthly release packed with bug fixes and a major new experimental feature, the NodeState API (#7117). ## Breaking Changes Core: - #7248 As a follow-up to https://github.com/facebook/lexical/pull/7180 the collapseAtStart logic now continues through both inline and non-inline nodes so long as there are no previous siblings, roots, or shadow roots encountered. This is because nodes such as CollapsibleTitleNode had a collapseAtStart that returns true but contain nodes that are not inline and have a collapseAtStart that returns false (e.g. ParagraphNode). In order to fix an inconsistency for how nested !isInline elements behave, CollapsibleContainerNode is now a shadowRoot. The CollapsibleContentNode was already a shadowRoot. This is now similar to the situation for tables where both TableNode and TableCellNode are both shadowRoot. The fix here also moved collapseAtStart from CollapsibleTitleNode to CollapsibleContainerNode which makes a bit more sense since the whole container gets collapsed, not just the title. The title is still the only location that you can initiate this collapse from, since it is always the first child. React: - #7219 Exports from `@lexical/react` that had been deprecated since v0.16.0 (June 2024) have been removed: - All default exports were removed, each module has a named export - The inconsistently named `@lexical/react/LexicalTableOfContents` was moved to `@lexical/react/LexicalTableOfContentsPlugin` ## Highlights Core: - 🆕 #7117 Experimental [Node State](https://lexical.dev/docs/concepts/node-replacement#node-state-experimental): Add a generic state property to all nodes. More documentation and examples to come in the next few weeks. New APIs: - [createState](https://lexical.dev/docs/api/modules/lexical#createstate) - [$getState](https://lexical.dev/docs/api/modules/lexical#getstate) - [$getStateChange](https://lexical.dev/docs/api/modules/lexical#getstatechange) - [$setState](https://lexical.dev/docs/api/modules/lexical#setstate) - 🆕 #7135 Refactor RangeSelection.getNodes() to use NodeCaret APIs. Introduces new APIs with a total ordering for PointCaret and getting common ancestors. - [$comparePointCaretNext](https://lexical.dev/docs/api/modules/lexical#comparepointcaretnext) - [$getCommonAncestor](https://lexical.dev/docs/api/modules/lexical#getcommonancestor) - [$getCommonAncestorResultBranchOrder](https://lexical.dev/docs/api/modules/lexical#getcommonancestorresultbranchorder) - ✅ #7225 deleteCharacter through ListNode->ListItemNode (applies to nested !isInline elements in general) - ✅ #7256 Point.isBefore could return incorrect result due to normalization - ✅ #7239 Fix selection shifting when deleting paragraphs on Android Chrome - ✅ #7226 Added isInline implementations to TextNode and LineBreakNode Collab: - ✅ #7217 Normalize multiple adjacent merge conflicts in one block List: - ✅ #7225 Retain selection styling when exiting nested list - 🆕 #7024 Bullet item style matches text style Mark: - ✅ #7255 Identify `<mark>` as an inline element Playground: - ✅ #7233 Image component rerenders on every editor update - ✅ #7229 Table action menu dropdown positioning - 🆕 #7208 Playground dev/prod vite configs have been unified and example vite configurations have been refactored to allow for `npm run monorepo:dev` command which runs the examples with the version of lexical in the repository (useful for developing examples based on unreleased features, or debugging situations that are difficult to create in the playground) Table: - ✅ #7213 Prevent adjacent cell selection on triple-click React: - ✅ #7237 Ensure attributes are set immediately on menu - ✅ #7264 Menu element not cleaned up on unmount - ✂️ #7219 Remove deprecated default exports ## What's Changed * 2024 recap shortcut by @zurfyx in https://github.com/facebook/lexical/pull/7223 * v0.25.0 by @etrepum in https://github.com/facebook/lexical/pull/7221 * [Breaking Change][lexical/react] Chore: Remove deprecated default exports by @kirandash in https://github.com/facebook/lexical/pull/7219 * [lexical-yjs] Bug Fix: Normalize multiple adjacent merge conflicts in one block by @james-atticus in https://github.com/facebook/lexical/pull/7217 * [lexical-table] Docs: Fix @lexical/table README.md by @etrepum in https://github.com/facebook/lexical/pull/7224 * [@lexical/list] Feature: export `ListNodeTagType` by @DaniGuardiola in https://github.com/facebook/lexical/pull/7228 * [lexical-list] Bug Fix: retain selection styling when exiting nested list by @mrdivyansh in https://github.com/facebook/lexical/pull/7225 * [lexical-playground] fix: hard coded theme classes for table hover actions by @umaranis in https://github.com/facebook/lexical/pull/7182 * [*] Feature: Add linter to check that flow types are consistent with typescript types by @etrepum in https://github.com/facebook/lexical/pull/7230 * [lexical-playground] Refactor: Image component rerenders on every editor update by @jvithlani in https://github.com/facebook/lexical/pull/7233 * [lexical][lexical-code] Refactor: Use NodeCaret to implement RangeSelection.getNodes() by @etrepum in https://github.com/facebook/lexical/pull/7135 * [lexical-list] Bullet item color matches text color by @ivailop7 in https://github.com/facebook/lexical/pull/7024 * [lexical-table] Bug Fix: Prevent adjacent cell selection on triple-click by @kirandash in https://github.com/facebook/lexical/pull/7213 * [lexical-react] fix: ensure attributes are set immediately on menu by @sodenn in https://github.com/facebook/lexical/pull/7237 * [Update] Upgrade docusaurus version by @lilshady in https://github.com/facebook/lexical/pull/7244 * [Breaking Changes][lexical][lexical-list][lexical-playground] Bug Fix: deleteCharacter through ListNode->ListItemNode by @etrepum in https://github.com/facebook/lexical/pull/7248 * [lexical] fix typo in Caret error msg by @potatowagon in https://github.com/facebook/lexical/pull/7249 * [fix] Add missing flow types for node event plugin by @fantactuka in https://github.com/facebook/lexical/pull/7252 * [lexical-playground] Bug Fix Table Action Menu dropdown positioning by @umaranis in https://github.com/facebook/lexical/pull/7229 * [lexical][lexical-utils] Chore: Add some missing flow types for NodeCaret and table related functionality by @etrepum in https://github.com/facebook/lexical/pull/7253 * [lexical-playground][examples/*] Refactor: Unify vite dev/prod/example configurations by @etrepum in https://github.com/facebook/lexical/pull/7208 * [lexical][lexical-mark] Bug Fix: Identify <mark> as inline element by @PeterDekkers in https://github.com/facebook/lexical/pull/7255 * [lexical] Feature: add a generic state property to all nodes by @GermanJablo in https://github.com/facebook/lexical/pull/7117 * [lexical] Bug Fix: Point.isBefore could return incorrect result due to normalization by @etrepum in https://github.com/facebook/lexical/pull/7256 * [@lexical/react] Bug Fix: anchor element not cleanup when component unmount by @yuanyan in https://github.com/facebook/lexical/pull/7264 * Fix selection shifting when deleting paragraphs on android by @waynetee in https://github.com/facebook/lexical/pull/7239 * [lexical] Chore: Added missing `isInline` function to TextNode by @mrdivyansh in https://github.com/facebook/lexical/pull/7226 ## New Contributors * @DaniGuardiola made their first contribution in https://github.com/facebook/lexical/pull/7228 * @jvithlani made their first contribution in https://github.com/facebook/lexical/pull/7233 * @sodenn made their first contribution in https://github.com/facebook/lexical/pull/7237 * @lilshady made their first contribution in https://github.com/facebook/lexical/pull/7244 * @PeterDekkers made their first contribution in https://github.com/facebook/lexical/pull/7255 * @yuanyan made their first contribution in https://github.com/facebook/lexical/pull/7264 **Full Changelog**: https://github.com/facebook/lexical/compare/v0.25.0...v0.26.0