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

editor: fix backspace deleting formatting in list item (#6712) #6878

Merged

Conversation

01zulfi
Copy link
Collaborator

@01zulfi 01zulfi commented Nov 15, 2024

  • fix hitting backspace inside the second (or next) p in list item deleted the formatting of the entire list item

Closes #6712

@01zulfi 01zulfi force-pushed the fix/list-formatting-backspace branch from df193a5 to fd36749 Compare November 15, 2024 10:09
@01zulfi 01zulfi force-pushed the fix/list-formatting-backspace branch from fd36749 to f391d2d Compare November 15, 2024 11:33
@01zulfi 01zulfi requested a review from thecodrr November 15, 2024 11:33
@01zulfi 01zulfi force-pushed the fix/list-formatting-backspace branch from f391d2d to fd9da99 Compare November 15, 2024 12:03
}
+ // if previous item is not a list (could be a paragraph in the current list item)
+ // join to the same list item
+ if (!hasListItemBefore(name, editor.state)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

After some more testing, this is not going to work. It breaks in cases where you are backspacing in the first item of the list. This logic should be more robust to handle only the cases where we are backspacing in the second or later child inside a list item.

I also recommend adding tests for other cases:

  1. Backspacing at the start of the first list item
  2. Backspacing when there is a list right before the list item

It should handle all these cases correctly.

@01zulfi 01zulfi force-pushed the fix/list-formatting-backspace branch from fd9da99 to f90935e Compare November 18, 2024 10:20
@01zulfi 01zulfi requested a review from thecodrr November 18, 2024 10:21
Copy link
Contributor

@thecodrr thecodrr left a comment

Choose a reason for hiding this comment

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

Good work!

…#6712)

* fix hitting backspace inside the second (or next) p in list item deleted the formatting of the entire list item

Signed-off-by: 01zulfi <[email protected]>
@01zulfi 01zulfi force-pushed the fix/list-formatting-backspace branch from f90935e to 645fe82 Compare November 19, 2024 05:27
@01zulfi 01zulfi requested a review from thecodrr November 19, 2024 05:28
@thecodrr thecodrr merged commit ad78b3a into streetwriters:master Nov 19, 2024
9 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pressing BACKSPACE after SHIFT-ENTER deletes the formatting of the previous line
2 participants