v0.24.0

facebook/lexicalv0.24.0Feb 7, 2025by etrepum

AI Summary

A release focusing on build optimization, core editor fixes, and table alignment support.

Key Highlights

  • CommonJS production builds optimized with terser.
  • Editor focus is now synchronous when called inside an update.
  • Table alignment support added.
  • Reverse DFS iterator added to utils.

Breaking Changes

  • `insertList` and `removeList` are deprecated; use `$insertList` and `$removeList`.
  • List commands now update synchronously when dispatched.

New Features

  • Terser optimization for CommonJS builds.
  • Custom `syncCursorPositions` function for collab.
  • Table alignment feature.
  • Reverse DFS iterator.

Full Release Notes

## Breaking Changes

Build:

* 🆕 #7047 All commonjs prod builds are now optimized with terser instead of the unmaintained closure compiler

Core editor:

* ✅ #7037 `editor.focus()` now happens synchronously when called from inside of an update, as if it was implemented with a command dispatch. Previously it would defer which is confusing behavior because the expected side-effect is to change the selection which you really do want to happen synchronously.

Lexical List:

* 🆕 #7037 `insertList` and `removeList` are now deprecated, use `$insertList` and `$removeList` instead
* ✅ #7037 `INSERT_CHECK_LIST_COMMAND`, `INSERT_ORDERED_LIST_COMMAND`, `INSERT_UNORDERED_LIST_COMMAND` and `REMOVE_LIST_COMMAND` now update synchronously when dispatched from inside an update, rather than deferring a nested update (this is the expected behavior for commands)

## Highlights

Core editor:

* ✅ Fix: Infinite loop when splitting invalid ListItemNode #7037
* ✅ Fix: Handle MutationObserver/input event re-ordering when using contentEditable inside of an iframe #7045
* ✅ Fix: Normalize selection after applyDOMRange to account for Firefox differences #7050
* ✅ Fix: triple click around inline elements (links) #7055
* ✅ Fix: iOS Autocorrect strips formatting by reporting wrong dataType #5789
* ✅ Fix: In the Safari browser, during the compositing event process, the delete key exhibits unexpected behavior #7061
* ✅ Fix: Chrome on android deletion bugs #7122

Collab:

* 🆕 Feature: Allow passing in custom `syncCursorPositions` function to collab hook #7053
* ✅ Fix: handle text node being split by Yjs redo #7098

List:

* ✅ Fix: Prevent error when calling formatList when selection is at root by #6994
* ✅ Fix: ListItemNode serialization throws #7116

Mark:

* 🆕 Feature: include inline decorator nodes in marks #7086
* ✅ Fix: $wrapSelectionInMarkNode with element points #7132

Markdown:

* ✅ Fix: support link and inline code text formats #7004

Playground:

* ✅ Fix: Columns Layout Item Overflow #7066
* 🆕 Feature: TableOfContents Scroll smooth behaviour #7069
* ✅ Fix: prevent growing whitespaces in markdown table toggle #7041
* ✅ Fix: Ensure Delete Node handles all node types #7096

React:

* ✅ Fix: Import `JSX` type from React to prevent "Cannot find namespace 'JSX'"-error when type-checking with React 19 #7080

Table:

* 🆕 Feature: Support table alignment #7044
* ✅ Fix: Prevent error if pasted table has empty row #7057

Utils:

* 🆕 Feature: Add reverse dfs iterator #7107 #7112

Build:

* 🆕 All commonjs prod builds are now optimized with terser instead of the unmaintained closure compiler #7047 
* ✅ Change fork modules to use production only when NODE_ENV explicitly set to production #7065

## What's Changed
* v0.23.1 by @etrepum in https://github.com/facebook/lexical/pull/7035
* [Breaking Change][lexical][lexical-selection][lexical-list] Bug Fix: Fix infinite loop when splitting invalid ListItemNode by @etrepum in https://github.com/facebook/lexical/pull/7037
* Clean up nested editor update by @ivailop7 in https://github.com/facebook/lexical/pull/7039
* [lexical] Bug Fix: Handle MutationObserver/input event re-ordering when using contentEditable inside of an iframe by @etrepum in https://github.com/facebook/lexical/pull/7045
* [Breaking Change][*] Chore: Use terser for optimizing cjs prod build by @etrepum in https://github.com/facebook/lexical/pull/7047
* [*] Bug Fix: Use GITHUB_OUTPUT instead of GITHUB_ENV for size-limit action by @etrepum in https://github.com/facebook/lexical/pull/7051
* [lexical] Bug Fix: Normalize selection after applyDOMRange to account for Firefox differences by @etrepum in https://github.com/facebook/lexical/pull/7050
* Revert [Breaking Change][lexical] Bug Fix: Commit updates on editorSetRootElement(null) (#7023) by @potatowagon in https://github.com/facebook/lexical/pull/7052
* [lexical-table] Support table alignment by @ivailop7 in https://github.com/facebook/lexical/pull/7044
* fix: triple click around inline elements (links) by @fantactuka in https://github.com/facebook/lexical/pull/7055
* [lexical-yjs] Feature: Allow passing in custom `syncCursorPositions` function to collab hook by @amanharwara in https://github.com/facebook/lexical/pull/7053
* fix: iOS Autocorrect strips formatting by reporting wrong dataType by @redstar504 in https://github.com/facebook/lexical/pull/5789
* [lexical-list] Bug Fix: Prevent error when calling formatList when selection is at root by @amanharwara in https://github.com/facebook/lexical/pull/6994
* [lexical-table] Bug Fix: Prevent error if pasted table has empty row by @amanharwara in https://github.com/facebook/lexical/pull/7057
* docs: Change "here" link to more descriptive text by @6TELOIV in https://github.com/facebook/lexical/pull/7058
* [lexical] Bug Fix: In the Safari browser, during the compositing event process, the delete key exhibits unexpected behavior. by @EruditionTu in https://github.com/facebook/lexical/pull/7061
* Change fork modules to use production only when NODE_ENV explicitly set to production by @etrepum in https://github.com/facebook/lexical/pull/7065
* [lexical-playground] Fix Columns Layout Item Overflow by @ivailop7 in https://github.com/facebook/lexical/pull/7066
* [lexical-playground] plugins TableOfContent Scroll smooth behaviour A… by @mshaheerz in https://github.com/facebook/lexical/pull/7069
* Unrevert [Breaking Change][lexical] Bug Fix: Commit updates on editor.setRootElement(null) #7023 by @potatowagon in https://github.com/facebook/lexical/pull/7068
* [playground] Bug fix: prevent growing whitespaces in markdown table toggle by @potatowagon in https://github.com/facebook/lexical/pull/7041
* Fix: Use already defined RegisteredNodes type by @hellovuki in https://github.com/facebook/lexical/pull/7085
* [lexical] Chore: Rename variable and add comments for Safari compositing workaround by @EruditionTu in https://github.com/facebook/lexical/pull/7092
* [lexical-react] Bug Fix: Import `JSX` type from React to prevent "Cannot find namespace 'JSX'"-error when type-checking with React 19 by @Svish in https://github.com/facebook/lexical/pull/7080
* [lexical-yjs] Bug Fix: handle text node being split by Yjs redo by @james-atticus in https://github.com/facebook/lexical/pull/7098
* Lexical Docs: 2 updates to spelling README.md by @DocAdam in https://github.com/facebook/lexical/pull/7102
* Selection | Lexical: 1 Spelling Update Update selection.md by @DocAdam in https://github.com/facebook/lexical/pull/7103
* Creating a React Plugin: 1 Grammar Update - Update create_plugin.md by @DocAdam in https://github.com/facebook/lexical/pull/7104
* Working with DOM Events: 2 Spelling and Grammar Updates Update dom-ev… by @DocAdam in https://github.com/facebook/lexical/pull/7105
* Listeners Lexical: 3 updates to spelling and grammar - Update listeners.md  by @DocAdam in https://github.com/facebook/lexical/pull/7100
* [lexical-playground] Bug Fix: Ensure Delete Node handles all node types by @mshaheerz in https://github.com/facebook/lexical/pull/7096
* [lexical-utils] Feature: add reverse dfs iterator by @nigelgutzmann in https://github.com/facebook/lexical/pull/7107
* [lexical-utils] Fix: Modify $reverseDfs to be a right-to-left variant of $dfs by @etrepum in https://github.com/facebook/lexical/pull/7112
* [lexical-mark] Feature: include inline decorator nodes in marks by @james-atticus in https://github.com/facebook/lexical/pull/7086
* Fix ListItemNode serialization throws by @zurfyx in https://github.com/facebook/lexical/pull/7116
* [workflow] disable size-limit job by @potatowagon in https://github.com/facebook/lexical/pull/7125
* [workflow] Delete size limit report by @potatowagon in https://github.com/facebook/lexical/pull/7128
* cleanup size-limit by @potatowagon in https://github.com/facebook/lexical/pull/7129
* [lexical-playground] Fix: Replace icon with Twitter with X by @awjae in https://github.com/facebook/lexical/pull/7127
* [lexical][lexical-mark] Bug Fix: $wrapSelectionInMarkNode with element points by @etrepum in https://github.com/facebook/lexical/pull/7132
* [lexical-react] Refactor: Replace `React$Context` with `React.Context` by @SamChou19815 in https://github.com/facebook/lexical/pull/7137
* [lexical-markdown] Bug Fix: support link and inline code text formats by @AlessioGr in https://github.com/facebook/lexical/pull/7004
* [lexical] Bug Fix: Fix Chrome on android deletion bugs by @waynetee in https://github.com/facebook/lexical/pull/7122
* [bugfix] Fix flow typedef for links plugin to include attributes by @fantactuka in https://github.com/facebook/lexical/pull/7145
* [ci] Chore: Remove SSH_KEY secret by @etrepum in https://github.com/facebook/lexical/pull/7143
* [ci] Bug Fix: Force tag update so create release branch can be run multiple times by @etrepum in https://github.com/facebook/lexical/pull/7146

## New Contributors
* @redstar504 made their first contribution in https://github.com/facebook/lexical/pull/5789
* @6TELOIV made their first contribution in https://github.com/facebook/lexical/pull/7058
* @EruditionTu made their first contribution in https://github.com/facebook/lexical/pull/7061
* @mshaheerz made their first contribution in https://github.com/facebook/lexical/pull/7069
* @hellovuki made their first contribution in https://github.com/facebook/lexical/pull/7085
* @Svish made their first contribution in https://github.com/facebook/lexical/pull/7080
* @nigelgutzmann made their first contribution in https://github.com/facebook/lexical/pull/7107
* @awjae made their first contribution in https://github.com/facebook/lexical/pull/7127
* @waynetee made their first contribution in https://github.com/facebook/lexical/pull/7122

**Full Changelog**: https://github.com/facebook/lexical/compare/v0.23.1...v0.24.0