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