@progress/kendo-editor-common 1.12.2-develop.5 → 1.12.2-develop.7

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 (183) hide show
  1. package/dist/cdn/js/kendo-editor-common.js +1 -1
  2. package/dist/cdn/main.js +1 -1
  3. package/dist/es/DOMSerializer.js +6 -7
  4. package/dist/es/align.js +3 -6
  5. package/dist/es/blockNode.js +11 -14
  6. package/dist/es/blockquote.js +2 -5
  7. package/dist/es/cleanFormatting.js +3 -6
  8. package/dist/es/config/align-rules.js +5 -7
  9. package/dist/es/config/commands.js +13 -9
  10. package/dist/es/config/constants.js +7 -9
  11. package/dist/es/config/indent-rules.js +3 -6
  12. package/dist/es/config/keymap.js +7 -10
  13. package/dist/es/config/list-settings.js +3 -5
  14. package/dist/es/config/schema.js +4 -6
  15. package/dist/es/find-replace.js +8 -10
  16. package/dist/es/flatten-spans.js +2 -5
  17. package/dist/es/image.js +2 -5
  18. package/dist/es/indent.js +11 -14
  19. package/dist/es/inline-style.js +10 -12
  20. package/dist/es/link.js +5 -8
  21. package/dist/es/listConvert.js +8 -9
  22. package/dist/es/lists.js +12 -15
  23. package/dist/es/main.js +34 -33
  24. package/dist/es/mark.js +16 -17
  25. package/dist/es/paste.js +10 -13
  26. package/dist/es/plugins/caret-color.js +5 -8
  27. package/dist/es/plugins/csp-fix.js +2 -5
  28. package/dist/es/plugins/highlight.js +3 -6
  29. package/dist/es/plugins/image-resize.js +8 -11
  30. package/dist/es/plugins/list-markers-styles.js +2 -5
  31. package/dist/es/plugins/placeholder.js +2 -5
  32. package/dist/es/plugins/resize-utils.js +2 -4
  33. package/dist/es/plugins/spaces-fix.js +1 -4
  34. package/dist/es/plugins/table-resize/column-resize.js +21 -24
  35. package/dist/es/plugins/table-resize/index.js +6 -9
  36. package/dist/es/plugins/table-resize/row-resize.js +23 -24
  37. package/dist/es/plugins/table-resize/table-resize.js +17 -20
  38. package/dist/es/plugins/table-resize/table-view.js +6 -9
  39. package/dist/es/plugins/table-resize/utils.js +10 -13
  40. package/dist/es/source.js +15 -18
  41. package/dist/es/table.js +15 -18
  42. package/dist/es/text.js +1 -3
  43. package/dist/es/types/active-marks.js +1 -0
  44. package/dist/es/types/command.js +1 -0
  45. package/dist/es/types/dispatchFn.js +1 -0
  46. package/dist/es/types/paste-cleanup-settings.js +1 -0
  47. package/dist/es/types/predicate.js +1 -0
  48. package/dist/es/utils.js +18 -21
  49. package/dist/npm/DOMSerializer.d.ts +35 -0
  50. package/dist/npm/DOMSerializer.js +10 -9
  51. package/dist/npm/align.d.ts +4 -7
  52. package/dist/npm/align.js +9 -10
  53. package/dist/npm/blockNode.d.ts +15 -12
  54. package/dist/npm/blockNode.js +28 -29
  55. package/dist/npm/blockquote.d.ts +2 -5
  56. package/dist/npm/blockquote.js +6 -7
  57. package/dist/npm/cleanFormatting.d.ts +3 -6
  58. package/dist/npm/cleanFormatting.js +7 -8
  59. package/dist/npm/config/align-rules.d.ts +6 -8
  60. package/dist/npm/config/align-rules.js +8 -13
  61. package/dist/npm/config/commands.d.ts +19 -11
  62. package/dist/npm/config/commands.js +16 -17
  63. package/dist/npm/config/constants.d.ts +7 -0
  64. package/dist/npm/config/constants.js +10 -17
  65. package/dist/npm/config/indent-rules.d.ts +4 -6
  66. package/dist/npm/config/indent-rules.js +8 -11
  67. package/dist/npm/config/keymap.d.ts +2 -5
  68. package/dist/npm/config/keymap.js +21 -22
  69. package/dist/npm/config/list-settings.d.ts +30 -0
  70. package/dist/npm/config/list-settings.js +10 -13
  71. package/dist/npm/config/schema.d.ts +2 -3
  72. package/dist/npm/config/schema.js +19 -20
  73. package/dist/npm/find-replace.d.ts +7 -10
  74. package/dist/npm/find-replace.js +20 -20
  75. package/dist/npm/flatten-spans.d.ts +1 -3
  76. package/dist/npm/flatten-spans.js +6 -7
  77. package/dist/npm/image.d.ts +3 -6
  78. package/dist/npm/image.js +5 -6
  79. package/dist/npm/indent.d.ts +9 -12
  80. package/dist/npm/indent.js +37 -38
  81. package/dist/npm/inline-style.d.ts +4 -7
  82. package/dist/npm/inline-style.js +28 -28
  83. package/dist/npm/link.d.ts +2 -4
  84. package/dist/npm/link.js +21 -22
  85. package/dist/npm/listConvert.d.ts +1 -3
  86. package/dist/npm/listConvert.js +13 -12
  87. package/dist/npm/lists.d.ts +8 -8
  88. package/dist/npm/lists.js +26 -27
  89. package/dist/npm/main.d.ts +34 -35
  90. package/dist/npm/main.js +214 -391
  91. package/dist/npm/mark.d.ts +17 -12
  92. package/dist/npm/mark.js +30 -29
  93. package/dist/npm/paste.d.ts +8 -11
  94. package/dist/npm/paste.js +19 -20
  95. package/dist/npm/plugins/caret-color.d.ts +2 -5
  96. package/dist/npm/plugins/caret-color.js +15 -17
  97. package/dist/npm/plugins/csp-fix.d.ts +1 -4
  98. package/dist/npm/plugins/csp-fix.js +8 -9
  99. package/dist/npm/plugins/highlight.d.ts +4 -7
  100. package/dist/npm/plugins/highlight.js +11 -13
  101. package/dist/npm/plugins/image-resize.d.ts +5 -7
  102. package/dist/npm/plugins/image-resize.js +35 -37
  103. package/dist/npm/plugins/list-markers-styles.d.ts +2 -5
  104. package/dist/npm/plugins/list-markers-styles.js +14 -16
  105. package/dist/npm/plugins/placeholder.d.ts +1 -4
  106. package/dist/npm/plugins/placeholder.js +10 -12
  107. package/dist/npm/plugins/resize-utils.d.ts +35 -0
  108. package/dist/npm/plugins/resize-utils.js +5 -7
  109. package/dist/npm/plugins/spaces-fix.d.ts +1 -4
  110. package/dist/npm/plugins/spaces-fix.js +9 -10
  111. package/dist/npm/plugins/table-resize/column-resize.d.ts +2 -0
  112. package/dist/npm/plugins/table-resize/column-resize.js +44 -46
  113. package/dist/npm/plugins/table-resize/index.d.ts +2 -5
  114. package/dist/npm/plugins/table-resize/index.js +13 -14
  115. package/dist/npm/plugins/table-resize/row-resize.d.ts +2 -0
  116. package/dist/npm/plugins/table-resize/row-resize.js +40 -40
  117. package/dist/npm/plugins/table-resize/table-resize.d.ts +18 -0
  118. package/dist/npm/plugins/table-resize/table-resize.js +51 -52
  119. package/dist/npm/plugins/table-resize/table-view.d.ts +28 -0
  120. package/dist/npm/plugins/table-resize/table-view.js +23 -24
  121. package/dist/npm/plugins/table-resize/utils.d.ts +17 -7
  122. package/dist/npm/plugins/table-resize/utils.js +24 -28
  123. package/dist/npm/source.d.ts +13 -16
  124. package/dist/npm/source.js +35 -36
  125. package/dist/npm/table.d.ts +9 -10
  126. package/dist/npm/table.js +33 -49
  127. package/dist/npm/text.d.ts +3 -6
  128. package/dist/npm/text.js +3 -3
  129. package/dist/npm/types/active-marks.d.ts +1 -4
  130. package/dist/npm/types/active-marks.js +2 -0
  131. package/dist/npm/types/command.d.ts +2 -5
  132. package/dist/npm/types/command.js +2 -0
  133. package/dist/npm/types/dispatchFn.d.ts +1 -4
  134. package/dist/npm/types/dispatchFn.js +2 -0
  135. package/dist/npm/types/paste-cleanup-settings.d.ts +1 -3
  136. package/dist/npm/types/paste-cleanup-settings.js +2 -0
  137. package/dist/npm/types/predicate.d.ts +1 -0
  138. package/dist/npm/types/predicate.js +2 -0
  139. package/dist/npm/utils.d.ts +33 -14
  140. package/dist/npm/utils.js +38 -39
  141. package/package.json +4 -51
  142. package/dist/es2015/DOMSerializer.js +0 -184
  143. package/dist/es2015/align.js +0 -43
  144. package/dist/es2015/blockNode.js +0 -180
  145. package/dist/es2015/blockquote.js +0 -26
  146. package/dist/es2015/cleanFormatting.js +0 -20
  147. package/dist/es2015/config/align-rules.js +0 -30
  148. package/dist/es2015/config/commands.js +0 -50
  149. package/dist/es2015/config/constants.js +0 -9
  150. package/dist/es2015/config/indent-rules.js +0 -42
  151. package/dist/es2015/config/keymap.js +0 -51
  152. package/dist/es2015/config/list-settings.js +0 -21
  153. package/dist/es2015/config/schema.js +0 -314
  154. package/dist/es2015/find-replace.js +0 -122
  155. package/dist/es2015/flatten-spans.js +0 -112
  156. package/dist/es2015/image.js +0 -10
  157. package/dist/es2015/indent.js +0 -105
  158. package/dist/es2015/inline-style.js +0 -177
  159. package/dist/es2015/link.js +0 -105
  160. package/dist/es2015/listConvert.js +0 -184
  161. package/dist/es2015/lists.js +0 -266
  162. package/dist/es2015/main.js +0 -44
  163. package/dist/es2015/mark.js +0 -239
  164. package/dist/es2015/node_modules/tslib/tslib.es6.js +0 -35
  165. package/dist/es2015/paste.js +0 -162
  166. package/dist/es2015/plugins/caret-color.js +0 -34
  167. package/dist/es2015/plugins/csp-fix.js +0 -51
  168. package/dist/es2015/plugins/highlight.js +0 -23
  169. package/dist/es2015/plugins/image-resize.js +0 -225
  170. package/dist/es2015/plugins/list-markers-styles.js +0 -104
  171. package/dist/es2015/plugins/placeholder.js +0 -27
  172. package/dist/es2015/plugins/resize-utils.js +0 -13
  173. package/dist/es2015/plugins/spaces-fix.js +0 -46
  174. package/dist/es2015/plugins/table-resize/column-resize.js +0 -267
  175. package/dist/es2015/plugins/table-resize/index.js +0 -12
  176. package/dist/es2015/plugins/table-resize/row-resize.js +0 -234
  177. package/dist/es2015/plugins/table-resize/table-resize.js +0 -278
  178. package/dist/es2015/plugins/table-resize/table-view.js +0 -128
  179. package/dist/es2015/plugins/table-resize/utils.js +0 -93
  180. package/dist/es2015/source.js +0 -251
  181. package/dist/es2015/table.js +0 -132
  182. package/dist/es2015/text.js +0 -5
  183. package/dist/es2015/utils.js +0 -289
@@ -1,6 +1,5 @@
1
- import { setAttribute } from './utils.js';
2
-
3
- class DOMSerializer {
1
+ import { setAttribute } from './utils';
2
+ export class DOMSerializer {
4
3
  /// Render an [output spec](#model.DOMOutputSpec) to a DOM node. If
5
4
  /// the spec has a hole (zero) in it, `contentDOM` will point at the
6
5
  /// node with the hole.
@@ -21,7 +20,8 @@ class DOMSerializer {
21
20
  }
22
21
  let contentDOM;
23
22
  const dom = (xmlNS ? docum.createElementNS(xmlNS, tagName) : docum.createElement(tagName));
24
- let attrs = structure[1], start = 1;
23
+ const attrs = structure[1];
24
+ let start = 1;
25
25
  if (attrs && typeof attrs === 'object' && attrs.nodeType == null && !Array.isArray(attrs)) {
26
26
  start = 2;
27
27
  for (const name in attrs) {
@@ -99,7 +99,8 @@ class DOMSerializer {
99
99
  if (!target) {
100
100
  target = doc(options).createDocumentFragment();
101
101
  }
102
- let top = target, active = [];
102
+ let top = target;
103
+ const active = [];
103
104
  fragment.forEach(node => {
104
105
  if (active.length || node.marks.length) {
105
106
  let keep = 0, rendered = 0;
@@ -180,5 +181,3 @@ function gatherToDOM(obj) {
180
181
  function doc(options) {
181
182
  return options.document || window.document;
182
183
  }
183
-
184
- export { DOMSerializer };
package/dist/es/align.js CHANGED
@@ -1,11 +1,10 @@
1
- import { blockNodes, addStyles, changeTextBlock } from './blockNode.js';
2
-
1
+ import { blockNodes, addStyles, changeTextBlock } from './blockNode';
3
2
  /**
4
3
  * Aligning block elements in the selection.
5
4
  *
6
5
  * @returns {boolean} - Returns true if any alignment is applied.
7
6
  */
8
- const alignBlocks = (actions, commandName) => (state, dispatch) => {
7
+ export const alignBlocks = (actions, commandName) => (state, dispatch) => {
9
8
  const blocks = blockNodes(state);
10
9
  const tr = state.tr;
11
10
  tr.setMeta('commandName', commandName);
@@ -24,7 +23,7 @@ const alignBlocks = (actions, commandName) => (state, dispatch) => {
24
23
  }
25
24
  return result;
26
25
  };
27
- const isAligned = (state, actions) => {
26
+ export const isAligned = (state, actions) => {
28
27
  const blocks = blockNodes(state);
29
28
  let result = false;
30
29
  blocks.forEach(node => {
@@ -39,5 +38,3 @@ const isAligned = (state, actions) => {
39
38
  });
40
39
  return result;
41
40
  };
42
-
43
- export { alignBlocks, isAligned };
@@ -1,8 +1,7 @@
1
- import { changeStylesString } from './utils.js';
1
+ import { changeStylesString } from './utils';
2
2
  import { ReplaceAroundStep } from 'prosemirror-transform';
3
- import { Slice, Fragment } from 'prosemirror-model';
3
+ import { Fragment, Slice } from 'prosemirror-model';
4
4
  import { NodeSelection } from 'prosemirror-state';
5
-
6
5
  /**
7
6
  * @hidden
8
7
  */
@@ -16,7 +15,7 @@ const canChangeType = (stateDoc, pos, type) => {
16
15
  * @example
17
16
  * See `cleanTextBlockFormatting` or `formatBlockElements` function.
18
17
  */
19
- const changeTextBlock = (tr, node, nodeType, attrs) => {
18
+ export const changeTextBlock = (tr, node, nodeType, attrs) => {
20
19
  if (!nodeType.isTextblock) {
21
20
  return false;
22
21
  }
@@ -47,7 +46,7 @@ const changeTextBlock = (tr, node, nodeType, attrs) => {
47
46
  * @example
48
47
  * See `cleanTextBlockFormatting` function.
49
48
  */
50
- const blockNodes = (state, options = { blocksInSelection: false }) => {
49
+ export const blockNodes = (state, options = { blocksInSelection: false }) => {
51
50
  const { doc, selection } = state;
52
51
  const { $from, ranges } = selection;
53
52
  const { blocksInSelection } = options;
@@ -79,7 +78,7 @@ const blockNodes = (state, options = { blocksInSelection: false }) => {
79
78
  }
80
79
  return result;
81
80
  };
82
- const formatBlockElements = (value, commandName) => (state, dispatch) => {
81
+ export const formatBlockElements = (value, commandName) => (state, dispatch) => {
83
82
  const blocks = blockNodes(state);
84
83
  const nodes = state.schema.nodes;
85
84
  const tr = state.tr;
@@ -112,7 +111,7 @@ const formatBlockElements = (value, commandName) => (state, dispatch) => {
112
111
  * @example
113
112
  * See `cleanFormatting` function.
114
113
  */
115
- const cleanTextBlockFormatting = (tr, options = { blocksInSelection: true }) => {
114
+ export const cleanTextBlockFormatting = (tr, options = { blocksInSelection: true }) => {
116
115
  const { doc, selection } = tr;
117
116
  const { blocksInSelection, blockNodeType } = options;
118
117
  const nodes = blockNodes({ doc, selection }, { blocksInSelection });
@@ -125,7 +124,7 @@ const cleanTextBlockFormatting = (tr, options = { blocksInSelection: true }) =>
125
124
  }
126
125
  });
127
126
  };
128
- const getBlockFormats = (state) => {
127
+ export const getBlockFormats = (state) => {
129
128
  const blocks = blockNodes(state);
130
129
  const nodes = state.schema.nodes;
131
130
  const result = [];
@@ -143,7 +142,7 @@ const getBlockFormats = (state) => {
143
142
  });
144
143
  return result;
145
144
  };
146
- const addStyles = (node, stylesToApply) => {
145
+ export const addStyles = (node, stylesToApply) => {
147
146
  let currentStyles = node.attrs.style, changedStyleResult, toChange;
148
147
  if (currentStyles) {
149
148
  stylesToApply.forEach(style => {
@@ -156,7 +155,7 @@ const addStyles = (node, stylesToApply) => {
156
155
  currentStyles = currentStyles || stylesToApply.reduce(reducer, '');
157
156
  return Object.assign({}, node.attrs, { style: currentStyles || null });
158
157
  };
159
- const hasNode = (state, nodeType) => {
158
+ export const hasNode = (state, nodeType) => {
160
159
  const { from, to } = state.selection;
161
160
  let result = false;
162
161
  state.doc.nodesBetween(from, to, node => {
@@ -165,15 +164,13 @@ const hasNode = (state, nodeType) => {
165
164
  });
166
165
  return result;
167
166
  };
168
- const parentBlockFormat = (state) => {
167
+ export const parentBlockFormat = (state) => {
169
168
  const formats = getBlockFormats(state);
170
169
  return new Set(formats).size === 1 ? formats[0] : null;
171
170
  };
172
171
  /**
173
172
  * **Deprecated.** Use `parentBlockFormat` function instead.
174
173
  */
175
- const activeNode = (state) => {
174
+ export const activeNode = (state) => {
176
175
  return { tag: parentBlockFormat(state) || '' };
177
176
  };
178
-
179
- export { activeNode, addStyles, blockNodes, changeTextBlock, cleanTextBlockFormatting, formatBlockElements, getBlockFormats, hasNode, parentBlockFormat };
@@ -1,9 +1,8 @@
1
1
  import { wrapIn } from 'prosemirror-commands';
2
-
3
- const blockquote = (state, dispatch) => {
2
+ export const blockquote = (state, dispatch) => {
4
3
  return wrapIn(state.schema.nodes.blockquote)(state, dispatch);
5
4
  };
6
- const liftBlockquote = (state, dispatch) => {
5
+ export const liftBlockquote = (state, dispatch) => {
7
6
  const { $from, $to } = state.selection;
8
7
  const nodeType = state.schema.nodes.blockquote;
9
8
  const doc = state.doc;
@@ -22,5 +21,3 @@ const liftBlockquote = (state, dispatch) => {
22
21
  }
23
22
  return result;
24
23
  };
25
-
26
- export { blockquote, liftBlockquote };
@@ -1,10 +1,9 @@
1
- import { cleanTextBlockFormatting } from './blockNode.js';
2
- import { cleanMarks } from './mark.js';
3
-
1
+ import { cleanTextBlockFormatting } from './blockNode';
2
+ import { cleanMarks } from './mark';
4
3
  /**
5
4
  * A command which removes the inline formatting, class and style attributes of paragraph and heading elements in the selection.
6
5
  */
7
- const cleanFormatting = (options = { blocksInSelection: true }) => (state, dispatch) => {
6
+ export const cleanFormatting = (options = { blocksInSelection: true }) => (state, dispatch) => {
8
7
  const tr = state.tr;
9
8
  const { blocksInSelection, blockNodeType, exceptMarks } = options;
10
9
  const except = (exceptMarks || [state.schema.marks.link]).filter(Boolean);
@@ -16,5 +15,3 @@ const cleanFormatting = (options = { blocksInSelection: true }) => (state, dispa
16
15
  }
17
16
  return result;
18
17
  };
19
-
20
- export { cleanFormatting };
@@ -1,30 +1,28 @@
1
1
  const style = (name, value) => {
2
2
  return { name: name, value: value };
3
3
  };
4
- const alignLeftRules = [
4
+ export const alignLeftRules = [
5
5
  { node: 'paragraph', style: [style('text-align', 'left')] },
6
6
  { node: 'heading', style: [style('text-align', 'left')] },
7
7
  { node: 'table_caption_external', style: [style('text-align', 'left')] }
8
8
  ];
9
- const alignRightRules = [
9
+ export const alignRightRules = [
10
10
  { node: 'paragraph', style: [style('text-align', 'right')] },
11
11
  { node: 'heading', style: [style('text-align', 'right')] },
12
12
  { node: 'table_caption_external', style: [style('text-align', 'right')] }
13
13
  ];
14
- const alignCenterRules = [
14
+ export const alignCenterRules = [
15
15
  { node: 'paragraph', style: [style('text-align', 'center')] },
16
16
  { node: 'heading', style: [style('text-align', 'center')] },
17
17
  { node: 'table_caption_external', style: [style('text-align', 'center')] }
18
18
  ];
19
- const alignJustifyRules = [
19
+ export const alignJustifyRules = [
20
20
  { node: 'paragraph', style: [style('text-align', 'justify')] },
21
21
  { node: 'heading', style: [style('text-align', 'justify')] },
22
22
  { node: 'table_caption_external', style: [style('text-align', 'justify')] }
23
23
  ];
24
- const alignRemoveRules = [
24
+ export const alignRemoveRules = [
25
25
  { node: 'paragraph', style: [style('text-align', '')] },
26
26
  { node: 'heading', style: [style('text-align', '')] },
27
27
  { node: 'table_caption_external', style: [style('text-align', '')] }
28
28
  ];
29
-
30
- export { alignCenterRules, alignJustifyRules, alignLeftRules, alignRemoveRules, alignRightRules };
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The object of the Bold command.
3
3
  */
4
- const bold = {
4
+ export 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 @@ const bold = {
9
9
  /**
10
10
  * The object of the Italic command.
11
11
  */
12
- const italic = {
12
+ export const italic = {
13
13
  mark: 'em',
14
14
  altMarks: ['i'],
15
15
  altStyle: { name: 'font-style', value: /^italic$/i }
@@ -17,34 +17,38 @@ const italic = {
17
17
  /**
18
18
  * The object of the Underline command.
19
19
  */
20
- const underline = {
20
+ export 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
- const strikethrough = {
27
+ export 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
- const subscript = {
34
+ export const subscript = {
35
35
  mark: 'sub'
36
36
  };
37
37
  /**
38
38
  * The object of the Superscript command.
39
39
  */
40
- const superscript = {
40
+ export const superscript = {
41
41
  mark: 'sup'
42
42
  };
43
43
  /**
44
44
  * The object of the Link tool settings.
45
45
  */
46
- const link = {
46
+ export const link = {
47
+ mark: 'link'
48
+ };
49
+ /**
50
+ * The object of the Unlink tool settings.
51
+ */
52
+ export const unlink = {
47
53
  mark: 'link'
48
54
  };
49
-
50
- export { bold, italic, link, strikethrough, subscript, superscript, underline };
@@ -1,9 +1,7 @@
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
+ 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,9 +1,8 @@
1
- import { listsTypes } from './list-settings.js';
2
-
1
+ import { listsTypes } from './list-settings';
3
2
  /**
4
3
  * The object of the Indent tool settings.
5
4
  */
6
- const indentRules = {
5
+ export const indentRules = {
7
6
  nodes: [{
8
7
  node: 'paragraph',
9
8
  style: 'margin-left',
@@ -22,7 +21,7 @@ const indentRules = {
22
21
  /**
23
22
  * The object of the Outdent tool settings.
24
23
  */
25
- const outdentRules = {
24
+ export const outdentRules = {
26
25
  nodes: [{
27
26
  node: 'paragraph',
28
27
  style: 'margin-left',
@@ -38,5 +37,3 @@ const outdentRules = {
38
37
  }],
39
38
  listsTypes: { ...listsTypes }
40
39
  };
41
-
42
- export { indentRules, outdentRules };
@@ -1,14 +1,13 @@
1
- import { chainCommands, deleteSelection, joinBackward, selectNodeBackward, newlineInCode, createParagraphNear, liftEmptyBlock, splitBlockKeepMarks, exitCode } from 'prosemirror-commands';
1
+ import { chainCommands, exitCode, newlineInCode, createParagraphNear, liftEmptyBlock, splitBlockKeepMarks, deleteSelection, joinBackward, selectNodeBackward } from 'prosemirror-commands';
2
2
  import { undo, redo } from 'prosemirror-history';
3
3
  import { undoInputRule } from 'prosemirror-inputrules';
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
-
4
+ import { splitListItemKeepMarks } from '../lists';
5
+ import { bold, italic, underline } from './commands';
6
+ import { toggleInlineFormat } from './../inline-style';
7
+ import { expandToWordWrap } from '../utils';
9
8
  const mac = typeof navigator !== 'undefined' ? /Mac/.test(navigator.platform) : false;
10
9
  // https://github.com/ProseMirror/prosemirror-example-setup/blob/master/src/keymap.js
11
- const buildKeymap = (schema, options) => {
10
+ export const buildKeymap = (schema, options) => {
12
11
  const keys = {};
13
12
  const applyToWord = (options && options.applyToWord) || false;
14
13
  keys['Mod-z'] = undo;
@@ -39,7 +38,7 @@ const buildKeymap = (schema, options) => {
39
38
  }
40
39
  return keys;
41
40
  };
42
- const buildListKeymap = (schema) => {
41
+ export const buildListKeymap = (schema) => {
43
42
  const keys = {};
44
43
  if (schema.nodes.list_item) {
45
44
  // tslint:disable-next-line:no-string-literal
@@ -47,5 +46,3 @@ const buildListKeymap = (schema) => {
47
46
  }
48
47
  return keys;
49
48
  };
50
-
51
- export { buildKeymap, buildListKeymap };
@@ -1,4 +1,4 @@
1
- const listsTypes = {
1
+ export const listsTypes = {
2
2
  orderedList: 'ordered_list',
3
3
  bulletList: 'bullet_list',
4
4
  listItem: 'list_item'
@@ -6,16 +6,14 @@ const listsTypes = {
6
6
  /**
7
7
  * The object of the OrderedList tool settings.
8
8
  */
9
- const orderedList = {
9
+ export const orderedList = {
10
10
  listType: listsTypes.orderedList,
11
11
  types: { ...listsTypes }
12
12
  };
13
13
  /**
14
14
  * The object of the UnorderedList tool settings.
15
15
  */
16
- const bulletList = {
16
+ export const bulletList = {
17
17
  listType: listsTypes.bulletList,
18
18
  types: { ...listsTypes }
19
19
  };
20
-
21
- export { bulletList, listsTypes, orderedList };
@@ -1,8 +1,7 @@
1
1
  import { Schema } from 'prosemirror-model';
2
2
  import { tableNodes } from 'prosemirror-tables';
3
- import { domToPmDoc, htmlToFragment, pmDocToFragment } from '../source.js';
4
- import { colgroupAttr, resizableAttr, rowTypeAttr } from './constants.js';
5
-
3
+ import { domToPmDoc, htmlToFragment, pmDocToFragment } from '../source';
4
+ import { rowTypeAttr, colgroupAttr, resizableAttr } from './constants';
6
5
  const hole = 0;
7
6
  const blockquoteDOM = ['blockquote', hole], hrDOM = ['hr'], preDOM = ['pre', ['code', hole]];
8
7
  const olDOM = ['ol', 0], ulDOM = ['ul', 0], liDOM = ['li', 0];
@@ -132,7 +131,7 @@ const shouldSkipColgroup = (node) => {
132
131
  }
133
132
  return shouldSkip;
134
133
  };
135
- const parseStrColgroup = (colgroup) => {
134
+ export const parseStrColgroup = (colgroup) => {
136
135
  const doc = domToPmDoc(htmlToFragment(colgroup), colgroupSchema, { preserveWhitespace: false });
137
136
  const fragment = pmDocToFragment(doc);
138
137
  const colgroupEl = fragment.firstChild;
@@ -373,5 +372,4 @@ const nodes = {
373
372
  },
374
373
  ...tNodes
375
374
  };
376
-
377
- export { marks, nodes, parseStrColgroup };
375
+ export { nodes, marks };
@@ -1,7 +1,7 @@
1
1
  import { TextSelection } from 'prosemirror-state';
2
-
3
- const findAt = (doc, searchOptions, start, end, exit) => {
4
- let result = [], exec, text, from, to, childText, nextSibling;
2
+ export const findAt = (doc, searchOptions, start, end, exit) => {
3
+ const result = [];
4
+ let exec, text, from, to, childText, nextSibling;
5
5
  const nodes = [];
6
6
  const { matchCase, matchWord, useRegExp } = searchOptions;
7
7
  let searchText = searchOptions.text;
@@ -56,7 +56,7 @@ const findAt = (doc, searchOptions, start, end, exit) => {
56
56
  });
57
57
  return result;
58
58
  };
59
- const find = (state, searchOptions) => {
59
+ export const find = (state, searchOptions) => {
60
60
  const { backward, matchCyclic, ...options } = searchOptions;
61
61
  const exit = backward ? () => false : r => r.length > 0;
62
62
  const { doc, selection } = state;
@@ -75,16 +75,16 @@ const find = (state, searchOptions) => {
75
75
  }
76
76
  return result.length ? result[result.length - 1] : null;
77
77
  };
78
- const findAll = (doc, searchOptions) => {
78
+ export const findAll = (doc, searchOptions) => {
79
79
  return findAt(doc, searchOptions, 0, doc.content.size, () => false);
80
80
  };
81
- const replace = (selection, text, transaction) => {
81
+ export const replace = (selection, text, transaction) => {
82
82
  const { from, to } = selection;
83
83
  transaction.insertText(text, from, to)
84
84
  .setSelection(TextSelection.create(transaction.doc, from, from + text.length));
85
85
  return transaction;
86
86
  };
87
- const replaceAll = (state, replaceText, searchOptions) => {
87
+ export const replaceAll = (state, replaceText, searchOptions) => {
88
88
  const result = findAll(state.doc, searchOptions);
89
89
  if (result.length === 0) {
90
90
  return null;
@@ -95,7 +95,7 @@ const replaceAll = (state, replaceText, searchOptions) => {
95
95
  }
96
96
  return transaction;
97
97
  };
98
- const notLetter = /^[\s0-9~`!@#$%\^&*\(\)_\-=+\\|\[\]{};:'"\?/.,<>]?$/;
98
+ const notLetter = /^[\s0-9~`!@#$%^&*()_\-=+\\|[\]{};:'"?/.,<>]?$/;
99
99
  const shouldMatchWord = (exec, matchWord) => {
100
100
  if (!matchWord) {
101
101
  return true;
@@ -117,5 +117,3 @@ const createRegExp = (inputString, flags) => {
117
117
  .replace(/\s/g, '\\s');
118
118
  return new RegExp(escaped, flags);
119
119
  };
120
-
121
- export { find, findAll, findAt, replace, replaceAll };
@@ -1,5 +1,4 @@
1
- import { htmlToFragment, fragmentToHtml } from './source.js';
2
-
1
+ import { fragmentToHtml, htmlToFragment } from './source';
3
2
  class DomTreeExtractor {
4
3
  constructor(top) {
5
4
  this.extractBefore = (edgeNode) => {
@@ -61,7 +60,7 @@ const isEmptySpan = (fragment) => {
61
60
  * @param content - The HTML content to normalize.
62
61
  * @returns The normalized HTML content with flattened <span> elements.
63
62
  */
64
- const flattenNestedSpans = (content) => {
63
+ export const flattenNestedSpans = (content) => {
65
64
  const dom = htmlToFragment(content);
66
65
  let innerSpan = getInnerSpan(dom);
67
66
  while (innerSpan) {
@@ -108,5 +107,3 @@ const flattenNestedSpans = (content) => {
108
107
  }
109
108
  return fragmentToHtml(dom);
110
109
  };
111
-
112
- export { flattenNestedSpans };
package/dist/es/image.js CHANGED
@@ -1,10 +1,7 @@
1
- import { insertNode } from './utils.js';
2
-
3
- const insertImage = (attrs) => (state, dispatch) => {
1
+ import { insertNode } from './utils';
2
+ export const insertImage = (attrs) => (state, dispatch) => {
4
3
  const { image } = state.schema.nodes;
5
4
  const commandName = 'insertImage';
6
5
  const newImage = image.createAndFill(attrs);
7
6
  insertNode(newImage)(state, tr => dispatch(tr.setMeta('commandName', commandName).setMeta('args', attrs)));
8
7
  };
9
-
10
- export { insertImage };
package/dist/es/indent.js CHANGED
@@ -1,15 +1,14 @@
1
1
  import { sinkListItem, liftListItem } from 'prosemirror-schema-list';
2
- import { indentRules, outdentRules } from './config/indent-rules.js';
3
- import { hasNode, blockNodes, addStyles, changeTextBlock } from './blockNode.js';
4
- import { findNthParentNodeOfType } from './utils.js';
5
- import { liftBlockquote } from './blockquote.js';
6
-
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';
7
6
  /**
8
7
  * Indenting block elements in the selection.
9
8
  *
10
9
  * @returns {boolean} - Returns true if any indentation is applied.
11
10
  */
12
- const indentBlocks = (actions, command, dir) => (state, dispatch) => {
11
+ export const indentBlocks = (actions, command, dir) => (state, dispatch) => {
13
12
  const blocks = blockNodes(state);
14
13
  const tr = state.tr;
15
14
  tr.setMeta('commandName', command);
@@ -45,7 +44,7 @@ const indentBlocks = (actions, command, dir) => (state, dispatch) => {
45
44
  }
46
45
  return result;
47
46
  };
48
- const isIndented = (state, rules, dir) => {
47
+ export const isIndented = (state, rules, dir) => {
49
48
  const blocks = blockNodes(state);
50
49
  let result = false;
51
50
  blocks.forEach(node => {
@@ -60,10 +59,10 @@ const isIndented = (state, rules, dir) => {
60
59
  });
61
60
  return result;
62
61
  };
63
- const canIndentAsListItem = (state, nodeType) => {
62
+ export const canIndentAsListItem = (state, nodeType) => {
64
63
  return sinkListItem(nodeType)(state);
65
64
  };
66
- const canOutdentAsListItem = (state, rules) => {
65
+ export const canOutdentAsListItem = (state, rules) => {
67
66
  const listItem = state.schema.nodes[rules.listsTypes.listItem];
68
67
  const orderedList = state.schema.nodes[rules.listsTypes.orderedList];
69
68
  const bulletList = state.schema.nodes[rules.listsTypes.bulletList];
@@ -71,13 +70,13 @@ const canOutdentAsListItem = (state, rules) => {
71
70
  const isNestedInUL = !!findNthParentNodeOfType(bulletList, 2)(state.selection);
72
71
  return (isNestedInOL || isNestedInUL) && liftListItem(listItem)(state);
73
72
  };
74
- const canBeIndented = (state, rules) => {
73
+ export const canBeIndented = (state, rules) => {
75
74
  const nodes = state.schema.nodes;
76
75
  const listItem = nodes[indentRules.listsTypes.listItem];
77
76
  return ((isIndented(state, rules.nodes) || indentRules.nodes.some(rule => nodes[rule.node] && hasNode(state, nodes[rule.node]))) &&
78
77
  !hasNode(state, listItem));
79
78
  };
80
- const indent = (state, dispatch) => {
79
+ export const indent = (state, dispatch) => {
81
80
  const listItem = state.schema.nodes[indentRules.listsTypes.listItem];
82
81
  const isIndentableBlock = canBeIndented(state, indentRules);
83
82
  if (canIndentAsListItem(state, listItem)) {
@@ -87,7 +86,7 @@ const indent = (state, dispatch) => {
87
86
  indentBlocks(indentRules.nodes)(state, dispatch);
88
87
  }
89
88
  };
90
- const outdent = (state, dispatch) => {
89
+ export const outdent = (state, dispatch) => {
91
90
  const nodes = state.schema.nodes;
92
91
  const listItem = nodes[outdentRules.listsTypes.listItem];
93
92
  const isIndentableBlock = canBeIndented(state, outdentRules);
@@ -101,5 +100,3 @@ const outdent = (state, dispatch) => {
101
100
  indentBlocks(outdentRules.nodes)(state, dispatch);
102
101
  }
103
102
  };
104
-
105
- export { canBeIndented, canIndentAsListItem, canOutdentAsListItem, indent, indentBlocks, isIndented, outdent };
@@ -1,8 +1,7 @@
1
- import { RemoveMarkStep, AddMarkStep } from 'prosemirror-transform';
1
+ import { AddMarkStep, RemoveMarkStep } from 'prosemirror-transform';
2
2
  import { TextSelection } from 'prosemirror-state';
3
- import { changeStylesString, shallowEqual } from './utils.js';
4
- import { markApplies, selectionMarks, styleValue, hasMark, removeMarks, toggleMark } from './mark.js';
5
-
3
+ import { changeStylesString, shallowEqual } from './utils';
4
+ import { markApplies, hasMark, removeMarks, toggleMark, styleValue, selectionMarks } from './mark';
6
5
  const changeStyleFromMark = (marks, toChange) => {
7
6
  const styleMark = marks.find(m => m.type.name === 'style');
8
7
  const elementStyle = styleMark && styleMark.attrs.style;
@@ -10,7 +9,8 @@ const changeStyleFromMark = (marks, toChange) => {
10
9
  };
11
10
  const changeStyleMark = (tr, from, to, attrs, markType) => {
12
11
  const mark = markType.create({ style: attrs.style });
13
- let removed = [], added = [], removing = null, adding = null;
12
+ const removed = [], added = [];
13
+ let removing = null, adding = null;
14
14
  tr.doc.nodesBetween(from, to, (node, pos, parent) => {
15
15
  if (!node.isInline) {
16
16
  return;
@@ -21,7 +21,7 @@ const changeStyleMark = (tr, from, to, attrs, markType) => {
21
21
  const newStyle = changeStyleFromMark(marks, attrs);
22
22
  if (newStyle.changed || attrs.newValue) {
23
23
  const style = newStyle.changed ?
24
- { style: newStyle.style || null } : { style: `${[attrs.style]}: ${attrs.newValue};` };
24
+ { style: newStyle.style || null } : { style: `${attrs.style}: ${attrs.newValue};` };
25
25
  const currentMark = markType.isInSet(marks) ? marks.find(m => m.type.name === 'style') : null;
26
26
  const newMarkAttrs = currentMark ? { ...currentMark.attrs, ...style } : style;
27
27
  const newStyleMark = markType.create(newMarkAttrs);
@@ -56,7 +56,7 @@ const changeStyleMark = (tr, from, to, attrs, markType) => {
56
56
  /**
57
57
  * Used by FontSize and FontName tools for getting their state.
58
58
  */
59
- const getInlineStyles = (state, style) => {
59
+ export const getInlineStyles = (state, style) => {
60
60
  const styleMark = state.schema.marks.style;
61
61
  const marks = styleMark ? selectionMarks(state, styleMark) : [];
62
62
  return marks.map(mark => styleValue(mark, style)).filter(m => m !== null);
@@ -104,7 +104,7 @@ const changeStyle = (markType, attrs) => {
104
104
  /**
105
105
  * Used by bold, italic, ... and link commands.
106
106
  */
107
- const toggleInlineFormat = (options, tr, markAttrs) => (state, dispatch) => {
107
+ export const toggleInlineFormat = (options, tr, markAttrs) => (state, dispatch) => {
108
108
  const marks = state.schema.marks;
109
109
  const { altStyle, altMarks = [], mark } = options;
110
110
  const transaction = tr || state.tr;
@@ -133,7 +133,7 @@ const toggleInlineFormat = (options, tr, markAttrs) => (state, dispatch) => {
133
133
  /**
134
134
  * Used by FontSize, FontName, Color and BackColor commands.
135
135
  */
136
- const applyInlineStyle = (options, command) => (state, dispatch) => {
136
+ export const applyInlineStyle = (options, command) => (state, dispatch) => {
137
137
  const marks = state.schema.marks;
138
138
  const markType = marks.style;
139
139
  const attrs = {
@@ -160,7 +160,7 @@ const applyInlineStyle = (options, command) => (state, dispatch) => {
160
160
  }
161
161
  }
162
162
  else if (attrs.newValue) {
163
- newStyles.style = `${[attrs.style]}: ${attrs.newValue};`;
163
+ newStyles.style = `${attrs.style}: ${attrs.newValue};`;
164
164
  }
165
165
  const newMarkAttrs = currentMark ? { ...currentMark.attrs, ...newStyles } : newStyles;
166
166
  if (Object.keys(newMarkAttrs).some(attrName => newMarkAttrs[attrName] !== null)) {
@@ -173,5 +173,3 @@ const applyInlineStyle = (options, command) => (state, dispatch) => {
173
173
  }
174
174
  return changeStyle(markType, attrs)(state, dispatch, tr);
175
175
  };
176
-
177
- export { applyInlineStyle, getInlineStyles, toggleInlineFormat };