Skip to content

Commit 8837156

Browse files
authored
fix(list-keymap): early exit when selection is not collapsed (#5810)
1 parent 94a8d25 commit 8837156

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

.changeset/chatty-monkeys-hear.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@tiptap/extension-list-keymap": patch
3+
---
4+
5+
Fix backspace behavior when selection is not collapsed

packages/extension-list-keymap/src/listHelpers/handleBackspace.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ export const handleBackspace = (editor: Editor, name: string, parentListTypes: s
1212
return true
1313
}
1414

15+
// if the selection is not collapsed
16+
// we can rely on the default backspace behavior
17+
if (editor.state.selection.from !== editor.state.selection.to) {
18+
return false
19+
}
20+
1521
// if the current item is NOT inside a list item &
1622
// the previous item is a list (orderedList or bulletList)
1723
// move the cursor into the list and delete the current item

0 commit comments

Comments
 (0)