Skip to content

feat(richtext-lexical): upgrade lexical from 0.21.0 to 0.27.1#11564

Merged
AlessioGr merged 26 commits intomainfrom
feat/lexical-0.27.1
Mar 6, 2025
Merged

feat(richtext-lexical): upgrade lexical from 0.21.0 to 0.27.1#11564
AlessioGr merged 26 commits intomainfrom
feat/lexical-0.27.1

Conversation

@AlessioGr
Copy link
Copy Markdown
Member

@AlessioGr AlessioGr commented Mar 6, 2025

Fixes #10628

This upgrades lexical from 0.21.0 to 0.27.1. This will allow us to use the new node state API to implement custom text formats (e.g. text colors), thanks to Germán.

Notable changes ported over from lexical playground:

Table column freezing

CleanShot.2025-03-05.at.20.10.13.mp4

Block cursors

We now render a block cursor, which is a custom cursor that gets rendered when the browser doesn't render the native one. An example would be this this horizontal cursor above block nodes, if there is no space above:

CleanShot 2025-03-05 at 18 48 08@2x

Previously, those cursors were unstyled and not visible

Table Alignment

Tables can now be aligned

CleanShot 2025-03-05 at 19 48 32@2x

@AlessioGr AlessioGr marked this pull request as draft March 6, 2025 01:18
@AlessioGr AlessioGr marked this pull request as ready for review March 6, 2025 05:44
@AlessioGr AlessioGr enabled auto-merge (squash) March 6, 2025 05:55
@AlessioGr AlessioGr merged commit 557ac99 into main Mar 6, 2025
71 checks passed
@AlessioGr AlessioGr deleted the feat/lexical-0.27.1 branch March 6, 2025 17:06
@github-actions
Copy link
Copy Markdown
Contributor

🚀 This is included in version v3.28.0

GermanJablo added a commit that referenced this pull request Mar 2, 2026
## 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
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.

Unable to insert more than one table row at a time

1 participant