-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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-html] Feature: support pasting empty block nodes #6392
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
size-limit report 📦
|
{ | ||
expectedHTML: `<p dir="ltr"><span data-lexical-text="true">a</span></p><p dir="ltr"><span data-lexical-text="true">b b</span></p><p dir="ltr"><span data-lexical-text="true">c</span></p><p dir="ltr"><span data-lexical-text="true">z </span></p><p dir="ltr"><span data-lexical-text="true">d e </span></p><p dir="ltr"><span data-lexical-text="true">fg</span></p>`, | ||
name: 'nested divs', | ||
pastedHTML: `<div> | ||
a | ||
<div> | ||
b b | ||
<div> | ||
c | ||
<div> | ||
<div></div> | ||
z | ||
</div> | ||
</div> | ||
d e | ||
</div> | ||
fg | ||
</div>`, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved this to packages/lexical-utils/src/tests/unit/LexicalEventHelpers.test.tsx onPasteFromRichText
because an extra <br />
is introduced in this test setup which i cant repro on the playground or the onPasteFromRichText test env
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Description
An empty block node (eg.
<div></div>
) in between 2 inline nodes in html places the next inline node on the next line, acting as a linebreak. lexical currently doesnt handle pasting empty block nodes, so there is a missing line break where the empty block node should be.see test plan for demo.
test cases are added as unit tests
Test plan
Before
After
Before
After