fix: add checkboxes to TaskItem HTML output, fix #2037

This commit is contained in:
Philipp Kühn 2021-11-08 20:52:42 +01:00
parent 8fc915cade
commit c94d2b0517

View File

@ -45,12 +45,32 @@ export const TaskItem = Node.create<TaskItemOptions>({
] ]
}, },
renderHTML({ HTMLAttributes }) { renderHTML({ node, HTMLAttributes }) {
return ['li', mergeAttributes( return [
this.options.HTMLAttributes, 'li',
HTMLAttributes, mergeAttributes(
{ 'data-type': 'taskItem' }, this.options.HTMLAttributes,
), 0] HTMLAttributes,
{ 'data-type': 'taskItem' },
),
[
'label',
[
'input',
{
type: 'checkbox',
checked: node.attrs.checked
? 'checked'
: null,
},
],
['span'],
],
[
'div',
0,
],
]
}, },
addKeyboardShortcuts() { addKeyboardShortcuts() {