Skip to content

[Fix] : Linebreak insertion breaks format inheritance#8172

Open
Jynx2004 wants to merge 27 commits intofacebook:mainfrom
Jynx2004:format_update
Open

[Fix] : Linebreak insertion breaks format inheritance#8172
Jynx2004 wants to merge 27 commits intofacebook:mainfrom
Jynx2004:format_update

Conversation

@Jynx2004
Copy link

Description

Instead of sending value 0 as a static value we take the current format from selection.format and pass it to the respective function responsible for format change.
As a result the format gets passed on between multiple linebreaks.

Closes #8160

Before

Screenshot 2026-02-26 004335

After

Screenshot 2026-02-26 004320

Jynx2004 added 19 commits July 17, 2025 19:07
Removed unnecessary checks and code related to text node styles.
@vercel
Copy link

vercel bot commented Feb 25, 2026

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

Project Deployment Actions Updated (UTC)
lexical Ready Ready Preview, Comment Feb 28, 2026 7:10pm
lexical-playground Ready Ready Preview, Comment Feb 28, 2026 7:10pm

Request Review

@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 25, 2026
Copy link
Collaborator

@etrepum etrepum left a comment

Choose a reason for hiding this comment

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

I will review this after it has new tests to show that the change has the desired behavior

@Jynx2004
Copy link
Author

I will review this after it has new tests to show that the change has the desired behavior

` -$updateSelectionFormatStyle(selection, 0, '');
  +$updateSelectionFormatStyle(selection, selection.format, '');`

Here only the passed argument is changed instead of sending static 0 value we have passed the actual format which will not need any new tests . It can be tested on existing tests.

@etrepum
Copy link
Collaborator

etrepum commented Feb 25, 2026

There needs to be a new test that shows that this change does something useful, and that future changes to lexical preserve that behavior. The existing test suite is not sufficient to show that your code works as expected.

@Jynx2004
Copy link
Author

There needs to be a new test that shows that this change does something useful, and that future changes to lexical preserve that behavior. The existing test suite is not sufficient to show that your code works as expected.

Will create some tests for testing this issue.

@Jynx2004
Copy link
Author

There needs to be a new test that shows that this change does something useful, and that future changes to lexical preserve that behavior. The existing test suite is not sufficient to show that your code works as expected.

I have added the test case to test this feature

Copy link
Collaborator

@etrepum etrepum left a comment

Choose a reason for hiding this comment

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

Based on running the unit tests locally I don't think this works, but the unit test can be written more concisely

Jynx2004 and others added 4 commits March 1, 2026 00:37
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: linebreak insertion breaks format inheritance

2 participants