-
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][lexical-playground] Bug Fix: Create line break on paste of content type text/html #6376
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Hi @jnnwnk! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
size-limit report 📦
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Hi guys, this is my first contribution to an open source project of this size. |
tested with these cases
they are working |
const parentElement = node.parentElement; | ||
if (parentElement !== null) { | ||
if (parentElement !== null && parentElement.tagName === 'P') { |
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.
maybe we could generalise this further to not convert all only child line breaks in block nodes, cause eg.
1
<div>
<br />
</div>
3
becomes
1
3
when it should be
1
3
doing on all block nodes would need more testing, ill look into it in a seperate PR.
meanwhile this change is an upgrade for lexical so i would be happy to merge once all the tests pass :)
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.
@potatowagon Are there any tests I need to fix/add?
The checks look good for me, except for After Approval
which was skipped for any reason? If there is anything I can do to make this mergable, let me know :)
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.
nothing needed, thanks for the fix!
…content type text/html (facebook#6376) Co-authored-by: Janna Wieneke <[email protected]>
Description
Current behaviour
On copy past of text with content type
text/html
(e.g. from google docs), line breaks inside of paragraphs are ignored. The HTML looks like this (I removed styling attributes for better overview):The first line break (before p tag) is recognized correctly.
The second line break (which is embedded between Test1 and Test2 in the first paragraph) gets lost.
Expected / Fixed behaviour
The line break is inserted correctly, no matter where it was placed.
Closes #5592
Test plan
Before
lexical-line-break-before-fix_XsA1rhKO.mp4
After
lexical-line-break-after-fix_gAjhcqd8.mp4