Skip to content

Commit

Permalink
fix(list-keymap): early exit when selection is not collapsed (#5810)
Browse files Browse the repository at this point in the history
  • Loading branch information
juraj98 authored Nov 7, 2024
1 parent 94a8d25 commit 8837156
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/chatty-monkeys-hear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@tiptap/extension-list-keymap": patch
---

Fix backspace behavior when selection is not collapsed
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8837156

Please sign in to comment.