@progress/kendo-editor-common 1.11.9-dev.202411251354 → 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 +35 -53
  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
package/dist/npm/utils.js CHANGED
@@ -1,104 +1,95 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setAttribute = exports.setStyleAttr = exports.applyStyle = exports.parseStyle = exports.expandToWordWrap = exports.expandSelection = exports.shallowEqual = exports.indentHtml = exports.selectedLineTextOnly = exports.getNodeFromSelection = exports.getSelectionText = exports.hasSameMarkup = exports.insertNode = exports.parentNode = exports.findNthParentNodeOfType = exports.canInsert = exports.setNodeStyle = exports.changeStylesString = void 0;
4
- var tslib_1 = require("tslib");
5
- var prosemirror_model_1 = require("prosemirror-model");
6
- var prosemirror_state_1 = require("prosemirror-state");
7
- var kendo_common_1 = require("@progress/kendo-common");
8
- var source_1 = require("./source");
9
- var changeStylesString = function (styleText, newStyle) {
10
- var styleToChange = newStyle.style;
11
- var regExp = newStyle.value;
12
- var newValue = newStyle.newValue;
1
+ 'use strict';
2
+
3
+ var prosemirrorModel = require('prosemirror-model');
4
+ var prosemirrorState = require('prosemirror-state');
5
+ var kendoCommon = require('@progress/kendo-common');
6
+
7
+ const changeStylesString = (styleText, newStyle) => {
8
+ const styleToChange = newStyle.style;
9
+ const regExp = newStyle.value;
10
+ const newValue = newStyle.newValue;
13
11
  if (!styleText) {
14
12
  return { changed: false, style: null };
15
13
  }
16
- var styles = (0, exports.parseStyle)(styleText);
17
- var styleNames = Object.keys(styles);
18
- var filtered = [];
19
- for (var i = 0; i < styleNames.length; i++) {
20
- var name_1 = styleNames[i];
21
- if (name_1.toLowerCase() !== styleToChange || !regExp.test(styles[name_1])) {
22
- filtered.push("".concat(name_1, ": ").concat(styles[name_1]));
14
+ const styles = parseStyle(styleText);
15
+ const styleNames = Object.keys(styles);
16
+ const filtered = [];
17
+ for (let i = 0; i < styleNames.length; i++) {
18
+ const name = styleNames[i];
19
+ if (name.toLowerCase() !== styleToChange || !regExp.test(styles[name])) {
20
+ filtered.push(`${name}: ${styles[name]}`);
23
21
  }
24
22
  }
25
23
  if (newValue) {
26
- filtered.push("".concat(styleToChange, ": ").concat(newValue));
24
+ filtered.push(`${styleToChange}: ${newValue}`);
27
25
  }
28
26
  return {
29
27
  style: filtered.join('; ') + (filtered.length ? ';' : ''),
30
28
  changed: Boolean(newValue) || filtered.length !== styleNames.length
31
29
  };
32
30
  };
33
- exports.changeStylesString = changeStylesString;
34
- var reAnyValue = /^.+$/;
31
+ const reAnyValue = /^.+$/;
35
32
  function setNodeStyle(nodeAttrs, styleType, value) {
36
- var attrs;
33
+ let attrs;
37
34
  if (new RegExp('[^-]?' + styleType + ':').test(nodeAttrs.style || '')) {
38
- var style = (0, exports.changeStylesString)(nodeAttrs.style || '', { style: styleType, value: reAnyValue, newValue: value }).style;
39
- attrs = tslib_1.__assign(tslib_1.__assign({}, nodeAttrs), { style: style });
35
+ const { style } = changeStylesString(nodeAttrs.style || '', { style: styleType, value: reAnyValue, newValue: value });
36
+ attrs = { ...nodeAttrs, style };
40
37
  }
41
38
  else if (nodeAttrs.style) {
42
- attrs = tslib_1.__assign(tslib_1.__assign({}, nodeAttrs), { style: nodeAttrs.style.replace(/;$/, '') + '; ' + styleType + ': ' + value + ';' });
39
+ attrs = { ...nodeAttrs, style: nodeAttrs.style.replace(/;$/, '') + '; ' + styleType + ': ' + value + ';' };
43
40
  }
44
41
  else {
45
- attrs = tslib_1.__assign(tslib_1.__assign({}, nodeAttrs), { style: styleType + ': ' + value + ';' });
42
+ attrs = { ...nodeAttrs, style: styleType + ': ' + value + ';' };
46
43
  }
47
44
  return attrs;
48
45
  }
49
- exports.setNodeStyle = setNodeStyle;
50
46
  /**
51
47
  * Determines if a given node type can be inserted at the current cursor position.
52
48
  */
53
- var canInsert = function (state, nodeType) {
54
- var $from = state.selection.$from;
55
- for (var d = $from.depth; d >= 0; d--) {
56
- var index = $from.index(d);
49
+ const canInsert = (state, nodeType) => {
50
+ const $from = state.selection.$from;
51
+ for (let d = $from.depth; d >= 0; d--) {
52
+ const index = $from.index(d);
57
53
  if ($from.node(d).canReplaceWith(index, index, nodeType)) {
58
54
  return true;
59
55
  }
60
56
  }
61
57
  return false;
62
58
  };
63
- exports.canInsert = canInsert;
64
- var getTypeName = function (n) {
65
- return n instanceof prosemirror_model_1.Node ? n.type.name : n.name;
59
+ const getTypeName = (n) => {
60
+ return n instanceof prosemirrorModel.Node ? n.type.name : n.name;
66
61
  };
67
- var findNthParentNode = function (predicate, depth) {
68
- if (depth === void 0) { depth = 1; }
69
- return function (selection) {
70
- var $from = selection.$from;
71
- for (var i = $from.depth; i > 0; i--) {
72
- var node = $from.node(i);
62
+ const findNthParentNode = (predicate, depth = 1) => {
63
+ return (selection) => {
64
+ const { $from } = selection;
65
+ for (let i = $from.depth; i > 0; i--) {
66
+ const node = $from.node(i);
73
67
  if (predicate(node)) {
74
68
  depth = depth - 1;
75
69
  if (depth === 0) {
76
- return { depth: i, node: node };
70
+ return { depth: i, node };
77
71
  }
78
72
  }
79
73
  }
80
74
  };
81
75
  };
82
- var findNthParentNodeOfType = function (nodeType, depth) {
83
- if (depth === void 0) { depth = 1; }
84
- return function (selection) {
85
- return findNthParentNode(function (node) { return getTypeName(node) === getTypeName(nodeType); }, depth)(selection);
76
+ const findNthParentNodeOfType = (nodeType, depth = 1) => {
77
+ return (selection) => {
78
+ return findNthParentNode((node) => getTypeName(node) === getTypeName(nodeType), depth)(selection);
86
79
  };
87
80
  };
88
- exports.findNthParentNodeOfType = findNthParentNodeOfType;
89
81
  function parentNode(pos, predicate) {
90
- for (var depth = pos.depth; depth > 0; depth--) {
91
- var node = pos.node(depth);
82
+ for (let depth = pos.depth; depth > 0; depth--) {
83
+ const node = pos.node(depth);
92
84
  if (predicate(node)) {
93
- return { node: node, depth: depth };
85
+ return { node, depth };
94
86
  }
95
87
  }
96
88
  return null;
97
89
  }
98
- exports.parentNode = parentNode;
99
- var filterEmptyAttrs = function (attrs) {
100
- var result = {};
101
- for (var attr in attrs) {
90
+ const filterEmptyAttrs = (attrs) => {
91
+ const result = {};
92
+ for (const attr in attrs) {
102
93
  if (attr && (attrs[attr] || attrs[attr] === 0)) {
103
94
  result[attr] = attrs[attr];
104
95
  }
@@ -108,13 +99,13 @@ var filterEmptyAttrs = function (attrs) {
108
99
  /**
109
100
  * Inserts the given node at the place of current selection.
110
101
  */
111
- var insertNode = function (node, scrollIntoView) { return function (state, dispatch) {
112
- var selection = state.selection, tr = state.tr;
113
- if (selection instanceof prosemirror_state_1.NodeSelection
102
+ const insertNode = (node, scrollIntoView) => (state, dispatch) => {
103
+ const { selection, tr } = state;
104
+ if (selection instanceof prosemirrorState.NodeSelection
114
105
  && selection.node.type.name === node.type.name
115
106
  && node.isLeaf && !node.isText && node.nodeSize === 1) {
116
- tr.setNodeMarkup(selection.from, null, tslib_1.__assign(tslib_1.__assign({}, filterEmptyAttrs(selection.node.attrs)), filterEmptyAttrs(node.attrs)));
117
- tr.setSelection(prosemirror_state_1.NodeSelection.create(tr.doc, selection.from));
107
+ tr.setNodeMarkup(selection.from, null, { ...filterEmptyAttrs(selection.node.attrs), ...filterEmptyAttrs(node.attrs) });
108
+ tr.setSelection(prosemirrorState.NodeSelection.create(tr.doc, selection.from));
118
109
  }
119
110
  else {
120
111
  tr.replaceSelectionWith(node);
@@ -123,29 +114,20 @@ var insertNode = function (node, scrollIntoView) { return function (state, dispa
123
114
  tr.scrollIntoView();
124
115
  }
125
116
  dispatch(tr);
126
- }; };
127
- exports.insertNode = insertNode;
128
- var hasSameMarkup = function (dom1, dom2, schema, parseOptions) {
129
- var fragment1 = prosemirror_model_1.Fragment.from((0, source_1.parseContent)(dom1, schema, parseOptions));
130
- var fragment2 = prosemirror_model_1.Fragment.from((0, source_1.parseContent)(dom2, schema, parseOptions));
131
- return fragment1.eq(fragment2);
132
117
  };
133
- exports.hasSameMarkup = hasSameMarkup;
134
- var getSelectionText = function (state) {
135
- var sel = state.selection;
136
- if (sel instanceof prosemirror_state_1.TextSelection || sel instanceof prosemirror_state_1.AllSelection) {
137
- var fragment = sel.content().content;
118
+ const getSelectionText = (state) => {
119
+ const sel = state.selection;
120
+ if (sel instanceof prosemirrorState.TextSelection || sel instanceof prosemirrorState.AllSelection) {
121
+ const fragment = sel.content().content;
138
122
  return fragment.textBetween(0, fragment.size);
139
123
  }
140
124
  return '';
141
125
  };
142
- exports.getSelectionText = getSelectionText;
143
- var getNodeFromSelection = function (state) {
144
- if (state.selection instanceof prosemirror_state_1.NodeSelection) {
126
+ const getNodeFromSelection = (state) => {
127
+ if (state.selection instanceof prosemirrorState.NodeSelection) {
145
128
  return state.selection.node;
146
129
  }
147
130
  };
148
- exports.getNodeFromSelection = getNodeFromSelection;
149
131
  /**
150
132
  * Returns the text from the selection if only text is selected on a single line.
151
133
  * If selection contains leaf nodes (br, image) between text elements or
@@ -154,78 +136,72 @@ exports.getNodeFromSelection = getNodeFromSelection;
154
136
  * Useful for values of the inputs of Link and Find&Replace dialogs where the inputs value has been retrieved from the selection and
155
137
  * should be single line text only.
156
138
  */
157
- var selectedLineTextOnly = function (state) {
158
- var result = '', hasLeafs = false;
159
- var selection = state.selection, doc = state.doc;
160
- var $from = selection.$from, $to = selection.$to, from = selection.from, to = selection.to;
139
+ const selectedLineTextOnly = (state) => {
140
+ let result = '', hasLeafs = false;
141
+ const { selection, doc } = state;
142
+ const { $from, $to, from, to } = selection;
161
143
  if ($from.sameParent($to)) {
162
- doc.nodesBetween(from, to, function (node) {
144
+ doc.nodesBetween(from, to, (node) => {
163
145
  hasLeafs = hasLeafs || (node.isLeaf && !node.isText);
164
146
  });
165
147
  if (!hasLeafs) {
166
- result = (0, exports.getSelectionText)(state);
148
+ result = getSelectionText(state);
167
149
  }
168
150
  }
169
151
  return result;
170
152
  };
171
- exports.selectedLineTextOnly = selectedLineTextOnly;
172
153
  /**
173
154
  * Used by ViewHtml/ViewSource dialogs for making the HTML more readable.
174
155
  */
175
- var indentHtml = function (content) {
156
+ const indentHtml = (content) => {
176
157
  return content.replace(/<\/(p|li|ul|ol|h[1-6]|table|tr|td|th)>/ig, '</$1>\n')
177
158
  .replace(/<(ul|ol)([^>]*)><li/ig, '<$1$2>\n<li')
178
159
  .replace(/<br \/>/ig, '<br />\n')
179
160
  .replace(/\n$/, '');
180
161
  };
181
- exports.indentHtml = indentHtml;
182
- var shallowEqual = function (object1, object2) {
183
- var keys1 = Object.keys(object1);
184
- var keys2 = Object.keys(object2);
162
+ const shallowEqual = (object1, object2) => {
163
+ const keys1 = Object.keys(object1);
164
+ const keys2 = Object.keys(object2);
185
165
  return keys1.length === keys2.length &&
186
- keys1.every(function (k) { return object1[k] === object2[k]; });
166
+ keys1.every(k => object1[k] === object2[k]);
187
167
  };
188
- exports.shallowEqual = shallowEqual;
189
- var applyToWordDefault = { before: /[^ !,?.\[\]{}()]+$/i, after: /^[^ !,?.\[\]{}()]+/i };
168
+ const applyToWordDefault = { before: /[^ !,?.\[\]{}()]+$/i, after: /^[^ !,?.\[\]{}()]+/i };
190
169
  /**
191
170
  * if options.applyToWord is set, expands the selection to the word where the cursor is and
192
171
  * returns modified state and dispatch.
193
172
  */
194
- var expandSelection = function (state, dispatch, options) {
173
+ const expandSelection = (state, dispatch, options) => {
195
174
  if (!options.applyToWord || !state.selection.empty) {
196
- return { state: state, dispatch: dispatch };
175
+ return { state, dispatch };
197
176
  }
198
- var applyToWordOptions = options.applyToWord === true ? applyToWordDefault : options.applyToWord;
199
- var initialPosition = null;
200
- var tr = state.tr;
201
- var selection = state.selection;
202
- var before = selection.$head.nodeBefore;
203
- var after = selection.$head.nodeAfter;
177
+ const applyToWordOptions = options.applyToWord === true ? applyToWordDefault : options.applyToWord;
178
+ let initialPosition = null;
179
+ const tr = state.tr;
180
+ const selection = state.selection;
181
+ const before = selection.$head.nodeBefore;
182
+ const after = selection.$head.nodeAfter;
204
183
  if (before && before.type.name === 'text' && before.text && after && after.type.name === 'text' && after.text) {
205
- var children_1 = [];
206
- selection.$head.parent.descendants(function (node, pos) {
207
- children_1.push({ node: node, pos: pos });
184
+ const children = [];
185
+ selection.$head.parent.descendants((node, pos) => {
186
+ children.push({ node, pos });
208
187
  return false;
209
188
  });
210
- var cursor_1 = selection.$head.parentOffset;
211
- var nodeIndex = children_1.findIndex(function (_a) {
212
- var node = _a.node, pos = _a.pos;
213
- return pos <= cursor_1 && pos + node.nodeSize >= cursor_1;
214
- });
215
- var text = children_1[nodeIndex].node.text;
216
- var skip = false;
217
- for (var i = nodeIndex - 1; i >= 0; i--) {
218
- var element = children_1[i];
189
+ let cursor = selection.$head.parentOffset;
190
+ const nodeIndex = children.findIndex(({ node, pos }) => pos <= cursor && pos + node.nodeSize >= cursor);
191
+ let text = children[nodeIndex].node.text;
192
+ let skip = false;
193
+ for (let i = nodeIndex - 1; i >= 0; i--) {
194
+ const element = children[i];
219
195
  if (!skip && element && element.node.type.name === 'text') {
220
196
  text = element.node.text + text;
221
197
  }
222
198
  else {
223
199
  skip = true;
224
- cursor_1 -= element.node.nodeSize;
200
+ cursor -= element.node.nodeSize;
225
201
  }
226
202
  }
227
- for (var i = nodeIndex + 1; i < children_1.length; i++) {
228
- var element = children_1[i];
203
+ for (let i = nodeIndex + 1; i < children.length; i++) {
204
+ const element = children[i];
229
205
  if (element && element.node.type.name === 'text') {
230
206
  text = text + element.node.text;
231
207
  }
@@ -233,32 +209,31 @@ var expandSelection = function (state, dispatch, options) {
233
209
  break;
234
210
  }
235
211
  }
236
- var textBefore = text.substring(0, cursor_1);
237
- var textAfter = text.substring(cursor_1);
238
- var matchBefore = applyToWordOptions.before.exec(textBefore);
239
- var matchAfter = applyToWordOptions.after.exec(textAfter);
212
+ const textBefore = text.substring(0, cursor);
213
+ const textAfter = text.substring(cursor);
214
+ const matchBefore = applyToWordOptions.before.exec(textBefore);
215
+ const matchAfter = applyToWordOptions.after.exec(textAfter);
240
216
  if (matchBefore && matchAfter) {
241
- var extendLeft = matchBefore[0].length;
242
- var extendRight = matchAfter[0].length;
243
- var pos = initialPosition = selection.from;
244
- tr.setSelection(prosemirror_state_1.TextSelection.create(state.doc, pos - extendLeft, pos + extendRight));
245
- var cmdState = {
246
- tr: tr,
217
+ const extendLeft = matchBefore[0].length;
218
+ const extendRight = matchAfter[0].length;
219
+ const pos = initialPosition = selection.from;
220
+ tr.setSelection(prosemirrorState.TextSelection.create(state.doc, pos - extendLeft, pos + extendRight));
221
+ const cmdState = {
222
+ tr,
247
223
  selection: tr.selection,
248
224
  doc: tr.doc,
249
225
  storedMarks: null,
250
226
  schema: tr.doc.type.schema
251
227
  };
252
- var cmdDispatch = function (tran) {
253
- tran.setSelection(prosemirror_state_1.TextSelection.create(tran.doc, initialPosition));
228
+ const cmdDispatch = tran => {
229
+ tran.setSelection(prosemirrorState.TextSelection.create(tran.doc, initialPosition));
254
230
  dispatch(tran);
255
231
  };
256
232
  return { state: cmdState, dispatch: cmdDispatch };
257
233
  }
258
234
  }
259
- return { state: state, dispatch: dispatch };
235
+ return { state, dispatch };
260
236
  };
261
- exports.expandSelection = expandSelection;
262
237
  /**
263
238
  * if options.applyToWord is set, expands the selection to the word where the cursor is and
264
239
  * use the modified state for the passed command.
@@ -271,42 +246,38 @@ exports.expandSelection = expandSelection;
271
246
  * const command = expandToWordWrap(toggleInlineFormat, {...bold, applyToWord );
272
247
  * command(view.state, view.dispatch);
273
248
  */
274
- var expandToWordWrap = function (command, options) {
275
- return function (state, dispatch) {
276
- var _a = (0, exports.expandSelection)(state, dispatch, options), cmdState = _a.state, cmdDispatch = _a.dispatch;
249
+ const expandToWordWrap = (command, options) => {
250
+ return (state, dispatch) => {
251
+ const { state: cmdState, dispatch: cmdDispatch } = expandSelection(state, dispatch, options);
277
252
  return command(options)(cmdState, cmdDispatch);
278
253
  };
279
254
  };
280
- exports.expandToWordWrap = expandToWordWrap;
281
- var parseStyle = function (styleText) {
282
- return (0, kendo_common_1.parseInlineStyles)(styleText);
255
+ const parseStyle = (styleText) => {
256
+ return kendoCommon.parseInlineStyles(styleText);
283
257
  };
284
- exports.parseStyle = parseStyle;
285
- var applyStyle = function (styleText, styleType, styleValue) {
286
- var styles = (0, exports.parseStyle)(styleText);
258
+ const applyStyle = (styleText, styleType, styleValue) => {
259
+ const styles = parseStyle(styleText);
287
260
  styles[styleType] = styleValue;
288
- var result = Object.keys(styles)
289
- .map(function (name) { return styles[name] ? "".concat(name, ": ").concat(styles[name]) : null; })
261
+ const result = Object.keys(styles)
262
+ .map(name => styles[name] ? `${name}: ${styles[name]}` : null)
290
263
  .filter(Boolean)
291
264
  .join('; ');
292
265
  return result ? result + ';' : null;
293
266
  };
294
- exports.applyStyle = applyStyle;
295
- var setStyleAttr = function (element, styleString) {
296
- var styles = (0, exports.parseStyle)(styleString);
297
- for (var style in styles) {
267
+ const setStyleAttr = (element, styleString) => {
268
+ const styles = parseStyle(styleString);
269
+ for (const style in styles) {
298
270
  if (style && typeof element.style[style] !== 'undefined') {
299
271
  element.style[style] = styles[style];
300
272
  }
301
273
  }
302
274
  };
303
- exports.setStyleAttr = setStyleAttr;
304
- var setAttribute = function (node, attrName, value) {
305
- var current = node.getAttribute(attrName);
275
+ const setAttribute = (node, attrName, value) => {
276
+ const current = node.getAttribute(attrName);
306
277
  if (value !== undefined && value !== current) {
307
278
  if (attrName === 'style') {
308
279
  node.removeAttribute(attrName);
309
- (0, exports.setStyleAttr)(node, value);
280
+ setStyleAttr(node, value);
310
281
  }
311
282
  else {
312
283
  node.setAttribute(attrName, value);
@@ -316,4 +287,21 @@ var setAttribute = function (node, attrName, value) {
316
287
  node.removeAttribute(attrName);
317
288
  }
318
289
  };
290
+
291
+ exports.applyStyle = applyStyle;
292
+ exports.canInsert = canInsert;
293
+ exports.changeStylesString = changeStylesString;
294
+ exports.expandSelection = expandSelection;
295
+ exports.expandToWordWrap = expandToWordWrap;
296
+ exports.findNthParentNodeOfType = findNthParentNodeOfType;
297
+ exports.getNodeFromSelection = getNodeFromSelection;
298
+ exports.getSelectionText = getSelectionText;
299
+ exports.indentHtml = indentHtml;
300
+ exports.insertNode = insertNode;
301
+ exports.parentNode = parentNode;
302
+ exports.parseStyle = parseStyle;
303
+ exports.selectedLineTextOnly = selectedLineTextOnly;
319
304
  exports.setAttribute = setAttribute;
305
+ exports.setNodeStyle = setNodeStyle;
306
+ exports.setStyleAttr = setStyleAttr;
307
+ exports.shallowEqual = shallowEqual;
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@progress/kendo-editor-common",
3
3
  "description": "Kendo UI TypeScript package exporting functions for Editor component",
4
- "version": "1.11.9-dev.202411251354",
4
+ "version": "1.11.9-develop.1",
5
5
  "keywords": [
6
6
  "Kendo UI"
7
7
  ],
8
+ "type": "module",
8
9
  "author": "Progress",
9
10
  "license": "SEE LICENSE IN LICENSE.md",
10
11
  "main": "dist/npm/main.js",
@@ -15,11 +16,12 @@
15
16
  "jsdelivr": "dist/cdn/main.js",
16
17
  "unpkg": "dist/cdn/main.js",
17
18
  "scripts": {
19
+ "start": "vite",
18
20
  "test:ci": "jest",
19
21
  "test": "jest",
20
22
  "lint": "eslint .",
21
- "build-package": "cross-env NODE_OPTIONS=--openssl-legacy-provider gulp build-ts-package",
22
- "semantic-release": "semantic-release pre && semantic-prerelease publish --public && semantic-release post"
23
+ "build": "rollup -c",
24
+ "prepare": "husky"
23
25
  },
24
26
  "dependencies": {
25
27
  "@progress/kendo-common": "^1.0.2",
@@ -29,58 +31,36 @@
29
31
  "prosemirror-history": "1.4.1",
30
32
  "prosemirror-inputrules": "1.4.0",
31
33
  "prosemirror-keymap": "1.2.2",
32
- "prosemirror-model": "1.23.0",
34
+ "prosemirror-model": "1.24.0",
33
35
  "prosemirror-schema-list": "1.4.1",
34
36
  "prosemirror-state": "1.4.3",
35
37
  "prosemirror-tables": "1.6.1",
36
38
  "prosemirror-transform": "1.10.2",
37
39
  "prosemirror-view": "1.37.0",
38
- "tslib": "^2.4.0"
40
+ "tslib": "^2.8.1"
39
41
  },
40
42
  "devDependencies": {
41
- "@progress/kendo-typescript-tasks": "11.3.2",
42
- "@progress/semantic-prerelease": "^3.0.0",
43
- "@types/jasmine": "~2.2.0",
44
- "@types/jest": "^23.3.2",
43
+ "@rollup/plugin-commonjs": "^28.0.1",
44
+ "@rollup/plugin-node-resolve": "^15.3.0",
45
+ "@rollup/plugin-terser": "^0.4.4",
46
+ "@rollup/plugin-typescript": "^12.1.1",
47
+ "@types/jest": "^29.5.14",
45
48
  "@typescript-eslint/eslint-plugin": "^7.0.1",
46
- "cross-env": "^7.0.3",
47
- "cz-conventional-changelog": "^1.1.5",
48
49
  "eslint": "^8.56.0",
49
50
  "eslint-plugin-jest": "^27.8.0",
50
51
  "eslint-plugin-jsdoc": "^48.1.0",
51
52
  "eslint-plugin-typescript": "^0.14.0",
52
- "ghooks": "^1.0.3",
53
- "gulp": "^4.0.0",
53
+ "husky": "^9.1.7",
54
54
  "jest": "^29.7.0",
55
55
  "jest-environment-jsdom": "^29.7.0",
56
- "jest-preset-typescript": "^1.0.1",
57
- "semantic-release": "^6.3.6",
58
- "ts-jest": "^29.1.2",
56
+ "jest-preset-typescript": "^1.2.0",
57
+ "rollup": "^4.28.0",
58
+ "rollup-plugin-dts": "^6.1.1",
59
+ "semantic-release": "^24.2.0",
60
+ "ts-jest": "^29.2.5",
61
+ "typescript": "^5.7.2",
59
62
  "typescript-eslint": "^7.0.1",
60
- "validate-commit-msg": "^1.1.1"
61
- },
62
- "config": {
63
- "commitizen": {
64
- "path": "./node_modules/cz-conventional-changelog"
65
- },
66
- "ghooks": {
67
- "commit-msg": "validate-commit-msg"
68
- },
69
- "validate-commit-msg": {
70
- "types": [
71
- "feat",
72
- "fix",
73
- "docs",
74
- "style",
75
- "refactor",
76
- "perf",
77
- "test",
78
- "chore",
79
- "revert"
80
- ],
81
- "warnOnFail": false,
82
- "maxSubjectLength": 100
83
- }
63
+ "vite": "^6.0.2"
84
64
  },
85
65
  "jest": {
86
66
  "preset": "jest-preset-typescript",
@@ -94,20 +74,22 @@
94
74
  "url": "https://github.com/telerik/kendo-angular"
95
75
  },
96
76
  "release": {
97
- "debug": false,
98
- "branchTags": {
99
- "develop": "dev"
100
- },
101
- "fallbackTags": {
102
- "dev": "latest"
103
- },
104
- "analyzeCommits": "@progress/semantic-prerelease/analyzeCommits",
105
- "generateNotes": "@progress/semantic-prerelease/generateNotes",
106
- "getLastRelease": "@progress/semantic-prerelease/getLastRelease",
107
- "verifyConditions": "@progress/semantic-prerelease/verifyConditions",
108
- "verifyRelease": "@progress/semantic-prerelease/verifyRelease"
77
+ "branches": [
78
+ {
79
+ "name": "master",
80
+ "channel": "latest"
81
+ },
82
+ {
83
+ "name": "develop",
84
+ "prerelease": true,
85
+ "channel": "dev"
86
+ }
87
+ ]
88
+ },
89
+ "publishConfig": {
90
+ "access": "public"
109
91
  },
110
92
  "files": [
111
93
  "dist"
112
94
  ]
113
- }
95
+ }