@progress/kendo-editor-common 1.11.9-dev.202412020819 → 1.11.9-develop.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/dist/cdn/main.js +1 -1
  2. package/dist/es/DOMSerializer.js +71 -75
  3. package/dist/es/align.js +19 -16
  4. package/dist/es/blockNode.js +76 -78
  5. package/dist/es/blockquote.js +12 -9
  6. package/dist/es/cleanFormatting.js +16 -16
  7. package/dist/es/config/align-rules.js +8 -6
  8. package/dist/es/config/commands.js +9 -13
  9. package/dist/es/config/constants.js +9 -7
  10. package/dist/es/config/indent-rules.js +8 -6
  11. package/dist/es/config/keymap.js +20 -18
  12. package/dist/es/config/list-settings.js +7 -6
  13. package/dist/es/config/schema.js +184 -126
  14. package/dist/es/find-replace.js +34 -32
  15. package/dist/es/image.js +10 -7
  16. package/dist/es/indent.js +47 -44
  17. package/dist/es/inline-style.js +72 -70
  18. package/dist/es/link.js +51 -52
  19. package/dist/es/listConvert.js +37 -34
  20. package/dist/es/lists.js +83 -82
  21. package/dist/es/main.js +32 -33
  22. package/dist/es/mark.js +87 -92
  23. package/dist/es/paste.js +48 -46
  24. package/dist/es/plugins/caret-color.js +14 -11
  25. package/dist/es/plugins/csp-fix.js +23 -23
  26. package/dist/es/plugins/highlight.js +12 -10
  27. package/dist/es/plugins/image-resize.js +81 -81
  28. package/dist/es/plugins/list-markers-styles.js +43 -39
  29. package/dist/es/plugins/placeholder.js +12 -9
  30. package/dist/es/plugins/resize-utils.js +11 -9
  31. package/dist/es/plugins/spaces-fix.js +13 -10
  32. package/dist/es/plugins/table-resize/column-resize.js +104 -102
  33. package/dist/es/plugins/table-resize/index.js +10 -7
  34. package/dist/es/plugins/table-resize/row-resize.js +88 -89
  35. package/dist/es/plugins/table-resize/table-resize.js +129 -122
  36. package/dist/es/plugins/table-resize/table-view.js +46 -48
  37. package/dist/es/plugins/table-resize/utils.js +39 -41
  38. package/dist/es/source.js +78 -74
  39. package/dist/es/table.js +64 -66
  40. package/dist/es/text.js +4 -2
  41. package/dist/es/utils.js +107 -116
  42. package/dist/es2015/DOMSerializer.js +20 -17
  43. package/dist/es2015/align.js +6 -3
  44. package/dist/es2015/blockNode.js +15 -12
  45. package/dist/es2015/blockquote.js +5 -2
  46. package/dist/es2015/cleanFormatting.js +6 -3
  47. package/dist/es2015/config/align-rules.js +7 -5
  48. package/dist/es2015/config/commands.js +9 -13
  49. package/dist/es2015/config/constants.js +9 -7
  50. package/dist/es2015/config/indent-rules.js +6 -3
  51. package/dist/es2015/config/keymap.js +10 -7
  52. package/dist/es2015/config/list-settings.js +5 -3
  53. package/dist/es2015/config/schema.js +8 -6
  54. package/dist/es2015/find-replace.js +9 -6
  55. package/dist/es2015/image.js +5 -2
  56. package/dist/es2015/indent.js +14 -11
  57. package/dist/es2015/inline-style.js +9 -6
  58. package/dist/es2015/link.js +7 -4
  59. package/dist/es2015/listConvert.js +5 -2
  60. package/dist/es2015/lists.js +14 -11
  61. package/dist/es2015/main.js +32 -33
  62. package/dist/es2015/mark.js +15 -12
  63. package/dist/es2015/node_modules/tslib/tslib.es6.js +35 -0
  64. package/dist/es2015/paste.js +14 -11
  65. package/dist/es2015/plugins/caret-color.js +8 -5
  66. package/dist/es2015/plugins/csp-fix.js +5 -2
  67. package/dist/es2015/plugins/highlight.js +6 -3
  68. package/dist/es2015/plugins/image-resize.js +10 -7
  69. package/dist/es2015/plugins/list-markers-styles.js +6 -3
  70. package/dist/es2015/plugins/placeholder.js +5 -2
  71. package/dist/es2015/plugins/resize-utils.js +11 -9
  72. package/dist/es2015/plugins/spaces-fix.js +4 -1
  73. package/dist/es2015/plugins/table-resize/column-resize.js +24 -21
  74. package/dist/es2015/plugins/table-resize/index.js +9 -6
  75. package/dist/es2015/plugins/table-resize/row-resize.js +23 -20
  76. package/dist/es2015/plugins/table-resize/table-resize.js +20 -17
  77. package/dist/es2015/plugins/table-resize/table-view.js +9 -6
  78. package/dist/es2015/plugins/table-resize/utils.js +13 -10
  79. package/dist/es2015/source.js +24 -13
  80. package/dist/es2015/table.js +18 -15
  81. package/dist/es2015/text.js +3 -1
  82. package/dist/es2015/utils.js +22 -25
  83. package/dist/npm/DOMSerializer.js +73 -78
  84. package/dist/npm/align.d.ts +7 -4
  85. package/dist/npm/align.js +22 -21
  86. package/dist/npm/blockNode.d.ts +14 -15
  87. package/dist/npm/blockNode.js +91 -95
  88. package/dist/npm/blockquote.d.ts +5 -2
  89. package/dist/npm/blockquote.js +16 -15
  90. package/dist/npm/cleanFormatting.d.ts +6 -3
  91. package/dist/npm/cleanFormatting.js +17 -19
  92. package/dist/npm/config/align-rules.d.ts +8 -6
  93. package/dist/npm/config/align-rules.js +14 -9
  94. package/dist/npm/config/commands.d.ts +11 -19
  95. package/dist/npm/config/commands.js +17 -16
  96. package/dist/npm/config/constants.js +17 -10
  97. package/dist/npm/config/indent-rules.d.ts +6 -4
  98. package/dist/npm/config/indent-rules.js +11 -9
  99. package/dist/npm/config/keymap.d.ts +5 -2
  100. package/dist/npm/config/keymap.js +30 -30
  101. package/dist/npm/config/list-settings.js +13 -11
  102. package/dist/npm/config/schema.d.ts +4 -3
  103. package/dist/npm/config/schema.js +191 -134
  104. package/dist/npm/find-replace.d.ts +10 -7
  105. package/dist/npm/find-replace.js +47 -47
  106. package/dist/npm/image.d.ts +6 -3
  107. package/dist/npm/image.js +11 -10
  108. package/dist/npm/indent.d.ts +12 -9
  109. package/dist/npm/indent.js +68 -67
  110. package/dist/npm/inline-style.d.ts +7 -4
  111. package/dist/npm/inline-style.js +83 -83
  112. package/dist/npm/link.d.ts +4 -2
  113. package/dist/npm/link.js +58 -61
  114. package/dist/npm/listConvert.d.ts +3 -1
  115. package/dist/npm/listConvert.js +40 -39
  116. package/dist/npm/lists.d.ts +9 -9
  117. package/dist/npm/lists.js +94 -95
  118. package/dist/npm/main.d.ts +34 -33
  119. package/dist/npm/main.js +389 -198
  120. package/dist/npm/mark.d.ts +13 -18
  121. package/dist/npm/mark.js +104 -111
  122. package/dist/npm/paste.d.ts +12 -9
  123. package/dist/npm/paste.js +61 -61
  124. package/dist/npm/plugins/caret-color.d.ts +6 -3
  125. package/dist/npm/plugins/caret-color.js +21 -19
  126. package/dist/npm/plugins/csp-fix.d.ts +4 -1
  127. package/dist/npm/plugins/csp-fix.js +28 -30
  128. package/dist/npm/plugins/highlight.d.ts +7 -4
  129. package/dist/npm/plugins/highlight.js +17 -16
  130. package/dist/npm/plugins/image-resize.d.ts +7 -5
  131. package/dist/npm/plugins/image-resize.js +96 -97
  132. package/dist/npm/plugins/list-markers-styles.d.ts +5 -2
  133. package/dist/npm/plugins/list-markers-styles.js +49 -47
  134. package/dist/npm/plugins/placeholder.d.ts +4 -1
  135. package/dist/npm/plugins/placeholder.js +18 -17
  136. package/dist/npm/plugins/resize-utils.js +14 -12
  137. package/dist/npm/plugins/spaces-fix.d.ts +4 -1
  138. package/dist/npm/plugins/spaces-fix.js +19 -18
  139. package/dist/npm/plugins/table-resize/column-resize.js +117 -117
  140. package/dist/npm/plugins/table-resize/index.d.ts +5 -2
  141. package/dist/npm/plugins/table-resize/index.js +16 -15
  142. package/dist/npm/plugins/table-resize/row-resize.js +98 -101
  143. package/dist/npm/plugins/table-resize/table-resize.js +144 -139
  144. package/dist/npm/plugins/table-resize/table-view.js +59 -61
  145. package/dist/npm/plugins/table-resize/utils.d.ts +7 -17
  146. package/dist/npm/plugins/table-resize/utils.js +51 -52
  147. package/dist/npm/source.d.ts +18 -11
  148. package/dist/npm/source.js +94 -91
  149. package/dist/npm/table.d.ts +10 -9
  150. package/dist/npm/table.js +93 -82
  151. package/dist/npm/text.d.ts +6 -3
  152. package/dist/npm/text.js +5 -5
  153. package/dist/npm/types/active-marks.d.ts +4 -1
  154. package/dist/npm/types/command.d.ts +5 -2
  155. package/dist/npm/types/dispatchFn.d.ts +4 -1
  156. package/dist/npm/types/paste-cleanup-settings.d.ts +3 -1
  157. package/dist/npm/utils.d.ts +14 -29
  158. package/dist/npm/utils.js +133 -145
  159. package/package.json +35 -53
  160. package/dist/cdn/js/kendo-editor-common.js +0 -1
  161. package/dist/es/types/active-marks.js +0 -1
  162. package/dist/es/types/command.js +0 -1
  163. package/dist/es/types/dispatchFn.js +0 -1
  164. package/dist/es/types/paste-cleanup-settings.js +0 -1
  165. package/dist/es/types/predicate.js +0 -1
  166. package/dist/es2015/types/active-marks.js +0 -1
  167. package/dist/es2015/types/command.js +0 -1
  168. package/dist/es2015/types/dispatchFn.js +0 -1
  169. package/dist/es2015/types/paste-cleanup-settings.js +0 -1
  170. package/dist/es2015/types/predicate.js +0 -1
  171. package/dist/npm/DOMSerializer.d.ts +0 -35
  172. package/dist/npm/config/constants.d.ts +0 -7
  173. package/dist/npm/config/list-settings.d.ts +0 -30
  174. package/dist/npm/plugins/resize-utils.d.ts +0 -35
  175. package/dist/npm/plugins/table-resize/column-resize.d.ts +0 -2
  176. package/dist/npm/plugins/table-resize/row-resize.d.ts +0 -2
  177. package/dist/npm/plugins/table-resize/table-resize.d.ts +0 -18
  178. package/dist/npm/plugins/table-resize/table-view.d.ts +0 -28
  179. package/dist/npm/types/active-marks.js +0 -2
  180. package/dist/npm/types/command.js +0 -2
  181. package/dist/npm/types/dispatchFn.js +0 -2
  182. package/dist/npm/types/paste-cleanup-settings.js +0 -2
  183. package/dist/npm/types/predicate.d.ts +0 -1
  184. package/dist/npm/types/predicate.js +0 -2
  185. package/dist/systemjs/kendo-editor-common.js +0 -1
@@ -1,47 +1,46 @@
1
- import { __assign } from "tslib";
2
- import { NodeSelection, Plugin, PluginKey } from 'prosemirror-state';
3
- import { Decoration, DecorationSet } from 'prosemirror-view';
4
- import { dataResizeDirImage, resizeHandle } from '../config/constants';
5
- import { changeStylesString } from '../utils';
6
- import { directions, handles } from './resize-utils';
7
- export var imageResizeKey = new PluginKey('image-resize');
8
- var setSize = function (domNode, sizeType, value) {
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');
8
+ const setSize = (domNode, sizeType, value) => {
9
9
  domNode.style[sizeType] = value + 'px';
10
10
  };
11
- var reSize = /[^\-]width:|[^\-]height:/;
12
- var reAnyValue = /^.+$/;
13
- var ResizeState = /** @class */ (function () {
14
- function ResizeState(activeHandle, dragging, rect, nodePosition) {
11
+ const reSize = /[^\-]width:|[^\-]height:/;
12
+ const reAnyValue = /^.+$/;
13
+ class ResizeState {
14
+ constructor(activeHandle, dragging, rect, nodePosition) {
15
15
  this.activeHandle = activeHandle;
16
16
  this.dragging = dragging;
17
17
  this.rect = rect;
18
18
  this.nodePosition = nodePosition;
19
19
  }
20
- ResizeState.prototype.apply = function (tr) {
21
- var next = tr.getMeta(imageResizeKey);
20
+ apply(tr) {
21
+ const next = tr.getMeta(imageResizeKey);
22
22
  if (next) {
23
23
  return new ResizeState(next.activeHandle, next.setDragging, next.rect, next.nodePosition);
24
24
  }
25
25
  return this;
26
- };
27
- return ResizeState;
28
- }());
29
- var handleMouseMove = function (view, event, options) {
30
- var state = imageResizeKey.getState(view.state);
31
- var rect = state.rect, dragging = state.dragging, nodePosition = state.nodePosition, activeHandle = state.activeHandle;
26
+ }
27
+ }
28
+ const handleMouseMove = (view, event, options) => {
29
+ const state = imageResizeKey.getState(view.state);
30
+ const { rect, dragging, nodePosition: nodePosition, activeHandle } = state;
32
31
  if (!dragging || !rect) {
33
32
  return;
34
33
  }
35
- var img = view.nodeDOM(nodePosition);
36
- var dir = directions[activeHandle];
37
- var diffX = (event.clientX - dragging.startX) * dir.x;
38
- var diffY = (event.clientY - dragging.startY) * dir.y;
39
- var width = dir.x ? diffX + img.width : rect.width;
40
- var height = dir.y ? diffY + img.height : rect.height;
34
+ const img = view.nodeDOM(nodePosition);
35
+ const dir = directions[activeHandle];
36
+ const diffX = (event.clientX - dragging.startX) * dir.x;
37
+ const diffY = (event.clientY - dragging.startY) * dir.y;
38
+ let width = dir.x ? diffX + img.width : rect.width;
39
+ let height = dir.y ? diffY + img.height : rect.height;
41
40
  if (options.lockRatio && dir.x && dir.y) {
42
- var ratio = Math.min(width / img.width, height / img.height);
43
- var lockWidth = img.width * ratio;
44
- var lockHeight = img.height * ratio;
41
+ const ratio = Math.min(width / img.width, height / img.height);
42
+ const lockWidth = img.width * ratio;
43
+ const lockHeight = img.height * ratio;
45
44
  dragging.startX = event.clientX - (width - lockWidth) * dir.x;
46
45
  dragging.startY = event.clientY - (height - lockHeight) * dir.y;
47
46
  width = lockWidth;
@@ -57,32 +56,32 @@ var handleMouseMove = function (view, event, options) {
57
56
  rect.left = img.offsetLeft;
58
57
  rect.width = img.offsetWidth;
59
58
  rect.height = img.offsetHeight;
60
- var handlesWrapper = img.nextElementSibling;
59
+ const handlesWrapper = img.nextElementSibling;
61
60
  handlesWrapper.style.width = rect.width + 'px';
62
61
  handlesWrapper.style.height = rect.height + 'px';
63
62
  handlesWrapper.style.top = rect.top + 'px';
64
63
  handlesWrapper.style.left = rect.left + 'px';
65
64
  };
66
- var handleMouseUp = function (view) {
67
- var _a = imageResizeKey.getState(view.state), rect = _a.rect, dragging = _a.dragging, nodePosition = _a.nodePosition;
65
+ const handleMouseUp = (view) => {
66
+ const { rect, dragging, nodePosition } = imageResizeKey.getState(view.state);
68
67
  if (dragging && rect) {
69
- var selection = view.state.selection;
68
+ const selection = view.state.selection;
70
69
  if (selection instanceof NodeSelection) {
71
- var currAttrs = selection.node.attrs;
72
- var width = rect.width;
73
- var height = rect.height;
74
- var attrs = void 0;
70
+ const currAttrs = selection.node.attrs;
71
+ const width = rect.width;
72
+ const height = rect.height;
73
+ let attrs;
75
74
  if (reSize.test(currAttrs.style || '')) {
76
- var changedWidth = changeStylesString(currAttrs.style, { style: 'width', value: reAnyValue, newValue: width + 'px' });
77
- var style = changeStylesString(changedWidth.style || '', { style: 'height', value: reAnyValue, newValue: height + 'px' }).style;
78
- attrs = __assign(__assign({}, currAttrs), { style: style });
75
+ const changedWidth = changeStylesString(currAttrs.style, { style: 'width', value: reAnyValue, newValue: width + 'px' });
76
+ const { style } = changeStylesString(changedWidth.style || '', { style: 'height', value: reAnyValue, newValue: height + 'px' });
77
+ attrs = { ...currAttrs, style };
79
78
  }
80
79
  else {
81
- attrs = __assign(__assign({}, currAttrs), { width: width, height: height });
80
+ attrs = { ...currAttrs, width, height };
82
81
  }
83
- var newImage = selection.node.type.createAndFill(attrs);
82
+ const newImage = selection.node.type.createAndFill(attrs);
84
83
  if (newImage) {
85
- var tr = view.state.tr;
84
+ const tr = view.state.tr;
86
85
  tr.replaceWith(nodePosition, nodePosition + 1, newImage);
87
86
  tr.setSelection(NodeSelection.create(tr.doc, nodePosition));
88
87
  tr.setMeta('commandName', 'image-resize');
@@ -90,26 +89,26 @@ var handleMouseUp = function (view) {
90
89
  tr.setMeta(imageResizeKey, {
91
90
  setDragging: null,
92
91
  activeHandle: null,
93
- rect: rect,
94
- nodePosition: nodePosition
92
+ rect,
93
+ nodePosition
95
94
  });
96
95
  view.dispatch(tr);
97
96
  }
98
97
  }
99
98
  }
100
99
  };
101
- var handleMouseDown = function (view, event, options) {
102
- var target = event.target;
103
- var activeHandle = target.getAttribute(dataResizeDirImage);
100
+ const handleMouseDown = (view, event, options) => {
101
+ const target = event.target;
102
+ const activeHandle = target.getAttribute(dataResizeDirImage);
104
103
  if (!activeHandle) {
105
104
  return false;
106
105
  }
107
- var resizeState = imageResizeKey.getState(view.state);
106
+ const resizeState = imageResizeKey.getState(view.state);
108
107
  event.preventDefault();
109
- var transaction = view.state.tr;
108
+ const transaction = view.state.tr;
110
109
  transaction.setMeta(imageResizeKey, {
111
110
  setDragging: { startX: event.clientX, startY: event.clientY },
112
- activeHandle: activeHandle,
111
+ activeHandle,
113
112
  rect: resizeState.rect,
114
113
  nodePosition: resizeState.nodePosition
115
114
  });
@@ -127,12 +126,11 @@ var handleMouseDown = function (view, event, options) {
127
126
  event.view.addEventListener('mousemove', move);
128
127
  return true;
129
128
  };
130
- export var imageResizing = function (options) {
131
- if (options === void 0) { options = { node: 'image', lockRatio: true }; }
129
+ const imageResizing = (options = { node: 'image', lockRatio: true }) => {
132
130
  return new Plugin({
133
131
  key: imageResizeKey,
134
- view: function (viewObj) { return ({
135
- resize: function () {
132
+ view: (viewObj) => ({
133
+ resize() {
136
134
  if (imageResizeKey.getState(viewObj.state).rect) {
137
135
  viewObj.dispatch(viewObj.state.tr.setMeta('resize', true));
138
136
  }
@@ -140,28 +138,28 @@ export var imageResizing = function (options) {
140
138
  get window() {
141
139
  return viewObj.dom.ownerDocument && viewObj.dom.ownerDocument.defaultView;
142
140
  },
143
- attachResize: function () {
144
- var win = this.window;
141
+ attachResize() {
142
+ const win = this.window;
145
143
  if (win) {
146
144
  win.removeEventListener('resize', this.resize);
147
145
  win.addEventListener('resize', this.resize);
148
146
  }
149
147
  },
150
- removeResize: function () {
151
- var win = this.window;
148
+ removeResize() {
149
+ const win = this.window;
152
150
  if (win) {
153
151
  win.removeEventListener('resize', this.resize);
154
152
  }
155
153
  },
156
- update: function (view, prevState) {
157
- var state = view.state;
158
- var selection = state.selection;
159
- var nodeType = state.schema.nodes[options.node];
160
- var pluginState = imageResizeKey.getState(state);
161
- var prevRect = pluginState.rect;
154
+ update(view, prevState) {
155
+ const state = view.state;
156
+ const selection = state.selection;
157
+ const nodeType = state.schema.nodes[options.node];
158
+ const pluginState = imageResizeKey.getState(state);
159
+ const prevRect = pluginState.rect;
162
160
  if (selection instanceof NodeSelection && nodeType === selection.node.type) {
163
- var img = view.nodeDOM(selection.from);
164
- var rect = {
161
+ const img = view.nodeDOM(selection.from);
162
+ const rect = {
165
163
  top: img.offsetTop,
166
164
  left: img.offsetLeft,
167
165
  width: img.offsetWidth,
@@ -170,8 +168,8 @@ export var imageResizing = function (options) {
170
168
  if (!prevState.selection.eq(selection) ||
171
169
  (prevRect && (prevRect.width !== rect.width || prevRect.height !== rect.height ||
172
170
  prevRect.top !== rect.top || prevRect.left !== rect.left))) {
173
- var tr = state.tr;
174
- tr.setMeta(imageResizeKey, { rect: rect, nodePosition: selection.from });
171
+ const tr = state.tr;
172
+ tr.setMeta(imageResizeKey, { rect, nodePosition: selection.from });
175
173
  view.dispatch(tr);
176
174
  this.attachResize();
177
175
  }
@@ -181,37 +179,37 @@ export var imageResizing = function (options) {
181
179
  pluginState.nodePosition = -1;
182
180
  }
183
181
  },
184
- destroy: function () {
182
+ destroy() {
185
183
  this.removeResize();
186
184
  }
187
- }); },
185
+ }),
188
186
  state: {
189
- init: function () {
187
+ init() {
190
188
  return new ResizeState('', null, null, -1);
191
189
  },
192
- apply: function (tr, prev) {
190
+ apply(tr, prev) {
193
191
  return prev.apply(tr);
194
192
  }
195
193
  },
196
194
  props: {
197
195
  handleDOMEvents: {
198
- mousedown: function (view, event) {
196
+ mousedown(view, event) {
199
197
  return handleMouseDown(view, event, options);
200
198
  }
201
199
  },
202
- decorations: function (state) {
203
- var selection = state.selection;
204
- var nodeType = state.schema.nodes[options.node];
205
- var rect = imageResizeKey.getState(state).rect;
200
+ decorations(state) {
201
+ const selection = state.selection;
202
+ const nodeType = state.schema.nodes[options.node];
203
+ const rect = imageResizeKey.getState(state).rect;
206
204
  if (rect && selection instanceof NodeSelection && nodeType === selection.node.type) {
207
- var wrapper = document.createElement('div');
205
+ const wrapper = document.createElement('div');
208
206
  wrapper.className = 'k-editor-resize-handles-wrapper';
209
207
  wrapper.style.width = rect.width + 'px';
210
208
  wrapper.style.height = rect.height + 'px';
211
209
  wrapper.style.top = rect.top + 'px';
212
210
  wrapper.style.left = rect.left + 'px';
213
- for (var i = 0; i < handles.length; i++) {
214
- var dom = document.createElement('div');
211
+ for (let i = 0; i < handles.length; i++) {
212
+ const dom = document.createElement('div');
215
213
  dom.className = resizeHandle + ' ' + handles[i];
216
214
  dom.setAttribute(dataResizeDirImage, handles[i]);
217
215
  wrapper.appendChild(dom);
@@ -223,3 +221,5 @@ export var imageResizing = function (options) {
223
221
  }
224
222
  });
225
223
  };
224
+
225
+ export { imageResizeKey, imageResizing };
@@ -1,12 +1,12 @@
1
- import { __assign } from "tslib";
2
1
  import { Plugin, PluginKey } from 'prosemirror-state';
3
2
  import { RemoveMarkStep } from 'prosemirror-transform';
4
- import { parseStyle, applyStyle, parentNode } from '../utils';
5
- var inSelection = function (from, to, nodePos, node, doc) {
6
- var $from = doc.resolve(from);
7
- var $to = doc.resolve(to);
8
- var nodeName = node.type.name;
9
- var wrapper, parentLi;
3
+ import { applyStyle, parseStyle, parentNode } from '../utils.js';
4
+
5
+ const inSelection = (from, to, nodePos, node, doc) => {
6
+ const $from = doc.resolve(from);
7
+ const $to = doc.resolve(to);
8
+ const nodeName = node.type.name;
9
+ let wrapper, parentLi;
10
10
  if (!$from.nodeBefore) {
11
11
  wrapper = $from.node($from.depth);
12
12
  parentLi = $from.node($from.depth - 1);
@@ -23,44 +23,47 @@ var inSelection = function (from, to, nodePos, node, doc) {
23
23
  }
24
24
  return from <= nodePos && nodePos + node.content.size <= to;
25
25
  };
26
- var applyToListItems = function (tr, state, options) {
27
- var transaction = state.tr, doc = state.doc, _a = state.selection, from = _a.from, to = _a.to;
28
- var args = tr.getMeta('args');
29
- doc.nodesBetween(from, to, function (node, pos) {
26
+ const applyToListItems = (tr, state, options) => {
27
+ const { tr: transaction, doc, selection: { from, to } } = state;
28
+ const args = tr.getMeta('args');
29
+ doc.nodesBetween(from, to, (node, pos) => {
30
30
  if ((node.type.name === options.listItem) && inSelection(from, to, pos, node, doc)) {
31
- transaction.setNodeMarkup(pos, null, __assign(__assign({}, node.attrs), { style: applyStyle(node.attrs.style, args.style, args.value) }));
31
+ transaction.setNodeMarkup(pos, null, {
32
+ ...node.attrs,
33
+ style: applyStyle(node.attrs.style, args.style, args.value)
34
+ });
32
35
  }
33
36
  });
34
37
  return transaction.docChanged ? transaction : undefined;
35
38
  };
36
- var cleanListItems = function (tr, state, options) {
37
- var stylesToClean = Object.keys(options.resetValues);
38
- var transaction = state.tr, doc = state.doc, _a = state.selection, from = _a.from, to = _a.to;
39
- doc.nodesBetween(from, to, function (node, pos) {
39
+ const cleanListItems = (tr, state, options) => {
40
+ const stylesToClean = Object.keys(options.resetValues);
41
+ const { tr: transaction, doc, selection: { from, to } } = state;
42
+ doc.nodesBetween(from, to, (node, pos) => {
40
43
  if (node.type.name === options.listItem && inSelection(from, to, pos, node, doc)) {
41
- var attrs_1 = node.attrs;
42
- var nodeStyles_1 = parseStyle(node.attrs.style);
43
- stylesToClean.forEach(function (style) {
44
- if (nodeStyles_1[style]) {
45
- attrs_1 = __assign(__assign({}, attrs_1), { style: applyStyle(attrs_1.style, style, '') });
44
+ let attrs = node.attrs;
45
+ const nodeStyles = parseStyle(node.attrs.style);
46
+ stylesToClean.forEach(style => {
47
+ if (nodeStyles[style]) {
48
+ attrs = { ...attrs, style: applyStyle(attrs.style, style, '') };
46
49
  }
47
50
  });
48
- if (attrs_1 !== node.attrs) {
49
- transaction.setNodeMarkup(pos, null, attrs_1);
51
+ if (attrs !== node.attrs) {
52
+ transaction.setNodeMarkup(pos, null, attrs);
50
53
  }
51
54
  }
52
55
  });
53
- tr.steps.forEach(function (step) {
56
+ tr.steps.forEach((step) => {
54
57
  if (step instanceof RemoveMarkStep) {
55
- var mark = step.mark;
58
+ const mark = step.mark;
56
59
  if (mark.type.name === 'style' && mark.attrs.style) {
57
- var name_1 = mark.attrs.style.split(/\s*:\s*/)[0];
58
- var $pos = transaction.doc.resolve(step.from);
59
- var li = parentNode($pos, function (n) { return n.type.name === options.listItem; });
60
+ const [name] = mark.attrs.style.split(/\s*:\s*/);
61
+ const $pos = transaction.doc.resolve(step.from);
62
+ const li = parentNode($pos, n => n.type.name === options.listItem);
60
63
  if (li) {
61
- var liStyles = parseStyle(li.node.attrs.style);
62
- if (liStyles[name_1] && options.resetValues[name_1]) {
63
- var newMark = mark.type.create({ style: "".concat(name_1, ": ").concat(options.resetValues[name_1], ";") });
64
+ const liStyles = parseStyle(li.node.attrs.style);
65
+ if (liStyles[name] && options.resetValues[name]) {
66
+ const newMark = mark.type.create({ style: `${name}: ${options.resetValues[name]};` });
64
67
  transaction.addMark(step.from, step.to, newMark);
65
68
  }
66
69
  }
@@ -69,10 +72,10 @@ var cleanListItems = function (tr, state, options) {
69
72
  });
70
73
  return transaction.docChanged ? transaction : undefined;
71
74
  };
72
- var DEFAULT_OPTIONS = {
75
+ const DEFAULT_OPTIONS = {
73
76
  listItem: 'list_item',
74
77
  resetValues: {
75
- 'font-size': '',
78
+ 'font-size': '', // 'initial' or '16px'
76
79
  'font-family': '',
77
80
  'color': ''
78
81
  }
@@ -80,14 +83,13 @@ var DEFAULT_OPTIONS = {
80
83
  /**
81
84
  * Returns a plugin which applies font-size, font-family, color styles to list item marker.
82
85
  */
83
- export function listMarkersStyles(options) {
84
- if (options === void 0) { options = DEFAULT_OPTIONS; }
86
+ function listMarkersStyles(options = DEFAULT_OPTIONS) {
85
87
  return new Plugin({
86
88
  key: new PluginKey('list-markers-styles'),
87
- appendTransaction: function (transactions, _oldState, newState) {
88
- var tr = transactions.slice().pop();
89
- var commandName = tr.getMeta('commandName');
90
- var transaction;
89
+ appendTransaction: (transactions, _oldState, newState) => {
90
+ const tr = transactions.slice().pop();
91
+ const commandName = tr.getMeta('commandName');
92
+ let transaction;
91
93
  if (commandName === 'FontSize' || commandName === 'FontName' || commandName === 'ForeColor') {
92
94
  transaction = applyToListItems(tr, newState, options);
93
95
  }
@@ -101,3 +103,5 @@ export function listMarkersStyles(options) {
101
103
  }
102
104
  });
103
105
  }
106
+
107
+ export { listMarkersStyles };
@@ -1,20 +1,21 @@
1
1
  import { Plugin, PluginKey } from 'prosemirror-state';
2
- import { Decoration, DecorationSet } from 'prosemirror-view';
3
- export function placeholder(message) {
4
- var decAttrs = { class: 'k-placeholder', 'data-placeholder': message };
2
+ import { DecorationSet, Decoration } from 'prosemirror-view';
3
+
4
+ function placeholder(message) {
5
+ const decAttrs = { class: 'k-placeholder', 'data-placeholder': message };
5
6
  return new Plugin({
6
7
  key: new PluginKey('placeholder'),
7
8
  props: {
8
- decorations: function (state) {
9
- var doc = state.doc;
10
- var firstChild = doc.content.firstChild;
11
- var empty = doc.childCount === 0 ||
9
+ decorations: (state) => {
10
+ const { doc } = state;
11
+ const firstChild = doc.content.firstChild;
12
+ const empty = doc.childCount === 0 ||
12
13
  (doc.childCount === 1 && firstChild.inlineContent && firstChild.childCount === 0);
13
14
  if (!empty) {
14
15
  return DecorationSet.empty;
15
16
  }
16
- var decorations = [];
17
- doc.descendants(function (node, pos) {
17
+ const decorations = [];
18
+ doc.descendants((node, pos) => {
18
19
  decorations.push(Decoration.node(pos, pos + node.nodeSize, decAttrs));
19
20
  });
20
21
  return DecorationSet.create(doc, decorations);
@@ -22,3 +23,5 @@ export function placeholder(message) {
22
23
  }
23
24
  });
24
25
  }
26
+
27
+ export { placeholder };
@@ -1,11 +1,13 @@
1
- export var directions = {
2
- 'southeast': { x: 1, y: 1 },
3
- 'east': { x: 1, y: 0 },
4
- 'south': { x: 0, y: 1 },
5
- 'north': { x: 0, y: -1 },
6
- 'west': { x: -1, y: 0 },
7
- 'southwest': { x: -1, y: 1 },
8
- 'northwest': { x: -1, y: -1 },
1
+ const directions = {
2
+ 'southeast': { x: 1, y: 1 }, // bottom right
3
+ 'east': { x: 1, y: 0 }, // right
4
+ 'south': { x: 0, y: 1 }, // bottom
5
+ 'north': { x: 0, y: -1 }, // top
6
+ 'west': { x: -1, y: 0 }, // left
7
+ 'southwest': { x: -1, y: 1 }, // bottom left
8
+ 'northwest': { x: -1, y: -1 }, // top left
9
9
  'northeast': { x: 1, y: -1 } // top right
10
10
  };
11
- export var handles = Object.keys(directions);
11
+ const handles = Object.keys(directions);
12
+
13
+ export { directions, handles };
@@ -1,5 +1,6 @@
1
1
  import { Plugin, PluginKey } from 'prosemirror-state';
2
2
  import { Decoration, DecorationSet } from 'prosemirror-view';
3
+
3
4
  // The plugin resolves the following problems:
4
5
  //
5
6
  // 1. white-space: pre-wrap does not work with text-align: justify in firefox
@@ -10,17 +11,17 @@ import { Decoration, DecorationSet } from 'prosemirror-view';
10
11
  // Additional info here:
11
12
  // https://github.com/ProseMirror/prosemirror/issues/651
12
13
  // https://github.com/ProseMirror/prosemirror/issues/857
13
- var spaces = /\s+/g;
14
- var align = /text-align/;
15
- var aligned = function (node) { return align.test((node && node.attrs && node.attrs.style) || ''); };
16
- export var spacesFix = function () { return new Plugin({
14
+ const spaces = /\s+/g;
15
+ const align = /text-align/;
16
+ const aligned = (node) => align.test((node && node.attrs && node.attrs.style) || '');
17
+ const spacesFix = () => new Plugin({
17
18
  key: new PluginKey('spaces-fix'),
18
19
  props: {
19
- decorations: function (state) {
20
- var decorations = [];
21
- var doc = state.doc;
22
- var start, match, length, i;
23
- doc.nodesBetween(0, doc.content.size, function (node, position, parent) {
20
+ decorations: (state) => {
21
+ const decorations = [];
22
+ const doc = state.doc;
23
+ let start, match, length, i;
24
+ doc.nodesBetween(0, doc.content.size, (node, position, parent) => {
24
25
  if (node.type.isText && aligned(parent)) {
25
26
  match = spaces.exec(node.text || '');
26
27
  while (match !== null) {
@@ -40,4 +41,6 @@ export var spacesFix = function () { return new Plugin({
40
41
  return DecorationSet.create(doc, decorations);
41
42
  }
42
43
  }
43
- }); };
44
+ });
45
+
46
+ export { spacesFix };