mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-24 03:31:47 +08:00
fix(list-keymap): early exit when selection is not collapsed (#5810)
This commit is contained in:
parent
94a8d258f8
commit
88371561bb
5
.changeset/chatty-monkeys-hear.md
Normal file
5
.changeset/chatty-monkeys-hear.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"@tiptap/extension-list-keymap": patch
|
||||
---
|
||||
|
||||
Fix backspace behavior when selection is not collapsed
|
@ -12,6 +12,12 @@ export const handleBackspace = (editor: Editor, name: string, parentListTypes: s
|
||||
return true
|
||||
}
|
||||
|
||||
// if the selection is not collapsed
|
||||
// we can rely on the default backspace behavior
|
||||
if (editor.state.selection.from !== editor.state.selection.to) {
|
||||
return false
|
||||
}
|
||||
|
||||
// if the current item is NOT inside a list item &
|
||||
// the previous item is a list (orderedList or bulletList)
|
||||
// move the cursor into the list and delete the current item
|
||||
|
Loading…
Reference in New Issue
Block a user