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

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 +389 -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 +14 -29
  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/paste.js CHANGED
@@ -1,13 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.replaceImageSourcesFromRtf = exports.pasteCleanup = exports.sanitizeStyleAttr = exports.sanitizeClassAttr = exports.removeAttribute = exports.removeTag = exports.removeComments = exports.sanitize = void 0;
4
- var listConvert_1 = require("./listConvert");
5
- var source_1 = require("./source");
6
- var utils_1 = require("./utils");
1
+ 'use strict';
2
+
3
+ var listConvert = require('./listConvert.js');
4
+ var source = require('./source.js');
5
+ var utils = require('./utils.js');
6
+
7
7
  /**
8
8
  * Removes the invalid HTML. Use it as a first step for cleaning the HTML.
9
9
  */
10
- var sanitize = function (html) {
10
+ const sanitize = (html) => {
11
11
  html = html.replace(/^[\s\S]+?<!--StartFragment-->\s*([\s\S]*?)\s*<!--EndFragment-->[\s\S]+$/, '$1');
12
12
  html = html.replace(/<\/?[ovw]:[^>]*?>/gi, ''); // MS elements, e.g. <o:p>, <w:sdtPr>, <v:
13
13
  html = html.replace(/<\\?\??xml[^>]*>/gi, ''); // XML namespaces
@@ -20,50 +20,45 @@ var sanitize = function (html) {
20
20
  html = html.replace(/<!\[endif\]>/ig, '');
21
21
  return html;
22
22
  };
23
- exports.sanitize = sanitize;
24
23
  /**
25
24
  * Removes comments in HTML.
26
25
  */
27
- var removeComments = function (html) {
26
+ const removeComments = (html) => {
28
27
  return html.replace(/<!--[\s\S]+?-->/g, '');
29
28
  };
30
- exports.removeComments = removeComments;
31
29
  /**
32
30
  * Removes the specified tag(s).
33
31
  */
34
- var removeTag = function (html, tagPattern) {
32
+ const removeTag = (html, tagPattern) => {
35
33
  return html.replace(new RegExp('<\\/?(' + tagPattern + ')(?:\\s[^>]*?)?>', 'gi'), '');
36
34
  };
37
- exports.removeTag = removeTag;
38
35
  /**
39
36
  * Removes the passed attribute.
40
37
  */
41
- var removeAttribute = function (attr) {
38
+ const removeAttribute = (attr) => {
42
39
  if (attr.ownerElement) {
43
40
  attr.ownerElement.removeAttribute(attr.name);
44
41
  }
45
42
  };
46
- exports.removeAttribute = removeAttribute;
47
43
  /**
48
44
  * Remove the attribute if its value matches /^Mso/ regex.
49
45
  */
50
- var sanitizeClassAttr = function (attr) {
46
+ const sanitizeClassAttr = (attr) => {
51
47
  if (/^Mso/.test(attr.value)) {
52
- (0, exports.removeAttribute)(attr);
48
+ removeAttribute(attr);
53
49
  }
54
50
  };
55
- exports.sanitizeClassAttr = sanitizeClassAttr;
56
51
  /**
57
52
  * Removes invalid HTML styles.
58
53
  */
59
- var sanitizeStyleAttr = function (attr) {
60
- var styles = (0, utils_1.parseStyle)(attr.value);
61
- var element = attr.ownerElement;
62
- var supportedStyles = element.style;
63
- var result = '';
64
- Object.keys(styles).forEach(function (name) {
54
+ const sanitizeStyleAttr = (attr) => {
55
+ const styles = utils.parseStyle(attr.value);
56
+ const element = attr.ownerElement;
57
+ const supportedStyles = element.style;
58
+ let result = '';
59
+ Object.keys(styles).forEach(name => {
65
60
  if (supportedStyles[name] !== undefined) {
66
- result += "".concat(name, ": ").concat(styles[name], "; ");
61
+ result += `${name}: ${styles[name]}; `;
67
62
  }
68
63
  });
69
64
  result = result.trim();
@@ -71,12 +66,11 @@ var sanitizeStyleAttr = function (attr) {
71
66
  attr.value = result;
72
67
  }
73
68
  else {
74
- (0, exports.removeAttribute)(attr);
69
+ removeAttribute(attr);
75
70
  }
76
71
  };
77
- exports.sanitizeStyleAttr = sanitizeStyleAttr;
78
- var removeNode = function (node) {
79
- var parentNode = node.parentNode;
72
+ const removeNode = (node) => {
73
+ const parentNode = node.parentNode;
80
74
  if (parentNode) {
81
75
  while (node.firstChild) {
82
76
  parentNode.insertBefore(node.firstChild, node);
@@ -84,10 +78,10 @@ var removeNode = function (node) {
84
78
  parentNode.removeChild(node);
85
79
  }
86
80
  };
87
- var sanitizeNode = function (node, attributes) {
81
+ const sanitizeNode = (node, attributes) => {
88
82
  if (node.nodeType === Node.ELEMENT_NODE) {
89
- for (var i = node.attributes.length - 1; i >= 0; i--) {
90
- var attr = node.attributes[i];
83
+ for (let i = node.attributes.length - 1; i >= 0; i--) {
84
+ const attr = node.attributes[i];
91
85
  if (attributes[attr.name]) {
92
86
  attributes[attr.name](attr);
93
87
  }
@@ -104,37 +98,36 @@ var sanitizeNode = function (node, attributes) {
104
98
  * Cleans the HTML based on passed settings.
105
99
  * Before using it, clean the HTML with the `sanitize` function.
106
100
  */
107
- var pasteCleanup = function (html, settings) {
108
- var result = html;
101
+ const pasteCleanup = (html, settings) => {
102
+ let result = html;
109
103
  if (settings.convertMsLists) {
110
- result = (0, listConvert_1.convertMsLists)(result);
104
+ result = listConvert.convertMsLists(result);
111
105
  }
112
106
  if (settings.stripTags) {
113
- result = (0, exports.removeTag)(result, settings.stripTags);
107
+ result = removeTag(result, settings.stripTags);
114
108
  }
115
109
  if (settings.attributes) {
116
- var fragment = (0, source_1.htmlToFragment)(result);
117
- Array.from(fragment.querySelectorAll('*')).forEach(function (node) { return sanitizeNode(node, settings.attributes); });
118
- result = (0, source_1.fragmentToHtml)(fragment);
110
+ const fragment = source.htmlToFragment(result);
111
+ Array.from(fragment.querySelectorAll('*')).forEach(node => sanitizeNode(node, settings.attributes));
112
+ result = source.fragmentToHtml(fragment);
119
113
  }
120
114
  return result;
121
115
  };
122
- exports.pasteCleanup = pasteCleanup;
123
116
  function convertHexToBase64(hex) {
124
- var length = hex.length;
125
- var data = new Array(length / 2);
126
- for (var i = 0; i < length; i += 2) {
117
+ const length = hex.length;
118
+ const data = new Array(length / 2);
119
+ for (let i = 0; i < length; i += 2) {
127
120
  data[i] = String.fromCharCode(parseInt(hex.substring(i, i + 2), 16));
128
121
  }
129
122
  return btoa(data.join(''));
130
123
  }
131
- var reHtmlImg = /<img\s[^>]*?src=(?:'|")file:\/[^'"]+(?:'|")[^>]*>/gi;
132
- var reRtfImgHeader = /{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/;
133
- var reRtfImg = new RegExp('(?:(' + reRtfImgHeader.source + '))([\\da-fA-F\\s]+)\\}', 'g');
134
- var reNonHex = /[^\da-fA-F]/g;
135
- var reLocalFile = /file:\/[^'"]+\.(jpg|png|gif)/i;
136
- var reExtension = /\\(png|jpeg)blip\\/;
137
- var textRtfType = 'text/rtf';
124
+ const reHtmlImg = /<img\s[^>]*?src=(?:'|")file:\/[^'"]+(?:'|")[^>]*>/gi;
125
+ const reRtfImgHeader = /{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/;
126
+ const reRtfImg = new RegExp('(?:(' + reRtfImgHeader.source + '))([\\da-fA-F\\s]+)\\}', 'g');
127
+ const reNonHex = /[^\da-fA-F]/g;
128
+ const reLocalFile = /file:\/[^'"]+\.(jpg|png|gif)/i;
129
+ const reExtension = /\\(png|jpeg)blip\\/;
130
+ const textRtfType = 'text/rtf';
138
131
  /**
139
132
  * If the input HTML contains images with 'src' pointing to local file system (it happens when pasting images and text from MS Word),
140
133
  * the function will extract the image sources form the RTF and replace the image 'src' with extracted base64 format data in `html` string.
@@ -143,31 +136,38 @@ var textRtfType = 'text/rtf';
143
136
  * @param clipboardData - The paste event clipboardData object (event.clipboardData).
144
137
  * @returns - The html with the replaced images sources.
145
138
  */
146
- var replaceImageSourcesFromRtf = function (html, clipboardData) {
147
- var htmlImages = html.match(reHtmlImg);
139
+ const replaceImageSourcesFromRtf = (html, clipboardData) => {
140
+ const htmlImages = html.match(reHtmlImg);
148
141
  if (!htmlImages || clipboardData.types.indexOf(textRtfType) === -1) {
149
142
  return html;
150
143
  }
151
- var rtf = clipboardData.getData(textRtfType);
152
- var base64Sources = [];
153
- var rtfImages = rtf.match(reRtfImg);
144
+ const rtf = clipboardData.getData(textRtfType);
145
+ const base64Sources = [];
146
+ const rtfImages = rtf.match(reRtfImg);
154
147
  if (!rtf || !rtfImages) {
155
148
  return html;
156
149
  }
157
- for (var _i = 0, rtfImages_1 = rtfImages; _i < rtfImages_1.length; _i++) {
158
- var image = rtfImages_1[_i];
159
- var extension = reExtension.exec(image);
150
+ for (const image of rtfImages) {
151
+ const extension = reExtension.exec(image);
160
152
  if (extension) {
161
- var hex = image.replace(reRtfImgHeader, '').replace(reNonHex, '');
162
- base64Sources.push("data:image/".concat(extension[1], ";base64,").concat(convertHexToBase64(hex)));
153
+ const hex = image.replace(reRtfImgHeader, '').replace(reNonHex, '');
154
+ base64Sources.push(`data:image/${extension[1]};base64,${convertHexToBase64(hex)}`);
163
155
  }
164
156
  }
165
157
  if (htmlImages.length !== base64Sources.length) {
166
158
  return html;
167
159
  }
168
- return html.replace(reHtmlImg, function (img) {
169
- var src = base64Sources.shift() || '';
160
+ return html.replace(reHtmlImg, img => {
161
+ const src = base64Sources.shift() || '';
170
162
  return img.replace(reLocalFile, src);
171
163
  });
172
164
  };
165
+
166
+ exports.pasteCleanup = pasteCleanup;
167
+ exports.removeAttribute = removeAttribute;
168
+ exports.removeComments = removeComments;
169
+ exports.removeTag = removeTag;
173
170
  exports.replaceImageSourcesFromRtf = replaceImageSourcesFromRtf;
171
+ exports.sanitize = sanitize;
172
+ exports.sanitizeClassAttr = sanitizeClassAttr;
173
+ exports.sanitizeStyleAttr = sanitizeStyleAttr;
@@ -1,3 +1,6 @@
1
- import { Plugin, PluginKey } from 'prosemirror-state';
2
- export declare const caretColorKey: PluginKey<any>;
3
- export declare function caretColor(): Plugin;
1
+ import { PluginKey, Plugin } from 'prosemirror-state';
2
+
3
+ declare const caretColorKey: PluginKey<any>;
4
+ declare function caretColor(): Plugin;
5
+
6
+ export { caretColor, caretColorKey };
@@ -1,35 +1,37 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.caretColor = exports.caretColorKey = void 0;
4
- var prosemirror_state_1 = require("prosemirror-state");
5
- var prosemirror_view_1 = require("prosemirror-view");
6
- var mark_1 = require("./../mark");
7
- exports.caretColorKey = new prosemirror_state_1.PluginKey('caret-color');
1
+ 'use strict';
2
+
3
+ var prosemirrorState = require('prosemirror-state');
4
+ var prosemirrorView = require('prosemirror-view');
5
+ var mark = require('../mark.js');
6
+
7
+ const caretColorKey = new prosemirrorState.PluginKey('caret-color');
8
8
  function caretColor() {
9
- return new prosemirror_state_1.Plugin({
10
- key: exports.caretColorKey,
9
+ return new prosemirrorState.Plugin({
10
+ key: caretColorKey,
11
11
  props: {
12
- decorations: function (state) {
13
- var doc = state.doc, selection = state.selection, storedMarks = state.storedMarks;
12
+ decorations: (state) => {
13
+ const { doc, selection, storedMarks } = state;
14
14
  if (!selection.empty || !storedMarks) {
15
- return prosemirror_view_1.DecorationSet.empty;
15
+ return prosemirrorView.DecorationSet.empty;
16
16
  }
17
- var color = (0, mark_1.styleValue)((storedMarks || []).find(function (m) { return m.type.name === 'style'; }), { name: 'color', value: /^.+$/ });
17
+ const color = mark.styleValue((storedMarks || []).find((m) => m.type.name === 'style'), { name: 'color', value: /^.+$/ });
18
18
  if (!color) {
19
- return prosemirror_view_1.DecorationSet.empty;
19
+ return prosemirrorView.DecorationSet.empty;
20
20
  }
21
- var parentNode = selection.$anchor.parent;
22
- var decorations = [];
23
- doc.descendants(function (node, pos) {
21
+ const parentNode = selection.$anchor.parent;
22
+ const decorations = [];
23
+ doc.descendants((node, pos) => {
24
24
  if (node.eq(parentNode)) {
25
- decorations.push(prosemirror_view_1.Decoration.node(pos, pos + node.nodeSize, {
25
+ decorations.push(prosemirrorView.Decoration.node(pos, pos + node.nodeSize, {
26
26
  style: 'caret-color: ' + color
27
27
  }));
28
28
  }
29
29
  });
30
- return prosemirror_view_1.DecorationSet.create(doc, decorations);
30
+ return prosemirrorView.DecorationSet.create(doc, decorations);
31
31
  }
32
32
  }
33
33
  });
34
34
  }
35
+
35
36
  exports.caretColor = caretColor;
37
+ exports.caretColorKey = caretColorKey;
@@ -1,2 +1,5 @@
1
1
  import { Plugin } from 'prosemirror-state';
2
- export declare const cspFix: () => Plugin<any>;
2
+
3
+ declare const cspFix: () => Plugin<any>;
4
+
5
+ export { cspFix };
@@ -1,55 +1,53 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cspFix = void 0;
4
- var prosemirror_state_1 = require("prosemirror-state");
5
- var utils_1 = require("../utils");
6
- var setAttributes = function (dom, attrs) {
7
- for (var attrName in attrs) {
1
+ 'use strict';
2
+
3
+ var prosemirrorState = require('prosemirror-state');
4
+ var utils = require('../utils.js');
5
+
6
+ const setAttributes = (dom, attrs) => {
7
+ for (const attrName in attrs) {
8
8
  if (attrName) {
9
- (0, utils_1.setAttribute)(dom, attrName, attrs[attrName]);
9
+ utils.setAttribute(dom, attrName, attrs[attrName]);
10
10
  }
11
11
  }
12
12
  };
13
- var CustomNodeView = /** @class */ (function () {
14
- function CustomNodeView(node, view, nodeName, isLeaf) {
15
- if (isLeaf === void 0) { isLeaf = false; }
13
+ class CustomNodeView {
14
+ constructor(node, view, nodeName, isLeaf = false) {
16
15
  this.node = node;
17
16
  this.view = view;
18
17
  this.dom = document.createElement(nodeName);
19
18
  setAttributes(this.dom, node.attrs);
20
19
  this.contentDOM = !isLeaf ? this.dom : undefined;
21
20
  }
22
- return CustomNodeView;
23
- }());
24
- var StyleView = /** @class */ (function () {
25
- function StyleView(mark, view) {
21
+ }
22
+ class StyleView {
23
+ constructor(mark, view) {
26
24
  this.mark = mark;
27
25
  this.view = view;
28
26
  this.dom = document.createElement('span');
29
27
  setAttributes(this.dom, mark.attrs);
30
28
  this.contentDOM = this.dom;
31
29
  }
32
- return StyleView;
33
- }());
34
- var cspFix = function () {
35
- return new prosemirror_state_1.Plugin({
36
- key: new prosemirror_state_1.PluginKey('csp-fix'),
30
+ }
31
+ const cspFix = () => {
32
+ return new prosemirrorState.Plugin({
33
+ key: new prosemirrorState.PluginKey('csp-fix'),
37
34
  props: {
38
35
  nodeViews: {
39
- paragraph: function (node, view) { return new CustomNodeView(node, view, 'p'); },
40
- div: function (node, view) { return new CustomNodeView(node, view, 'div'); },
41
- table_wrapper: function (node, view) { return new CustomNodeView(node, view, 'div'); },
42
- table_caption_external: function (node, view) { return new CustomNodeView(node, view, 'div'); },
43
- table: function (node, view) { return new CustomNodeView(node, view, 'table'); },
44
- table_row: function (node, view) { return new CustomNodeView(node, view, 'tr'); },
45
- table_cell: function (node, view) { return new CustomNodeView(node, view, 'td'); },
46
- table_header: function (node, view) { return new CustomNodeView(node, view, 'th'); },
47
- image: function (node, view) { return new CustomNodeView(node, view, 'img', true); }
36
+ paragraph: (node, view) => new CustomNodeView(node, view, 'p'),
37
+ div: (node, view) => new CustomNodeView(node, view, 'div'),
38
+ table_wrapper: (node, view) => new CustomNodeView(node, view, 'div'),
39
+ table_caption_external: (node, view) => new CustomNodeView(node, view, 'div'),
40
+ table: (node, view) => new CustomNodeView(node, view, 'table'),
41
+ table_row: (node, view) => new CustomNodeView(node, view, 'tr'),
42
+ table_cell: (node, view) => new CustomNodeView(node, view, 'td'),
43
+ table_header: (node, view) => new CustomNodeView(node, view, 'th'),
44
+ image: (node, view) => new CustomNodeView(node, view, 'img', true)
48
45
  },
49
46
  markViews: {
50
- style: function (mark, view) { return new StyleView(mark, view); }
47
+ style: (mark, view) => new StyleView(mark, view)
51
48
  }
52
49
  }
53
50
  });
54
51
  };
52
+
55
53
  exports.cspFix = cspFix;
@@ -1,9 +1,12 @@
1
- import { Plugin, PluginKey } from 'prosemirror-state';
1
+ import { PluginKey, Plugin } from 'prosemirror-state';
2
2
  import { DecorationAttrs } from 'prosemirror-view';
3
- export interface InlineDecoration {
3
+
4
+ interface InlineDecoration {
4
5
  from: number;
5
6
  to: number;
6
7
  attrs: DecorationAttrs;
7
8
  }
8
- export declare const textHighlightKey: PluginKey<any>;
9
- export declare function textHighlight(key?: PluginKey): Plugin;
9
+ declare const textHighlightKey: PluginKey<any>;
10
+ declare function textHighlight(key?: PluginKey): Plugin;
11
+
12
+ export { type InlineDecoration, textHighlight, textHighlightKey };
@@ -1,25 +1,26 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.textHighlight = exports.textHighlightKey = void 0;
4
- var prosemirror_state_1 = require("prosemirror-state");
5
- var prosemirror_view_1 = require("prosemirror-view");
1
+ 'use strict';
2
+
3
+ var prosemirrorState = require('prosemirror-state');
4
+ var prosemirrorView = require('prosemirror-view');
5
+
6
6
  // https://discuss.prosemirror.net/t/passing-data-between-plugins/1843
7
- exports.textHighlightKey = new prosemirror_state_1.PluginKey('highlight');
8
- function textHighlight(key) {
9
- if (key === void 0) { key = exports.textHighlightKey; }
10
- return new prosemirror_state_1.Plugin({
11
- key: key,
7
+ const textHighlightKey = new prosemirrorState.PluginKey('highlight');
8
+ function textHighlight(key = textHighlightKey) {
9
+ return new prosemirrorState.Plugin({
10
+ key,
12
11
  state: {
13
- init: function () { return null; },
14
- apply: function (tr) { return tr.getMeta(this.spec.key); }
12
+ init() { return null; },
13
+ apply(tr) { return tr.getMeta(this.spec.key); }
15
14
  },
16
15
  props: {
17
- decorations: function (state) {
18
- var decorations = (this.spec.key.getState(state) || [])
19
- .map(function (d) { return prosemirror_view_1.Decoration.inline(d.from, d.to, d.attrs); });
20
- return prosemirror_view_1.DecorationSet.create(state.doc, decorations);
16
+ decorations(state) {
17
+ const decorations = (this.spec.key.getState(state) || [])
18
+ .map((d) => prosemirrorView.Decoration.inline(d.from, d.to, d.attrs));
19
+ return prosemirrorView.DecorationSet.create(state.doc, decorations);
21
20
  }
22
21
  }
23
22
  });
24
23
  }
24
+
25
25
  exports.textHighlight = textHighlight;
26
+ exports.textHighlightKey = textHighlightKey;
@@ -1,5 +1,6 @@
1
- import { Plugin, PluginKey, Transaction } from 'prosemirror-state';
2
- export declare const imageResizeKey: PluginKey<any>;
1
+ import { PluginKey, Plugin, Transaction } from 'prosemirror-state';
2
+
3
+ declare const imageResizeKey: PluginKey<any>;
3
4
  interface Rect {
4
5
  top: number;
5
6
  left: number;
@@ -20,9 +21,10 @@ declare class ResizeState {
20
21
  } | null, rect: Rect | null, nodePosition: number);
21
22
  apply(tr: Transaction): ResizeState;
22
23
  }
23
- export interface ImageResizeOptions {
24
+ interface ImageResizeOptions {
24
25
  node: string;
25
26
  lockRatio: boolean;
26
27
  }
27
- export declare const imageResizing: (options?: ImageResizeOptions) => Plugin<ResizeState>;
28
- export {};
28
+ declare const imageResizing: (options?: ImageResizeOptions) => Plugin<ResizeState>;
29
+
30
+ export { type ImageResizeOptions, imageResizeKey, imageResizing };