Skip to content

[lexical-playground] Bug Fix: Code block formatting in unintended adjacent lines #8149

Open
achaljhawar wants to merge 3 commits intofacebook:mainfrom
achaljhawar:fix/code-block-formatting
Open

[lexical-playground] Bug Fix: Code block formatting in unintended adjacent lines #8149
achaljhawar wants to merge 3 commits intofacebook:mainfrom
achaljhawar:fix/code-block-formatting

Conversation

@achaljhawar
Copy link
Contributor

Description

Code block formatting was pulling in unselected content after line breaks, this pr fixes this problem by splitting paragraphs at line break boundaries before conversion.

Closes #7691

Before

Lexical.Playground.4.mp4

After

Lexical.Playground.5.mp4

@vercel
Copy link

vercel bot commented Feb 18, 2026

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

Project Deployment Actions Updated (UTC)
lexical Ready Ready Preview, Comment Feb 19, 2026 5:40pm
lexical-playground Ready Ready Preview, Comment Feb 19, 2026 5:40pm

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 18, 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.

This PR should also include a test to confirm that the problem is fixed.

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.

This does have the probably undesired effect of converting all LineBreakNode in the selection's blocks to new ParagraphNodes, rather than the ones inside or bordering the selection. Overall nice work!

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: Code Block formatting applies to unintended adjacent lines

2 participants

Comments