Skip to content

[lexical] Bug Fix: copy NodeState when splitting text nodes - #7641

Merged
etrepum merged 2 commits into
meta:mainfrom
randal-atticus:node-state-copy-sibling
Jun 24, 2025
Merged

etrepum merged 2 commits into
meta:mainfrom
randal-atticus:node-state-copy-sibling

Conversation

@randal-atticus

@randal-atticus randal-atticus commented Jun 24, 2025 •

Copy link
Copy Markdown
Contributor

Description

Fixes node state not being copied to the new sibling nodes when splitting text nodes.

Test plan

Unit test created for this behaviour (and segmented text nodes)

Before

Formatting the middle of a TextNode with state applied to it would drop the styling (NodeState) from the split parts.

Screen.Recording.2025-06-24.at.11.28.34.am.mov

After

(Difficult to re-record the exact same situation above because it's on the NodeState docs page, but the test should demonstrate the desired outcome)
Here's a similar demo, showing it working:

Screen.Recording.2025-06-24.at.11.36.54.am.mov

@vercel

vercel Bot commented Jun 24, 2025 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 24, 2025 5:00am
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 24, 2025 5:00am

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 24, 2025

@etrepum etrepum left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Once the aliasing issue is addressed this looks like a good idea

@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label Jun 24, 2025

@etrepum etrepum left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good! Will merge after the test run finishes

This branch was successfully deployed

2 active deployments
Preview – lexical-playground — db958d61 Deployed Jun 24, 2025 by vercel[bot]
Preview – lexical — db958d61 Deployed Jun 24, 2025 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. extended-tests Run extended e2e tests on a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants