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-list] Bug Fix: Retain indentation when list format is removed and reapplied #6684

Merged

Conversation

SeaBa55
Copy link
Contributor

@SeaBa55 SeaBa55 commented Sep 29, 2024

Description

There is an issue in the lexical-list package where if the user removes the current applied list format, and then reapplies the same (or other) list format, indentation will not be retained. This results in a poor user experience with lists dropping indentation, for simply toggling the list format.

After some debugging, I saw that there was an attempt to handle this behavior within the $createListOrMerge method of formatList.ts, however, the indentation was not being applied in the newly added list nodes.

I found that the indentation would be applied to the new list nodes, only if the following invocations are applied after the list is attached to root:

listItem.setFormat(node.getFormatType());
listItem.setIndent(node.getIndent());

This PR does not close any issue. I realize I should have created an issue prior, and if the team requires this I can do so. Just let me know.

Before

removing_and_reapplying_list_format_looses_indentation_2024-09-28.mp4

After

removing_and_reapplying_list_format_keeps_indentation_2024-09-28.mp4

Copy link

vercel bot commented Sep 29, 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 Oct 5, 2024 11:06pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 5, 2024 11:06pm

@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 Sep 29, 2024
Copy link

github-actions bot commented Sep 29, 2024

size-limit report 📦

Path Size
lexical - cjs 29.91 KB (0%)
lexical - esm 29.72 KB (0%)
@lexical/rich-text - cjs 38.55 KB (0%)
@lexical/rich-text - esm 31.6 KB (0%)
@lexical/plain-text - cjs 37.09 KB (0%)
@lexical/plain-text - esm 28.92 KB (0%)
@lexical/react - cjs 40.29 KB (0%)
@lexical/react - esm 32.99 KB (0%)

@SeaBa55 SeaBa55 changed the title Retain indentation when list format is removed and reapplied [lexical][lexical-list] Bug Fix: Retain indentation when list format is removed and reapplied Sep 29, 2024
ivailop7
ivailop7 previously approved these changes Sep 30, 2024
Copy link
Collaborator

@ivailop7 ivailop7 left a comment

Choose a reason for hiding this comment

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

LGTM, can I get a second look from someone please

@ivailop7 ivailop7 added the extended-tests Run extended e2e tests on a PR label Sep 30, 2024
etrepum
etrepum previously approved these changes Sep 30, 2024
Copy link
Collaborator

@etrepum etrepum left a comment

Choose a reason for hiding this comment

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

It seems like it's probably fine but I would be a lot happier about merging if there was at least one test to show that it does fix the given issue

Copy link
Collaborator

@etrepum etrepum left a comment

Choose a reason for hiding this comment

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

I can't repro any issues with the tests under react-beta locally, so maybe it's some kind of CI cache issue. Changes look good otherwise!

@etrepum etrepum added this pull request to the merge queue Oct 6, 2024
Merged via the queue into facebook:main with commit d273333 Oct 6, 2024
40 of 41 checks passed
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.

4 participants