UNPKG

1.02 kBJavaScriptView Raw
1import { uuid } from '../../utils/uuid';
2export var taskItem = {
3 content: 'inline*',
4 defining: true,
5 marks: '_',
6 attrs: {
7 localId: { default: '' },
8 state: { default: 'TODO' },
9 },
10 parseDOM: [
11 {
12 tag: 'div[data-task-local-id]',
13 // Default priority is 50. We normally don't change this but since this node type is
14 // also used by list-item we need to make sure that we run this parser first.
15 priority: 100,
16 getAttrs: function (dom) { return ({
17 localId: uuid.generate(),
18 state: dom.getAttribute('data-task-state') || 'TODO',
19 }); },
20 },
21 ],
22 toDOM: function (node) {
23 var _a = node.attrs, localId = _a.localId, state = _a.state;
24 var attrs = {
25 'data-task-local-id': localId || 'local-task',
26 'data-task-state': state || 'TODO',
27 };
28 return ['div', attrs, 0];
29 },
30};
31//# sourceMappingURL=task-item.js.map
\No newline at end of file