mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-01-06 02:17:49 +08:00
replace some names
This commit is contained in:
parent
71ab0e0c9d
commit
f8f46b4f97
@ -18,7 +18,7 @@ export default class TodoItem extends Node {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
template: `
|
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>
|
<span class="todo-checkbox" contenteditable="false" @click="onChange"></span>
|
||||||
<div class="todo-content" ref="content" :contenteditable="editable.toString()"></div>
|
<div class="todo-content" ref="content" :contenteditable="editable.toString()"></div>
|
||||||
</li>
|
</li>
|
||||||
@ -35,11 +35,13 @@ export default class TodoItem extends Node {
|
|||||||
},
|
},
|
||||||
draggable: true,
|
draggable: true,
|
||||||
content: 'paragraph',
|
content: 'paragraph',
|
||||||
toDOM(node) {
|
toDOM: node => {
|
||||||
const { done } = node.attrs
|
const { done } = node.attrs
|
||||||
|
|
||||||
return ['li', {
|
return [
|
||||||
'data-type': 'todo_item',
|
'li',
|
||||||
|
{
|
||||||
|
'data-type': this.name,
|
||||||
'data-done': done.toString(),
|
'data-done': done.toString(),
|
||||||
},
|
},
|
||||||
['span', { class: 'todo-checkbox', contenteditable: 'false' }],
|
['span', { class: 'todo-checkbox', contenteditable: 'false' }],
|
||||||
@ -48,7 +50,7 @@ export default class TodoItem extends Node {
|
|||||||
},
|
},
|
||||||
parseDOM: [{
|
parseDOM: [{
|
||||||
priority: 51,
|
priority: 51,
|
||||||
tag: '[data-type="todo_item"]',
|
tag: `[data-type="${this.name}"]`,
|
||||||
getAttrs: dom => ({
|
getAttrs: dom => ({
|
||||||
done: dom.getAttribute('data-done') === 'true',
|
done: dom.getAttribute('data-done') === 'true',
|
||||||
}),
|
}),
|
||||||
|
@ -11,10 +11,10 @@ export default class TodoList extends Node {
|
|||||||
return {
|
return {
|
||||||
group: 'block',
|
group: 'block',
|
||||||
content: 'todo_item+',
|
content: 'todo_item+',
|
||||||
toDOM: () => ['ul', { 'data-type': 'todo_list' }, 0],
|
toDOM: () => ['ul', { 'data-type': this.name }, 0],
|
||||||
parseDOM: [{
|
parseDOM: [{
|
||||||
priority: 51,
|
priority: 51,
|
||||||
tag: '[data-type="todo_list"]',
|
tag: `[data-type="${this.name}"]`,
|
||||||
}],
|
}],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user