-
-
Notifications
You must be signed in to change notification settings - Fork 668
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
editor: fix backspace deleting formatting in list item (#6712) #6878
Conversation
df193a5
to
fd36749
Compare
packages/editor/src/extensions/list-item/tests/list-tem.test.ts
Outdated
Show resolved
Hide resolved
packages/editor/patches/@tiptap+extension-list-keymap+2.6.6.patch
Outdated
Show resolved
Hide resolved
fd36749
to
f391d2d
Compare
f391d2d
to
fd9da99
Compare
} | ||
+ // 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)) { |
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.
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:
- Backspacing at the start of the first list item
- Backspacing when there is a list right before the list item
It should handle all these cases correctly.
fd9da99
to
f90935e
Compare
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.
Good work!
packages/editor/src/extensions/list-item/tests/list-item.test.ts
Outdated
Show resolved
Hide resolved
packages/editor/src/extensions/list-item/tests/list-item.test.ts
Outdated
Show resolved
Hide resolved
packages/editor/src/extensions/list-item/tests/list-item.test.ts
Outdated
Show resolved
Hide resolved
…#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]>
f90935e
to
645fe82
Compare
Closes #6712