@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,16 +1,15 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.activeNode = exports.parentBlockFormat = exports.hasNode = exports.addStyles = exports.getBlockFormats = exports.cleanTextBlockFormatting = exports.formatBlockElements = exports.blockNodes = exports.changeTextBlock = void 0;
4
- var tslib_1 = require("tslib");
5
- var utils_1 = require("./utils");
6
- var prosemirror_transform_1 = require("prosemirror-transform");
7
- var prosemirror_model_1 = require("prosemirror-model");
8
- var prosemirror_state_1 = require("prosemirror-state");
1
+ 'use strict';
2
+
3
+ var utils = require('./utils.js');
4
+ var prosemirrorTransform = require('prosemirror-transform');
5
+ var prosemirrorModel = require('prosemirror-model');
6
+ var prosemirrorState = require('prosemirror-state');
7
+
9
8
  /**
10
9
  * @hidden
11
10
  */
12
- var canChangeType = function (stateDoc, pos, type) {
13
- var $pos = stateDoc.resolve(pos), index = $pos.index();
11
+ const canChangeType = (stateDoc, pos, type) => {
12
+ const $pos = stateDoc.resolve(pos), index = $pos.index();
14
13
  return $pos.parent.canReplaceWith(index, index + 1, type);
15
14
  };
16
15
  /**
@@ -19,49 +18,47 @@ var canChangeType = function (stateDoc, pos, type) {
19
18
  * @example
20
19
  * See `cleanTextBlockFormatting` or `formatBlockElements` function.
21
20
  */
22
- var changeTextBlock = function (tr, node, nodeType, attrs) {
21
+ const changeTextBlock = (tr, node, nodeType, attrs) => {
23
22
  if (!nodeType.isTextblock) {
24
23
  return false;
25
24
  }
26
- var ranges = tr.selection.ranges;
27
- ranges.forEach(function (range) {
28
- var mapFrom = tr.steps.length;
29
- var from = range.$from.pos;
30
- var to = range.$to.pos;
31
- tr.doc.nodesBetween(from, to, function (currNode, pos) {
25
+ const { ranges } = tr.selection;
26
+ ranges.forEach(range => {
27
+ const mapFrom = tr.steps.length;
28
+ const from = range.$from.pos;
29
+ const to = range.$to.pos;
30
+ tr.doc.nodesBetween(from, to, (currNode, pos) => {
32
31
  if (currNode.eq(node) &&
33
32
  currNode.isTextblock &&
34
33
  !currNode.hasMarkup(nodeType, attrs) &&
35
34
  canChangeType(tr.doc, tr.mapping.slice(mapFrom).map(pos), nodeType)) {
36
35
  // Ensure all markup that isn't allowed in the new node type is cleared
37
36
  tr.clearIncompatible(tr.mapping.slice(mapFrom).map(pos, 1), nodeType);
38
- var mapping = tr.mapping.slice(mapFrom);
39
- var startM = mapping.map(pos, 1), endM = mapping.map(pos + currNode.nodeSize, 1);
40
- var slice = new prosemirror_model_1.Slice(prosemirror_model_1.Fragment.from(nodeType.create(attrs, null, currNode.marks)), 0, 0);
41
- tr.step(new prosemirror_transform_1.ReplaceAroundStep(startM, endM, startM + 1, endM - 1, slice, 1, true));
37
+ const mapping = tr.mapping.slice(mapFrom);
38
+ const startM = mapping.map(pos, 1), endM = mapping.map(pos + currNode.nodeSize, 1);
39
+ const slice = new prosemirrorModel.Slice(prosemirrorModel.Fragment.from(nodeType.create(attrs, null, currNode.marks)), 0, 0);
40
+ tr.step(new prosemirrorTransform.ReplaceAroundStep(startM, endM, startM + 1, endM - 1, slice, 1, true));
42
41
  return false; // this will skip the node children
43
42
  }
44
43
  });
45
44
  });
46
45
  };
47
- exports.changeTextBlock = changeTextBlock;
48
46
  /**
49
47
  * Traverses the selection and returns the block nodes in it.
50
48
  *
51
49
  * @example
52
50
  * See `cleanTextBlockFormatting` function.
53
51
  */
54
- var blockNodes = function (state, options) {
55
- if (options === void 0) { options = { blocksInSelection: false }; }
56
- var doc = state.doc, selection = state.selection;
57
- var $from = selection.$from, ranges = selection.ranges;
58
- var blocksInSelection = options.blocksInSelection;
59
- var result = [];
60
- var selNode = selection instanceof prosemirror_state_1.NodeSelection ? selection.node : undefined;
52
+ const blockNodes = (state, options = { blocksInSelection: false }) => {
53
+ const { doc, selection } = state;
54
+ const { $from, ranges } = selection;
55
+ const { blocksInSelection } = options;
56
+ const result = [];
57
+ const selNode = selection instanceof prosemirrorState.NodeSelection ? selection.node : undefined;
61
58
  if (selNode) {
62
59
  if (selNode.isBlock) {
63
60
  result.push(selNode);
64
- selNode.nodesBetween(0, selNode.content.size, function (node) {
61
+ selNode.nodesBetween(0, selNode.content.size, node => {
65
62
  if (node.isBlock) {
66
63
  result.push(node);
67
64
  }
@@ -72,10 +69,10 @@ var blockNodes = function (state, options) {
72
69
  }
73
70
  }
74
71
  else {
75
- ranges.forEach(function (range) {
76
- var from = range.$from.pos;
77
- var to = range.$to.pos;
78
- doc.nodesBetween(from, to, function (node, pos) {
72
+ ranges.forEach(range => {
73
+ const from = range.$from.pos;
74
+ const to = range.$to.pos;
75
+ doc.nodesBetween(from, to, (node, pos) => {
79
76
  if (node.isBlock && (!blocksInSelection || (pos >= from && pos + node.content.size + 2 <= to))) {
80
77
  result.push(node);
81
78
  }
@@ -84,36 +81,32 @@ var blockNodes = function (state, options) {
84
81
  }
85
82
  return result;
86
83
  };
87
- exports.blockNodes = blockNodes;
88
- var formatBlockElements = function (value, commandName) {
89
- return function (state, dispatch) {
90
- var blocks = (0, exports.blockNodes)(state);
91
- var nodes = state.schema.nodes;
92
- var tr = state.tr;
93
- tr.setMeta('commandName', commandName);
94
- tr.setMeta('args', { value: value });
95
- blocks.forEach(function (node) {
96
- if (node.type.isTextblock) {
97
- if (value === 'p') {
98
- (0, exports.changeTextBlock)(tr, node, nodes.paragraph, node.attrs);
99
- }
100
- else if (/^h[1-6]$/i.test(value)) {
101
- var level = parseInt(value.substr(1), 10);
102
- (0, exports.changeTextBlock)(tr, node, nodes.heading, tslib_1.__assign(tslib_1.__assign({}, node.attrs), { level: level }));
103
- }
104
- else if (value === 'blockquote') {
105
- (0, exports.changeTextBlock)(tr, node, nodes.blockquote, node.attrs);
106
- }
84
+ const formatBlockElements = (value, commandName) => (state, dispatch) => {
85
+ const blocks = blockNodes(state);
86
+ const nodes = state.schema.nodes;
87
+ const tr = state.tr;
88
+ tr.setMeta('commandName', commandName);
89
+ tr.setMeta('args', { value });
90
+ blocks.forEach(node => {
91
+ if (node.type.isTextblock) {
92
+ if (value === 'p') {
93
+ changeTextBlock(tr, node, nodes.paragraph, node.attrs);
94
+ }
95
+ else if (/^h[1-6]$/i.test(value)) {
96
+ const level = parseInt(value.substr(1), 10);
97
+ changeTextBlock(tr, node, nodes.heading, { ...node.attrs, level });
98
+ }
99
+ else if (value === 'blockquote') {
100
+ changeTextBlock(tr, node, nodes.blockquote, node.attrs);
107
101
  }
108
- });
109
- var result = tr.docChanged;
110
- if (result) {
111
- dispatch(tr.scrollIntoView());
112
102
  }
113
- return result;
114
- };
103
+ });
104
+ const result = tr.docChanged;
105
+ if (result) {
106
+ dispatch(tr.scrollIntoView());
107
+ }
108
+ return result;
115
109
  };
116
- exports.formatBlockElements = formatBlockElements;
117
110
  /**
118
111
  * Removes the style and class attributes of text block elements.
119
112
  * Requires to dispatch the transaction.
@@ -121,31 +114,29 @@ exports.formatBlockElements = formatBlockElements;
121
114
  * @example
122
115
  * See `cleanFormatting` function.
123
116
  */
124
- var cleanTextBlockFormatting = function (tr, options) {
125
- if (options === void 0) { options = { blocksInSelection: true }; }
126
- var doc = tr.doc, selection = tr.selection;
127
- var blocksInSelection = options.blocksInSelection, blockNodeType = options.blockNodeType;
128
- var nodes = (0, exports.blockNodes)({ doc: doc, selection: selection }, { blocksInSelection: blocksInSelection });
129
- var textBlocks = nodes.filter(function (node) { return node.isTextblock; });
130
- textBlocks.forEach(function (node) {
131
- var _a = node.attrs || {}, _b = _a.style, style = _b === void 0 ? '' : _b, _c = _a.class, className = _c === void 0 ? '' : _c, attrs = tslib_1.__rest(_a, ["style", "class"]);
132
- var nodeType = blockNodeType || node.type;
117
+ const cleanTextBlockFormatting = (tr, options = { blocksInSelection: true }) => {
118
+ const { doc, selection } = tr;
119
+ const { blocksInSelection, blockNodeType } = options;
120
+ const nodes = blockNodes({ doc, selection }, { blocksInSelection });
121
+ const textBlocks = nodes.filter(node => node.isTextblock);
122
+ textBlocks.forEach(node => {
123
+ const { style = '', class: className = '', ...attrs } = node.attrs || {};
124
+ const nodeType = blockNodeType || node.type;
133
125
  if (style || className || nodeType !== node.type) {
134
- (0, exports.changeTextBlock)(tr, node, nodeType, attrs);
126
+ changeTextBlock(tr, node, nodeType, attrs);
135
127
  }
136
128
  });
137
129
  };
138
- exports.cleanTextBlockFormatting = cleanTextBlockFormatting;
139
- var getBlockFormats = function (state) {
140
- var blocks = (0, exports.blockNodes)(state);
141
- var nodes = state.schema.nodes;
142
- var result = [];
143
- blocks.forEach(function (node) {
130
+ const getBlockFormats = (state) => {
131
+ const blocks = blockNodes(state);
132
+ const nodes = state.schema.nodes;
133
+ const result = [];
134
+ blocks.forEach((node) => {
144
135
  if (node.type === nodes.paragraph) {
145
136
  result.push('p');
146
137
  }
147
138
  else if (node.type === nodes.heading) {
148
- result.push("h".concat(node.attrs.level));
139
+ result.push(`h${node.attrs.level}`);
149
140
  }
150
141
  else if (node.type === nodes.blockquote && nodes.blockquote.isTextblock) {
151
142
  // In case the blockquote can have inline content.
@@ -154,40 +145,45 @@ var getBlockFormats = function (state) {
154
145
  });
155
146
  return result;
156
147
  };
157
- exports.getBlockFormats = getBlockFormats;
158
- var addStyles = function (node, stylesToApply) {
159
- var currentStyles = node.attrs.style, changedStyleResult, toChange;
148
+ const addStyles = (node, stylesToApply) => {
149
+ let currentStyles = node.attrs.style, changedStyleResult, toChange;
160
150
  if (currentStyles) {
161
- stylesToApply.forEach(function (style) {
151
+ stylesToApply.forEach(style => {
162
152
  toChange = { style: style.name, value: /^.+$/, newValue: style.value };
163
- changedStyleResult = (0, utils_1.changeStylesString)(currentStyles, toChange);
153
+ changedStyleResult = utils.changeStylesString(currentStyles, toChange);
164
154
  currentStyles = changedStyleResult.changed ? changedStyleResult.style : currentStyles;
165
155
  });
166
156
  }
167
- var reducer = function (acc, curr) { return ((acc && curr.value ? acc + ' ' : '') + curr.value ? "".concat(curr.name, ": ").concat(curr.value, ";") : ''); };
157
+ const reducer = (acc, curr) => ((acc && curr.value ? acc + ' ' : '') + curr.value ? `${curr.name}: ${curr.value};` : '');
168
158
  currentStyles = currentStyles || stylesToApply.reduce(reducer, '');
169
159
  return Object.assign({}, node.attrs, { style: currentStyles || null });
170
160
  };
171
- exports.addStyles = addStyles;
172
- var hasNode = function (state, nodeType) {
173
- var _a = state.selection, from = _a.from, to = _a.to;
174
- var result = false;
175
- state.doc.nodesBetween(from, to, function (node) {
161
+ const hasNode = (state, nodeType) => {
162
+ const { from, to } = state.selection;
163
+ let result = false;
164
+ state.doc.nodesBetween(from, to, node => {
176
165
  result = result || node.type === nodeType;
177
166
  return !result;
178
167
  });
179
168
  return result;
180
169
  };
181
- exports.hasNode = hasNode;
182
- var parentBlockFormat = function (state) {
183
- var formats = (0, exports.getBlockFormats)(state);
170
+ const parentBlockFormat = (state) => {
171
+ const formats = getBlockFormats(state);
184
172
  return new Set(formats).size === 1 ? formats[0] : null;
185
173
  };
186
- exports.parentBlockFormat = parentBlockFormat;
187
174
  /**
188
175
  * **Deprecated.** Use `parentBlockFormat` function instead.
189
176
  */
190
- var activeNode = function (state) {
191
- return { tag: (0, exports.parentBlockFormat)(state) || '' };
177
+ const activeNode = (state) => {
178
+ return { tag: parentBlockFormat(state) || '' };
192
179
  };
180
+
193
181
  exports.activeNode = activeNode;
182
+ exports.addStyles = addStyles;
183
+ exports.blockNodes = blockNodes;
184
+ exports.changeTextBlock = changeTextBlock;
185
+ exports.cleanTextBlockFormatting = cleanTextBlockFormatting;
186
+ exports.formatBlockElements = formatBlockElements;
187
+ exports.getBlockFormats = getBlockFormats;
188
+ exports.hasNode = hasNode;
189
+ exports.parentBlockFormat = parentBlockFormat;
@@ -1,3 +1,6 @@
1
1
  import { EditorState, Transaction } from 'prosemirror-state';
2
- export declare const blockquote: (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
3
- export declare const liftBlockquote: (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
2
+
3
+ declare const blockquote: (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
4
+ declare const liftBlockquote: (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
5
+
6
+ export { blockquote, liftBlockquote };
@@ -1,28 +1,29 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.liftBlockquote = exports.blockquote = void 0;
4
- var prosemirror_commands_1 = require("prosemirror-commands");
5
- var blockquote = function (state, dispatch) {
6
- return (0, prosemirror_commands_1.wrapIn)(state.schema.nodes.blockquote)(state, dispatch);
1
+ 'use strict';
2
+
3
+ var prosemirrorCommands = require('prosemirror-commands');
4
+
5
+ const blockquote = (state, dispatch) => {
6
+ return prosemirrorCommands.wrapIn(state.schema.nodes.blockquote)(state, dispatch);
7
7
  };
8
- exports.blockquote = blockquote;
9
- var liftBlockquote = function (state, dispatch) {
10
- var _a = state.selection, $from = _a.$from, $to = _a.$to;
11
- var nodeType = state.schema.nodes.blockquote;
12
- var doc = state.doc;
13
- var target = -1;
14
- var range = $from.blockRange($to);
8
+ const liftBlockquote = (state, dispatch) => {
9
+ const { $from, $to } = state.selection;
10
+ const nodeType = state.schema.nodes.blockquote;
11
+ const doc = state.doc;
12
+ let target = -1;
13
+ const range = $from.blockRange($to);
15
14
  if (range) {
16
- doc.nodesBetween(range.start, range.end, function (node, pos) {
15
+ doc.nodesBetween(range.start, range.end, (node, pos) => {
17
16
  if (node.type === nodeType) {
18
17
  target = pos;
19
18
  }
20
19
  });
21
20
  }
22
- var result = target !== -1;
21
+ const result = target !== -1;
23
22
  if (dispatch && result) {
24
23
  dispatch(state.tr.lift(range, doc.resolve(target).depth));
25
24
  }
26
25
  return result;
27
26
  };
27
+
28
+ exports.blockquote = blockquote;
28
29
  exports.liftBlockquote = liftBlockquote;
@@ -1,14 +1,15 @@
1
- import { MarkType, NodeType } from 'prosemirror-model';
1
+ import { NodeType, MarkType } from 'prosemirror-model';
2
2
  import { EditorState, Transaction } from 'prosemirror-state';
3
+
3
4
  /**
4
5
  * A command which removes the inline formatting, class and style attributes of paragraph and heading elements in the selection.
5
6
  */
6
- export declare const cleanFormatting: (options?: CleanFormattingOptions) => (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
7
+ declare const cleanFormatting: (options?: CleanFormattingOptions) => (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean;
7
8
  /**
8
9
  * The cleanFormatting command options.
9
10
  * Defaults to `{ blocksInSelection: true }`.
10
11
  */
11
- export interface CleanFormattingOptions {
12
+ interface CleanFormattingOptions {
12
13
  /**
13
14
  * If set to `true`, the command will skip the text-block nodes which are partially selected.
14
15
  * This option affects the text-block nodes themselves(paragraph, heading) and does not affects marks cleaning.
@@ -25,3 +26,5 @@ export interface CleanFormattingOptions {
25
26
  */
26
27
  exceptMarks?: Array<MarkType>;
27
28
  }
29
+
30
+ export { type CleanFormattingOptions, cleanFormatting };
@@ -1,24 +1,22 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cleanFormatting = void 0;
4
- var blockNode_1 = require("./blockNode");
5
- var mark_1 = require("./mark");
1
+ 'use strict';
2
+
3
+ var blockNode = require('./blockNode.js');
4
+ var mark = require('./mark.js');
5
+
6
6
  /**
7
7
  * A command which removes the inline formatting, class and style attributes of paragraph and heading elements in the selection.
8
8
  */
9
- var cleanFormatting = function (options) {
10
- if (options === void 0) { options = { blocksInSelection: true }; }
11
- return function (state, dispatch) {
12
- var tr = state.tr;
13
- var blocksInSelection = options.blocksInSelection, blockNodeType = options.blockNodeType, exceptMarks = options.exceptMarks;
14
- var except = (exceptMarks || [state.schema.marks.link]).filter(Boolean);
15
- (0, mark_1.cleanMarks)(tr, { except: except });
16
- (0, blockNode_1.cleanTextBlockFormatting)(tr, { blocksInSelection: blocksInSelection, blockNodeType: blockNodeType });
17
- var result = tr.docChanged;
18
- if (result && dispatch) {
19
- dispatch(tr);
20
- }
21
- return result;
22
- };
9
+ const cleanFormatting = (options = { blocksInSelection: true }) => (state, dispatch) => {
10
+ const tr = state.tr;
11
+ const { blocksInSelection, blockNodeType, exceptMarks } = options;
12
+ const except = (exceptMarks || [state.schema.marks.link]).filter(Boolean);
13
+ mark.cleanMarks(tr, { except });
14
+ blockNode.cleanTextBlockFormatting(tr, { blocksInSelection, blockNodeType });
15
+ const result = tr.docChanged;
16
+ if (result && dispatch) {
17
+ dispatch(tr);
18
+ }
19
+ return result;
23
20
  };
21
+
24
22
  exports.cleanFormatting = cleanFormatting;
@@ -1,12 +1,14 @@
1
- export interface AlignRule {
1
+ interface AlignRule {
2
2
  node: string;
3
3
  style: Array<{
4
4
  name: string;
5
5
  value: string;
6
6
  }>;
7
7
  }
8
- export declare const alignLeftRules: Array<AlignRule>;
9
- export declare const alignRightRules: Array<AlignRule>;
10
- export declare const alignCenterRules: Array<AlignRule>;
11
- export declare const alignJustifyRules: Array<AlignRule>;
12
- export declare const alignRemoveRules: Array<AlignRule>;
8
+ declare const alignLeftRules: Array<AlignRule>;
9
+ declare const alignRightRules: Array<AlignRule>;
10
+ declare const alignCenterRules: Array<AlignRule>;
11
+ declare const alignJustifyRules: Array<AlignRule>;
12
+ declare const alignRemoveRules: Array<AlignRule>;
13
+
14
+ export { type AlignRule, alignCenterRules, alignJustifyRules, alignLeftRules, alignRemoveRules, alignRightRules };
@@ -1,31 +1,36 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.alignRemoveRules = exports.alignJustifyRules = exports.alignCenterRules = exports.alignRightRules = exports.alignLeftRules = void 0;
4
- var style = function (name, value) {
1
+ 'use strict';
2
+
3
+ const style = (name, value) => {
5
4
  return { name: name, value: value };
6
5
  };
7
- exports.alignLeftRules = [
6
+ const alignLeftRules = [
8
7
  { node: 'paragraph', style: [style('text-align', 'left')] },
9
8
  { node: 'heading', style: [style('text-align', 'left')] },
10
9
  { node: 'table_caption_external', style: [style('text-align', 'left')] }
11
10
  ];
12
- exports.alignRightRules = [
11
+ const alignRightRules = [
13
12
  { node: 'paragraph', style: [style('text-align', 'right')] },
14
13
  { node: 'heading', style: [style('text-align', 'right')] },
15
14
  { node: 'table_caption_external', style: [style('text-align', 'right')] }
16
15
  ];
17
- exports.alignCenterRules = [
16
+ const alignCenterRules = [
18
17
  { node: 'paragraph', style: [style('text-align', 'center')] },
19
18
  { node: 'heading', style: [style('text-align', 'center')] },
20
19
  { node: 'table_caption_external', style: [style('text-align', 'center')] }
21
20
  ];
22
- exports.alignJustifyRules = [
21
+ const alignJustifyRules = [
23
22
  { node: 'paragraph', style: [style('text-align', 'justify')] },
24
23
  { node: 'heading', style: [style('text-align', 'justify')] },
25
24
  { node: 'table_caption_external', style: [style('text-align', 'justify')] }
26
25
  ];
27
- exports.alignRemoveRules = [
26
+ const alignRemoveRules = [
28
27
  { node: 'paragraph', style: [style('text-align', '')] },
29
28
  { node: 'heading', style: [style('text-align', '')] },
30
29
  { node: 'table_caption_external', style: [style('text-align', '')] }
31
30
  ];
31
+
32
+ exports.alignCenterRules = alignCenterRules;
33
+ exports.alignJustifyRules = alignJustifyRules;
34
+ exports.alignLeftRules = alignLeftRules;
35
+ exports.alignRemoveRules = alignRemoveRules;
36
+ exports.alignRightRules = alignRightRules;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The inline-formatting options.
3
3
  */
4
- export interface InlineFormatOptions {
4
+ interface InlineFormatOptions {
5
5
  /**
6
6
  * The mark which will be applied or stripped.
7
7
  */
@@ -27,44 +27,36 @@ export interface InlineFormatOptions {
27
27
  /**
28
28
  * The object of the Bold command.
29
29
  */
30
- export declare const bold: InlineFormatOptions;
30
+ declare const bold: InlineFormatOptions;
31
31
  /**
32
32
  * The object of the Italic command.
33
33
  */
34
- export declare const italic: InlineFormatOptions;
34
+ declare const italic: InlineFormatOptions;
35
35
  /**
36
36
  * The object of the Underline command.
37
37
  */
38
- export declare const underline: InlineFormatOptions;
38
+ declare const underline: InlineFormatOptions;
39
39
  /**
40
40
  * The object of the Strikethrough command.
41
41
  */
42
- export declare const strikethrough: InlineFormatOptions;
42
+ declare const strikethrough: InlineFormatOptions;
43
43
  /**
44
44
  * The object of the Subscript command.
45
45
  */
46
- export declare const subscript: InlineFormatOptions;
46
+ declare const subscript: InlineFormatOptions;
47
47
  /**
48
48
  * The object of the Superscript command.
49
49
  */
50
- export declare const superscript: InlineFormatOptions;
50
+ declare const superscript: InlineFormatOptions;
51
51
  /**
52
52
  * The settings of the Link tool or dialog.
53
53
  */
54
- export interface LinkOptions {
54
+ interface LinkOptions {
55
55
  mark: string;
56
56
  }
57
57
  /**
58
58
  * The object of the Link tool settings.
59
59
  */
60
- export declare const link: LinkOptions;
61
- /**
62
- * The settings of the Unlink tool.
63
- */
64
- export interface UnlinkOptions {
65
- mark: string;
66
- }
67
- /**
68
- * The object of the Unlink tool settings.
69
- */
70
- export declare const unlink: UnlinkOptions;
60
+ declare const link: LinkOptions;
61
+
62
+ export { type InlineFormatOptions, type LinkOptions, bold, italic, link, strikethrough, subscript, superscript, underline };
@@ -1,10 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.unlink = exports.link = exports.superscript = exports.subscript = exports.strikethrough = exports.underline = exports.italic = exports.bold = void 0;
1
+ 'use strict';
2
+
4
3
  /**
5
4
  * The object of the Bold command.
6
5
  */
7
- exports.bold = {
6
+ const bold = {
8
7
  mark: 'strong',
9
8
  altMarks: ['b'],
10
9
  altStyle: { name: 'font-weight', value: /^(bold(er)?|[5-9]\d{2,})$/ }
@@ -12,7 +11,7 @@ exports.bold = {
12
11
  /**
13
12
  * The object of the Italic command.
14
13
  */
15
- exports.italic = {
14
+ const italic = {
16
15
  mark: 'em',
17
16
  altMarks: ['i'],
18
17
  altStyle: { name: 'font-style', value: /^italic$/i }
@@ -20,38 +19,40 @@ exports.italic = {
20
19
  /**
21
20
  * The object of the Underline command.
22
21
  */
23
- exports.underline = {
22
+ const underline = {
24
23
  mark: 'u',
25
24
  altStyle: { name: 'text-decoration', value: /^underline$/i }
26
25
  };
27
26
  /**
28
27
  * The object of the Strikethrough command.
29
28
  */
30
- exports.strikethrough = {
29
+ const strikethrough = {
31
30
  mark: 'del',
32
31
  altStyle: { name: 'text-decoration', value: /^line-through$/i }
33
32
  };
34
33
  /**
35
34
  * The object of the Subscript command.
36
35
  */
37
- exports.subscript = {
36
+ const subscript = {
38
37
  mark: 'sub'
39
38
  };
40
39
  /**
41
40
  * The object of the Superscript command.
42
41
  */
43
- exports.superscript = {
42
+ const superscript = {
44
43
  mark: 'sup'
45
44
  };
46
45
  /**
47
46
  * The object of the Link tool settings.
48
47
  */
49
- exports.link = {
50
- mark: 'link'
51
- };
52
- /**
53
- * The object of the Unlink tool settings.
54
- */
55
- exports.unlink = {
48
+ const link = {
56
49
  mark: 'link'
57
50
  };
51
+
52
+ exports.bold = bold;
53
+ exports.italic = italic;
54
+ exports.link = link;
55
+ exports.strikethrough = strikethrough;
56
+ exports.subscript = subscript;
57
+ exports.superscript = superscript;
58
+ exports.underline = underline;
@@ -1,10 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.dataResizeDirImage = exports.dataResizeDirTable = exports.resizeHandle = exports.resizableWrap = exports.resizableAttr = exports.colgroupAttr = exports.rowTypeAttr = void 0;
4
- exports.rowTypeAttr = 'k-parent-node';
5
- exports.colgroupAttr = 'k-colgroup-data';
6
- exports.resizableAttr = 'k-resizable-node';
7
- exports.resizableWrap = 'k-editor-resize-wrap-element';
8
- exports.resizeHandle = 'k-editor-resize-handle';
9
- exports.dataResizeDirTable = 'data-dir-table-resize';
10
- exports.dataResizeDirImage = 'data-dir-image-resize';
1
+ 'use strict';
2
+
3
+ const rowTypeAttr = 'k-parent-node';
4
+ const colgroupAttr = 'k-colgroup-data';
5
+ const resizableAttr = 'k-resizable-node';
6
+ const resizableWrap = 'k-editor-resize-wrap-element';
7
+ const resizeHandle = 'k-editor-resize-handle';
8
+ const dataResizeDirTable = 'data-dir-table-resize';
9
+ const dataResizeDirImage = 'data-dir-image-resize';
10
+
11
+ exports.colgroupAttr = colgroupAttr;
12
+ exports.dataResizeDirImage = dataResizeDirImage;
13
+ exports.dataResizeDirTable = dataResizeDirTable;
14
+ exports.resizableAttr = resizableAttr;
15
+ exports.resizableWrap = resizableWrap;
16
+ exports.resizeHandle = resizeHandle;
17
+ exports.rowTypeAttr = rowTypeAttr;