mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-27 14:59:27 +08:00
fix(extension-task-item): more flexible inputs for parsing
This commit is contained in:
parent
a21a122759
commit
e6c759ba60
5
.changeset/serious-foxes-decide.md
Normal file
5
.changeset/serious-foxes-decide.md
Normal 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"`
|
@ -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,
|
||||
}),
|
||||
|
Loading…
Reference in New Issue
Block a user