@progress/kendo-angular-editor 3.0.0-dev.202112211443 → 3.0.0-dev.202201121058
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-angular-editor.js +2 -2
- package/dist/cdn/main.js +1 -1
- package/dist/es/config/commands.js +2 -2
- package/dist/es/config/schema.js +1 -2
- package/dist/es/config/table-commands.js +1 -363
- package/dist/es/editor.component.js +6 -6
- package/dist/es/package-metadata.js +1 -1
- package/dist/es2015/config/commands.js +2 -2
- package/dist/es2015/config/schema.js +1 -2
- package/dist/es2015/config/table-commands.d.ts +0 -36
- package/dist/es2015/config/table-commands.js +1 -357
- package/dist/es2015/editor.component.js +6 -6
- package/dist/es2015/index.metadata.json +1 -1
- package/dist/es2015/package-metadata.js +1 -1
- package/dist/fesm2015/index.js +153 -1530
- package/dist/fesm5/index.js +171 -1574
- package/dist/npm/config/commands.js +1 -1
- package/dist/npm/config/schema.js +1 -2
- package/dist/npm/config/table-commands.js +1 -368
- package/dist/npm/editor.component.js +5 -5
- package/dist/npm/package-metadata.js +1 -1
- package/dist/systemjs/kendo-angular-editor.js +1 -1
- package/package.json +2 -2
- package/dist/es/config/table-nodes.js +0 -146
- package/dist/es/config/tables/CellSelection.js +0 -268
- package/dist/es/config/tables/TableMap.js +0 -333
- package/dist/es/config/tables/table-utils.js +0 -302
- package/dist/es2015/config/table-nodes.d.ts +0 -9
- package/dist/es2015/config/table-nodes.js +0 -145
- package/dist/es2015/config/tables/CellSelection.d.ts +0 -35
- package/dist/es2015/config/tables/CellSelection.js +0 -256
- package/dist/es2015/config/tables/TableMap.d.ts +0 -35
- package/dist/es2015/config/tables/TableMap.js +0 -329
- package/dist/es2015/config/tables/table-utils.d.ts +0 -77
- package/dist/es2015/config/tables/table-utils.js +0 -299
- package/dist/npm/config/table-nodes.js +0 -157
- package/dist/npm/config/tables/CellSelection.js +0 -270
- package/dist/npm/config/tables/TableMap.js +0 -338
- package/dist/npm/config/tables/table-utils.js +0 -307
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import * as tslib_1 from "tslib";
|
|
6
6
|
import { alignBlocks, alignLeftRules, alignCenterRules, alignRightRules, alignJustifyRules, alignRemoveRules, indent, outdent, setHtml, getHtml, insertImage, insertText, applyLink, removeLink, expandToWordWrap,
|
|
7
7
|
//marks
|
|
8
|
-
bold, italic, underline, strikethrough, subscript, superscript, link, toggleInlineFormat, applyInlineStyle, formatBlockElements, toggleOrderedList, toggleUnorderedList, isAligned, undo, redo, cleanFormatting, selectAll } from '@progress/kendo-editor-common';
|
|
9
|
-
import { insertTable
|
|
8
|
+
bold, italic, underline, strikethrough, subscript, superscript, link, toggleInlineFormat, applyInlineStyle, formatBlockElements, toggleOrderedList, toggleUnorderedList, isAligned, undo, redo, cleanFormatting, selectAll, addColumnBefore, addColumnAfter, addRowBefore, addRowAfter, deleteRow, deleteColumn, deleteTable, mergeCells, splitCell } from '@progress/kendo-editor-common';
|
|
9
|
+
import { insertTable } from './table-commands';
|
|
10
10
|
var alignRemove = function (state, dispatch) { return alignBlocks(alignRemoveRules)(state, dispatch); };
|
|
11
11
|
var ɵ0 = alignRemove;
|
|
12
12
|
var ɵ1 = function (applyToWord) { return expandToWordWrap(toggleInlineFormat, tslib_1.__assign({}, bold, { applyToWord: applyToWord })); }, ɵ2 = function (options) { return cleanFormatting(options); }, ɵ3 = function (attrs) { return expandToWordWrap(applyLink, { mark: 'link', attrs: attrs.value, applyToWord: attrs.applyToWord }); }, ɵ4 = function (attrs) { return expandToWordWrap(applyInlineStyle, { style: 'font-family', value: attrs.value, applyToWord: attrs.applyToWord }); }, ɵ5 = function (attrs) { return expandToWordWrap(applyInlineStyle, { style: 'font-size', value: attrs.value + 'px', applyToWord: attrs.applyToWord }); }, ɵ6 = function (attrs) { return expandToWordWrap(applyLink, { mark: 'link', attrs: attrs, applyToWord: attrs.applyToWord }); }, ɵ7 = function (text) { return insertText(text); }, ɵ8 = function (applyToWord) { return expandToWordWrap(toggleInlineFormat, tslib_1.__assign({}, italic, { applyToWord: applyToWord })); }, ɵ9 = function (applyToWord) { return expandToWordWrap(toggleInlineFormat, tslib_1.__assign({}, strikethrough, { applyToWord: applyToWord })); }, ɵ10 = function (applyToWord) { return expandToWordWrap(toggleInlineFormat, tslib_1.__assign({}, subscript, { applyToWord: applyToWord })); }, ɵ11 = function (applyToWord) { return expandToWordWrap(toggleInlineFormat, tslib_1.__assign({}, superscript, { applyToWord: applyToWord })); }, ɵ12 = function (applyToWord) { return expandToWordWrap(toggleInlineFormat, tslib_1.__assign({}, underline, { applyToWord: applyToWord })); }, ɵ13 = function () { return removeLink(link); }, ɵ14 = function (attrs) { return expandToWordWrap(applyInlineStyle, { style: 'color', value: attrs.value, applyToWord: attrs.applyToWord }); }, ɵ15 = function (attrs) { return expandToWordWrap(applyInlineStyle, { style: 'background-color', value: attrs.value, applyToWord: attrs.applyToWord }); }, ɵ16 = function () { return function (state, dispatch) { return selectAll(state, dispatch); }; };
|
package/dist/es/config/schema.js
CHANGED
|
@@ -5,12 +5,11 @@
|
|
|
5
5
|
import * as tslib_1 from "tslib";
|
|
6
6
|
import { semanticNodes } from './semantic-nodes';
|
|
7
7
|
import { marks as commonMarks, nodes as commonNodes, Schema } from '@progress/kendo-editor-common';
|
|
8
|
-
import { tableNodes } from './table-nodes';
|
|
9
8
|
/**
|
|
10
9
|
* @hidden
|
|
11
10
|
*/
|
|
12
11
|
var marks = commonMarks;
|
|
13
|
-
var nodes = Object.assign(commonNodes,
|
|
12
|
+
var nodes = Object.assign(commonNodes, semanticNodes);
|
|
14
13
|
/**
|
|
15
14
|
* @hidden
|
|
16
15
|
*/
|
|
@@ -2,11 +2,7 @@
|
|
|
2
2
|
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { insertNode,
|
|
6
|
-
import { createTable, isInTable, selectedRect, tableNodeTypes, rowIsHeader, setAttr, addColSpan, removeColSpan, isCellEmpty, splitCellWithType, cellsOverlapRectangle, findParentNodeClosestToPos } from './tables/table-utils';
|
|
7
|
-
import { isTable, isTableBody, isTableHead, isTableFoot, isTableHeaderCell, isTableCell } from './utils';
|
|
8
|
-
import { TableMap } from './tables/TableMap';
|
|
9
|
-
import { CellSelection } from './tables/CellSelection';
|
|
5
|
+
import { insertNode, createTable } from '@progress/kendo-editor-common';
|
|
10
6
|
/**
|
|
11
7
|
* @hidden
|
|
12
8
|
*/
|
|
@@ -16,361 +12,3 @@ export var insertTable = function (attrs) { return function (state, dispatch) {
|
|
|
16
12
|
insertNode(newTable, true)(state, dispatch);
|
|
17
13
|
}
|
|
18
14
|
}; };
|
|
19
|
-
var addTableGroupColumn = function (tr, _a, col, mainTable, requiredGroup, doc) {
|
|
20
|
-
var left = _a.left, right = _a.right;
|
|
21
|
-
var refColumn = col > 0 ? -1 : 0;
|
|
22
|
-
// not sure if this should be deleted
|
|
23
|
-
// if (columnIsHeader(map, table, col + refColumn)) {
|
|
24
|
-
// refColumn = col === 0 || col === map.width ? null : 0;
|
|
25
|
-
// }
|
|
26
|
-
var rect;
|
|
27
|
-
mainTable.node.descendants(function (tableChildNode, offset) {
|
|
28
|
-
if (requiredGroup(tableChildNode)) {
|
|
29
|
-
var i_1 = -1;
|
|
30
|
-
tableChildNode.firstChild.descendants(function (childNode, pos) {
|
|
31
|
-
if (isTableCell(childNode) || isTableHeaderCell(childNode)) {
|
|
32
|
-
i_1 = i_1 + 1;
|
|
33
|
-
if (i_1 === right || i_1 === left) {
|
|
34
|
-
var selection = new Selection(doc.resolve(pos + offset + mainTable.start), doc.resolve(pos + offset + mainTable.start));
|
|
35
|
-
rect = selectedRect(selection);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
// Do nothing if thead, tfoot or tbody is missing
|
|
42
|
-
if (!rect) {
|
|
43
|
-
return tr;
|
|
44
|
-
}
|
|
45
|
-
for (var row = 0; row < rect.map.height; row++) {
|
|
46
|
-
var index = row * rect.map.width + col;
|
|
47
|
-
// If this position falls inside a col-spanning cell
|
|
48
|
-
if (col > 0 && col < rect.map.width && rect.map.map[index - 1] === rect.map.map[index]) {
|
|
49
|
-
var pos = rect.map.map[index];
|
|
50
|
-
var cell = rect.table.nodeAt(pos);
|
|
51
|
-
tr.setNodeMarkup(tr.mapping.map(rect.tableStart + pos), null, addColSpan(cell.attrs, col - rect.map.colCount(pos)));
|
|
52
|
-
// Skip ahead if rowspan > 1
|
|
53
|
-
row += cell.attrs.rowspan - 1;
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
var type = rect.table.nodeAt(rect.map.map[index + refColumn]).type;
|
|
57
|
-
var pos = rect.map.positionAt(row, col, rect.table);
|
|
58
|
-
tr.insert(tr.mapping.map(rect.tableStart + pos), type.createAndFill());
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return tr;
|
|
62
|
-
};
|
|
63
|
-
var ɵ0 = addTableGroupColumn;
|
|
64
|
-
var removeTableGroupColumn = function (tr, _a, mainTable, requiredGroup, doc) {
|
|
65
|
-
var right = _a.right, left = _a.left;
|
|
66
|
-
var rect;
|
|
67
|
-
mainTable.node.descendants(function (tableChildNode, offset) {
|
|
68
|
-
if (requiredGroup(tableChildNode)) {
|
|
69
|
-
var i_2 = -1;
|
|
70
|
-
tableChildNode.firstChild.descendants(function (childNode, pos) {
|
|
71
|
-
if (isTableCell(childNode) || isTableHeaderCell(childNode)) {
|
|
72
|
-
i_2 = i_2 + 1;
|
|
73
|
-
if (i_2 >= left && i_2 < right) {
|
|
74
|
-
var resolvedPos = doc.resolve(pos + offset + mainTable.start + childNode.nodeSize);
|
|
75
|
-
var selection = new Selection(resolvedPos, resolvedPos);
|
|
76
|
-
rect = selectedRect(selection);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
// Do nothing if thead, tfoot or tbody is missing
|
|
83
|
-
if (!rect) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
for (var i = rect.right - 1;; i--) {
|
|
87
|
-
removeColumn(tr, rect, i);
|
|
88
|
-
if (i === rect.left) {
|
|
89
|
-
break;
|
|
90
|
-
}
|
|
91
|
-
rect.table = rect.tableStart ? tr.doc.nodeAt(rect.tableStart - 1) : tr.doc;
|
|
92
|
-
rect.map = TableMap.get(rect.table);
|
|
93
|
-
}
|
|
94
|
-
return;
|
|
95
|
-
};
|
|
96
|
-
var ɵ1 = removeTableGroupColumn;
|
|
97
|
-
var removeColumn = function (tr, _a, col) {
|
|
98
|
-
var map = _a.map, table = _a.table, tableStart = _a.tableStart;
|
|
99
|
-
for (var row = 0; row < map.height;) {
|
|
100
|
-
var index = row * map.width + col;
|
|
101
|
-
var pos = map.map[index];
|
|
102
|
-
var cell = table.nodeAt(pos);
|
|
103
|
-
// If this is part of a col-spanning cell
|
|
104
|
-
if ((col > 0 && map.map[index - 1] === pos) || (col < map.width - 1 && map.map[index + 1] === pos)) {
|
|
105
|
-
tr.setNodeMarkup(tr.mapping.map(tableStart + pos), null, removeColSpan(cell.attrs, col - map.colCount(pos)));
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
var start = tr.mapping.map(tableStart + pos);
|
|
109
|
-
tr.delete(start, start + cell.nodeSize);
|
|
110
|
-
}
|
|
111
|
-
row += cell.attrs.rowspan;
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
var ɵ2 = removeColumn;
|
|
115
|
-
/**
|
|
116
|
-
* @hidden
|
|
117
|
-
*/
|
|
118
|
-
// Command to add a column before the column with the selection.
|
|
119
|
-
export var addColumnBefore = function (state, dispatch) {
|
|
120
|
-
if (!isInTable(state)) {
|
|
121
|
-
return false;
|
|
122
|
-
}
|
|
123
|
-
if (dispatch) {
|
|
124
|
-
var rect = selectedRect(state.selection);
|
|
125
|
-
var mainTable = findParentNodeClosestToPos(state.selection.$anchor, isTable);
|
|
126
|
-
var tHeadTr = addTableGroupColumn(state.tr, rect, rect.left, mainTable, isTableHead, state.doc);
|
|
127
|
-
var tBodyTr = addTableGroupColumn(tHeadTr, rect, rect.left, mainTable, isTableBody, state.doc);
|
|
128
|
-
var tFootTr = addTableGroupColumn(tBodyTr, rect, rect.left, mainTable, isTableFoot, state.doc);
|
|
129
|
-
dispatch(tFootTr);
|
|
130
|
-
}
|
|
131
|
-
return true;
|
|
132
|
-
};
|
|
133
|
-
/**
|
|
134
|
-
* @hidden
|
|
135
|
-
*/
|
|
136
|
-
// Command to add a column after the column with the selection.
|
|
137
|
-
export var addColumnAfter = function (state, dispatch) {
|
|
138
|
-
if (!isInTable(state)) {
|
|
139
|
-
return false;
|
|
140
|
-
}
|
|
141
|
-
if (dispatch) {
|
|
142
|
-
var rect = selectedRect(state.selection);
|
|
143
|
-
var mainTable = findParentNodeClosestToPos(state.selection.$anchor, isTable);
|
|
144
|
-
var theadTr = addTableGroupColumn(state.tr, rect, rect.right, mainTable, isTableHead, state.doc);
|
|
145
|
-
var tBodyTr = addTableGroupColumn(theadTr, rect, rect.right, mainTable, isTableBody, state.doc);
|
|
146
|
-
var tFootTr = addTableGroupColumn(tBodyTr, rect, rect.right, mainTable, isTableFoot, state.doc);
|
|
147
|
-
dispatch(tFootTr);
|
|
148
|
-
}
|
|
149
|
-
return true;
|
|
150
|
-
};
|
|
151
|
-
var addRow = function (tr, _a, row) {
|
|
152
|
-
var map = _a.map, tableStart = _a.tableStart, table = _a.table;
|
|
153
|
-
var rowPos = tableStart;
|
|
154
|
-
for (var i = 0; i < row; i++) {
|
|
155
|
-
rowPos += table.child(i).nodeSize;
|
|
156
|
-
}
|
|
157
|
-
var cells = [];
|
|
158
|
-
var refRow = row > 0 ? -1 : 0;
|
|
159
|
-
if (rowIsHeader(map, table, row + refRow)) {
|
|
160
|
-
refRow = row === 0 || row === map.height ? null : 0;
|
|
161
|
-
}
|
|
162
|
-
for (var col = 0, index = map.width * row; col < map.width; col++, index++) {
|
|
163
|
-
// Covered by a rowspan cell
|
|
164
|
-
if (row > 0 && row < map.height && map.map[index] === map.map[index - map.width]) {
|
|
165
|
-
var pos = map.map[index];
|
|
166
|
-
var attrs = table.nodeAt(pos).attrs;
|
|
167
|
-
tr.setNodeMarkup(tableStart + pos, null, setAttr(attrs, 'rowspan', attrs.rowspan + 1));
|
|
168
|
-
col += attrs.colspan - 1;
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
var type = refRow == null ? tableNodeTypes(table.type.schema).cell : table.nodeAt(map.map[index + refRow * map.width]).type;
|
|
172
|
-
cells.push(type.createAndFill());
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
tr.insert(rowPos, tableNodeTypes(table.type.schema).row.create(null, cells));
|
|
176
|
-
return tr;
|
|
177
|
-
};
|
|
178
|
-
var ɵ3 = addRow;
|
|
179
|
-
/**
|
|
180
|
-
* @hidden
|
|
181
|
-
*/
|
|
182
|
-
// Add a table row before the selection.
|
|
183
|
-
export var addRowBefore = function (state, dispatch) {
|
|
184
|
-
if (!isInTable(state)) {
|
|
185
|
-
return false;
|
|
186
|
-
}
|
|
187
|
-
if (dispatch) {
|
|
188
|
-
var rect = selectedRect(state.selection);
|
|
189
|
-
dispatch(addRow(state.tr, rect, rect.top));
|
|
190
|
-
}
|
|
191
|
-
return true;
|
|
192
|
-
};
|
|
193
|
-
/**
|
|
194
|
-
* @hidden
|
|
195
|
-
*/
|
|
196
|
-
// Add a table row after the selection.
|
|
197
|
-
export var addRowAfter = function (state, dispatch) {
|
|
198
|
-
if (!isInTable(state)) {
|
|
199
|
-
return false;
|
|
200
|
-
}
|
|
201
|
-
if (dispatch) {
|
|
202
|
-
var rect = selectedRect(state.selection);
|
|
203
|
-
dispatch(addRow(state.tr, rect, rect.bottom));
|
|
204
|
-
}
|
|
205
|
-
return true;
|
|
206
|
-
};
|
|
207
|
-
/**
|
|
208
|
-
* @hidden
|
|
209
|
-
*/
|
|
210
|
-
// Command function that removes the selected columns from a table.
|
|
211
|
-
export var deleteColumn = function (state, dispatch) {
|
|
212
|
-
if (!isInTable(state)) {
|
|
213
|
-
return false;
|
|
214
|
-
}
|
|
215
|
-
if (dispatch) {
|
|
216
|
-
var rect = selectedRect(state.selection);
|
|
217
|
-
// if only one column left - delete the whole table
|
|
218
|
-
if (rect.left === 0 && rect.right === rect.map.width) {
|
|
219
|
-
return deleteTable(state, dispatch);
|
|
220
|
-
}
|
|
221
|
-
var mainTable = findParentNodeClosestToPos(state.selection.$anchor, isTable);
|
|
222
|
-
var tr = state.tr;
|
|
223
|
-
removeTableGroupColumn(tr, rect, mainTable, isTableFoot, tr.doc);
|
|
224
|
-
removeTableGroupColumn(tr, rect, mainTable, isTableBody, tr.doc);
|
|
225
|
-
removeTableGroupColumn(tr, rect, mainTable, isTableHead, tr.doc);
|
|
226
|
-
dispatch(tr);
|
|
227
|
-
}
|
|
228
|
-
return true;
|
|
229
|
-
};
|
|
230
|
-
var removeRow = function (tr, _a, row) {
|
|
231
|
-
var map = _a.map, table = _a.table, tableStart = _a.tableStart;
|
|
232
|
-
var rowPos = 0;
|
|
233
|
-
for (var i = 0; i < row; i++) {
|
|
234
|
-
rowPos += table.child(i).nodeSize;
|
|
235
|
-
}
|
|
236
|
-
var nextRow = rowPos + table.child(row).nodeSize;
|
|
237
|
-
var mapFrom = tr.mapping.maps.length;
|
|
238
|
-
tr.delete(rowPos + tableStart, nextRow + tableStart);
|
|
239
|
-
for (var col = 0, index = row * map.width; col < map.width; col++, index++) {
|
|
240
|
-
var pos = map.map[index];
|
|
241
|
-
if (row > 0 && pos === map.map[index - map.width]) {
|
|
242
|
-
// If this cell starts in the row above, simply reduce its rowspan
|
|
243
|
-
var attrs = table.nodeAt(pos).attrs;
|
|
244
|
-
tr.setNodeMarkup(tr.mapping.slice(mapFrom).map(pos + tableStart), null, setAttr(attrs, 'rowspan', attrs.rowspan - 1));
|
|
245
|
-
col += attrs.colspan - 1;
|
|
246
|
-
}
|
|
247
|
-
else if (row < map.width && pos === map.map[index + map.width]) {
|
|
248
|
-
// Else, if it continues in the row below, it has to be moved down
|
|
249
|
-
var cell = table.nodeAt(pos);
|
|
250
|
-
var copy = cell.type.create(setAttr(cell.attrs, 'rowspan', cell.attrs.rowspan - 1), cell.content);
|
|
251
|
-
var newPos = map.positionAt(row + 1, col, table);
|
|
252
|
-
tr.insert(tr.mapping.slice(mapFrom).map(tableStart + newPos), copy);
|
|
253
|
-
col += cell.attrs.colspan - 1;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
};
|
|
257
|
-
var ɵ4 = removeRow;
|
|
258
|
-
/**
|
|
259
|
-
* @hidden
|
|
260
|
-
*/
|
|
261
|
-
// Remove the selected rows from a table.
|
|
262
|
-
export var deleteRow = function (state, dispatch) {
|
|
263
|
-
if (!isInTable(state)) {
|
|
264
|
-
return false;
|
|
265
|
-
}
|
|
266
|
-
if (dispatch) {
|
|
267
|
-
var rect_1 = selectedRect(state.selection);
|
|
268
|
-
var tr = state.tr;
|
|
269
|
-
if (rect_1.top === 0 && rect_1.bottom === rect_1.map.height) {
|
|
270
|
-
var mainTable = findParentNodeClosestToPos(state.selection.$anchor, isTable);
|
|
271
|
-
if (mainTable.node.childCount === 1) {
|
|
272
|
-
deleteTable(state, dispatch);
|
|
273
|
-
}
|
|
274
|
-
else {
|
|
275
|
-
deleteTableElement(function (n) { return n.type.name === rect_1.table.type.name; })(state, dispatch);
|
|
276
|
-
}
|
|
277
|
-
return true;
|
|
278
|
-
}
|
|
279
|
-
for (var i = rect_1.bottom - 1;; i--) {
|
|
280
|
-
removeRow(tr, rect_1, i);
|
|
281
|
-
if (i === rect_1.top) {
|
|
282
|
-
break;
|
|
283
|
-
}
|
|
284
|
-
rect_1.table = rect_1.tableStart ? tr.doc.nodeAt(rect_1.tableStart - 1) : tr.doc;
|
|
285
|
-
rect_1.map = TableMap.get(rect_1.table);
|
|
286
|
-
}
|
|
287
|
-
dispatch(tr);
|
|
288
|
-
}
|
|
289
|
-
return true;
|
|
290
|
-
};
|
|
291
|
-
/**
|
|
292
|
-
* @hidden
|
|
293
|
-
*/
|
|
294
|
-
// Merge the selected cells into a single cell. Only available when
|
|
295
|
-
// the selected cells' outline forms a rectangle.
|
|
296
|
-
export var mergeCells = function (state, dispatch) {
|
|
297
|
-
var sel = state.selection;
|
|
298
|
-
if (!(sel instanceof CellSelection) || sel.$anchorCell.pos === sel.$headCell.pos) {
|
|
299
|
-
return false;
|
|
300
|
-
}
|
|
301
|
-
var rect = selectedRect(state.selection);
|
|
302
|
-
var map = rect.map;
|
|
303
|
-
if (cellsOverlapRectangle(map, rect)) {
|
|
304
|
-
return false;
|
|
305
|
-
}
|
|
306
|
-
if (dispatch) {
|
|
307
|
-
var tr = state.tr;
|
|
308
|
-
var seen = {};
|
|
309
|
-
var content = Fragment.empty;
|
|
310
|
-
var mergedPos = void 0;
|
|
311
|
-
var mergedCell = void 0;
|
|
312
|
-
for (var row = rect.top; row < rect.bottom; row++) {
|
|
313
|
-
for (var col = rect.left; col < rect.right; col++) {
|
|
314
|
-
var cellPos = map.map[row * map.width + col], cell = rect.table.nodeAt(cellPos);
|
|
315
|
-
if (seen[cellPos]) {
|
|
316
|
-
continue;
|
|
317
|
-
}
|
|
318
|
-
seen[cellPos] = true;
|
|
319
|
-
if (mergedPos === null) {
|
|
320
|
-
mergedPos = cellPos;
|
|
321
|
-
mergedCell = cell;
|
|
322
|
-
}
|
|
323
|
-
else {
|
|
324
|
-
if (!isCellEmpty(cell)) {
|
|
325
|
-
content = content.append(cell.content);
|
|
326
|
-
}
|
|
327
|
-
var mapped = tr.mapping.map(cellPos + rect.tableStart);
|
|
328
|
-
tr.delete(mapped, mapped + cell.nodeSize);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
tr.setNodeMarkup(mergedPos + rect.tableStart, null, setAttr(addColSpan(mergedCell.attrs, mergedCell.attrs.colspan, rect.right - rect.left - mergedCell.attrs.colspan), 'rowspan', rect.bottom - rect.top));
|
|
333
|
-
if (content.size) {
|
|
334
|
-
var end = mergedPos + 1 + mergedCell.content.size;
|
|
335
|
-
var start = isCellEmpty(mergedCell) ? mergedPos + 1 : end;
|
|
336
|
-
tr.replaceWith(start + rect.tableStart, end + rect.tableStart, content);
|
|
337
|
-
}
|
|
338
|
-
tr.setSelection(new CellSelection(tr.doc.resolve(mergedPos + rect.tableStart)));
|
|
339
|
-
dispatch(tr);
|
|
340
|
-
}
|
|
341
|
-
return true;
|
|
342
|
-
};
|
|
343
|
-
/**
|
|
344
|
-
* @hidden
|
|
345
|
-
*/
|
|
346
|
-
// Split a selected cell, whose rowpan or colspan is greater than one,
|
|
347
|
-
// into smaller cells. Use the first cell type for the new cells.
|
|
348
|
-
export var splitCell = function (state, dispatch) {
|
|
349
|
-
var nodeTypes = tableNodeTypes(state.schema);
|
|
350
|
-
return splitCellWithType(function (_a) {
|
|
351
|
-
var node = _a.node;
|
|
352
|
-
return nodeTypes[node.type.spec.tableRole];
|
|
353
|
-
})(state, dispatch);
|
|
354
|
-
};
|
|
355
|
-
var deleteTableElement = function (selector) { return function (state, dispatch) {
|
|
356
|
-
var $pos = state.selection.$anchor;
|
|
357
|
-
for (var d = $pos.depth; d > 0; d--) {
|
|
358
|
-
var node = $pos.node(d);
|
|
359
|
-
if (selector(node)) {
|
|
360
|
-
if (dispatch) {
|
|
361
|
-
var tr = state.tr;
|
|
362
|
-
tr.delete($pos.before(d), $pos.after(d)).scrollIntoView();
|
|
363
|
-
dispatch(tr);
|
|
364
|
-
}
|
|
365
|
-
return true;
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
return false;
|
|
369
|
-
}; };
|
|
370
|
-
var ɵ5 = deleteTableElement;
|
|
371
|
-
/**
|
|
372
|
-
* @hidden
|
|
373
|
-
*/
|
|
374
|
-
// Deletes the table around the selection, if any.
|
|
375
|
-
export var deleteTable = deleteTableElement(isTable);
|
|
376
|
-
export { ɵ0, ɵ1, ɵ2, ɵ3, ɵ4, ɵ5 };
|
|
@@ -10,7 +10,7 @@ import { map, filter, take } from 'rxjs/operators';
|
|
|
10
10
|
import { ToolBarComponent } from '@progress/kendo-angular-toolbar';
|
|
11
11
|
import { DialogService } from '@progress/kendo-angular-dialog';
|
|
12
12
|
import { hasObservers, isDocumentAvailable, KendoInput } from '@progress/kendo-angular-common';
|
|
13
|
-
import { buildKeymap, buildListKeymap, getHtml, pasteCleanup, sanitize, removeComments, sanitizeClassAttr, sanitizeStyleAttr, removeAttribute, placeholder, EditorView, EditorState, baseKeymap, keymap, history, parseContent, Plugin, PluginKey, TextSelection, Schema, AllSelection, gapCursor, getSelectionText, imageResizing } from '@progress/kendo-editor-common';
|
|
13
|
+
import { buildKeymap, buildListKeymap, getHtml, pasteCleanup, sanitize, removeComments, sanitizeClassAttr, sanitizeStyleAttr, removeAttribute, placeholder, EditorView, EditorState, baseKeymap, keymap, history, parseContent, Plugin, PluginKey, TextSelection, Schema, AllSelection, gapCursor, getSelectionText, imageResizing, tableEditing } from '@progress/kendo-editor-common';
|
|
14
14
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
15
15
|
import { packageMetadata } from './package-metadata';
|
|
16
16
|
import { schema } from './config/schema';
|
|
@@ -125,6 +125,9 @@ var EditorComponent = /** @class */ (function () {
|
|
|
125
125
|
this.contentAreaLoaded = new Subject();
|
|
126
126
|
this.dispatchTransaction = function (tr) {
|
|
127
127
|
var docChanged = tr.docChanged;
|
|
128
|
+
if (_this.disabled || (_this.readonly && docChanged)) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
128
131
|
if (docChanged) {
|
|
129
132
|
var doc = tr.doc;
|
|
130
133
|
var html_1 = getHtml({ doc: doc });
|
|
@@ -713,16 +716,13 @@ var EditorComponent = /** @class */ (function () {
|
|
|
713
716
|
}
|
|
714
717
|
}); }
|
|
715
718
|
}),
|
|
716
|
-
new Plugin({
|
|
717
|
-
key: new PluginKey('editor-filter-disabled-state'),
|
|
718
|
-
filterTransaction: function () { return !_this.disabled || _this.inForm; }
|
|
719
|
-
}),
|
|
720
719
|
history(),
|
|
721
720
|
keymap(buildListKeymap(currentSchema)),
|
|
722
721
|
keymap(buildKeymap(currentSchema, { applyToWord: this.applyToWord })),
|
|
723
722
|
keymap(baseKeymap),
|
|
724
723
|
gapCursor(),
|
|
725
|
-
imageResizing()
|
|
724
|
+
imageResizing(),
|
|
725
|
+
tableEditing()
|
|
726
726
|
];
|
|
727
727
|
if (this.placeholder) {
|
|
728
728
|
defaultPlugins.push(placeholder(this.placeholder));
|
|
@@ -9,7 +9,7 @@ export var packageMetadata = {
|
|
|
9
9
|
name: '@progress/kendo-angular-editor',
|
|
10
10
|
productName: 'Kendo UI for Angular',
|
|
11
11
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
12
|
-
publishDate:
|
|
12
|
+
publishDate: 1641984793,
|
|
13
13
|
version: '',
|
|
14
14
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
|
|
15
15
|
};
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { alignBlocks, alignLeftRules, alignCenterRules, alignRightRules, alignJustifyRules, alignRemoveRules, indent, outdent, setHtml, getHtml, insertImage, insertText, applyLink, removeLink, expandToWordWrap,
|
|
6
6
|
//marks
|
|
7
|
-
bold, italic, underline, strikethrough, subscript, superscript, link, toggleInlineFormat, applyInlineStyle, formatBlockElements, toggleOrderedList, toggleUnorderedList, isAligned, undo, redo, cleanFormatting, selectAll } from '@progress/kendo-editor-common';
|
|
8
|
-
import { insertTable
|
|
7
|
+
bold, italic, underline, strikethrough, subscript, superscript, link, toggleInlineFormat, applyInlineStyle, formatBlockElements, toggleOrderedList, toggleUnorderedList, isAligned, undo, redo, cleanFormatting, selectAll, addColumnBefore, addColumnAfter, addRowBefore, addRowAfter, deleteRow, deleteColumn, deleteTable, mergeCells, splitCell } from '@progress/kendo-editor-common';
|
|
8
|
+
import { insertTable } from './table-commands';
|
|
9
9
|
const alignRemove = (state, dispatch) => alignBlocks(alignRemoveRules)(state, dispatch);
|
|
10
10
|
const ɵ0 = alignRemove;
|
|
11
11
|
const ɵ1 = (applyToWord) => expandToWordWrap(toggleInlineFormat, Object.assign({}, bold, { applyToWord })), ɵ2 = (options) => cleanFormatting(options), ɵ3 = attrs => expandToWordWrap(applyLink, { mark: 'link', attrs: attrs.value, applyToWord: attrs.applyToWord }), ɵ4 = attrs => expandToWordWrap(applyInlineStyle, { style: 'font-family', value: attrs.value, applyToWord: attrs.applyToWord }), ɵ5 = attrs => expandToWordWrap(applyInlineStyle, { style: 'font-size', value: attrs.value + 'px', applyToWord: attrs.applyToWord }), ɵ6 = attrs => expandToWordWrap(applyLink, { mark: 'link', attrs: attrs, applyToWord: attrs.applyToWord }), ɵ7 = text => insertText(text), ɵ8 = (applyToWord) => expandToWordWrap(toggleInlineFormat, Object.assign({}, italic, { applyToWord })), ɵ9 = (applyToWord) => expandToWordWrap(toggleInlineFormat, Object.assign({}, strikethrough, { applyToWord })), ɵ10 = (applyToWord) => expandToWordWrap(toggleInlineFormat, Object.assign({}, subscript, { applyToWord })), ɵ11 = (applyToWord) => expandToWordWrap(toggleInlineFormat, Object.assign({}, superscript, { applyToWord })), ɵ12 = (applyToWord) => expandToWordWrap(toggleInlineFormat, Object.assign({}, underline, { applyToWord })), ɵ13 = () => removeLink(link), ɵ14 = attrs => expandToWordWrap(applyInlineStyle, { style: 'color', value: attrs.value, applyToWord: attrs.applyToWord }), ɵ15 = attrs => expandToWordWrap(applyInlineStyle, { style: 'background-color', value: attrs.value, applyToWord: attrs.applyToWord }), ɵ16 = () => (state, dispatch) => selectAll(state, dispatch);
|
|
@@ -4,12 +4,11 @@
|
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { semanticNodes } from './semantic-nodes';
|
|
6
6
|
import { marks as commonMarks, nodes as commonNodes, Schema } from '@progress/kendo-editor-common';
|
|
7
|
-
import { tableNodes } from './table-nodes';
|
|
8
7
|
/**
|
|
9
8
|
* @hidden
|
|
10
9
|
*/
|
|
11
10
|
const marks = commonMarks;
|
|
12
|
-
const nodes = Object.assign(commonNodes,
|
|
11
|
+
const nodes = Object.assign(commonNodes, semanticNodes);
|
|
13
12
|
/**
|
|
14
13
|
* @hidden
|
|
15
14
|
*/
|
|
@@ -8,39 +8,3 @@ import { Command } from '../common/commands';
|
|
|
8
8
|
* @hidden
|
|
9
9
|
*/
|
|
10
10
|
export declare const insertTable: (attrs: TableData) => Command;
|
|
11
|
-
/**
|
|
12
|
-
* @hidden
|
|
13
|
-
*/
|
|
14
|
-
export declare const addColumnBefore: Command;
|
|
15
|
-
/**
|
|
16
|
-
* @hidden
|
|
17
|
-
*/
|
|
18
|
-
export declare const addColumnAfter: Command;
|
|
19
|
-
/**
|
|
20
|
-
* @hidden
|
|
21
|
-
*/
|
|
22
|
-
export declare const addRowBefore: Command;
|
|
23
|
-
/**
|
|
24
|
-
* @hidden
|
|
25
|
-
*/
|
|
26
|
-
export declare const addRowAfter: Command;
|
|
27
|
-
/**
|
|
28
|
-
* @hidden
|
|
29
|
-
*/
|
|
30
|
-
export declare const deleteColumn: Command;
|
|
31
|
-
/**
|
|
32
|
-
* @hidden
|
|
33
|
-
*/
|
|
34
|
-
export declare const deleteRow: Command;
|
|
35
|
-
/**
|
|
36
|
-
* @hidden
|
|
37
|
-
*/
|
|
38
|
-
export declare const mergeCells: Command;
|
|
39
|
-
/**
|
|
40
|
-
* @hidden
|
|
41
|
-
*/
|
|
42
|
-
export declare const splitCell: Command;
|
|
43
|
-
/**
|
|
44
|
-
* @hidden
|
|
45
|
-
*/
|
|
46
|
-
export declare const deleteTable: Command;
|