@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,7 +1,8 @@
1
1
  import { RemoveMarkStep } from 'prosemirror-transform';
2
2
  import { MarkType } from 'prosemirror-model';
3
- import { parseStyle } from './utils';
4
- export const markApplies = (doc, ranges, type) => {
3
+ import { parseStyle } from './utils.js';
4
+
5
+ const markApplies = (doc, ranges, type) => {
5
6
  const loop = i => {
6
7
  const ref = ranges[i];
7
8
  const $from = ref.$from;
@@ -25,7 +26,7 @@ export const markApplies = (doc, ranges, type) => {
25
26
  }
26
27
  return false;
27
28
  };
28
- export const toggleMark = (markType, attrs, tr) => (state, dispatch) => {
29
+ const toggleMark = (markType, attrs, tr) => (state, dispatch) => {
29
30
  const { empty, $cursor, ranges } = state.selection;
30
31
  if ((empty && !$cursor) || !markApplies(state.doc, ranges, markType)) {
31
32
  return false;
@@ -59,7 +60,7 @@ export const toggleMark = (markType, attrs, tr) => (state, dispatch) => {
59
60
  }
60
61
  return true;
61
62
  };
62
- export const removeMark = (tr, from, to, mark) => {
63
+ const removeMark = (tr, from, to, mark) => {
63
64
  if (mark === void 0) {
64
65
  mark = null;
65
66
  }
@@ -107,7 +108,7 @@ export const removeMark = (tr, from, to, mark) => {
107
108
  matched.forEach((m) => { return tr.step(new RemoveMarkStep(m.from, m.to, m.style)); });
108
109
  return tr;
109
110
  };
110
- export const removeMarks = (marks, state, dispatch, tr) => {
111
+ const removeMarks = (marks, state, dispatch, tr) => {
111
112
  const { $cursor, ranges } = state.selection;
112
113
  tr = tr || state.tr;
113
114
  if ($cursor) {
@@ -129,7 +130,7 @@ export const removeMarks = (marks, state, dispatch, tr) => {
129
130
  return true;
130
131
  };
131
132
  const toArray = (x) => x instanceof Array ? x : [x];
132
- export const removeAllMarks = ({ except = [] } = {}) => (state, dispatch) => {
133
+ const removeAllMarks = ({ except = [] } = {}) => (state, dispatch) => {
133
134
  const tr = state.tr;
134
135
  cleanMarks(tr, { except: toArray(except) });
135
136
  if (tr.docChanged) {
@@ -143,7 +144,7 @@ export const removeAllMarks = ({ except = [] } = {}) => (state, dispatch) => {
143
144
  * @example
144
145
  * See `removeAllMarks` or `cleanFormatting` function.
145
146
  */
146
- export const cleanMarks = (tr, { except }) => {
147
+ const cleanMarks = (tr, { except }) => {
147
148
  const { doc, selection } = tr;
148
149
  const schema = doc.type.schema;
149
150
  const { empty, ranges } = selection;
@@ -161,7 +162,7 @@ export const cleanMarks = (tr, { except }) => {
161
162
  * Checks if a mark exists in the selection.
162
163
  * Used for checking the state of bold, italic, ... and unlink tools.
163
164
  */
164
- export const hasMark = (state, options) => {
165
+ const hasMark = (state, options) => {
165
166
  const marks = state.schema.marks;
166
167
  const altMarks = (options.altMarks || []).filter(m => marks[m]);
167
168
  const altStyle = options.altStyle;
@@ -183,7 +184,7 @@ export const hasMark = (state, options) => {
183
184
  }
184
185
  return Boolean(result);
185
186
  };
186
- export const styleValue = (mark, style) => {
187
+ const styleValue = (mark, style) => {
187
188
  const styleText = (mark && mark.attrs.style) || '';
188
189
  const styles = parseStyle(styleText);
189
190
  const styleNames = Object.keys(styles);
@@ -198,7 +199,7 @@ export const styleValue = (mark, style) => {
198
199
  /**
199
200
  * Returns the marks of a specific type for every inline node in the selection.
200
201
  */
201
- export const selectionMarks = (state, markType) => {
202
+ const selectionMarks = (state, markType) => {
202
203
  const { from, $from, to, empty } = state.selection;
203
204
  const marks = [];
204
205
  if (empty) {
@@ -217,7 +218,7 @@ export const selectionMarks = (state, markType) => {
217
218
  * Returns the specified mark which wraps the selection.
218
219
  * Used by link tools.
219
220
  */
220
- export const getMark = (state, markType) => {
221
+ const getMark = (state, markType) => {
221
222
  const marks = selectionMarks(state, markType);
222
223
  const filtered = marks.filter(m => Boolean(m));
223
224
  return marks.length === filtered.length ? marks[0] : undefined;
@@ -225,7 +226,7 @@ export const getMark = (state, markType) => {
225
226
  /**
226
227
  * **Deprecated.** Use `selectionMarks` function instead.
227
228
  */
228
- export const getActiveMarks = (state, markType) => {
229
+ const getActiveMarks = (state, markType) => {
229
230
  const marks = selectionMarks(state, markType);
230
231
  const filtered = marks.filter(m => Boolean(m));
231
232
  const hasNodesWithoutMarks = marks.length !== filtered.length;
@@ -234,3 +235,5 @@ export const getActiveMarks = (state, markType) => {
234
235
  marks: filtered
235
236
  };
236
237
  };
238
+
239
+ export { cleanMarks, getActiveMarks, getMark, hasMark, markApplies, removeAllMarks, removeMark, removeMarks, selectionMarks, styleValue, toggleMark };
@@ -0,0 +1,35 @@
1
+ /******************************************************************************
2
+ Copyright (c) Microsoft Corporation.
3
+
4
+ Permission to use, copy, modify, and/or distribute this software for any
5
+ purpose with or without fee is hereby granted.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
+ PERFORMANCE OF THIS SOFTWARE.
14
+ ***************************************************************************** */
15
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
16
+
17
+
18
+ function __rest(s, e) {
19
+ var t = {};
20
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
21
+ t[p] = s[p];
22
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
23
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
24
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
25
+ t[p[i]] = s[p[i]];
26
+ }
27
+ return t;
28
+ }
29
+
30
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
31
+ var e = new Error(message);
32
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
33
+ };
34
+
35
+ export { __rest };
@@ -1,10 +1,11 @@
1
- import { convertMsLists } from './listConvert';
2
- import { fragmentToHtml, htmlToFragment } from './source';
3
- import { parseStyle } from './utils';
1
+ import { convertMsLists } from './listConvert.js';
2
+ import { htmlToFragment, fragmentToHtml } from './source.js';
3
+ import { parseStyle } from './utils.js';
4
+
4
5
  /**
5
6
  * Removes the invalid HTML. Use it as a first step for cleaning the HTML.
6
7
  */
7
- export const sanitize = (html) => {
8
+ const sanitize = (html) => {
8
9
  html = html.replace(/^[\s\S]+?<!--StartFragment-->\s*([\s\S]*?)\s*<!--EndFragment-->[\s\S]+$/, '$1');
9
10
  html = html.replace(/<\/?[ovw]:[^>]*?>/gi, ''); // MS elements, e.g. <o:p>, <w:sdtPr>, <v:
10
11
  html = html.replace(/<\\?\??xml[^>]*>/gi, ''); // XML namespaces
@@ -20,19 +21,19 @@ export const sanitize = (html) => {
20
21
  /**
21
22
  * Removes comments in HTML.
22
23
  */
23
- export const removeComments = (html) => {
24
+ const removeComments = (html) => {
24
25
  return html.replace(/<!--[\s\S]+?-->/g, '');
25
26
  };
26
27
  /**
27
28
  * Removes the specified tag(s).
28
29
  */
29
- export const removeTag = (html, tagPattern) => {
30
+ const removeTag = (html, tagPattern) => {
30
31
  return html.replace(new RegExp('<\\/?(' + tagPattern + ')(?:\\s[^>]*?)?>', 'gi'), '');
31
32
  };
32
33
  /**
33
34
  * Removes the passed attribute.
34
35
  */
35
- export const removeAttribute = (attr) => {
36
+ const removeAttribute = (attr) => {
36
37
  if (attr.ownerElement) {
37
38
  attr.ownerElement.removeAttribute(attr.name);
38
39
  }
@@ -40,7 +41,7 @@ export const removeAttribute = (attr) => {
40
41
  /**
41
42
  * Remove the attribute if its value matches /^Mso/ regex.
42
43
  */
43
- export const sanitizeClassAttr = (attr) => {
44
+ const sanitizeClassAttr = (attr) => {
44
45
  if (/^Mso/.test(attr.value)) {
45
46
  removeAttribute(attr);
46
47
  }
@@ -48,7 +49,7 @@ export const sanitizeClassAttr = (attr) => {
48
49
  /**
49
50
  * Removes invalid HTML styles.
50
51
  */
51
- export const sanitizeStyleAttr = (attr) => {
52
+ const sanitizeStyleAttr = (attr) => {
52
53
  const styles = parseStyle(attr.value);
53
54
  const element = attr.ownerElement;
54
55
  const supportedStyles = element.style;
@@ -95,7 +96,7 @@ const sanitizeNode = (node, attributes) => {
95
96
  * Cleans the HTML based on passed settings.
96
97
  * Before using it, clean the HTML with the `sanitize` function.
97
98
  */
98
- export const pasteCleanup = (html, settings) => {
99
+ const pasteCleanup = (html, settings) => {
99
100
  let result = html;
100
101
  if (settings.convertMsLists) {
101
102
  result = convertMsLists(result);
@@ -133,7 +134,7 @@ const textRtfType = 'text/rtf';
133
134
  * @param clipboardData - The paste event clipboardData object (event.clipboardData).
134
135
  * @returns - The html with the replaced images sources.
135
136
  */
136
- export const replaceImageSourcesFromRtf = (html, clipboardData) => {
137
+ const replaceImageSourcesFromRtf = (html, clipboardData) => {
137
138
  const htmlImages = html.match(reHtmlImg);
138
139
  if (!htmlImages || clipboardData.types.indexOf(textRtfType) === -1) {
139
140
  return html;
@@ -159,3 +160,5 @@ export const replaceImageSourcesFromRtf = (html, clipboardData) => {
159
160
  return img.replace(reLocalFile, src);
160
161
  });
161
162
  };
163
+
164
+ export { pasteCleanup, removeAttribute, removeComments, removeTag, replaceImageSourcesFromRtf, sanitize, sanitizeClassAttr, sanitizeStyleAttr };
@@ -1,8 +1,9 @@
1
- import { Plugin, PluginKey } from 'prosemirror-state';
2
- import { Decoration, DecorationSet } from 'prosemirror-view';
3
- import { styleValue } from './../mark';
4
- export const caretColorKey = new PluginKey('caret-color');
5
- export function caretColor() {
1
+ import { PluginKey, Plugin } from 'prosemirror-state';
2
+ import { DecorationSet, Decoration } from 'prosemirror-view';
3
+ import { styleValue } from '../mark.js';
4
+
5
+ const caretColorKey = new PluginKey('caret-color');
6
+ function caretColor() {
6
7
  return new Plugin({
7
8
  key: caretColorKey,
8
9
  props: {
@@ -29,3 +30,5 @@ export function caretColor() {
29
30
  }
30
31
  });
31
32
  }
33
+
34
+ export { caretColor, caretColorKey };
@@ -1,5 +1,6 @@
1
1
  import { Plugin, PluginKey } from 'prosemirror-state';
2
- import { setAttribute } from '../utils';
2
+ import { setAttribute } from '../utils.js';
3
+
3
4
  const setAttributes = (dom, attrs) => {
4
5
  for (const attrName in attrs) {
5
6
  if (attrName) {
@@ -25,7 +26,7 @@ class StyleView {
25
26
  this.contentDOM = this.dom;
26
27
  }
27
28
  }
28
- export const cspFix = () => {
29
+ const cspFix = () => {
29
30
  return new Plugin({
30
31
  key: new PluginKey('csp-fix'),
31
32
  props: {
@@ -46,3 +47,5 @@ export const cspFix = () => {
46
47
  }
47
48
  });
48
49
  };
50
+
51
+ export { cspFix };
@@ -1,8 +1,9 @@
1
- import { Plugin, PluginKey } from 'prosemirror-state';
1
+ import { PluginKey, Plugin } from 'prosemirror-state';
2
2
  import { Decoration, DecorationSet } from 'prosemirror-view';
3
+
3
4
  // https://discuss.prosemirror.net/t/passing-data-between-plugins/1843
4
- export const textHighlightKey = new PluginKey('highlight');
5
- export function textHighlight(key = textHighlightKey) {
5
+ const textHighlightKey = new PluginKey('highlight');
6
+ function textHighlight(key = textHighlightKey) {
6
7
  return new Plugin({
7
8
  key,
8
9
  state: {
@@ -18,3 +19,5 @@ export function textHighlight(key = textHighlightKey) {
18
19
  }
19
20
  });
20
21
  }
22
+
23
+ export { textHighlight, textHighlightKey };
@@ -1,9 +1,10 @@
1
- import { NodeSelection, Plugin, PluginKey } from 'prosemirror-state';
2
- import { Decoration, DecorationSet } from 'prosemirror-view';
3
- import { dataResizeDirImage, resizeHandle } from '../config/constants';
4
- import { changeStylesString } from '../utils';
5
- import { directions, handles } from './resize-utils';
6
- export const imageResizeKey = new PluginKey('image-resize');
1
+ import { PluginKey, Plugin, NodeSelection } from 'prosemirror-state';
2
+ import { DecorationSet, Decoration } from 'prosemirror-view';
3
+ import { resizeHandle, dataResizeDirImage } from '../config/constants.js';
4
+ import { changeStylesString } from '../utils.js';
5
+ import { handles, directions } from './resize-utils.js';
6
+
7
+ const imageResizeKey = new PluginKey('image-resize');
7
8
  const setSize = (domNode, sizeType, value) => {
8
9
  domNode.style[sizeType] = value + 'px';
9
10
  };
@@ -125,7 +126,7 @@ const handleMouseDown = (view, event, options) => {
125
126
  event.view.addEventListener('mousemove', move);
126
127
  return true;
127
128
  };
128
- export const imageResizing = (options = { node: 'image', lockRatio: true }) => {
129
+ const imageResizing = (options = { node: 'image', lockRatio: true }) => {
129
130
  return new Plugin({
130
131
  key: imageResizeKey,
131
132
  view: (viewObj) => ({
@@ -220,3 +221,5 @@ export const imageResizing = (options = { node: 'image', lockRatio: true }) => {
220
221
  }
221
222
  });
222
223
  };
224
+
225
+ export { imageResizeKey, imageResizing };
@@ -1,6 +1,7 @@
1
1
  import { Plugin, PluginKey } from 'prosemirror-state';
2
2
  import { RemoveMarkStep } from 'prosemirror-transform';
3
- import { parseStyle, applyStyle, parentNode } from '../utils';
3
+ import { applyStyle, parseStyle, parentNode } from '../utils.js';
4
+
4
5
  const inSelection = (from, to, nodePos, node, doc) => {
5
6
  const $from = doc.resolve(from);
6
7
  const $to = doc.resolve(to);
@@ -71,7 +72,7 @@ const cleanListItems = (tr, state, options) => {
71
72
  const DEFAULT_OPTIONS = {
72
73
  listItem: 'list_item',
73
74
  resetValues: {
74
- 'font-size': '',
75
+ 'font-size': '', // 'initial' or '16px'
75
76
  'font-family': '',
76
77
  'color': ''
77
78
  }
@@ -79,7 +80,7 @@ const DEFAULT_OPTIONS = {
79
80
  /**
80
81
  * Returns a plugin which applies font-size, font-family, color styles to list item marker.
81
82
  */
82
- export function listMarkersStyles(options = DEFAULT_OPTIONS) {
83
+ function listMarkersStyles(options = DEFAULT_OPTIONS) {
83
84
  return new Plugin({
84
85
  key: new PluginKey('list-markers-styles'),
85
86
  appendTransaction: (transactions, _oldState, newState) => {
@@ -99,3 +100,5 @@ export function listMarkersStyles(options = DEFAULT_OPTIONS) {
99
100
  }
100
101
  });
101
102
  }
103
+
104
+ export { listMarkersStyles };
@@ -1,6 +1,7 @@
1
1
  import { Plugin, PluginKey } from 'prosemirror-state';
2
- import { Decoration, DecorationSet } from 'prosemirror-view';
3
- export function placeholder(message) {
2
+ import { DecorationSet, Decoration } from 'prosemirror-view';
3
+
4
+ function placeholder(message) {
4
5
  const decAttrs = { class: 'k-placeholder', 'data-placeholder': message };
5
6
  return new Plugin({
6
7
  key: new PluginKey('placeholder'),
@@ -22,3 +23,5 @@ export function placeholder(message) {
22
23
  }
23
24
  });
24
25
  }
26
+
27
+ export { placeholder };
@@ -1,11 +1,13 @@
1
- export const directions = {
2
- 'southeast': { x: 1, y: 1 },
3
- 'east': { x: 1, y: 0 },
4
- 'south': { x: 0, y: 1 },
5
- 'north': { x: 0, y: -1 },
6
- 'west': { x: -1, y: 0 },
7
- 'southwest': { x: -1, y: 1 },
8
- 'northwest': { x: -1, y: -1 },
1
+ const directions = {
2
+ 'southeast': { x: 1, y: 1 }, // bottom right
3
+ 'east': { x: 1, y: 0 }, // right
4
+ 'south': { x: 0, y: 1 }, // bottom
5
+ 'north': { x: 0, y: -1 }, // top
6
+ 'west': { x: -1, y: 0 }, // left
7
+ 'southwest': { x: -1, y: 1 }, // bottom left
8
+ 'northwest': { x: -1, y: -1 }, // top left
9
9
  'northeast': { x: 1, y: -1 } // top right
10
10
  };
11
- export const handles = Object.keys(directions);
11
+ const handles = Object.keys(directions);
12
+
13
+ export { directions, handles };
@@ -1,5 +1,6 @@
1
1
  import { Plugin, PluginKey } from 'prosemirror-state';
2
2
  import { Decoration, DecorationSet } from 'prosemirror-view';
3
+
3
4
  // The plugin resolves the following problems:
4
5
  //
5
6
  // 1. white-space: pre-wrap does not work with text-align: justify in firefox
@@ -13,7 +14,7 @@ import { Decoration, DecorationSet } from 'prosemirror-view';
13
14
  const spaces = /\s+/g;
14
15
  const align = /text-align/;
15
16
  const aligned = (node) => align.test((node && node.attrs && node.attrs.style) || '');
16
- export const spacesFix = () => new Plugin({
17
+ const spacesFix = () => new Plugin({
17
18
  key: new PluginKey('spaces-fix'),
18
19
  props: {
19
20
  decorations: (state) => {
@@ -41,3 +42,5 @@ export const spacesFix = () => new Plugin({
41
42
  }
42
43
  }
43
44
  });
45
+
46
+ export { spacesFix };
@@ -1,14 +1,15 @@
1
1
  import { Plugin } from 'prosemirror-state';
2
2
  import { TableMap } from 'prosemirror-tables';
3
- import { Decoration, DecorationSet } from 'prosemirror-view';
4
- import { colgroupAttr } from '../../config/constants';
5
- import { TableView, TableWrapperView } from './table-view';
6
- import { parseStyle, setNodeStyle } from './../../utils';
7
- import { cellIndexes, domCellAround, otherResizeHandle, otherResizing, edgeCell, tableColumnResizeKey as key } from './utils';
8
- export function columnResizing() {
3
+ import { DecorationSet, Decoration } from 'prosemirror-view';
4
+ import { colgroupAttr } from '../../config/constants.js';
5
+ import { TableWrapperView, TableView } from './table-view.js';
6
+ import { setNodeStyle, parseStyle } from '../../utils.js';
7
+ import { tableColumnResizeKey, otherResizeHandle, otherResizing, domCellAround, cellIndexes, edgeCell } from './utils.js';
8
+
9
+ function columnResizing() {
9
10
  const handleWidth = 5, cellMinWidth = 25;
10
11
  const plugin = new Plugin({
11
- key,
12
+ key: tableColumnResizeKey,
12
13
  state: {
13
14
  init() {
14
15
  return new ResizeState(-1, null);
@@ -19,15 +20,15 @@ export function columnResizing() {
19
20
  },
20
21
  props: {
21
22
  attributes(state) {
22
- if (otherResizeHandle(key, state)) {
23
+ if (otherResizeHandle(tableColumnResizeKey, state)) {
23
24
  return null;
24
25
  }
25
- const pluginState = key.getState(state);
26
+ const pluginState = tableColumnResizeKey.getState(state);
26
27
  return pluginState.activeHandle > -1 ? { class: 'resize-cursor' } : null;
27
28
  },
28
29
  handleDOMEvents: {
29
30
  mousemove(view, event) {
30
- if (!otherResizing(key, view.state)) {
31
+ if (!otherResizing(tableColumnResizeKey, view.state)) {
31
32
  handleMouseMove(view, event, handleWidth);
32
33
  }
33
34
  return false;
@@ -41,8 +42,8 @@ export function columnResizing() {
41
42
  }
42
43
  },
43
44
  decorations(state) {
44
- if (!otherResizing(key, state)) {
45
- const pluginState = key.getState(state);
45
+ if (!otherResizing(tableColumnResizeKey, state)) {
46
+ const pluginState = tableColumnResizeKey.getState(state);
46
47
  if (pluginState.activeHandle > -1) {
47
48
  return handleDecorations(state, pluginState.activeHandle);
48
49
  }
@@ -67,7 +68,7 @@ class ResizeState {
67
68
  }
68
69
  apply(tr) {
69
70
  let state;
70
- const action = tr.getMeta(key);
71
+ const action = tr.getMeta(tableColumnResizeKey);
71
72
  if (action && action.setHandle != null) {
72
73
  return new ResizeState(action.setHandle, null);
73
74
  }
@@ -85,7 +86,7 @@ class ResizeState {
85
86
  }
86
87
  }
87
88
  function handleMouseMove(view, event, handleWidth) {
88
- const pluginState = key.getState(view.state);
89
+ const pluginState = tableColumnResizeKey.getState(view.state);
89
90
  if (!pluginState.dragging) {
90
91
  const target = domCellAround(event.target);
91
92
  let cell = -1;
@@ -106,13 +107,13 @@ function handleMouseMove(view, event, handleWidth) {
106
107
  }
107
108
  }
108
109
  function handleMouseLeave(view) {
109
- const pluginState = key.getState(view.state);
110
+ const pluginState = tableColumnResizeKey.getState(view.state);
110
111
  if (pluginState.activeHandle > -1 && !pluginState.dragging) {
111
112
  updateHandle(view, -1);
112
113
  }
113
114
  }
114
115
  function handleMouseDown(view, event, cellMinWidth) {
115
- const pluginState = key.getState(view.state);
116
+ const pluginState = tableColumnResizeKey.getState(view.state);
116
117
  if (pluginState.activeHandle === -1 || pluginState.dragging) {
117
118
  return false;
118
119
  }
@@ -152,7 +153,7 @@ function handleMouseDown(view, event, cellMinWidth) {
152
153
  tableAttrs = Object.assign(Object.assign({}, tableNode.attrs), { [colgroupAttr]: '<colgroup>' + cols.reduce((acc, cur) => acc + cur.outerHTML, '') + '</colgroup>' });
153
154
  }
154
155
  const width = parseFloat(col.style.width);
155
- const tr = view.state.tr.setMeta(key, { setDragging: { startX: event.clientX, startWidth: width } });
156
+ const tr = view.state.tr.setMeta(tableColumnResizeKey, { setDragging: { startX: event.clientX, startWidth: width } });
156
157
  if (!tableDom.style.width) {
157
158
  const widths = Array.from(col.parentNode.children).map((c) => c.style.width);
158
159
  if (widths.every(Boolean)) {
@@ -168,18 +169,18 @@ function handleMouseDown(view, event, cellMinWidth) {
168
169
  function finish(ev) {
169
170
  ev.view.removeEventListener('mouseup', finish);
170
171
  ev.view.removeEventListener('mousemove', move);
171
- const curPluginState = key.getState(view.state);
172
+ const curPluginState = tableColumnResizeKey.getState(view.state);
172
173
  if (curPluginState.dragging) {
173
174
  const transaction = view.state.tr;
174
175
  updateColumnWidth(view, transaction, curPluginState.activeHandle);
175
- view.dispatch(transaction.setMeta(key, { setDragging: null }));
176
+ view.dispatch(transaction.setMeta(tableColumnResizeKey, { setDragging: null }));
176
177
  }
177
178
  }
178
179
  function move(ev) {
179
180
  if (!ev.which) {
180
181
  return finish(ev);
181
182
  }
182
- const curPluginState = key.getState(view.state);
183
+ const curPluginState = tableColumnResizeKey.getState(view.state);
183
184
  const dragged = draggedWidth(curPluginState.dragging, ev, cellMinWidth);
184
185
  displayColumnWidth(view, curPluginState.activeHandle, dragged);
185
186
  }
@@ -195,7 +196,7 @@ function draggedWidth(dragging, event, cellMinWidth) {
195
196
  function updateHandle(view, value) {
196
197
  const tr = view.state.tr;
197
198
  tr.setMeta('addToHistory', false);
198
- tr.setMeta(key, { setHandle: value });
199
+ tr.setMeta(tableColumnResizeKey, { setHandle: value });
199
200
  view.dispatch(tr);
200
201
  }
201
202
  function updateColumnWidth(view, tr, cell) {
@@ -262,3 +263,5 @@ function handleDecorations(state, cell) {
262
263
  }));
263
264
  return DecorationSet.create(state.doc, decorations);
264
265
  }
266
+
267
+ export { columnResizing };
@@ -1,9 +1,12 @@
1
- import { columnResizing } from './column-resize';
2
- import { tableResizing as tableResize } from './table-resize';
3
- import { rowResizing } from './row-resize';
4
- export const tableResizing = () => [
5
- tableResize(),
1
+ import { columnResizing } from './column-resize.js';
2
+ import { tableResizing as tableResizing$1 } from './table-resize.js';
3
+ import { rowResizing } from './row-resize.js';
4
+ export { tableColumnResizeKey, tableResizeKey, tableRowResizeKey } from './utils.js';
5
+
6
+ const tableResizing = () => [
7
+ tableResizing$1(),
6
8
  columnResizing(),
7
9
  rowResizing()
8
10
  ];
9
- export { tableResizeKey, tableColumnResizeKey, tableRowResizeKey } from './utils';
11
+
12
+ export { tableResizing };