@progress/kendo-editor-common 1.12.2-develop.4 → 1.12.2-develop.6

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 +3 -50
  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,16 +1,16 @@
1
- 'use strict';
2
-
3
- var prosemirrorState = require('prosemirror-state');
4
- var prosemirrorView = require('prosemirror-view');
5
- var constants = require('../config/constants.js');
6
- var utils = require('../utils.js');
7
- var resizeUtils = require('./resize-utils.js');
8
-
9
- const imageResizeKey = new prosemirrorState.PluginKey('image-resize');
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.imageResizing = exports.imageResizeKey = void 0;
4
+ const prosemirror_state_1 = require("prosemirror-state");
5
+ const prosemirror_view_1 = require("prosemirror-view");
6
+ const constants_1 = require("../config/constants");
7
+ const utils_1 = require("../utils");
8
+ const resize_utils_1 = require("./resize-utils");
9
+ exports.imageResizeKey = new prosemirror_state_1.PluginKey('image-resize');
10
10
  const setSize = (domNode, sizeType, value) => {
11
11
  domNode.style[sizeType] = value + 'px';
12
12
  };
13
- const reSize = /[^\-]width:|[^\-]height:/;
13
+ const reSize = /[^-]width:|[^-]height:/;
14
14
  const reAnyValue = /^.+$/;
15
15
  class ResizeState {
16
16
  constructor(activeHandle, dragging, rect, nodePosition) {
@@ -20,7 +20,7 @@ class ResizeState {
20
20
  this.nodePosition = nodePosition;
21
21
  }
22
22
  apply(tr) {
23
- const next = tr.getMeta(imageResizeKey);
23
+ const next = tr.getMeta(exports.imageResizeKey);
24
24
  if (next) {
25
25
  return new ResizeState(next.activeHandle, next.setDragging, next.rect, next.nodePosition);
26
26
  }
@@ -28,13 +28,13 @@ class ResizeState {
28
28
  }
29
29
  }
30
30
  const handleMouseMove = (view, event, options) => {
31
- const state = imageResizeKey.getState(view.state);
31
+ const state = exports.imageResizeKey.getState(view.state);
32
32
  const { rect, dragging, nodePosition: nodePosition, activeHandle } = state;
33
33
  if (!dragging || !rect) {
34
34
  return;
35
35
  }
36
36
  const img = view.nodeDOM(nodePosition);
37
- const dir = resizeUtils.directions[activeHandle];
37
+ const dir = resize_utils_1.directions[activeHandle];
38
38
  const diffX = (event.clientX - dragging.startX) * dir.x;
39
39
  const diffY = (event.clientY - dragging.startY) * dir.y;
40
40
  let width = dir.x ? diffX + img.width : rect.width;
@@ -65,17 +65,17 @@ const handleMouseMove = (view, event, options) => {
65
65
  handlesWrapper.style.left = rect.left + 'px';
66
66
  };
67
67
  const handleMouseUp = (view) => {
68
- const { rect, dragging, nodePosition } = imageResizeKey.getState(view.state);
68
+ const { rect, dragging, nodePosition } = exports.imageResizeKey.getState(view.state);
69
69
  if (dragging && rect) {
70
70
  const selection = view.state.selection;
71
- if (selection instanceof prosemirrorState.NodeSelection) {
71
+ if (selection instanceof prosemirror_state_1.NodeSelection) {
72
72
  const currAttrs = selection.node.attrs;
73
73
  const width = rect.width;
74
74
  const height = rect.height;
75
75
  let attrs;
76
76
  if (reSize.test(currAttrs.style || '')) {
77
- const changedWidth = utils.changeStylesString(currAttrs.style, { style: 'width', value: reAnyValue, newValue: width + 'px' });
78
- const { style } = utils.changeStylesString(changedWidth.style || '', { style: 'height', value: reAnyValue, newValue: height + 'px' });
77
+ const changedWidth = (0, utils_1.changeStylesString)(currAttrs.style, { style: 'width', value: reAnyValue, newValue: width + 'px' });
78
+ const { style } = (0, utils_1.changeStylesString)(changedWidth.style || '', { style: 'height', value: reAnyValue, newValue: height + 'px' });
79
79
  attrs = { ...currAttrs, style };
80
80
  }
81
81
  else {
@@ -85,10 +85,10 @@ const handleMouseUp = (view) => {
85
85
  if (newImage) {
86
86
  const tr = view.state.tr;
87
87
  tr.replaceWith(nodePosition, nodePosition + 1, newImage);
88
- tr.setSelection(prosemirrorState.NodeSelection.create(tr.doc, nodePosition));
88
+ tr.setSelection(prosemirror_state_1.NodeSelection.create(tr.doc, nodePosition));
89
89
  tr.setMeta('commandName', 'image-resize');
90
90
  tr.setMeta('args', attrs);
91
- tr.setMeta(imageResizeKey, {
91
+ tr.setMeta(exports.imageResizeKey, {
92
92
  setDragging: null,
93
93
  activeHandle: null,
94
94
  rect,
@@ -101,14 +101,14 @@ const handleMouseUp = (view) => {
101
101
  };
102
102
  const handleMouseDown = (view, event, options) => {
103
103
  const target = event.target;
104
- const activeHandle = target.getAttribute(constants.dataResizeDirImage);
104
+ const activeHandle = target.getAttribute(constants_1.dataResizeDirImage);
105
105
  if (!activeHandle) {
106
106
  return false;
107
107
  }
108
- const resizeState = imageResizeKey.getState(view.state);
108
+ const resizeState = exports.imageResizeKey.getState(view.state);
109
109
  event.preventDefault();
110
110
  const transaction = view.state.tr;
111
- transaction.setMeta(imageResizeKey, {
111
+ transaction.setMeta(exports.imageResizeKey, {
112
112
  setDragging: { startX: event.clientX, startY: event.clientY },
113
113
  activeHandle,
114
114
  rect: resizeState.rect,
@@ -129,11 +129,11 @@ const handleMouseDown = (view, event, options) => {
129
129
  return true;
130
130
  };
131
131
  const imageResizing = (options = { node: 'image', lockRatio: true }) => {
132
- return new prosemirrorState.Plugin({
133
- key: imageResizeKey,
132
+ return new prosemirror_state_1.Plugin({
133
+ key: exports.imageResizeKey,
134
134
  view: (viewObj) => ({
135
135
  resize() {
136
- if (imageResizeKey.getState(viewObj.state).rect) {
136
+ if (exports.imageResizeKey.getState(viewObj.state).rect) {
137
137
  viewObj.dispatch(viewObj.state.tr.setMeta('resize', true));
138
138
  }
139
139
  },
@@ -157,9 +157,9 @@ const imageResizing = (options = { node: 'image', lockRatio: true }) => {
157
157
  const state = view.state;
158
158
  const selection = state.selection;
159
159
  const nodeType = state.schema.nodes[options.node];
160
- const pluginState = imageResizeKey.getState(state);
160
+ const pluginState = exports.imageResizeKey.getState(state);
161
161
  const prevRect = pluginState.rect;
162
- if (selection instanceof prosemirrorState.NodeSelection && nodeType === selection.node.type) {
162
+ if (selection instanceof prosemirror_state_1.NodeSelection && nodeType === selection.node.type) {
163
163
  const img = view.nodeDOM(selection.from);
164
164
  const rect = {
165
165
  top: img.offsetTop,
@@ -171,7 +171,7 @@ const imageResizing = (options = { node: 'image', lockRatio: true }) => {
171
171
  (prevRect && (prevRect.width !== rect.width || prevRect.height !== rect.height ||
172
172
  prevRect.top !== rect.top || prevRect.left !== rect.left))) {
173
173
  const tr = state.tr;
174
- tr.setMeta(imageResizeKey, { rect, nodePosition: selection.from });
174
+ tr.setMeta(exports.imageResizeKey, { rect, nodePosition: selection.from });
175
175
  view.dispatch(tr);
176
176
  this.attachResize();
177
177
  }
@@ -202,27 +202,25 @@ const imageResizing = (options = { node: 'image', lockRatio: true }) => {
202
202
  decorations(state) {
203
203
  const selection = state.selection;
204
204
  const nodeType = state.schema.nodes[options.node];
205
- const rect = imageResizeKey.getState(state).rect;
206
- if (rect && selection instanceof prosemirrorState.NodeSelection && nodeType === selection.node.type) {
205
+ const rect = exports.imageResizeKey.getState(state).rect;
206
+ if (rect && selection instanceof prosemirror_state_1.NodeSelection && nodeType === selection.node.type) {
207
207
  const wrapper = document.createElement('div');
208
208
  wrapper.className = 'k-editor-resize-handles-wrapper';
209
209
  wrapper.style.width = rect.width + 'px';
210
210
  wrapper.style.height = rect.height + 'px';
211
211
  wrapper.style.top = rect.top + 'px';
212
212
  wrapper.style.left = rect.left + 'px';
213
- for (let i = 0; i < resizeUtils.handles.length; i++) {
213
+ for (let i = 0; i < resize_utils_1.handles.length; i++) {
214
214
  const dom = document.createElement('div');
215
- dom.className = constants.resizeHandle + ' ' + resizeUtils.handles[i];
216
- dom.setAttribute(constants.dataResizeDirImage, resizeUtils.handles[i]);
215
+ dom.className = constants_1.resizeHandle + ' ' + resize_utils_1.handles[i];
216
+ dom.setAttribute(constants_1.dataResizeDirImage, resize_utils_1.handles[i]);
217
217
  wrapper.appendChild(dom);
218
218
  }
219
- return prosemirrorView.DecorationSet.create(state.doc, [prosemirrorView.Decoration.widget(state.selection.from + 1, wrapper)]);
219
+ return prosemirror_view_1.DecorationSet.create(state.doc, [prosemirror_view_1.Decoration.widget(state.selection.from + 1, wrapper)]);
220
220
  }
221
- return prosemirrorView.DecorationSet.empty;
221
+ return prosemirror_view_1.DecorationSet.empty;
222
222
  }
223
223
  }
224
224
  });
225
225
  };
226
-
227
- exports.imageResizeKey = imageResizeKey;
228
226
  exports.imageResizing = imageResizing;
@@ -1,6 +1,5 @@
1
1
  import { Plugin } from 'prosemirror-state';
2
-
3
- interface ListMarkersStylesOptions {
2
+ export interface ListMarkersStylesOptions {
4
3
  listItem: string;
5
4
  resetValues: {
6
5
  'font-size': string;
@@ -11,6 +10,4 @@ interface ListMarkersStylesOptions {
11
10
  /**
12
11
  * Returns a plugin which applies font-size, font-family, color styles to list item marker.
13
12
  */
14
- declare function listMarkersStyles(options?: ListMarkersStylesOptions): Plugin;
15
-
16
- export { type ListMarkersStylesOptions, listMarkersStyles };
13
+ export declare function listMarkersStyles(options?: ListMarkersStylesOptions): Plugin;
@@ -1,9 +1,9 @@
1
- 'use strict';
2
-
3
- var prosemirrorState = require('prosemirror-state');
4
- var prosemirrorTransform = require('prosemirror-transform');
5
- var utils = require('../utils.js');
6
-
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listMarkersStyles = listMarkersStyles;
4
+ const prosemirror_state_1 = require("prosemirror-state");
5
+ const prosemirror_transform_1 = require("prosemirror-transform");
6
+ const utils_1 = require("../utils");
7
7
  const inSelection = (from, to, nodePos, node, doc) => {
8
8
  const $from = doc.resolve(from);
9
9
  const $to = doc.resolve(to);
@@ -32,7 +32,7 @@ const applyToListItems = (tr, state, options) => {
32
32
  if ((node.type.name === options.listItem) && inSelection(from, to, pos, node, doc)) {
33
33
  transaction.setNodeMarkup(pos, null, {
34
34
  ...node.attrs,
35
- style: utils.applyStyle(node.attrs.style, args.style, args.value)
35
+ style: (0, utils_1.applyStyle)(node.attrs.style, args.style, args.value)
36
36
  });
37
37
  }
38
38
  });
@@ -44,10 +44,10 @@ const cleanListItems = (tr, state, options) => {
44
44
  doc.nodesBetween(from, to, (node, pos) => {
45
45
  if (node.type.name === options.listItem && inSelection(from, to, pos, node, doc)) {
46
46
  let attrs = node.attrs;
47
- const nodeStyles = utils.parseStyle(node.attrs.style);
47
+ const nodeStyles = (0, utils_1.parseStyle)(node.attrs.style);
48
48
  stylesToClean.forEach(style => {
49
49
  if (nodeStyles[style]) {
50
- attrs = { ...attrs, style: utils.applyStyle(attrs.style, style, '') };
50
+ attrs = { ...attrs, style: (0, utils_1.applyStyle)(attrs.style, style, '') };
51
51
  }
52
52
  });
53
53
  if (attrs !== node.attrs) {
@@ -56,14 +56,14 @@ const cleanListItems = (tr, state, options) => {
56
56
  }
57
57
  });
58
58
  tr.steps.forEach((step) => {
59
- if (step instanceof prosemirrorTransform.RemoveMarkStep) {
59
+ if (step instanceof prosemirror_transform_1.RemoveMarkStep) {
60
60
  const mark = step.mark;
61
61
  if (mark.type.name === 'style' && mark.attrs.style) {
62
62
  const [name] = mark.attrs.style.split(/\s*:\s*/);
63
63
  const $pos = transaction.doc.resolve(step.from);
64
- const li = utils.parentNode($pos, n => n.type.name === options.listItem);
64
+ const li = (0, utils_1.parentNode)($pos, n => n.type.name === options.listItem);
65
65
  if (li) {
66
- const liStyles = utils.parseStyle(li.node.attrs.style);
66
+ const liStyles = (0, utils_1.parseStyle)(li.node.attrs.style);
67
67
  if (liStyles[name] && options.resetValues[name]) {
68
68
  const newMark = mark.type.create({ style: `${name}: ${options.resetValues[name]};` });
69
69
  transaction.addMark(step.from, step.to, newMark);
@@ -86,8 +86,8 @@ const DEFAULT_OPTIONS = {
86
86
  * Returns a plugin which applies font-size, font-family, color styles to list item marker.
87
87
  */
88
88
  function listMarkersStyles(options = DEFAULT_OPTIONS) {
89
- return new prosemirrorState.Plugin({
90
- key: new prosemirrorState.PluginKey('list-markers-styles'),
89
+ return new prosemirror_state_1.Plugin({
90
+ key: new prosemirror_state_1.PluginKey('list-markers-styles'),
91
91
  appendTransaction: (transactions, _oldState, newState) => {
92
92
  const tr = transactions.slice().pop();
93
93
  const commandName = tr.getMeta('commandName');
@@ -105,5 +105,3 @@ function listMarkersStyles(options = DEFAULT_OPTIONS) {
105
105
  }
106
106
  });
107
107
  }
108
-
109
- exports.listMarkersStyles = listMarkersStyles;
@@ -1,5 +1,2 @@
1
1
  import { Plugin } from 'prosemirror-state';
2
-
3
- declare function placeholder(message: string): Plugin;
4
-
5
- export { placeholder };
2
+ export declare function placeholder(message: string): Plugin;
@@ -1,12 +1,12 @@
1
- 'use strict';
2
-
3
- var prosemirrorState = require('prosemirror-state');
4
- var prosemirrorView = require('prosemirror-view');
5
-
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.placeholder = placeholder;
4
+ const prosemirror_state_1 = require("prosemirror-state");
5
+ const prosemirror_view_1 = require("prosemirror-view");
6
6
  function placeholder(message) {
7
7
  const decAttrs = { class: 'k-placeholder', 'data-placeholder': message };
8
- return new prosemirrorState.Plugin({
9
- key: new prosemirrorState.PluginKey('placeholder'),
8
+ return new prosemirror_state_1.Plugin({
9
+ key: new prosemirror_state_1.PluginKey('placeholder'),
10
10
  props: {
11
11
  decorations: (state) => {
12
12
  const { doc } = state;
@@ -14,16 +14,14 @@ function placeholder(message) {
14
14
  const empty = doc.childCount === 0 ||
15
15
  (doc.childCount === 1 && firstChild.inlineContent && firstChild.childCount === 0);
16
16
  if (!empty) {
17
- return prosemirrorView.DecorationSet.empty;
17
+ return prosemirror_view_1.DecorationSet.empty;
18
18
  }
19
19
  const decorations = [];
20
20
  doc.descendants((node, pos) => {
21
- decorations.push(prosemirrorView.Decoration.node(pos, pos + node.nodeSize, decAttrs));
21
+ decorations.push(prosemirror_view_1.Decoration.node(pos, pos + node.nodeSize, decAttrs));
22
22
  });
23
- return prosemirrorView.DecorationSet.create(doc, decorations);
23
+ return prosemirror_view_1.DecorationSet.create(doc, decorations);
24
24
  }
25
25
  }
26
26
  });
27
27
  }
28
-
29
- exports.placeholder = placeholder;
@@ -0,0 +1,35 @@
1
+ export declare const directions: {
2
+ southeast: {
3
+ x: number;
4
+ y: number;
5
+ };
6
+ east: {
7
+ x: number;
8
+ y: number;
9
+ };
10
+ south: {
11
+ x: number;
12
+ y: number;
13
+ };
14
+ north: {
15
+ x: number;
16
+ y: number;
17
+ };
18
+ west: {
19
+ x: number;
20
+ y: number;
21
+ };
22
+ southwest: {
23
+ x: number;
24
+ y: number;
25
+ };
26
+ northwest: {
27
+ x: number;
28
+ y: number;
29
+ };
30
+ northeast: {
31
+ x: number;
32
+ y: number;
33
+ };
34
+ };
35
+ export declare const handles: string[];
@@ -1,6 +1,7 @@
1
- 'use strict';
2
-
3
- const directions = {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handles = exports.directions = void 0;
4
+ exports.directions = {
4
5
  'southeast': { x: 1, y: 1 }, // bottom right
5
6
  'east': { x: 1, y: 0 }, // right
6
7
  'south': { x: 0, y: 1 }, // bottom
@@ -10,7 +11,4 @@ const directions = {
10
11
  'northwest': { x: -1, y: -1 }, // top left
11
12
  'northeast': { x: 1, y: -1 } // top right
12
13
  };
13
- const handles = Object.keys(directions);
14
-
15
- exports.directions = directions;
16
- exports.handles = handles;
14
+ exports.handles = Object.keys(exports.directions);
@@ -1,5 +1,2 @@
1
1
  import { Plugin } from 'prosemirror-state';
2
-
3
- declare const spacesFix: () => Plugin<any>;
4
-
5
- export { spacesFix };
2
+ export declare const spacesFix: () => Plugin<any>;
@@ -1,8 +1,8 @@
1
- 'use strict';
2
-
3
- var prosemirrorState = require('prosemirror-state');
4
- var prosemirrorView = require('prosemirror-view');
5
-
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.spacesFix = void 0;
4
+ const prosemirror_state_1 = require("prosemirror-state");
5
+ const prosemirror_view_1 = require("prosemirror-view");
6
6
  // The plugin resolves the following problems:
7
7
  //
8
8
  // 1. white-space: pre-wrap does not work with text-align: justify in firefox
@@ -16,8 +16,8 @@ var prosemirrorView = require('prosemirror-view');
16
16
  const spaces = /\s+/g;
17
17
  const align = /text-align/;
18
18
  const aligned = (node) => align.test((node && node.attrs && node.attrs.style) || '');
19
- const spacesFix = () => new prosemirrorState.Plugin({
20
- key: new prosemirrorState.PluginKey('spaces-fix'),
19
+ const spacesFix = () => new prosemirror_state_1.Plugin({
20
+ key: new prosemirror_state_1.PluginKey('spaces-fix'),
21
21
  props: {
22
22
  decorations: (state) => {
23
23
  const decorations = [];
@@ -31,7 +31,7 @@ const spacesFix = () => new prosemirrorState.Plugin({
31
31
  length = match[0].length;
32
32
  if (match.index + length < match.input.length) {
33
33
  for (i = 0; i <= length - 1; i += 2) {
34
- decorations.push(prosemirrorView.Decoration.inline(start + i, start + i + 1, {
34
+ decorations.push(prosemirror_view_1.Decoration.inline(start + i, start + i + 1, {
35
35
  style: 'white-space: normal'
36
36
  }));
37
37
  }
@@ -40,9 +40,8 @@ const spacesFix = () => new prosemirrorState.Plugin({
40
40
  }
41
41
  }
42
42
  });
43
- return prosemirrorView.DecorationSet.create(doc, decorations);
43
+ return prosemirror_view_1.DecorationSet.create(doc, decorations);
44
44
  }
45
45
  }
46
46
  });
47
-
48
47
  exports.spacesFix = spacesFix;
@@ -0,0 +1,2 @@
1
+ import { Plugin } from 'prosemirror-state';
2
+ export declare function columnResizing(): Plugin;
@@ -1,17 +1,17 @@
1
- 'use strict';
2
-
3
- var prosemirrorState = require('prosemirror-state');
4
- var prosemirrorTables = require('prosemirror-tables');
5
- var prosemirrorView = require('prosemirror-view');
6
- var constants = require('../../config/constants.js');
7
- var tableView = require('./table-view.js');
8
- var utils$1 = require('../../utils.js');
9
- var utils = require('./utils.js');
10
-
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.columnResizing = columnResizing;
4
+ const prosemirror_state_1 = require("prosemirror-state");
5
+ const prosemirror_tables_1 = require("prosemirror-tables");
6
+ const prosemirror_view_1 = require("prosemirror-view");
7
+ const constants_1 = require("../../config/constants");
8
+ const table_view_1 = require("./table-view");
9
+ const utils_1 = require("./../../utils");
10
+ const utils_2 = require("./utils");
11
11
  function columnResizing() {
12
12
  const handleWidth = 5, cellMinWidth = 25;
13
- const plugin = new prosemirrorState.Plugin({
14
- key: utils.tableColumnResizeKey,
13
+ const plugin = new prosemirror_state_1.Plugin({
14
+ key: utils_2.tableColumnResizeKey,
15
15
  state: {
16
16
  init() {
17
17
  return new ResizeState(-1, null);
@@ -22,15 +22,15 @@ function columnResizing() {
22
22
  },
23
23
  props: {
24
24
  attributes(state) {
25
- if (utils.otherResizeHandle(utils.tableColumnResizeKey, state)) {
25
+ if ((0, utils_2.otherResizeHandle)(utils_2.tableColumnResizeKey, state)) {
26
26
  return null;
27
27
  }
28
- const pluginState = utils.tableColumnResizeKey.getState(state);
28
+ const pluginState = utils_2.tableColumnResizeKey.getState(state);
29
29
  return pluginState.activeHandle > -1 ? { class: 'resize-cursor' } : null;
30
30
  },
31
31
  handleDOMEvents: {
32
32
  mousemove(view, event) {
33
- if (!utils.otherResizing(utils.tableColumnResizeKey, view.state)) {
33
+ if (!(0, utils_2.otherResizing)(utils_2.tableColumnResizeKey, view.state)) {
34
34
  handleMouseMove(view, event, handleWidth);
35
35
  }
36
36
  return false;
@@ -44,17 +44,17 @@ function columnResizing() {
44
44
  }
45
45
  },
46
46
  decorations(state) {
47
- if (!utils.otherResizing(utils.tableColumnResizeKey, state)) {
48
- const pluginState = utils.tableColumnResizeKey.getState(state);
47
+ if (!(0, utils_2.otherResizing)(utils_2.tableColumnResizeKey, state)) {
48
+ const pluginState = utils_2.tableColumnResizeKey.getState(state);
49
49
  if (pluginState.activeHandle > -1) {
50
50
  return handleDecorations(state, pluginState.activeHandle);
51
51
  }
52
52
  }
53
- return prosemirrorView.DecorationSet.empty;
53
+ return prosemirror_view_1.DecorationSet.empty;
54
54
  },
55
55
  nodeViews: {
56
- table_wrapper: (node, view) => new tableView.TableWrapperView(node, view),
57
- table: (node, view) => new tableView.TableView(node, view)
56
+ table_wrapper: (node, view) => new table_view_1.TableWrapperView(node, view),
57
+ table: (node, view) => new table_view_1.TableView(node, view)
58
58
  }
59
59
  }
60
60
  });
@@ -70,7 +70,7 @@ class ResizeState {
70
70
  }
71
71
  apply(tr) {
72
72
  let state;
73
- const action = tr.getMeta(utils.tableColumnResizeKey);
73
+ const action = tr.getMeta(utils_2.tableColumnResizeKey);
74
74
  if (action && action.setHandle != null) {
75
75
  return new ResizeState(action.setHandle, null);
76
76
  }
@@ -88,19 +88,19 @@ class ResizeState {
88
88
  }
89
89
  }
90
90
  function handleMouseMove(view, event, handleWidth) {
91
- const pluginState = utils.tableColumnResizeKey.getState(view.state);
91
+ const pluginState = utils_2.tableColumnResizeKey.getState(view.state);
92
92
  if (!pluginState.dragging) {
93
- const target = utils.domCellAround(event.target);
93
+ const target = (0, utils_2.domCellAround)(event.target);
94
94
  let cell = -1;
95
95
  if (target) {
96
- const indexes = utils.cellIndexes(target);
96
+ const indexes = (0, utils_2.cellIndexes)(target);
97
97
  const { left, right } = target.getBoundingClientRect();
98
98
  if (Math.abs(event.clientX - left) <= handleWidth && indexes.cellIndex > 0) {
99
99
  indexes.cellIndex -= target.colSpan;
100
- cell = utils.edgeCell(view, event, indexes);
100
+ cell = (0, utils_2.edgeCell)(view, event, indexes);
101
101
  }
102
102
  else if (right - event.clientX > 0 && right - event.clientX <= handleWidth) {
103
- cell = utils.edgeCell(view, event, indexes);
103
+ cell = (0, utils_2.edgeCell)(view, event, indexes);
104
104
  }
105
105
  }
106
106
  if (cell !== pluginState.activeHandle) {
@@ -109,13 +109,13 @@ function handleMouseMove(view, event, handleWidth) {
109
109
  }
110
110
  }
111
111
  function handleMouseLeave(view) {
112
- const pluginState = utils.tableColumnResizeKey.getState(view.state);
112
+ const pluginState = utils_2.tableColumnResizeKey.getState(view.state);
113
113
  if (pluginState.activeHandle > -1 && !pluginState.dragging) {
114
114
  updateHandle(view, -1);
115
115
  }
116
116
  }
117
117
  function handleMouseDown(view, event, cellMinWidth) {
118
- const pluginState = utils.tableColumnResizeKey.getState(view.state);
118
+ const pluginState = utils_2.tableColumnResizeKey.getState(view.state);
119
119
  if (pluginState.activeHandle === -1 || pluginState.dragging) {
120
120
  return false;
121
121
  }
@@ -131,7 +131,7 @@ function handleMouseDown(view, event, cellMinWidth) {
131
131
  const domCell = dom.node.childNodes[dom.offset];
132
132
  const tableDom = domCell.closest('table');
133
133
  let col, tableAttrs;
134
- if (tableNode.attrs[constants.colgroupAttr]) {
134
+ if (tableNode.attrs[constants_1.colgroupAttr]) {
135
135
  const colgroup = tableDom.firstChild;
136
136
  col = colgroup.children[colSpan - 1];
137
137
  if (!col.style.width) {
@@ -154,16 +154,16 @@ function handleMouseDown(view, event, cellMinWidth) {
154
154
  col.style.width = col.offsetWidth + 'px';
155
155
  tableAttrs = {
156
156
  ...tableNode.attrs,
157
- [constants.colgroupAttr]: '<colgroup>' + cols.reduce((acc, cur) => acc + cur.outerHTML, '') + '</colgroup>'
157
+ [constants_1.colgroupAttr]: '<colgroup>' + cols.reduce((acc, cur) => acc + cur.outerHTML, '') + '</colgroup>'
158
158
  };
159
159
  }
160
160
  const width = parseFloat(col.style.width);
161
- const tr = view.state.tr.setMeta(utils.tableColumnResizeKey, { setDragging: { startX: event.clientX, startWidth: width } });
161
+ const tr = view.state.tr.setMeta(utils_2.tableColumnResizeKey, { setDragging: { startX: event.clientX, startWidth: width } });
162
162
  if (!tableDom.style.width) {
163
163
  const widths = Array.from(col.parentNode.children).map((c) => c.style.width);
164
164
  if (widths.every(Boolean)) {
165
165
  const sum = widths.reduce((acc, cur) => acc + parseFloat(cur), 0);
166
- tableAttrs = utils$1.setNodeStyle(tableAttrs || tableNode.attrs, 'width', sum + 'px');
166
+ tableAttrs = (0, utils_1.setNodeStyle)(tableAttrs || tableNode.attrs, 'width', sum + 'px');
167
167
  }
168
168
  }
169
169
  if (tableAttrs) {
@@ -174,18 +174,18 @@ function handleMouseDown(view, event, cellMinWidth) {
174
174
  function finish(ev) {
175
175
  ev.view.removeEventListener('mouseup', finish);
176
176
  ev.view.removeEventListener('mousemove', move);
177
- const curPluginState = utils.tableColumnResizeKey.getState(view.state);
177
+ const curPluginState = utils_2.tableColumnResizeKey.getState(view.state);
178
178
  if (curPluginState.dragging) {
179
179
  const transaction = view.state.tr;
180
180
  updateColumnWidth(view, transaction, curPluginState.activeHandle);
181
- view.dispatch(transaction.setMeta(utils.tableColumnResizeKey, { setDragging: null }));
181
+ view.dispatch(transaction.setMeta(utils_2.tableColumnResizeKey, { setDragging: null }));
182
182
  }
183
183
  }
184
184
  function move(ev) {
185
185
  if (!ev.which) {
186
186
  return finish(ev);
187
187
  }
188
- const curPluginState = utils.tableColumnResizeKey.getState(view.state);
188
+ const curPluginState = utils_2.tableColumnResizeKey.getState(view.state);
189
189
  const dragged = draggedWidth(curPluginState.dragging, ev, cellMinWidth);
190
190
  displayColumnWidth(view, curPluginState.activeHandle, dragged);
191
191
  }
@@ -201,7 +201,7 @@ function draggedWidth(dragging, event, cellMinWidth) {
201
201
  function updateHandle(view, value) {
202
202
  const tr = view.state.tr;
203
203
  tr.setMeta('addToHistory', false);
204
- tr.setMeta(utils.tableColumnResizeKey, { setHandle: value });
204
+ tr.setMeta(utils_2.tableColumnResizeKey, { setHandle: value });
205
205
  view.dispatch(tr);
206
206
  }
207
207
  function updateColumnWidth(view, tr, cell) {
@@ -210,20 +210,20 @@ function updateColumnWidth(view, tr, cell) {
210
210
  const tablePos = $cell.posAtIndex(0, $cell.depth - 1) - 1;
211
211
  const tableDom = view.nodeDOM(start).closest('table');
212
212
  let attrs = tableNode.attrs;
213
- if (tableNode && attrs[constants.colgroupAttr]) {
213
+ if (tableNode && attrs[constants_1.colgroupAttr]) {
214
214
  const colgroup = tableDom.firstChild;
215
- attrs = { ...attrs, [constants.colgroupAttr]: colgroup.outerHTML };
215
+ attrs = { ...attrs, [constants_1.colgroupAttr]: colgroup.outerHTML };
216
216
  }
217
217
  const tableDomWidth = tableDom.style.width;
218
- if (tableDom && tableDomWidth && utils$1.parseStyle(attrs.style).width !== tableDomWidth) {
219
- attrs = utils$1.setNodeStyle(attrs, 'width', tableDomWidth);
218
+ if (tableDom && tableDomWidth && (0, utils_1.parseStyle)(attrs.style).width !== tableDomWidth) {
219
+ attrs = (0, utils_1.setNodeStyle)(attrs, 'width', tableDomWidth);
220
220
  }
221
221
  tr.setNodeMarkup(tablePos, null, attrs);
222
222
  }
223
223
  function displayColumnWidth(view, cell, width) {
224
224
  const $cell = view.state.doc.resolve(cell);
225
225
  const table = $cell.node(-1), start = $cell.start(-1);
226
- const col = prosemirrorTables.TableMap.get(table).colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan - 1;
226
+ const col = prosemirror_tables_1.TableMap.get(table).colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan - 1;
227
227
  let dom = view.domAtPos($cell.start(-1)).node;
228
228
  if (dom.nodeName !== 'TABLE') {
229
229
  dom = dom.closest('table');
@@ -243,7 +243,7 @@ function displayColumnWidth(view, cell, width) {
243
243
  function handleDecorations(state, cell) {
244
244
  const decorations = [];
245
245
  const $cell = state.doc.resolve(cell);
246
- const table = $cell.node(-1), map = prosemirrorTables.TableMap.get(table), start = $cell.start(-1);
246
+ const table = $cell.node(-1), map = prosemirror_tables_1.TableMap.get(table), start = $cell.start(-1);
247
247
  const cellsPositions = [];
248
248
  const cellPos = cell - start;
249
249
  let column = -1;
@@ -264,9 +264,7 @@ function handleDecorations(state, cell) {
264
264
  const pos = start + cPos + table.nodeAt(cPos).nodeSize - 1;
265
265
  const dom = document.createElement('div');
266
266
  dom.className = 'column-resize-handle';
267
- decorations.push(prosemirrorView.Decoration.widget(pos, dom));
267
+ decorations.push(prosemirror_view_1.Decoration.widget(pos, dom));
268
268
  }));
269
- return prosemirrorView.DecorationSet.create(state.doc, decorations);
269
+ return prosemirror_view_1.DecorationSet.create(state.doc, decorations);
270
270
  }
271
-
272
- exports.columnResizing = columnResizing;