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] [lexical-selection] Preserve paragraph styles between lines #6437

Merged
merged 10 commits into from
Jul 23, 2024

Conversation

ivailop7
Copy link
Collaborator

@ivailop7 ivailop7 commented Jul 21, 2024

This fixes the bug where we don't preserve style attributes like color, font size, background color or any custom styles when creating a new paragraph (press Enter twice).
Heavily inspired by the solution for the formatting: #5822
I've just extended in the same fashion for the styling.
Closes #5958

Before:

before_styling.mov

After:

after_styling.mov

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 22, 2024 10:31pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 22, 2024 10:31pm

@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
@ivailop7 ivailop7 changed the title Preserve paragraph styles [lexical] Preserve paragraph styles Jul 21, 2024
Copy link

github-actions bot commented Jul 21, 2024

size-limit report 📦

Path Size
lexical - cjs 28.86 KB (0%)
lexical - esm 28.73 KB (0%)
@lexical/rich-text - cjs 37.24 KB (0%)
@lexical/rich-text - esm 28.18 KB (0%)
@lexical/plain-text - cjs 35.85 KB (0%)
@lexical/plain-text - esm 25.49 KB (0%)
@lexical/react - cjs 39.14 KB (0%)
@lexical/react - esm 29.62 KB (0%)

@ivailop7 ivailop7 changed the title [lexical] Preserve paragraph styles [lexical] [lexical-selection] Preserve paragraph styles Jul 21, 2024
@ivailop7 ivailop7 marked this pull request as ready for review July 21, 2024 23:09
@ivailop7 ivailop7 added the extended-tests Run extended e2e tests on a PR label Jul 21, 2024
@ivailop7 ivailop7 changed the title [lexical] [lexical-selection] Preserve paragraph styles [lexical] [lexical-selection] Preserve paragraph styles between lines Jul 21, 2024
@ivailop7 ivailop7 added this pull request to the merge queue Jul 23, 2024
Merged via the queue into facebook:main with commit 5a3ab1f Jul 23, 2024
43 of 45 checks passed
@anasteele206
Copy link

You should be careful of making getStyle and setStyle methods on LexicalElementNode. This can cause conflicts for users who want to upgrade their lexical dependency when they are extending nodes to support importing inline style to them.

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.

How to keep styles between lines?
4 participants