Skip to content

Commit ba3bd74

Browse files
authored
feat(richtext-lexical): upgrade lexical from 0.35.0 to 0.41.0 (#15760)
## Summary Upgrades the lexical dependency from 0.35.0 to 0.41.0. Keeping up with Lexical releases avoids accumulating too large a gap, which makes future upgrades risky and time-consuming. This upgrade also brings in the upstream `normalizeMarkdown` fix ([facebook/lexical#7812](facebook/lexical#7812)), which means we can eventually drop our vendored copy of that function. If you installed lexical manually, update it to 0.41.0. Installing lexical manually is not recommended, as it may break between updates, and our re-exported versions should be used. See the [yellow banner box](https://payloadcms.com/docs/rich-text/custom-features) for details. If you still encounter richtext-lexical errors, do the following, in this order: - Delete node_modules - Delete your lockfile (e.g. pnpm-lock.json) - Reinstall your dependencies (e.g. pnpm install) ## Lexical Breaking Changes The following Lexical releases contain breaking changes. We recommend reading them if you're using Lexical APIs directly (`@payloadcms/richtext-lexical/lexical/*`). - [v0.41.0](https://github.com/facebook/lexical/releases/tag/v0.41.0) — `--lexical-indent-base-value` CSS custom property is now only read from the editor root element, not from indented elements. **Payload already handles this change internally** — no action required. - [v0.39.0](https://github.com/facebook/lexical/releases/tag/v0.39.0) — `ElementNode` JSON serialization: `textFormat` and `textStyle` are now only serialized when necessary (when the node has no direct TextNode children). May affect code that reads these properties from serialized data. - [v0.38.0](https://github.com/facebook/lexical/releases/tag/v0.38.1) — Static transforms from superclasses are now always applied. Table selection handler priorities lowered from CRITICAL to HIGH. - [v0.36.1](https://github.com/facebook/lexical/releases/tag/v0.36.1) — `DecoratorNode.decorate()` return type widened to `null | T`. Collaboration context changes (not used by Payload). None of these breaking changes require action from Payload users under normal usage. ## Changes - Bump all `@lexical/*` and `lexical` from 0.35.0 to 0.41.0 - Update `lexicalTargetVersion` constant - Move `--lexical-indent-base-value` CSS variable from `.LexicalEditorTheme__indent` to the `.LexicalEditorTheme` root selector (v0.41.0 breaking change) - Update `textFormat` test expectations for inline code paragraphs (v0.39.0 serialization change) - Update pnpm-lock.yaml ## Previous Lexical Upgrades - [#13715](#13715) — 0.34.0 → 0.35.0 - [#13622](#13622) — 0.28.0 → 0.34.0 - [#11764](#11764) — 0.27.2 → 0.28.0 - [#11564](#11564) — 0.21.0 → 0.27.1
1 parent a1d6733 commit ba3bd74

5 files changed

Lines changed: 271 additions & 219 deletions

File tree

packages/richtext-lexical/package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -367,17 +367,17 @@
367367
]
368368
},
369369
"dependencies": {
370-
"@lexical/clipboard": "0.35.0",
371-
"@lexical/headless": "0.35.0",
372-
"@lexical/html": "0.35.0",
373-
"@lexical/link": "0.35.0",
374-
"@lexical/list": "0.35.0",
375-
"@lexical/mark": "0.35.0",
376-
"@lexical/react": "0.35.0",
377-
"@lexical/rich-text": "0.35.0",
378-
"@lexical/selection": "0.35.0",
379-
"@lexical/table": "0.35.0",
380-
"@lexical/utils": "0.35.0",
370+
"@lexical/clipboard": "0.41.0",
371+
"@lexical/headless": "0.41.0",
372+
"@lexical/html": "0.41.0",
373+
"@lexical/link": "0.41.0",
374+
"@lexical/list": "0.41.0",
375+
"@lexical/mark": "0.41.0",
376+
"@lexical/react": "0.41.0",
377+
"@lexical/rich-text": "0.41.0",
378+
"@lexical/selection": "0.41.0",
379+
"@lexical/table": "0.41.0",
380+
"@lexical/utils": "0.41.0",
381381
"@payloadcms/translations": "workspace:*",
382382
"@payloadcms/ui": "workspace:*",
383383
"@types/uuid": "10.0.0",
@@ -387,7 +387,7 @@
387387
"dequal": "2.0.3",
388388
"escape-html": "1.0.3",
389389
"jsox": "1.2.121",
390-
"lexical": "0.35.0",
390+
"lexical": "0.41.0",
391391
"mdast-util-from-markdown": "2.0.2",
392392
"mdast-util-mdx-jsx": "3.1.3",
393393
"micromark-extension-mdx-jsx": "3.0.1",
@@ -402,7 +402,7 @@
402402
"@babel/preset-env": "7.27.2",
403403
"@babel/preset-react": "7.27.1",
404404
"@babel/preset-typescript": "7.27.1",
405-
"@lexical/eslint-plugin": "0.35.0",
405+
"@lexical/eslint-plugin": "0.41.0",
406406
"@payloadcms/eslint-config": "workspace:*",
407407
"@types/escape-html": "1.0.4",
408408
"@types/json-schema": "7.0.15",

packages/richtext-lexical/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { richTextValidateHOC } from './validate/index.js'
2929

3030
let checkedDependencies = false
3131

32-
export const lexicalTargetVersion = '0.35.0'
32+
export const lexicalTargetVersion = '0.41.0'
3333

3434
export function lexicalEditor(args?: LexicalEditorProps): LexicalRichTextAdapterProvider {
3535
if (

packages/richtext-lexical/src/lexical/theme/EditorTheme.scss

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
}
99

1010
.LexicalEditorTheme {
11+
--lexical-indent-base-value: 40px;
12+
1113
&__ltr {
1214
text-align: left;
1315
}
@@ -85,10 +87,6 @@
8587
margin-block: 0.75em 0.4em;
8688
}
8789

88-
&__indent {
89-
--lexical-indent-base-value: 40px;
90-
}
91-
9290
&__textBold {
9391
font-weight: bold;
9492
}

0 commit comments

Comments
 (0)