@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
@@ -1,13 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.replaceAll = exports.replace = exports.findAll = exports.find = exports.findAt = void 0;
4
- var tslib_1 = require("tslib");
5
- var prosemirror_state_1 = require("prosemirror-state");
6
- var findAt = function (doc, searchOptions, start, end, exit) {
7
- var result = [], exec, text, from, to, childText, nextSibling;
8
- var nodes = [];
9
- var matchCase = searchOptions.matchCase, matchWord = searchOptions.matchWord, useRegExp = searchOptions.useRegExp;
10
- var searchText = searchOptions.text;
1
+ 'use strict';
2
+
3
+ var prosemirrorState = require('prosemirror-state');
4
+
5
+ const findAt = (doc, searchOptions, start, end, exit) => {
6
+ let result = [], exec, text, from, to, childText, nextSibling;
7
+ const nodes = [];
8
+ const { matchCase, matchWord, useRegExp } = searchOptions;
9
+ let searchText = searchOptions.text;
11
10
  if (useRegExp && (/^\\$/.test(searchText) || /[^\\]\\$/.test(searchText))) {
12
11
  // lookbehind doesn't work in Edge -> /((?<!\\)\\)$/.test(searchText)
13
12
  searchText = searchText.substring(0, searchText.length - 1);
@@ -15,19 +14,19 @@ var findAt = function (doc, searchOptions, start, end, exit) {
15
14
  if (!searchText) {
16
15
  return result;
17
16
  }
18
- var flags = matchCase ? 'g' : 'gi';
19
- var regExp = useRegExp ? new RegExp(searchText, flags) : createRegExp(searchText, flags);
20
- doc.nodesBetween(start, end, function (node, pos) {
17
+ const flags = matchCase ? 'g' : 'gi';
18
+ const regExp = useRegExp ? new RegExp(searchText, flags) : createRegExp(searchText, flags);
19
+ doc.nodesBetween(start, end, (node, pos) => {
21
20
  if (exit(result)) {
22
21
  return false;
23
22
  }
24
23
  if (node.inlineContent && pos + node.content.size >= start) {
25
24
  nodes.length = 0;
26
- node.nodesBetween(0, node.content.size, function (child, childPos, parent, i) {
25
+ node.nodesBetween(0, node.content.size, (child, childPos, parent, i) => {
27
26
  if (exit(result)) {
28
27
  return false;
29
28
  }
30
- var posToDoc = 1 + pos + childPos;
29
+ const posToDoc = 1 + pos + childPos;
31
30
  if (child.isText && posToDoc + child.nodeSize >= start) {
32
31
  childText = child.text || '';
33
32
  nextSibling = parent.childCount - 1 >= i + 1 && parent.child(i + 1);
@@ -37,13 +36,13 @@ var findAt = function (doc, searchOptions, start, end, exit) {
37
36
  if (nextSibling && nextSibling.isText) {
38
37
  return;
39
38
  }
40
- text = nodes.map(function (t) { return t.text; }).join('');
39
+ text = nodes.map(t => t.text).join('');
41
40
  exec = regExp.exec(text);
42
41
  while (exec !== null) {
43
42
  from = nodes[0].start + exec.index;
44
43
  to = from + exec[0].length;
45
44
  if (start <= from && end >= to && shouldMatchWord(exec, matchWord)) {
46
- result.push(prosemirror_state_1.TextSelection.create(doc, from, to));
45
+ result.push(prosemirrorState.TextSelection.create(doc, from, to));
47
46
  }
48
47
  if (exit(result)) {
49
48
  break;
@@ -59,69 +58,70 @@ var findAt = function (doc, searchOptions, start, end, exit) {
59
58
  });
60
59
  return result;
61
60
  };
62
- exports.findAt = findAt;
63
- var find = function (state, searchOptions) {
64
- var backward = searchOptions.backward, matchCyclic = searchOptions.matchCyclic, options = tslib_1.__rest(searchOptions, ["backward", "matchCyclic"]);
65
- var exit = backward ? function () { return false; } : function (r) { return r.length > 0; };
66
- var doc = state.doc, selection = state.selection;
67
- var result = [];
61
+ const find = (state, searchOptions) => {
62
+ const { backward, matchCyclic, ...options } = searchOptions;
63
+ const exit = backward ? () => false : r => r.length > 0;
64
+ const { doc, selection } = state;
65
+ let result = [];
68
66
  if (backward) {
69
- result = (0, exports.findAt)(doc, options, 0, selection.from, exit);
67
+ result = findAt(doc, options, 0, selection.from, exit);
70
68
  if (!result.length && matchCyclic) {
71
- result = (0, exports.findAt)(doc, options, selection.from, doc.content.size, exit);
69
+ result = findAt(doc, options, selection.from, doc.content.size, exit);
72
70
  }
73
71
  }
74
72
  else {
75
- result = (0, exports.findAt)(doc, options, selection.to, doc.content.size, exit);
73
+ result = findAt(doc, options, selection.to, doc.content.size, exit);
76
74
  if (!result.length && matchCyclic) {
77
- result = (0, exports.findAt)(doc, options, 0, selection.to, exit);
75
+ result = findAt(doc, options, 0, selection.to, exit);
78
76
  }
79
77
  }
80
78
  return result.length ? result[result.length - 1] : null;
81
79
  };
82
- exports.find = find;
83
- var findAll = function (doc, searchOptions) {
84
- return (0, exports.findAt)(doc, searchOptions, 0, doc.content.size, function () { return false; });
80
+ const findAll = (doc, searchOptions) => {
81
+ return findAt(doc, searchOptions, 0, doc.content.size, () => false);
85
82
  };
86
- exports.findAll = findAll;
87
- var replace = function (selection, text, transaction) {
88
- var from = selection.from, to = selection.to;
83
+ const replace = (selection, text, transaction) => {
84
+ const { from, to } = selection;
89
85
  transaction.insertText(text, from, to)
90
- .setSelection(prosemirror_state_1.TextSelection.create(transaction.doc, from, from + text.length));
86
+ .setSelection(prosemirrorState.TextSelection.create(transaction.doc, from, from + text.length));
91
87
  return transaction;
92
88
  };
93
- exports.replace = replace;
94
- var replaceAll = function (state, replaceText, searchOptions) {
95
- var result = (0, exports.findAll)(state.doc, searchOptions);
89
+ const replaceAll = (state, replaceText, searchOptions) => {
90
+ const result = findAll(state.doc, searchOptions);
96
91
  if (result.length === 0) {
97
92
  return null;
98
93
  }
99
- var transaction = state.tr;
100
- for (var i = result.length - 1; i >= 0; i--) {
94
+ const transaction = state.tr;
95
+ for (let i = result.length - 1; i >= 0; i--) {
101
96
  transaction.insertText(replaceText, result[i].from, result[i].to);
102
97
  }
103
98
  return transaction;
104
99
  };
105
- exports.replaceAll = replaceAll;
106
- var notLetter = /^[\s0-9~`!@#$%\^&*\(\)_\-=+\\|\[\]{};:'"\?/.,<>]?$/;
107
- var shouldMatchWord = function (exec, matchWord) {
100
+ const notLetter = /^[\s0-9~`!@#$%\^&*\(\)_\-=+\\|\[\]{};:'"\?/.,<>]?$/;
101
+ const shouldMatchWord = (exec, matchWord) => {
108
102
  if (!matchWord) {
109
103
  return true;
110
104
  }
111
105
  else if (matchWord === true) {
112
- var text = exec.input;
113
- var charBefore = text.charAt(exec.index - 1);
114
- var charAfter = text.charAt(exec.index + exec[0].length);
106
+ const text = exec.input;
107
+ const charBefore = text.charAt(exec.index - 1);
108
+ const charAfter = text.charAt(exec.index + exec[0].length);
115
109
  return notLetter.test(charBefore) && notLetter.test(charAfter);
116
110
  }
117
111
  else {
118
112
  return matchWord(exec);
119
113
  }
120
114
  };
121
- var createRegExp = function (inputString, flags) {
122
- var escaped = inputString
115
+ const createRegExp = (inputString, flags) => {
116
+ const escaped = inputString
123
117
  .replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')
124
118
  .replace(/-/g, '\\x2d')
125
119
  .replace(/\s/g, '\\s');
126
120
  return new RegExp(escaped, flags);
127
121
  };
122
+
123
+ exports.find = find;
124
+ exports.findAll = findAll;
125
+ exports.findAt = findAt;
126
+ exports.replace = replace;
127
+ exports.replaceAll = replaceAll;
@@ -1,8 +1,11 @@
1
- import { Command } from './types/command';
2
- export interface ImageData {
1
+ import { Command } from './types/command.js';
2
+
3
+ interface ImageData {
3
4
  src: string;
4
5
  alt?: string;
5
6
  width?: string;
6
7
  height?: string;
7
8
  }
8
- export declare const insertImage: (attrs: ImageData) => Command;
9
+ declare const insertImage: (attrs: ImageData) => Command;
10
+
11
+ export { type ImageData, insertImage };
package/dist/npm/image.js CHANGED
@@ -1,11 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.insertImage = void 0;
4
- var utils_1 = require("./utils");
5
- var insertImage = function (attrs) { return function (state, dispatch) {
6
- var image = state.schema.nodes.image;
7
- var commandName = 'insertImage';
8
- var newImage = image.createAndFill(attrs);
9
- (0, utils_1.insertNode)(newImage)(state, function (tr) { return dispatch(tr.setMeta('commandName', commandName).setMeta('args', attrs)); });
10
- }; };
1
+ 'use strict';
2
+
3
+ var utils = require('./utils.js');
4
+
5
+ const insertImage = (attrs) => (state, dispatch) => {
6
+ const { image } = state.schema.nodes;
7
+ const commandName = 'insertImage';
8
+ const newImage = image.createAndFill(attrs);
9
+ utils.insertNode(newImage)(state, tr => dispatch(tr.setMeta('commandName', commandName).setMeta('args', attrs)));
10
+ };
11
+
11
12
  exports.insertImage = insertImage;
@@ -1,16 +1,19 @@
1
1
  import { EditorState } from 'prosemirror-state';
2
2
  import { NodeType } from 'prosemirror-model';
3
- import { IndentRule, IndentationRules } from './config/indent-rules';
4
- import { Command } from './types/command';
3
+ import { IndentRule, IndentationRules } from './config/indent-rules.js';
4
+ import { Command } from './types/command.js';
5
+
5
6
  /**
6
7
  * Indenting block elements in the selection.
7
8
  *
8
9
  * @returns {boolean} - Returns true if any indentation is applied.
9
10
  */
10
- export declare const indentBlocks: (actions: Array<IndentRule>, command?: string, dir?: string) => Command;
11
- export declare const isIndented: (state: EditorState, rules: Array<IndentRule>, dir?: string) => boolean;
12
- export declare const canIndentAsListItem: (state: EditorState, nodeType: NodeType) => boolean;
13
- export declare const canOutdentAsListItem: (state: EditorState, rules: IndentationRules) => boolean;
14
- export declare const canBeIndented: (state: EditorState, rules: IndentationRules) => boolean;
15
- export declare const indent: Command;
16
- export declare const outdent: Command;
11
+ declare const indentBlocks: (actions: Array<IndentRule>, command?: string, dir?: string) => Command;
12
+ declare const isIndented: (state: EditorState, rules: Array<IndentRule>, dir?: string) => boolean;
13
+ declare const canIndentAsListItem: (state: EditorState, nodeType: NodeType) => boolean;
14
+ declare const canOutdentAsListItem: (state: EditorState, rules: IndentationRules) => boolean;
15
+ declare const canBeIndented: (state: EditorState, rules: IndentationRules) => boolean;
16
+ declare const indent: Command;
17
+ declare const outdent: Command;
18
+
19
+ export { canBeIndented, canIndentAsListItem, canOutdentAsListItem, indent, indentBlocks, isIndented, outdent };
@@ -1,112 +1,113 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.outdent = exports.indent = exports.canBeIndented = exports.canOutdentAsListItem = exports.canIndentAsListItem = exports.isIndented = exports.indentBlocks = void 0;
4
- var prosemirror_schema_list_1 = require("prosemirror-schema-list");
5
- var indent_rules_1 = require("./config/indent-rules");
6
- var blockNode_1 = require("./blockNode");
7
- var utils_1 = require("./utils");
8
- var blockquote_1 = require("./blockquote");
1
+ 'use strict';
2
+
3
+ var prosemirrorSchemaList = require('prosemirror-schema-list');
4
+ var indentRules = require('./config/indent-rules.js');
5
+ var blockNode = require('./blockNode.js');
6
+ var utils = require('./utils.js');
7
+ var blockquote = require('./blockquote.js');
8
+
9
9
  /**
10
10
  * Indenting block elements in the selection.
11
11
  *
12
12
  * @returns {boolean} - Returns true if any indentation is applied.
13
13
  */
14
- var indentBlocks = function (actions, command, dir) { return function (state, dispatch) {
15
- var blocks = (0, blockNode_1.blockNodes)(state);
16
- var tr = state.tr;
14
+ const indentBlocks = (actions, command, dir) => (state, dispatch) => {
15
+ const blocks = blockNode.blockNodes(state);
16
+ const tr = state.tr;
17
17
  tr.setMeta('commandName', command);
18
- blocks.forEach(function (node) {
18
+ blocks.forEach(node => {
19
19
  if (node.type.isTextblock) {
20
- var newAttrs = void 0;
21
- var action = actions.find(function (a) { return a.node === node.type.name; });
20
+ let newAttrs;
21
+ const action = actions.find(a => a.node === node.type.name);
22
22
  if (action) {
23
- var style = dir === 'rtl' ? action.rtlStyle : action.style;
24
- var newStyle = {
23
+ const style = dir === 'rtl' ? action.rtlStyle : action.style;
24
+ const newStyle = {
25
25
  name: style,
26
- value: action.step > 0 ? "".concat(action.step).concat(action.unit) : ''
26
+ value: action.step > 0 ? `${action.step}${action.unit}` : ''
27
27
  };
28
28
  if (node.attrs.style) {
29
- var re = new RegExp("".concat(style, ":\\s?(\\d+)").concat(action.unit), 'i');
30
- var match = node.attrs.style.match(re);
29
+ const re = new RegExp(`${style}:\\s?(\\d+)${action.unit}`, 'i');
30
+ const match = node.attrs.style.match(re);
31
31
  if (match) {
32
- var newMargin = parseFloat(match[1]) + action.step;
32
+ let newMargin = parseFloat(match[1]) + action.step;
33
33
  newMargin = newMargin <= 0 ? '' : newMargin;
34
- newStyle.value = "".concat(newMargin).concat(newMargin ? action.unit : '');
34
+ newStyle.value = `${newMargin}${newMargin ? action.unit : ''}`;
35
35
  }
36
36
  }
37
- newAttrs = (0, blockNode_1.addStyles)(node, [newStyle]);
37
+ newAttrs = blockNode.addStyles(node, [newStyle]);
38
38
  }
39
39
  if (newAttrs) {
40
- (0, blockNode_1.changeTextBlock)(tr, node, node.type, newAttrs);
40
+ blockNode.changeTextBlock(tr, node, node.type, newAttrs);
41
41
  }
42
42
  }
43
43
  });
44
- var result = tr.docChanged;
44
+ const result = tr.docChanged;
45
45
  if (result) {
46
46
  dispatch(tr.scrollIntoView());
47
47
  }
48
48
  return result;
49
- }; };
50
- exports.indentBlocks = indentBlocks;
51
- var isIndented = function (state, rules, dir) {
52
- var blocks = (0, blockNode_1.blockNodes)(state);
53
- var result = false;
54
- blocks.forEach(function (node) {
49
+ };
50
+ const isIndented = (state, rules, dir) => {
51
+ const blocks = blockNode.blockNodes(state);
52
+ let result = false;
53
+ blocks.forEach(node => {
55
54
  if (!result && node.type.isTextblock && node.attrs.style) {
56
- var action = rules.find(function (a) { return a.node === node.type.name; });
55
+ const action = rules.find(a => a.node === node.type.name);
57
56
  if (action) {
58
- var style = dir === 'rtl' ? action.rtlStyle : action.style;
59
- var reIndent = new RegExp("".concat(style, ":\\s?\\d+").concat(action.unit), 'i');
57
+ const style = dir === 'rtl' ? action.rtlStyle : action.style;
58
+ const reIndent = new RegExp(`${style}:\\s?\\d+${action.unit}`, 'i');
60
59
  result = reIndent.test(node.attrs.style);
61
60
  }
62
61
  }
63
62
  });
64
63
  return result;
65
64
  };
66
- exports.isIndented = isIndented;
67
- var canIndentAsListItem = function (state, nodeType) {
68
- return (0, prosemirror_schema_list_1.sinkListItem)(nodeType)(state);
65
+ const canIndentAsListItem = (state, nodeType) => {
66
+ return prosemirrorSchemaList.sinkListItem(nodeType)(state);
69
67
  };
70
- exports.canIndentAsListItem = canIndentAsListItem;
71
- var canOutdentAsListItem = function (state, rules) {
72
- var listItem = state.schema.nodes[rules.listsTypes.listItem];
73
- var orderedList = state.schema.nodes[rules.listsTypes.orderedList];
74
- var bulletList = state.schema.nodes[rules.listsTypes.bulletList];
75
- var isNestedInOL = !!(0, utils_1.findNthParentNodeOfType)(orderedList, 2)(state.selection);
76
- var isNestedInUL = !!(0, utils_1.findNthParentNodeOfType)(bulletList, 2)(state.selection);
77
- return (isNestedInOL || isNestedInUL) && (0, prosemirror_schema_list_1.liftListItem)(listItem)(state);
68
+ const canOutdentAsListItem = (state, rules) => {
69
+ const listItem = state.schema.nodes[rules.listsTypes.listItem];
70
+ const orderedList = state.schema.nodes[rules.listsTypes.orderedList];
71
+ const bulletList = state.schema.nodes[rules.listsTypes.bulletList];
72
+ const isNestedInOL = !!utils.findNthParentNodeOfType(orderedList, 2)(state.selection);
73
+ const isNestedInUL = !!utils.findNthParentNodeOfType(bulletList, 2)(state.selection);
74
+ return (isNestedInOL || isNestedInUL) && prosemirrorSchemaList.liftListItem(listItem)(state);
78
75
  };
79
- exports.canOutdentAsListItem = canOutdentAsListItem;
80
- var canBeIndented = function (state, rules) {
81
- var nodes = state.schema.nodes;
82
- var listItem = nodes[indent_rules_1.indentRules.listsTypes.listItem];
83
- return (((0, exports.isIndented)(state, rules.nodes) || indent_rules_1.indentRules.nodes.some(function (rule) { return nodes[rule.node] && (0, blockNode_1.hasNode)(state, nodes[rule.node]); })) &&
84
- !(0, blockNode_1.hasNode)(state, listItem));
76
+ const canBeIndented = (state, rules) => {
77
+ const nodes = state.schema.nodes;
78
+ const listItem = nodes[indentRules.indentRules.listsTypes.listItem];
79
+ return ((isIndented(state, rules.nodes) || indentRules.indentRules.nodes.some(rule => nodes[rule.node] && blockNode.hasNode(state, nodes[rule.node]))) &&
80
+ !blockNode.hasNode(state, listItem));
85
81
  };
86
- exports.canBeIndented = canBeIndented;
87
- var indent = function (state, dispatch) {
88
- var listItem = state.schema.nodes[indent_rules_1.indentRules.listsTypes.listItem];
89
- var isIndentableBlock = (0, exports.canBeIndented)(state, indent_rules_1.indentRules);
90
- if ((0, exports.canIndentAsListItem)(state, listItem)) {
91
- (0, prosemirror_schema_list_1.sinkListItem)(listItem)(state, dispatch);
82
+ const indent = (state, dispatch) => {
83
+ const listItem = state.schema.nodes[indentRules.indentRules.listsTypes.listItem];
84
+ const isIndentableBlock = canBeIndented(state, indentRules.indentRules);
85
+ if (canIndentAsListItem(state, listItem)) {
86
+ prosemirrorSchemaList.sinkListItem(listItem)(state, dispatch);
92
87
  }
93
88
  else if (isIndentableBlock) {
94
- (0, exports.indentBlocks)(indent_rules_1.indentRules.nodes)(state, dispatch);
89
+ indentBlocks(indentRules.indentRules.nodes)(state, dispatch);
95
90
  }
96
91
  };
97
- exports.indent = indent;
98
- var outdent = function (state, dispatch) {
99
- var nodes = state.schema.nodes;
100
- var listItem = nodes[indent_rules_1.outdentRules.listsTypes.listItem];
101
- var isIndentableBlock = (0, exports.canBeIndented)(state, indent_rules_1.outdentRules);
102
- if ((0, blockNode_1.hasNode)(state, nodes.blockquote)) {
103
- (0, blockquote_1.liftBlockquote)(state, dispatch);
92
+ const outdent = (state, dispatch) => {
93
+ const nodes = state.schema.nodes;
94
+ const listItem = nodes[indentRules.outdentRules.listsTypes.listItem];
95
+ const isIndentableBlock = canBeIndented(state, indentRules.outdentRules);
96
+ if (blockNode.hasNode(state, nodes.blockquote)) {
97
+ blockquote.liftBlockquote(state, dispatch);
104
98
  }
105
- else if ((0, exports.canOutdentAsListItem)(state, indent_rules_1.outdentRules)) {
106
- (0, prosemirror_schema_list_1.liftListItem)(listItem)(state, dispatch);
99
+ else if (canOutdentAsListItem(state, indentRules.outdentRules)) {
100
+ prosemirrorSchemaList.liftListItem(listItem)(state, dispatch);
107
101
  }
108
102
  else if (isIndentableBlock) {
109
- (0, exports.indentBlocks)(indent_rules_1.outdentRules.nodes)(state, dispatch);
103
+ indentBlocks(indentRules.outdentRules.nodes)(state, dispatch);
110
104
  }
111
105
  };
106
+
107
+ exports.canBeIndented = canBeIndented;
108
+ exports.canIndentAsListItem = canIndentAsListItem;
109
+ exports.canOutdentAsListItem = canOutdentAsListItem;
110
+ exports.indent = indent;
111
+ exports.indentBlocks = indentBlocks;
112
+ exports.isIndented = isIndented;
112
113
  exports.outdent = outdent;
@@ -1,20 +1,23 @@
1
1
  import { EditorState, Transaction } from 'prosemirror-state';
2
- import { InlineFormatOptions } from './config/commands';
2
+ import { InlineFormatOptions } from './config/commands.js';
3
+
3
4
  /**
4
5
  * Used by FontSize and FontName tools for getting their state.
5
6
  */
6
- export declare const getInlineStyles: (state: EditorState, style: {
7
+ declare const getInlineStyles: (state: EditorState, style: {
7
8
  name: string;
8
9
  value: RegExp;
9
10
  }) => Array<string>;
10
11
  /**
11
12
  * Used by bold, italic, ... and link commands.
12
13
  */
13
- export declare const toggleInlineFormat: (options: InlineFormatOptions, tr?: Transaction, markAttrs?: any) => (state: any, dispatch: any) => boolean;
14
+ declare const toggleInlineFormat: (options: InlineFormatOptions, tr?: Transaction, markAttrs?: any) => (state: any, dispatch: any) => boolean;
14
15
  /**
15
16
  * Used by FontSize, FontName, Color and BackColor commands.
16
17
  */
17
- export declare const applyInlineStyle: (options: {
18
+ declare const applyInlineStyle: (options: {
18
19
  style: string;
19
20
  value: string;
20
21
  }, command?: string) => (state: any, dispatch: any) => boolean;
22
+
23
+ export { applyInlineStyle, getInlineStyles, toggleInlineFormat };