replace some names

This commit is contained in:
Philipp Kühn 2019-02-06 15:09:53 +01:00
parent 71ab0e0c9d
commit f8f46b4f97
2 changed files with 9 additions and 7 deletions

View File

@ -18,7 +18,7 @@ export default class TodoItem extends Node {
},
},
template: `
<li data-type="todo_item" :data-done="node.attrs.done.toString()">
<li :data-type="node.type.name" :data-done="node.attrs.done.toString()">
<span class="todo-checkbox" contenteditable="false" @click="onChange"></span>
<div class="todo-content" ref="content" :contenteditable="editable.toString()"></div>
</li>
@ -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',
}),

View File

@ -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}"]`,
}],
}
}