@progress/kendo-editor-common 1.11.9-dev.202412020819 → 1.11.9-develop.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/dist/cdn/main.js +1 -1
  2. package/dist/es/DOMSerializer.js +71 -75
  3. package/dist/es/align.js +19 -16
  4. package/dist/es/blockNode.js +76 -78
  5. package/dist/es/blockquote.js +12 -9
  6. package/dist/es/cleanFormatting.js +16 -16
  7. package/dist/es/config/align-rules.js +8 -6
  8. package/dist/es/config/commands.js +9 -13
  9. package/dist/es/config/constants.js +9 -7
  10. package/dist/es/config/indent-rules.js +8 -6
  11. package/dist/es/config/keymap.js +20 -18
  12. package/dist/es/config/list-settings.js +7 -6
  13. package/dist/es/config/schema.js +184 -126
  14. package/dist/es/find-replace.js +34 -32
  15. package/dist/es/image.js +10 -7
  16. package/dist/es/indent.js +47 -44
  17. package/dist/es/inline-style.js +72 -70
  18. package/dist/es/link.js +51 -52
  19. package/dist/es/listConvert.js +37 -34
  20. package/dist/es/lists.js +83 -82
  21. package/dist/es/main.js +32 -33
  22. package/dist/es/mark.js +87 -92
  23. package/dist/es/paste.js +48 -46
  24. package/dist/es/plugins/caret-color.js +14 -11
  25. package/dist/es/plugins/csp-fix.js +23 -23
  26. package/dist/es/plugins/highlight.js +12 -10
  27. package/dist/es/plugins/image-resize.js +81 -81
  28. package/dist/es/plugins/list-markers-styles.js +43 -39
  29. package/dist/es/plugins/placeholder.js +12 -9
  30. package/dist/es/plugins/resize-utils.js +11 -9
  31. package/dist/es/plugins/spaces-fix.js +13 -10
  32. package/dist/es/plugins/table-resize/column-resize.js +104 -102
  33. package/dist/es/plugins/table-resize/index.js +10 -7
  34. package/dist/es/plugins/table-resize/row-resize.js +88 -89
  35. package/dist/es/plugins/table-resize/table-resize.js +129 -122
  36. package/dist/es/plugins/table-resize/table-view.js +46 -48
  37. package/dist/es/plugins/table-resize/utils.js +39 -41
  38. package/dist/es/source.js +78 -74
  39. package/dist/es/table.js +64 -66
  40. package/dist/es/text.js +4 -2
  41. package/dist/es/utils.js +107 -116
  42. package/dist/es2015/DOMSerializer.js +20 -17
  43. package/dist/es2015/align.js +6 -3
  44. package/dist/es2015/blockNode.js +15 -12
  45. package/dist/es2015/blockquote.js +5 -2
  46. package/dist/es2015/cleanFormatting.js +6 -3
  47. package/dist/es2015/config/align-rules.js +7 -5
  48. package/dist/es2015/config/commands.js +9 -13
  49. package/dist/es2015/config/constants.js +9 -7
  50. package/dist/es2015/config/indent-rules.js +6 -3
  51. package/dist/es2015/config/keymap.js +10 -7
  52. package/dist/es2015/config/list-settings.js +5 -3
  53. package/dist/es2015/config/schema.js +8 -6
  54. package/dist/es2015/find-replace.js +9 -6
  55. package/dist/es2015/image.js +5 -2
  56. package/dist/es2015/indent.js +14 -11
  57. package/dist/es2015/inline-style.js +9 -6
  58. package/dist/es2015/link.js +7 -4
  59. package/dist/es2015/listConvert.js +5 -2
  60. package/dist/es2015/lists.js +14 -11
  61. package/dist/es2015/main.js +32 -33
  62. package/dist/es2015/mark.js +15 -12
  63. package/dist/es2015/node_modules/tslib/tslib.es6.js +35 -0
  64. package/dist/es2015/paste.js +14 -11
  65. package/dist/es2015/plugins/caret-color.js +8 -5
  66. package/dist/es2015/plugins/csp-fix.js +5 -2
  67. package/dist/es2015/plugins/highlight.js +6 -3
  68. package/dist/es2015/plugins/image-resize.js +10 -7
  69. package/dist/es2015/plugins/list-markers-styles.js +6 -3
  70. package/dist/es2015/plugins/placeholder.js +5 -2
  71. package/dist/es2015/plugins/resize-utils.js +11 -9
  72. package/dist/es2015/plugins/spaces-fix.js +4 -1
  73. package/dist/es2015/plugins/table-resize/column-resize.js +24 -21
  74. package/dist/es2015/plugins/table-resize/index.js +9 -6
  75. package/dist/es2015/plugins/table-resize/row-resize.js +23 -20
  76. package/dist/es2015/plugins/table-resize/table-resize.js +20 -17
  77. package/dist/es2015/plugins/table-resize/table-view.js +9 -6
  78. package/dist/es2015/plugins/table-resize/utils.js +13 -10
  79. package/dist/es2015/source.js +24 -13
  80. package/dist/es2015/table.js +18 -15
  81. package/dist/es2015/text.js +3 -1
  82. package/dist/es2015/utils.js +22 -25
  83. package/dist/npm/DOMSerializer.js +73 -78
  84. package/dist/npm/align.d.ts +7 -4
  85. package/dist/npm/align.js +22 -21
  86. package/dist/npm/blockNode.d.ts +14 -15
  87. package/dist/npm/blockNode.js +91 -95
  88. package/dist/npm/blockquote.d.ts +5 -2
  89. package/dist/npm/blockquote.js +16 -15
  90. package/dist/npm/cleanFormatting.d.ts +6 -3
  91. package/dist/npm/cleanFormatting.js +17 -19
  92. package/dist/npm/config/align-rules.d.ts +8 -6
  93. package/dist/npm/config/align-rules.js +14 -9
  94. package/dist/npm/config/commands.d.ts +11 -19
  95. package/dist/npm/config/commands.js +17 -16
  96. package/dist/npm/config/constants.js +17 -10
  97. package/dist/npm/config/indent-rules.d.ts +6 -4
  98. package/dist/npm/config/indent-rules.js +11 -9
  99. package/dist/npm/config/keymap.d.ts +5 -2
  100. package/dist/npm/config/keymap.js +30 -30
  101. package/dist/npm/config/list-settings.js +13 -11
  102. package/dist/npm/config/schema.d.ts +4 -3
  103. package/dist/npm/config/schema.js +191 -134
  104. package/dist/npm/find-replace.d.ts +10 -7
  105. package/dist/npm/find-replace.js +47 -47
  106. package/dist/npm/image.d.ts +6 -3
  107. package/dist/npm/image.js +11 -10
  108. package/dist/npm/indent.d.ts +12 -9
  109. package/dist/npm/indent.js +68 -67
  110. package/dist/npm/inline-style.d.ts +7 -4
  111. package/dist/npm/inline-style.js +83 -83
  112. package/dist/npm/link.d.ts +4 -2
  113. package/dist/npm/link.js +58 -61
  114. package/dist/npm/listConvert.d.ts +3 -1
  115. package/dist/npm/listConvert.js +40 -39
  116. package/dist/npm/lists.d.ts +9 -9
  117. package/dist/npm/lists.js +94 -95
  118. package/dist/npm/main.d.ts +34 -33
  119. package/dist/npm/main.js +388 -198
  120. package/dist/npm/mark.d.ts +13 -18
  121. package/dist/npm/mark.js +104 -111
  122. package/dist/npm/paste.d.ts +12 -9
  123. package/dist/npm/paste.js +61 -61
  124. package/dist/npm/plugins/caret-color.d.ts +6 -3
  125. package/dist/npm/plugins/caret-color.js +21 -19
  126. package/dist/npm/plugins/csp-fix.d.ts +4 -1
  127. package/dist/npm/plugins/csp-fix.js +28 -30
  128. package/dist/npm/plugins/highlight.d.ts +7 -4
  129. package/dist/npm/plugins/highlight.js +17 -16
  130. package/dist/npm/plugins/image-resize.d.ts +7 -5
  131. package/dist/npm/plugins/image-resize.js +96 -97
  132. package/dist/npm/plugins/list-markers-styles.d.ts +5 -2
  133. package/dist/npm/plugins/list-markers-styles.js +49 -47
  134. package/dist/npm/plugins/placeholder.d.ts +4 -1
  135. package/dist/npm/plugins/placeholder.js +18 -17
  136. package/dist/npm/plugins/resize-utils.js +14 -12
  137. package/dist/npm/plugins/spaces-fix.d.ts +4 -1
  138. package/dist/npm/plugins/spaces-fix.js +19 -18
  139. package/dist/npm/plugins/table-resize/column-resize.js +117 -117
  140. package/dist/npm/plugins/table-resize/index.d.ts +5 -2
  141. package/dist/npm/plugins/table-resize/index.js +16 -15
  142. package/dist/npm/plugins/table-resize/row-resize.js +98 -101
  143. package/dist/npm/plugins/table-resize/table-resize.js +144 -139
  144. package/dist/npm/plugins/table-resize/table-view.js +59 -61
  145. package/dist/npm/plugins/table-resize/utils.d.ts +7 -17
  146. package/dist/npm/plugins/table-resize/utils.js +51 -52
  147. package/dist/npm/source.d.ts +18 -11
  148. package/dist/npm/source.js +94 -91
  149. package/dist/npm/table.d.ts +10 -9
  150. package/dist/npm/table.js +93 -82
  151. package/dist/npm/text.d.ts +6 -3
  152. package/dist/npm/text.js +5 -5
  153. package/dist/npm/types/active-marks.d.ts +4 -1
  154. package/dist/npm/types/command.d.ts +5 -2
  155. package/dist/npm/types/dispatchFn.d.ts +4 -1
  156. package/dist/npm/types/paste-cleanup-settings.d.ts +3 -1
  157. package/dist/npm/utils.d.ts +13 -32
  158. package/dist/npm/utils.js +133 -145
  159. package/package.json +34 -52
  160. package/dist/cdn/js/kendo-editor-common.js +0 -1
  161. package/dist/es/types/active-marks.js +0 -1
  162. package/dist/es/types/command.js +0 -1
  163. package/dist/es/types/dispatchFn.js +0 -1
  164. package/dist/es/types/paste-cleanup-settings.js +0 -1
  165. package/dist/es/types/predicate.js +0 -1
  166. package/dist/es2015/types/active-marks.js +0 -1
  167. package/dist/es2015/types/command.js +0 -1
  168. package/dist/es2015/types/dispatchFn.js +0 -1
  169. package/dist/es2015/types/paste-cleanup-settings.js +0 -1
  170. package/dist/es2015/types/predicate.js +0 -1
  171. package/dist/npm/DOMSerializer.d.ts +0 -35
  172. package/dist/npm/config/constants.d.ts +0 -7
  173. package/dist/npm/config/list-settings.d.ts +0 -30
  174. package/dist/npm/plugins/resize-utils.d.ts +0 -35
  175. package/dist/npm/plugins/table-resize/column-resize.d.ts +0 -2
  176. package/dist/npm/plugins/table-resize/row-resize.d.ts +0 -2
  177. package/dist/npm/plugins/table-resize/table-resize.d.ts +0 -18
  178. package/dist/npm/plugins/table-resize/table-view.d.ts +0 -28
  179. package/dist/npm/types/active-marks.js +0 -2
  180. package/dist/npm/types/command.js +0 -2
  181. package/dist/npm/types/dispatchFn.js +0 -2
  182. package/dist/npm/types/paste-cleanup-settings.js +0 -2
  183. package/dist/npm/types/predicate.d.ts +0 -1
  184. package/dist/npm/types/predicate.js +0 -2
  185. package/dist/systemjs/kendo-editor-common.js +0 -1
@@ -1,116 +1,132 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.marks = exports.nodes = exports.parseStrColgroup = void 0;
4
- var tslib_1 = require("tslib");
5
- var prosemirror_model_1 = require("prosemirror-model");
6
- var prosemirror_tables_1 = require("prosemirror-tables");
7
- var source_1 = require("../source");
8
- var constants_1 = require("./constants");
9
- var hole = 0;
10
- var blockquoteDOM = ['blockquote', hole], hrDOM = ['hr'], preDOM = ['pre', ['code', hole]];
11
- var olDOM = ['ol', 0], ulDOM = ['ul', 0], liDOM = ['li', 0];
12
- var domAttributes = function (dom) {
13
- var result = {};
14
- var attributes = dom.attributes;
15
- var attr;
16
- for (var i = 0; i < attributes.length; i++) {
1
+ 'use strict';
2
+
3
+ var prosemirrorModel = require('prosemirror-model');
4
+ var prosemirrorTables = require('prosemirror-tables');
5
+ var source = require('../source.js');
6
+ var constants = require('./constants.js');
7
+
8
+ const hole = 0;
9
+ const blockquoteDOM = ['blockquote', hole], hrDOM = ['hr'], preDOM = ['pre', ['code', hole]];
10
+ const olDOM = ['ol', 0], ulDOM = ['ul', 0], liDOM = ['li', 0];
11
+ const domAttributes = (dom) => {
12
+ const result = {};
13
+ const attributes = dom.attributes;
14
+ let attr;
15
+ for (let i = 0; i < attributes.length; i++) {
17
16
  attr = attributes[i];
18
17
  result[attr.name] = attr.value;
19
18
  }
20
19
  return result;
21
20
  };
22
- var defaultAttrs = function (attrs) {
23
- var nodeAttrs = {};
24
- attrs.forEach(function (attr) {
21
+ const defaultAttrs = (attrs) => {
22
+ const nodeAttrs = {};
23
+ attrs.forEach(attr => {
25
24
  nodeAttrs[attr] = { default: null };
26
25
  });
27
26
  return nodeAttrs;
28
27
  };
29
- var commonAttributes = function () { return defaultAttrs(['style', 'class', 'id']); };
30
- var hasAttrs = function (attrs, exclude) {
31
- for (var attr in attrs) {
28
+ const commonAttributes = () => defaultAttrs(['style', 'class', 'id']);
29
+ const hasAttrs = (attrs, exclude) => {
30
+ for (const attr in attrs) {
32
31
  if (attr && attrs[attr] !== null && attr !== exclude) {
33
32
  return true;
34
33
  }
35
34
  }
36
35
  return false;
37
36
  };
38
- var pmAttributes = function (attrs, exclude) {
39
- if (exclude === void 0) { exclude = []; }
40
- var result = {};
41
- var _loop_1 = function (attr) {
42
- if (attr && attrs[attr] !== null && !exclude.find(function (e) { return e === attr; })) {
37
+ const pmAttributes = (attrs, exclude = []) => {
38
+ const result = {};
39
+ for (const attr in attrs) {
40
+ if (attr && attrs[attr] !== null && !exclude.find(e => e === attr)) {
43
41
  result[attr] = attrs[attr];
44
42
  }
45
- };
46
- for (var attr in attrs) {
47
- _loop_1(attr);
48
43
  }
49
44
  return result;
50
45
  };
51
- var tagMark = function (tag) {
52
- var _a;
53
- return _a = {},
54
- _a[tag] = {
46
+ const tagMark = tag => {
47
+ return {
48
+ [tag]: {
55
49
  name: tag,
56
- inclusive: true,
50
+ inclusive: true, // https://prosemirror.net/docs/ref/#model.MarkSpec.inclusive
57
51
  parseDOM: [{ tag: tag }],
58
- toDOM: function () { return [tag, hole]; }
59
- },
60
- _a;
52
+ toDOM: () => [tag, hole]
53
+ }
54
+ };
61
55
  };
62
- var marks = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({
56
+ const marks = {
63
57
  // :: MarkSpec A link. Has `href` and `title` attributes. `title`
64
58
  // defaults to the empty string. Rendered and parsed as an `<a>`
65
59
  // element.
66
60
  link: {
67
- attrs: tslib_1.__assign(tslib_1.__assign({}, commonAttributes()), { href: { default: null }, target: { default: null }, title: { default: null } }),
61
+ attrs: {
62
+ ...commonAttributes(),
63
+ href: { default: null },
64
+ target: { default: null },
65
+ title: { default: null }
66
+ },
68
67
  inclusive: false,
69
68
  parseDOM: [{ tag: 'a', getAttrs: domAttributes }],
70
- toDOM: function (node) { return ['a', pmAttributes(node.attrs), hole]; }
71
- } }, tagMark('strong')), tagMark('b')), tagMark('em')), tagMark('i')), tagMark('del')), tagMark('sub')), tagMark('sup')), tagMark('code')), { style: {
72
- attrs: tslib_1.__assign({}, commonAttributes()),
69
+ toDOM: (node) => ['a', pmAttributes(node.attrs), hole]
70
+ },
71
+ ...tagMark('strong'),
72
+ ...tagMark('b'),
73
+ ...tagMark('em'),
74
+ ...tagMark('i'),
75
+ ...tagMark('del'),
76
+ ...tagMark('sub'),
77
+ ...tagMark('sup'),
78
+ ...tagMark('code'),
79
+ style: {
80
+ attrs: {
81
+ ...commonAttributes()
82
+ },
73
83
  parseDOM: [{
74
84
  tag: 'span',
75
85
  getAttrs: domAttributes
76
86
  }],
77
- toDOM: function (node) { return hasAttrs(node.attrs) ?
78
- ['span', pmAttributes(node.attrs), hole] : ['span', hole]; }
79
- } }), tagMark('u'));
80
- exports.marks = marks;
81
- var cellAttribute = function (name) {
82
- var _a;
83
- return _a = {},
84
- _a[name] = {
87
+ toDOM: node => hasAttrs(node.attrs) ?
88
+ ['span', pmAttributes(node.attrs), hole] : ['span', hole]
89
+ },
90
+ ...tagMark('u')
91
+ };
92
+ const cellAttribute = (name) => {
93
+ return {
94
+ [name]: {
85
95
  default: null,
86
- getFromDOM: function (cell) { return cell.getAttribute(name); },
87
- setDOMAttr: function (value, attrs) { attrs[name] = value; }
88
- },
89
- _a;
96
+ getFromDOM: (cell) => cell.getAttribute(name),
97
+ setDOMAttr: (value, attrs) => { attrs[name] = value; }
98
+ }
99
+ };
100
+ };
101
+ const cellAttributes = {
102
+ ...cellAttribute('style'),
103
+ ...cellAttribute('class'),
104
+ ...cellAttribute('id'),
105
+ ...cellAttribute('headers'),
106
+ ...cellAttribute('scope')
90
107
  };
91
- var cellAttributes = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, cellAttribute('style')), cellAttribute('class')), cellAttribute('id')), cellAttribute('headers')), cellAttribute('scope'));
92
- var colgroupNodes = {
108
+ const colgroupNodes = {
93
109
  doc: { content: 'colgroup*' },
94
110
  col: {
95
111
  attrs: defaultAttrs(['id', 'class', 'style', 'span']),
96
112
  parseDOM: [{ getAttrs: domAttributes, tag: 'col' }],
97
- toDOM: function (node) { return ['col', node.attrs]; }
113
+ toDOM: node => ['col', node.attrs]
98
114
  },
99
115
  colgroup: {
100
116
  attrs: defaultAttrs(['id', 'class', 'style', 'span']),
101
117
  content: 'col*',
102
118
  parseDOM: [{ getAttrs: domAttributes, tag: 'colgroup' }],
103
- toDOM: function (node) { return ['colgroup', node.attrs, 0]; }
119
+ toDOM: node => ['colgroup', node.attrs, 0]
104
120
  },
105
121
  text: { inline: true, group: 'inline' }
106
122
  };
107
- var colgroupSchema = new prosemirror_model_1.Schema({ nodes: colgroupNodes, marks: {} });
123
+ const colgroupSchema = new prosemirrorModel.Schema({ nodes: colgroupNodes, marks: {} });
108
124
  // will be removed when we implement our own columnResizing
109
- var shouldSkipColgroup = function (node) {
110
- var shouldSkip = false;
111
- var row = node.child(0);
112
- for (var r = 0; r < row.childCount; r++) {
113
- var cell = row.child(r);
125
+ const shouldSkipColgroup = (node) => {
126
+ let shouldSkip = false;
127
+ const row = node.child(0);
128
+ for (let r = 0; r < row.childCount; r++) {
129
+ const cell = row.child(r);
114
130
  if (cell.attrs.colwidth) {
115
131
  shouldSkip = true;
116
132
  break;
@@ -118,25 +134,30 @@ var shouldSkipColgroup = function (node) {
118
134
  }
119
135
  return shouldSkip;
120
136
  };
121
- var parseStrColgroup = function (colgroup) {
122
- var doc = (0, source_1.domToPmDoc)((0, source_1.htmlToFragment)(colgroup), colgroupSchema, { preserveWhitespace: false });
123
- var fragment = (0, source_1.pmDocToFragment)(doc);
124
- var colgroupEl = fragment.firstChild;
137
+ const parseStrColgroup = (colgroup) => {
138
+ const doc = source.domToPmDoc(source.htmlToFragment(colgroup), colgroupSchema, { preserveWhitespace: false });
139
+ const fragment = source.pmDocToFragment(doc);
140
+ const colgroupEl = fragment.firstChild;
125
141
  return colgroupEl;
126
142
  };
127
- exports.parseStrColgroup = parseStrColgroup;
128
- var tNodes = (0, prosemirror_tables_1.tableNodes)({ tableGroup: 'block', cellContent: 'block+', cellAttributes: cellAttributes });
129
- tNodes.table_row.attrs = tslib_1.__assign(tslib_1.__assign({}, tNodes.table_row.attrs), defaultAttrs([constants_1.rowTypeAttr, 'style', 'class', 'id']));
130
- tNodes.table_row.toDOM = function (node) { return ['tr', pmAttributes(node.attrs), 0]; };
143
+ const tNodes = prosemirrorTables.tableNodes({ tableGroup: 'block', cellContent: 'block+', cellAttributes });
144
+ tNodes.table_row.attrs = {
145
+ ...tNodes.table_row.attrs,
146
+ ...defaultAttrs([constants.rowTypeAttr, 'style', 'class', 'id'])
147
+ };
148
+ tNodes.table_row.toDOM = node => ['tr', pmAttributes(node.attrs), 0];
131
149
  tNodes.table_row.parseDOM = [{ tag: 'tr', getAttrs: domAttributes }];
132
- tNodes.table.attrs = tslib_1.__assign(tslib_1.__assign({}, tNodes.table.attrs), defaultAttrs(['style', 'class', 'id', constants_1.colgroupAttr, constants_1.resizableAttr]));
133
- tNodes.table.toDOM = function (node) {
134
- var tableAttrs = hasAttrs(node.attrs) ? pmAttributes(node.attrs, [constants_1.colgroupAttr, constants_1.resizableAttr]) : {};
135
- var colgroup = null;
136
- if (node.attrs[constants_1.colgroupAttr] && !shouldSkipColgroup(node)) {
137
- var colgroupEl = (0, exports.parseStrColgroup)(node.attrs[constants_1.colgroupAttr]);
150
+ tNodes.table.attrs = {
151
+ ...tNodes.table.attrs,
152
+ ...defaultAttrs(['style', 'class', 'id', constants.colgroupAttr, constants.resizableAttr])
153
+ };
154
+ tNodes.table.toDOM = (node) => {
155
+ const tableAttrs = hasAttrs(node.attrs) ? pmAttributes(node.attrs, [constants.colgroupAttr, constants.resizableAttr]) : {};
156
+ let colgroup = null;
157
+ if (node.attrs[constants.colgroupAttr] && !shouldSkipColgroup(node)) {
158
+ const colgroupEl = parseStrColgroup(node.attrs[constants.colgroupAttr]);
138
159
  if (colgroupEl) {
139
- var cols = Array.from(colgroupEl.children).map(function (c) { return ['col', domAttributes(c)]; });
160
+ const cols = Array.from(colgroupEl.children).map((c) => ['col', domAttributes(c)]);
140
161
  colgroup = [
141
162
  'colgroup',
142
163
  domAttributes(colgroupEl)
@@ -148,32 +169,35 @@ tNodes.table.toDOM = function (node) {
148
169
  };
149
170
  tNodes.table.parseDOM = [{
150
171
  tag: 'table',
151
- getAttrs: function (node) {
152
- var attrs = domAttributes(node);
153
- var colgroup = Array.from(node.childNodes).find(function (c) { return c.nodeName === 'COLGROUP'; });
172
+ getAttrs: (node) => {
173
+ const attrs = domAttributes(node);
174
+ const colgroup = Array.from(node.childNodes).find(c => c.nodeName === 'COLGROUP');
154
175
  if (colgroup) {
155
- attrs[constants_1.colgroupAttr] = colgroup.outerHTML;
176
+ attrs[constants.colgroupAttr] = colgroup.outerHTML;
156
177
  }
157
178
  return attrs;
158
179
  }
159
180
  }];
160
- var nodes = tslib_1.__assign({
181
+ const nodes = {
161
182
  // :: NodeSpec The top level document node.
162
183
  doc: {
163
184
  content: 'block+'
164
- },
185
+ },
165
186
  // :: NodeSpec A plain paragraph textblock. Represented in the DOM
166
187
  // as a `<p>` element.
167
188
  paragraph: {
168
189
  content: 'inline*',
169
190
  group: 'block',
170
- attrs: tslib_1.__assign({}, commonAttributes()),
191
+ attrs: {
192
+ ...commonAttributes()
193
+ },
171
194
  parseDOM: [{
172
195
  tag: 'p',
173
196
  getAttrs: domAttributes
174
197
  }],
175
- toDOM: function (node) { return hasAttrs(node.attrs) ? ['p', pmAttributes(node.attrs), hole] : ['p', hole]; }
176
- }, table_wrapper: {
198
+ toDOM: node => hasAttrs(node.attrs) ? ['p', pmAttributes(node.attrs), hole] : ['p', hole]
199
+ },
200
+ table_wrapper: {
177
201
  content: '(table_caption_external | table)+',
178
202
  group: 'block',
179
203
  defining: true,
@@ -185,66 +209,78 @@ var nodes = tslib_1.__assign({
185
209
  tag: 'div[table]',
186
210
  getAttrs: domAttributes
187
211
  }],
188
- toDOM: function (node) { return hasAttrs(node.attrs) ? ['div', pmAttributes(node.attrs), hole] : ['div', hole]; }
189
- }, table_caption_external: {
212
+ toDOM: node => hasAttrs(node.attrs) ? ['div', pmAttributes(node.attrs), hole] : ['div', hole]
213
+ },
214
+ table_caption_external: {
190
215
  content: 'inline+',
191
216
  group: 'block',
192
- attrs: tslib_1.__assign({ caption: { default: null } }, commonAttributes()),
217
+ attrs: {
218
+ caption: { default: null },
219
+ ...commonAttributes()
220
+ },
193
221
  parseDOM: [{
194
222
  tag: 'div[caption]',
195
223
  getAttrs: domAttributes
196
224
  }],
197
- toDOM: function (node) { return hasAttrs(node.attrs) ? ['div', pmAttributes(node.attrs), hole] : ['div', hole]; }
198
- }, div: {
225
+ toDOM: node => hasAttrs(node.attrs) ? ['div', pmAttributes(node.attrs), hole] : ['div', hole]
226
+ },
227
+ div: {
199
228
  // Uncaught SyntaxError: Mixing inline and block content (in content expression '(block | inline)*')
200
229
  // content: '(block | inline)*',
201
230
  content: 'block*',
202
231
  group: 'block',
203
- attrs: tslib_1.__assign({}, commonAttributes()),
232
+ attrs: {
233
+ ...commonAttributes()
234
+ },
204
235
  parseDOM: [{
205
236
  tag: 'div',
206
237
  getAttrs: domAttributes
207
238
  }],
208
- toDOM: function (node) { return hasAttrs(node.attrs) ? ['div', pmAttributes(node.attrs), hole] : ['div', hole]; }
209
- },
239
+ toDOM: node => hasAttrs(node.attrs) ? ['div', pmAttributes(node.attrs), hole] : ['div', hole]
240
+ },
210
241
  // :: NodeSpec A blockquote (`<blockquote>`) wrapping one or more blocks.
211
242
  blockquote: {
212
- attrs: tslib_1.__assign({}, commonAttributes()),
243
+ attrs: {
244
+ ...commonAttributes()
245
+ },
213
246
  content: 'block+',
214
247
  group: 'block',
215
- defining: true,
248
+ defining: true, // https://prosemirror.net/docs/ref/#model.NodeSpec.defining
216
249
  parseDOM: [{
217
250
  tag: 'blockquote',
218
251
  getAttrs: domAttributes
219
252
  }],
220
- toDOM: function (node) { return hasAttrs(node.attrs) ? ['blockquote', pmAttributes(node.attrs), hole] : blockquoteDOM; }
221
- },
253
+ toDOM: node => hasAttrs(node.attrs) ? ['blockquote', pmAttributes(node.attrs), hole] : blockquoteDOM
254
+ },
222
255
  // :: NodeSpec A horizontal rule (`<hr>`).
223
256
  horizontal_rule: {
224
257
  group: 'block',
225
258
  parseDOM: [{ tag: 'hr' }],
226
- toDOM: function () { return hrDOM; }
227
- },
259
+ toDOM: () => hrDOM
260
+ },
228
261
  // :: NodeSpec A heading textblock, with a `level` attribute that
229
262
  // has to hold the numbers from 1 to 6. Parsed and serialized as `<h1>` to
230
263
  // `<h6>` elements.
231
264
  heading: {
232
- attrs: tslib_1.__assign(tslib_1.__assign({}, commonAttributes()), { level: { default: 1 } }),
265
+ attrs: {
266
+ ...commonAttributes(),
267
+ level: { default: 1 }
268
+ },
233
269
  content: 'inline*',
234
270
  group: 'block',
235
271
  defining: true,
236
272
  parseDOM: [
237
- { tag: 'h1', getAttrs: function (node) { return (tslib_1.__assign(tslib_1.__assign({}, domAttributes(node)), { level: 1 })); } },
238
- { tag: 'h2', getAttrs: function (node) { return (tslib_1.__assign(tslib_1.__assign({}, domAttributes(node)), { level: 2 })); } },
239
- { tag: 'h3', getAttrs: function (node) { return (tslib_1.__assign(tslib_1.__assign({}, domAttributes(node)), { level: 3 })); } },
240
- { tag: 'h4', getAttrs: function (node) { return (tslib_1.__assign(tslib_1.__assign({}, domAttributes(node)), { level: 4 })); } },
241
- { tag: 'h5', getAttrs: function (node) { return (tslib_1.__assign(tslib_1.__assign({}, domAttributes(node)), { level: 5 })); } },
242
- { tag: 'h6', getAttrs: function (node) { return (tslib_1.__assign(tslib_1.__assign({}, domAttributes(node)), { level: 6 })); } }
273
+ { tag: 'h1', getAttrs: node => ({ ...domAttributes(node), level: 1 }) },
274
+ { tag: 'h2', getAttrs: node => ({ ...domAttributes(node), level: 2 }) },
275
+ { tag: 'h3', getAttrs: node => ({ ...domAttributes(node), level: 3 }) },
276
+ { tag: 'h4', getAttrs: node => ({ ...domAttributes(node), level: 4 }) },
277
+ { tag: 'h5', getAttrs: node => ({ ...domAttributes(node), level: 5 }) },
278
+ { tag: 'h6', getAttrs: node => ({ ...domAttributes(node), level: 6 }) }
243
279
  ],
244
- toDOM: function (node) { return hasAttrs(node.attrs, 'level') ?
280
+ toDOM: node => hasAttrs(node.attrs, 'level') ?
245
281
  ['h' + node.attrs.level, pmAttributes(node.attrs, ['level']), hole] :
246
- ['h' + node.attrs.level, hole]; }
247
- },
282
+ ['h' + node.attrs.level, hole]
283
+ },
248
284
  // :: NodeSpec A code listing. Disallows marks or non-text inline
249
285
  // nodes by default. Represented as a `<pre>` element with a
250
286
  // `<code>` element inside it.
@@ -255,36 +291,45 @@ var nodes = tslib_1.__assign({
255
291
  code: true,
256
292
  defining: true,
257
293
  parseDOM: [{ tag: 'pre', preserveWhitespace: 'full' }],
258
- toDOM: function () { return preDOM; }
259
- },
294
+ toDOM: () => preDOM
295
+ },
260
296
  // :: NodeSpec The text node.
261
297
  text: {
262
298
  inline: true,
263
299
  group: 'inline'
264
- },
300
+ },
265
301
  // :: NodeSpec An inline image (`<img>`) node. Supports `src`,
266
302
  // `alt`, and `href` attributes. The latter two default to an empty
267
303
  // string.
268
304
  image: {
269
305
  inline: true,
270
- attrs: tslib_1.__assign({ src: { default: null }, alt: { default: null }, title: { default: null }, width: { default: null }, height: { default: null } }, commonAttributes()),
306
+ attrs: {
307
+ src: { default: null },
308
+ alt: { default: null },
309
+ title: { default: null },
310
+ width: { default: null },
311
+ height: { default: null },
312
+ ...commonAttributes()
313
+ },
271
314
  group: 'inline',
272
315
  draggable: true,
273
316
  parseDOM: [{ tag: 'img', getAttrs: domAttributes }],
274
- toDOM: function (node) { return hasAttrs(node.attrs) ? ['img', pmAttributes(node.attrs)] : ['img']; }
275
- },
317
+ toDOM: node => hasAttrs(node.attrs) ? ['img', pmAttributes(node.attrs)] : ['img']
318
+ },
276
319
  // :: NodeSpec A hard line break represented in the DOM as a `<br>` element.
277
320
  hard_break: {
278
321
  inline: true,
279
- attrs: tslib_1.__assign({}, commonAttributes()),
322
+ attrs: {
323
+ ...commonAttributes()
324
+ },
280
325
  group: 'inline',
281
326
  selectable: false,
282
327
  parseDOM: [{
283
328
  tag: 'br',
284
329
  getAttrs: domAttributes
285
330
  }],
286
- toDOM: function (node) { return hasAttrs(node.attrs) ? ['br', pmAttributes(node.attrs)] : ['br']; }
287
- },
331
+ toDOM: node => hasAttrs(node.attrs) ? ['br', pmAttributes(node.attrs)] : ['br']
332
+ },
288
333
  // :: NodeSpec
289
334
  // An ordered list [node spec](#model.NodeSpec). Has a single
290
335
  // attribute, `order`, which determines the number at which the list
@@ -293,32 +338,44 @@ var nodes = tslib_1.__assign({
293
338
  ordered_list: {
294
339
  content: 'list_item+',
295
340
  group: 'block',
296
- attrs: tslib_1.__assign(tslib_1.__assign({}, commonAttributes()), { type: { default: null }, order: { default: 1 } }),
297
- parseDOM: [{ tag: 'ol', getAttrs: function (dom) {
298
- return tslib_1.__assign(tslib_1.__assign({}, domAttributes(dom)), { order: dom.hasAttribute('start') ? parseInt(dom.getAttribute('start') || '1', 10) : 1 });
341
+ attrs: {
342
+ ...commonAttributes(),
343
+ type: { default: null },
344
+ order: { default: 1 }
345
+ },
346
+ parseDOM: [{ tag: 'ol', getAttrs: (dom) => {
347
+ return {
348
+ ...domAttributes(dom),
349
+ order: dom.hasAttribute('start') ? parseInt(dom.getAttribute('start') || '1', 10) : 1
350
+ };
299
351
  } }],
300
- toDOM: function (node) {
352
+ toDOM: node => {
301
353
  return node.attrs.order === 1 ?
302
354
  (hasAttrs(node.attrs, 'order') ? ['ol', pmAttributes(node.attrs, ['order']), hole] : olDOM) :
303
- ['ol', tslib_1.__assign(tslib_1.__assign({}, pmAttributes(node.attrs, ['order'])), { start: node.attrs.order }), hole];
355
+ ['ol', { ...pmAttributes(node.attrs, ['order']), start: node.attrs.order }, hole];
304
356
  }
305
- },
357
+ },
306
358
  // :: NodeSpec
307
359
  // A bullet list node specification represented in the DOM as a `<ul>` element.
308
360
  bullet_list: {
309
361
  content: 'list_item+',
310
362
  group: 'block',
311
- attrs: tslib_1.__assign({}, commonAttributes()),
363
+ attrs: { ...commonAttributes() },
312
364
  parseDOM: [{ tag: 'ul', getAttrs: domAttributes }],
313
- toDOM: function (node) { return hasAttrs(node.attrs) ? ['ul', pmAttributes(node.attrs), hole] : ulDOM; }
314
- },
365
+ toDOM: node => hasAttrs(node.attrs) ? ['ul', pmAttributes(node.attrs), hole] : ulDOM
366
+ },
315
367
  // :: NodeSpec
316
368
  // A list item (`<li>`) specification.
317
369
  list_item: {
318
370
  content: '(paragraph | heading) block*',
319
- attrs: tslib_1.__assign({}, commonAttributes()),
371
+ attrs: { ...commonAttributes() },
320
372
  parseDOM: [{ tag: 'li', getAttrs: domAttributes }],
321
- toDOM: function (node) { return hasAttrs(node.attrs) ? ['li', pmAttributes(node.attrs), hole] : liDOM; },
373
+ toDOM: node => hasAttrs(node.attrs) ? ['li', pmAttributes(node.attrs), hole] : liDOM,
322
374
  defining: true
323
- } }, tNodes);
375
+ },
376
+ ...tNodes
377
+ };
378
+
379
+ exports.marks = marks;
324
380
  exports.nodes = nodes;
381
+ exports.parseStrColgroup = parseStrColgroup;
@@ -1,6 +1,7 @@
1
- import { TextSelection, Selection, Transaction, EditorState } from 'prosemirror-state';
1
+ import { TextSelection, EditorState, Selection, Transaction } from 'prosemirror-state';
2
2
  import { Node } from 'prosemirror-model';
3
- export interface SearchOptions {
3
+
4
+ interface SearchOptions {
4
5
  text: string;
5
6
  backward?: boolean;
6
7
  matchCyclic?: boolean;
@@ -8,14 +9,16 @@ export interface SearchOptions {
8
9
  matchWord?: boolean | ((exec: RegExpExecArray) => boolean);
9
10
  useRegExp?: boolean;
10
11
  }
11
- export declare const findAt: (doc: Node, searchOptions: SearchOptions, start: number, end: number, exit: (result: TextSelection[]) => boolean) => TextSelection[];
12
- export declare const find: (state: EditorState | {
12
+ declare const findAt: (doc: Node, searchOptions: SearchOptions, start: number, end: number, exit: (result: TextSelection[]) => boolean) => TextSelection[];
13
+ declare const find: (state: EditorState | {
13
14
  doc: Node;
14
15
  selection: Selection;
15
16
  }, searchOptions: SearchOptions) => TextSelection | null;
16
- export declare const findAll: (doc: Node, searchOptions: SearchOptions) => TextSelection[];
17
- export declare const replace: (selection: Selection | {
17
+ declare const findAll: (doc: Node, searchOptions: SearchOptions) => TextSelection[];
18
+ declare const replace: (selection: Selection | {
18
19
  from: number;
19
20
  to: number;
20
21
  }, text: string, transaction: Transaction) => Transaction;
21
- export declare const replaceAll: (state: EditorState, replaceText: string, searchOptions: SearchOptions) => Transaction | null;
22
+ declare const replaceAll: (state: EditorState, replaceText: string, searchOptions: SearchOptions) => Transaction | null;
23
+
24
+ export { type SearchOptions, find, findAll, findAt, replace, replaceAll };