@progress/kendo-editor-common 1.11.1 → 1.11.2-dev.202402200937
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/es/DOMSerializer.js +8 -8
- package/dist/es/align.js +1 -1
- package/dist/es/blockNode.js +5 -7
- package/dist/es/blockquote.js +1 -1
- package/dist/es/config/keymap.js +3 -3
- package/dist/es/config/schema.js +2 -1
- package/dist/es/find-replace.js +1 -1
- package/dist/es/indent.js +4 -4
- package/dist/es/inline-style.js +3 -3
- package/dist/es/listConvert.js +2 -2
- package/dist/es/lists.js +2 -1
- package/dist/es/paste.js +2 -2
- package/dist/es/plugins/caret-color.js +1 -1
- package/dist/es/plugins/csp-fix.js +4 -4
- package/dist/es/plugins/highlight.js +1 -1
- package/dist/es/plugins/image-resize.js +6 -6
- package/dist/es/plugins/list-markers-styles.js +3 -3
- package/dist/es/plugins/placeholder.js +1 -1
- package/dist/es/plugins/spaces-fix.js +1 -1
- package/dist/es/plugins/table-resize/column-resize.js +14 -12
- package/dist/es/plugins/table-resize/row-resize.js +7 -7
- package/dist/es/plugins/table-resize/table-resize.js +6 -6
- package/dist/es/source.js +1 -0
- package/dist/es/table.js +1 -0
- package/dist/es/utils.js +3 -3
- package/dist/es2015/DOMSerializer.js +37 -37
- package/dist/es2015/blockNode.js +9 -11
- package/dist/es2015/blockquote.js +1 -1
- package/dist/es2015/config/keymap.js +3 -3
- package/dist/es2015/config/schema.js +4 -3
- package/dist/es2015/find-replace.js +1 -1
- package/dist/es2015/inline-style.js +5 -5
- package/dist/es2015/listConvert.js +6 -6
- package/dist/es2015/lists.js +6 -5
- package/dist/es2015/mark.js +17 -17
- package/dist/es2015/plugins/caret-color.js +1 -1
- package/dist/es2015/plugins/csp-fix.js +5 -5
- package/dist/es2015/plugins/highlight.js +1 -1
- package/dist/es2015/plugins/image-resize.js +10 -10
- package/dist/es2015/plugins/list-markers-styles.js +2 -2
- package/dist/es2015/plugins/placeholder.js +1 -1
- package/dist/es2015/plugins/spaces-fix.js +1 -1
- package/dist/es2015/plugins/table-resize/column-resize.js +41 -39
- package/dist/es2015/plugins/table-resize/row-resize.js +27 -27
- package/dist/es2015/plugins/table-resize/table-resize.js +6 -6
- package/dist/es2015/plugins/table-resize/table-view.js +2 -2
- package/dist/es2015/source.js +1 -0
- package/dist/es2015/table.js +1 -0
- package/dist/es2015/utils.js +6 -6
- package/dist/npm/DOMSerializer.d.ts +2 -2
- package/dist/npm/DOMSerializer.js +8 -8
- package/dist/npm/align.js +5 -5
- package/dist/npm/blockNode.js +13 -15
- package/dist/npm/blockquote.js +2 -2
- package/dist/npm/cleanFormatting.js +2 -2
- package/dist/npm/config/keymap.js +7 -7
- package/dist/npm/config/schema.js +6 -5
- package/dist/npm/find-replace.js +7 -7
- package/dist/npm/image.js +1 -1
- package/dist/npm/indent.js +24 -24
- package/dist/npm/inline-style.js +13 -13
- package/dist/npm/link.js +7 -7
- package/dist/npm/listConvert.js +4 -4
- package/dist/npm/lists.d.ts +2 -1
- package/dist/npm/lists.js +10 -9
- package/dist/npm/mark.js +7 -7
- package/dist/npm/paste.js +8 -8
- package/dist/npm/plugins/caret-color.js +1 -1
- package/dist/npm/plugins/csp-fix.d.ts +1 -1
- package/dist/npm/plugins/csp-fix.js +3 -3
- package/dist/npm/plugins/highlight.d.ts +1 -1
- package/dist/npm/plugins/image-resize.d.ts +1 -1
- package/dist/npm/plugins/image-resize.js +4 -4
- package/dist/npm/plugins/list-markers-styles.js +8 -8
- package/dist/npm/plugins/table-resize/column-resize.js +23 -21
- package/dist/npm/plugins/table-resize/index.js +3 -3
- package/dist/npm/plugins/table-resize/row-resize.js +18 -18
- package/dist/npm/plugins/table-resize/table-resize.js +25 -25
- package/dist/npm/plugins/table-resize/table-view.js +4 -4
- package/dist/npm/plugins/table-resize/utils.js +1 -1
- package/dist/npm/source.d.ts +1 -0
- package/dist/npm/source.js +6 -5
- package/dist/npm/table.d.ts +1 -0
- package/dist/npm/table.js +8 -7
- package/dist/npm/types/command.d.ts +1 -1
- package/dist/npm/types/dispatchFn.d.ts +1 -1
- package/dist/npm/types/predicate.d.ts +1 -1
- package/dist/npm/utils.d.ts +1 -1
- package/dist/npm/utils.js +10 -10
- package/package.json +25 -18
- package/NOTICE.txt +0 -614
- package/dist/cdn/js/kendo-editor-common.js +0 -1
- package/dist/cdn/main.js +0 -1
- package/dist/systemjs/kendo-editor-common.js +0 -1
package/dist/npm/mark.js
CHANGED
|
@@ -30,7 +30,7 @@ var markApplies = function (doc, ranges, type) {
|
|
|
30
30
|
exports.markApplies = markApplies;
|
|
31
31
|
var toggleMark = function (markType, attrs, tr) { return function (state, dispatch) {
|
|
32
32
|
var _a = state.selection, empty = _a.empty, $cursor = _a.$cursor, ranges = _a.ranges;
|
|
33
|
-
if ((empty && !$cursor) || !exports.markApplies(state.doc, ranges, markType)) {
|
|
33
|
+
if ((empty && !$cursor) || !(0, exports.markApplies)(state.doc, ranges, markType)) {
|
|
34
34
|
return false;
|
|
35
35
|
}
|
|
36
36
|
if (dispatch) {
|
|
@@ -126,7 +126,7 @@ var removeMarks = function (marks, state, dispatch, tr) {
|
|
|
126
126
|
var _loop_1 = function (i) {
|
|
127
127
|
var _b = ranges[i], $from = _b.$from, $to = _b.$to;
|
|
128
128
|
marks.forEach(function (m) {
|
|
129
|
-
exports.removeMark(tr, $from.pos, $to.pos, m);
|
|
129
|
+
(0, exports.removeMark)(tr, $from.pos, $to.pos, m);
|
|
130
130
|
});
|
|
131
131
|
};
|
|
132
132
|
for (var i = 0; i < ranges.length; i++) {
|
|
@@ -142,7 +142,7 @@ var removeAllMarks = function (_a) {
|
|
|
142
142
|
var _b = _a === void 0 ? {} : _a, _c = _b.except, except = _c === void 0 ? [] : _c;
|
|
143
143
|
return function (state, dispatch) {
|
|
144
144
|
var tr = state.tr;
|
|
145
|
-
exports.cleanMarks(tr, { except: toArray(except) });
|
|
145
|
+
(0, exports.cleanMarks)(tr, { except: toArray(except) });
|
|
146
146
|
if (tr.docChanged) {
|
|
147
147
|
dispatch(tr);
|
|
148
148
|
}
|
|
@@ -194,8 +194,8 @@ var hasMark = function (state, options) {
|
|
|
194
194
|
result = (type && doc.rangeHasMark(from, to, type)) || altMarks.some(function (m) { return doc.rangeHasMark(from, to, marks[m]); });
|
|
195
195
|
}
|
|
196
196
|
if (!result && altStyle && marks.style) {
|
|
197
|
-
return exports.selectionMarks(state, marks.style)
|
|
198
|
-
.some(function (mark) { return exports.styleValue(mark, altStyle) !== null; });
|
|
197
|
+
return (0, exports.selectionMarks)(state, marks.style)
|
|
198
|
+
.some(function (mark) { return (0, exports.styleValue)(mark, altStyle) !== null; });
|
|
199
199
|
}
|
|
200
200
|
return Boolean(result);
|
|
201
201
|
};
|
|
@@ -236,7 +236,7 @@ exports.selectionMarks = selectionMarks;
|
|
|
236
236
|
* Used by link tools.
|
|
237
237
|
*/
|
|
238
238
|
var getMark = function (state, markType) {
|
|
239
|
-
var marks = exports.selectionMarks(state, markType);
|
|
239
|
+
var marks = (0, exports.selectionMarks)(state, markType);
|
|
240
240
|
var filtered = marks.filter(function (m) { return Boolean(m); });
|
|
241
241
|
return marks.length === filtered.length ? marks[0] : undefined;
|
|
242
242
|
};
|
|
@@ -245,7 +245,7 @@ exports.getMark = getMark;
|
|
|
245
245
|
* **Deprecated.** Use `selectionMarks` function instead.
|
|
246
246
|
*/
|
|
247
247
|
var getActiveMarks = function (state, markType) {
|
|
248
|
-
var marks = exports.selectionMarks(state, markType);
|
|
248
|
+
var marks = (0, exports.selectionMarks)(state, markType);
|
|
249
249
|
var filtered = marks.filter(function (m) { return Boolean(m); });
|
|
250
250
|
var hasNodesWithoutMarks = marks.length !== filtered.length;
|
|
251
251
|
return {
|
package/dist/npm/paste.js
CHANGED
|
@@ -48,7 +48,7 @@ exports.removeAttribute = removeAttribute;
|
|
|
48
48
|
*/
|
|
49
49
|
var sanitizeClassAttr = function (attr) {
|
|
50
50
|
if (/^Mso/.test(attr.value)) {
|
|
51
|
-
exports.removeAttribute(attr);
|
|
51
|
+
(0, exports.removeAttribute)(attr);
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
exports.sanitizeClassAttr = sanitizeClassAttr;
|
|
@@ -66,7 +66,7 @@ var sanitizeStyleAttr = function (attr) {
|
|
|
66
66
|
var _a;
|
|
67
67
|
_a = style.split(styleValueSplit), name = _a[0], value = _a[1];
|
|
68
68
|
if (supportedStyles[name] !== undefined) {
|
|
69
|
-
result += name
|
|
69
|
+
result += "".concat(name, ": ").concat(value, "; ");
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
result = result.trim();
|
|
@@ -74,7 +74,7 @@ var sanitizeStyleAttr = function (attr) {
|
|
|
74
74
|
attr.value = result;
|
|
75
75
|
}
|
|
76
76
|
else {
|
|
77
|
-
exports.removeAttribute(attr);
|
|
77
|
+
(0, exports.removeAttribute)(attr);
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
80
|
exports.sanitizeStyleAttr = sanitizeStyleAttr;
|
|
@@ -110,15 +110,15 @@ var sanitizeNode = function (node, attributes) {
|
|
|
110
110
|
var pasteCleanup = function (html, settings) {
|
|
111
111
|
var result = html;
|
|
112
112
|
if (settings.convertMsLists) {
|
|
113
|
-
result = listConvert_1.convertMsLists(result);
|
|
113
|
+
result = (0, listConvert_1.convertMsLists)(result);
|
|
114
114
|
}
|
|
115
115
|
if (settings.stripTags) {
|
|
116
|
-
result = exports.removeTag(result, settings.stripTags);
|
|
116
|
+
result = (0, exports.removeTag)(result, settings.stripTags);
|
|
117
117
|
}
|
|
118
118
|
if (settings.attributes) {
|
|
119
|
-
var fragment = source_1.htmlToFragment(result);
|
|
119
|
+
var fragment = (0, source_1.htmlToFragment)(result);
|
|
120
120
|
Array.from(fragment.querySelectorAll('*')).forEach(function (node) { return sanitizeNode(node, settings.attributes); });
|
|
121
|
-
result = source_1.fragmentToHtml(fragment);
|
|
121
|
+
result = (0, source_1.fragmentToHtml)(fragment);
|
|
122
122
|
}
|
|
123
123
|
return result;
|
|
124
124
|
};
|
|
@@ -162,7 +162,7 @@ var replaceImageSourcesFromRtf = function (html, clipboardData) {
|
|
|
162
162
|
var extension = reExtension.exec(image);
|
|
163
163
|
if (extension) {
|
|
164
164
|
var hex = image.replace(reRtfImgHeader, '').replace(reNonHex, '');
|
|
165
|
-
base64Sources.push("data:image/"
|
|
165
|
+
base64Sources.push("data:image/".concat(extension[1], ";base64,").concat(convertHexToBase64(hex)));
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
if (htmlImages.length !== base64Sources.length) {
|
|
@@ -14,7 +14,7 @@ function caretColor() {
|
|
|
14
14
|
if (!selection.empty || !storedMarks) {
|
|
15
15
|
return prosemirror_view_1.DecorationSet.empty;
|
|
16
16
|
}
|
|
17
|
-
var color = mark_1.styleValue((storedMarks || []).find(function (m) { return m.type.name === 'style'; }), { name: 'color', value: /^.+$/ });
|
|
17
|
+
var color = (0, mark_1.styleValue)((storedMarks || []).find(function (m) { return m.type.name === 'style'; }), { name: 'color', value: /^.+$/ });
|
|
18
18
|
if (!color) {
|
|
19
19
|
return prosemirror_view_1.DecorationSet.empty;
|
|
20
20
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Plugin } from
|
|
1
|
+
import { Plugin } from 'prosemirror-state';
|
|
2
2
|
export declare const cspFix: () => Plugin<any>;
|
|
@@ -6,7 +6,7 @@ var utils_1 = require("../utils");
|
|
|
6
6
|
var setAttributes = function (dom, attrs) {
|
|
7
7
|
for (var attrName in attrs) {
|
|
8
8
|
if (attrName) {
|
|
9
|
-
utils_1.setAttribute(dom, attrName, attrs[attrName]);
|
|
9
|
+
(0, utils_1.setAttribute)(dom, attrName, attrs[attrName]);
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
};
|
|
@@ -22,7 +22,7 @@ var CustomNodeView = /** @class */ (function () {
|
|
|
22
22
|
return CustomNodeView;
|
|
23
23
|
}());
|
|
24
24
|
var StyleView = /** @class */ (function () {
|
|
25
|
-
function StyleView(mark, view
|
|
25
|
+
function StyleView(mark, view) {
|
|
26
26
|
this.mark = mark;
|
|
27
27
|
this.view = view;
|
|
28
28
|
this.dom = document.createElement('span');
|
|
@@ -47,7 +47,7 @@ var cspFix = function () {
|
|
|
47
47
|
image: function (node, view) { return new CustomNodeView(node, view, 'img', true); }
|
|
48
48
|
},
|
|
49
49
|
markViews: {
|
|
50
|
-
style: function (mark, view
|
|
50
|
+
style: function (mark, view) { return new StyleView(mark, view); }
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
});
|
|
@@ -21,11 +21,11 @@ var ResizeState = /** @class */ (function () {
|
|
|
21
21
|
this.nodePosition = nodePosition;
|
|
22
22
|
}
|
|
23
23
|
ResizeState.prototype.apply = function (tr) {
|
|
24
|
-
var
|
|
24
|
+
var next = tr.getMeta(exports.imageResizeKey);
|
|
25
25
|
if (next) {
|
|
26
26
|
return new ResizeState(next.activeHandle, next.setDragging, next.rect, next.nodePosition);
|
|
27
27
|
}
|
|
28
|
-
return
|
|
28
|
+
return this;
|
|
29
29
|
};
|
|
30
30
|
return ResizeState;
|
|
31
31
|
}());
|
|
@@ -76,8 +76,8 @@ var handleMouseUp = function (view) {
|
|
|
76
76
|
var height = rect.height;
|
|
77
77
|
var attrs = void 0;
|
|
78
78
|
if (reSize.test(currAttrs.style || '')) {
|
|
79
|
-
var changedWidth = utils_1.changeStylesString(currAttrs.style, { style: 'width', value: reAnyValue, newValue: width + 'px' });
|
|
80
|
-
var style = utils_1.changeStylesString(changedWidth.style || '', { style: 'height', value: reAnyValue, newValue: height + 'px' }).style;
|
|
79
|
+
var changedWidth = (0, utils_1.changeStylesString)(currAttrs.style, { style: 'width', value: reAnyValue, newValue: width + 'px' });
|
|
80
|
+
var style = (0, utils_1.changeStylesString)(changedWidth.style || '', { style: 'height', value: reAnyValue, newValue: height + 'px' }).style;
|
|
81
81
|
attrs = tslib_1.__assign(tslib_1.__assign({}, currAttrs), { style: style });
|
|
82
82
|
}
|
|
83
83
|
else {
|
|
@@ -31,7 +31,7 @@ var applyToListItems = function (tr, state, options) {
|
|
|
31
31
|
var args = tr.getMeta('args');
|
|
32
32
|
doc.nodesBetween(from, to, function (node, pos) {
|
|
33
33
|
if ((node.type.name === options.listItem) && inSelection(from, to, pos, node, doc)) {
|
|
34
|
-
transaction.setNodeMarkup(pos, null, tslib_1.__assign(tslib_1.__assign({}, node.attrs), { style: utils_1.applyStyle(node.attrs.style, args.style, args.value) }));
|
|
34
|
+
transaction.setNodeMarkup(pos, null, tslib_1.__assign(tslib_1.__assign({}, node.attrs), { style: (0, utils_1.applyStyle)(node.attrs.style, args.style, args.value) }));
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
37
|
return transaction.docChanged ? transaction : undefined;
|
|
@@ -39,13 +39,13 @@ var applyToListItems = function (tr, state, options) {
|
|
|
39
39
|
var cleanListItems = function (tr, state, options) {
|
|
40
40
|
var stylesToClean = Object.keys(options.resetValues);
|
|
41
41
|
var transaction = state.tr, doc = state.doc, _a = state.selection, from = _a.from, to = _a.to;
|
|
42
|
-
doc.nodesBetween(from, to, function (node, pos
|
|
42
|
+
doc.nodesBetween(from, to, function (node, pos) {
|
|
43
43
|
if (node.type.name === options.listItem && inSelection(from, to, pos, node, doc)) {
|
|
44
44
|
var attrs_1 = node.attrs;
|
|
45
|
-
var nodeStyles_1 = utils_1.parseStyle(node.attrs.style);
|
|
45
|
+
var nodeStyles_1 = (0, utils_1.parseStyle)(node.attrs.style);
|
|
46
46
|
stylesToClean.forEach(function (style) {
|
|
47
47
|
if (nodeStyles_1[style]) {
|
|
48
|
-
attrs_1 = tslib_1.__assign(tslib_1.__assign({}, attrs_1), { style: utils_1.applyStyle(attrs_1.style, style, '') });
|
|
48
|
+
attrs_1 = tslib_1.__assign(tslib_1.__assign({}, attrs_1), { style: (0, utils_1.applyStyle)(attrs_1.style, style, '') });
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
51
|
if (attrs_1 !== node.attrs) {
|
|
@@ -57,13 +57,13 @@ var cleanListItems = function (tr, state, options) {
|
|
|
57
57
|
if (step instanceof prosemirror_transform_1.RemoveMarkStep) {
|
|
58
58
|
var mark = step.mark;
|
|
59
59
|
if (mark.type.name === 'style' && mark.attrs.style) {
|
|
60
|
-
var
|
|
60
|
+
var name_1 = mark.attrs.style.split(/\s*:\s*/)[0];
|
|
61
61
|
var $pos = transaction.doc.resolve(step.from);
|
|
62
|
-
var li = utils_1.parentNode($pos, function (n) { return n.type.name === options.listItem; });
|
|
62
|
+
var li = (0, utils_1.parentNode)($pos, function (n) { return n.type.name === options.listItem; });
|
|
63
63
|
if (li) {
|
|
64
|
-
var liStyles = utils_1.parseStyle(li.node.attrs.style);
|
|
64
|
+
var liStyles = (0, utils_1.parseStyle)(li.node.attrs.style);
|
|
65
65
|
if (liStyles[name_1] && options.resetValues[name_1]) {
|
|
66
|
-
var newMark = mark.type.create({ style: name_1
|
|
66
|
+
var newMark = mark.type.create({ style: "".concat(name_1, ": ").concat(options.resetValues[name_1], ";") });
|
|
67
67
|
transaction.addMark(step.from, step.to, newMark);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
@@ -14,7 +14,7 @@ function columnResizing() {
|
|
|
14
14
|
var plugin = new prosemirror_state_1.Plugin({
|
|
15
15
|
key: utils_2.tableColumnResizeKey,
|
|
16
16
|
state: {
|
|
17
|
-
init: function (
|
|
17
|
+
init: function () {
|
|
18
18
|
return new ResizeState(-1, null);
|
|
19
19
|
},
|
|
20
20
|
apply: function (tr, prev) {
|
|
@@ -23,7 +23,7 @@ function columnResizing() {
|
|
|
23
23
|
},
|
|
24
24
|
props: {
|
|
25
25
|
attributes: function (state) {
|
|
26
|
-
if (utils_2.otherResizeHandle(utils_2.tableColumnResizeKey, state)) {
|
|
26
|
+
if ((0, utils_2.otherResizeHandle)(utils_2.tableColumnResizeKey, state)) {
|
|
27
27
|
return null;
|
|
28
28
|
}
|
|
29
29
|
var pluginState = utils_2.tableColumnResizeKey.getState(state);
|
|
@@ -31,7 +31,7 @@ function columnResizing() {
|
|
|
31
31
|
},
|
|
32
32
|
handleDOMEvents: {
|
|
33
33
|
mousemove: function (view, event) {
|
|
34
|
-
if (!utils_2.otherResizing(utils_2.tableColumnResizeKey, view.state)) {
|
|
34
|
+
if (!(0, utils_2.otherResizing)(utils_2.tableColumnResizeKey, view.state)) {
|
|
35
35
|
handleMouseMove(view, event, handleWidth);
|
|
36
36
|
}
|
|
37
37
|
return false;
|
|
@@ -45,7 +45,7 @@ function columnResizing() {
|
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
decorations: function (state) {
|
|
48
|
-
if (!utils_2.otherResizing(utils_2.tableColumnResizeKey, state)) {
|
|
48
|
+
if (!(0, utils_2.otherResizing)(utils_2.tableColumnResizeKey, state)) {
|
|
49
49
|
var pluginState = utils_2.tableColumnResizeKey.getState(state);
|
|
50
50
|
if (pluginState.activeHandle > -1) {
|
|
51
51
|
return handleDecorations(state, pluginState.activeHandle);
|
|
@@ -71,37 +71,39 @@ var ResizeState = /** @class */ (function () {
|
|
|
71
71
|
this.dragging = dragging;
|
|
72
72
|
}
|
|
73
73
|
ResizeState.prototype.apply = function (tr) {
|
|
74
|
-
var state
|
|
74
|
+
var state;
|
|
75
|
+
var action = tr.getMeta(utils_2.tableColumnResizeKey);
|
|
75
76
|
if (action && action.setHandle != null) {
|
|
76
77
|
return new ResizeState(action.setHandle, null);
|
|
77
78
|
}
|
|
78
79
|
if (action && action.setDragging !== undefined) {
|
|
79
|
-
return new ResizeState(
|
|
80
|
+
return new ResizeState(this.activeHandle, action.setDragging);
|
|
80
81
|
}
|
|
81
|
-
if (
|
|
82
|
-
var handle = tr.mapping.map(
|
|
82
|
+
if (this.activeHandle > -1 && tr.docChanged) {
|
|
83
|
+
var handle = tr.mapping.map(this.activeHandle, -1);
|
|
83
84
|
if (!pointsAtCell(tr.doc.resolve(handle))) {
|
|
84
85
|
handle = -1;
|
|
85
86
|
}
|
|
86
|
-
state = new ResizeState(handle,
|
|
87
|
+
state = new ResizeState(handle, this.dragging);
|
|
87
88
|
}
|
|
88
|
-
return state;
|
|
89
|
+
return state || this;
|
|
89
90
|
};
|
|
90
91
|
return ResizeState;
|
|
91
92
|
}());
|
|
92
93
|
function handleMouseMove(view, event, handleWidth) {
|
|
93
94
|
var pluginState = utils_2.tableColumnResizeKey.getState(view.state);
|
|
94
95
|
if (!pluginState.dragging) {
|
|
95
|
-
var target = utils_2.domCellAround(event.target)
|
|
96
|
+
var target = (0, utils_2.domCellAround)(event.target);
|
|
97
|
+
var cell = -1;
|
|
96
98
|
if (target) {
|
|
97
|
-
var indexes = utils_2.cellIndexes(target);
|
|
99
|
+
var indexes = (0, utils_2.cellIndexes)(target);
|
|
98
100
|
var _a = target.getBoundingClientRect(), left = _a.left, right = _a.right;
|
|
99
101
|
if (Math.abs(event.clientX - left) <= handleWidth && indexes.cellIndex > 0) {
|
|
100
102
|
indexes.cellIndex -= target.colSpan;
|
|
101
|
-
cell = utils_2.edgeCell(view, event, indexes);
|
|
103
|
+
cell = (0, utils_2.edgeCell)(view, event, indexes);
|
|
102
104
|
}
|
|
103
105
|
else if (right - event.clientX > 0 && right - event.clientX <= handleWidth) {
|
|
104
|
-
cell = utils_2.edgeCell(view, event, indexes);
|
|
106
|
+
cell = (0, utils_2.edgeCell)(view, event, indexes);
|
|
105
107
|
}
|
|
106
108
|
}
|
|
107
109
|
if (cell !== pluginState.activeHandle) {
|
|
@@ -162,7 +164,7 @@ function handleMouseDown(view, event, cellMinWidth) {
|
|
|
162
164
|
var widths = Array.from(col.parentNode.children).map(function (c) { return c.style.width; });
|
|
163
165
|
if (widths.every(Boolean)) {
|
|
164
166
|
var sum = widths.reduce(function (acc, cur) { return acc + parseFloat(cur); }, 0);
|
|
165
|
-
tableAttrs = utils_1.setNodeStyle(tableAttrs || tableNode.attrs, 'width', sum + 'px');
|
|
167
|
+
tableAttrs = (0, utils_1.setNodeStyle)(tableAttrs || tableNode.attrs, 'width', sum + 'px');
|
|
166
168
|
}
|
|
167
169
|
}
|
|
168
170
|
if (tableAttrs) {
|
|
@@ -176,7 +178,7 @@ function handleMouseDown(view, event, cellMinWidth) {
|
|
|
176
178
|
var curPluginState = utils_2.tableColumnResizeKey.getState(view.state);
|
|
177
179
|
if (curPluginState.dragging) {
|
|
178
180
|
var transaction = view.state.tr;
|
|
179
|
-
updateColumnWidth(view, transaction, curPluginState.activeHandle
|
|
181
|
+
updateColumnWidth(view, transaction, curPluginState.activeHandle);
|
|
180
182
|
view.dispatch(transaction.setMeta(utils_2.tableColumnResizeKey, { setDragging: null }));
|
|
181
183
|
}
|
|
182
184
|
}
|
|
@@ -186,7 +188,7 @@ function handleMouseDown(view, event, cellMinWidth) {
|
|
|
186
188
|
}
|
|
187
189
|
var curPluginState = utils_2.tableColumnResizeKey.getState(view.state);
|
|
188
190
|
var dragged = draggedWidth(curPluginState.dragging, ev, cellMinWidth);
|
|
189
|
-
displayColumnWidth(view, curPluginState.activeHandle, dragged
|
|
191
|
+
displayColumnWidth(view, curPluginState.activeHandle, dragged);
|
|
190
192
|
}
|
|
191
193
|
event.view.addEventListener('mouseup', finish);
|
|
192
194
|
event.view.addEventListener('mousemove', move);
|
|
@@ -203,7 +205,7 @@ function updateHandle(view, value) {
|
|
|
203
205
|
tr.setMeta(utils_2.tableColumnResizeKey, { setHandle: value });
|
|
204
206
|
view.dispatch(tr);
|
|
205
207
|
}
|
|
206
|
-
function updateColumnWidth(view, tr, cell
|
|
208
|
+
function updateColumnWidth(view, tr, cell) {
|
|
207
209
|
var _a;
|
|
208
210
|
var $cell = view.state.doc.resolve(cell);
|
|
209
211
|
var tableNode = $cell.node(-1), start = $cell.start(-1);
|
|
@@ -215,12 +217,12 @@ function updateColumnWidth(view, tr, cell, _width) {
|
|
|
215
217
|
attrs = tslib_1.__assign(tslib_1.__assign({}, attrs), (_a = {}, _a[constants_1.colgroupAttr] = colgroup.outerHTML, _a));
|
|
216
218
|
}
|
|
217
219
|
var tableDomWidth = tableDom.style.width;
|
|
218
|
-
if (tableDom && tableDomWidth && utils_1.parseStyle(attrs.style).width !== tableDomWidth) {
|
|
219
|
-
attrs = utils_1.setNodeStyle(attrs, 'width', tableDomWidth);
|
|
220
|
+
if (tableDom && tableDomWidth && (0, utils_1.parseStyle)(attrs.style).width !== tableDomWidth) {
|
|
221
|
+
attrs = (0, utils_1.setNodeStyle)(attrs, 'width', tableDomWidth);
|
|
220
222
|
}
|
|
221
223
|
tr.setNodeMarkup(tablePos, null, attrs);
|
|
222
224
|
}
|
|
223
|
-
function displayColumnWidth(view, cell, width
|
|
225
|
+
function displayColumnWidth(view, cell, width) {
|
|
224
226
|
var $cell = view.state.doc.resolve(cell);
|
|
225
227
|
var table = $cell.node(-1), start = $cell.start(-1);
|
|
226
228
|
var col = prosemirror_tables_1.TableMap.get(table).colCount($cell.pos - start) + $cell.nodeAfter.attrs.colspan - 1;
|
|
@@ -5,9 +5,9 @@ var column_resize_1 = require("./column-resize");
|
|
|
5
5
|
var table_resize_1 = require("./table-resize");
|
|
6
6
|
var row_resize_1 = require("./row-resize");
|
|
7
7
|
var tableResizing = function () { return [
|
|
8
|
-
table_resize_1.tableResizing(),
|
|
9
|
-
column_resize_1.columnResizing(),
|
|
10
|
-
row_resize_1.rowResizing()
|
|
8
|
+
(0, table_resize_1.tableResizing)(),
|
|
9
|
+
(0, column_resize_1.columnResizing)(),
|
|
10
|
+
(0, row_resize_1.rowResizing)()
|
|
11
11
|
]; };
|
|
12
12
|
exports.tableResizing = tableResizing;
|
|
13
13
|
var utils_1 = require("./utils");
|
|
@@ -20,7 +20,7 @@ function rowResizing() {
|
|
|
20
20
|
key: utils_1.tableRowResizeKey,
|
|
21
21
|
state: {
|
|
22
22
|
init: function (_, state) {
|
|
23
|
-
this.spec.props.nodeViews[prosemirror_tables_1.tableNodeTypes(state.schema).row.name] = function (
|
|
23
|
+
this.spec.props.nodeViews[(0, prosemirror_tables_1.tableNodeTypes)(state.schema).row.name] = function () { return new TableRowView(); };
|
|
24
24
|
return new ResizeState(-1, null);
|
|
25
25
|
},
|
|
26
26
|
apply: function (tr, prev) {
|
|
@@ -29,7 +29,7 @@ function rowResizing() {
|
|
|
29
29
|
},
|
|
30
30
|
props: {
|
|
31
31
|
attributes: function (state) {
|
|
32
|
-
if (utils_1.otherResizeHandle(utils_1.tableRowResizeKey, state)) {
|
|
32
|
+
if ((0, utils_1.otherResizeHandle)(utils_1.tableRowResizeKey, state)) {
|
|
33
33
|
return null;
|
|
34
34
|
}
|
|
35
35
|
var pluginState = utils_1.tableRowResizeKey.getState(state);
|
|
@@ -37,7 +37,7 @@ function rowResizing() {
|
|
|
37
37
|
},
|
|
38
38
|
handleDOMEvents: {
|
|
39
39
|
mousemove: function (view, event) {
|
|
40
|
-
if (!utils_1.otherResizing(utils_1.tableRowResizeKey, view.state)) {
|
|
40
|
+
if (!(0, utils_1.otherResizing)(utils_1.tableRowResizeKey, view.state)) {
|
|
41
41
|
handleMouseMove(view, event, handleWidth);
|
|
42
42
|
}
|
|
43
43
|
return false;
|
|
@@ -51,7 +51,7 @@ function rowResizing() {
|
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
decorations: function (state) {
|
|
54
|
-
if (utils_1.otherResizing(utils_1.tableRowResizeKey, state)) {
|
|
54
|
+
if ((0, utils_1.otherResizing)(utils_1.tableRowResizeKey, state)) {
|
|
55
55
|
return prosemirror_view_1.DecorationSet.empty;
|
|
56
56
|
}
|
|
57
57
|
var pluginState = utils_1.tableRowResizeKey.getState(state);
|
|
@@ -74,37 +74,37 @@ var ResizeState = /** @class */ (function () {
|
|
|
74
74
|
this.dragging = dragging;
|
|
75
75
|
}
|
|
76
76
|
ResizeState.prototype.apply = function (tr) {
|
|
77
|
-
var state
|
|
77
|
+
var state, action = tr.getMeta(utils_1.tableRowResizeKey);
|
|
78
78
|
if (action && action.setHandle != null) {
|
|
79
79
|
return new ResizeState(action.setHandle, null);
|
|
80
80
|
}
|
|
81
81
|
if (action && action.setDragging !== undefined) {
|
|
82
|
-
return new ResizeState(
|
|
82
|
+
return new ResizeState(this.activeHandle, action.setDragging);
|
|
83
83
|
}
|
|
84
|
-
if (
|
|
85
|
-
var handle = tr.mapping.map(
|
|
84
|
+
if (this.activeHandle > -1) {
|
|
85
|
+
var handle = tr.mapping.map(this.activeHandle, -1);
|
|
86
86
|
if (!pointsAtCell(tr.doc.resolve(handle))) {
|
|
87
87
|
handle = null;
|
|
88
88
|
}
|
|
89
|
-
state = new ResizeState(handle,
|
|
89
|
+
state = new ResizeState(handle, this.dragging);
|
|
90
90
|
}
|
|
91
|
-
return state;
|
|
91
|
+
return state || this;
|
|
92
92
|
};
|
|
93
93
|
return ResizeState;
|
|
94
94
|
}());
|
|
95
95
|
function handleMouseMove(view, event, handleWidth) {
|
|
96
96
|
var pluginState = utils_1.tableRowResizeKey.getState(view.state);
|
|
97
97
|
if (!pluginState.dragging) {
|
|
98
|
-
var target = utils_1.domCellAround(event.target), cell = -1;
|
|
98
|
+
var target = (0, utils_1.domCellAround)(event.target), cell = -1;
|
|
99
99
|
if (target) {
|
|
100
|
-
var indexes = utils_1.cellIndexes(target);
|
|
100
|
+
var indexes = (0, utils_1.cellIndexes)(target);
|
|
101
101
|
var _a = target.getBoundingClientRect(), top_1 = _a.top, bottom = _a.bottom;
|
|
102
102
|
if (Math.abs(event.clientY - top_1) <= handleWidth && indexes.rowIndex > 0) {
|
|
103
103
|
indexes.rowIndex -= target.rowSpan;
|
|
104
|
-
cell = utils_1.edgeCell(view, event, indexes);
|
|
104
|
+
cell = (0, utils_1.edgeCell)(view, event, indexes);
|
|
105
105
|
}
|
|
106
106
|
else if (bottom - event.clientY > 0 && bottom - event.clientY <= handleWidth) {
|
|
107
|
-
cell = utils_1.edgeCell(view, event, indexes);
|
|
107
|
+
cell = (0, utils_1.edgeCell)(view, event, indexes);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
if (cell !== pluginState.activeHandle) {
|
|
@@ -127,8 +127,8 @@ function handleMouseDown(view, event) {
|
|
|
127
127
|
var $cell = doc.resolve(pluginState.activeHandle);
|
|
128
128
|
var row = $cell.parent;
|
|
129
129
|
var table = $cell.node(-1);
|
|
130
|
-
var rowHeightStr = utils_2.parseStyle(row.attrs.style).height;
|
|
131
|
-
var tableHeight = utils_2.parseStyle(table.attrs.style).height;
|
|
130
|
+
var rowHeightStr = (0, utils_2.parseStyle)(row.attrs.style).height;
|
|
131
|
+
var tableHeight = (0, utils_2.parseStyle)(table.attrs.style).height;
|
|
132
132
|
var rowHeight = rowHeightStr ? parseFloat(rowHeightStr) : 0;
|
|
133
133
|
if (!rowHeightStr) {
|
|
134
134
|
var tr = view.nodeDOM(pluginState.activeHandle);
|
|
@@ -182,13 +182,13 @@ function updateRowHeight(view, tr, cellPos) {
|
|
|
182
182
|
var dom = view.nodeDOM(rowPos);
|
|
183
183
|
var win = (dom.ownerDocument && dom.ownerDocument.defaultView) || window;
|
|
184
184
|
dom.style.height = win.getComputedStyle(dom).height;
|
|
185
|
-
tr.setNodeMarkup(rowPos, null, utils_2.setNodeStyle(row.attrs, 'height', dom.style.height));
|
|
185
|
+
tr.setNodeMarkup(rowPos, null, (0, utils_2.setNodeStyle)(row.attrs, 'height', dom.style.height));
|
|
186
186
|
var table = dom && dom.closest('table');
|
|
187
187
|
var tableHeight = table && table.style.height;
|
|
188
188
|
if (tableHeight) {
|
|
189
189
|
var $pos = doc.resolve(rowPos);
|
|
190
190
|
var tablePos = $pos.start($pos.depth) - 1;
|
|
191
|
-
tr.setNodeMarkup(tablePos, null, utils_2.setNodeStyle($pos.parent.attrs, 'height', tableHeight));
|
|
191
|
+
tr.setNodeMarkup(tablePos, null, (0, utils_2.setNodeStyle)($pos.parent.attrs, 'height', tableHeight));
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
194
|
function displayRowHeight(view, cellPos, height, offset, tableHeight) {
|