NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm, #4968 most downloaded on npm
This package contains misc utilities for Lexical.
Latest stable
0.53.0
Last release 10 days ago
10 Nov 2026
Ships on a steady schedule
a new release about every 8 days
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
5 years old
724 releases · first in 2022
Drag across the ruler to compare, or tap a release to open it.
v0.49.1-nightly.20260824.0
v0.49.1-nightly.20260824.0
v0.49.1-nightly.20260821.0
v0.49.1-nightly.20260821.0
v0.49.1-nightly.20260820.0
v0.49.1-nightly.20260820.0
Your coding agent can read these notes before it upgrades. Set up the MCP server →
v0.49.1-nightly.20260819.0
v0.49.1-nightly.20260819.0
v0.49.1-nightly.20260818.0
v0.49.1-nightly.20260818.0
v0.49.1-nightly.20260817.0
v0.49.1-nightly.20260817.0
v0.49.1-nightly.20260814.0
v0.49.1-nightly.20260814.0
v0.49.1-nightly.20260813.0
v0.49.1-nightly.20260813.0
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
…for Lexical's built-in node classes (#8640), a breaking change that replaces per-node getType()/clone()/importJSON()/importDOM()/transform() boilerpla…
v0.49.0 is a monthly release headlined by the completion of the $config() protocol migration for Lexical's built-in node classes (#8640), a breaking change that replaces per-node getType()/clone()/importJSON()/importDOM()/transform() boilerplate with runtime-synthesized behavior. It ships with a cluster of follow-up fixes hardening the synthesized getType() and clone() (including a stack overflow in compiled builds), an opt-in sticky horizontal scrollbar for overflowing tables, and a broad batch of fixes across tables, Markdown, HTML, code highlighting, and selection.
lexical — Built-in node classes are ported to the $config() protocol. The static importJSON(), importDOM(), clone(), and transform() methods are no longer present on ported nodes; use the higher-level equivalents instead (LexicalEditor.parseEditorState/$generateNodesFromDOM, the $cloneWithProperties helper, and extensions or $transform in $config). getType() is unchanged and safe to keep using, __type is now readonly, and node constructors require zero-argument defaults. Custom nodes may keep their static methods, but adopting $config() is recommended (#8640)lexical — LexicalCommand<T>'s payload type is now invariant to prevent unsafe structural compatibility between commands. Previously correct code (including explicit generics) needs no changes; only unsafe LexicalCommand<unknown> usage must switch to the newly exported AnyLexicalCommand alias. dispatchCommand's payload argument is now optional when a command's payload type is undefined or void, and redundant explicit type parameters were dropped from the registerCommand/registerNodeTransform call sites (#8877)@lexical/table — Opt-in sticky horizontal scrollbar for tables wider than their container, so the scrollbar stays anchored at the viewport bottom instead of only being reachable at the end of the table. Enable it with hasStickyScrollbar: true in the table config; style it via the new tableStickyScrollbar theme key (#8790)@lexical/table — The <colgroup> element is now omitted from the table DOM when column widths are undefined, producing cleaner markup and letting the browser auto-size columns; it is created or removed dynamically as widths change (#8850)lexical — Added an editor operation benchmark suite (paragraph split, bold formatting, range deletion, paste, select-all format) measured through full DOM reconciliation, to help contributors track core editing performance (#8856)@lexical/table — $createTableSelection is deprecated in favor of $createTableSelectionFrom, which takes the table node plus anchor/focus cells and validates them, instead of returning a blank selection with placeholder 'root' keys that must be overwritten (#8855)@lexical/table — getShape() is deprecated because it computes incorrect bounds for merged cells; use the now-exported $computeTableCellRectBoundary (with $computeTableMap) instead (#8853)$config() follow-ups (#8640)
clone() now applies afterCloneFrom() when called directly (e.g. NodeClass.clone(node)), fixing silent property loss across 25+ core nodes (#8864)getType() no longer returns the superclass type when inherited, fixing node-type collisions during editor registration (#8867)getType() no longer recurses infinitely when a bundler copies it onto a subclass as an own static, fixing stack overflows in compiled/minified builds (#8869)Tables
DELETE_LINE_COMMAND (Cmd/Ctrl-based delete-line shortcuts) now works inside table cells instead of being silently swallowed (#8851)Selection & editing
editor.read()) now run in a fresh writable update instead of being silently dropped, with a dev warning (#8863)Markdown, HTML & code
p, .foo) against all elements instead of only tag-matched ones (#8873)QuoteNode.updateDOM now accepts the EditorConfig argument the reconciler passes to every other node, for API consistency (#8882)Playground & website
Full Changelog: v0.48.0...v0.49.0
lexical, @lexical/rich-text, @lexical/link, @lexical/mark, @lexical/hashtag, @lexical/table, @lexical/code, @lexical/extension, @lexical/react: Built-in nodes use $config(); static methods not for callers (#8640)
Built-in node classes are ported to $config(). Static
transform() is gone from ported classes; static clone(),
importJSON() and importDOM() have wider types and are not intended to
be called. __type is readonly, and constructors need zero-argument
defaults. getType() is unchanged.
Detect: calls such as ParagraphNode.clone(, TextNode.importJSON(,
HeadingNode.importDOM(, or .transform() on a built-in node class;
subclasses that call super static methods or assign __type.
Migration: use $cloneWithProperties(node) instead of clone;
editor.parseEditorState or $generateNodesFromSerializedNodes (from
@lexical/clipboard) instead of importJSON; $generateNodesFromDOM
instead of importDOM; extensions or $transform in $config instead of
transform.
lexical: LexicalCommand<T> is invariant in its payload type (#8877)
LexicalCommand used to ignore its payload type, so any command was
assignable to any other. It now carries a brand that makes the payload type
invariant (in Flow it is an opaque type), so a command is only assignable
to a LexicalCommand of exactly its own payload type. registerCommand
infers its payload type from both the command and the listener, which must
now agree exactly, narrower or wider. dispatchCommand's payload is
optional for void / undefined commands. Runtime behavior is unchanged,
and no built-in command's payload type changed.
Detect: TypeScript errors such as Argument of type 'LexicalCommand<KeyboardEvent | null>' is not assignable to parameter of type 'LexicalCommand<KeyboardEvent>' after upgrading, from:
registerCommand listeners whose parameter annotation differs from the
command's payload, such as
editor.registerCommand(KEY_ENTER_COMMAND, (event: KeyboardEvent) => ...)
(the payload of KEY_ENTER_COMMAND is KeyboardEvent | null), or a
shared handler declared as (event: KeyboardEvent) => boolean passed for
it;function press(command: LexicalCommand<KeyboardEvent>, event: KeyboardEvent)
called with KEY_ENTER_COMMAND;LexicalCommand<unknown> used to mean "any command" (arrays, maps,
parameters);registerCommand that do not match the
command's payload;createCommand.Migration: let TypeScript infer the listener's parameter, or annotate it
with the command's exact payload (CommandPayloadType<typeof KEY_ENTER_COMMAND>)
and handle every case it allows (for KEY_ENTER_COMMAND, null). Make
helpers generic over the payload, or give them the exact payload type. Use
AnyLexicalCommand for "any command", and drop explicit generics on
registerCommand.
// Before
editor.registerCommand(
KEY_ENTER_COMMAND,
(event: KeyboardEvent) => onEnter(event),
COMMAND_PRIORITY_LOW,
);
function press(command: LexicalCommand<KeyboardEvent>, event: KeyboardEvent) {
editor.dispatchCommand(command, event);
}
// After
editor.registerCommand(
KEY_ENTER_COMMAND,
event => (event ? onEnter(event) : false),
COMMAND_PRIORITY_LOW,
);
function press<P>(command: LexicalCommand<P>, payload: P) {
editor.dispatchCommand(command, payload);
}
Codemod: none.
@lexical/table: $createTableSelection deprecated (#8855)
Replacement: $createTableSelectionFrom.
Removal: not scheduled.
@lexical/table: TableSelection.getShape() deprecated (#8853)
Replacement: $computeTableMap with $computeTableCellRectBoundary.
Removal: not scheduled.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Fixed a serialize-javascript dependency vulnerability
v0.48.0 is a maintenance release focused on bug fixes across Markdown, tables, lists, links, and selection. It's headlined by a fix for a v0.46.0 regression that broke native text drag-and-drop (#8842) and a couple of notable security hardening fixes. It also adds a handful of new features, including an MdastHtmlExtension with examples for authoring custom Markdown constructs (collapsibles, kbd, alerts, footnotes), a customizable Yjs shared-type root name for collaborative editing, and new table row manipulation helpers.
@lexical/table — Added $moveTableRow for reordering table rows, plus the previously missing $unmergeCellNode export (#8833)@lexical/yjs / @lexical/react — The Yjs shared-type root name is now customizable, so Lexical can share a Yjs document with other content that uses a different root key (#8841)@lexical/extension / @lexical/mdast — Added MdastHtmlExtension and Markdown custom-construct examples (collapsible sections, kbd, alerts, footnotes) demonstrating how to extend the Markdown ↔ mdast pipeline. See the Markdown & mdast serialization guide (#8826)Drag & drop (fix for v0.46.0 regression)
dragover for text drags, so native drops work again (#8842)Security
LinkNode.sanitizeUrl() now fails closed on unparseable URLs, preventing a potential XSS vector (#8846)serialize-javascript dependency vulnerability (#8803)Markdown & code
Tables
Lists & character limit
OverflowNodes in useCharacterLimit (#8831)Links & selection
scrollIntoViewIfNeeded when the selection rect is above the editor, fixing a Safari RTL caret jump (#8848)Full Changelog: https://github.com/facebook/lexical/compare/v0.47.0...v0.48.0
@lexical/list: Backspace at the start of a top-level list item turns it into a paragraph (#8829)
registerList (used by ListExtension and ListPlugin) now handles
KEY_BACKSPACE_COMMAND at COMMAND_PRIORITY_BEFORE_EDITOR, before the
@lexical/rich-text handler. With a collapsed caret at the start of a
top-level list item, Backspace turns the item into a paragraph, splitting
the list around it when items follow. Before, Backspace at the start of a
top-level item joined it to the end of the block above (the previous item,
or a paragraph before the list); that now takes a second Backspace. Nested
items were already outdented.
ListItemNode.collapseAtStart changed to match and now returns boolean
instead of true. That widened return type is filed here rather than as
breaking because callers only test the result, and overrides that return
true still type check.
Verify: Backspace at the start of top-level list items, including tests that
expect the item to join the block above, and any
KEY_BACKSPACE_COMMAND handler of your own at COMMAND_PRIORITY_EDITOR or
lower that expects to see this keystroke in a list item.
@lexical/extension: $applyFormatToDom deprecated (#8826)
Replacement: applyFormatToDom (the function does not need an active editor).
Removal: not scheduled.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
[lexical] Chore: Fix tmp package dependency vulnerability (#8802) by @vijayojha89
v0.47.0 is a monthly release with a lot of bug fixes, particularly related to IME and composition, and is headlined by two new experimental packages:
@lexical/mdast (#8794) — a micromark/mdast-based alternative to @lexical/markdown. Parsing, serialization, and markdown shortcuts all go through the same parser used by remark, so CommonMark + GFM compliance comes for free and there is no second grammar to keep in sync. The original syntax of each construct is preserved on the nodes, so re-serializing produces minimally different Markdown. @lexical/markdown remains the supported default for production apps. See the new Markdown with @lexical/mdast guide.@lexical/a11y (#8591) — framework-agnostic accessibility helpers (ARIA live regions, focus management, roving tab index, focus trap) usable from React, Svelte, Vue, Solid, or vanilla DOM, with React wrappers shipping from @lexical/react. The playground adopts them as part of a WCAG AA reference pass, and the keyboard contracts Lexical follows are documented in the new Keyboard Accessibility guide.Beyond the headliners: React 18 is now the baseline (see Breaking Changes), the playground gains Find and Replace and a Ruby annotation node with a floating editor, tables learn to spread pasted TSV across cells and get row/column header utilities, and there is a long list of IME/composition, selection, and navigation fixes.
Special recognition once again goes to @mayrang who has been plowing through IME, accessibility, and other input related issues as well as the really cool new Find and Replace and Ruby Annotations playground features.
@lexical/react / @lexical/devtools-core — React 17 support dropped (#8782)React 18 is now the minimum supported version; the react / react-dom peerDependencies require >=18, and React 17 compatibility code paths were removed. If you are already on React 18 or 19, no changes are required.
lexical — DOM element preserved when composing on a segmented TextNode (#8784)Starting IME composition in the middle of a segmented TextNode (e.g. a mention) previously replaced the node — destroying its DOM element and breaking the browser's composition tracking (caret flashing and styling bleed on Chrome). The node now temporarily switches to normal mode for the duration of composition, keeping the same node key and DOM element, and is cleaned up when composition ends. Subclass transforms or method overrides that assume a segmented node is always in segmented mode must account for this transient state — see the updated TextNode.setMode() documentation.
lexical — $getDocument() returns the owner document of the active editor (correct inside a Shadow DOM or iframe), falling back to the global document when there is no active editor; a new @lexical/eslint-plugin rule enforces its use over the document global (#8788, #8813)lexical — registerEventListener / registerEventListeners, type-safe addEventListener helpers that return cleanup functions, now used throughout the codebase — see the updated Working with DOM Events guide (#8767)lexical — SET_TEXT_FORMAT_COMMAND sets (rather than toggles) the selection's text format (see Commands); the same PR fixes formatText toggle direction (#8807)@lexical/markdown — $generateNodesFromMarkdownString parses a markdown string into Lexical nodes without inserting them into the document or modifying the selection (#8789)@lexical/table — $setTableRowIsHeader and $setTableColumnIsHeader utilities (#8815); $insertTableRowAtNode and $insertTableColumnAtNode are now exported (#8791)IME, composition & mobile
InputState (#8809); refactored IME composition test infrastructure with browser-level coverage (#8793)Selection & navigation
deleteLine no longer removes adjacent block decorators (#8744)$setBlocksType properly handles block-end focus in backward selections (#8753); insertNodes re-resolves a detached firstBlock (#8764)deleteCharacter no longer overwrites the X11 PRIMARY selection via Selection.modify (#8774)onUpdate callbacks during nested commits (#8672)Markdown, code & tables
TabNode inside code blocks (#8752)Playground & website
extends for type parameter bound in registerEventListeners flow type (#8778) by @potatowagonFull Changelog: https://lexical.dev is the project site; compare view: https://github.com/facebook/lexical/compare/v0.46.0...v0.47.0
@lexical/react, @lexical/devtools-core: React 18 is the minimum (#8782)
Peer dependencies require react and react-dom >=18.
Detect: react below 18 in your package.json.
Migration: upgrade React to 18 or later.
lexical: Segmented TextNode switches to normal during IME composition (#8784)
Composing in the middle of a segmented TextNode keeps the
node and its DOM, temporarily switching it to normal mode until
composition ends.
Detect: transforms or overrides that assume a segmented node is always in segmented mode (for example mention nodes).
Migration: handle the transient normal mode.
Verify: IME input inside mentions or other segmented nodes.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
build(deps): bump webpack-dev-server to >=5.2.4 (CVE-2026-6402) by @xiezhenjia-meta in https://github.com/facebook/lexical/pull/8632
v0.46.0 is a monthly release headlined by two major new experimental capabilities:
editorStateThis release also includes many other fixes and new features across IME/composition, collaboration, markdown round-tripping, lists, code blocks, links, and mobile keyboards. It is also our first release (other than nightlies) to use NPM Trusted Publishing.
Special recognition for this release goes to @mayrang for doing the majority of the work on both of these new features as well as fixing some tricky IME/composition issues 👏 @levensta has also been doing a fantastic job going through the issue backlog, providing valuable feedback on these bleeding edge features, and identifying long-standing edge cases.
lexical — Node traversal methods no longer accept unsafe type parameters (#8661)The zero-argument generics on getParent(OrThrow), getPreviousSibling(s), getNextSibling(s), getChildren, getFirstChild(OrThrow), getLastChild(OrThrow), getChildAtIndex, getFirstDescendant, getLastDescendant, and getDescendantByIndex were implicit unchecked casts — there is no inference site, so any non-base type argument was equivalent to an as cast. Each method is now an overload pair: a documented non-generic signature returning the base type (LexicalNode / ElementNode | null), plus the old generic signature marked @deprecated. Code that leaned on contextual-type inference no longer type-checks:
// Before: compiled (unsound). After: type error.
const node: ParagraphNode | null = $getRoot().getFirstChild();
// Port directly with an explicit cast (no behavior change):
const node = $getRoot().getFirstChild() as ParagraphNode | null;
// Or, better, narrow with a guard:
const node = $getRoot().getFirstChild();
if ($isParagraphNode(node)) { /* node: ParagraphNode */ }
Existing getFirstChild<ParagraphNode>()-style calls still compile but are now deprecated and will be removed in a future release. This is a types-only change with no runtime impact.
lexical — $getNearestNodeFromDOMNode(rootElement) now returns RootNode (#8588)The "selection captured outside of Lexical" mechanism is generalized beyond DecoratorNode subtrees: setDOMUnmanaged(dom, {captureSelection: true}) now marks any subtree (e.g. a DOMRenderExtension override or a getDOMSlot widget) as selection-captured, and isDOMCapturingSelection(dom) walks ancestors so a descendant <input> reports as captured. As part of this, the root element now carries a __lexicalKey_* stash, so $getNodeFromDOM / $getNearestNodeFromDOMNode resolve the root element to the RootNode instead of null. Two call sites become more correct (drop-on-root in clipboard, table-selection→range conversion), but external callers that relied on $getNearestNodeFromDOMNode(rootElement) returning null must update. The internal-only $isSelectionCapturedInDecorator was removed.
lexical — insertNodes preserves a leading linebreak; managed <br>s are now tagged (#8615)RangeSelection.insertNodes now preserves the first LineBreakNode when inserting inline content ahead of a block element, instead of silently dropping it. Separately, the reconciler-inserted "managed" line breaks (the otherwise-invisible <br>s Lexical adds so the caret can land in empty lines) are now identifiable in the DOM as <br data-lexical-managed-linebreak="true"> — and, on iOS Safari, an analogous <img data-lexical-managed-linebreak="true" …> in some cases. DOM/HTML snapshot test expectations may need to ignore or expect this attribute. Closes #3980.
@lexical/html and node extensions — DOMImportExtension rules now register implicitly (#8662) (experimental)The experimental DOM-import pipeline no longer requires you to list a per-package import extension. Each node-providing extension (RichTextExtension, ListExtension, LinkExtension, TableExtension, CodeExtension) now registers its own import rules, and the standalone RichTextImportExtension / ListImportExtension / LinkImportExtension / TableImportExtension / CodeImportExtension / HorizontalRuleImportExtension become deprecated aliases that may be removed as early as v0.47.0. Rules stay inert unless HTML is routed through ClipboardDOMImportExtension or $generateNodesFromDOMViaExtension; the legacy importDOM paste path is unchanged. If you had not adopted these v0.45.0 extensions yet, there is no breaking change.
lexical / @lexical/yjs / @lexical/clipboard / @lexical/html — Named slots (#8603) (experimental)All slot machinery is opt-in and gated (an editor latches _slotsUsed on the first $setSlot), so editors that never use slots take identical code paths to before. Two changes are observable regardless:
syncLexicalUpdateToYjsV2__EXPERIMENTAL takes a new dirtyLeaves parameter, inserted between dirtyElements and normalizedNodes (a slot host's values surface as dirty leaves).NodeSelection containing an ElementNode now includes that element's children on copy/export ($getHtmlContent / $generateJSONFromSelectedNodes). The previous behavior serialized a childless shell, making cut of an element NodeSelection silently lossy; partial RangeSelections keep per-child slicing and excludeFromCopy children remain excluded.@lexical/link / @lexical/list / @lexical/react — Removed exports deprecated since v0.32.1 (#8704)Exports marked @deprecated in v0.32.1 (2025-06-04, >12 months ago) with no Meta-internal consumers are removed:
@lexical/link: toggleLink → use $toggleLink@lexical/list: insertList / removeList → use $insertList / $removeList (from an update or command listener)@lexical/react: the ContentEditable Props type alias → use ContentEditablePropsNote: lexical's $nodesOfType is intentionally un-deprecated (it still has many consumers). The remaining v0.32.1 deprecations that still have internal consumers (KEY_MODIFIER_COMMAND, $wrapNodes, the @lexical/table row/column helpers, etc.) are left for a follow-up.
lexical — editor.read(mode, fn) and EditorReadMode (#8702)read gains an optional first argument: 'force-commit' (the default; flushes pending updates first — the previous one-argument behavior), 'pending' (reads the pending state without flushing — the old editor.readPending, now removed), and 'latest' (reads the committed state without flushing, equivalent to editor.getEditorState().read(fn, {editor})). EditorReadMode is exported. readPending only shipped after v0.45.0, so its removal is not considered a breaking change.
lexical — DOM shadow root support (#8694)An editor can now mount inside an open shadow tree without losing selection, focus, drag-and-drop, IME composition, or floating-UI behavior. Reads go through platform APIs — Selection.getComposedRanges, Selection.direction, ShadowRoot.activeElement, Document.caretPositionFromPoint(x, y, {shadowRoots}) — and nine new helpers ship from lexical; the light-DOM code paths are unchanged. Follow-ups #8708 (insert nodes at the block cursor inside a shadow root) and #8740 (ignore beforeinput/input in captured decorators, fixing Firefox 152) complete the surface.
lexical — onWarn editor hook (#8644)CreateEditorArgs gains an optional onWarn?: ErrorHandler (stored as _onWarn, defaulting to console.warn), mirroring onError. The infinite-update-loop guard's recoverable warning now routes through it (wired end-to-end in #8658), so embedders that bridge reporting to their own telemetry no longer lose this signal to each user's browser console.
lexical — $config() accessor-based nominal typing (#8645)An additive extension of the $config() protocol: abstract base classes can declare configuration shared with their subclasses under a Symbol.for(<ClassName>) key (resolved by getStaticNodeConfig), and accessor-based nominal typing lets subclasses opt into stricter $config() checks. No existing node class is changed.
@lexical/history — Cut/paste get their own undo entry (#8649)Any update tagged PASTE_TAG or CUT_TAG is now classified as an OTHER change inside @lexical/history, which keeps it from merging into the preceding keystrokes and keeps following keystrokes from merging into it. Undoing a short paste (or an iOS autocorrect/prediction) or a cut no longer also undoes the text you typed immediately before it.
@lexical/extension — SelectBlockExtension (#8532)Overrides SELECT_ALL_COMMAND so the first invocation selects the nearest block element and the second selects the entire document; a selection already spanning multiple blocks expands straight to the document, and select-all is a no-op when everything is already selected. Includes an opt-in cascadeSelection option for nested editors (image captions, etc.) and enables PreventSelectAllExtension by default to keep keydown from leaking out of input/textarea elements. (Also introduced editor.read('pending', …) via the now-generalized #8702.)
@lexical/yjs / @lexical/react — Collaborative cursors via the CSS Custom Highlight API (#8550)Remote collaborators' selections are now painted with the widely-supported CSS Custom Highlight API; the error-prone absolutely-positioned overlay remains only as a fallback. The remote caret is still rendered as a positioned element. Closes #4457, #5837.
@lexical/utils — dedupeSelectionRects (#8709)A new exported helper that drops zero-area rects and any rect that contains another (with 1px tolerance) from Range.getClientRects(), fixing the duplicate/over-bright and spurious extra-wide fake-selection rects WebKit produces on some blocks. It is wired into positionNodeOnRange, so every fake-selection consumer (markSelection, selectionAlwaysOnDisplay, the extension) gets clean rects. Addresses #7106, #7492.
@lexical/code-core — escapeWithArrows (#8393)CodeIndentExtension gains an escapeWithArrows option (default false): when a code block is the terminal node and the caret is at the end of its text, pressing the arrow keys creates a new paragraph and moves the caret into it. New $onEscapeDown / $onEscapeUp helpers back it in @lexical/utils. Closes #7912, #4685, #5968.
@lexical/react — Self-contained LexicalErrorBoundary (#8720)LexicalErrorBoundary no longer wraps react-error-boundary (the dependency is dropped) and gains an optional fallback prop — omit it for the default message, or pass fallback={null} to render nothing. Its public type is unchanged, so it remains usable as the ErrorBoundary prop of RichTextPlugin / PlainTextPlugin.
lexical):$getNearestNodeFromDOMNode(rootElement) resolves to RootNode; generalized captured selection via setDOMUnmanaged({captureSelection})insertNodes; tag managed <br> with data-lexical-managed-linebreakeditor.read(mode, fn) overload + EditorReadMode (replaces readPending)onWarn editor hook (#8658 routes the recursion guard through it end-to-end)$config() accessor-based nominal typingTabNode.setTextContent for Safari IME compositionCOMPOSITION_END_TAG from the Firefox onInput defer branchbeforeinput/input in captured decorators (Firefox 152)devInvariant$assumeEditor warns via devInvariant instead of throwing in prodklass.prototype null check in getStaticNodeConfiginheritsLoose-safe helper for class-inheritance loopstokenizeRawText / $generateNodesFromRawTextgetStaticNodeConfigT[] over Array<T>, modernized Flow stubs, dropped deprecated traversal type params in testseditorState$generateHtmlFromNodes self-establishes active-editor scope (back-compat for #8519)SelectBlockExtensionescapeWithArrows: create a paragraph around a terminal code block with the arrow keysLinkNode wrap on copy in Firefox/SafariDecoratorNode on Backspace at the start of a top-level listMarkNode method return types to boolean (restores subclass overrides)$handleTableSelectionChangeCommand@lexical/yjs) / Dragon:@lexical/dragon: handle makeChanges messages and the listener-registration racededupeSelectionRects — clean up WebKit fake-selection rectsgetScrollParent to @lexical/utilsLexicalErrorBoundary (drops react-error-boundary) with an optional fallback prop.js.flow files; 📝 #8714 API doc coverage of @lexical/react exportspreventDefault() in dragover for HTML5 DnD complianceAutocompleteDictionary)¶, ↵, →, ·), toggled from SettingsPageBreakNode as <hr> so Safari fires beforeinput after paste/esm/ proof of concept@flaky tags)ActionsPluginEACCES in Windows CI browser testseditor.getEditorState().read(...) to editor.read('latest', ...)AGENTS.md / CLAUDE.md)tmp dependency; #8647 replace the node-state-style example with the dev-examples versionFull Changelog: https://github.com/facebook/lexical/compare/v0.45.0...v0.46.0
lexical: Traversal methods and $getNodeByKey return the base node type unless a type argument is written (#8661)
getParent, getChildren, getFirstChild, getLastChild,
getNextSibling(s), getPreviousSibling(s), getChildAtIndex,
getFirstDescendant, getLastDescendant, getDescendantByIndex (and
their OrThrow forms), $getNodeByKey and $getNodeByKeyOrThrow gained
a first overload with no type parameter that returns LexicalNode (or
ElementNode for getParent and getParentOrThrow), in TypeScript and
Flow (where getParents, already non-generic in TypeScript, got the same
overload). The generic overload is kept but deprecated (see Deprecations), and
TypeScript only picks it when the type argument is written out. A call
without one used to infer the node type from where its result went; it now
returns the base type, so code that compiled before can fail to type check.
Runtime behavior is unchanged.
Detect: calls to these methods without a type argument whose result goes
straight to a narrower node type: an annotated variable
(const p: ParagraphNode | null = node.getFirstChild()), a function
argument ($styleList(root.getFirstChildOrThrow()), where $styleList is
a function of yours whose parameter is a ListNode), the return value of a function declared to return a node
subclass, or a property or array of a subclass type
(const items: ListItemNode[] = list.getChildren()). After upgrading,
TypeScript reports TS2322 (Type 'LexicalNode | null' is not assignable to type ... or Type 'LexicalNode[]' is not assignable to type ...), TS2345
(Argument of type 'LexicalNode' is not assignable to parameter of type ...), or, for a return value, TS2740 (Type 'LexicalNode' is missing the following properties from type ...). Calls that pass a type argument (getFirstChild<ParagraphNode>())
still compile until v0.53.0, which removes that overload.
Migration: call the method without a type argument and narrow the result
with a node guard ($isListNode, $isParagraphNode, ...) before passing
it on. Adding a type argument also compiles, but only until v0.53.0.
// $styleList is your own function: (list: ListNode) => void
// Before: T was inferred as ListNode from the parameter type
$styleList(root.getFirstChildOrThrow());
const node: ParagraphNode | null = $getRoot().getFirstChild();
// After
const first = root.getFirstChildOrThrow();
if ($isListNode(first)) {
$styleList(first);
}
const node = $getRoot().getFirstChild();
if ($isParagraphNode(node)) {
// node: ParagraphNode
}
Codemod: none; each call site needs a guard that fits its context.
lexical: $getNearestNodeFromDOMNode(rootElement) returns RootNode (#8588)
The root element resolves to the RootNode instead of null
in $getNearestNodeFromDOMNode and $getNodeFromDOM.
Detect: calls to those functions whose result is compared to null to
detect the root element.
Migration: check $isRootNode(result) as well.
lexical, @lexical/clipboard, @lexical/html, @lexical/yjs: Element NodeSelection copies include children; Yjs v2 sync signature (#8603)
Copying a NodeSelection that contains an ElementNode
includes its children. The experimental syncLexicalUpdateToYjsV2__EXPERIMENTAL
takes a new dirtyLeaves argument between dirtyElements and
normalizedNodes.
Detect: copy/cut of selected element nodes; direct calls to
syncLexicalUpdateToYjsV2__EXPERIMENTAL.
Migration: pass dirtyLeaves from the update listener payload.
Verify: copy/cut of selected element nodes.
@lexical/link: toggleLink removed (#8704)
The deprecated toggleLink export is removed.
Detect: toggleLink imported from @lexical/link.
Migration: rename to $toggleLink; toggleLink was an alias of it,
so arguments and calling context are unchanged.
@lexical/list: insertList / removeList removed (#8704)
The deprecated insertList(editor, listType) and
removeList(editor) exports are removed.
Detect: insertList or removeList imported from @lexical/list.
Migration:
// Before
insertList(editor, 'bullet');
removeList(editor);
// After (or dispatch INSERT_UNORDERED_LIST_COMMAND / REMOVE_LIST_COMMAND)
editor.update(() => $insertList('bullet'));
editor.update(() => $removeList());
@lexical/react: ContentEditable Props type removed (#8704)
The Props type alias exported by
@lexical/react/LexicalContentEditable is removed.
Detect: import type {Props} from '@lexical/react/LexicalContentEditable'.
Migration: use ContentEditableProps.
lexical: Managed line breaks are tagged; insertNodes keeps a leading linebreak (#8615)
Reconciler-inserted <br>s carry
data-lexical-managed-linebreak="true" (on iOS Safari sometimes an <img>
with the same attribute). RangeSelection.insertNodes keeps the first
LineBreakNode when inserting inline content before a block.
Detect: DOM or HTML snapshot tests; code that queries br in the
editor DOM.
Migration: update snapshots or ignore the attribute.
Verify: DOM snapshots; inserting content with leading line breaks.
lexical: Type arguments on node traversal methods deprecated (#8661)
Replacement: call without a type argument and narrow with a type guard such as $isParagraphNode. Applies to the traversal methods listed under Breaking changes and to $getNodeByKey / $getNodeByKeyOrThrow. Calls that relied on an inferred type argument are already broken in this version; see the Breaking changes entry.
Detect: explicit type arguments on these methods, such as getParentOrThrow<ListItemNode>(). Calls without one are covered by the Breaking changes entry.
Removal: v0.53.0 for TypeScript; #9479 removes the generic overloads. The Flow declarations keep them, still deprecated, after #9529.
@lexical/html, @lexical/rich-text, @lexical/list, @lexical/link, @lexical/table, @lexical/code: RichTextImportExtension and the other per-package DOM import extensions deprecated (#8662)
Replacement: remove them from your dependencies; the node extensions (RichTextExtension, ListExtension, LinkExtension, TableExtension, CodeExtension, HorizontalRuleExtension) register their own DOM import rules. These are experimental APIs.
Removal: no earlier than v0.53.0; #9316 removes it after v0.52.0.
lexical: removeFromParent and isSelectionCapturedInDecoratorInput deprecated (#8603)
Replacement: $removeFromParent and $isSelectionCapturedInDecoratorInput.
Removal: not scheduled.
@lexical/react: getScrollParent from @lexical/react/LexicalTypeaheadMenuPlugin deprecated (#8733)
Replacement: getScrollParent from @lexical/utils.
Removal: not scheduled.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
One column per quarter.