npm @lexical/react 0.42.0
v0.42.0

latest release: 0.42.1-nightly.20260320.0
8 hours ago

v0.42.0 is a monthly release with a huge number of fixes and features from a lot of new contributors. The most notable fixes are related to tables, links, extensions, and markdown. @lexical/eslint-plugin is now fully compatible with eslint 9+. The production builds are also now generated in an ascii-only format which may considerably reduce memory usage in some deployment environments.

Breaking Changes

Prism highlighting extracted from @lexical/code #8198

Prism highlighting now lives in @lexical/code-prism and the Prism related functionality in @lexical/code is now deprecated. Transitionally, there is a @lexical/code-core package which has the implementation of Lexical's code functionality without a Prism dependency.

Experimental hasFitNestedTables has been moved to the playground #8210

Due to its experimental nature and incomplete implementation, the in-progress hasFitNestedTables functionality has been moved to the playground

New APIs

lexical - $copyNode + LexicalNode.resetOnCopyNodeFrom & NodeState resetOnCopyNode

After $copyNode is used it now calls copiedNode.resetOnCopyNodeFrom(originalNode) which will reset every NodeState that has resetOnCopyNode: true in its configuration. Subclasses can override this method to reset other "ephemeral" state such as whether a ListNodeItem is checked or not.

Note that this does not influence serialization or copy and paste operations, it only affects calls to $copyNode.

@lexical/utils - $insertNodeIntoLeaf

The current behavior RangeSelection.insertNodes can split an inline ElementNode (e.g. a LinkNode) when inserting content, even if that content is also inline and could be a child of the given node. $insertNodeIntoLeaf is now provided to insert a node without splitting any containing nodes.

Highlights

Core:

  • ๐Ÿงน #8190 Change EditorThemeClasses from type to interface
  • โœ… #8218 Respect CSS scroll-padding in scrollIntoViewIfNeeded
  • โœ… #8220 deleteWord now behaves the same as deleteCharacter when at the edge of an ElementNode
  • ๐Ÿ†• #8221 resetOnCopyNode configuration to NodeState and LexicalNode.resetOnCopyNodeFrom hook
  • ๐Ÿ†• #8219 LexicalEditor RootListener and EditableListener can return unregister callbacks
  • โœ… #8222 Consecutive Linebreak insertion now preserves selection format

Code:

  • โš ๏ธ #8198 Extract Prism highlighting code to @lexical/code-prism and add @lexical/code-core to provide a dependency that does not include Prism. @lexical/code remains backwards compatible with Prism included, but you should migrate to using highlighting from @lexical/code-shiki or @lexical/code-prism.

Devtools:

  • โœ… #8230 Clean up strict mode useLexicalCommandsLog behavior

Extension:

  • ๐Ÿ†• #8202 LexicalExtensionEditorComposer, NestedEditorExtension, and fixed SharedHistoryExtension with playground refactor

Markdown:

  • โœ… #8170 Enforce CommonMark flanking rules for trailing spaces
  • โœ… #8192 Update backslash handling to comply with CommonMark
  • โœ… #8211 Convert tabs to TabNode on import

Link:

  • โœ… #8165 Enable autolink matching when unlinked
  • ๐Ÿ†• #8236 Merge adjacent LinkNodes with identical attributes

Eslint Plugin:

  • ๐Ÿงน #8227 Add flat configuration and full eslint 9+ support for @lexical/eslint-plugin

List:

  • ๐Ÿ†• #8213 Create copies of ListNode/ListItemNode in split-like operations

React:

  • ๐Ÿงน#8199 Remove deprecated ContextMenu, consolidate menu rendering with backward-compatible menuRenderFn

Table:

  • โœ… #8187 Use monolithic listener for SELECTION_CHANGE_COMMAND and deselection handler
  • โœ… #8193 Improve nested table selection by using monolithic pointer event handling
  • โœ… #8195 Prevent single-cell table selection after exiting table selection
  • โœ… #8200 Call $handleTableSelectionChangeCommand once instead of per-table
  • ๐Ÿงน #8215 Add test for mouse leaving browser window during table selection
  • โš ๏ธ #8210 hasFitNestedTables functionality moved to the playground
  • โœ… #8234 Handle table selections crossing into/out of nested tables

Utils:

  • ๐Ÿ†• #8206 Add $insertNodeIntoLeaf with example usage in playground DateTimeNode

Misc:

Infrastructure

  • ๐Ÿงน #8239 Upgrade rollup packages and configure terser for ascii_only output

Playground:

  • โœ… #8186 Add fallback for dimensionless images to prevent collapse
  • ๐Ÿงน #8188 Remove legacy events mode
  • ๐Ÿ†• #8183 Nested tables resize themselves with hasFitNestedTables: true
  • โœ… #8214 Use inline style for LayoutContainerNode import
  • โœ… #8228 Fix cursor position after EquationNode
  • โœ… #8224 make clear formatting work on multiple paragraphs

What's Changed

  • v0.41.0 by @etrepum in #8166
  • Update examples for v0.41.0 by @etrepum in #8171
  • [lexical] Chore: Fix minimatch CVE-2026-26996 in example projects by @thatmichael85 in #8169
  • Fix cross-spawn vulnerability (CVE-2024-21538) by removing child-process-promise by @thatmichael85 in #8177
  • [lexical] Security: Fix qs vulnerability (CVE-2025-15284) by @thatmichael85 in #8176
  • [lexical-markdown] Fix: enforce CommonMark flanking rules for trailing spaces by @Sa-Te in #8170
  • [lexical] Chore: Fix form-data CVE-2025-7783 in root lockfile by @thatmichael85 in #8174
  • [lexical] Security: Fix @isaacs/brace-expansion vulnerability (CVE-2026-25547) by @thatmichael85 in #8175
  • [lexical] Chore: Fix rollup CVE-2026-27606 across all lockfiles by @thatmichael85 in #8173
  • Fix rollup CVE-2026-27606 in example project lockfiles by @thatmichael85 in #8182
  • [lexical-link] Bug Fix: Enable autolink matching when it unlinked by @levensta in #8165
  • [lexical-playground] Fix: add fallback for dimensionless images to prevent collapse by @Sa-Te in #8186
  • [lexical-playground] Chore: Remove legacy-events mode by @levensta in #8188
  • [lexical] Chore: Change alias from type to interface for EditorThemeClasses by @levensta in #8190
  • [lexical-table] Refactor: use monolithic listener for table SELECTION_CHANGE_COMMAND and deselection handler by @randal-atticus in #8187
  • [lexical-table][lexical-playground] Feature: nested tables resize themselves if hasFitNestedTables: true by @randal-atticus in #8183
  • [lexical-markdown] Bug Fix: update backslash escape handling to align with CommonMark by @kimseongyu in #8192
  • [lexical-table] Bug Fix: Improve nested table selection by using monolithic pointer event handling by @randal-atticus in #8193
  • [lexical-code] Breaking Change: Extract Prism code highlighting to @lexical/code-prism (with internal module @lexical/code-core to avoid circular import) by @etrepum in #8198
  • [lexical-table] Bug Fix: Prevent single-cell table selection after exiting table selection by @randal-atticus in #8195
  • [lexical-react] Revert revert: Remove deprecated ContextMenu, consolidate menu rendering with backward-compatible menuRenderFn by @thatmichael85 in #8199
  • [lexical-table] Refactor: Call $handleTableSelectionChangeCommand once instead of per-table by @randal-atticus in #8200
  • [lexical-website] Bug Fix: Removed blog route from lexical.dev by @m-santanna in #8209
  • [lexical-playground] Fix: use inline style for LayoutContainerNode import by @WhyBusyy in #8214
  • [lexical-table] Chore: add test for mouse leaving browser window during table selection by @takenosuke-code in #8215
  • [lexical-utils][lexical-playground] Feature: Add $insertNodeIntoLeaf and insert deeply DateTimeNode by @levensta in #8206
  • [lexical] Bug Fix: respect CSS scroll-padding in scrollIntoViewIfNeeded by @takenosuke-code in #8218
  • [lexical] Bug Fix: When the editor starts with an empty list item, pressing ctrl+backspace (deleteWord) should replace the list with a paragraph by @Jynx2004 in #8220
  • [lexical][lexical-list][lexical-markdown] Feature: resetOnCopyNode configuration to NodeState and LexicalNode.resetOnCopyNodeFrom hook by @etrepum in #8221
  • [lexical] Feature: LexicalEditor RootListener and EditableListener can return unregister callbacks by @etrepum in #8219
  • [lexical-markdown][lexical-playground] Bug Fix: Convert tabs in TabNode at import by @lytion in #8211
  • [lexical] Fix: Consecutive Linebreak insertion resets selection format by @Jynx2004 in #8222
  • [lexical-table][lexical-playground] Breaking change: Move hasFitNestedTables logic to Playground plugin by @randal-atticus in #8210
  • [lexical-website] Fix: Correct the mistake in the argument in the example on the Updates page by @levensta in #8225
  • [lexical-list] Fix: create copies ListNode/ListItemNode in split-like operations by @levensta in #8213
  • [lexical-link]: Refactor: add afterCloneFrom method to LinkNode/AutoLinkNode by @levensta in #8226
  • [lexical] Fix: Fixing cursor position after inline equation, fix block equations by @Jynx2004 in #8228
  • [lexical-eslint-plugin] Chore: update @lexical/eslint-plugin for better eslint 9+ support, finish jest to vitest migration by @etrepum in #8227
  • [lexical-playground] Bug fix: make clear formatting work on multiple paragraphs by @dabrpio in #8224
  • [lexical-code][lexical-mark][lexical-react][lexical-table][lexical-rich-text][lexical-link] Bug Fix: Add and fix afterCloneFrom implementations by @etrepum in #8229
  • [lexical-extension][lexical-react] Feature: LexicalExtensionEditorComposer, NestedEditorExtension, and fixed SharedHistoryExtension with playground refactor by @etrepum in #8202
  • [lexical-playground] Chore: Remove unused code from playground TablePlugin by @etrepum in #8231
  • [lexical-devtools-core] Bug Fix: Clean up strict mode useLexicalCommandsLog behavior by @etrepum in #8230
  • [lexical-rich-text] Bug Fix: use writable node in HeadingNode.setTag by @karesansui-u in #8235
  • build(deps): bump next from 15.5.11 to 16.1.7 in /scripts/tests/integration/fixtures/lexical-esm-nextjs by @dependabot[bot] in #8232
  • [lexical-link] Feature : Merge adjacent LinkNodes with identical attributes by @achaljhawar in #8236
  • [lexical-table] Bug Fix: handle table selections crossing into/out of nested tables by @randal-atticus in #8234
  • [*] Chore: Upgrade rollup packages and configure terser for ascii_only output by @etrepum in #8239
  • [lexical-playground][lexical-react] Bug Fix: Fix accessor implementations to use getLatest/getWritable consistently by @etrepum in #8241

New Contributors

Full Changelog: v0.41.0...v0.42.0

Don't miss a new react release

NewReleases is sending notifications on new releases.