v0.42.0

Rheosoph/flow-likev0.42.0Mar 19, 2026by etrepum

AI Summary

This release focuses on significant improvements to table and link handling, along with a major refactoring of code highlighting packages. It introduces new APIs for node copying and leaf insertion, while moving experimental features out of the core.

Key Highlights

  • Prism highlighting extracted to `@lexical/code-prism` package
  • New `$copyNode` API with `resetOnCopyNodeFrom` hook for resetting ephemeral state
  • New `$insertNodeIntoLeaf` utility to prevent splitting inline nodes during insertion
  • Enhanced table selection and nested table support
  • ESLint 9+ support with flat configuration for the eslint plugin

Breaking Changes

  • Prism highlighting extracted from `@lexical/code` to `@lexical/code-prism`
  • Experimental `hasFitNestedTables` functionality moved to the playground

New Features

  • `resetOnCopyNode` configuration for NodeState
  • `$insertNodeIntoLeaf` utility in `@lexical/utils`
  • LexicalExtensionEditorComposer and NestedEditorExtension support
  • Merge adjacent LinkNodes with identical attributes

Full Release Notes

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:

* ๐Ÿงน #8229 #8235 #8226 #8241 Add and fix afterCloneFrom and accessor implementations

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

## New Contributors
* @m-santanna made their first contribution in https://github.com/facebook/lexical/pull/8209
* @WhyBusyy made their first contribution in https://github.com/facebook/lexical/pull/8214
* @takenosuke-code made their first contribution in https://github.com/facebook/lexical/pull/8215
* @Jynx2004 made their first contribution in https://github.com/facebook/lexical/pull/8220
* @dabrpio made their first contribution in https://github.com/facebook/lexical/pull/8224
* @karesansui-u made their first contribution in https://github.com/facebook/lexical/pull/8235

**Full Changelog**: https://github.com/facebook/lexical/compare/v0.41.0...v0.42.0