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-html] Bug Fix: Preserve text alignment of nested block elements, when converting HTML to Lexical Nodes #6340

Merged
merged 9 commits into from
Jun 27, 2024

Conversation

nzigopis
Copy link
Contributor

Description

When an HTML block element, contained in another element, has text alighment set,
preserve the alignment, and don't replace from parent's
Closes #6162

Test plan

Before

An html text like this:
<div><p style="text-align: center;">Hello world!</p></div>
would result in paragraph with no text align,
while an html like this:
<div style="text-align: right;"><p style="text-align: center;">Hello world!</p></div>
would set the paragraph's text align to right

After

In both cases above, paragraph preserves it's center alignment

Copy link

vercel bot commented Jun 26, 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 Jun 26, 2024 7:38am
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 26, 2024 7:38am

@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 Jun 26, 2024
Copy link

github-actions bot commented Jun 26, 2024

size-limit report 📦

Path Size
lexical - cjs 28.47 KB (0%)
lexical - esm 28.28 KB (0%)
@lexical/rich-text - cjs 36.91 KB (0%)
@lexical/rich-text - esm 28.09 KB (0%)
@lexical/plain-text - cjs 35.54 KB (0%)
@lexical/plain-text - esm 25.3 KB (0%)
@lexical/react - cjs 38.82 KB (0%)
@lexical/react - esm 29.27 KB (0%)

@ivailop7 ivailop7 added the extended-tests Run extended e2e tests on a PR label Jun 26, 2024
@Sahejkm Sahejkm added this pull request to the merge queue Jun 27, 2024
Merged via the queue into facebook:main with commit d13e5b8 Jun 27, 2024
64 of 65 checks passed
@jiangtutu0529
Copy link

Description

When an HTML block element, contained in another element, has text alighment set, preserve the alignment, and don't replace from parent's Closes #6162

Test plan

Before

An html text like this: <div><p style="text-align: center;">Hello world!</p></div> would result in paragraph with no text align, while an html like this: <div style="text-align: right;"><p style="text-align: center;">Hello world!</p></div> would set the paragraph's text align to right

After

In both cases above, paragraph preserves it's center alignment

An html text like this: <p class="editor-paragraph"><span style="white-space: pre-wrap;">4534</span><span style="color: rgb(255, 185, 140); white-space: pre-wrap;">53</span></p> would result in paragraph with no color,how can i fix this bug?

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. extended-tests Run extended e2e tests on a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Converting HTML to Lexical Nodes strips text alignment from paragraphs
5 participants