@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
package/dist/es/link.js CHANGED
@@ -1,7 +1,6 @@
1
- import { toggleInlineFormat } from './inline-style.js';
2
- import { hasMark, toggleMark, removeMark, selectionMarks } from './mark.js';
1
+ import { toggleInlineFormat } from './inline-style';
2
+ import { hasMark, toggleMark, removeMark, selectionMarks } from './mark';
3
3
  import { EditorState } from 'prosemirror-state';
4
-
5
4
  const modifyLink = (options, tr) => (state, dispatch) => {
6
5
  const { $cursor, from, to } = state.selection;
7
6
  const markType = state.schema.marks[options.mark];
@@ -37,7 +36,7 @@ const modifyLink = (options, tr) => (state, dispatch) => {
37
36
  dispatch(tr);
38
37
  }
39
38
  };
40
- const removeLink = (options, tr) => (state, dispatch) => {
39
+ export const removeLink = (options, tr) => (state, dispatch) => {
41
40
  const { $cursor } = state.selection;
42
41
  if (!$cursor) {
43
42
  toggleInlineFormat(options, tr)(state, dispatch);
@@ -71,7 +70,7 @@ const getParentMark = (state, markType) => {
71
70
  const marks = selectionMarks(state, markType);
72
71
  return marks.length === 1 && marks[0] ? marks[0] : null;
73
72
  };
74
- const applyLink = ({ mark, attrs }, commandName = 'link') => (state, dispatch) => {
73
+ export const applyLink = ({ mark, attrs }, commandName = 'link') => (state, dispatch) => {
75
74
  const marks = state.schema.marks;
76
75
  const tr = state.tr;
77
76
  if (commandName) {
@@ -86,7 +85,7 @@ const applyLink = ({ mark, attrs }, commandName = 'link') => (state, dispatch) =
86
85
  else {
87
86
  let nextState = state;
88
87
  if (hasMark(state, { mark })) {
89
- removeLink({ mark}, tr)(state, markDispatched);
88
+ removeLink({ mark, attrs }, tr)(state, markDispatched);
90
89
  nextState = EditorState.create({ doc: tr.doc, selection: tr.selection });
91
90
  }
92
91
  if (dispatched) {
@@ -101,5 +100,3 @@ const applyLink = ({ mark, attrs }, commandName = 'link') => (state, dispatch) =
101
100
  }
102
101
  return dispatched;
103
102
  };
104
-
105
- export { applyLink, removeLink };
@@ -1,5 +1,4 @@
1
- import { htmlToFragment, fragmentToHtml } from './source.js';
2
-
1
+ import { fragmentToHtml, htmlToFragment } from './source';
3
2
  const msoListRegExp = /style=['"]?[^'"]*?mso-list:\s*[a-zA-Z]+(\d+)\s[a-zA-Z]+(\d+)\s(\w+)/gi;
4
3
  const extractListLevels = (html) => {
5
4
  html = html.replace(msoListRegExp, (match, list, level) => {
@@ -75,7 +74,7 @@ const listTypes = (p) => {
75
74
  style: guessUnorderedListStyle(trimStartText(innerText(p)))
76
75
  };
77
76
  }
78
- if (/^\s*\w+[\.\)][\u00a0 ]{2,}/.test(html)) {
77
+ if (/^\s*\w+[.)][\u00a0 ]{2,}/.test(html)) {
79
78
  return {
80
79
  tag: 'ol',
81
80
  style: guessOrderedListStyle(trimStartText(innerText(p)))
@@ -83,13 +82,14 @@ const listTypes = (p) => {
83
82
  }
84
83
  };
85
84
  const convertToLi = (p) => {
86
- let content, name = p.nodeName.toLowerCase();
85
+ const name = p.nodeName.toLowerCase();
86
+ let content;
87
87
  if (p.firstChild && p.firstChild.nodeType === Node.COMMENT_NODE) {
88
88
  p.removeChild(p.firstChild);
89
89
  }
90
90
  if (p.childNodes.length === 1) {
91
91
  content = p.firstChild.nodeType === Node.TEXT_NODE ?
92
- innerText(p) : p.firstChild.innerHTML.replace(/^\w+[\.\)]( )+ /, '');
92
+ innerText(p) : p.firstChild.innerHTML.replace(/^\w+[.)]( )+ /, '');
93
93
  }
94
94
  else {
95
95
  p.removeChild(p.firstChild);
@@ -115,7 +115,8 @@ const convertToLi = (p) => {
115
115
  return li;
116
116
  };
117
117
  const toList = (blockNodes) => {
118
- let lastMargin = -1, levels = {}, li, rootMargin, rootIndex, lastRootLi, isLastRootLi, rootList, items, i, p, type, margin, list, listData;
118
+ const levels = {};
119
+ let lastMargin = -1, li, rootMargin, rootIndex, lastRootLi, isLastRootLi, rootList, items, i, p, type, margin, list, listData;
119
120
  for (i = 0; i < blockNodes.length; i++) {
120
121
  p = blockNodes[i];
121
122
  listData = {
@@ -173,12 +174,10 @@ const toList = (blockNodes) => {
173
174
  }
174
175
  }
175
176
  };
176
- const convertMsLists = (html) => {
177
+ export const convertMsLists = (html) => {
177
178
  const container = htmlToFragment(extractListLevels(html));
178
179
  const groups = new Set();
179
180
  mapListsCandidates(container.children, groups);
180
181
  groups.forEach(listsCandidates => toList(listsCandidates));
181
182
  return fragmentToHtml(container);
182
183
  };
183
-
184
- export { convertMsLists };
package/dist/es/lists.js CHANGED
@@ -1,10 +1,9 @@
1
- import { Slice, Fragment, NodeRange } from 'prosemirror-model';
1
+ import { Fragment, Slice, 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 { splitListItem, wrapInList as wrapInList$1 } from 'prosemirror-schema-list';
6
- import { bulletList, orderedList } from './config/list-settings.js';
7
-
5
+ import { wrapInList as pmWrapInList, splitListItem } from 'prosemirror-schema-list';
6
+ import { bulletList as bulletListSettings, orderedList as orderedListSettings } from './config/list-settings';
8
7
  const rootListDepth = (pos, nodes) => {
9
8
  // Get the depth of the nearest ancestor list
10
9
  const { bulletList, orderedList, listItem } = nodes;
@@ -208,21 +207,21 @@ function liftListItems(options) {
208
207
  };
209
208
  }
210
209
  function wrapInList(nodeType, attrs = {}) {
211
- return autoJoin(wrapInList$1(nodeType, attrs), (before, after) => before.type === after.type && before.type === nodeType);
210
+ return autoJoin(pmWrapInList(nodeType, attrs), (before, after) => before.type === after.type && before.type === nodeType);
212
211
  }
213
- const reListStyle = /list\-style\-type:\s?([\w-]+)/;
212
+ const reListStyle = /list-style-type:\s?([\w-]+)/;
214
213
  /**
215
214
  * Extracts list-style-type style from node's attributes.
216
215
  *
217
216
  * @param attrs - The attributes of the list node
218
217
  * @returns The extracted list-style-type.
219
218
  */
220
- const listStyle = (attrs) => {
219
+ export const listStyle = (attrs) => {
221
220
  const styleAttr = attrs.style || '';
222
221
  const execArray = reListStyle.exec(styleAttr);
223
222
  return (execArray && execArray[1]) || '';
224
223
  };
225
- const toggleList = (state, dispatch, view, options, command) => {
224
+ export const toggleList = (state, dispatch, view, options, command) => {
226
225
  const { listType, listAttrs = { style: null } } = options;
227
226
  const { selection } = state;
228
227
  const fromNode = selection.$from.node(selection.$from.depth - 2);
@@ -246,13 +245,13 @@ const toggleList = (state, dispatch, view, options, command) => {
246
245
  return true;
247
246
  }
248
247
  };
249
- function toggleUnorderedList(state, dispatch, view) {
250
- return toggleList(state, dispatch, view, { listType: bulletList.listType, ...bulletList.types });
248
+ export function toggleUnorderedList(state, dispatch, view) {
249
+ return toggleList(state, dispatch, view, { listType: bulletListSettings.listType, ...bulletListSettings.types });
251
250
  }
252
- function toggleOrderedList(state, dispatch, view) {
253
- return toggleList(state, dispatch, view, { listType: orderedList.listType, ...orderedList.types });
251
+ export function toggleOrderedList(state, dispatch, view) {
252
+ return toggleList(state, dispatch, view, { listType: orderedListSettings.listType, ...orderedListSettings.types });
254
253
  }
255
- const splitListItemKeepMarks = (itemType) => (state, dispatch) => {
254
+ export const splitListItemKeepMarks = (itemType) => (state, dispatch) => {
256
255
  // see https://github.com/ProseMirror/prosemirror-commands/blob/master/src/commands.js#L321-L327
257
256
  return splitListItem(itemType)(state, tr => {
258
257
  const marks = state.storedMarks || (state.selection.$to.parentOffset && state.selection.$from.marks());
@@ -262,5 +261,3 @@ const splitListItemKeepMarks = (itemType) => (state, dispatch) => {
262
261
  dispatch(tr);
263
262
  });
264
263
  };
265
-
266
- export { listStyle, splitListItemKeepMarks, toggleList, toggleOrderedList, toggleUnorderedList };
package/dist/es/main.js CHANGED
@@ -1,33 +1,34 @@
1
- export { domToPmDoc, fragmentToHtml, getHtml, hasSameMarkup, htmlToFragment, parseContent, pmDocToFragment, removeComments, setHtml, trimWhitespace } from './source.js';
2
- export { flattenNestedSpans } from './flatten-spans.js';
3
- export { applyInlineStyle, getInlineStyles, toggleInlineFormat } from './inline-style.js';
4
- export { applyLink, removeLink } from './link.js';
5
- export { insertText } from './text.js';
6
- export { insertImage } from './image.js';
7
- export { alignBlocks, isAligned } from './align.js';
8
- export { cleanFormatting } from './cleanFormatting.js';
9
- export { activeNode, blockNodes, changeTextBlock, cleanTextBlockFormatting, formatBlockElements, getBlockFormats, hasNode, parentBlockFormat } from './blockNode.js';
10
- export { cleanMarks, getActiveMarks, getMark, hasMark, removeAllMarks, selectionMarks } from './mark.js';
11
- export { canBeIndented, canIndentAsListItem, canOutdentAsListItem, indent, indentBlocks, isIndented, outdent } from './indent.js';
12
- export { listStyle, toggleList, toggleOrderedList, toggleUnorderedList } from './lists.js';
13
- export { blockquote, liftBlockquote } from './blockquote.js';
14
- export { canInsert, expandSelection, expandToWordWrap, getNodeFromSelection, getSelectionText, indentHtml, insertNode, parentNode, selectedLineTextOnly } from './utils.js';
15
- export { alignCenterRules, alignJustifyRules, alignLeftRules, alignRemoveRules, alignRightRules } from './config/align-rules.js';
16
- export { indentRules, outdentRules } from './config/indent-rules.js';
17
- export { marks, nodes } from './config/schema.js';
18
- export { buildKeymap, buildListKeymap } from './config/keymap.js';
19
- export { bold, italic, link, strikethrough, subscript, superscript, underline } from './config/commands.js';
20
- export { pasteCleanup, removeAttribute, removeTag, replaceImageSourcesFromRtf, sanitize, sanitizeClassAttr, sanitizeStyleAttr } from './paste.js';
21
- export { convertMsLists } from './listConvert.js';
22
- export { find, findAll, findAt, replace, replaceAll } from './find-replace.js';
23
- export { placeholder } from './plugins/placeholder.js';
24
- export { spacesFix } from './plugins/spaces-fix.js';
25
- export { cspFix } from './plugins/csp-fix.js';
26
- export { textHighlight, textHighlightKey } from './plugins/highlight.js';
27
- export { imageResizeKey, imageResizing } from './plugins/image-resize.js';
28
- export { caretColor, caretColorKey } from './plugins/caret-color.js';
29
- export { tableResizing } from './plugins/table-resize/index.js';
30
- export { listMarkersStyles } from './plugins/list-markers-styles.js';
1
+ export { getHtml, setHtml, parseContent, trimWhitespace, htmlToFragment, domToPmDoc, pmDocToFragment, fragmentToHtml, hasSameMarkup, removeComments } from './source';
2
+ export { flattenNestedSpans } from './flatten-spans';
3
+ export { applyInlineStyle, getInlineStyles, toggleInlineFormat } from './inline-style';
4
+ export { applyLink, removeLink } from './link';
5
+ export { insertText } from './text';
6
+ export { insertImage } from './image';
7
+ export { alignBlocks, isAligned } from './align';
8
+ export { cleanFormatting } from './cleanFormatting';
9
+ export { hasNode, activeNode, formatBlockElements, getBlockFormats, parentBlockFormat, changeTextBlock, blockNodes, cleanTextBlockFormatting } from './blockNode';
10
+ export { hasMark, getMark, getActiveMarks, removeAllMarks, cleanMarks, selectionMarks } from './mark';
11
+ export { indent, canIndentAsListItem, outdent, canOutdentAsListItem, isIndented, canBeIndented, indentBlocks } from './indent';
12
+ export { toggleOrderedList, toggleUnorderedList, toggleList, listStyle } from './lists';
13
+ export { blockquote, liftBlockquote } from './blockquote';
14
+ export { getSelectionText, getNodeFromSelection, selectedLineTextOnly, expandSelection, expandToWordWrap, canInsert, parentNode, insertNode, indentHtml } from './utils';
15
+ export { alignLeftRules, alignCenterRules, alignRightRules, alignJustifyRules, alignRemoveRules } from './config/align-rules';
16
+ export { indentRules, outdentRules } from './config/indent-rules';
17
+ export { nodes, marks } from './config/schema';
18
+ export { buildKeymap, buildListKeymap } from './config/keymap';
19
+ export { bold, italic, underline, strikethrough, subscript, superscript, link } from './config/commands';
20
+ export { sanitize, removeTag, pasteCleanup, sanitizeClassAttr, sanitizeStyleAttr, removeAttribute, replaceImageSourcesFromRtf } from './paste';
21
+ export { convertMsLists } from './listConvert';
22
+ export { find, findAt, findAll, replace, replaceAll } from './find-replace';
23
+ export { placeholder } from './plugins/placeholder';
24
+ export { spacesFix } from './plugins/spaces-fix';
25
+ export { cspFix } from './plugins/csp-fix';
26
+ export { textHighlight, textHighlightKey } from './plugins/highlight';
27
+ export { imageResizing, imageResizeKey } from './plugins/image-resize';
28
+ export { caretColor, caretColorKey } from './plugins/caret-color';
29
+ export { tableResizing, tableResizeKey, tableColumnResizeKey, tableRowResizeKey } from './plugins/table-resize';
30
+ export { listMarkersStyles } from './plugins/list-markers-styles';
31
+ // ProseMirror re-exports
31
32
  export * from 'prosemirror-commands';
32
33
  export * from 'prosemirror-dropcursor';
33
34
  export * from 'prosemirror-gapcursor';
@@ -37,8 +38,8 @@ export * from 'prosemirror-keymap';
37
38
  export * from 'prosemirror-model';
38
39
  export * from 'prosemirror-schema-list';
39
40
  export * from 'prosemirror-state';
40
- 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';
41
+ // Fixes an error related to setting over the addRowAfter and addRowBefore exports from the PM tables module
42
+ 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';
41
43
  export * from 'prosemirror-transform';
42
44
  export * from 'prosemirror-view';
43
- export { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, createTable, deleteColumn } from './table.js';
44
- export { tableColumnResizeKey, tableResizeKey, tableRowResizeKey } from './plugins/table-resize/utils.js';
45
+ export { createTable, addRowAfter, addRowBefore, addColumnBefore, addColumnAfter, deleteColumn, pmAddColumnBefore, pmAddColumnAfter, pmAddRowAfter, pmAddRowBefore, pmDeleteColumn } from './table';
package/dist/es/mark.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import { RemoveMarkStep } from 'prosemirror-transform';
2
2
  import { MarkType } from 'prosemirror-model';
3
- import { parseStyle } from './utils.js';
4
-
5
- const markApplies = (doc, ranges, type) => {
3
+ import { parseStyle } from './utils';
4
+ export const markApplies = (doc, ranges, type) => {
6
5
  const loop = i => {
7
6
  const ref = ranges[i];
8
7
  const $from = ref.$from;
@@ -26,7 +25,7 @@ const markApplies = (doc, ranges, type) => {
26
25
  }
27
26
  return false;
28
27
  };
29
- const toggleMark = (markType, attrs, tr) => (state, dispatch) => {
28
+ export const toggleMark = (markType, attrs, tr) => (state, dispatch) => {
30
29
  const { empty, $cursor, ranges } = state.selection;
31
30
  if ((empty && !$cursor) || !markApplies(state.doc, ranges, markType)) {
32
31
  return false;
@@ -60,11 +59,12 @@ const toggleMark = (markType, attrs, tr) => (state, dispatch) => {
60
59
  }
61
60
  return true;
62
61
  };
63
- const removeMark = (tr, from, to, mark) => {
62
+ export const removeMark = (tr, from, to, mark) => {
64
63
  if (mark === void 0) {
65
64
  mark = null;
66
65
  }
67
- let matched = [], step = 0;
66
+ const matched = [];
67
+ let step = 0;
68
68
  tr.doc.nodesBetween(from, to, (node, pos) => {
69
69
  if (!node.isInline) {
70
70
  return;
@@ -88,7 +88,8 @@ const removeMark = (tr, from, to, mark) => {
88
88
  if (toRemove && toRemove.length) {
89
89
  const end = Math.min(pos + node.nodeSize, to);
90
90
  for (let i = 0; i < toRemove.length; i++) {
91
- let style = toRemove[i], found$1 = (void 0);
91
+ const style = toRemove[i];
92
+ let found$1 = (void 0);
92
93
  for (let j = 0; j < matched.length; j++) {
93
94
  const m = matched[j];
94
95
  if (m.step === step - 1 && style.eq(m.style)) {
@@ -108,7 +109,7 @@ const removeMark = (tr, from, to, mark) => {
108
109
  matched.forEach((m) => { return tr.step(new RemoveMarkStep(m.from, m.to, m.style)); });
109
110
  return tr;
110
111
  };
111
- const removeMarks = (marks, state, dispatch, tr) => {
112
+ export const removeMarks = (marks, state, dispatch, tr) => {
112
113
  const { $cursor, ranges } = state.selection;
113
114
  tr = tr || state.tr;
114
115
  if ($cursor) {
@@ -130,7 +131,7 @@ const removeMarks = (marks, state, dispatch, tr) => {
130
131
  return true;
131
132
  };
132
133
  const toArray = (x) => x instanceof Array ? x : [x];
133
- const removeAllMarks = ({ except = [] } = {}) => (state, dispatch) => {
134
+ export const removeAllMarks = ({ except = [] } = {}) => (state, dispatch) => {
134
135
  const tr = state.tr;
135
136
  cleanMarks(tr, { except: toArray(except) });
136
137
  if (tr.docChanged) {
@@ -144,7 +145,7 @@ const removeAllMarks = ({ except = [] } = {}) => (state, dispatch) => {
144
145
  * @example
145
146
  * See `removeAllMarks` or `cleanFormatting` function.
146
147
  */
147
- const cleanMarks = (tr, { except }) => {
148
+ export const cleanMarks = (tr, { except }) => {
148
149
  const { doc, selection } = tr;
149
150
  const schema = doc.type.schema;
150
151
  const { empty, ranges } = selection;
@@ -162,7 +163,7 @@ const cleanMarks = (tr, { except }) => {
162
163
  * Checks if a mark exists in the selection.
163
164
  * Used for checking the state of bold, italic, ... and unlink tools.
164
165
  */
165
- const hasMark = (state, options) => {
166
+ export const hasMark = (state, options) => {
166
167
  const marks = state.schema.marks;
167
168
  const altMarks = (options.altMarks || []).filter(m => marks[m]);
168
169
  const altStyle = options.altStyle;
@@ -184,7 +185,7 @@ const hasMark = (state, options) => {
184
185
  }
185
186
  return Boolean(result);
186
187
  };
187
- const styleValue = (mark, style) => {
188
+ export const styleValue = (mark, style) => {
188
189
  const styleText = (mark && mark.attrs.style) || '';
189
190
  const styles = parseStyle(styleText);
190
191
  const styleNames = Object.keys(styles);
@@ -199,7 +200,7 @@ const styleValue = (mark, style) => {
199
200
  /**
200
201
  * Returns the marks of a specific type for every inline node in the selection.
201
202
  */
202
- const selectionMarks = (state, markType) => {
203
+ export const selectionMarks = (state, markType) => {
203
204
  const { from, $from, to, empty } = state.selection;
204
205
  const marks = [];
205
206
  if (empty) {
@@ -218,7 +219,7 @@ const selectionMarks = (state, markType) => {
218
219
  * Returns the specified mark which wraps the selection.
219
220
  * Used by link tools.
220
221
  */
221
- const getMark = (state, markType) => {
222
+ export const getMark = (state, markType) => {
222
223
  const marks = selectionMarks(state, markType);
223
224
  const filtered = marks.filter(m => Boolean(m));
224
225
  return marks.length === filtered.length ? marks[0] : undefined;
@@ -226,7 +227,7 @@ const getMark = (state, markType) => {
226
227
  /**
227
228
  * **Deprecated.** Use `selectionMarks` function instead.
228
229
  */
229
- const getActiveMarks = (state, markType) => {
230
+ export const getActiveMarks = (state, markType) => {
230
231
  const marks = selectionMarks(state, markType);
231
232
  const filtered = marks.filter(m => Boolean(m));
232
233
  const hasNodesWithoutMarks = marks.length !== filtered.length;
@@ -235,5 +236,3 @@ const getActiveMarks = (state, markType) => {
235
236
  marks: filtered
236
237
  };
237
238
  };
238
-
239
- export { cleanMarks, getActiveMarks, getMark, hasMark, markApplies, removeAllMarks, removeMark, removeMarks, selectionMarks, styleValue, toggleMark };
package/dist/es/paste.js CHANGED
@@ -1,11 +1,10 @@
1
- import { convertMsLists } from './listConvert.js';
2
- import { htmlToFragment, fragmentToHtml } from './source.js';
3
- import { parseStyle } from './utils.js';
4
-
1
+ import { convertMsLists } from './listConvert';
2
+ import { fragmentToHtml, htmlToFragment } from './source';
3
+ import { parseStyle } from './utils';
5
4
  /**
6
5
  * Removes the invalid HTML. Use it as a first step for cleaning the HTML.
7
6
  */
8
- const sanitize = (html) => {
7
+ export const sanitize = (html) => {
9
8
  html = html.replace(/^[\s\S]+?<!--StartFragment-->\s*([\s\S]*?)\s*<!--EndFragment-->[\s\S]+$/, '$1');
10
9
  html = html.replace(/<\/?[ovw]:[^>]*?>/gi, ''); // MS elements, e.g. <o:p>, <w:sdtPr>, <v:
11
10
  html = html.replace(/<\\?\??xml[^>]*>/gi, ''); // XML namespaces
@@ -25,13 +24,13 @@ const sanitize = (html) => {
25
24
  /**
26
25
  * Removes the specified tag(s).
27
26
  */
28
- const removeTag = (html, tagPattern) => {
27
+ export const removeTag = (html, tagPattern) => {
29
28
  return html.replace(new RegExp('<\\/?(' + tagPattern + ')(?:\\s[^>]*?)?>', 'gi'), '');
30
29
  };
31
30
  /**
32
31
  * Removes the passed attribute.
33
32
  */
34
- const removeAttribute = (attr) => {
33
+ export const removeAttribute = (attr) => {
35
34
  if (attr.ownerElement) {
36
35
  attr.ownerElement.removeAttribute(attr.name);
37
36
  }
@@ -39,7 +38,7 @@ const removeAttribute = (attr) => {
39
38
  /**
40
39
  * Remove the attribute if its value matches /^Mso/ regex.
41
40
  */
42
- const sanitizeClassAttr = (attr) => {
41
+ export const sanitizeClassAttr = (attr) => {
43
42
  if (/^Mso/.test(attr.value)) {
44
43
  removeAttribute(attr);
45
44
  }
@@ -47,7 +46,7 @@ const sanitizeClassAttr = (attr) => {
47
46
  /**
48
47
  * Removes invalid HTML styles.
49
48
  */
50
- const sanitizeStyleAttr = (attr) => {
49
+ export const sanitizeStyleAttr = (attr) => {
51
50
  const styles = parseStyle(attr.value);
52
51
  const element = attr.ownerElement;
53
52
  const supportedStyles = element.style;
@@ -94,7 +93,7 @@ const sanitizeNode = (node, attributes) => {
94
93
  * Cleans the HTML based on passed settings.
95
94
  * Before using it, clean the HTML with the `sanitize` function.
96
95
  */
97
- const pasteCleanup = (html, settings) => {
96
+ export const pasteCleanup = (html, settings) => {
98
97
  let result = html;
99
98
  if (settings.convertMsLists) {
100
99
  result = convertMsLists(result);
@@ -132,7 +131,7 @@ const textRtfType = 'text/rtf';
132
131
  * @param clipboardData - The paste event clipboardData object (event.clipboardData).
133
132
  * @returns - The html with the replaced images sources.
134
133
  */
135
- const replaceImageSourcesFromRtf = (html, clipboardData) => {
134
+ export const replaceImageSourcesFromRtf = (html, clipboardData) => {
136
135
  const htmlImages = html.match(reHtmlImg);
137
136
  if (!htmlImages || clipboardData.types.indexOf(textRtfType) === -1) {
138
137
  return html;
@@ -158,5 +157,3 @@ const replaceImageSourcesFromRtf = (html, clipboardData) => {
158
157
  return img.replace(reLocalFile, src);
159
158
  });
160
159
  };
161
-
162
- export { pasteCleanup, removeAttribute, removeTag, replaceImageSourcesFromRtf, sanitize, sanitizeClassAttr, sanitizeStyleAttr };
@@ -1,9 +1,8 @@
1
- import { PluginKey, Plugin } from 'prosemirror-state';
2
- import { DecorationSet, Decoration } from 'prosemirror-view';
3
- import { styleValue } from '../mark.js';
4
-
5
- const caretColorKey = new PluginKey('caret-color');
6
- function caretColor() {
1
+ import { Plugin, PluginKey } from 'prosemirror-state';
2
+ import { Decoration, DecorationSet } from 'prosemirror-view';
3
+ import { styleValue } from './../mark';
4
+ export const caretColorKey = new PluginKey('caret-color');
5
+ export function caretColor() {
7
6
  return new Plugin({
8
7
  key: caretColorKey,
9
8
  props: {
@@ -30,5 +29,3 @@ function caretColor() {
30
29
  }
31
30
  });
32
31
  }
33
-
34
- export { caretColor, caretColorKey };
@@ -1,6 +1,5 @@
1
1
  import { Plugin, PluginKey } from 'prosemirror-state';
2
- import { setAttribute } from '../utils.js';
3
-
2
+ import { setAttribute } from '../utils';
4
3
  const setAttributes = (dom, attrs) => {
5
4
  for (const attrName in attrs) {
6
5
  if (attrName) {
@@ -26,7 +25,7 @@ class StyleView {
26
25
  this.contentDOM = this.dom;
27
26
  }
28
27
  }
29
- const cspFix = () => {
28
+ export const cspFix = () => {
30
29
  return new Plugin({
31
30
  key: new PluginKey('csp-fix'),
32
31
  props: {
@@ -47,5 +46,3 @@ const cspFix = () => {
47
46
  }
48
47
  });
49
48
  };
50
-
51
- export { cspFix };
@@ -1,9 +1,8 @@
1
- import { PluginKey, Plugin } from 'prosemirror-state';
1
+ import { Plugin, PluginKey } from 'prosemirror-state';
2
2
  import { Decoration, DecorationSet } from 'prosemirror-view';
3
-
4
3
  // https://discuss.prosemirror.net/t/passing-data-between-plugins/1843
5
- const textHighlightKey = new PluginKey('highlight');
6
- function textHighlight(key = textHighlightKey) {
4
+ export const textHighlightKey = new PluginKey('highlight');
5
+ export function textHighlight(key = textHighlightKey) {
7
6
  return new Plugin({
8
7
  key,
9
8
  state: {
@@ -19,5 +18,3 @@ function textHighlight(key = textHighlightKey) {
19
18
  }
20
19
  });
21
20
  }
22
-
23
- export { textHighlight, textHighlightKey };
@@ -1,14 +1,13 @@
1
- import { PluginKey, Plugin, NodeSelection } from 'prosemirror-state';
2
- import { DecorationSet, Decoration } from 'prosemirror-view';
3
- import { resizeHandle, dataResizeDirImage } from '../config/constants.js';
4
- import { changeStylesString } from '../utils.js';
5
- import { handles, directions } from './resize-utils.js';
6
-
7
- const imageResizeKey = new PluginKey('image-resize');
1
+ import { NodeSelection, Plugin, PluginKey } from 'prosemirror-state';
2
+ import { Decoration, DecorationSet } from 'prosemirror-view';
3
+ import { dataResizeDirImage, resizeHandle } from '../config/constants';
4
+ import { changeStylesString } from '../utils';
5
+ import { directions, handles } from './resize-utils';
6
+ export const imageResizeKey = new PluginKey('image-resize');
8
7
  const setSize = (domNode, sizeType, value) => {
9
8
  domNode.style[sizeType] = value + 'px';
10
9
  };
11
- const reSize = /[^\-]width:|[^\-]height:/;
10
+ const reSize = /[^-]width:|[^-]height:/;
12
11
  const reAnyValue = /^.+$/;
13
12
  class ResizeState {
14
13
  constructor(activeHandle, dragging, rect, nodePosition) {
@@ -126,7 +125,7 @@ const handleMouseDown = (view, event, options) => {
126
125
  event.view.addEventListener('mousemove', move);
127
126
  return true;
128
127
  };
129
- const imageResizing = (options = { node: 'image', lockRatio: true }) => {
128
+ export const imageResizing = (options = { node: 'image', lockRatio: true }) => {
130
129
  return new Plugin({
131
130
  key: imageResizeKey,
132
131
  view: (viewObj) => ({
@@ -221,5 +220,3 @@ const imageResizing = (options = { node: 'image', lockRatio: true }) => {
221
220
  }
222
221
  });
223
222
  };
224
-
225
- export { imageResizeKey, imageResizing };
@@ -1,7 +1,6 @@
1
1
  import { Plugin, PluginKey } from 'prosemirror-state';
2
2
  import { RemoveMarkStep } from 'prosemirror-transform';
3
- import { applyStyle, parseStyle, parentNode } from '../utils.js';
4
-
3
+ import { parseStyle, applyStyle, parentNode } from '../utils';
5
4
  const inSelection = (from, to, nodePos, node, doc) => {
6
5
  const $from = doc.resolve(from);
7
6
  const $to = doc.resolve(to);
@@ -83,7 +82,7 @@ const DEFAULT_OPTIONS = {
83
82
  /**
84
83
  * Returns a plugin which applies font-size, font-family, color styles to list item marker.
85
84
  */
86
- function listMarkersStyles(options = DEFAULT_OPTIONS) {
85
+ export function listMarkersStyles(options = DEFAULT_OPTIONS) {
87
86
  return new Plugin({
88
87
  key: new PluginKey('list-markers-styles'),
89
88
  appendTransaction: (transactions, _oldState, newState) => {
@@ -103,5 +102,3 @@ function listMarkersStyles(options = DEFAULT_OPTIONS) {
103
102
  }
104
103
  });
105
104
  }
106
-
107
- export { listMarkersStyles };
@@ -1,7 +1,6 @@
1
1
  import { Plugin, PluginKey } from 'prosemirror-state';
2
- import { DecorationSet, Decoration } from 'prosemirror-view';
3
-
4
- function placeholder(message) {
2
+ import { Decoration, DecorationSet } from 'prosemirror-view';
3
+ export function placeholder(message) {
5
4
  const decAttrs = { class: 'k-placeholder', 'data-placeholder': message };
6
5
  return new Plugin({
7
6
  key: new PluginKey('placeholder'),
@@ -23,5 +22,3 @@ function placeholder(message) {
23
22
  }
24
23
  });
25
24
  }
26
-
27
- export { placeholder };
@@ -1,4 +1,4 @@
1
- const directions = {
1
+ export const directions = {
2
2
  'southeast': { x: 1, y: 1 }, // bottom right
3
3
  'east': { x: 1, y: 0 }, // right
4
4
  'south': { x: 0, y: 1 }, // bottom
@@ -8,6 +8,4 @@ const directions = {
8
8
  'northwest': { x: -1, y: -1 }, // top left
9
9
  'northeast': { x: 1, y: -1 } // top right
10
10
  };
11
- const handles = Object.keys(directions);
12
-
13
- export { directions, handles };
11
+ export const handles = Object.keys(directions);
@@ -1,6 +1,5 @@
1
1
  import { Plugin, PluginKey } from 'prosemirror-state';
2
2
  import { Decoration, DecorationSet } from 'prosemirror-view';
3
-
4
3
  // The plugin resolves the following problems:
5
4
  //
6
5
  // 1. white-space: pre-wrap does not work with text-align: justify in firefox
@@ -14,7 +13,7 @@ import { Decoration, DecorationSet } from 'prosemirror-view';
14
13
  const spaces = /\s+/g;
15
14
  const align = /text-align/;
16
15
  const aligned = (node) => align.test((node && node.attrs && node.attrs.style) || '');
17
- const spacesFix = () => new Plugin({
16
+ export const spacesFix = () => new Plugin({
18
17
  key: new PluginKey('spaces-fix'),
19
18
  props: {
20
19
  decorations: (state) => {
@@ -42,5 +41,3 @@ const spacesFix = () => new Plugin({
42
41
  }
43
42
  }
44
43
  });
45
-
46
- export { spacesFix };