_Written with AI_
Upgrades lexical from `0.52.0` to `0.53.0`.
## Breaking changes
Rich-text data keeps its existing format. No database migration is
needed. Payload's built-in features have been updated, but your own
TypeScript code or custom features may need changes:
- **Node type arguments:** `getParent<T>()`, `getParentOrThrow<T>()`,
`getChildren<T>()`, `getFirstChild<T>()`, `getNextSibling<T>()`,
`$getNodeByKey<T>()` and the rest of that family no longer accept a type
argument. Remove `<T>` and narrow the result with a node guard such as
`$isListItemNode`. Runtime behavior is unchanged.
- **Removed extensions:** `LinkImportExtension`, `ListImportExtension`,
`RichTextImportExtension` and `HorizontalRuleImportExtension`
(deprecated in 0.52) are no longer exported from
`@payloadcms/richtext-lexical/lexical/link`, `/list`, `/rich-text` and
`/html`. Use `LinkExtension`, `ListExtension` and `RichTextExtension`;
for horizontal rules, use `HorizontalRuleExtension` from
`@lexical/extension`.
- **Markdown export:** `convertLexicalToMarkdown` escapes literal
brackets and HTML-like text, for example `[note]` becomes
`[note]`, so it is not parsed back as a link or HTML.
`convertMarkdownToLexical` restores the original text.
## Breaking changes and Payload migrations
Reviewed [0.53.0](https://github.com/meta/lexical/releases/tag/v0.53.0)
and the `CHANGELOG.md` now shipped in the `lexical` package, including
its behavior changes. **Yes** means Payload code needed adaptation;
**No** means no Payload migration was required.
| Breaking change | Required migration in Payload | Changes made |
|
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| ----------------------------- |
---------------------------------------------------------------------------------------------------------------------------------------------------
|
| [Unchecked node type arguments are
removed](meta/lexical#9479) from traversal
and key lookup methods. | Yes | `TableCellResizerPlugin` called
`tableRow.getChildren<TableCellNode>()`. It now uses
`.filter($isTableCellNode)`, matching the upstream playground. |
| [Extensions deprecated in 0.52 are
removed](meta/lexical#9316). | No | Payload
does not use them. They disappear from the `export *` proxies listed
above. |
| [`ElementNode.reconcileObservedMutation` restores the committed
children's DOM](meta/lexical#9329)
(`@internal`). | No | No Payload call sites. |
| [`@lexical/mdast` stores table column alignment as cell paragraph
format](meta/lexical#9478). | No | Payload
does not use `@lexical/mdast`. |
| Behavior: [Markdown export escapes literal
text](meta/lexical#9481). | No | Documented
in the migration guide. MDX round-trip int tests pass unchanged. |
| Behavior: [a read-only `ContentEditable` without an accessible name no
longer renders
`role="textbox"`](meta/lexical#9270). | No |
Payload passes the field label as `aria-label`, so labeled read-only
editors keep the role. |
| Behavior: [`ClickableLinkPlugin` opens new tabs without
`window.opener`](meta/lexical#9303), and
[nested editors handle their own link
clicks](meta/lexical#9360). | No | The link
feature uses `ClickableLinkPlugin` and gets the reverse-tabnabbing fix
automatically. |
Package entry points of every proxied package were compared against
0.52.0. The only addition is the experimental
`@lexical/html/BlockIdHTMLExtension` subpath. Payload only re-exports
the `@lexical/html` root, so no proxy exports need adding or removing.
## Previous Lexical upgrades
- [#18397](#18397) — 0.50.0 →
0.52.0
- [#18149](#18149) — 0.48.0 →
0.50.0
- [#17554](#17554) — 0.45.0 →
0.48.0
Written with AI
Upgrades
lexicaland every installed@lexical/*package from0.50.0to0.52.0for Payload 4.x (main), and pinnedtsxdependencies from4.22.4to4.23.15. Removes the native-loader workaround no longer needed with the new tsx version.Also fixes duplicate image uploads triggered by repeated node transforms in Lexical 0.52. CI fixes update the keyboard-navigation expectation and correct an existing auth-test parameter error that blocked integration tests.
Fixes #17757
3.x counterpart: #18398.
Why this fixes the CLI failure
With Payload 3.90.1 on Node 22.22.0, importing a config that included
lexicalEditor()could leave CLI startup pending before the config or target script was evaluated. The process then exited 0 with no output and left a pending PostgreSQL migration unapplied. Previously, Payload started the CLI withvoid start(), and an unresolved promise alone does not keep Node's event loop alive.Lexical 0.50's Node entry points select their build with top-level
await import(...), which is probably what caused it. Lexical has shipped ESM-only packages since 0.51, using static imports instead of those asynchronous Node wrappers. Upgrading to 0.52 fixes this issue.Also removes the
module.registerHooks = undefinedworkaround for #16949. tsx 4.23.15 excludes bare built-ins from namespace inheritance, following its Node 24tsImportbridge fix.CLI exit codes
CLI startup is now awaited at the top level in all three loader paths: tsx, SWC, and disabled transpilation. If an import never settles and Node runs out of work, Node reports an unsettled top-level await and exits 13. Successful commands still exit 0, and command-specific failure codes are preserved.
Breaking changes
Rich-text data keeps its existing format. No database migration is needed. Payload's built-in features have been updated, but your own TypeScript code or custom features may need changes:
SerializedEditorState<T>,SerializedElementNode<T>, andSerializedRootNode<T>no longer accept<T>. Remove it if the base node type is enough, or use Payload'sTypedEditorState<T>for documents with your own node types. Without<T>, children are stillSerializedLexicalNode[].ReturnType<Node['exportJSON']>can now make fields such asversionandurloptional. Use the node's explicit serialized type, such asSerializedLinkNode, when you need the full format. Normalnode.exportJSON()calls still return full JSON.SELECTION_CHANGE_COMMANDnow fires before the DOM is updated. If your custom listener reads the DOM, defer that work with$onUpdate(() => editor.read('latest', callback)).node.getLatest().exportJSON()to export its current values.The type changes also affect imports through
@payloadcms/richtext-lexical/lexicaland its subpaths. Payload'sTypedEditorState<T>and its own serialized node types keep their generic APIs for this upgrade.Keep importing Lexical through Payload's re-exports; do not install a separate Lexical version. See the custom feature documentation. The table below also lists removed APIs that may affect custom features.
LexicalComposeris deprecated but still available.Breaking changes and Payload migrations
Reviewed 0.51.0 and 0.52.0, including the serialization declarations. Yes means Payload code needed adaptation; No means no Payload migration was required.
exportJSONoverloads and remove theSerializedEditorState,SerializedElementNode, andSerializedRootNodegenerics.ReturnTypecan now infer compact, partial JSON.typediscriminants. UpdatehasTextto the non-generic editor-state type.exportJSONcan serialize a retained instance without callinggetLatest().node.getLatest().exportJSON().@lexical/code.SELECTION_CHANGE_COMMANDruns before DOM reconciliation, including node and table selections.$onUpdateandeditor.read('latest', ...). Keep nested decorator updates with their own editor. The table menu already defers DOM reads.DOMRenderExtension$createDOMoverrides.LexicalNode.getCommonAncestoris removed.$getCommonAncestor, accounting for its different handling of non-element nodes.React package entry points were compared against 0.50.0; no Payload proxy exports need adding or removing.
Previous Lexical upgrades