mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-01-19 23:03:02 +08:00
fix(extension-task-item): more flexible inputs for parsing
This commit is contained in:
parent
46079c28a6
commit
b47df57444
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: {
|
checked: {
|
||||||
default: false,
|
default: false,
|
||||||
keepOnSplit: 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 => ({
|
renderHTML: attributes => ({
|
||||||
'data-checked': attributes.checked,
|
'data-checked': attributes.checked,
|
||||||
}),
|
}),
|
||||||
|
Loading…
Reference in New Issue
Block a user