Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lexical-rich-text] Bug Fix: HeadingNode.insertNewAfter #6435

Merged
merged 6 commits into from
Jul 24, 2024

Conversation

GermanJablo
Copy link
Contributor

Description

If a paragraph is inserted when the selection is at the end of a heading, a paragraph should be inserted.

However, the logic for detecting whether the selection was at the end of the heading was incorrect. It did not work if, for example, the heading had multiple TextNodes.

Copy link

vercel bot commented Jul 21, 2024

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 Jul 24, 2024 2:20am
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 24, 2024 2:20am

@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 Jul 21, 2024
Copy link

github-actions bot commented Jul 21, 2024

size-limit report 📦

Path Size
lexical - cjs 29.04 KB (0%)
lexical - esm 28.83 KB (0%)
@lexical/rich-text - cjs 37.34 KB (0%)
@lexical/rich-text - esm 28.32 KB (0%)
@lexical/plain-text - cjs 35.98 KB (0%)
@lexical/plain-text - esm 25.59 KB (0%)
@lexical/react - cjs 39.23 KB (0%)
@lexical/react - esm 29.74 KB (0%)

@GermanJablo
Copy link
Contributor Author

@potatowagon
Copy link
Contributor

i can reproduce the issue, had to create multiple text nodes in heading, eg. bold "Hello" in "Hello world"

headingNode = new HeadingNode('h1');
const headingTextNode1 = $createTextNode('hello');
const headingTextNode2 = $createTextNode(' world');
headingTextNode2.setFormat('bold');
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

@potatowagon potatowagon left a comment

Choose a reason for hiding this comment

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

thanks for the fix!

@potatowagon potatowagon added this pull request to the merge queue Jul 24, 2024
Merged via the queue into facebook:main with commit 5a7d9c7 Jul 24, 2024
48 checks passed
@GermanJablo GermanJablo deleted the heading-insertNewAfter branch July 24, 2024 10:59
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.

3 participants