Skip to content

refactor(richtext-lexical): upgrade lexical to 0.48.0 - #17554

Merged
AlessioGr merged 2 commits into
mainfrom
feat/lexical-0.48.0
Jul 29, 2026
Merged

AlessioGr merged 2 commits into
mainfrom
feat/lexical-0.48.0

Conversation

@AlessioGr

@AlessioGr AlessioGr commented Jul 29, 2026 •

Copy link
Copy Markdown
Member

Upgrades lexical and every @lexical/* package from 0.45.0 to 0.48.0.

Changes required

Lexical widened the base importJSON parameter to include Record<string, unknown>, which a TypeScript interface cannot satisfy. Four nodes (link, autolink, and both horizontal rules) intersect their serialized type with it to compensate, which needs no casts and leaves the serialized types alone.

Also included

Fifteen @lexical/react subpaths are re-exported to reach parity with lexical exports. Payload's local getScrollParent copy is deleted now that @lexical/utils exports it.

Lexical Breaking Changes

  • v0.48.0 - no breaking changes.
  • v0.47.0
    • Composing on the middle of a segmented TextNode now preserves the DOM element. No action - IME-only internal change.
  • v0.46.0
    • static importJSON widened its parameter to SerializedLexicalNode & Record<string, unknown>. Not labelled breaking upstream, but it is for any subclass that narrows the parameter: a TypeScript interface cannot satisfy Record<string, unknown>. Action taken - four of our nodes now intersect their serialized type with it.
    • Node traversal type parameters deprecated. $getNodeByKey<T>(key) and friends resolve to LexicalNode | null now that a non-generic overload wins inference. Action taken - one call site switched to a type guard.
    • Removed exports deprecated since v0.32.1: toggleLink, insertList, removeList, and ContentEditable's Props alias. No action - Payload defines its own $toggleLink and never imported the others.
    • Named slots, which have two observable effects: a new dirtyLeaves parameter on syncLexicalUpdateToYjsV2__EXPERIMENTAL, and element NodeSelections now including their children in copy and export. No action - we have no @lexical/yjs dependency and call neither $getHtmlContent nor $generateJSONFromSelectedNodes.
    • insertNodes preserves a leading linebreak, and reconciler-managed <br>s are tagged data-lexical-managed-linebreak="true". No action - but expect the attribute if you assert on editor DOM.
    • DOMImportExtension rules now register implicitly via node extensions. No action.
    • Captured selection generalized via setDOMUnmanaged(captureSelection). No action - API unused by Payload.

@AlessioGr
AlessioGr enabled auto-merge (squash) July 29, 2026 21:33
@github-actions

Copy link
Copy Markdown
Contributor

📦 esbuild Bundle Analysis for payload

This analysis was generated by esbuild-bundle-analyzer. 🤖

Meta File Out File Size (raw) Note
packages/next/meta_index.json esbuild/index.js 201.89 KB ✅ No change
packages/payload/meta_index.json esbuild/index.js 1.41 MB ⚠️ +236 B (+0.0%)
packages/payload/meta_shared.json esbuild/exports/shared.js 213.16 KB ✅ No change
packages/richtext-lexical/meta_client.json esbuild/exports/client_optimized/index.js 285.45 KB ✅ -102 B (-0.0%)
packages/ui/meta_client.json esbuild/exports/client_optimized/index.js 36.44 KB ✅ No change
packages/ui/meta_shared.json esbuild/exports/shared_optimized/index.js 18.95 KB ✅ No change
Largest paths These visualization shows top 20 largest paths in the bundle.

Meta file: packages/next/meta_index.json, Out file: esbuild/index.js

Path Size
../../node_modules ${{\color{Goldenrod}{ ████████████████████████▋ }}}$ 98.9%, 197.86 KB
dist/adapters/router.js ${{\color{Goldenrod}{ }}}$ 0.4%, 718 B
dist/adapters/server.js ${{\color{Goldenrod}{ }}}$ 0.3%, 533 B
dist/adapters/layout.js ${{\color{Goldenrod}{ }}}$ 0.3%, 526 B
dist/adapters/views.js ${{\color{Goldenrod}{ }}}$ 0.2%, 409 B
dist/esbuildEntry.js ${{\color{Goldenrod}{ }}}$ 0.0%, 0 B

Meta file: packages/payload/meta_index.json, Out file: esbuild/index.js

Path Size
../../node_modules ${{\color{Goldenrod}{ █████████████████▏ }}}$ 68.6%, 964.39 KB
dist/fields/hooks ${{\color{Goldenrod}{ ▊ }}}$ 3.2%, 44.37 KB
dist/collections/operations ${{\color{Goldenrod}{ ▊ }}}$ 3.0%, 42.75 KB
dist/utilities/configToJSONSchema.js ${{\color{Goldenrod}{ ▎ }}}$ 1.1%, 15.99 KB
dist/auth/operations ${{\color{Goldenrod}{ ▎ }}}$ 1.1%, 15.68 KB
dist/queues/operations ${{\color{Goldenrod}{ ▎ }}}$ 1.0%, 14.29 KB
dist/fields/config ${{\color{Goldenrod}{ ▎ }}}$ 1.0%, 13.74 KB
dist/globals/operations ${{\color{Goldenrod}{ ▎ }}}$ 1.0%, 13.36 KB
dist/fields/validations.js ${{\color{Goldenrod}{ ▏ }}}$ 0.8%, 10.69 KB
dist/bin/generateImportMap ${{\color{Goldenrod}{ ▏ }}}$ 0.7%, 9.84 KB
dist/collections/config ${{\color{Goldenrod}{ ▏ }}}$ 0.7%, 9.32 KB
dist/config/orderable ${{\color{Goldenrod}{ ▏ }}}$ 0.6%, 8.07 KB
dist/index.js ${{\color{Goldenrod}{ ▏ }}}$ 0.6%, 7.96 KB
dist/uploads/fetchAPI-multipart ${{\color{Goldenrod}{ ▏ }}}$ 0.6%, 7.84 KB
dist/hierarchy/utils ${{\color{Goldenrod}{ ▏ }}}$ 0.5%, 7.64 KB
dist/database/migrations ${{\color{Goldenrod}{ ▏ }}}$ 0.5%, 7.55 KB
dist/config/sanitize.js ${{\color{Goldenrod}{ ▏ }}}$ 0.5%, 7.26 KB
dist/collections/endpoints ${{\color{Goldenrod}{ }}}$ 0.4%, 6.12 KB
dist/uploads/endpoints ${{\color{Goldenrod}{ }}}$ 0.4%, 5.56 KB
dist/utilities/telemetry ${{\color{Goldenrod}{ }}}$ 0.4%, 5.43 KB
(other) ${{\color{Goldenrod}{ ███████▊ }}}$ 31.4%, 440.57 KB

Meta file: packages/payload/meta_shared.json, Out file: esbuild/exports/shared.js

Path Size
../../node_modules ${{\color{Goldenrod}{ █████████████████▉ }}}$ 71.9%, 150.13 KB
dist/fields/validations.js ${{\color{Goldenrod}{ █▎ }}}$ 5.1%, 10.69 KB
dist/fields/config ${{\color{Goldenrod}{ ▋ }}}$ 2.8%, 5.82 KB
dist/utilities/traverseFields.js ${{\color{Goldenrod}{ ▌ }}}$ 2.1%, 4.44 KB
dist/collections/config ${{\color{Goldenrod}{ ▍ }}}$ 1.6%, 3.32 KB
dist/config/orderable ${{\color{Goldenrod}{ ▍ }}}$ 1.5%, 3.13 KB
dist/fields/baseFields ${{\color{Goldenrod}{ ▎ }}}$ 1.3%, 2.79 KB
dist/utilities/deepCopyObject.js ${{\color{Goldenrod}{ ▎ }}}$ 1.3%, 2.69 KB
dist/config/client.js ${{\color{Goldenrod}{ ▎ }}}$ 1.3%, 2.68 KB
dist/auth/cookies.js ${{\color{Goldenrod}{ ▏ }}}$ 0.7%, 1.55 KB
dist/utilities/flattenTopLevelFields.js ${{\color{Goldenrod}{ ▏ }}}$ 0.7%, 1.41 KB
dist/utilities/getVersionsConfig.js ${{\color{Goldenrod}{ ▏ }}}$ 0.5%, 1.04 KB
dist/globals/config ${{\color{Goldenrod}{ }}}$ 0.4%, 939 B
dist/utilities/flattenAllFields.js ${{\color{Goldenrod}{ }}}$ 0.4%, 793 B
dist/utilities/unflatten.js ${{\color{Goldenrod}{ }}}$ 0.4%, 779 B
dist/utilities/sanitizeUserDataForEmail.js ${{\color{Goldenrod}{ }}}$ 0.3%, 713 B
dist/auth/extractJWT.js ${{\color{Goldenrod}{ }}}$ 0.3%, 696 B
dist/utilities/getFieldPermissions.js ${{\color{Goldenrod}{ }}}$ 0.3%, 651 B
dist/errors/ValidationError.js ${{\color{Goldenrod}{ }}}$ 0.3%, 577 B
dist/bin/generateImportMap ${{\color{Goldenrod}{ }}}$ 0.3%, 561 B
(other) ${{\color{Goldenrod}{ ███████ }}}$ 28.1%, 58.55 KB

Meta file: packages/richtext-lexical/meta_client.json, Out file: esbuild/exports/client_optimized/index.js

Path Size
dist/features/blocks ${{\color{Goldenrod}{ ███▎ }}}$ 13.2%, 37.20 KB
dist/lexical/ui ${{\color{Goldenrod}{ ███ }}}$ 12.1%, 34.16 KB
dist/lexical/plugins ${{\color{Goldenrod}{ ██▉ }}}$ 11.7%, 32.88 KB
dist/features/experimental_table ${{\color{Goldenrod}{ ██▍ }}}$ 9.6%, 27.22 KB
dist/features/link ${{\color{Goldenrod}{ █▋ }}}$ 6.7%, 18.82 KB
dist/features/toolbars ${{\color{Goldenrod}{ █▍ }}}$ 5.9%, 16.58 KB
dist/features/upload ${{\color{Goldenrod}{ █▎ }}}$ 5.1%, 14.28 KB
dist/features/textState ${{\color{Goldenrod}{ ▉ }}}$ 3.9%, 11.08 KB
dist/lexical/utils ${{\color{Goldenrod}{ ▉ }}}$ 3.5%, 10.02 KB
dist/features/relationship ${{\color{Goldenrod}{ ▊ }}}$ 3.4%, 9.61 KB
dist/features/converters ${{\color{Goldenrod}{ ▊ }}}$ 3.0%, 8.36 KB
dist/utilities/fieldsDrawer ${{\color{Goldenrod}{ ▋ }}}$ 2.9%, 8.12 KB
dist/features/debug ${{\color{Goldenrod}{ ▋ }}}$ 2.6%, 7.40 KB
dist/lexical/config ${{\color{Goldenrod}{ ▍ }}}$ 1.8%, 5.14 KB
dist/features/lists ${{\color{Goldenrod}{ ▎ }}}$ 1.3%, 3.64 KB
dist/features/format ${{\color{Goldenrod}{ ▎ }}}$ 1.2%, 3.28 KB
dist/lexical/LexicalEditor.js ${{\color{Goldenrod}{ ▎ }}}$ 1.1%, 3.23 KB
dist/features/horizontalRule ${{\color{Goldenrod}{ ▎ }}}$ 1.1%, 3.18 KB
dist/field/Field.js ${{\color{Goldenrod}{ ▎ }}}$ 1.0%, 2.88 KB
dist/lexical/nodes ${{\color{Goldenrod}{ ▏ }}}$ 0.9%, 2.66 KB
(other) ${{\color{Goldenrod}{ █████████████████████▋ }}}$ 86.8%, 245.05 KB

Meta file: packages/ui/meta_client.json, Out file: esbuild/exports/client_optimized/index.js

Path Size
dist/exports/client ${{\color{Goldenrod}{ █████████████████████████ }}}$ 100.0%, 26.82 KB

Meta file: packages/ui/meta_shared.json, Out file: esbuild/exports/shared_optimized/index.js

Path Size
dist/graphics/Logo ${{\color{Goldenrod}{ ███████▋ }}}$ 30.5%, 5.57 KB
../../node_modules ${{\color{Goldenrod}{ ███▌ }}}$ 14.5%, 2.65 KB
dist/graphics/Icon ${{\color{Goldenrod}{ ██ }}}$ 8.3%, 1.51 KB
dist/utilities/formatDocTitle ${{\color{Goldenrod}{ █▊ }}}$ 7.2%, 1.32 KB
dist/providers/TableColumns ${{\color{Goldenrod}{ █▏ }}}$ 4.7%, 866 B
dist/utilities/getGlobalData.js ${{\color{Goldenrod}{ █ }}}$ 4.2%, 762 B
dist/utilities/api.js ${{\color{Goldenrod}{ █ }}}$ 4.1%, 756 B
dist/utilities/groupNavItems.js ${{\color{Goldenrod}{ █ }}}$ 4.1%, 745 B
dist/elements/Translation ${{\color{Goldenrod}{ ▋ }}}$ 2.7%, 493 B
dist/utilities/handleTakeOver.js ${{\color{Goldenrod}{ ▌ }}}$ 2.4%, 440 B
dist/utilities/traverseForLocalizedFields.js ${{\color{Goldenrod}{ ▌ }}}$ 2.3%, 419 B
dist/elements/withMergedProps ${{\color{Goldenrod}{ ▍ }}}$ 1.9%, 339 B
dist/utilities/getNavGroups.js ${{\color{Goldenrod}{ ▍ }}}$ 1.9%, 338 B
dist/utilities/getVisibleEntities.js ${{\color{Goldenrod}{ ▍ }}}$ 1.8%, 329 B
dist/elements/WithServerSideProps ${{\color{Goldenrod}{ ▎ }}}$ 1.3%, 232 B
dist/layouts/Root ${{\color{Goldenrod}{ ▎ }}}$ 1.3%, 230 B
dist/utilities/handleGoBack.js ${{\color{Goldenrod}{ ▎ }}}$ 1.0%, 180 B
dist/fields/mergeFieldStyles.js ${{\color{Goldenrod}{ ▏ }}}$ 0.9%, 158 B
dist/forms/Form ${{\color{Goldenrod}{ ▏ }}}$ 0.8%, 152 B
dist/utilities/handleBackToDashboard.js ${{\color{Goldenrod}{ ▏ }}}$ 0.8%, 152 B
(other) ${{\color{Goldenrod}{ █████████████████▍ }}}$ 69.5%, 12.68 KB
Details

Next to the size is how much the size has increased or decreased compared with the base branch of this PR.

  • ‼️: Size increased by 20% or more. Special attention should be given to this.
  • ⚠️: Size increased in acceptable range (lower than 20%).
  • ✅: No change or even downsized.
  • 🗑️: The out file is deleted: not found in base branch.
  • 🆕: The out file is newly found: will be added to base branch.

@GermanJablo

Copy link
Copy Markdown
Contributor

#17064 deferred deleting normalizeMarkdown until meta/lexical#8734 shipped, which it did in 0.47.0. Left for its own PR.

Unfortunately this is still blocked

@GermanJablo GermanJablo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

My only suggestion would be to add a short Lexical Breaking Changes section to the description, enumerating the notable changes across 0.46 → 0.48 and whether each needs action (the whitespace-only table-cell behavior, the importJSON signature change, etc.), just like we did in #17064.

@AlessioGr
AlessioGr merged commit 4e6581b into main Jul 29, 2026
183 checks passed
@AlessioGr
AlessioGr deleted the feat/lexical-0.48.0 branch July 29, 2026 22:10
AlessioGr added a commit that referenced this pull request Sep 10, 2026
Upgrades `lexical` and every installed `@lexical/*` package from
`0.48.0` to `0.50.0` for Payload 4.x (`main`). Updates the dependency
pins, lockfile, `lexicalTargetVersion`, and v4 migration guide.

## Breaking changes

**No application changes or data migration are needed when using
Payload's built-in rich text features.**

If you maintain custom rich text features, check that they still compile
and that custom content loads, copies, and pastes correctly. Lexical
tightened some TypeScript types and changed how custom nodes are loaded
and copied. Tests that inspect the editor's HTML may also need updated
selectors or snapshots because Lexical adds some internal markup.

**Do not install `lexical` or `@lexical/*` yourself for use with
Payload.** Remove any direct dependencies you added for the editor and
use Payload's re-exports from `@payloadcms/richtext-lexical/lexical` and
`@payloadcms/richtext-lexical/lexical/*`. Payload supplies the matching
versions; mixing versions can break the editor. This is the existing
[custom feature
requirement](https://payloadcms.com/docs/rich-text/custom-features).

## Breaking changes and Payload migrations

Reviewed
[0.49.0](https://github.com/facebook/lexical/releases/tag/v0.49.0) and
[0.50.0](https://github.com/facebook/lexical/releases/tag/v0.50.0).
Listed below are breaking API/type changes and behavior changes
explicitly identified as breaking in the release notes. Deprecations and
routine bug fixes are omitted. **Yes** means we had to change Payload
code; **No** means no Payload migration was required.

| Release | Breaking change | Required migration in Payload | Changes
made |
| ------- |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| ----------------------------- |
---------------------------------------------------------------------------------------------------------------------------------
|
| 0.49 | [Built-in nodes adopt
`$config()`](meta/lexical#8640). Direct
static `importJSON`, `importDOM`, `clone`, and `transform`
implementations change; `__type` becomes readonly and automatic node
construction needs zero-argument defaults. Custom static implementations
remain supported. | No | - |
| 0.49 | [`LexicalCommand<T>` checks its payload type more
strictly](meta/lexical#8877).
`LexicalCommand<unknown>` is no longer a safe catch-all. | Yes | Focus
and blur commands were incorrectly registered with `MouseEvent`. Removed
the explicit types so Lexical infers `FocusEvent`. |
| 0.50 | [Named-slot values cannot be replaced with
`LexicalNode.replace()`](meta/lexical#8938).
Block converters also [skip slot
values](meta/lexical#8905). | No | - |
| 0.50 | [Lexical JSON clipboard copying checks
`excludeFromCopy('clone')`, not
`'html'`](meta/lexical#8995). | No | - |

Also updated the copied table action menu for merged-cell bounds, header
toggles, and merge/unmerge selection, and fixed the upload alignment
test’s image selector. The nested toolbar wheel test now hovers each
toolbar before scrolling; its assertions are unchanged. Both affected
e2e tests pass locally in Chromium on TanStack. Formatting and diff
checks pass.

## Previous Lexical upgrades

- [#17554](#17554) — 0.45.0 →
0.48.0
- [#17064](#17064) — 0.41.0 →
0.45.0
- [#15760](#15760) — 0.35.0 →
0.41.0
AlessioGr added a commit that referenced this pull request Sep 11, 2026
Upgrades `lexical` and every installed `@lexical/*` package from
`0.41.0` to `0.50.0` for Payload 3.x. Updates the dependency pins,
lockfile, and `lexicalTargetVersion`.

Also exposes the 15 React entry points added on main in
[#17554](#17554) through
`@payloadcms/richtext-lexical/lexical/react/*`, so custom features can
use these APIs through Payload.

## Breaking changes

**No application changes or data migration are needed when using
Payload's built-in rich text features.**

If you maintain custom rich text features, check that they still compile
and that custom content loads, copies, and pastes correctly. Lexical
removed some older APIs, tightened TypeScript types, and changed how
custom nodes are loaded and copied. Tests that inspect the editor's HTML
may also need updated selectors or snapshots because Lexical adds some
internal markup.

**Do not install `lexical` or `@lexical/*` yourself for use with
Payload.** Remove any direct dependencies you added for the editor and
use Payload's re-exports from `@payloadcms/richtext-lexical/lexical` and
`@payloadcms/richtext-lexical/lexical/*`. Payload supplies the matching
versions; mixing versions can break the editor. This is the existing
[custom feature
requirement](https://payloadcms.com/docs/rich-text/custom-features).

The 3.x Markdown implementation and converter defaults are preserved.
This does not backport the v4 Markdown API changes.

## Breaking changes and Payload migrations

Reviewed
[0.42.0](https://github.com/facebook/lexical/releases/tag/v0.42.0),
[0.43.0](https://github.com/facebook/lexical/releases/tag/v0.43.0),
[0.44.0](https://github.com/facebook/lexical/releases/tag/v0.44.0),
[0.45.0](https://github.com/facebook/lexical/releases/tag/v0.45.0),
[0.46.0](https://github.com/facebook/lexical/releases/tag/v0.46.0),
[0.47.0](https://github.com/facebook/lexical/releases/tag/v0.47.0),
[0.48.0](https://github.com/facebook/lexical/releases/tag/v0.48.0),
[0.49.0](https://github.com/facebook/lexical/releases/tag/v0.49.0),
[0.50.0](https://github.com/facebook/lexical/releases/tag/v0.50.0).
Listed below are breaking API/type changes and behavior changes
explicitly identified as breaking in the release notes. Deprecations and
routine bug fixes are omitted. **Yes** means we had to change Payload
code; **No** means no Payload migration was required.

| Release | Breaking change | Required migration in Payload | Changes
made |
| ------- |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| ----------------------------- |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
| 0.42 | [Experimental `hasFitNestedTables` moves out of the table
package into the
playground](meta/lexical#8210). | No | - |
| 0.42 | [The deprecated context-menu plugin is
removed](meta/lexical#8199). | Yes | Removed
the invalid `LexicalContextMenuPlugin` proxy and package export. Custom
consumers must use
`@payloadcms/richtext-lexical/lexical/react/LexicalNodeContextMenuPlugin`
and adapt to its node-context-menu API. |
| 0.43 | [Nested editors delegate asynchronously to their
parent](meta/lexical#8308), restoring the
behavior from before 0.42.0. | No | - |
| 0.45 | [`$getReconciledDirection` now inherits direction through
shadow-root nodes](meta/lexical#8479). | No
| - |
| 0.45 | [Backspace at the start of a non-empty block preserves the
current block type and
formatting](meta/lexical#8493). | No | - |
| 0.45 | [Moving nodes between parents adjusts selection
offsets](meta/lexical#8501). | No | - |
| 0.45 | [Markdown shortcuts can trigger when IME composition
commits](meta/lexical#8503). | No | - |
| 0.45 | [Rich/plain text automatically removes empty inline
elements](meta/lexical#8497). | No | - |
| 0.45 | [Triple-click selection normalization moves from core into
rich/plain text
registration](meta/lexical#8520). Editors
bypassing that registration must add
`NormalizeTripleClickSelectionExtension`. | No | - |
| 0.45 | [`DOMSlot` and the DOM rendering override APIs are
generalized](meta/lexical#8519); playground
`AutocompleteNode` is replaced by `VisibleLineBreakExtension`. | No | -
|
| 0.46 | [`static importJSON` widens its parameter to
`SerializedLexicalNode & Record<string,
unknown>`](#17554). Overrides
using serialized interfaces can fail TypeScript checks. | No | - |
| 0.46 | [Node lookups and traversal no longer infer unchecked subclass
types](meta/lexical#8661). Explicit
unchecked traversal generics are deprecated. | Yes | Removed the upload
drawer’s assumption that a node lookup returns `UploadNode`. Added
`$isUploadNode` before reading or updating upload data. |
| 0.46 | [DOM lookups of the editor root return `RootNode` instead of
`null`](meta/lexical#8588).
Selection-capture handling is also generalized beyond decorators. | No |
- |
| 0.46 | [`insertNodes` preserves leading line breaks, and managed line
breaks receive a DOM
marker](meta/lexical#8615). | No | - |
| 0.46 | [Experimental DOM-import rules register through node
extensions](meta/lexical#8662); the separate
per-package import extensions become deprecated aliases. | No | - |
| 0.46 | [Experimental named slots change the Yjs sync
signature](meta/lexical#8603):
`syncLexicalUpdateToYjsV2__EXPERIMENTAL` gains a `dirtyLeaves`
parameter. | No | - |
| 0.46 | [Copying an element through `NodeSelection` includes its
children](meta/lexical#8603), instead of
copying an empty shell. | No | - |
| 0.46 | [Previously deprecated exports are
removed](meta/lexical#8704): `toggleLink`,
`insertList`, `removeList`, and ContentEditable’s `Props` alias.
Replacements are `$toggleLink`, `$insertList`, `$removeList`, and
`ContentEditableProps`. | No | - |
| 0.47 | [React 17 support is
removed](meta/lexical#8782); React 18 or
later is required. | No | - |
| 0.47 | [Segmented text temporarily switches to normal mode during IME
composition while keeping its
DOM](meta/lexical#8784). Subclasses must
tolerate that temporary mode. | No | - |
| 0.49 | [Built-in nodes adopt
`$config()`](meta/lexical#8640). Direct
static `importJSON`, `importDOM`, `clone`, and `transform`
implementations change; `__type` becomes readonly and automatic node
construction needs zero-argument defaults. Custom static implementations
remain supported. | No | - |
| 0.49 | [`LexicalCommand<T>` checks its payload type more
strictly](meta/lexical#8877).
`LexicalCommand<unknown>` is no longer a safe catch-all. | Yes | Focus
and blur commands were incorrectly registered with `MouseEvent`. Removed
the explicit types so Lexical infers `FocusEvent`. |
| 0.50 | [Named-slot values cannot be replaced with
`LexicalNode.replace()`](meta/lexical#8938).
Block converters also [skip slot
values](meta/lexical#8905). | No | - |
| 0.50 | [Lexical JSON clipboard copying checks
`excludeFromCopy('clone')`, not
`'html'`](meta/lexical#8995). | No | - |

Also updated the copied table action menu for merged-cell bounds, header
toggles, and merge/unmerge selection, and fixed the upload alignment
test’s image selector. Formatting and diff checks pass for the upload
selector fix.

Verified all 15 new entry points through source and published export
maps with runtime imports and TypeScript checks. ESLint and formatting
checks pass.

## Previous Lexical upgrades

- [#15760](#15760) — 0.35.0 →
0.41.0
- [#13715](#13715) — 0.34.0 →
0.35.0
- [#13622](#13622) — 0.28.0 →
0.34.0
AlessioGr added a commit that referenced this pull request Sep 30, 2026
…18397)

_Written with AI_

Upgrades `lexical` and every installed `@lexical/*` package from
`0.50.0` to `0.52.0` for Payload 4.x (`main`), and pinned `tsx`
dependencies from `4.22.4` to `4.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 with `void 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 = undefined` workaround for
#16949. tsx 4.23.15 [excludes bare built-ins from namespace
inheritance](privatenumber/tsx@38e1588),
following its [Node 24 `tsImport` bridge
fix](privatenumber/tsx@6e5236b).

## 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:

- **Generic types:** `SerializedEditorState<T>`,
`SerializedElementNode<T>`, and `SerializedRootNode<T>` no longer accept
`<T>`. Remove it if the base node type is enough, or use Payload's
`TypedEditorState<T>` for documents with your own node types. Without
`<T>`, children are still `SerializedLexicalNode[]`.
- **Export types:** `ReturnType<Node['exportJSON']>` can now make fields
such as `version` and `url` optional. Use the node's explicit serialized
type, such as `SerializedLinkNode`, when you need the full format.
Normal `node.exportJSON()` calls still return full JSON.
- **Selection listeners:** `SELECTION_CHANGE_COMMAND` now fires before
the DOM is updated. If your custom listener reads the DOM, defer that
work with `$onUpdate(() => editor.read('latest', callback))`.
- **Saved node references:** If you keep a node reference across an
editor update, call `node.getLatest().exportJSON()` to export its
current values.

The type changes also affect imports through
`@payloadcms/richtext-lexical/lexical` and its subpaths. Payload's
`TypedEditorState<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](https://payloadcms.com/docs/rich-text/custom-features).
The table below also lists removed APIs that may affect custom features.
`LexicalComposer` is deprecated but still available.

## Breaking changes and Payload migrations

Reviewed
[0.51.0](https://github.com/facebook/lexical/releases/tag/v0.51.0) and
[0.52.0](https://github.com/facebook/lexical/releases/tag/v0.52.0),
including the serialization declarations. **Yes** means Payload code
needed adaptation; **No** means no Payload migration was required.

| Release | Breaking change | Required migration in Payload | Changes
made |
| ------- | --------------- | ----------------------------- |
------------ |
| 0.51 | [npm packages are ESM
only](meta/lexical#9127); older CommonJS
consumers must use dynamic imports. | No | Payload already uses ESM.
This removes the asynchronous Lexical wrapper involved in the CLI
reproducer. |
| 0.51 | [Serialization schemas and compact
export](meta/lexical#8602) add `exportJSON`
overloads and remove the `SerializedEditorState`,
`SerializedElementNode`, and `SerializedRootNode` generics. `ReturnType`
can now infer compact, partial JSON. | Yes | Infer the full-format
overload for node hooks, validation and population while preserving
custom nodes' literal `type` discriminants. Update `hasText` to the
non-generic editor-state type. |
| 0.51 | [`exportJSON` can serialize a retained instance without calling
`getLatest()`](meta/lexical#8602). | No |
Audited Payload's clipboard and Markdown call sites: they serialize
nodes obtained from the current selection/tree, without an intervening
mutation. Custom callers holding stale references should use
`node.getLatest().exportJSON()`. |
| 0.51 | [Deprecated Prism re-exports are removed from
`@lexical/code`](meta/lexical#9141). | No |
Payload does not consume the removed exports. |
| 0.52 | [`SELECTION_CHANGE_COMMAND` runs before DOM
reconciliation](meta/lexical#9219),
including node and table selections. | Yes | Defer link popup, inline
toolbar and decorator DOM work with `$onUpdate` and
`editor.read('latest', ...)`. Keep nested decorator updates with their
own editor. The table menu already defers DOM reads. |
| 0.52 | [Default HTML export honors `DOMRenderExtension` `$createDOM`
overrides](meta/lexical#9231). | No |
Payload does not configure these extension overrides; existing converter
tests pass. |
| 0.52 | [`LexicalNode.getCommonAncestor` is
removed](meta/lexical#9238). | No | No
Payload call sites. Custom consumers can use `$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

- [#18149](#18149) — 0.48.0 →
0.50.0
- [#17554](#17554) — 0.45.0 →
0.48.0
- [#17064](#17064) — 0.41.0 →
0.45.0
AlessioGr added a commit that referenced this pull request Oct 28, 2026
_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
`&#91;note&#93;`, 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants