fix(extension-task-item): more flexible inputs for parsing

This commit is contained in:
Yuichiro Yamashita 2024-07-18 19:31:16 +09:00 committed by GitHub
parent a21a122759
commit e6c759ba60
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
"@tiptap/extension-task-item": patch
---
allow task items to be parsed when only having `<li data-checked` instead of only when `<li data-checked="true"`

View File

@ -65,7 +65,11 @@ export const TaskItem = Node.create<TaskItemOptions>({
checked: {
default: false,
keepOnSplit: false,
parseHTML: element => element.getAttribute('data-checked') === 'true',
parseHTML: element => {
const dataChecked = element.getAttribute('data-checked')
return dataChecked == null || dataChecked === 'true'
},
renderHTML: attributes => ({
'data-checked': attributes.checked,
}),