@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,78 +1,76 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.columnResizing = void 0;
4
- var tslib_1 = require("tslib");
5
- var prosemirror_state_1 = require("prosemirror-state");
6
- var prosemirror_tables_1 = require("prosemirror-tables");
7
- var prosemirror_view_1 = require("prosemirror-view");
8
- var constants_1 = require("../../config/constants");
9
- var table_view_1 = require("./table-view");
10
- var utils_1 = require("./../../utils");
11
- var utils_2 = require("./utils");
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
+
12
11
  function columnResizing() {
13
- var handleWidth = 5, cellMinWidth = 25;
14
- var plugin = new prosemirror_state_1.Plugin({
15
- key: utils_2.tableColumnResizeKey,
12
+ const handleWidth = 5, cellMinWidth = 25;
13
+ const plugin = new prosemirrorState.Plugin({
14
+ key: utils.tableColumnResizeKey,
16
15
  state: {
17
- init: function () {
16
+ init() {
18
17
  return new ResizeState(-1, null);
19
18
  },
20
- apply: function (tr, prev) {
19
+ apply(tr, prev) {
21
20
  return prev.apply(tr);
22
21
  }
23
22
  },
24
23
  props: {
25
- attributes: function (state) {
26
- if ((0, utils_2.otherResizeHandle)(utils_2.tableColumnResizeKey, state)) {
24
+ attributes(state) {
25
+ if (utils.otherResizeHandle(utils.tableColumnResizeKey, state)) {
27
26
  return null;
28
27
  }
29
- var pluginState = utils_2.tableColumnResizeKey.getState(state);
28
+ const pluginState = utils.tableColumnResizeKey.getState(state);
30
29
  return pluginState.activeHandle > -1 ? { class: 'resize-cursor' } : null;
31
30
  },
32
31
  handleDOMEvents: {
33
- mousemove: function (view, event) {
34
- if (!(0, utils_2.otherResizing)(utils_2.tableColumnResizeKey, view.state)) {
32
+ mousemove(view, event) {
33
+ if (!utils.otherResizing(utils.tableColumnResizeKey, view.state)) {
35
34
  handleMouseMove(view, event, handleWidth);
36
35
  }
37
36
  return false;
38
37
  },
39
- mouseleave: function (view) {
38
+ mouseleave(view) {
40
39
  handleMouseLeave(view);
41
40
  return false;
42
41
  },
43
- mousedown: function (view, event) {
42
+ mousedown(view, event) {
44
43
  return handleMouseDown(view, event, cellMinWidth);
45
44
  }
46
45
  },
47
- decorations: function (state) {
48
- if (!(0, utils_2.otherResizing)(utils_2.tableColumnResizeKey, state)) {
49
- var pluginState = utils_2.tableColumnResizeKey.getState(state);
46
+ decorations(state) {
47
+ if (!utils.otherResizing(utils.tableColumnResizeKey, state)) {
48
+ const pluginState = utils.tableColumnResizeKey.getState(state);
50
49
  if (pluginState.activeHandle > -1) {
51
50
  return handleDecorations(state, pluginState.activeHandle);
52
51
  }
53
52
  }
54
- return prosemirror_view_1.DecorationSet.empty;
53
+ return prosemirrorView.DecorationSet.empty;
55
54
  },
56
55
  nodeViews: {
57
- table_wrapper: function (node, view) { return new table_view_1.TableWrapperView(node, view); },
58
- table: function (node, view) { return new table_view_1.TableView(node, view); }
56
+ table_wrapper: (node, view) => new tableView.TableWrapperView(node, view),
57
+ table: (node, view) => new tableView.TableView(node, view)
59
58
  }
60
59
  }
61
60
  });
62
61
  return plugin;
63
62
  }
64
- exports.columnResizing = columnResizing;
65
63
  function pointsAtCell($pos) {
66
64
  return Boolean($pos.parent.type.spec.tableRole === 'row' && $pos.nodeAfter);
67
65
  }
68
- var ResizeState = /** @class */ (function () {
69
- function ResizeState(activeHandle, dragging) {
66
+ class ResizeState {
67
+ constructor(activeHandle, dragging) {
70
68
  this.activeHandle = activeHandle;
71
69
  this.dragging = dragging;
72
70
  }
73
- ResizeState.prototype.apply = function (tr) {
74
- var state;
75
- var action = tr.getMeta(utils_2.tableColumnResizeKey);
71
+ apply(tr) {
72
+ let state;
73
+ const action = tr.getMeta(utils.tableColumnResizeKey);
76
74
  if (action && action.setHandle != null) {
77
75
  return new ResizeState(action.setHandle, null);
78
76
  }
@@ -80,30 +78,29 @@ var ResizeState = /** @class */ (function () {
80
78
  return new ResizeState(this.activeHandle, action.setDragging);
81
79
  }
82
80
  if (this.activeHandle > -1 && tr.docChanged) {
83
- var handle = tr.mapping.map(this.activeHandle, -1);
81
+ let handle = tr.mapping.map(this.activeHandle, -1);
84
82
  if (!pointsAtCell(tr.doc.resolve(handle))) {
85
83
  handle = -1;
86
84
  }
87
85
  state = new ResizeState(handle, this.dragging);
88
86
  }
89
87
  return state || this;
90
- };
91
- return ResizeState;
92
- }());
88
+ }
89
+ }
93
90
  function handleMouseMove(view, event, handleWidth) {
94
- var pluginState = utils_2.tableColumnResizeKey.getState(view.state);
91
+ const pluginState = utils.tableColumnResizeKey.getState(view.state);
95
92
  if (!pluginState.dragging) {
96
- var target = (0, utils_2.domCellAround)(event.target);
97
- var cell = -1;
93
+ const target = utils.domCellAround(event.target);
94
+ let cell = -1;
98
95
  if (target) {
99
- var indexes = (0, utils_2.cellIndexes)(target);
100
- var _a = target.getBoundingClientRect(), left = _a.left, right = _a.right;
96
+ const indexes = utils.cellIndexes(target);
97
+ const { left, right } = target.getBoundingClientRect();
101
98
  if (Math.abs(event.clientX - left) <= handleWidth && indexes.cellIndex > 0) {
102
99
  indexes.cellIndex -= target.colSpan;
103
- cell = (0, utils_2.edgeCell)(view, event, indexes);
100
+ cell = utils.edgeCell(view, event, indexes);
104
101
  }
105
102
  else if (right - event.clientX > 0 && right - event.clientX <= handleWidth) {
106
- cell = (0, utils_2.edgeCell)(view, event, indexes);
103
+ cell = utils.edgeCell(view, event, indexes);
107
104
  }
108
105
  }
109
106
  if (cell !== pluginState.activeHandle) {
@@ -112,82 +109,84 @@ function handleMouseMove(view, event, handleWidth) {
112
109
  }
113
110
  }
114
111
  function handleMouseLeave(view) {
115
- var pluginState = utils_2.tableColumnResizeKey.getState(view.state);
112
+ const pluginState = utils.tableColumnResizeKey.getState(view.state);
116
113
  if (pluginState.activeHandle > -1 && !pluginState.dragging) {
117
114
  updateHandle(view, -1);
118
115
  }
119
116
  }
120
117
  function handleMouseDown(view, event, cellMinWidth) {
121
- var _a;
122
- var pluginState = utils_2.tableColumnResizeKey.getState(view.state);
118
+ const pluginState = utils.tableColumnResizeKey.getState(view.state);
123
119
  if (pluginState.activeHandle === -1 || pluginState.dragging) {
124
120
  return false;
125
121
  }
126
- var $cell = view.state.doc.resolve(pluginState.activeHandle);
127
- var row = $cell.parent;
128
- var cellIndex = $cell.index();
129
- var colSpan = 0;
130
- for (var i = 0; i <= cellIndex; i++) {
122
+ const $cell = view.state.doc.resolve(pluginState.activeHandle);
123
+ const row = $cell.parent;
124
+ const cellIndex = $cell.index();
125
+ let colSpan = 0;
126
+ for (let i = 0; i <= cellIndex; i++) {
131
127
  colSpan += row.child(i).attrs.colspan;
132
128
  }
133
- var tableNode = $cell.node($cell.depth - 1);
134
- var dom = view.domAtPos(pluginState.activeHandle);
135
- var domCell = dom.node.childNodes[dom.offset];
136
- var tableDom = domCell.closest('table');
137
- var col, tableAttrs;
138
- if (tableNode.attrs[constants_1.colgroupAttr]) {
139
- var colgroup = tableDom.firstChild;
129
+ const tableNode = $cell.node($cell.depth - 1);
130
+ const dom = view.domAtPos(pluginState.activeHandle);
131
+ const domCell = dom.node.childNodes[dom.offset];
132
+ const tableDom = domCell.closest('table');
133
+ let col, tableAttrs;
134
+ if (tableNode.attrs[constants.colgroupAttr]) {
135
+ const colgroup = tableDom.firstChild;
140
136
  col = colgroup.children[colSpan - 1];
141
137
  if (!col.style.width) {
142
138
  col.style.width = col.offsetWidth + 'px';
143
139
  }
144
140
  }
145
141
  else {
146
- var total = 0;
147
- for (var i = 0; i < row.childCount; i++) {
142
+ let total = 0;
143
+ for (let i = 0; i < row.childCount; i++) {
148
144
  total += row.child(i).attrs.colspan;
149
145
  }
150
- var colgroup = document.createElement('colgroup');
151
- var cols = new Array(total);
152
- for (var i = 0; i < total; i++) {
146
+ const colgroup = document.createElement('colgroup');
147
+ const cols = new Array(total);
148
+ for (let i = 0; i < total; i++) {
153
149
  cols[i] = document.createElement('col');
154
150
  colgroup.appendChild(cols[i]);
155
151
  }
156
152
  tableDom.insertBefore(colgroup, tableDom.firstChild);
157
153
  col = cols[cellIndex];
158
154
  col.style.width = col.offsetWidth + 'px';
159
- tableAttrs = tslib_1.__assign(tslib_1.__assign({}, tableNode.attrs), (_a = {}, _a[constants_1.colgroupAttr] = '<colgroup>' + cols.reduce(function (acc, cur) { return acc + cur.outerHTML; }, '') + '</colgroup>', _a));
155
+ tableAttrs = {
156
+ ...tableNode.attrs,
157
+ [constants.colgroupAttr]: '<colgroup>' + cols.reduce((acc, cur) => acc + cur.outerHTML, '') + '</colgroup>'
158
+ };
160
159
  }
161
- var width = parseFloat(col.style.width);
162
- var tr = view.state.tr.setMeta(utils_2.tableColumnResizeKey, { setDragging: { startX: event.clientX, startWidth: width } });
160
+ const width = parseFloat(col.style.width);
161
+ const tr = view.state.tr.setMeta(utils.tableColumnResizeKey, { setDragging: { startX: event.clientX, startWidth: width } });
163
162
  if (!tableDom.style.width) {
164
- var widths = Array.from(col.parentNode.children).map(function (c) { return c.style.width; });
163
+ const widths = Array.from(col.parentNode.children).map((c) => c.style.width);
165
164
  if (widths.every(Boolean)) {
166
- var sum = widths.reduce(function (acc, cur) { return acc + parseFloat(cur); }, 0);
167
- tableAttrs = (0, utils_1.setNodeStyle)(tableAttrs || tableNode.attrs, 'width', sum + 'px');
165
+ const sum = widths.reduce((acc, cur) => acc + parseFloat(cur), 0);
166
+ tableAttrs = utils$1.setNodeStyle(tableAttrs || tableNode.attrs, 'width', sum + 'px');
168
167
  }
169
168
  }
170
169
  if (tableAttrs) {
171
- var tablePos = $cell.posAtIndex(0, $cell.depth - 1) - 1;
170
+ const tablePos = $cell.posAtIndex(0, $cell.depth - 1) - 1;
172
171
  tr.setNodeMarkup(tablePos, null, tableAttrs);
173
172
  }
174
173
  view.dispatch(tr);
175
174
  function finish(ev) {
176
175
  ev.view.removeEventListener('mouseup', finish);
177
176
  ev.view.removeEventListener('mousemove', move);
178
- var curPluginState = utils_2.tableColumnResizeKey.getState(view.state);
177
+ const curPluginState = utils.tableColumnResizeKey.getState(view.state);
179
178
  if (curPluginState.dragging) {
180
- var transaction = view.state.tr;
179
+ const transaction = view.state.tr;
181
180
  updateColumnWidth(view, transaction, curPluginState.activeHandle);
182
- view.dispatch(transaction.setMeta(utils_2.tableColumnResizeKey, { setDragging: null }));
181
+ view.dispatch(transaction.setMeta(utils.tableColumnResizeKey, { setDragging: null }));
183
182
  }
184
183
  }
185
184
  function move(ev) {
186
185
  if (!ev.which) {
187
186
  return finish(ev);
188
187
  }
189
- var curPluginState = utils_2.tableColumnResizeKey.getState(view.state);
190
- var dragged = draggedWidth(curPluginState.dragging, ev, cellMinWidth);
188
+ const curPluginState = utils.tableColumnResizeKey.getState(view.state);
189
+ const dragged = draggedWidth(curPluginState.dragging, ev, cellMinWidth);
191
190
  displayColumnWidth(view, curPluginState.activeHandle, dragged);
192
191
  }
193
192
  event.view.addEventListener('mouseup', finish);
@@ -196,77 +195,78 @@ function handleMouseDown(view, event, cellMinWidth) {
196
195
  return true;
197
196
  }
198
197
  function draggedWidth(dragging, event, cellMinWidth) {
199
- var offset = event.clientX - dragging.startX;
198
+ const offset = event.clientX - dragging.startX;
200
199
  return Math.max(cellMinWidth, dragging.startWidth + offset);
201
200
  }
202
201
  function updateHandle(view, value) {
203
- var tr = view.state.tr;
202
+ const tr = view.state.tr;
204
203
  tr.setMeta('addToHistory', false);
205
- tr.setMeta(utils_2.tableColumnResizeKey, { setHandle: value });
204
+ tr.setMeta(utils.tableColumnResizeKey, { setHandle: value });
206
205
  view.dispatch(tr);
207
206
  }
208
207
  function updateColumnWidth(view, tr, cell) {
209
- var _a;
210
- var $cell = view.state.doc.resolve(cell);
211
- var tableNode = $cell.node(-1), start = $cell.start(-1);
212
- var tablePos = $cell.posAtIndex(0, $cell.depth - 1) - 1;
213
- var tableDom = view.nodeDOM(start).closest('table');
214
- var attrs = tableNode.attrs;
215
- if (tableNode && attrs[constants_1.colgroupAttr]) {
216
- var colgroup = tableDom.firstChild;
217
- attrs = tslib_1.__assign(tslib_1.__assign({}, attrs), (_a = {}, _a[constants_1.colgroupAttr] = colgroup.outerHTML, _a));
208
+ const $cell = view.state.doc.resolve(cell);
209
+ const tableNode = $cell.node(-1), start = $cell.start(-1);
210
+ const tablePos = $cell.posAtIndex(0, $cell.depth - 1) - 1;
211
+ const tableDom = view.nodeDOM(start).closest('table');
212
+ let attrs = tableNode.attrs;
213
+ if (tableNode && attrs[constants.colgroupAttr]) {
214
+ const colgroup = tableDom.firstChild;
215
+ attrs = { ...attrs, [constants.colgroupAttr]: colgroup.outerHTML };
218
216
  }
219
- var tableDomWidth = tableDom.style.width;
220
- if (tableDom && tableDomWidth && (0, utils_1.parseStyle)(attrs.style).width !== tableDomWidth) {
221
- attrs = (0, utils_1.setNodeStyle)(attrs, 'width', tableDomWidth);
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);
222
220
  }
223
221
  tr.setNodeMarkup(tablePos, null, attrs);
224
222
  }
225
223
  function displayColumnWidth(view, cell, width) {
226
- var $cell = view.state.doc.resolve(cell);
227
- var table = $cell.node(-1), start = $cell.start(-1);
228
- var col = prosemirror_tables_1.TableMap.get(table).colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan - 1;
229
- var dom = view.domAtPos($cell.start(-1)).node;
224
+ const $cell = view.state.doc.resolve(cell);
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;
227
+ let dom = view.domAtPos($cell.start(-1)).node;
230
228
  if (dom.nodeName !== 'TABLE') {
231
229
  dom = dom.closest('table');
232
230
  }
233
- var tableDom = dom;
234
- var colgroup = tableDom.firstChild;
235
- var cols = Array.from(colgroup.children);
231
+ const tableDom = dom;
232
+ const colgroup = tableDom.firstChild;
233
+ const cols = Array.from(colgroup.children);
236
234
  cols[col].style.width = width + 'px';
237
235
  if (tableDom.style.width) {
238
- var widths = cols.map(function (c) { return c.style.width; });
236
+ const widths = cols.map(c => c.style.width);
239
237
  if (widths.every(Boolean)) {
240
- var sum = widths.reduce(function (acc, cur) { return acc + parseFloat(cur); }, 0);
238
+ const sum = widths.reduce((acc, cur) => acc + parseFloat(cur), 0);
241
239
  tableDom.style.width = sum + 'px';
242
240
  }
243
241
  }
244
242
  }
245
243
  function handleDecorations(state, cell) {
246
- var decorations = [];
247
- var $cell = state.doc.resolve(cell);
248
- var table = $cell.node(-1), map = prosemirror_tables_1.TableMap.get(table), start = $cell.start(-1);
249
- var cellsPositions = [];
250
- var cellPos = cell - start;
251
- var column = -1;
252
- for (var i = 0; i < map.height; i++) {
244
+ const decorations = [];
245
+ const $cell = state.doc.resolve(cell);
246
+ const table = $cell.node(-1), map = prosemirrorTables.TableMap.get(table), start = $cell.start(-1);
247
+ const cellsPositions = [];
248
+ const cellPos = cell - start;
249
+ let column = -1;
250
+ for (let i = 0; i < map.height; i++) {
253
251
  cellsPositions.push(map.map.slice(i * map.width, (i * map.width) + map.width));
254
252
  if (column === -1) {
255
253
  column = cellsPositions[i].lastIndexOf(cellPos);
256
254
  }
257
255
  }
258
- var cells = [];
259
- cellsPositions.forEach(function (row) {
260
- var c = row[column];
256
+ const cells = [];
257
+ cellsPositions.forEach((row) => {
258
+ const c = row[column];
261
259
  if (row[column] !== row[column + 1]) {
262
260
  cells.push(c);
263
261
  }
264
262
  });
265
- cells.forEach((function (cPos) {
266
- var pos = start + cPos + table.nodeAt(cPos).nodeSize - 1;
267
- var dom = document.createElement('div');
263
+ cells.forEach((cPos => {
264
+ const pos = start + cPos + table.nodeAt(cPos).nodeSize - 1;
265
+ const dom = document.createElement('div');
268
266
  dom.className = 'column-resize-handle';
269
- decorations.push(prosemirror_view_1.Decoration.widget(pos, dom));
267
+ decorations.push(prosemirrorView.Decoration.widget(pos, dom));
270
268
  }));
271
- return prosemirror_view_1.DecorationSet.create(state.doc, decorations);
269
+ return prosemirrorView.DecorationSet.create(state.doc, decorations);
272
270
  }
271
+
272
+ exports.columnResizing = columnResizing;
@@ -1,2 +1,5 @@
1
- export declare const tableResizing: () => import("prosemirror-state").Plugin<any>[];
2
- export { tableResizeKey, tableColumnResizeKey, tableRowResizeKey } from './utils';
1
+ import * as prosemirror_state from 'prosemirror-state';
2
+
3
+ declare const tableResizing: () => prosemirror_state.Plugin<any>[];
4
+
5
+ export { tableResizing };
@@ -1,16 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tableRowResizeKey = exports.tableColumnResizeKey = exports.tableResizeKey = exports.tableResizing = void 0;
4
- var column_resize_1 = require("./column-resize");
5
- var table_resize_1 = require("./table-resize");
6
- var row_resize_1 = require("./row-resize");
7
- var tableResizing = function () { return [
8
- (0, table_resize_1.tableResizing)(),
9
- (0, column_resize_1.columnResizing)(),
10
- (0, row_resize_1.rowResizing)()
11
- ]; };
1
+ 'use strict';
2
+
3
+ var columnResize = require('./column-resize.js');
4
+ var tableResize = require('./table-resize.js');
5
+ var rowResize = require('./row-resize.js');
6
+ var utils = require('./utils.js');
7
+
8
+ const tableResizing = () => [
9
+ tableResize.tableResizing(),
10
+ columnResize.columnResizing(),
11
+ rowResize.rowResizing()
12
+ ];
13
+
14
+ exports.tableColumnResizeKey = utils.tableColumnResizeKey;
15
+ exports.tableResizeKey = utils.tableResizeKey;
16
+ exports.tableRowResizeKey = utils.tableRowResizeKey;
12
17
  exports.tableResizing = tableResizing;
13
- var utils_1 = require("./utils");
14
- Object.defineProperty(exports, "tableResizeKey", { enumerable: true, get: function () { return utils_1.tableResizeKey; } });
15
- Object.defineProperty(exports, "tableColumnResizeKey", { enumerable: true, get: function () { return utils_1.tableColumnResizeKey; } });
16
- Object.defineProperty(exports, "tableRowResizeKey", { enumerable: true, get: function () { return utils_1.tableRowResizeKey; } });