diff --git a/packages/extension-task-item/src/task-item.ts b/packages/extension-task-item/src/task-item.ts index c7f02883..c0e644ba 100644 --- a/packages/extension-task-item/src/task-item.ts +++ b/packages/extension-task-item/src/task-item.ts @@ -2,6 +2,7 @@ import { Node, mergeAttributes, wrappingInputRule } from '@tiptap/core' export interface TaskItemOptions { nested: boolean, + checkable: boolean, HTMLAttributes: Record, } @@ -13,6 +14,7 @@ export const TaskItem = Node.create({ addOptions() { return { nested: false, + checkable: false, HTMLAttributes: {}, } }, @@ -105,9 +107,9 @@ export const TaskItem = Node.create({ checkboxWrapper.contentEditable = 'false' checkbox.type = 'checkbox' checkbox.addEventListener('change', event => { - // if the editor isn’t editable + // if the editor isn’t editable and the item isn't checkable // we have to undo the latest change - if (!editor.isEditable) { + if (!editor.isEditable && !checkable) { checkbox.checked = !checkbox.checked return