fix(task-item): prevent onBlur being trigged when toggled (#5520)

This commit is contained in:
Jarle Friestad 2024-08-20 16:54:16 +02:00 committed by GitHub
parent 97ea55fe4c
commit dbcdaad30a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

View File

@ -0,0 +1,5 @@
---
"@tiptap/extension-task-item": patch
---
Prevent `onBlur` from being trigged when a task item is toggled

View File

@ -137,6 +137,7 @@ export const TaskItem = Node.create<TaskItemOptions>({
checkboxWrapper.contentEditable = 'false'
checkbox.type = 'checkbox'
checkbox.addEventListener('mousedown', event => event.preventDefault())
checkbox.addEventListener('change', event => {
// if the editor isnt editable and we don't have a handler for
// readonly checks we have to undo the latest change