@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.
- package/dist/cdn/main.js +1 -1
- package/dist/es/DOMSerializer.js +71 -75
- package/dist/es/align.js +19 -16
- package/dist/es/blockNode.js +76 -78
- package/dist/es/blockquote.js +12 -9
- package/dist/es/cleanFormatting.js +16 -16
- package/dist/es/config/align-rules.js +8 -6
- package/dist/es/config/commands.js +9 -13
- package/dist/es/config/constants.js +9 -7
- package/dist/es/config/indent-rules.js +8 -6
- package/dist/es/config/keymap.js +20 -18
- package/dist/es/config/list-settings.js +7 -6
- package/dist/es/config/schema.js +184 -126
- package/dist/es/find-replace.js +34 -32
- package/dist/es/image.js +10 -7
- package/dist/es/indent.js +47 -44
- package/dist/es/inline-style.js +72 -70
- package/dist/es/link.js +51 -52
- package/dist/es/listConvert.js +37 -34
- package/dist/es/lists.js +83 -82
- package/dist/es/main.js +32 -33
- package/dist/es/mark.js +87 -92
- package/dist/es/paste.js +48 -46
- package/dist/es/plugins/caret-color.js +14 -11
- package/dist/es/plugins/csp-fix.js +23 -23
- package/dist/es/plugins/highlight.js +12 -10
- package/dist/es/plugins/image-resize.js +81 -81
- package/dist/es/plugins/list-markers-styles.js +43 -39
- package/dist/es/plugins/placeholder.js +12 -9
- package/dist/es/plugins/resize-utils.js +11 -9
- package/dist/es/plugins/spaces-fix.js +13 -10
- package/dist/es/plugins/table-resize/column-resize.js +104 -102
- package/dist/es/plugins/table-resize/index.js +10 -7
- package/dist/es/plugins/table-resize/row-resize.js +88 -89
- package/dist/es/plugins/table-resize/table-resize.js +129 -122
- package/dist/es/plugins/table-resize/table-view.js +46 -48
- package/dist/es/plugins/table-resize/utils.js +39 -41
- package/dist/es/source.js +78 -74
- package/dist/es/table.js +64 -66
- package/dist/es/text.js +4 -2
- package/dist/es/utils.js +107 -116
- package/dist/es2015/DOMSerializer.js +20 -17
- package/dist/es2015/align.js +6 -3
- package/dist/es2015/blockNode.js +15 -12
- package/dist/es2015/blockquote.js +5 -2
- package/dist/es2015/cleanFormatting.js +6 -3
- package/dist/es2015/config/align-rules.js +7 -5
- package/dist/es2015/config/commands.js +9 -13
- package/dist/es2015/config/constants.js +9 -7
- package/dist/es2015/config/indent-rules.js +6 -3
- package/dist/es2015/config/keymap.js +10 -7
- package/dist/es2015/config/list-settings.js +5 -3
- package/dist/es2015/config/schema.js +8 -6
- package/dist/es2015/find-replace.js +9 -6
- package/dist/es2015/image.js +5 -2
- package/dist/es2015/indent.js +14 -11
- package/dist/es2015/inline-style.js +9 -6
- package/dist/es2015/link.js +7 -4
- package/dist/es2015/listConvert.js +5 -2
- package/dist/es2015/lists.js +14 -11
- package/dist/es2015/main.js +32 -33
- package/dist/es2015/mark.js +15 -12
- package/dist/es2015/node_modules/tslib/tslib.es6.js +35 -0
- package/dist/es2015/paste.js +14 -11
- package/dist/es2015/plugins/caret-color.js +8 -5
- package/dist/es2015/plugins/csp-fix.js +5 -2
- package/dist/es2015/plugins/highlight.js +6 -3
- package/dist/es2015/plugins/image-resize.js +10 -7
- package/dist/es2015/plugins/list-markers-styles.js +6 -3
- package/dist/es2015/plugins/placeholder.js +5 -2
- package/dist/es2015/plugins/resize-utils.js +11 -9
- package/dist/es2015/plugins/spaces-fix.js +4 -1
- package/dist/es2015/plugins/table-resize/column-resize.js +24 -21
- package/dist/es2015/plugins/table-resize/index.js +9 -6
- package/dist/es2015/plugins/table-resize/row-resize.js +23 -20
- package/dist/es2015/plugins/table-resize/table-resize.js +20 -17
- package/dist/es2015/plugins/table-resize/table-view.js +9 -6
- package/dist/es2015/plugins/table-resize/utils.js +13 -10
- package/dist/es2015/source.js +24 -13
- package/dist/es2015/table.js +18 -15
- package/dist/es2015/text.js +3 -1
- package/dist/es2015/utils.js +22 -25
- package/dist/npm/DOMSerializer.js +73 -78
- package/dist/npm/align.d.ts +7 -4
- package/dist/npm/align.js +22 -21
- package/dist/npm/blockNode.d.ts +14 -15
- package/dist/npm/blockNode.js +91 -95
- package/dist/npm/blockquote.d.ts +5 -2
- package/dist/npm/blockquote.js +16 -15
- package/dist/npm/cleanFormatting.d.ts +6 -3
- package/dist/npm/cleanFormatting.js +17 -19
- package/dist/npm/config/align-rules.d.ts +8 -6
- package/dist/npm/config/align-rules.js +14 -9
- package/dist/npm/config/commands.d.ts +11 -19
- package/dist/npm/config/commands.js +17 -16
- package/dist/npm/config/constants.js +17 -10
- package/dist/npm/config/indent-rules.d.ts +6 -4
- package/dist/npm/config/indent-rules.js +11 -9
- package/dist/npm/config/keymap.d.ts +5 -2
- package/dist/npm/config/keymap.js +30 -30
- package/dist/npm/config/list-settings.js +13 -11
- package/dist/npm/config/schema.d.ts +4 -3
- package/dist/npm/config/schema.js +191 -134
- package/dist/npm/find-replace.d.ts +10 -7
- package/dist/npm/find-replace.js +47 -47
- package/dist/npm/image.d.ts +6 -3
- package/dist/npm/image.js +11 -10
- package/dist/npm/indent.d.ts +12 -9
- package/dist/npm/indent.js +68 -67
- package/dist/npm/inline-style.d.ts +7 -4
- package/dist/npm/inline-style.js +83 -83
- package/dist/npm/link.d.ts +4 -2
- package/dist/npm/link.js +58 -61
- package/dist/npm/listConvert.d.ts +3 -1
- package/dist/npm/listConvert.js +40 -39
- package/dist/npm/lists.d.ts +9 -9
- package/dist/npm/lists.js +94 -95
- package/dist/npm/main.d.ts +34 -33
- package/dist/npm/main.js +389 -198
- package/dist/npm/mark.d.ts +13 -18
- package/dist/npm/mark.js +104 -111
- package/dist/npm/paste.d.ts +12 -9
- package/dist/npm/paste.js +61 -61
- package/dist/npm/plugins/caret-color.d.ts +6 -3
- package/dist/npm/plugins/caret-color.js +21 -19
- package/dist/npm/plugins/csp-fix.d.ts +4 -1
- package/dist/npm/plugins/csp-fix.js +28 -30
- package/dist/npm/plugins/highlight.d.ts +7 -4
- package/dist/npm/plugins/highlight.js +17 -16
- package/dist/npm/plugins/image-resize.d.ts +7 -5
- package/dist/npm/plugins/image-resize.js +96 -97
- package/dist/npm/plugins/list-markers-styles.d.ts +5 -2
- package/dist/npm/plugins/list-markers-styles.js +49 -47
- package/dist/npm/plugins/placeholder.d.ts +4 -1
- package/dist/npm/plugins/placeholder.js +18 -17
- package/dist/npm/plugins/resize-utils.js +14 -12
- package/dist/npm/plugins/spaces-fix.d.ts +4 -1
- package/dist/npm/plugins/spaces-fix.js +19 -18
- package/dist/npm/plugins/table-resize/column-resize.js +117 -117
- package/dist/npm/plugins/table-resize/index.d.ts +5 -2
- package/dist/npm/plugins/table-resize/index.js +16 -15
- package/dist/npm/plugins/table-resize/row-resize.js +98 -101
- package/dist/npm/plugins/table-resize/table-resize.js +144 -139
- package/dist/npm/plugins/table-resize/table-view.js +59 -61
- package/dist/npm/plugins/table-resize/utils.d.ts +7 -17
- package/dist/npm/plugins/table-resize/utils.js +51 -52
- package/dist/npm/source.d.ts +18 -11
- package/dist/npm/source.js +94 -91
- package/dist/npm/table.d.ts +10 -9
- package/dist/npm/table.js +93 -82
- package/dist/npm/text.d.ts +6 -3
- package/dist/npm/text.js +5 -5
- package/dist/npm/types/active-marks.d.ts +4 -1
- package/dist/npm/types/command.d.ts +5 -2
- package/dist/npm/types/dispatchFn.d.ts +4 -1
- package/dist/npm/types/paste-cleanup-settings.d.ts +3 -1
- package/dist/npm/utils.d.ts +14 -29
- package/dist/npm/utils.js +133 -145
- package/package.json +35 -53
- package/dist/cdn/js/kendo-editor-common.js +0 -1
- package/dist/es/types/active-marks.js +0 -1
- package/dist/es/types/command.js +0 -1
- package/dist/es/types/dispatchFn.js +0 -1
- package/dist/es/types/paste-cleanup-settings.js +0 -1
- package/dist/es/types/predicate.js +0 -1
- package/dist/es2015/types/active-marks.js +0 -1
- package/dist/es2015/types/command.js +0 -1
- package/dist/es2015/types/dispatchFn.js +0 -1
- package/dist/es2015/types/paste-cleanup-settings.js +0 -1
- package/dist/es2015/types/predicate.js +0 -1
- package/dist/npm/DOMSerializer.d.ts +0 -35
- package/dist/npm/config/constants.d.ts +0 -7
- package/dist/npm/config/list-settings.d.ts +0 -30
- package/dist/npm/plugins/resize-utils.d.ts +0 -35
- package/dist/npm/plugins/table-resize/column-resize.d.ts +0 -2
- package/dist/npm/plugins/table-resize/row-resize.d.ts +0 -2
- package/dist/npm/plugins/table-resize/table-resize.d.ts +0 -18
- package/dist/npm/plugins/table-resize/table-view.d.ts +0 -28
- package/dist/npm/types/active-marks.js +0 -2
- package/dist/npm/types/command.js +0 -2
- package/dist/npm/types/dispatchFn.js +0 -2
- package/dist/npm/types/paste-cleanup-settings.js +0 -2
- package/dist/npm/types/predicate.d.ts +0 -1
- package/dist/npm/types/predicate.js +0 -2
- package/dist/systemjs/kendo-editor-common.js +0 -1
|
@@ -1,57 +1,55 @@
|
|
|
1
1
|
import { Plugin } from 'prosemirror-state';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { parseStyle, setNodeStyle } from '
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
TableRowView.prototype.ignoreMutation = function (record) {
|
|
2
|
+
import { tableNodeTypes, TableMap } from 'prosemirror-tables';
|
|
3
|
+
import { DecorationSet, Decoration } from 'prosemirror-view';
|
|
4
|
+
import { tableRowResizeKey, otherResizeHandle, otherResizing, domCellAround, cellIndexes, edgeCell } from './utils.js';
|
|
5
|
+
import { parseStyle, setNodeStyle } from '../../utils.js';
|
|
6
|
+
|
|
7
|
+
class TableRowView {
|
|
8
|
+
ignoreMutation(record) {
|
|
10
9
|
return record.type === 'attributes' && record.attributeName === 'style' && record.target.nodeName === 'TR';
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
key: key,
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function rowResizing() {
|
|
13
|
+
const handleWidth = 5;
|
|
14
|
+
const plugin = new Plugin({
|
|
15
|
+
key: tableRowResizeKey,
|
|
18
16
|
state: {
|
|
19
|
-
init
|
|
20
|
-
this.spec.props.nodeViews[tableNodeTypes(state.schema).row.name] =
|
|
17
|
+
init(_, state) {
|
|
18
|
+
this.spec.props.nodeViews[tableNodeTypes(state.schema).row.name] = () => new TableRowView();
|
|
21
19
|
return new ResizeState(-1, null);
|
|
22
20
|
},
|
|
23
|
-
apply
|
|
21
|
+
apply(tr, prev) {
|
|
24
22
|
return prev.apply(tr);
|
|
25
23
|
}
|
|
26
24
|
},
|
|
27
25
|
props: {
|
|
28
|
-
attributes
|
|
29
|
-
if (otherResizeHandle(
|
|
26
|
+
attributes(state) {
|
|
27
|
+
if (otherResizeHandle(tableRowResizeKey, state)) {
|
|
30
28
|
return null;
|
|
31
29
|
}
|
|
32
|
-
|
|
30
|
+
const pluginState = tableRowResizeKey.getState(state);
|
|
33
31
|
return pluginState.activeHandle > -1 ? { class: 'resize-cursor-vertical' } : null;
|
|
34
32
|
},
|
|
35
33
|
handleDOMEvents: {
|
|
36
|
-
mousemove
|
|
37
|
-
if (!otherResizing(
|
|
34
|
+
mousemove(view, event) {
|
|
35
|
+
if (!otherResizing(tableRowResizeKey, view.state)) {
|
|
38
36
|
handleMouseMove(view, event, handleWidth);
|
|
39
37
|
}
|
|
40
38
|
return false;
|
|
41
39
|
},
|
|
42
|
-
mouseleave
|
|
40
|
+
mouseleave(view) {
|
|
43
41
|
handleMouseLeave(view);
|
|
44
42
|
return false;
|
|
45
43
|
},
|
|
46
|
-
mousedown
|
|
44
|
+
mousedown(view, event) {
|
|
47
45
|
return handleMouseDown(view, event);
|
|
48
46
|
}
|
|
49
47
|
},
|
|
50
|
-
decorations
|
|
51
|
-
if (otherResizing(
|
|
48
|
+
decorations(state) {
|
|
49
|
+
if (otherResizing(tableRowResizeKey, state)) {
|
|
52
50
|
return DecorationSet.empty;
|
|
53
51
|
}
|
|
54
|
-
|
|
52
|
+
const pluginState = tableRowResizeKey.getState(state);
|
|
55
53
|
if (pluginState.activeHandle > -1) {
|
|
56
54
|
return handleDecorations(state, pluginState.activeHandle);
|
|
57
55
|
}
|
|
@@ -64,13 +62,13 @@ export function rowResizing() {
|
|
|
64
62
|
function pointsAtCell($pos) {
|
|
65
63
|
return $pos.parent.type.spec.tableRole === 'row' && $pos.nodeAfter;
|
|
66
64
|
}
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
class ResizeState {
|
|
66
|
+
constructor(activeHandle, dragging) {
|
|
69
67
|
this.activeHandle = activeHandle;
|
|
70
68
|
this.dragging = dragging;
|
|
71
69
|
}
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
apply(tr) {
|
|
71
|
+
let state, action = tr.getMeta(tableRowResizeKey);
|
|
74
72
|
if (action && action.setHandle != null) {
|
|
75
73
|
return new ResizeState(action.setHandle, null);
|
|
76
74
|
}
|
|
@@ -78,24 +76,23 @@ var ResizeState = /** @class */ (function () {
|
|
|
78
76
|
return new ResizeState(this.activeHandle, action.setDragging);
|
|
79
77
|
}
|
|
80
78
|
if (this.activeHandle > -1) {
|
|
81
|
-
|
|
79
|
+
let handle = tr.mapping.map(this.activeHandle, -1);
|
|
82
80
|
if (!pointsAtCell(tr.doc.resolve(handle))) {
|
|
83
81
|
handle = null;
|
|
84
82
|
}
|
|
85
83
|
state = new ResizeState(handle, this.dragging);
|
|
86
84
|
}
|
|
87
85
|
return state || this;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
}());
|
|
86
|
+
}
|
|
87
|
+
}
|
|
91
88
|
function handleMouseMove(view, event, handleWidth) {
|
|
92
|
-
|
|
89
|
+
const pluginState = tableRowResizeKey.getState(view.state);
|
|
93
90
|
if (!pluginState.dragging) {
|
|
94
|
-
|
|
91
|
+
let target = domCellAround(event.target), cell = -1;
|
|
95
92
|
if (target) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
if (Math.abs(event.clientY -
|
|
93
|
+
const indexes = cellIndexes(target);
|
|
94
|
+
const { top, bottom } = target.getBoundingClientRect();
|
|
95
|
+
if (Math.abs(event.clientY - top) <= handleWidth && indexes.rowIndex > 0) {
|
|
99
96
|
indexes.rowIndex -= target.rowSpan;
|
|
100
97
|
cell = edgeCell(view, event, indexes);
|
|
101
98
|
}
|
|
@@ -109,39 +106,39 @@ function handleMouseMove(view, event, handleWidth) {
|
|
|
109
106
|
}
|
|
110
107
|
}
|
|
111
108
|
function handleMouseLeave(view) {
|
|
112
|
-
|
|
109
|
+
const pluginState = tableRowResizeKey.getState(view.state);
|
|
113
110
|
if (pluginState.activeHandle > -1 && !pluginState.dragging) {
|
|
114
111
|
updateHandle(view, -1);
|
|
115
112
|
}
|
|
116
113
|
}
|
|
117
114
|
function handleMouseDown(view, event) {
|
|
118
|
-
|
|
115
|
+
const pluginState = tableRowResizeKey.getState(view.state);
|
|
119
116
|
if (pluginState.activeHandle === -1 || pluginState.dragging) {
|
|
120
117
|
return false;
|
|
121
118
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
119
|
+
const doc = view.state.doc;
|
|
120
|
+
const $cell = doc.resolve(pluginState.activeHandle);
|
|
121
|
+
const row = $cell.parent;
|
|
122
|
+
const table = $cell.node(-1);
|
|
123
|
+
const rowHeightStr = parseStyle(row.attrs.style).height;
|
|
124
|
+
const tableHeight = parseStyle(table.attrs.style).height;
|
|
125
|
+
let rowHeight = rowHeightStr ? parseFloat(rowHeightStr) : 0;
|
|
129
126
|
if (!rowHeightStr) {
|
|
130
|
-
|
|
127
|
+
const tr = view.nodeDOM(pluginState.activeHandle);
|
|
131
128
|
rowHeight = tr.offsetHeight;
|
|
132
129
|
}
|
|
133
|
-
view.dispatch(view.state.tr.setMeta(
|
|
130
|
+
view.dispatch(view.state.tr.setMeta(tableRowResizeKey, {
|
|
134
131
|
setDragging: {
|
|
135
132
|
startY: event.clientY,
|
|
136
|
-
startHeight: { rowHeight
|
|
133
|
+
startHeight: { rowHeight, tableHeight }
|
|
137
134
|
}
|
|
138
135
|
}));
|
|
139
136
|
function finish(ev) {
|
|
140
137
|
ev.view.removeEventListener('mouseup', finish);
|
|
141
138
|
ev.view.removeEventListener('mousemove', move);
|
|
142
|
-
|
|
139
|
+
const curPluginState = tableRowResizeKey.getState(view.state);
|
|
143
140
|
if (curPluginState.dragging) {
|
|
144
|
-
|
|
141
|
+
const tr = view.state.tr.setMeta(tableRowResizeKey, { setDragging: null });
|
|
145
142
|
updateRowHeight(view, tr, curPluginState.activeHandle);
|
|
146
143
|
view.dispatch(tr);
|
|
147
144
|
}
|
|
@@ -150,9 +147,9 @@ function handleMouseDown(view, event) {
|
|
|
150
147
|
if (!ev.which) {
|
|
151
148
|
return finish(ev);
|
|
152
149
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
150
|
+
const curPluginState = tableRowResizeKey.getState(view.state);
|
|
151
|
+
const dragged = draggedHeight(curPluginState.dragging, ev);
|
|
152
|
+
const offset = ev.clientY - curPluginState.dragging.startY;
|
|
156
153
|
displayRowHeight(view, curPluginState.activeHandle, dragged, offset, tableHeight);
|
|
157
154
|
}
|
|
158
155
|
event.view.addEventListener('mouseup', finish);
|
|
@@ -161,42 +158,42 @@ function handleMouseDown(view, event) {
|
|
|
161
158
|
return true;
|
|
162
159
|
}
|
|
163
160
|
function draggedHeight(dragging, event) {
|
|
164
|
-
|
|
161
|
+
const offset = event.clientY - dragging.startY;
|
|
165
162
|
return dragging.startHeight.rowHeight + offset;
|
|
166
163
|
}
|
|
167
164
|
function updateHandle(view, value) {
|
|
168
|
-
|
|
165
|
+
const tr = view.state.tr;
|
|
169
166
|
tr.setMeta('addToHistory', false);
|
|
170
|
-
tr.setMeta(
|
|
167
|
+
tr.setMeta(tableRowResizeKey, { setHandle: value });
|
|
171
168
|
view.dispatch(tr);
|
|
172
169
|
}
|
|
173
170
|
function updateRowHeight(view, tr, cellPos) {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
171
|
+
const doc = view.state.doc;
|
|
172
|
+
const $cell = doc.resolve(cellPos);
|
|
173
|
+
const row = $cell.parent;
|
|
174
|
+
const rowPos = $cell.posAtIndex(0) - 1;
|
|
175
|
+
const dom = view.nodeDOM(rowPos);
|
|
176
|
+
const win = (dom.ownerDocument && dom.ownerDocument.defaultView) || window;
|
|
180
177
|
dom.style.height = win.getComputedStyle(dom).height;
|
|
181
178
|
tr.setNodeMarkup(rowPos, null, setNodeStyle(row.attrs, 'height', dom.style.height));
|
|
182
|
-
|
|
183
|
-
|
|
179
|
+
const table = dom && dom.closest('table');
|
|
180
|
+
const tableHeight = table && table.style.height;
|
|
184
181
|
if (tableHeight) {
|
|
185
|
-
|
|
186
|
-
|
|
182
|
+
const $pos = doc.resolve(rowPos);
|
|
183
|
+
const tablePos = $pos.start($pos.depth) - 1;
|
|
187
184
|
tr.setNodeMarkup(tablePos, null, setNodeStyle($pos.parent.attrs, 'height', tableHeight));
|
|
188
185
|
}
|
|
189
186
|
}
|
|
190
187
|
function displayRowHeight(view, cellPos, height, offset, tableHeight) {
|
|
191
|
-
|
|
192
|
-
|
|
188
|
+
const cell = view.nodeDOM(cellPos);
|
|
189
|
+
const row = cell && cell.parentNode;
|
|
193
190
|
if (row) {
|
|
194
191
|
row.style.height = height + 'px';
|
|
195
|
-
|
|
192
|
+
const win = (row.ownerDocument && row.ownerDocument.defaultView) || window;
|
|
196
193
|
row.style.height = win.getComputedStyle(row).height;
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
194
|
+
const table = row.closest('table');
|
|
195
|
+
const newHeight = (parseFloat(tableHeight) + offset) + 'px';
|
|
196
|
+
const current = table && table.style.height;
|
|
200
197
|
if (current && current !== newHeight) {
|
|
201
198
|
table.style.height = (parseFloat(tableHeight) + offset) + 'px';
|
|
202
199
|
table.style.height = win.getComputedStyle(table).height;
|
|
@@ -204,32 +201,34 @@ function displayRowHeight(view, cellPos, height, offset, tableHeight) {
|
|
|
204
201
|
}
|
|
205
202
|
}
|
|
206
203
|
function handleDecorations(state, cell) {
|
|
207
|
-
|
|
204
|
+
const decorations = [];
|
|
208
205
|
if (typeof cell !== 'number') {
|
|
209
206
|
return DecorationSet.empty;
|
|
210
207
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
for (
|
|
208
|
+
const $cell = state.doc.resolve(cell), table = $cell.node(-1), map = TableMap.get(table), start = $cell.start(-1);
|
|
209
|
+
const cellsPositions = [];
|
|
210
|
+
const cellPos = cell - start;
|
|
211
|
+
let rowIndex = -1;
|
|
212
|
+
for (let i = 0; i < map.height; i++) {
|
|
216
213
|
cellsPositions.push(map.map.slice(i * map.width, (i * map.width) + map.width));
|
|
217
214
|
if (cellsPositions[i].indexOf(cellPos) !== -1) {
|
|
218
215
|
rowIndex = i;
|
|
219
216
|
}
|
|
220
217
|
}
|
|
221
|
-
|
|
222
|
-
cellsPositions[rowIndex].forEach(
|
|
218
|
+
const cells = [];
|
|
219
|
+
cellsPositions[rowIndex].forEach((c, i) => {
|
|
223
220
|
if (!cellsPositions[rowIndex + 1] || c !== cellsPositions[rowIndex + 1][i]) {
|
|
224
221
|
cells.push(c);
|
|
225
222
|
}
|
|
226
223
|
});
|
|
227
|
-
cells.forEach(
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
224
|
+
cells.forEach((cPos) => {
|
|
225
|
+
const cellNode = table.nodeAt(cPos);
|
|
226
|
+
const widgetPos = start + cPos + (cellNode ? cellNode.nodeSize : 0) - 1;
|
|
227
|
+
const dom = document.createElement('div');
|
|
231
228
|
dom.className = 'row-resize-handle';
|
|
232
229
|
decorations.push(Decoration.widget(widgetPos, dom));
|
|
233
230
|
});
|
|
234
231
|
return DecorationSet.create(state.doc, decorations);
|
|
235
232
|
}
|
|
233
|
+
|
|
234
|
+
export { rowResizing };
|