1 | import { uuid } from '../../utils/uuid';
|
2 | export var status = {
|
3 | inline: true,
|
4 | group: 'inline',
|
5 | selectable: true,
|
6 | attrs: {
|
7 | text: { default: '' },
|
8 | color: { default: '' },
|
9 | localId: { default: uuid.generate() },
|
10 | style: { default: '' },
|
11 | },
|
12 | parseDOM: [
|
13 | {
|
14 | tag: 'span[data-node-type="status"]',
|
15 | getAttrs: function (domNode) {
|
16 | var dom = domNode;
|
17 | return {
|
18 | text: dom.textContent.replace(/\n/, '').trim(),
|
19 | color: dom.getAttribute('data-color'),
|
20 | localId: uuid.generate(),
|
21 | style: dom.getAttribute('data-style'),
|
22 | };
|
23 | },
|
24 | },
|
25 | ],
|
26 | toDOM: function (node) {
|
27 | var _a = node.attrs, text = _a.text, color = _a.color, localId = _a.localId, style = _a.style;
|
28 | var attrs = {
|
29 | 'data-node-type': 'status',
|
30 | 'data-color': color,
|
31 | 'data-local-id': localId,
|
32 | 'data-style': style,
|
33 | contenteditable: 'false',
|
34 | };
|
35 | return ['span', attrs, text];
|
36 | },
|
37 | };
|
38 |
|
\ | No newline at end of file |