diff --git a/packages/tiptap-extensions/src/nodes/TodoItem.js b/packages/tiptap-extensions/src/nodes/TodoItem.js
index f7fe8a193..fdbf6bdd9 100644
--- a/packages/tiptap-extensions/src/nodes/TodoItem.js
+++ b/packages/tiptap-extensions/src/nodes/TodoItem.js
@@ -18,7 +18,7 @@ export default class TodoItem extends Node {
},
},
template: `
-
+
@@ -35,11 +35,13 @@ export default class TodoItem extends Node {
},
draggable: true,
content: 'paragraph',
- toDOM(node) {
+ toDOM: node => {
const { done } = node.attrs
- return ['li', {
- 'data-type': 'todo_item',
+ return [
+ 'li',
+ {
+ 'data-type': this.name,
'data-done': done.toString(),
},
['span', { class: 'todo-checkbox', contenteditable: 'false' }],
@@ -48,7 +50,7 @@ export default class TodoItem extends Node {
},
parseDOM: [{
priority: 51,
- tag: '[data-type="todo_item"]',
+ tag: `[data-type="${this.name}"]`,
getAttrs: dom => ({
done: dom.getAttribute('data-done') === 'true',
}),
diff --git a/packages/tiptap-extensions/src/nodes/TodoList.js b/packages/tiptap-extensions/src/nodes/TodoList.js
index fd749b860..73c8c1545 100644
--- a/packages/tiptap-extensions/src/nodes/TodoList.js
+++ b/packages/tiptap-extensions/src/nodes/TodoList.js
@@ -11,10 +11,10 @@ export default class TodoList extends Node {
return {
group: 'block',
content: 'todo_item+',
- toDOM: () => ['ul', { 'data-type': 'todo_list' }, 0],
+ toDOM: () => ['ul', { 'data-type': this.name }, 0],
parseDOM: [{
priority: 51,
- tag: '[data-type="todo_list"]',
+ tag: `[data-type="${this.name}"]`,
}],
}
}