Skip to content

[lexical-rich-text] Bug Fix: preserve heading format and style when splitting a heading - #8926

Merged
etrepum merged 1 commit into
facebook:mainfrom
LeSingh1:fix/heading-split-format
Aug 5, 2026
Merged

[lexical-rich-text] Bug Fix: preserve heading format and style when splitting a heading#8926
etrepum merged 1 commit into
facebook:mainfrom
LeSingh1:fix/heading-split-format

Conversation

@LeSingh1

@LeSingh1 LeSingh1 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Description

HeadingNode.insertNewAfter() copies the tag and direction onto the second half of a split heading but not the block format or style. Pressing Enter in the middle of a centered heading produces a left-aligned one. ParagraphNode.insertNewAfter() and ListItemNode.insertNewAfter() (via $copyNode) already carry both over.

This copies getFormatType() and getStyle() onto the new heading. Only the heading-to-heading split path is affected; the end-of-heading path still creates a plain paragraph.

Test plan

Before

New unit test HeadingNode.insertNewAfter() middle keeps format and style fails on main:

AssertionError: expected '' to be 'center'

After

Passes; Tests 20 passed (20) in that file. pnpm run test-unit green (227 files, 4939 passed).

…plitting a heading

HeadingNode.insertNewAfter() copied the tag and direction onto the second
half of a split heading but not the block format or style, so pressing
Enter in the middle of a centered heading produced a left-aligned one.
ParagraphNode.insertNewAfter() and ListItemNode.insertNewAfter() both
carry those over already.
@vercel

vercel Bot commented Aug 4, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
lexical Ready Ready Preview Aug 4, 2026 8:13pm
lexical-playground Ready Ready Preview Aug 4, 2026 8:13pm

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 Aug 4, 2026
@etrepum
etrepum added this pull request to the merge queue Aug 5, 2026
Merged via the queue into facebook:main with commit be0694d Aug 5, 2026
46 checks passed
@etrepum etrepum mentioned this pull request Aug 31, 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants