@progress/kendo-editor-common 1.8.2-dev.202204011319 → 1.9.0-dev.202204060830

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 (43) hide show
  1. package/dist/cdn/js/kendo-editor-common.js +2 -2
  2. package/dist/cdn/main.js +1 -1
  3. package/dist/es/config/constants.js +4 -0
  4. package/dist/es/config/schema.js +9 -5
  5. package/dist/es/main.js +1 -0
  6. package/dist/es/plugins/image-resize.js +4 -3
  7. package/dist/es/plugins/table-resize/column-resize.js +294 -0
  8. package/dist/es/plugins/table-resize/index.js +8 -0
  9. package/dist/es/plugins/table-resize/row-resize.js +244 -0
  10. package/dist/es/plugins/table-resize/table-resize.js +281 -0
  11. package/dist/es/plugins/table-resize/table-view.js +87 -0
  12. package/dist/es/plugins/table-resize/utils.js +53 -0
  13. package/dist/es2015/config/constants.js +4 -0
  14. package/dist/es2015/config/schema.js +11 -8
  15. package/dist/es2015/main.js +1 -0
  16. package/dist/es2015/plugins/image-resize.js +4 -3
  17. package/dist/es2015/plugins/table-resize/column-resize.js +290 -0
  18. package/dist/es2015/plugins/table-resize/index.js +8 -0
  19. package/dist/es2015/plugins/table-resize/row-resize.js +240 -0
  20. package/dist/es2015/plugins/table-resize/table-resize.js +277 -0
  21. package/dist/es2015/plugins/table-resize/table-view.js +84 -0
  22. package/dist/es2015/plugins/table-resize/utils.js +51 -0
  23. package/dist/npm/config/constants.d.ts +4 -0
  24. package/dist/npm/config/constants.js +4 -0
  25. package/dist/npm/config/schema.d.ts +1 -0
  26. package/dist/npm/config/schema.js +8 -4
  27. package/dist/npm/main.d.ts +1 -0
  28. package/dist/npm/main.js +2 -0
  29. package/dist/npm/plugins/image-resize.js +4 -3
  30. package/dist/npm/plugins/table-resize/column-resize.d.ts +2 -0
  31. package/dist/npm/plugins/table-resize/column-resize.js +297 -0
  32. package/dist/npm/plugins/table-resize/index.d.ts +1 -0
  33. package/dist/npm/plugins/table-resize/index.js +10 -0
  34. package/dist/npm/plugins/table-resize/row-resize.d.ts +2 -0
  35. package/dist/npm/plugins/table-resize/row-resize.js +247 -0
  36. package/dist/npm/plugins/table-resize/table-resize.d.ts +6 -0
  37. package/dist/npm/plugins/table-resize/table-resize.js +283 -0
  38. package/dist/npm/plugins/table-resize/table-view.d.ts +17 -0
  39. package/dist/npm/plugins/table-resize/table-view.js +89 -0
  40. package/dist/npm/plugins/table-resize/utils.d.ts +12 -0
  41. package/dist/npm/plugins/table-resize/utils.js +59 -0
  42. package/dist/systemjs/kendo-editor-common.js +1 -1
  43. package/package.json +2 -2
@@ -0,0 +1,283 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var tslib_1 = require("tslib");
4
+ var prosemirror_state_1 = require("prosemirror-state");
5
+ var constants_1 = require("../../config/constants");
6
+ var utils_1 = require("./utils");
7
+ function parentNode(pos, predicate) {
8
+ for (var d = pos.depth; d > 0; d--) {
9
+ var node = pos.node(d);
10
+ if (predicate(node)) {
11
+ return node;
12
+ }
13
+ }
14
+ return null;
15
+ }
16
+ var directions = {
17
+ 'southeast': { x: 1, y: 1 },
18
+ 'east': { x: 1, y: 0 },
19
+ 'south': { x: 0, y: 1 },
20
+ 'north': { x: 0, y: -1 },
21
+ 'west': { x: -1, y: 0 },
22
+ 'southwest': { x: -1, y: 1 },
23
+ 'northwest': { x: -1, y: -1 },
24
+ 'northeast': { x: 1, y: -1 } // top right
25
+ };
26
+ var commonDir = {
27
+ 'southeast': true,
28
+ 'southwest': true,
29
+ 'northwest': true,
30
+ 'northeast': true
31
+ };
32
+ var horizontalDir = tslib_1.__assign({ 'east': true, 'west': true }, commonDir);
33
+ var verticalDir = tslib_1.__assign({ 'south': true, 'north': true }, commonDir);
34
+ var setSize = function (domNode, sizeType, value) {
35
+ domNode.style[sizeType] = value + 'px';
36
+ };
37
+ var ResizeState = /** @class */ (function () {
38
+ function ResizeState(activeHandle, dragging, nodePosition) {
39
+ this.activeHandle = activeHandle;
40
+ this.dragging = dragging;
41
+ this.nodePosition = nodePosition;
42
+ }
43
+ ResizeState.prototype.apply = function (tr) {
44
+ var state = this, next = tr.getMeta(utils_1.tableResizeKey);
45
+ if (next) {
46
+ var nextState = new ResizeState(next.activeHandle, next.setDragging, next.nodePosition);
47
+ return nextState;
48
+ }
49
+ return state;
50
+ };
51
+ return ResizeState;
52
+ }());
53
+ var handleMouseMove = function (view, event, options) {
54
+ var state = utils_1.tableResizeKey.getState(view.state);
55
+ var dragging = state.dragging, nodePosition = state.nodePosition, activeHandle = state.activeHandle;
56
+ if (nodePosition < 0 || !dragging) {
57
+ return;
58
+ }
59
+ var resizedNode = utils_1.getTable(view.nodeDOM(nodePosition));
60
+ var rect = resizedNode.getBoundingClientRect();
61
+ var dir = directions[activeHandle];
62
+ var diffX = (event.clientX - dragging.startX) * dir.x;
63
+ var diffY = (event.clientY - dragging.startY) * dir.y;
64
+ var nodeWidth = resizedNode.offsetWidth;
65
+ var nodeHeight = resizedNode.offsetHeight;
66
+ var width = dir.x ? diffX + nodeWidth : rect.width;
67
+ var height = dir.y ? diffY + nodeHeight : rect.height;
68
+ if (options.lockRatio && dir.x && dir.y) {
69
+ var ratio = Math.min(width / nodeWidth, height / nodeHeight);
70
+ var lockWidth = nodeWidth * ratio;
71
+ var lockHeight = nodeHeight * ratio;
72
+ dragging.startX = event.clientX - (width - lockWidth) * dir.x;
73
+ dragging.startY = event.clientY - (height - lockHeight) * dir.y;
74
+ width = lockWidth;
75
+ height = lockHeight;
76
+ }
77
+ else {
78
+ dragging.startX = dir.x ? event.clientX : dragging.startX;
79
+ dragging.startY = dir.y ? event.clientY : dragging.startY;
80
+ }
81
+ if (horizontalDir[activeHandle]) {
82
+ setSize(resizedNode, 'width', width);
83
+ }
84
+ if (verticalDir[activeHandle]) {
85
+ setSize(resizedNode, 'height', height);
86
+ }
87
+ };
88
+ var toPercents = function (view, tr, tablePos) {
89
+ var tableNode = view.state.doc.nodeAt(tablePos);
90
+ var tableDom = utils_1.getTable(view.nodeDOM(tablePos));
91
+ var _a = tableSize(tableDom), tableWidth = _a.width, tableHeight = _a.height, colsWidth = _a.colsWidth;
92
+ var colgroup = tableDom.firstChild;
93
+ var cols = Array.from((colgroup && colgroup.children) || []);
94
+ // const borders = new Array(cols.length).fill(tableWidth / tableOffsetWidth / cols.length);
95
+ var widthChanged = false;
96
+ cols.forEach(function (col, i) {
97
+ if (col.style.width && !/%$/.test(col.style.width)) {
98
+ col.style.width = ((colsWidth[i]) * 100 / tableWidth) + '%';
99
+ widthChanged = true;
100
+ }
101
+ });
102
+ var rows = Array.from(tableDom.rows);
103
+ var heightChange = false;
104
+ tableNode.forEach(function (row, offset, index) {
105
+ var rowHeight = utils_1.parseStyle(row.attrs.style).height;
106
+ if (rowHeight && !/%$/.test(rowHeight)) {
107
+ tr.setNodeMarkup(tablePos + offset + 1, null, utils_1.setNodeStyle(row.attrs, 'height', (rows[index].offsetHeight * 100 / tableHeight) + '%'));
108
+ heightChange = true;
109
+ }
110
+ });
111
+ var tableAttrs = tableNode.attrs;
112
+ if (utils_1.parseStyle(tableAttrs.style).width !== tableWidth + 'px') {
113
+ tableAttrs = utils_1.setNodeStyle(tableAttrs, 'width', tableWidth + 'px');
114
+ }
115
+ if (widthChanged) {
116
+ tableAttrs[constants_1.colgroupAttr] = colgroup.outerHTML;
117
+ }
118
+ if (heightChange) {
119
+ tableAttrs = utils_1.setNodeStyle(tableAttrs, 'height', tableHeight + 'px');
120
+ }
121
+ if (widthChanged || heightChange) {
122
+ tr.setNodeMarkup(tablePos, null, tableAttrs);
123
+ }
124
+ };
125
+ var toPixels = function (view, tr, tablePos, attrs) {
126
+ var tableNode = view.state.doc.nodeAt(tablePos);
127
+ var tableDom = utils_1.getTable(view.nodeDOM(tablePos));
128
+ var rows = Array.from(tableDom.rows);
129
+ tableNode.forEach(function (row, offset, index) {
130
+ var rowHeight = utils_1.parseStyle(row.attrs.style).height;
131
+ if (rowHeight && !/px$/.test(rowHeight)) {
132
+ tr.setNodeMarkup(tablePos + offset + 1, null, utils_1.setNodeStyle(row.attrs, 'height', rows[index].offsetHeight + 'px'));
133
+ }
134
+ });
135
+ var colgroup = tableDom.firstChild;
136
+ var cols = Array.from((colgroup && colgroup.children) || []);
137
+ var widthChanged = false;
138
+ cols.forEach(function (col, i) {
139
+ if (col.style.width && !/px$/.test(col.style.width)) {
140
+ col.style.width = cols[i].offsetWidth + 'px';
141
+ widthChanged = true;
142
+ }
143
+ });
144
+ var tableAttrs = tslib_1.__assign({}, attrs);
145
+ if (widthChanged) {
146
+ tableAttrs[constants_1.colgroupAttr] = colgroup.outerHTML;
147
+ }
148
+ return tableAttrs;
149
+ };
150
+ var tableSize = function (table) {
151
+ var cols = Array.from(table.firstChild.children);
152
+ var colsWidth = cols.map(function (c) { return c.offsetWidth; });
153
+ var width = colsWidth.reduce(function (acc, cur) { return acc + cur; }, 0);
154
+ var height = table.offsetHeight; // Array.from(table.rows).reduce((acc, cur) => acc + cur.offsetHeight, 0);
155
+ return { width: width, height: height, colsWidth: colsWidth, offsetWidth: table.offsetWidth };
156
+ };
157
+ var handleMouseUp = function (view) {
158
+ var _a = utils_1.tableResizeKey.getState(view.state), dragging = _a.dragging, nodePosition = _a.nodePosition, activeHandle = _a.activeHandle;
159
+ if (dragging) {
160
+ var node = view.state.doc.nodeAt(nodePosition);
161
+ var dom = utils_1.getTable(view.nodeDOM(nodePosition));
162
+ var rect = tableSize(dom);
163
+ if (node) {
164
+ var width = rect.offsetWidth + 'px';
165
+ var height = rect.height + 'px';
166
+ var tr = view.state.tr;
167
+ var attrs = node.attrs;
168
+ var parsedStyles = utils_1.parseStyle(attrs.style);
169
+ if (horizontalDir[activeHandle] && dom.style.width && parsedStyles.width !== width) {
170
+ attrs = utils_1.setNodeStyle(attrs, 'width', width);
171
+ }
172
+ if (verticalDir[activeHandle] && dom.style.height && parsedStyles.height !== height) {
173
+ attrs = utils_1.setNodeStyle(attrs, 'height', height);
174
+ }
175
+ toPixels(view, tr, nodePosition, attrs);
176
+ tr.setNodeMarkup(nodePosition, null, attrs);
177
+ tr.setMeta('commandName', 'node-resize');
178
+ tr.setMeta('args', attrs);
179
+ tr.setMeta(utils_1.tableResizeKey, {
180
+ setDragging: null,
181
+ activeHandle: null,
182
+ nodePosition: nodePosition
183
+ });
184
+ view.dispatch(tr);
185
+ }
186
+ }
187
+ };
188
+ var handleMouseDown = function (view, event, options) {
189
+ var target = event.target;
190
+ var activeHandle = target.getAttribute(constants_1.dataDirection);
191
+ if (!activeHandle) {
192
+ return false;
193
+ }
194
+ var resizeState = utils_1.tableResizeKey.getState(view.state);
195
+ event.preventDefault();
196
+ var transaction = view.state.tr;
197
+ transaction.setMeta(utils_1.tableResizeKey, {
198
+ setDragging: { startX: event.clientX, startY: event.clientY },
199
+ activeHandle: activeHandle,
200
+ nodePosition: resizeState.nodePosition
201
+ });
202
+ transaction.setMeta('addToHistory', false);
203
+ toPercents(view, transaction, resizeState.nodePosition);
204
+ view.dispatch(transaction);
205
+ var curWindow = event.view || window;
206
+ function move(e) {
207
+ handleMouseMove(view, e, options);
208
+ }
209
+ function finish(_e) {
210
+ curWindow.removeEventListener('mouseup', finish);
211
+ curWindow.removeEventListener('mousemove', move);
212
+ handleMouseUp(view);
213
+ }
214
+ curWindow.addEventListener('mouseup', finish);
215
+ curWindow.addEventListener('mousemove', move);
216
+ return true;
217
+ };
218
+ exports.tableResizing = function (options) {
219
+ if (options === void 0) { options = { node: 'table', lockRatio: false }; }
220
+ return new prosemirror_state_1.Plugin({
221
+ key: utils_1.tableResizeKey,
222
+ view: function (_viewObj) { return ({
223
+ selectedNode: function (state, nodeType) {
224
+ var selection = state.selection;
225
+ var isNodeSelected = selection instanceof prosemirror_state_1.NodeSelection && nodeType === selection.node.type;
226
+ if (isNodeSelected && selection instanceof prosemirror_state_1.NodeSelection) {
227
+ return { node: selection.node, pos: selection.from };
228
+ }
229
+ var node = parentNode(selection.$from, function (n) { return n.type === nodeType; });
230
+ if (node) {
231
+ var tableDepth = new Array(selection.$from.depth + 1).fill(0)
232
+ .findIndex(function (_, i) { return selection.$from.node(i).type.spec.tableRole === 'table'; });
233
+ var pos = selection.$from.start(tableDepth) - 1;
234
+ return { node: node, pos: pos };
235
+ }
236
+ return null;
237
+ },
238
+ update: function (view, prevState) {
239
+ var _a, _b, _c, _d;
240
+ var state = view.state;
241
+ var nodeType = state.schema.nodes[options.node];
242
+ var selected = this.selectedNode(state, nodeType);
243
+ var prevSelected = this.selectedNode(prevState, nodeType);
244
+ if (!selected && prevSelected && !prevState.doc.eq(view.state.doc)) {
245
+ // selected table is deleted
246
+ return;
247
+ }
248
+ if (selected || prevSelected) {
249
+ var tr = state.tr;
250
+ if (selected && prevSelected && selected.pos !== prevSelected.pos) {
251
+ tr.setMeta(utils_1.tableResizeKey, { nodePosition: selected.pos });
252
+ tr.setNodeMarkup(prevSelected.pos, nodeType, tslib_1.__assign({}, prevSelected.node.attrs, (_a = {}, _a[constants_1.resizableAttr] = false, _a)));
253
+ tr.setNodeMarkup(selected.pos, nodeType, tslib_1.__assign({}, selected.node.attrs, (_b = {}, _b[constants_1.resizableAttr] = true, _b)));
254
+ view.dispatch(tr);
255
+ }
256
+ else if (selected && !prevSelected) {
257
+ tr.setMeta(utils_1.tableResizeKey, { nodePosition: selected.pos });
258
+ view.dispatch(tr.setNodeMarkup(selected.pos, nodeType, tslib_1.__assign({}, selected.node.attrs, (_c = {}, _c[constants_1.resizableAttr] = true, _c))));
259
+ }
260
+ else if (!selected && prevSelected) {
261
+ tr.setMeta(utils_1.tableResizeKey, { nodePosition: -1 });
262
+ view.dispatch(tr.setNodeMarkup(prevSelected.pos, nodeType, tslib_1.__assign({}, prevSelected.node.attrs, (_d = {}, _d[constants_1.resizableAttr] = false, _d))));
263
+ }
264
+ }
265
+ }
266
+ }); },
267
+ state: {
268
+ init: function () {
269
+ return new ResizeState('', null, -1);
270
+ },
271
+ apply: function (tr, prev) {
272
+ return prev.apply(tr);
273
+ }
274
+ },
275
+ props: {
276
+ handleDOMEvents: {
277
+ mousedown: function (view, event) {
278
+ return handleMouseDown(view, event, options);
279
+ }
280
+ }
281
+ }
282
+ });
283
+ };
@@ -0,0 +1,17 @@
1
+ import { Node } from 'prosemirror-model';
2
+ import { EditorView } from 'prosemirror-view';
3
+ export declare class TableView {
4
+ node: Node;
5
+ view: EditorView;
6
+ table: HTMLTableElement;
7
+ colgroup: HTMLTableColElement;
8
+ dom: HTMLElement;
9
+ contentDOM: HTMLElement;
10
+ private resizeHandles;
11
+ constructor(node: Node, view: EditorView);
12
+ update(node: Node): boolean;
13
+ ignoreMutation(record: MutationRecord): boolean;
14
+ destroy(): void;
15
+ private renderColgroup;
16
+ private setAttributes;
17
+ }
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var constants_1 = require("../../config/constants");
4
+ var schema_1 = require("../../config/schema");
5
+ var directions = ['northwest', 'north', 'northeast', 'southwest', 'south', 'southeast', 'west', 'east'];
6
+ var TableView = /** @class */ (function () {
7
+ function TableView(node, view) {
8
+ this.node = node;
9
+ this.view = view;
10
+ this.dom = document.createElement('div');
11
+ this.dom.className = constants_1.resizableWrap;
12
+ this.table = this.dom.appendChild(document.createElement('table'));
13
+ if (node.attrs[constants_1.colgroupAttr]) {
14
+ this.renderColgroup(node.attrs[constants_1.colgroupAttr]);
15
+ }
16
+ var tBody = this.table.appendChild(document.createElement('tbody'));
17
+ this.setAttributes(this.table, node.attrs);
18
+ this.resizeHandles = directions.map(function (dir) {
19
+ var handle = document.createElement('span');
20
+ handle.className = constants_1.resizeHandle + ' ' + dir;
21
+ handle.setAttribute(constants_1.dataDirection, dir);
22
+ return handle;
23
+ });
24
+ this.contentDOM = tBody;
25
+ }
26
+ TableView.prototype.update = function (node) {
27
+ var _this = this;
28
+ if (node.type !== this.node.type) {
29
+ return false;
30
+ }
31
+ var prev = this.node;
32
+ this.node = node;
33
+ if (node.attrs[constants_1.resizableAttr]) {
34
+ this.resizeHandles.forEach(function (handle) {
35
+ _this.dom.appendChild(handle);
36
+ });
37
+ }
38
+ else {
39
+ Array.from(this.dom.children)
40
+ .filter(function (e) { return e.classList.contains(constants_1.resizeHandle); })
41
+ .forEach(function (e) { return e.remove(); });
42
+ }
43
+ this.setAttributes(this.table, node.attrs);
44
+ if (prev.attrs[constants_1.colgroupAttr] !== node.attrs[constants_1.colgroupAttr]) {
45
+ this.renderColgroup(node.attrs[constants_1.colgroupAttr]);
46
+ }
47
+ return true;
48
+ };
49
+ TableView.prototype.ignoreMutation = function (record) {
50
+ var result = record.type === 'attributes' &&
51
+ (record.target === this.table ||
52
+ record.target.firstChild === this.table ||
53
+ (this.colgroup && this.colgroup.contains(record.target)));
54
+ return result;
55
+ };
56
+ TableView.prototype.destroy = function () {
57
+ this.node = null;
58
+ this.view = null;
59
+ this.table = null;
60
+ this.colgroup = null;
61
+ this.resizeHandles = null;
62
+ };
63
+ TableView.prototype.renderColgroup = function (colgroupStr) {
64
+ if (this.table && this.table.firstChild && this.table.firstChild.nodeName === 'COLGROUP') {
65
+ this.table.removeChild(this.table.firstChild);
66
+ }
67
+ if (colgroupStr) {
68
+ this.colgroup = schema_1.parseStrColgroup(colgroupStr);
69
+ this.table.insertBefore(this.colgroup, this.table.firstChild);
70
+ }
71
+ };
72
+ TableView.prototype.setAttributes = function (table, attrs) {
73
+ var skip = [constants_1.colgroupAttr, constants_1.resizableAttr];
74
+ for (var attrName in attrs) {
75
+ if (attrName && skip.indexOf(attrName) === -1) {
76
+ var current = table.getAttribute(attrName);
77
+ var next = attrs[attrName];
78
+ if (next && next !== current) {
79
+ table.setAttribute(attrName, next);
80
+ }
81
+ else if (!next) {
82
+ table.removeAttribute(attrName);
83
+ }
84
+ }
85
+ }
86
+ };
87
+ return TableView;
88
+ }());
89
+ exports.TableView = TableView;
@@ -0,0 +1,12 @@
1
+ import { EditorState, PluginKey } from 'prosemirror-state';
2
+ export declare const reAnyValue: RegExp;
3
+ export declare const parseStyle: (styleText: string) => {
4
+ [x: string]: string;
5
+ };
6
+ export declare function setNodeStyle(nodeAttrs: any, styleType: string, value: string): any;
7
+ export declare const tableResizeKey: PluginKey<any, any>;
8
+ export declare const tableColumnResizing: PluginKey<any, any>;
9
+ export declare const tableRowResizing: PluginKey<any, any>;
10
+ export declare function otherResizing(current: PluginKey, state: EditorState): boolean;
11
+ export declare function otherResizeHandle(current: PluginKey, state: EditorState): boolean;
12
+ export declare function getTable(dom: HTMLElement): HTMLTableElement;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var tslib_1 = require("tslib");
4
+ var prosemirror_state_1 = require("prosemirror-state");
5
+ var utils_1 = require("../../utils");
6
+ exports.reAnyValue = /^.+$/;
7
+ exports.parseStyle = function (styleText) {
8
+ var styles = (styleText || '').split(/\s*;\s*/).filter(Boolean).map(function (s) {
9
+ var _a;
10
+ var nameValue = s.split(/\s*:\s*/);
11
+ return _a = {}, _a[nameValue[0]] = nameValue[1], _a;
12
+ }).reduce(function (acc, val) { return (tslib_1.__assign({}, acc, val)); }, {});
13
+ return styles;
14
+ };
15
+ function setNodeStyle(nodeAttrs, styleType, value) {
16
+ var attrs;
17
+ if (new RegExp('[^-]?' + styleType + ':').test(nodeAttrs.style || '')) {
18
+ var style = utils_1.changeStylesString(nodeAttrs.style || '', { style: styleType, value: exports.reAnyValue, newValue: value }).style;
19
+ attrs = tslib_1.__assign({}, nodeAttrs, { style: style });
20
+ }
21
+ else if (nodeAttrs.style) {
22
+ attrs = tslib_1.__assign({}, nodeAttrs, { style: nodeAttrs.style.replace(/;$/, '') + '; ' + styleType + ': ' + value + ';' });
23
+ }
24
+ else {
25
+ attrs = tslib_1.__assign({}, nodeAttrs, { style: styleType + ': ' + value + ';' });
26
+ }
27
+ return attrs;
28
+ }
29
+ exports.setNodeStyle = setNodeStyle;
30
+ exports.tableResizeKey = new prosemirror_state_1.PluginKey('table-resize');
31
+ exports.tableColumnResizing = new prosemirror_state_1.PluginKey('table-column-resizing');
32
+ exports.tableRowResizing = new prosemirror_state_1.PluginKey('table-row-resizing');
33
+ function otherResizing(current, state) {
34
+ var activeResize = false;
35
+ activeResize = activeResize ||
36
+ (current !== exports.tableResizeKey && Boolean(exports.tableResizeKey.get(state)) && exports.tableResizeKey.getState(state).dragging);
37
+ activeResize = activeResize ||
38
+ (current !== exports.tableColumnResizing && Boolean(exports.tableColumnResizing.get(state)) && exports.tableColumnResizing.getState(state).dragging);
39
+ activeResize = activeResize ||
40
+ (current !== exports.tableRowResizing && Boolean(exports.tableRowResizing.get(state)) && exports.tableRowResizing.getState(state).dragging);
41
+ return activeResize;
42
+ }
43
+ exports.otherResizing = otherResizing;
44
+ function otherResizeHandle(current, state) {
45
+ var activeResize = false;
46
+ activeResize = activeResize ||
47
+ (current !== exports.tableColumnResizing && exports.tableColumnResizing.get(state) && exports.tableColumnResizing.getState(state).activeHandle > -1);
48
+ activeResize = activeResize ||
49
+ (current !== exports.tableRowResizing && exports.tableRowResizing.get(state) && exports.tableRowResizing.getState(state).activeHandle > -1);
50
+ return activeResize;
51
+ }
52
+ exports.otherResizeHandle = otherResizeHandle;
53
+ function getTable(dom) {
54
+ if (dom && dom.firstChild && dom.firstChild.nodeName === 'TABLE') {
55
+ return dom.firstChild;
56
+ }
57
+ return dom;
58
+ }
59
+ exports.getTable = getTable;