@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,7 +1,7 @@
1
1
  /**
2
2
  * The object of the Bold command.
3
3
  */
4
- export const bold = {
4
+ const bold = {
5
5
  mark: 'strong',
6
6
  altMarks: ['b'],
7
7
  altStyle: { name: 'font-weight', value: /^(bold(er)?|[5-9]\d{2,})$/ }
@@ -9,7 +9,7 @@ export const bold = {
9
9
  /**
10
10
  * The object of the Italic command.
11
11
  */
12
- export const italic = {
12
+ const italic = {
13
13
  mark: 'em',
14
14
  altMarks: ['i'],
15
15
  altStyle: { name: 'font-style', value: /^italic$/i }
@@ -17,38 +17,34 @@ export const italic = {
17
17
  /**
18
18
  * The object of the Underline command.
19
19
  */
20
- export const underline = {
20
+ const underline = {
21
21
  mark: 'u',
22
22
  altStyle: { name: 'text-decoration', value: /^underline$/i }
23
23
  };
24
24
  /**
25
25
  * The object of the Strikethrough command.
26
26
  */
27
- export const strikethrough = {
27
+ const strikethrough = {
28
28
  mark: 'del',
29
29
  altStyle: { name: 'text-decoration', value: /^line-through$/i }
30
30
  };
31
31
  /**
32
32
  * The object of the Subscript command.
33
33
  */
34
- export const subscript = {
34
+ const subscript = {
35
35
  mark: 'sub'
36
36
  };
37
37
  /**
38
38
  * The object of the Superscript command.
39
39
  */
40
- export const superscript = {
40
+ const superscript = {
41
41
  mark: 'sup'
42
42
  };
43
43
  /**
44
44
  * The object of the Link tool settings.
45
45
  */
46
- export const link = {
47
- mark: 'link'
48
- };
49
- /**
50
- * The object of the Unlink tool settings.
51
- */
52
- export const unlink = {
46
+ const link = {
53
47
  mark: 'link'
54
48
  };
49
+
50
+ export { bold, italic, link, strikethrough, subscript, superscript, underline };
@@ -1,7 +1,9 @@
1
- export const rowTypeAttr = 'k-parent-node';
2
- export const colgroupAttr = 'k-colgroup-data';
3
- export const resizableAttr = 'k-resizable-node';
4
- export const resizableWrap = 'k-editor-resize-wrap-element';
5
- export const resizeHandle = 'k-editor-resize-handle';
6
- export const dataResizeDirTable = 'data-dir-table-resize';
7
- export const dataResizeDirImage = 'data-dir-image-resize';
1
+ const rowTypeAttr = 'k-parent-node';
2
+ const colgroupAttr = 'k-colgroup-data';
3
+ const resizableAttr = 'k-resizable-node';
4
+ const resizableWrap = 'k-editor-resize-wrap-element';
5
+ const resizeHandle = 'k-editor-resize-handle';
6
+ const dataResizeDirTable = 'data-dir-table-resize';
7
+ const dataResizeDirImage = 'data-dir-image-resize';
8
+
9
+ export { colgroupAttr, dataResizeDirImage, dataResizeDirTable, resizableAttr, resizableWrap, resizeHandle, rowTypeAttr };
@@ -1,8 +1,9 @@
1
- import { listsTypes } from './list-settings';
1
+ import { listsTypes } from './list-settings.js';
2
+
2
3
  /**
3
4
  * The object of the Indent tool settings.
4
5
  */
5
- export const indentRules = {
6
+ const indentRules = {
6
7
  nodes: [{
7
8
  node: 'paragraph',
8
9
  style: 'margin-left',
@@ -21,7 +22,7 @@ export const indentRules = {
21
22
  /**
22
23
  * The object of the Outdent tool settings.
23
24
  */
24
- export const outdentRules = {
25
+ const outdentRules = {
25
26
  nodes: [{
26
27
  node: 'paragraph',
27
28
  style: 'margin-left',
@@ -37,3 +38,5 @@ export const outdentRules = {
37
38
  }],
38
39
  listsTypes: Object.assign({}, listsTypes)
39
40
  };
41
+
42
+ export { indentRules, outdentRules };
@@ -1,13 +1,14 @@
1
- import { chainCommands, exitCode, newlineInCode, createParagraphNear, liftEmptyBlock, splitBlockKeepMarks, deleteSelection, joinBackward, selectNodeBackward } from 'prosemirror-commands';
1
+ import { chainCommands, deleteSelection, joinBackward, selectNodeBackward, newlineInCode, createParagraphNear, liftEmptyBlock, splitBlockKeepMarks, exitCode } from 'prosemirror-commands';
2
2
  import { undo, redo } from 'prosemirror-history';
3
3
  import { undoInputRule } from 'prosemirror-inputrules';
4
- import { splitListItemKeepMarks } from '../lists';
5
- import { bold, italic, underline } from './commands';
6
- import { toggleInlineFormat } from './../inline-style';
7
- import { expandToWordWrap } from '../utils';
4
+ import { splitListItemKeepMarks } from '../lists.js';
5
+ import { bold, italic, underline } from './commands.js';
6
+ import { toggleInlineFormat } from '../inline-style.js';
7
+ import { expandToWordWrap } from '../utils.js';
8
+
8
9
  const mac = typeof navigator !== 'undefined' ? /Mac/.test(navigator.platform) : false;
9
10
  // https://github.com/ProseMirror/prosemirror-example-setup/blob/master/src/keymap.js
10
- export const buildKeymap = (schema, options) => {
11
+ const buildKeymap = (schema, options) => {
11
12
  const keys = {};
12
13
  const applyToWord = (options && options.applyToWord) || false;
13
14
  keys['Mod-z'] = undo;
@@ -38,7 +39,7 @@ export const buildKeymap = (schema, options) => {
38
39
  }
39
40
  return keys;
40
41
  };
41
- export const buildListKeymap = (schema) => {
42
+ const buildListKeymap = (schema) => {
42
43
  const keys = {};
43
44
  if (schema.nodes.list_item) {
44
45
  // tslint:disable-next-line:no-string-literal
@@ -46,3 +47,5 @@ export const buildListKeymap = (schema) => {
46
47
  }
47
48
  return keys;
48
49
  };
50
+
51
+ export { buildKeymap, buildListKeymap };
@@ -1,4 +1,4 @@
1
- export const listsTypes = {
1
+ const listsTypes = {
2
2
  orderedList: 'ordered_list',
3
3
  bulletList: 'bullet_list',
4
4
  listItem: 'list_item'
@@ -6,14 +6,16 @@ export const listsTypes = {
6
6
  /**
7
7
  * The object of the OrderedList tool settings.
8
8
  */
9
- export const orderedList = {
9
+ const orderedList = {
10
10
  listType: listsTypes.orderedList,
11
11
  types: Object.assign({}, listsTypes)
12
12
  };
13
13
  /**
14
14
  * The object of the UnorderedList tool settings.
15
15
  */
16
- export const bulletList = {
16
+ const bulletList = {
17
17
  listType: listsTypes.bulletList,
18
18
  types: Object.assign({}, listsTypes)
19
19
  };
20
+
21
+ export { bulletList, listsTypes, orderedList };
@@ -1,7 +1,8 @@
1
1
  import { Schema } from 'prosemirror-model';
2
2
  import { tableNodes } from 'prosemirror-tables';
3
- import { domToPmDoc, htmlToFragment, pmDocToFragment } from '../source';
4
- import { rowTypeAttr, colgroupAttr, resizableAttr } from './constants';
3
+ import { domToPmDoc, htmlToFragment, pmDocToFragment } from '../source.js';
4
+ import { colgroupAttr, rowTypeAttr, resizableAttr } from './constants.js';
5
+
5
6
  const hole = 0;
6
7
  const blockquoteDOM = ['blockquote', hole], hrDOM = ['hr'], preDOM = ['pre', ['code', hole]];
7
8
  const olDOM = ['ol', 0], ulDOM = ['ul', 0], liDOM = ['li', 0];
@@ -44,7 +45,7 @@ const tagMark = tag => {
44
45
  return {
45
46
  [tag]: {
46
47
  name: tag,
47
- inclusive: true,
48
+ inclusive: true, // https://prosemirror.net/docs/ref/#model.MarkSpec.inclusive
48
49
  parseDOM: [{ tag: tag }],
49
50
  toDOM: () => [tag, hole]
50
51
  }
@@ -107,7 +108,7 @@ const shouldSkipColgroup = (node) => {
107
108
  }
108
109
  return shouldSkip;
109
110
  };
110
- export const parseStrColgroup = (colgroup) => {
111
+ const parseStrColgroup = (colgroup) => {
111
112
  const doc = domToPmDoc(htmlToFragment(colgroup), colgroupSchema, { preserveWhitespace: false });
112
113
  const fragment = pmDocToFragment(doc);
113
114
  const colgroupEl = fragment.firstChild;
@@ -200,7 +201,7 @@ const nodes = Object.assign({
200
201
  attrs: Object.assign({}, commonAttributes()),
201
202
  content: 'block+',
202
203
  group: 'block',
203
- defining: true,
204
+ defining: true, // https://prosemirror.net/docs/ref/#model.NodeSpec.defining
204
205
  parseDOM: [{
205
206
  tag: 'blockquote',
206
207
  getAttrs: domAttributes
@@ -309,4 +310,5 @@ const nodes = Object.assign({
309
310
  toDOM: node => hasAttrs(node.attrs) ? ['li', pmAttributes(node.attrs), hole] : liDOM,
310
311
  defining: true
311
312
  } }, tNodes);
312
- export { nodes, marks };
313
+
314
+ export { marks, nodes, parseStrColgroup };
@@ -1,6 +1,7 @@
1
- import { __rest } from "tslib";
1
+ import { __rest } from './node_modules/tslib/tslib.es6.js';
2
2
  import { TextSelection } from 'prosemirror-state';
3
- export const findAt = (doc, searchOptions, start, end, exit) => {
3
+
4
+ const findAt = (doc, searchOptions, start, end, exit) => {
4
5
  let result = [], exec, text, from, to, childText, nextSibling;
5
6
  const nodes = [];
6
7
  const { matchCase, matchWord, useRegExp } = searchOptions;
@@ -56,7 +57,7 @@ export const findAt = (doc, searchOptions, start, end, exit) => {
56
57
  });
57
58
  return result;
58
59
  };
59
- export const find = (state, searchOptions) => {
60
+ const find = (state, searchOptions) => {
60
61
  const { backward, matchCyclic } = searchOptions, options = __rest(searchOptions, ["backward", "matchCyclic"]);
61
62
  const exit = backward ? () => false : r => r.length > 0;
62
63
  const { doc, selection } = state;
@@ -75,16 +76,16 @@ export const find = (state, searchOptions) => {
75
76
  }
76
77
  return result.length ? result[result.length - 1] : null;
77
78
  };
78
- export const findAll = (doc, searchOptions) => {
79
+ const findAll = (doc, searchOptions) => {
79
80
  return findAt(doc, searchOptions, 0, doc.content.size, () => false);
80
81
  };
81
- export const replace = (selection, text, transaction) => {
82
+ const replace = (selection, text, transaction) => {
82
83
  const { from, to } = selection;
83
84
  transaction.insertText(text, from, to)
84
85
  .setSelection(TextSelection.create(transaction.doc, from, from + text.length));
85
86
  return transaction;
86
87
  };
87
- export const replaceAll = (state, replaceText, searchOptions) => {
88
+ const replaceAll = (state, replaceText, searchOptions) => {
88
89
  const result = findAll(state.doc, searchOptions);
89
90
  if (result.length === 0) {
90
91
  return null;
@@ -117,3 +118,5 @@ const createRegExp = (inputString, flags) => {
117
118
  .replace(/\s/g, '\\s');
118
119
  return new RegExp(escaped, flags);
119
120
  };
121
+
122
+ export { find, findAll, findAt, replace, replaceAll };
@@ -1,7 +1,10 @@
1
- import { insertNode } from './utils';
2
- export const insertImage = (attrs) => (state, dispatch) => {
1
+ import { insertNode } from './utils.js';
2
+
3
+ const insertImage = (attrs) => (state, dispatch) => {
3
4
  const { image } = state.schema.nodes;
4
5
  const commandName = 'insertImage';
5
6
  const newImage = image.createAndFill(attrs);
6
7
  insertNode(newImage)(state, tr => dispatch(tr.setMeta('commandName', commandName).setMeta('args', attrs)));
7
8
  };
9
+
10
+ export { insertImage };
@@ -1,14 +1,15 @@
1
1
  import { sinkListItem, liftListItem } from 'prosemirror-schema-list';
2
- import { indentRules, outdentRules } from './config/indent-rules';
3
- import { blockNodes, addStyles, changeTextBlock, hasNode } from './blockNode';
4
- import { findNthParentNodeOfType } from './utils';
5
- import { liftBlockquote } from './blockquote';
2
+ import { indentRules, outdentRules } from './config/indent-rules.js';
3
+ import { blockNodes, addStyles, changeTextBlock, hasNode } from './blockNode.js';
4
+ import { findNthParentNodeOfType } from './utils.js';
5
+ import { liftBlockquote } from './blockquote.js';
6
+
6
7
  /**
7
8
  * Indenting block elements in the selection.
8
9
  *
9
10
  * @returns {boolean} - Returns true if any indentation is applied.
10
11
  */
11
- export const indentBlocks = (actions, command, dir) => (state, dispatch) => {
12
+ const indentBlocks = (actions, command, dir) => (state, dispatch) => {
12
13
  const blocks = blockNodes(state);
13
14
  const tr = state.tr;
14
15
  tr.setMeta('commandName', command);
@@ -44,7 +45,7 @@ export const indentBlocks = (actions, command, dir) => (state, dispatch) => {
44
45
  }
45
46
  return result;
46
47
  };
47
- export const isIndented = (state, rules, dir) => {
48
+ const isIndented = (state, rules, dir) => {
48
49
  const blocks = blockNodes(state);
49
50
  let result = false;
50
51
  blocks.forEach(node => {
@@ -59,10 +60,10 @@ export const isIndented = (state, rules, dir) => {
59
60
  });
60
61
  return result;
61
62
  };
62
- export const canIndentAsListItem = (state, nodeType) => {
63
+ const canIndentAsListItem = (state, nodeType) => {
63
64
  return sinkListItem(nodeType)(state);
64
65
  };
65
- export const canOutdentAsListItem = (state, rules) => {
66
+ const canOutdentAsListItem = (state, rules) => {
66
67
  const listItem = state.schema.nodes[rules.listsTypes.listItem];
67
68
  const orderedList = state.schema.nodes[rules.listsTypes.orderedList];
68
69
  const bulletList = state.schema.nodes[rules.listsTypes.bulletList];
@@ -70,13 +71,13 @@ export const canOutdentAsListItem = (state, rules) => {
70
71
  const isNestedInUL = !!findNthParentNodeOfType(bulletList, 2)(state.selection);
71
72
  return (isNestedInOL || isNestedInUL) && liftListItem(listItem)(state);
72
73
  };
73
- export const canBeIndented = (state, rules) => {
74
+ const canBeIndented = (state, rules) => {
74
75
  const nodes = state.schema.nodes;
75
76
  const listItem = nodes[indentRules.listsTypes.listItem];
76
77
  return ((isIndented(state, rules.nodes) || indentRules.nodes.some(rule => nodes[rule.node] && hasNode(state, nodes[rule.node]))) &&
77
78
  !hasNode(state, listItem));
78
79
  };
79
- export const indent = (state, dispatch) => {
80
+ const indent = (state, dispatch) => {
80
81
  const listItem = state.schema.nodes[indentRules.listsTypes.listItem];
81
82
  const isIndentableBlock = canBeIndented(state, indentRules);
82
83
  if (canIndentAsListItem(state, listItem)) {
@@ -86,7 +87,7 @@ export const indent = (state, dispatch) => {
86
87
  indentBlocks(indentRules.nodes)(state, dispatch);
87
88
  }
88
89
  };
89
- export const outdent = (state, dispatch) => {
90
+ const outdent = (state, dispatch) => {
90
91
  const nodes = state.schema.nodes;
91
92
  const listItem = nodes[outdentRules.listsTypes.listItem];
92
93
  const isIndentableBlock = canBeIndented(state, outdentRules);
@@ -100,3 +101,5 @@ export const outdent = (state, dispatch) => {
100
101
  indentBlocks(outdentRules.nodes)(state, dispatch);
101
102
  }
102
103
  };
104
+
105
+ export { canBeIndented, canIndentAsListItem, canOutdentAsListItem, indent, indentBlocks, isIndented, outdent };
@@ -1,7 +1,8 @@
1
- import { AddMarkStep, RemoveMarkStep } from 'prosemirror-transform';
1
+ import { RemoveMarkStep, AddMarkStep } from 'prosemirror-transform';
2
2
  import { TextSelection } from 'prosemirror-state';
3
- import { changeStylesString, shallowEqual } from './utils';
4
- import { markApplies, hasMark, removeMarks, toggleMark, styleValue, selectionMarks } from './mark';
3
+ import { changeStylesString, shallowEqual } from './utils.js';
4
+ import { selectionMarks, styleValue, hasMark, removeMarks, toggleMark, markApplies } from './mark.js';
5
+
5
6
  const changeStyleFromMark = (marks, toChange) => {
6
7
  const styleMark = marks.find(m => m.type.name === 'style');
7
8
  const elementStyle = styleMark && styleMark.attrs.style;
@@ -55,7 +56,7 @@ const changeStyleMark = (tr, from, to, attrs, markType) => {
55
56
  /**
56
57
  * Used by FontSize and FontName tools for getting their state.
57
58
  */
58
- export const getInlineStyles = (state, style) => {
59
+ const getInlineStyles = (state, style) => {
59
60
  const styleMark = state.schema.marks.style;
60
61
  const marks = styleMark ? selectionMarks(state, styleMark) : [];
61
62
  return marks.map(mark => styleValue(mark, style)).filter(m => m !== null);
@@ -103,7 +104,7 @@ const changeStyle = (markType, attrs) => {
103
104
  /**
104
105
  * Used by bold, italic, ... and link commands.
105
106
  */
106
- export const toggleInlineFormat = (options, tr, markAttrs) => (state, dispatch) => {
107
+ const toggleInlineFormat = (options, tr, markAttrs) => (state, dispatch) => {
107
108
  const marks = state.schema.marks;
108
109
  const { altStyle, altMarks = [], mark } = options;
109
110
  const transaction = tr || state.tr;
@@ -132,7 +133,7 @@ export const toggleInlineFormat = (options, tr, markAttrs) => (state, dispatch)
132
133
  /**
133
134
  * Used by FontSize, FontName, Color and BackColor commands.
134
135
  */
135
- export const applyInlineStyle = (options, command) => (state, dispatch) => {
136
+ const applyInlineStyle = (options, command) => (state, dispatch) => {
136
137
  const marks = state.schema.marks;
137
138
  const markType = marks.style;
138
139
  const attrs = {
@@ -172,3 +173,5 @@ export const applyInlineStyle = (options, command) => (state, dispatch) => {
172
173
  }
173
174
  return changeStyle(markType, attrs)(state, dispatch, tr);
174
175
  };
176
+
177
+ export { applyInlineStyle, getInlineStyles, toggleInlineFormat };
@@ -1,6 +1,7 @@
1
- import { toggleInlineFormat } from './inline-style';
2
- import { hasMark, toggleMark, removeMark, selectionMarks } from './mark';
1
+ import { toggleInlineFormat } from './inline-style.js';
2
+ import { removeMark, hasMark, selectionMarks, toggleMark } from './mark.js';
3
3
  import { EditorState } from 'prosemirror-state';
4
+
4
5
  const modifyLink = (options, tr) => (state, dispatch) => {
5
6
  const { $cursor, from, to } = state.selection;
6
7
  const markType = state.schema.marks[options.mark];
@@ -36,7 +37,7 @@ const modifyLink = (options, tr) => (state, dispatch) => {
36
37
  dispatch(tr);
37
38
  }
38
39
  };
39
- export const removeLink = (options, tr) => (state, dispatch) => {
40
+ const removeLink = (options, tr) => (state, dispatch) => {
40
41
  const { $cursor } = state.selection;
41
42
  if (!$cursor) {
42
43
  toggleInlineFormat(options, tr)(state, dispatch);
@@ -70,7 +71,7 @@ const getParentMark = (state, markType) => {
70
71
  const marks = selectionMarks(state, markType);
71
72
  return marks.length === 1 && marks[0] ? marks[0] : null;
72
73
  };
73
- export const applyLink = ({ mark, attrs }, commandName = 'link') => (state, dispatch) => {
74
+ const applyLink = ({ mark, attrs }, commandName = 'link') => (state, dispatch) => {
74
75
  const marks = state.schema.marks;
75
76
  const tr = state.tr;
76
77
  if (commandName) {
@@ -100,3 +101,5 @@ export const applyLink = ({ mark, attrs }, commandName = 'link') => (state, disp
100
101
  }
101
102
  return dispatched;
102
103
  };
104
+
105
+ export { applyLink, removeLink };
@@ -1,4 +1,5 @@
1
- import { fragmentToHtml, htmlToFragment } from './source';
1
+ import { htmlToFragment, fragmentToHtml } from './source.js';
2
+
2
3
  const msoListRegExp = /style=['"]?[^'"]*?mso-list:\s*[a-zA-Z]+(\d+)\s[a-zA-Z]+(\d+)\s(\w+)/gi;
3
4
  const extractListLevels = (html) => {
4
5
  html = html.replace(msoListRegExp, (match, list, level) => {
@@ -176,10 +177,12 @@ const toList = (blockNodes) => {
176
177
  }
177
178
  }
178
179
  };
179
- export const convertMsLists = (html) => {
180
+ const convertMsLists = (html) => {
180
181
  const container = htmlToFragment(extractListLevels(html));
181
182
  const groups = new Set();
182
183
  mapListsCandidates(container.children, groups);
183
184
  groups.forEach(listsCandidates => toList(listsCandidates));
184
185
  return fragmentToHtml(container);
185
186
  };
187
+
188
+ export { convertMsLists };
@@ -1,9 +1,10 @@
1
- import { Fragment, Slice, NodeRange } from 'prosemirror-model';
1
+ import { Slice, Fragment, NodeRange } from 'prosemirror-model';
2
2
  import { TextSelection, NodeSelection } from 'prosemirror-state';
3
3
  import { liftTarget, ReplaceAroundStep } from 'prosemirror-transform';
4
4
  import { autoJoin } from 'prosemirror-commands';
5
- import { wrapInList as pmWrapInList, splitListItem } from 'prosemirror-schema-list';
6
- import { bulletList as bulletListSettings, orderedList as orderedListSettings } from './config/list-settings';
5
+ import { wrapInList as wrapInList$1, splitListItem } from 'prosemirror-schema-list';
6
+ import { bulletList, orderedList } from './config/list-settings.js';
7
+
7
8
  const rootListDepth = (pos, nodes) => {
8
9
  // Get the depth of the nearest ancestor list
9
10
  const { bulletList, orderedList, listItem } = nodes;
@@ -207,7 +208,7 @@ function liftListItems(options) {
207
208
  };
208
209
  }
209
210
  function wrapInList(nodeType, attrs = {}) {
210
- return autoJoin(pmWrapInList(nodeType, attrs), (before, after) => before.type === after.type && before.type === nodeType);
211
+ return autoJoin(wrapInList$1(nodeType, attrs), (before, after) => before.type === after.type && before.type === nodeType);
211
212
  }
212
213
  const reListStyle = /list\-style\-type:\s?([\w-]+)/;
213
214
  /**
@@ -216,12 +217,12 @@ const reListStyle = /list\-style\-type:\s?([\w-]+)/;
216
217
  * @param attrs - The attributes of the list node
217
218
  * @returns The extracted list-style-type.
218
219
  */
219
- export const listStyle = (attrs) => {
220
+ const listStyle = (attrs) => {
220
221
  const styleAttr = attrs.style || '';
221
222
  const execArray = reListStyle.exec(styleAttr);
222
223
  return (execArray && execArray[1]) || '';
223
224
  };
224
- export const toggleList = (state, dispatch, view, options, command) => {
225
+ const toggleList = (state, dispatch, view, options, command) => {
225
226
  const { listType, listAttrs = { style: null } } = options;
226
227
  const { selection } = state;
227
228
  const fromNode = selection.$from.node(selection.$from.depth - 2);
@@ -245,13 +246,13 @@ export const toggleList = (state, dispatch, view, options, command) => {
245
246
  return true;
246
247
  }
247
248
  };
248
- export function toggleUnorderedList(state, dispatch, view) {
249
- return toggleList(state, dispatch, view, Object.assign({ listType: bulletListSettings.listType }, bulletListSettings.types));
249
+ function toggleUnorderedList(state, dispatch, view) {
250
+ return toggleList(state, dispatch, view, Object.assign({ listType: bulletList.listType }, bulletList.types));
250
251
  }
251
- export function toggleOrderedList(state, dispatch, view) {
252
- return toggleList(state, dispatch, view, Object.assign({ listType: orderedListSettings.listType }, orderedListSettings.types));
252
+ function toggleOrderedList(state, dispatch, view) {
253
+ return toggleList(state, dispatch, view, Object.assign({ listType: orderedList.listType }, orderedList.types));
253
254
  }
254
- export const splitListItemKeepMarks = (itemType) => (state, dispatch) => {
255
+ const splitListItemKeepMarks = (itemType) => (state, dispatch) => {
255
256
  // see https://github.com/ProseMirror/prosemirror-commands/blob/master/src/commands.js#L321-L327
256
257
  return splitListItem(itemType)(state, tr => {
257
258
  const marks = state.storedMarks || (state.selection.$to.parentOffset && state.selection.$from.marks());
@@ -261,3 +262,5 @@ export const splitListItemKeepMarks = (itemType) => (state, dispatch) => {
261
262
  dispatch(tr);
262
263
  });
263
264
  };
265
+
266
+ export { listStyle, splitListItemKeepMarks, toggleList, toggleOrderedList, toggleUnorderedList };
@@ -1,33 +1,32 @@
1
- export { getHtml, setHtml, parseContent, trimWhitespace, htmlToFragment, domToPmDoc, pmDocToFragment, fragmentToHtml } from './source';
2
- export { applyInlineStyle, getInlineStyles, toggleInlineFormat } from './inline-style';
3
- export { applyLink, removeLink } from './link';
4
- export { insertText } from './text';
5
- export { insertImage } from './image';
6
- export { alignBlocks, isAligned } from './align';
7
- export { cleanFormatting } from './cleanFormatting';
8
- export { hasNode, activeNode, formatBlockElements, getBlockFormats, parentBlockFormat, changeTextBlock, blockNodes, cleanTextBlockFormatting } from './blockNode';
9
- export { hasMark, getMark, getActiveMarks, removeAllMarks, cleanMarks, selectionMarks } from './mark';
10
- export { indent, canIndentAsListItem, outdent, canOutdentAsListItem, isIndented, canBeIndented, indentBlocks } from './indent';
11
- export { toggleOrderedList, toggleUnorderedList, toggleList, listStyle } from './lists';
12
- export { blockquote, liftBlockquote } from './blockquote';
13
- export { hasSameMarkup, getSelectionText, getNodeFromSelection, selectedLineTextOnly, expandSelection, expandToWordWrap, canInsert, insertNode, indentHtml } from './utils';
14
- export { alignLeftRules, alignCenterRules, alignRightRules, alignJustifyRules, alignRemoveRules } from './config/align-rules';
15
- export { indentRules, outdentRules } from './config/indent-rules';
16
- export { nodes, marks } from './config/schema';
17
- export { buildKeymap, buildListKeymap } from './config/keymap';
18
- export { bold, italic, underline, strikethrough, subscript, superscript, link } from './config/commands';
19
- export { sanitize, removeComments, removeTag, pasteCleanup, sanitizeClassAttr, sanitizeStyleAttr, removeAttribute, replaceImageSourcesFromRtf } from './paste';
20
- export { convertMsLists } from './listConvert';
21
- export { find, findAt, findAll, replace, replaceAll } from './find-replace';
22
- export { placeholder } from './plugins/placeholder';
23
- export { spacesFix } from './plugins/spaces-fix';
24
- export { cspFix } from './plugins/csp-fix';
25
- export { textHighlight, textHighlightKey } from './plugins/highlight';
26
- export { imageResizing, imageResizeKey } from './plugins/image-resize';
27
- export { caretColor, caretColorKey } from './plugins/caret-color';
28
- export { tableResizing, tableResizeKey, tableColumnResizeKey, tableRowResizeKey } from './plugins/table-resize';
29
- export { listMarkersStyles } from './plugins/list-markers-styles';
30
- // ProseMirror re-exports
1
+ export { domToPmDoc, fragmentToHtml, getHtml, hasSameMarkup, htmlToFragment, parseContent, pmDocToFragment, setHtml, trimWhitespace } from './source.js';
2
+ export { applyInlineStyle, getInlineStyles, toggleInlineFormat } from './inline-style.js';
3
+ export { applyLink, removeLink } from './link.js';
4
+ export { insertText } from './text.js';
5
+ export { insertImage } from './image.js';
6
+ export { alignBlocks, isAligned } from './align.js';
7
+ export { cleanFormatting } from './cleanFormatting.js';
8
+ export { activeNode, blockNodes, changeTextBlock, cleanTextBlockFormatting, formatBlockElements, getBlockFormats, hasNode, parentBlockFormat } from './blockNode.js';
9
+ export { cleanMarks, getActiveMarks, getMark, hasMark, removeAllMarks, selectionMarks } from './mark.js';
10
+ export { canBeIndented, canIndentAsListItem, canOutdentAsListItem, indent, indentBlocks, isIndented, outdent } from './indent.js';
11
+ export { listStyle, toggleList, toggleOrderedList, toggleUnorderedList } from './lists.js';
12
+ export { blockquote, liftBlockquote } from './blockquote.js';
13
+ export { canInsert, expandSelection, expandToWordWrap, getNodeFromSelection, getSelectionText, indentHtml, insertNode, parentNode, selectedLineTextOnly } from './utils.js';
14
+ export { alignCenterRules, alignJustifyRules, alignLeftRules, alignRemoveRules, alignRightRules } from './config/align-rules.js';
15
+ export { indentRules, outdentRules } from './config/indent-rules.js';
16
+ export { marks, nodes } from './config/schema.js';
17
+ export { buildKeymap, buildListKeymap } from './config/keymap.js';
18
+ export { bold, italic, link, strikethrough, subscript, superscript, underline } from './config/commands.js';
19
+ export { pasteCleanup, removeAttribute, removeComments, removeTag, replaceImageSourcesFromRtf, sanitize, sanitizeClassAttr, sanitizeStyleAttr } from './paste.js';
20
+ export { convertMsLists } from './listConvert.js';
21
+ export { find, findAll, findAt, replace, replaceAll } from './find-replace.js';
22
+ export { placeholder } from './plugins/placeholder.js';
23
+ export { spacesFix } from './plugins/spaces-fix.js';
24
+ export { cspFix } from './plugins/csp-fix.js';
25
+ export { textHighlight, textHighlightKey } from './plugins/highlight.js';
26
+ export { imageResizeKey, imageResizing } from './plugins/image-resize.js';
27
+ export { caretColor, caretColorKey } from './plugins/caret-color.js';
28
+ export { tableResizing } from './plugins/table-resize/index.js';
29
+ export { listMarkersStyles } from './plugins/list-markers-styles.js';
31
30
  export * from 'prosemirror-commands';
32
31
  export * from 'prosemirror-dropcursor';
33
32
  export * from 'prosemirror-gapcursor';
@@ -37,8 +36,8 @@ export * from 'prosemirror-keymap';
37
36
  export * from 'prosemirror-model';
38
37
  export * from 'prosemirror-schema-list';
39
38
  export * from 'prosemirror-state';
40
- // Fixes an error related to setting over the addRowAfter and addRowBefore exports from the PM tables module
41
- export { TableMap, tableEditing, tableEditingKey, tableNodeTypes, tableNodes, fixTables, fixTablesKey, isInTable, deleteTable, inSameTable, CellSelection, selectedRect, selectionCell, setCellAttr, goToNextCell, toggleHeader, toggleHeaderCell, toggleHeaderColumn, toggleHeaderRow, splitCell, splitCellWithType, mergeCells, deleteRow, rowIsHeader, addRow, addColSpan, addColumn, colCount, columnIsHeader, columnResizing, columnResizingPluginKey, updateColumnsOnResize, cellAround, findCell, removeColSpan, moveCellForward, nextCell } from 'prosemirror-tables';
39
+ export { CellSelection, TableMap, addColSpan, addColumn, addRow, cellAround, colCount, columnIsHeader, columnResizing, columnResizingPluginKey, deleteRow, deleteTable, findCell, fixTables, fixTablesKey, goToNextCell, inSameTable, isInTable, mergeCells, moveCellForward, nextCell, addColumnAfter as pmAddColumnAfter, addColumnBefore as pmAddColumnBefore, addRowAfter as pmAddRowAfter, addRowBefore as pmAddRowBefore, deleteColumn as pmDeleteColumn, removeColSpan, rowIsHeader, selectedRect, selectionCell, setCellAttr, splitCell, splitCellWithType, tableEditing, tableEditingKey, tableNodeTypes, tableNodes, toggleHeader, toggleHeaderCell, toggleHeaderColumn, toggleHeaderRow, updateColumnsOnResize } from 'prosemirror-tables';
42
40
  export * from 'prosemirror-transform';
43
41
  export * from 'prosemirror-view';
44
- export { createTable, addRowAfter, addRowBefore, addColumnBefore, addColumnAfter, deleteColumn, pmAddColumnBefore, pmAddColumnAfter, pmAddRowAfter, pmAddRowBefore, pmDeleteColumn } from './table';
42
+ export { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, createTable, deleteColumn } from './table.js';
43
+ export { tableColumnResizeKey, tableResizeKey, tableRowResizeKey } from './plugins/table-resize/utils.js';