Skip to content

[lexical] Bug Fix: Maintain format when replace multiple formatted text nodes with composition text#8162

Merged
etrepum merged 2 commits intofacebook:mainfrom
kimseongyu:fix-format-removed-on-multiselection-after-replace-IME
Feb 23, 2026
Merged

[lexical] Bug Fix: Maintain format when replace multiple formatted text nodes with composition text#8162
etrepum merged 2 commits intofacebook:mainfrom
kimseongyu:fix-format-removed-on-multiselection-after-replace-IME

Conversation

@kimseongyu
Copy link
Copy Markdown
Contributor

Description

Current Behavior

A regression appeared in the scenario that #8121 addressed. When replacing multi-formatted text nodes with composition text, only the first character has formatting, and it is not applied to the subsequent characters.

In issue #8067, I implemented a fix to inherit format and style when replacing multi-formatted text nodes with plain text. However, in those changes, format and style were not inherited if the node was a composing node. As a result, they are still not correctly inherited when the node is replaced during IME composition.

In issue #8119, E2E tests were introduced to verify that multi-formatted nodes are correctly replaced by composition text. However, because the tests performed bulk insertion of the composition string, they did not cover cases where the composition is committed character-by-character.

Changes in This PR

  • The logic is updated so that format and style are preserved during composition as well.
  • The existing E2E test is updated to commit composition text one character at a time so that the character-by-character.

Test plan

Before

before.mov

After

after.mov

@meta-cla meta-cla 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 Feb 22, 2026
@vercel
Copy link
Copy Markdown

vercel bot commented Feb 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lexical Ready Ready Preview, Comment Feb 22, 2026 11:16pm
lexical-playground Ready Ready Preview, Comment Feb 22, 2026 11:16pm

Request Review

@etrepum etrepum added this pull request to the merge queue Feb 23, 2026
Merged via the queue into facebook:main with commit 1448d64 Feb 23, 2026
42 checks passed
@kimseongyu kimseongyu deleted the fix-format-removed-on-multiselection-after-replace-IME branch February 23, 2026 06:49
@etrepum etrepum mentioned this pull request Feb 25, 2026
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.

2 participants