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 }) {
return ['li', mergeAttributes(
this.options.HTMLAttributes,
HTMLAttributes,
{ 'data-type': 'taskItem' },
), 0]
renderHTML({ node, HTMLAttributes }) {
return [
'li',
mergeAttributes(
this.options.HTMLAttributes,
HTMLAttributes,
{ 'data-type': 'taskItem' },
),
[
'label',
[
'input',
{
type: 'checkbox',
checked: node.attrs.checked
? 'checked'
: null,
},
],
['span'],
],
[
'div',
0,
],
]
},
addKeyboardShortcuts() {