@progress/kendo-editor-common 1.12.2-develop.5 → 1.12.2-develop.6
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/js/kendo-editor-common.js +1 -1
- package/dist/cdn/main.js +1 -1
- package/dist/es/DOMSerializer.js +6 -7
- package/dist/es/align.js +3 -6
- package/dist/es/blockNode.js +11 -14
- package/dist/es/blockquote.js +2 -5
- package/dist/es/cleanFormatting.js +3 -6
- package/dist/es/config/align-rules.js +5 -7
- package/dist/es/config/commands.js +13 -9
- package/dist/es/config/constants.js +7 -9
- package/dist/es/config/indent-rules.js +3 -6
- package/dist/es/config/keymap.js +7 -10
- package/dist/es/config/list-settings.js +3 -5
- package/dist/es/config/schema.js +4 -6
- package/dist/es/find-replace.js +8 -10
- package/dist/es/flatten-spans.js +2 -5
- package/dist/es/image.js +2 -5
- package/dist/es/indent.js +11 -14
- package/dist/es/inline-style.js +10 -12
- package/dist/es/link.js +5 -8
- package/dist/es/listConvert.js +8 -9
- package/dist/es/lists.js +12 -15
- package/dist/es/main.js +34 -33
- package/dist/es/mark.js +16 -17
- package/dist/es/paste.js +10 -13
- package/dist/es/plugins/caret-color.js +5 -8
- package/dist/es/plugins/csp-fix.js +2 -5
- package/dist/es/plugins/highlight.js +3 -6
- package/dist/es/plugins/image-resize.js +8 -11
- package/dist/es/plugins/list-markers-styles.js +2 -5
- package/dist/es/plugins/placeholder.js +2 -5
- package/dist/es/plugins/resize-utils.js +2 -4
- package/dist/es/plugins/spaces-fix.js +1 -4
- package/dist/es/plugins/table-resize/column-resize.js +21 -24
- package/dist/es/plugins/table-resize/index.js +6 -9
- package/dist/es/plugins/table-resize/row-resize.js +23 -24
- package/dist/es/plugins/table-resize/table-resize.js +17 -20
- package/dist/es/plugins/table-resize/table-view.js +6 -9
- package/dist/es/plugins/table-resize/utils.js +10 -13
- package/dist/es/source.js +15 -18
- package/dist/es/table.js +15 -18
- package/dist/es/text.js +1 -3
- package/dist/es/types/active-marks.js +1 -0
- package/dist/es/types/command.js +1 -0
- package/dist/es/types/dispatchFn.js +1 -0
- package/dist/es/types/paste-cleanup-settings.js +1 -0
- package/dist/es/types/predicate.js +1 -0
- package/dist/es/utils.js +18 -21
- package/dist/npm/DOMSerializer.d.ts +35 -0
- package/dist/npm/DOMSerializer.js +10 -9
- package/dist/npm/align.d.ts +4 -7
- package/dist/npm/align.js +9 -10
- package/dist/npm/blockNode.d.ts +15 -12
- package/dist/npm/blockNode.js +28 -29
- package/dist/npm/blockquote.d.ts +2 -5
- package/dist/npm/blockquote.js +6 -7
- package/dist/npm/cleanFormatting.d.ts +3 -6
- package/dist/npm/cleanFormatting.js +7 -8
- package/dist/npm/config/align-rules.d.ts +6 -8
- package/dist/npm/config/align-rules.js +8 -13
- package/dist/npm/config/commands.d.ts +19 -11
- package/dist/npm/config/commands.js +16 -17
- package/dist/npm/config/constants.d.ts +7 -0
- package/dist/npm/config/constants.js +10 -17
- package/dist/npm/config/indent-rules.d.ts +4 -6
- package/dist/npm/config/indent-rules.js +8 -11
- package/dist/npm/config/keymap.d.ts +2 -5
- package/dist/npm/config/keymap.js +21 -22
- package/dist/npm/config/list-settings.d.ts +30 -0
- package/dist/npm/config/list-settings.js +10 -13
- package/dist/npm/config/schema.d.ts +2 -3
- package/dist/npm/config/schema.js +19 -20
- package/dist/npm/find-replace.d.ts +7 -10
- package/dist/npm/find-replace.js +20 -20
- package/dist/npm/flatten-spans.d.ts +1 -3
- package/dist/npm/flatten-spans.js +6 -7
- package/dist/npm/image.d.ts +3 -6
- package/dist/npm/image.js +5 -6
- package/dist/npm/indent.d.ts +9 -12
- package/dist/npm/indent.js +37 -38
- package/dist/npm/inline-style.d.ts +4 -7
- package/dist/npm/inline-style.js +28 -28
- package/dist/npm/link.d.ts +2 -4
- package/dist/npm/link.js +21 -22
- package/dist/npm/listConvert.d.ts +1 -3
- package/dist/npm/listConvert.js +13 -12
- package/dist/npm/lists.d.ts +8 -8
- package/dist/npm/lists.js +26 -27
- package/dist/npm/main.d.ts +34 -35
- package/dist/npm/main.js +214 -391
- package/dist/npm/mark.d.ts +17 -12
- package/dist/npm/mark.js +30 -29
- package/dist/npm/paste.d.ts +8 -11
- package/dist/npm/paste.js +19 -20
- package/dist/npm/plugins/caret-color.d.ts +2 -5
- package/dist/npm/plugins/caret-color.js +15 -17
- package/dist/npm/plugins/csp-fix.d.ts +1 -4
- package/dist/npm/plugins/csp-fix.js +8 -9
- package/dist/npm/plugins/highlight.d.ts +4 -7
- package/dist/npm/plugins/highlight.js +11 -13
- package/dist/npm/plugins/image-resize.d.ts +5 -7
- package/dist/npm/plugins/image-resize.js +35 -37
- package/dist/npm/plugins/list-markers-styles.d.ts +2 -5
- package/dist/npm/plugins/list-markers-styles.js +14 -16
- package/dist/npm/plugins/placeholder.d.ts +1 -4
- package/dist/npm/plugins/placeholder.js +10 -12
- package/dist/npm/plugins/resize-utils.d.ts +35 -0
- package/dist/npm/plugins/resize-utils.js +5 -7
- package/dist/npm/plugins/spaces-fix.d.ts +1 -4
- package/dist/npm/plugins/spaces-fix.js +9 -10
- package/dist/npm/plugins/table-resize/column-resize.d.ts +2 -0
- package/dist/npm/plugins/table-resize/column-resize.js +44 -46
- package/dist/npm/plugins/table-resize/index.d.ts +2 -5
- package/dist/npm/plugins/table-resize/index.js +13 -14
- package/dist/npm/plugins/table-resize/row-resize.d.ts +2 -0
- package/dist/npm/plugins/table-resize/row-resize.js +40 -40
- package/dist/npm/plugins/table-resize/table-resize.d.ts +18 -0
- package/dist/npm/plugins/table-resize/table-resize.js +51 -52
- package/dist/npm/plugins/table-resize/table-view.d.ts +28 -0
- package/dist/npm/plugins/table-resize/table-view.js +23 -24
- package/dist/npm/plugins/table-resize/utils.d.ts +17 -7
- package/dist/npm/plugins/table-resize/utils.js +24 -28
- package/dist/npm/source.d.ts +13 -16
- package/dist/npm/source.js +35 -36
- package/dist/npm/table.d.ts +9 -10
- package/dist/npm/table.js +33 -49
- package/dist/npm/text.d.ts +3 -6
- package/dist/npm/text.js +3 -3
- package/dist/npm/types/active-marks.d.ts +1 -4
- package/dist/npm/types/active-marks.js +2 -0
- package/dist/npm/types/command.d.ts +2 -5
- package/dist/npm/types/command.js +2 -0
- package/dist/npm/types/dispatchFn.d.ts +1 -4
- package/dist/npm/types/dispatchFn.js +2 -0
- package/dist/npm/types/paste-cleanup-settings.d.ts +1 -3
- package/dist/npm/types/paste-cleanup-settings.js +2 -0
- package/dist/npm/types/predicate.d.ts +1 -0
- package/dist/npm/types/predicate.js +2 -0
- package/dist/npm/utils.d.ts +33 -14
- package/dist/npm/utils.js +38 -39
- package/package.json +3 -50
- package/dist/es2015/DOMSerializer.js +0 -184
- package/dist/es2015/align.js +0 -43
- package/dist/es2015/blockNode.js +0 -180
- package/dist/es2015/blockquote.js +0 -26
- package/dist/es2015/cleanFormatting.js +0 -20
- package/dist/es2015/config/align-rules.js +0 -30
- package/dist/es2015/config/commands.js +0 -50
- package/dist/es2015/config/constants.js +0 -9
- package/dist/es2015/config/indent-rules.js +0 -42
- package/dist/es2015/config/keymap.js +0 -51
- package/dist/es2015/config/list-settings.js +0 -21
- package/dist/es2015/config/schema.js +0 -314
- package/dist/es2015/find-replace.js +0 -122
- package/dist/es2015/flatten-spans.js +0 -112
- package/dist/es2015/image.js +0 -10
- package/dist/es2015/indent.js +0 -105
- package/dist/es2015/inline-style.js +0 -177
- package/dist/es2015/link.js +0 -105
- package/dist/es2015/listConvert.js +0 -184
- package/dist/es2015/lists.js +0 -266
- package/dist/es2015/main.js +0 -44
- package/dist/es2015/mark.js +0 -239
- package/dist/es2015/node_modules/tslib/tslib.es6.js +0 -35
- package/dist/es2015/paste.js +0 -162
- package/dist/es2015/plugins/caret-color.js +0 -34
- package/dist/es2015/plugins/csp-fix.js +0 -51
- package/dist/es2015/plugins/highlight.js +0 -23
- package/dist/es2015/plugins/image-resize.js +0 -225
- package/dist/es2015/plugins/list-markers-styles.js +0 -104
- package/dist/es2015/plugins/placeholder.js +0 -27
- package/dist/es2015/plugins/resize-utils.js +0 -13
- package/dist/es2015/plugins/spaces-fix.js +0 -46
- package/dist/es2015/plugins/table-resize/column-resize.js +0 -267
- package/dist/es2015/plugins/table-resize/index.js +0 -12
- package/dist/es2015/plugins/table-resize/row-resize.js +0 -234
- package/dist/es2015/plugins/table-resize/table-resize.js +0 -278
- package/dist/es2015/plugins/table-resize/table-view.js +0 -128
- package/dist/es2015/plugins/table-resize/utils.js +0 -93
- package/dist/es2015/source.js +0 -251
- package/dist/es2015/table.js +0 -132
- package/dist/es2015/text.js +0 -5
- package/dist/es2015/utils.js +0 -289
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
declare const tableResizing: () => prosemirror_state.Plugin<any>[];
|
|
4
|
-
|
|
5
|
-
export { tableResizing };
|
|
1
|
+
export declare const tableResizing: () => import("prosemirror-state").Plugin<any>[];
|
|
2
|
+
export { tableResizeKey, tableColumnResizeKey, tableRowResizeKey } from './utils';
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tableRowResizeKey = exports.tableColumnResizeKey = exports.tableResizeKey = exports.tableResizing = void 0;
|
|
4
|
+
const column_resize_1 = require("./column-resize");
|
|
5
|
+
const table_resize_1 = require("./table-resize");
|
|
6
|
+
const row_resize_1 = require("./row-resize");
|
|
8
7
|
const tableResizing = () => [
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
(0, table_resize_1.tableResizing)(),
|
|
9
|
+
(0, column_resize_1.columnResizing)(),
|
|
10
|
+
(0, row_resize_1.rowResizing)()
|
|
12
11
|
];
|
|
13
|
-
|
|
14
|
-
exports.tableColumnResizeKey = utils.tableColumnResizeKey;
|
|
15
|
-
exports.tableResizeKey = utils.tableResizeKey;
|
|
16
|
-
exports.tableRowResizeKey = utils.tableRowResizeKey;
|
|
17
12
|
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; } });
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rowResizing = rowResizing;
|
|
4
|
+
const prosemirror_state_1 = require("prosemirror-state");
|
|
5
|
+
const prosemirror_tables_1 = require("prosemirror-tables");
|
|
6
|
+
const prosemirror_view_1 = require("prosemirror-view");
|
|
7
|
+
const utils_1 = require("./utils");
|
|
8
|
+
const utils_2 = require("./../../utils");
|
|
9
9
|
class TableRowView {
|
|
10
10
|
ignoreMutation(record) {
|
|
11
11
|
return record.type === 'attributes' && record.attributeName === 'style' && record.target.nodeName === 'TR';
|
|
@@ -13,11 +13,11 @@ class TableRowView {
|
|
|
13
13
|
}
|
|
14
14
|
function rowResizing() {
|
|
15
15
|
const handleWidth = 5;
|
|
16
|
-
const plugin = new
|
|
17
|
-
key:
|
|
16
|
+
const plugin = new prosemirror_state_1.Plugin({
|
|
17
|
+
key: utils_1.tableRowResizeKey,
|
|
18
18
|
state: {
|
|
19
19
|
init(_, state) {
|
|
20
|
-
this.spec.props.nodeViews[
|
|
20
|
+
this.spec.props.nodeViews[(0, prosemirror_tables_1.tableNodeTypes)(state.schema).row.name] = () => new TableRowView();
|
|
21
21
|
return new ResizeState(-1, null);
|
|
22
22
|
},
|
|
23
23
|
apply(tr, prev) {
|
|
@@ -26,15 +26,15 @@ function rowResizing() {
|
|
|
26
26
|
},
|
|
27
27
|
props: {
|
|
28
28
|
attributes(state) {
|
|
29
|
-
if (
|
|
29
|
+
if ((0, utils_1.otherResizeHandle)(utils_1.tableRowResizeKey, state)) {
|
|
30
30
|
return null;
|
|
31
31
|
}
|
|
32
|
-
const pluginState =
|
|
32
|
+
const pluginState = utils_1.tableRowResizeKey.getState(state);
|
|
33
33
|
return pluginState.activeHandle > -1 ? { class: 'resize-cursor-vertical' } : null;
|
|
34
34
|
},
|
|
35
35
|
handleDOMEvents: {
|
|
36
36
|
mousemove(view, event) {
|
|
37
|
-
if (!
|
|
37
|
+
if (!(0, utils_1.otherResizing)(utils_1.tableRowResizeKey, view.state)) {
|
|
38
38
|
handleMouseMove(view, event, handleWidth);
|
|
39
39
|
}
|
|
40
40
|
return false;
|
|
@@ -48,10 +48,10 @@ function rowResizing() {
|
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
decorations(state) {
|
|
51
|
-
if (
|
|
52
|
-
return
|
|
51
|
+
if ((0, utils_1.otherResizing)(utils_1.tableRowResizeKey, state)) {
|
|
52
|
+
return prosemirror_view_1.DecorationSet.empty;
|
|
53
53
|
}
|
|
54
|
-
const pluginState =
|
|
54
|
+
const pluginState = utils_1.tableRowResizeKey.getState(state);
|
|
55
55
|
if (pluginState.activeHandle > -1) {
|
|
56
56
|
return handleDecorations(state, pluginState.activeHandle);
|
|
57
57
|
}
|
|
@@ -70,7 +70,8 @@ class ResizeState {
|
|
|
70
70
|
this.dragging = dragging;
|
|
71
71
|
}
|
|
72
72
|
apply(tr) {
|
|
73
|
-
let state
|
|
73
|
+
let state;
|
|
74
|
+
const action = tr.getMeta(utils_1.tableRowResizeKey);
|
|
74
75
|
if (action && action.setHandle != null) {
|
|
75
76
|
return new ResizeState(action.setHandle, null);
|
|
76
77
|
}
|
|
@@ -88,18 +89,19 @@ class ResizeState {
|
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
91
|
function handleMouseMove(view, event, handleWidth) {
|
|
91
|
-
const pluginState =
|
|
92
|
+
const pluginState = utils_1.tableRowResizeKey.getState(view.state);
|
|
92
93
|
if (!pluginState.dragging) {
|
|
93
|
-
|
|
94
|
+
const target = (0, utils_1.domCellAround)(event.target);
|
|
95
|
+
let cell = -1;
|
|
94
96
|
if (target) {
|
|
95
|
-
const indexes =
|
|
97
|
+
const indexes = (0, utils_1.cellIndexes)(target);
|
|
96
98
|
const { top, bottom } = target.getBoundingClientRect();
|
|
97
99
|
if (Math.abs(event.clientY - top) <= handleWidth && indexes.rowIndex > 0) {
|
|
98
100
|
indexes.rowIndex -= target.rowSpan;
|
|
99
|
-
cell =
|
|
101
|
+
cell = (0, utils_1.edgeCell)(view, event, indexes);
|
|
100
102
|
}
|
|
101
103
|
else if (bottom - event.clientY > 0 && bottom - event.clientY <= handleWidth) {
|
|
102
|
-
cell =
|
|
104
|
+
cell = (0, utils_1.edgeCell)(view, event, indexes);
|
|
103
105
|
}
|
|
104
106
|
}
|
|
105
107
|
if (cell !== pluginState.activeHandle) {
|
|
@@ -108,13 +110,13 @@ function handleMouseMove(view, event, handleWidth) {
|
|
|
108
110
|
}
|
|
109
111
|
}
|
|
110
112
|
function handleMouseLeave(view) {
|
|
111
|
-
const pluginState =
|
|
113
|
+
const pluginState = utils_1.tableRowResizeKey.getState(view.state);
|
|
112
114
|
if (pluginState.activeHandle > -1 && !pluginState.dragging) {
|
|
113
115
|
updateHandle(view, -1);
|
|
114
116
|
}
|
|
115
117
|
}
|
|
116
118
|
function handleMouseDown(view, event) {
|
|
117
|
-
const pluginState =
|
|
119
|
+
const pluginState = utils_1.tableRowResizeKey.getState(view.state);
|
|
118
120
|
if (pluginState.activeHandle === -1 || pluginState.dragging) {
|
|
119
121
|
return false;
|
|
120
122
|
}
|
|
@@ -122,14 +124,14 @@ function handleMouseDown(view, event) {
|
|
|
122
124
|
const $cell = doc.resolve(pluginState.activeHandle);
|
|
123
125
|
const row = $cell.parent;
|
|
124
126
|
const table = $cell.node(-1);
|
|
125
|
-
const rowHeightStr =
|
|
126
|
-
const tableHeight =
|
|
127
|
+
const rowHeightStr = (0, utils_2.parseStyle)(row.attrs.style).height;
|
|
128
|
+
const tableHeight = (0, utils_2.parseStyle)(table.attrs.style).height;
|
|
127
129
|
let rowHeight = rowHeightStr ? parseFloat(rowHeightStr) : 0;
|
|
128
130
|
if (!rowHeightStr) {
|
|
129
131
|
const tr = view.nodeDOM(pluginState.activeHandle);
|
|
130
132
|
rowHeight = tr.offsetHeight;
|
|
131
133
|
}
|
|
132
|
-
view.dispatch(view.state.tr.setMeta(
|
|
134
|
+
view.dispatch(view.state.tr.setMeta(utils_1.tableRowResizeKey, {
|
|
133
135
|
setDragging: {
|
|
134
136
|
startY: event.clientY,
|
|
135
137
|
startHeight: { rowHeight, tableHeight }
|
|
@@ -138,9 +140,9 @@ function handleMouseDown(view, event) {
|
|
|
138
140
|
function finish(ev) {
|
|
139
141
|
ev.view.removeEventListener('mouseup', finish);
|
|
140
142
|
ev.view.removeEventListener('mousemove', move);
|
|
141
|
-
const curPluginState =
|
|
143
|
+
const curPluginState = utils_1.tableRowResizeKey.getState(view.state);
|
|
142
144
|
if (curPluginState.dragging) {
|
|
143
|
-
const tr = view.state.tr.setMeta(
|
|
145
|
+
const tr = view.state.tr.setMeta(utils_1.tableRowResizeKey, { setDragging: null });
|
|
144
146
|
updateRowHeight(view, tr, curPluginState.activeHandle);
|
|
145
147
|
view.dispatch(tr);
|
|
146
148
|
}
|
|
@@ -149,7 +151,7 @@ function handleMouseDown(view, event) {
|
|
|
149
151
|
if (!ev.which) {
|
|
150
152
|
return finish(ev);
|
|
151
153
|
}
|
|
152
|
-
const curPluginState =
|
|
154
|
+
const curPluginState = utils_1.tableRowResizeKey.getState(view.state);
|
|
153
155
|
const dragged = draggedHeight(curPluginState.dragging, ev);
|
|
154
156
|
const offset = ev.clientY - curPluginState.dragging.startY;
|
|
155
157
|
displayRowHeight(view, curPluginState.activeHandle, dragged, offset, tableHeight);
|
|
@@ -166,7 +168,7 @@ function draggedHeight(dragging, event) {
|
|
|
166
168
|
function updateHandle(view, value) {
|
|
167
169
|
const tr = view.state.tr;
|
|
168
170
|
tr.setMeta('addToHistory', false);
|
|
169
|
-
tr.setMeta(
|
|
171
|
+
tr.setMeta(utils_1.tableRowResizeKey, { setHandle: value });
|
|
170
172
|
view.dispatch(tr);
|
|
171
173
|
}
|
|
172
174
|
function updateRowHeight(view, tr, cellPos) {
|
|
@@ -177,13 +179,13 @@ function updateRowHeight(view, tr, cellPos) {
|
|
|
177
179
|
const dom = view.nodeDOM(rowPos);
|
|
178
180
|
const win = (dom.ownerDocument && dom.ownerDocument.defaultView) || window;
|
|
179
181
|
dom.style.height = win.getComputedStyle(dom).height;
|
|
180
|
-
tr.setNodeMarkup(rowPos, null,
|
|
182
|
+
tr.setNodeMarkup(rowPos, null, (0, utils_2.setNodeStyle)(row.attrs, 'height', dom.style.height));
|
|
181
183
|
const table = dom && dom.closest('table');
|
|
182
184
|
const tableHeight = table && table.style.height;
|
|
183
185
|
if (tableHeight) {
|
|
184
186
|
const $pos = doc.resolve(rowPos);
|
|
185
187
|
const tablePos = $pos.start($pos.depth) - 1;
|
|
186
|
-
tr.setNodeMarkup(tablePos, null,
|
|
188
|
+
tr.setNodeMarkup(tablePos, null, (0, utils_2.setNodeStyle)($pos.parent.attrs, 'height', tableHeight));
|
|
187
189
|
}
|
|
188
190
|
}
|
|
189
191
|
function displayRowHeight(view, cellPos, height, offset, tableHeight) {
|
|
@@ -205,9 +207,9 @@ function displayRowHeight(view, cellPos, height, offset, tableHeight) {
|
|
|
205
207
|
function handleDecorations(state, cell) {
|
|
206
208
|
const decorations = [];
|
|
207
209
|
if (typeof cell !== 'number') {
|
|
208
|
-
return
|
|
210
|
+
return prosemirror_view_1.DecorationSet.empty;
|
|
209
211
|
}
|
|
210
|
-
const $cell = state.doc.resolve(cell), table = $cell.node(-1), map =
|
|
212
|
+
const $cell = state.doc.resolve(cell), table = $cell.node(-1), map = prosemirror_tables_1.TableMap.get(table), start = $cell.start(-1);
|
|
211
213
|
const cellsPositions = [];
|
|
212
214
|
const cellPos = cell - start;
|
|
213
215
|
let rowIndex = -1;
|
|
@@ -228,9 +230,7 @@ function handleDecorations(state, cell) {
|
|
|
228
230
|
const widgetPos = start + cPos + (cellNode ? cellNode.nodeSize : 0) - 1;
|
|
229
231
|
const dom = document.createElement('div');
|
|
230
232
|
dom.className = 'row-resize-handle';
|
|
231
|
-
decorations.push(
|
|
233
|
+
decorations.push(prosemirror_view_1.Decoration.widget(widgetPos, dom));
|
|
232
234
|
});
|
|
233
|
-
return
|
|
235
|
+
return prosemirror_view_1.DecorationSet.create(state.doc, decorations);
|
|
234
236
|
}
|
|
235
|
-
|
|
236
|
-
exports.rowResizing = rowResizing;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Plugin, Transaction } from 'prosemirror-state';
|
|
2
|
+
declare class ResizeState {
|
|
3
|
+
activeHandle: string;
|
|
4
|
+
dragging: {
|
|
5
|
+
startX: number;
|
|
6
|
+
startY: number;
|
|
7
|
+
} | null;
|
|
8
|
+
nodePosition: number;
|
|
9
|
+
constructor(activeHandle: string, dragging: {
|
|
10
|
+
startX: number;
|
|
11
|
+
startY: number;
|
|
12
|
+
} | null, nodePosition: number);
|
|
13
|
+
apply(tr: Transaction): ResizeState;
|
|
14
|
+
}
|
|
15
|
+
export declare const tableResizing: (options?: {
|
|
16
|
+
node: string;
|
|
17
|
+
}) => Plugin<ResizeState>;
|
|
18
|
+
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tableResizing = void 0;
|
|
4
|
+
const prosemirror_state_1 = require("prosemirror-state");
|
|
5
|
+
const constants_1 = require("../../config/constants");
|
|
6
|
+
const utils_1 = require("./utils");
|
|
7
|
+
const utils_2 = require("./../../utils");
|
|
8
|
+
const resize_utils_1 = require("./../resize-utils");
|
|
9
9
|
const commonDir = {
|
|
10
10
|
'southeast': true,
|
|
11
11
|
'southwest': true,
|
|
@@ -29,7 +29,7 @@ class ResizeState {
|
|
|
29
29
|
this.nodePosition = nodePosition;
|
|
30
30
|
}
|
|
31
31
|
apply(tr) {
|
|
32
|
-
const next = tr.getMeta(
|
|
32
|
+
const next = tr.getMeta(utils_1.tableResizeKey);
|
|
33
33
|
if (next) {
|
|
34
34
|
const nextState = new ResizeState(next.activeHandle, next.setDragging, next.nodePosition);
|
|
35
35
|
return nextState;
|
|
@@ -39,14 +39,14 @@ class ResizeState {
|
|
|
39
39
|
}
|
|
40
40
|
const handleMouseMove = (view, event) => {
|
|
41
41
|
var _a;
|
|
42
|
-
const state =
|
|
42
|
+
const state = utils_1.tableResizeKey.getState(view.state);
|
|
43
43
|
const { dragging, nodePosition, activeHandle } = state;
|
|
44
44
|
if (nodePosition < 0 || !dragging) {
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
|
-
const tableDom =
|
|
47
|
+
const tableDom = (0, utils_1.getTable)(view.nodeDOM(nodePosition));
|
|
48
48
|
const rect = tableDom.getBoundingClientRect();
|
|
49
|
-
const dir =
|
|
49
|
+
const dir = resize_utils_1.directions[activeHandle];
|
|
50
50
|
const diffX = (event.clientX - dragging.startX) * dir.x;
|
|
51
51
|
const diffY = (event.clientY - dragging.startY) * dir.y;
|
|
52
52
|
const win = (tableDom.ownerDocument && tableDom.ownerDocument.defaultView) || window;
|
|
@@ -72,7 +72,7 @@ const handleMouseMove = (view, event) => {
|
|
|
72
72
|
};
|
|
73
73
|
const toPercents = (view, tr, tablePos) => {
|
|
74
74
|
const tableNode = view.state.doc.nodeAt(tablePos);
|
|
75
|
-
const tableDom =
|
|
75
|
+
const tableDom = (0, utils_1.getTable)(view.nodeDOM(tablePos));
|
|
76
76
|
const { width, height, colsWidth, rowsHeight, offsetWidth, offsetHeight } = tableSize(tableDom);
|
|
77
77
|
const colgroup = tableDom.firstChild;
|
|
78
78
|
const cols = Array.from((colgroup && colgroup.children) || []);
|
|
@@ -85,21 +85,21 @@ const toPercents = (view, tr, tablePos) => {
|
|
|
85
85
|
});
|
|
86
86
|
let heightChange = false;
|
|
87
87
|
tableNode.forEach((row, offset, index) => {
|
|
88
|
-
const rowHeight =
|
|
88
|
+
const rowHeight = (0, utils_2.parseStyle)(row.attrs.style).height;
|
|
89
89
|
if (rowHeight && !/%$/.test(rowHeight)) {
|
|
90
|
-
tr.setNodeMarkup(tablePos + offset + 1, null,
|
|
90
|
+
tr.setNodeMarkup(tablePos + offset + 1, null, (0, utils_2.setNodeStyle)(row.attrs, 'height', (rowsHeight[index] * 100 / height) + '%'));
|
|
91
91
|
heightChange = true;
|
|
92
92
|
}
|
|
93
93
|
});
|
|
94
94
|
let tableAttrs = tableNode.attrs;
|
|
95
|
-
if (
|
|
96
|
-
tableAttrs =
|
|
95
|
+
if ((0, utils_2.parseStyle)(tableAttrs.style).width !== offsetWidth + 'px') {
|
|
96
|
+
tableAttrs = (0, utils_2.setNodeStyle)(tableAttrs, 'width', offsetWidth + 'px');
|
|
97
97
|
}
|
|
98
98
|
if (widthChanged) {
|
|
99
|
-
tableAttrs[
|
|
99
|
+
tableAttrs[constants_1.colgroupAttr] = colgroup.outerHTML;
|
|
100
100
|
}
|
|
101
101
|
if (heightChange) {
|
|
102
|
-
tableAttrs =
|
|
102
|
+
tableAttrs = (0, utils_2.setNodeStyle)(tableAttrs, 'height', offsetHeight + 'px');
|
|
103
103
|
}
|
|
104
104
|
if (widthChanged || heightChange) {
|
|
105
105
|
tr.setNodeMarkup(tablePos, null, tableAttrs);
|
|
@@ -107,14 +107,14 @@ const toPercents = (view, tr, tablePos) => {
|
|
|
107
107
|
};
|
|
108
108
|
const toPixels = (view, tr, tablePos, attrs) => {
|
|
109
109
|
const tableNode = view.state.doc.nodeAt(tablePos);
|
|
110
|
-
const tableDom =
|
|
110
|
+
const tableDom = (0, utils_1.getTable)(view.nodeDOM(tablePos));
|
|
111
111
|
const win = (tableDom.ownerDocument && tableDom.ownerDocument.defaultView) || window;
|
|
112
112
|
const calcStyle = win.getComputedStyle;
|
|
113
113
|
const rows = Array.from(tableDom.rows);
|
|
114
114
|
tableNode.forEach((row, offset, index) => {
|
|
115
|
-
const rowHeight =
|
|
115
|
+
const rowHeight = (0, utils_2.parseStyle)(row.attrs.style).height;
|
|
116
116
|
if (rowHeight && !/px$/.test(rowHeight)) {
|
|
117
|
-
tr.setNodeMarkup(tablePos + offset + 1, null,
|
|
117
|
+
tr.setNodeMarkup(tablePos + offset + 1, null, (0, utils_2.setNodeStyle)(row.attrs, 'height', calcStyle(rows[index]).height));
|
|
118
118
|
}
|
|
119
119
|
});
|
|
120
120
|
const colgroup = tableDom.firstChild;
|
|
@@ -128,7 +128,7 @@ const toPixels = (view, tr, tablePos, attrs) => {
|
|
|
128
128
|
});
|
|
129
129
|
const tableAttrs = { ...attrs };
|
|
130
130
|
if (widthChanged) {
|
|
131
|
-
tableAttrs[
|
|
131
|
+
tableAttrs[constants_1.colgroupAttr] = colgroup.outerHTML;
|
|
132
132
|
}
|
|
133
133
|
return tableAttrs;
|
|
134
134
|
};
|
|
@@ -143,37 +143,37 @@ const tableSize = (table) => {
|
|
|
143
143
|
return { width, height, colsWidth, rowsHeight, offsetWidth, offsetHeight };
|
|
144
144
|
};
|
|
145
145
|
const handleMouseUp = (view) => {
|
|
146
|
-
const { dragging, nodePosition, activeHandle } =
|
|
146
|
+
const { dragging, nodePosition, activeHandle } = utils_1.tableResizeKey.getState(view.state);
|
|
147
147
|
if (dragging) {
|
|
148
148
|
const node = view.state.doc.nodeAt(nodePosition);
|
|
149
|
-
const dom =
|
|
149
|
+
const dom = (0, utils_1.getTable)(view.nodeDOM(nodePosition));
|
|
150
150
|
const rect = tableSize(dom);
|
|
151
151
|
if (node) {
|
|
152
152
|
const width = rect.offsetWidth + 'px';
|
|
153
153
|
const height = rect.offsetHeight + 'px';
|
|
154
154
|
const tr = view.state.tr;
|
|
155
155
|
let attrs = node.attrs;
|
|
156
|
-
const parsedStyles =
|
|
156
|
+
const parsedStyles = (0, utils_2.parseStyle)(attrs.style);
|
|
157
157
|
if (horizontalDir[activeHandle] && dom.style.width && parsedStyles.width !== width) {
|
|
158
|
-
attrs =
|
|
158
|
+
attrs = (0, utils_2.setNodeStyle)(attrs, 'width', width);
|
|
159
159
|
}
|
|
160
160
|
if (verticalDir[activeHandle] && dom.style.height && parsedStyles.height !== height) {
|
|
161
|
-
attrs =
|
|
161
|
+
attrs = (0, utils_2.setNodeStyle)(attrs, 'height', height);
|
|
162
162
|
}
|
|
163
163
|
attrs = toPixels(view, tr, nodePosition, attrs);
|
|
164
164
|
tr.setNodeMarkup(nodePosition, null, attrs);
|
|
165
165
|
tr.setMeta('commandName', 'node-resize');
|
|
166
166
|
tr.setMeta('args', attrs);
|
|
167
|
-
tr.setMeta(
|
|
167
|
+
tr.setMeta(utils_1.tableResizeKey, {
|
|
168
168
|
setDragging: null,
|
|
169
169
|
activeHandle: null,
|
|
170
170
|
nodePosition
|
|
171
171
|
});
|
|
172
|
-
if (!/%/.test(
|
|
172
|
+
if (!/%/.test((0, utils_2.parseStyle)(attrs.style).width || '')) {
|
|
173
173
|
const $pos = tr.doc.resolve(nodePosition);
|
|
174
|
-
const wrapper =
|
|
175
|
-
if (wrapper && /%/.test(
|
|
176
|
-
const wrapperAttrs =
|
|
174
|
+
const wrapper = (0, utils_2.parentNode)($pos, n => n.type.name === 'table_wrapper');
|
|
175
|
+
if (wrapper && /%/.test((0, utils_2.parseStyle)(wrapper.node.attrs.style).width || '')) {
|
|
176
|
+
const wrapperAttrs = (0, utils_2.setNodeStyle)(wrapper.node.attrs, 'width', '');
|
|
177
177
|
const wrapperPos = $pos.start(wrapper.depth) - 1;
|
|
178
178
|
tr.setNodeMarkup(wrapperPos, null, wrapperAttrs);
|
|
179
179
|
}
|
|
@@ -184,14 +184,14 @@ const handleMouseUp = (view) => {
|
|
|
184
184
|
};
|
|
185
185
|
const handleMouseDown = (view, event) => {
|
|
186
186
|
const target = event.target;
|
|
187
|
-
const activeHandle = target.getAttribute(
|
|
187
|
+
const activeHandle = target.getAttribute(constants_1.dataResizeDirTable);
|
|
188
188
|
if (!activeHandle) {
|
|
189
189
|
return false;
|
|
190
190
|
}
|
|
191
|
-
const resizeState =
|
|
191
|
+
const resizeState = utils_1.tableResizeKey.getState(view.state);
|
|
192
192
|
event.preventDefault();
|
|
193
193
|
const transaction = view.state.tr;
|
|
194
|
-
transaction.setMeta(
|
|
194
|
+
transaction.setMeta(utils_1.tableResizeKey, {
|
|
195
195
|
setDragging: { startX: event.clientX, startY: event.clientY },
|
|
196
196
|
activeHandle,
|
|
197
197
|
nodePosition: resizeState.nodePosition
|
|
@@ -213,16 +213,16 @@ const handleMouseDown = (view, event) => {
|
|
|
213
213
|
return true;
|
|
214
214
|
};
|
|
215
215
|
const tableResizing = (options = { node: 'table' }) => {
|
|
216
|
-
return new
|
|
217
|
-
key:
|
|
216
|
+
return new prosemirror_state_1.Plugin({
|
|
217
|
+
key: utils_1.tableResizeKey,
|
|
218
218
|
view: () => ({
|
|
219
219
|
selectedNode(state, nodeType) {
|
|
220
220
|
const selection = state.selection;
|
|
221
|
-
const isNodeSelected = selection instanceof
|
|
222
|
-
if (isNodeSelected && selection instanceof
|
|
221
|
+
const isNodeSelected = selection instanceof prosemirror_state_1.NodeSelection && nodeType === selection.node.type;
|
|
222
|
+
if (isNodeSelected && selection instanceof prosemirror_state_1.NodeSelection) {
|
|
223
223
|
return { node: selection.node, pos: selection.from };
|
|
224
224
|
}
|
|
225
|
-
const parent =
|
|
225
|
+
const parent = (0, utils_2.parentNode)(selection.$from, (n) => n.type === nodeType);
|
|
226
226
|
const node = parent && parent.node;
|
|
227
227
|
if (node) {
|
|
228
228
|
const pos = selection.$from.start(parent.depth) - 1;
|
|
@@ -243,26 +243,26 @@ const tableResizing = (options = { node: 'table' }) => {
|
|
|
243
243
|
const tr = state.tr;
|
|
244
244
|
tr.setMeta('addToHistory', false);
|
|
245
245
|
if (selected && prevSelected && selected.pos !== prevSelected.pos) {
|
|
246
|
-
tr.setMeta(
|
|
246
|
+
tr.setMeta(utils_1.tableResizeKey, { nodePosition: selected.pos });
|
|
247
247
|
const prevNode = tr.doc.nodeAt(prevSelected.pos);
|
|
248
248
|
if (prevNode && prevNode.type.name === nodeType.name) {
|
|
249
|
-
tr.setNodeMarkup(prevSelected.pos, nodeType, { ...prevSelected.node.attrs, [
|
|
249
|
+
tr.setNodeMarkup(prevSelected.pos, nodeType, { ...prevSelected.node.attrs, [constants_1.resizableAttr]: false });
|
|
250
250
|
}
|
|
251
|
-
tr.setNodeMarkup(selected.pos, nodeType, { ...selected.node.attrs, [
|
|
251
|
+
tr.setNodeMarkup(selected.pos, nodeType, { ...selected.node.attrs, [constants_1.resizableAttr]: true });
|
|
252
252
|
view.dispatch(tr);
|
|
253
253
|
}
|
|
254
254
|
else if (selected && prevSelected && selected.pos === prevSelected.pos &&
|
|
255
|
-
!selected.node.attrs[
|
|
256
|
-
tr.setMeta(
|
|
257
|
-
view.dispatch(tr.setNodeMarkup(selected.pos, nodeType, { ...selected.node.attrs, [
|
|
255
|
+
!selected.node.attrs[constants_1.resizableAttr] && !state.selection.eq(prevState.selection)) {
|
|
256
|
+
tr.setMeta(utils_1.tableResizeKey, { nodePosition: selected.pos });
|
|
257
|
+
view.dispatch(tr.setNodeMarkup(selected.pos, nodeType, { ...selected.node.attrs, [constants_1.resizableAttr]: true }));
|
|
258
258
|
}
|
|
259
259
|
else if (selected && !prevSelected) {
|
|
260
|
-
tr.setMeta(
|
|
261
|
-
view.dispatch(tr.setNodeMarkup(selected.pos, nodeType, { ...selected.node.attrs, [
|
|
260
|
+
tr.setMeta(utils_1.tableResizeKey, { nodePosition: selected.pos });
|
|
261
|
+
view.dispatch(tr.setNodeMarkup(selected.pos, nodeType, { ...selected.node.attrs, [constants_1.resizableAttr]: true }));
|
|
262
262
|
}
|
|
263
263
|
else if (!selected && prevSelected) {
|
|
264
|
-
tr.setMeta(
|
|
265
|
-
view.dispatch(tr.setNodeMarkup(prevSelected.pos, nodeType, { ...prevSelected.node.attrs, [
|
|
264
|
+
tr.setMeta(utils_1.tableResizeKey, { nodePosition: -1 });
|
|
265
|
+
view.dispatch(tr.setNodeMarkup(prevSelected.pos, nodeType, { ...prevSelected.node.attrs, [constants_1.resizableAttr]: false }));
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
268
|
}
|
|
@@ -284,5 +284,4 @@ const tableResizing = (options = { node: 'table' }) => {
|
|
|
284
284
|
}
|
|
285
285
|
});
|
|
286
286
|
};
|
|
287
|
-
|
|
288
287
|
exports.tableResizing = tableResizing;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Node } from 'prosemirror-model';
|
|
2
|
+
import { EditorView, NodeView, ViewMutationRecord } from 'prosemirror-view';
|
|
3
|
+
export declare class TableView implements NodeView {
|
|
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: ViewMutationRecord): boolean;
|
|
14
|
+
destroy(): void;
|
|
15
|
+
private renderColgroup;
|
|
16
|
+
private setAttributes;
|
|
17
|
+
}
|
|
18
|
+
export declare class TableWrapperView implements NodeView {
|
|
19
|
+
node?: Node;
|
|
20
|
+
view?: EditorView;
|
|
21
|
+
dom: HTMLElement;
|
|
22
|
+
contentDOM?: HTMLElement;
|
|
23
|
+
constructor(node: Node, view: EditorView);
|
|
24
|
+
update(node: Node): boolean;
|
|
25
|
+
ignoreMutation(record: ViewMutationRecord): boolean;
|
|
26
|
+
destroy(): void;
|
|
27
|
+
private setAttributes;
|
|
28
|
+
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TableWrapperView = exports.TableView = void 0;
|
|
4
|
+
const constants_1 = require("../../config/constants");
|
|
5
|
+
const schema_1 = require("../../config/schema");
|
|
6
|
+
const resize_utils_1 = require("./../resize-utils");
|
|
7
|
+
const utils_1 = require("./../../utils");
|
|
8
8
|
class TableView {
|
|
9
9
|
constructor(node, view) {
|
|
10
10
|
this.node = node;
|
|
11
11
|
this.view = view;
|
|
12
12
|
this.dom = document.createElement('div');
|
|
13
|
-
this.dom.className =
|
|
13
|
+
this.dom.className = constants_1.resizableWrap;
|
|
14
14
|
this.table = this.dom.appendChild(document.createElement('table'));
|
|
15
|
-
if (node.attrs[
|
|
16
|
-
this.renderColgroup(node.attrs[
|
|
15
|
+
if (node.attrs[constants_1.colgroupAttr]) {
|
|
16
|
+
this.renderColgroup(node.attrs[constants_1.colgroupAttr]);
|
|
17
17
|
}
|
|
18
18
|
const tBody = this.table.appendChild(document.createElement('tbody'));
|
|
19
19
|
this.setAttributes(this.table, node.attrs);
|
|
20
|
-
this.resizeHandles =
|
|
20
|
+
this.resizeHandles = resize_utils_1.handles.map(dir => {
|
|
21
21
|
const handle = document.createElement('span');
|
|
22
|
-
handle.className =
|
|
23
|
-
handle.setAttribute(
|
|
22
|
+
handle.className = constants_1.resizeHandle + ' ' + dir;
|
|
23
|
+
handle.setAttribute(constants_1.dataResizeDirTable, dir);
|
|
24
24
|
return handle;
|
|
25
25
|
});
|
|
26
26
|
this.contentDOM = tBody;
|
|
@@ -31,19 +31,19 @@ class TableView {
|
|
|
31
31
|
}
|
|
32
32
|
const prev = this.node;
|
|
33
33
|
this.node = node;
|
|
34
|
-
if (node.attrs[
|
|
34
|
+
if (node.attrs[constants_1.resizableAttr]) {
|
|
35
35
|
this.resizeHandles.forEach(handle => {
|
|
36
36
|
this.dom.appendChild(handle);
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
else {
|
|
40
40
|
Array.from(this.dom.children)
|
|
41
|
-
.filter((e) => e.classList.contains(
|
|
41
|
+
.filter((e) => e.classList.contains(constants_1.resizeHandle))
|
|
42
42
|
.forEach((e) => e.remove());
|
|
43
43
|
}
|
|
44
44
|
this.setAttributes(this.table, node.attrs);
|
|
45
|
-
if (prev.attrs[
|
|
46
|
-
this.renderColgroup(node.attrs[
|
|
45
|
+
if (prev.attrs[constants_1.colgroupAttr] !== node.attrs[constants_1.colgroupAttr]) {
|
|
46
|
+
this.renderColgroup(node.attrs[constants_1.colgroupAttr]);
|
|
47
47
|
}
|
|
48
48
|
return true;
|
|
49
49
|
}
|
|
@@ -66,15 +66,15 @@ class TableView {
|
|
|
66
66
|
this.table.removeChild(this.table.firstChild);
|
|
67
67
|
}
|
|
68
68
|
if (colgroupStr) {
|
|
69
|
-
this.colgroup =
|
|
69
|
+
this.colgroup = (0, schema_1.parseStrColgroup)(colgroupStr);
|
|
70
70
|
this.table.insertBefore(this.colgroup, this.table.firstChild);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
setAttributes(table, attrs) {
|
|
74
|
-
const skip = [
|
|
74
|
+
const skip = [constants_1.colgroupAttr, constants_1.resizableAttr];
|
|
75
75
|
for (const attrName in attrs) {
|
|
76
76
|
if (attrName && skip.indexOf(attrName) === -1) {
|
|
77
|
-
|
|
77
|
+
(0, utils_1.setAttribute)(table, attrName, attrs[attrName]);
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
if (/%$/.test(table.style.width)) {
|
|
@@ -86,6 +86,7 @@ class TableView {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
+
exports.TableView = TableView;
|
|
89
90
|
class TableWrapperView {
|
|
90
91
|
constructor(node, view) {
|
|
91
92
|
this.node = node;
|
|
@@ -112,13 +113,13 @@ class TableWrapperView {
|
|
|
112
113
|
setAttributes(dom, attrs) {
|
|
113
114
|
for (const attrName in attrs) {
|
|
114
115
|
if (attrName) {
|
|
115
|
-
|
|
116
|
+
(0, utils_1.setAttribute)(dom, attrName, attrs[attrName]);
|
|
116
117
|
}
|
|
117
118
|
}
|
|
118
119
|
dom.setAttribute('table', '');
|
|
119
120
|
if (/%/.test(dom.style.width)) {
|
|
120
121
|
const table = this.node && this.node.lastChild;
|
|
121
|
-
const tableStyles = table ?
|
|
122
|
+
const tableStyles = table ? (0, utils_1.parseStyle)(table.attrs.style) : {};
|
|
122
123
|
const tableWidth = tableStyles.width || '';
|
|
123
124
|
if (tableWidth && !/%/.test(tableWidth)) {
|
|
124
125
|
dom.style.width = '';
|
|
@@ -126,6 +127,4 @@ class TableWrapperView {
|
|
|
126
127
|
}
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
|
-
|
|
130
|
-
exports.TableView = TableView;
|
|
131
130
|
exports.TableWrapperView = TableWrapperView;
|