UNPKG

1.21 kBJavaScriptView Raw
1export var layoutColumn = {
2 content: 'block+',
3 isolating: true,
4 marks: 'alignment',
5 attrs: {
6 width: {
7 default: undefined,
8 },
9 },
10 parseDOM: [
11 {
12 context: 'layoutColumn//',
13 tag: 'div[data-layout-column]',
14 skip: true,
15 },
16 {
17 tag: 'div[data-layout-column]',
18 getAttrs: function (domNode) {
19 var dom = domNode;
20 return {
21 width: Number(dom.getAttribute('data-column-width')) || undefined,
22 };
23 },
24 },
25 ],
26 toDOM: function (node) {
27 var attrs = {
28 'data-layout-column': 'true',
29 };
30 var width = node.attrs.width;
31 if (width) {
32 attrs['style'] = "flex-basis: " + width + "%";
33 attrs['data-column-width'] = width;
34 }
35 // We need to apply a attribute to the inner most child to help
36 // ProseMirror identify its boundaries better.
37 var contentAttrs = {
38 'data-layout-content': 'true',
39 };
40 return ['div', attrs, ['div', contentAttrs, 0]];
41 },
42};
43//# sourceMappingURL=layout-column.js.map
\No newline at end of file