@progress/kendo-angular-editor 2.5.0 → 3.0.0-dev.202201191455
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/LICENSE.md +1 -1
- package/NOTICE.txt +119 -79
- package/README.md +1 -1
- package/dist/cdn/js/kendo-angular-editor.js +2 -2
- package/dist/cdn/main.js +1 -1
- package/dist/es/common/error-messages.js +4 -3
- package/dist/es/config/command-icons.js +1 -0
- package/dist/es/config/commands.js +18 -17
- package/dist/es/config/schema.js +2 -4
- package/dist/es/config/table-commands.js +1 -363
- package/dist/es/dialogs/colorpicker-dialog.component.js +1 -1
- package/dist/es/dialogs/file-link-dialog.component.js +1 -1
- package/dist/es/dialogs/image-dialog.component.js +1 -1
- package/dist/es/editor-toolbar-state.js +12 -2
- package/dist/es/editor.component.js +103 -75
- package/dist/es/editor.module.js +6 -3
- package/dist/es/index.js +2 -0
- package/dist/es/localization/messages.js +4 -0
- package/dist/es/main.js +1 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/{es2015/config/table-nodes.d.ts → es/preventable-events/paste-event-data.js} +0 -5
- package/dist/es/preventable-events/paste-event.js +25 -0
- package/dist/es/tools/blockquote/editor-blockquote-button.directive.js +48 -0
- package/dist/es/tools/colorpicker/editor-colorpicker.component.js +24 -7
- package/dist/es/tools/format/editor-format-dropdownlist.component.js +1 -1
- package/dist/es/tools/format/editor-format.component.js +0 -1
- package/dist/es/tools/tables/popup-table-grid.component.js +1 -1
- package/dist/es2015/common/commands.d.ts +1 -1
- package/dist/es2015/common/error-messages.js +4 -3
- package/dist/es2015/common/format-item.interface.d.ts +1 -1
- package/dist/es2015/common/paste-cleanup-settings.d.ts +14 -0
- package/dist/es2015/config/command-icons.js +1 -0
- package/dist/es2015/config/commands.js +18 -17
- package/dist/es2015/config/schema.d.ts +1 -1
- package/dist/es2015/config/schema.js +2 -3
- package/dist/es2015/config/table-commands.d.ts +0 -36
- package/dist/es2015/config/table-commands.js +1 -357
- package/dist/es2015/dialogs/colorpicker-dialog.component.js +1 -1
- package/dist/es2015/dialogs/file-link-dialog.component.js +4 -4
- package/dist/es2015/dialogs/image-dialog.component.js +4 -4
- package/dist/es2015/editor-toolbar-state.js +12 -2
- package/dist/es2015/editor.component.d.ts +16 -11
- package/dist/es2015/editor.component.js +105 -75
- package/dist/es2015/editor.module.js +6 -3
- package/dist/es2015/index.d.ts +2 -0
- package/dist/es2015/index.js +2 -0
- package/dist/es2015/index.metadata.json +1 -1
- package/dist/es2015/localization/messages.d.ts +4 -0
- package/dist/es2015/localization/messages.js +4 -0
- package/dist/es2015/main.d.ts +2 -0
- package/dist/es2015/main.js +1 -0
- package/dist/es2015/package-metadata.js +1 -1
- package/dist/es2015/preventable-events/paste-event-data.d.ts +21 -0
- package/dist/es2015/preventable-events/paste-event-data.js +4 -0
- package/dist/es2015/preventable-events/paste-event.d.ts +27 -0
- package/dist/es2015/preventable-events/paste-event.js +20 -0
- package/dist/es2015/tools/blockquote/editor-blockquote-button.directive.d.ts +30 -0
- package/dist/es2015/tools/blockquote/editor-blockquote-button.directive.js +45 -0
- package/dist/es2015/tools/colorpicker/editor-colorpicker.component.d.ts +8 -2
- package/dist/es2015/tools/colorpicker/editor-colorpicker.component.js +20 -7
- package/dist/es2015/tools/format/editor-format-dropdownlist.component.js +0 -4
- package/dist/es2015/tools/format/editor-format.component.js +0 -1
- package/dist/es2015/tools/tables/popup-table-grid.component.js +2 -2
- package/dist/fesm2015/index.js +354 -1624
- package/dist/fesm5/index.js +365 -1649
- package/dist/npm/common/error-messages.js +4 -2
- package/dist/npm/config/command-icons.js +1 -0
- package/dist/npm/config/commands.js +16 -14
- package/dist/npm/config/schema.js +2 -4
- package/dist/npm/config/table-commands.js +1 -368
- package/dist/npm/dialogs/colorpicker-dialog.component.js +1 -1
- package/dist/npm/dialogs/file-link-dialog.component.js +1 -1
- package/dist/npm/dialogs/image-dialog.component.js +1 -1
- package/dist/npm/editor-toolbar-state.js +11 -1
- package/dist/npm/editor.component.js +99 -71
- package/dist/npm/editor.module.js +7 -4
- package/dist/npm/index.js +5 -0
- package/dist/npm/localization/messages.js +4 -0
- package/dist/npm/main.js +2 -0
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/preventable-events/paste-event-data.js +6 -0
- package/dist/npm/preventable-events/paste-event.js +27 -0
- package/dist/npm/tools/blockquote/editor-blockquote-button.directive.js +50 -0
- package/dist/npm/tools/colorpicker/editor-colorpicker.component.js +24 -7
- package/dist/npm/tools/format/editor-format-dropdownlist.component.js +1 -1
- package/dist/npm/tools/format/editor-format.component.js +0 -1
- package/dist/npm/tools/tables/popup-table-grid.component.js +1 -1
- package/dist/systemjs/kendo-angular-editor.js +1 -1
- package/package.json +18 -18
- 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.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
package/dist/fesm5/index.js
CHANGED
|
@@ -5,19 +5,19 @@
|
|
|
5
5
|
import { __assign, __extends, __decorate, __param, __metadata } from 'tslib';
|
|
6
6
|
import { Inject, Optional, Input, ViewChild, ElementRef, Component, Injectable, isDevMode, Output, EventEmitter, HostBinding, ContentChild, ViewContainerRef, forwardRef, ChangeDetectorRef, NgZone, TemplateRef, Host, Directive, NgModule } from '@angular/core';
|
|
7
7
|
import { FormControl, Validators, FormGroup, NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
8
|
-
import { Subject, fromEvent,
|
|
9
|
-
import { take,
|
|
8
|
+
import { Subject, fromEvent, BehaviorSubject, zip, interval } from 'rxjs';
|
|
9
|
+
import { take, map, filter, concatMap, takeUntil } from 'rxjs/operators';
|
|
10
10
|
import { ToolBarComponent, ToolBarToolComponent, ToolBarButtonComponent, ToolBarModule } from '@progress/kendo-angular-toolbar';
|
|
11
11
|
import { DialogRef, DialogContentBase, DialogService, DialogModule } from '@progress/kendo-angular-dialog';
|
|
12
|
-
import { isDocumentAvailable, guid, KendoInput, Keys } from '@progress/kendo-angular-common';
|
|
13
|
-
import { nodes, Schema, marks,
|
|
12
|
+
import { isDocumentAvailable, guid, PreventableEvent, KendoInput, hasObservers, Keys } from '@progress/kendo-angular-common';
|
|
13
|
+
import { nodes, Schema, marks, createTable, insertNode, expandToWordWrap, toggleInlineFormat, bold, cleanFormatting, applyLink, applyInlineStyle, insertText, italic, strikethrough, subscript, superscript, underline, removeLink, link, selectAll, isAligned, alignCenterRules, alignBlocks, alignRemoveRules, alignJustifyRules, alignLeftRules, alignRightRules, formatBlockElements, getHtml, indent, insertImage, toggleOrderedList, toggleUnorderedList, outdent, redo, setHtml, undo, blockquote, addColumnBefore, addColumnAfter, addRowBefore, addRowAfter, deleteRow, deleteColumn, mergeCells, splitCell, deleteTable, hasMark, activeNode, canIndentAsListItem, canBeIndented, indentRules, hasNode, canOutdentAsListItem, outdentRules, isIndented, getActiveMarks, expandSelection, getNodeFromSelection, getMark, getSelectionText, TextSelection, parseContent, Plugin, PluginKey, history, keymap, buildListKeymap, buildKeymap, baseKeymap, gapCursor, imageResizing, tableEditing, placeholder, EditorState, EditorView, pasteCleanup, AllSelection, removeComments, sanitize, removeAttribute, sanitizeStyleAttr, sanitizeClassAttr } from '@progress/kendo-editor-common';
|
|
14
14
|
export { Schema, EditorState, Plugin, PluginKey, Transaction, EditorView, Decoration, DecorationSet, NodeType, Node, MarkType, Mark, InputRule, inputRules, wrappingInputRule, textblockTypeInputRule, keymap, baseKeymap, history, dropCursor, gapCursor, tableNodes, getSelectionText } from '@progress/kendo-editor-common';
|
|
15
15
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
16
16
|
import { L10N_PREFIX, RTL, MessageService, LocalizationService, ComponentMessages } from '@progress/kendo-angular-l10n';
|
|
17
17
|
import { CommonModule } from '@angular/common';
|
|
18
18
|
import { DropDownListComponent, DropDownsModule } from '@progress/kendo-angular-dropdowns';
|
|
19
19
|
import { ButtonModule } from '@progress/kendo-angular-buttons';
|
|
20
|
-
import { ColorPickerComponent, ColorPickerModule, NumericTextBoxModule, TextBoxModule } from '@progress/kendo-angular-inputs';
|
|
20
|
+
import { ColorPickerComponent, ColorPickerModule, NumericTextBoxModule, CheckBoxModule, TextBoxModule } from '@progress/kendo-angular-inputs';
|
|
21
21
|
import { PopupService } from '@progress/kendo-angular-popup';
|
|
22
22
|
|
|
23
23
|
/**
|
|
@@ -27,7 +27,7 @@ var packageMetadata = {
|
|
|
27
27
|
name: '@progress/kendo-angular-editor',
|
|
28
28
|
productName: 'Kendo UI for Angular',
|
|
29
29
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
30
|
-
publishDate:
|
|
30
|
+
publishDate: 1642603748,
|
|
31
31
|
version: '',
|
|
32
32
|
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'
|
|
33
33
|
};
|
|
@@ -67,16 +67,6 @@ var getAttributes = function (dom) {
|
|
|
67
67
|
}
|
|
68
68
|
return result;
|
|
69
69
|
};
|
|
70
|
-
/**
|
|
71
|
-
* @hidden
|
|
72
|
-
*/
|
|
73
|
-
var serializeDOMAttrs = function (el) {
|
|
74
|
-
return Array.from(el.attributes)
|
|
75
|
-
.reduce(function (acc, curr) {
|
|
76
|
-
var _a;
|
|
77
|
-
return Object.assign({}, acc, (_a = {}, _a[curr.name] = curr.value, _a));
|
|
78
|
-
}, {});
|
|
79
|
-
};
|
|
80
70
|
/**
|
|
81
71
|
* @hidden
|
|
82
72
|
*/
|
|
@@ -97,38 +87,6 @@ var createDefaultAttributes = function (attrs) {
|
|
|
97
87
|
* @hidden
|
|
98
88
|
*/
|
|
99
89
|
var hole = 0;
|
|
100
|
-
/**
|
|
101
|
-
* @hidden
|
|
102
|
-
*/
|
|
103
|
-
var isSchemaNode = function (schemaNodeName) { return function (node) { return node.type.name === schemaNodeName; }; };
|
|
104
|
-
/**
|
|
105
|
-
* @hidden
|
|
106
|
-
*/
|
|
107
|
-
var isTable = isSchemaNode('table');
|
|
108
|
-
/**
|
|
109
|
-
* @hidden
|
|
110
|
-
*/
|
|
111
|
-
var isTableBody = isSchemaNode('table_body');
|
|
112
|
-
/**
|
|
113
|
-
* @hidden
|
|
114
|
-
*/
|
|
115
|
-
var isTableHead = isSchemaNode('table_head');
|
|
116
|
-
/**
|
|
117
|
-
* @hidden
|
|
118
|
-
*/
|
|
119
|
-
var isTableFoot = isSchemaNode('table_foot');
|
|
120
|
-
/**
|
|
121
|
-
* @hidden
|
|
122
|
-
*/
|
|
123
|
-
var isTableRow = isSchemaNode('table_row');
|
|
124
|
-
/**
|
|
125
|
-
* @hidden
|
|
126
|
-
*/
|
|
127
|
-
var isTableCell = isSchemaNode('table_cell');
|
|
128
|
-
/**
|
|
129
|
-
* @hidden
|
|
130
|
-
*/
|
|
131
|
-
var isTableHeaderCell = isSchemaNode('table_header');
|
|
132
90
|
|
|
133
91
|
var createSemanticNode = function (tagName) { return ({
|
|
134
92
|
// Uncaught SyntaxError: Mixing inline and block content (in content expression '(block | inline)*')
|
|
@@ -148,1520 +106,48 @@ var createSemanticNode = function (tagName) { return ({
|
|
|
148
106
|
var semanticTagNames = ['article', 'main', 'nav', 'header', 'footer', 'aside', 'section'];
|
|
149
107
|
var ɵ1 = function (acc, curr) {
|
|
150
108
|
var _a;
|
|
151
|
-
return Object.assign(acc, (_a = {}, _a[curr] = createSemanticNode(curr), _a));
|
|
152
|
-
};
|
|
153
|
-
/**
|
|
154
|
-
* @hidden
|
|
155
|
-
*/
|
|
156
|
-
var semanticNodes = semanticTagNames.reduce(ɵ1, {});
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* @hidden
|
|
160
|
-
*/
|
|
161
|
-
function outerWidth(element) {
|
|
162
|
-
var width = element.offsetWidth;
|
|
163
|
-
var style = getComputedStyle(element);
|
|
164
|
-
width += parseFloat(style.marginLeft) || 0 + parseFloat(style.marginRight) || 0;
|
|
165
|
-
return width;
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* @hidden
|
|
169
|
-
*/
|
|
170
|
-
var removeEntries = function (obj, predicate) {
|
|
171
|
-
return Object.keys(obj)
|
|
172
|
-
.filter(function (key) { return predicate(key); })
|
|
173
|
-
.reduce(function (acc, curr) {
|
|
174
|
-
var _a;
|
|
175
|
-
return Object.assign(acc, (_a = {}, _a[curr] = obj[curr], _a));
|
|
176
|
-
}, {});
|
|
177
|
-
};
|
|
178
|
-
/**
|
|
179
|
-
* @hidden
|
|
180
|
-
*/
|
|
181
|
-
var removeEmptyEntries = function (obj) {
|
|
182
|
-
var predicate = function (key) { return obj[key] !== null && obj[key] !== undefined && obj[key] !== ''; };
|
|
183
|
-
return removeEntries(obj, predicate);
|
|
184
|
-
};
|
|
185
|
-
/**
|
|
186
|
-
* @hidden
|
|
187
|
-
*/
|
|
188
|
-
var isNullOrUndefined = function (value) { return value === undefined || value === null; };
|
|
189
|
-
/**
|
|
190
|
-
* @hidden
|
|
191
|
-
*/
|
|
192
|
-
var isPresent = function (value) { return !isNullOrUndefined(value); };
|
|
193
|
-
/**
|
|
194
|
-
* @hidden
|
|
195
|
-
*/
|
|
196
|
-
var detectIE = function () {
|
|
197
|
-
if (!isDocumentAvailable()) {
|
|
198
|
-
return false;
|
|
199
|
-
}
|
|
200
|
-
var ua = window.navigator.userAgent;
|
|
201
|
-
var msie = ua.indexOf('MSIE ');
|
|
202
|
-
var trident = ua.indexOf('Trident/');
|
|
203
|
-
return msie > 0 || trident > 0;
|
|
204
|
-
};
|
|
205
|
-
/**
|
|
206
|
-
* @hidden
|
|
207
|
-
*/
|
|
208
|
-
var safeString = function (value) { return (isNullOrUndefined(value) ? '' : value.toString()); };
|
|
209
|
-
/**
|
|
210
|
-
* @hidden
|
|
211
|
-
*/
|
|
212
|
-
var first = function (arr) { return arr[0]; };
|
|
213
|
-
/**
|
|
214
|
-
* @hidden
|
|
215
|
-
*/
|
|
216
|
-
var last = function (arr) { return arr[arr.length - 1]; };
|
|
217
|
-
/**
|
|
218
|
-
* @hidden
|
|
219
|
-
*/
|
|
220
|
-
var split = function (splitter) { return function (value) { return value.split(splitter); }; };
|
|
221
|
-
/**
|
|
222
|
-
* @hidden
|
|
223
|
-
*/
|
|
224
|
-
var trim = function (value) { return value.trim(); };
|
|
225
|
-
/**
|
|
226
|
-
* @hidden
|
|
227
|
-
*/
|
|
228
|
-
var filter$1 = function (predicate) { return function (arr) { return arr.filter(predicate); }; };
|
|
229
|
-
/**
|
|
230
|
-
* @hidden
|
|
231
|
-
*/
|
|
232
|
-
var getUniqueStyleValues = function (style, cssStyle) {
|
|
233
|
-
if (style.hasNodesWithoutMarks) {
|
|
234
|
-
return '';
|
|
235
|
-
}
|
|
236
|
-
var uniqueMarkValues = style.marks
|
|
237
|
-
.filter(function (m) { return m.type.name === 'style'; })
|
|
238
|
-
.map(function (m) { return m.attrs.style; })
|
|
239
|
-
.map(safeString)
|
|
240
|
-
.map(split(';'))
|
|
241
|
-
.map(filter$1(function (m) { return m.includes(cssStyle); }))
|
|
242
|
-
// guards against empty array
|
|
243
|
-
.map(function (cssStyleValues) { return (cssStyleValues.length !== 0 ? cssStyleValues : [cssStyle + ": INVALID"]); })
|
|
244
|
-
.map(first)
|
|
245
|
-
.map(split(':'))
|
|
246
|
-
.map(last)
|
|
247
|
-
.map(trim)
|
|
248
|
-
.reduce(function (acc, curr) { return (acc.indexOf(curr) > -1 ? acc : acc.concat([curr])); }, []);
|
|
249
|
-
if (uniqueMarkValues.indexOf('INVALID') > -1 || uniqueMarkValues.length !== 1) {
|
|
250
|
-
return '';
|
|
251
|
-
}
|
|
252
|
-
return uniqueMarkValues[0];
|
|
253
|
-
};
|
|
254
|
-
/**
|
|
255
|
-
* @hidden
|
|
256
|
-
*/
|
|
257
|
-
var conditionallyExecute = function (fn) { return function (condition) { return function (param) { return (condition ? fn(param) : param); }; }; };
|
|
258
|
-
/**
|
|
259
|
-
* @hidden
|
|
260
|
-
*/
|
|
261
|
-
var pipe = function () {
|
|
262
|
-
var fns = [];
|
|
263
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
264
|
-
fns[_i] = arguments[_i];
|
|
265
|
-
}
|
|
266
|
-
return function (x) { return fns.reduce(function (y, f) { return f(y); }, x); };
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
var setCellAttrs = function (nodeAttributes) {
|
|
270
|
-
var attrs = __assign({}, nodeAttributes);
|
|
271
|
-
if (nodeAttributes.colspan !== 1) {
|
|
272
|
-
attrs.colspan = nodeAttributes.colspan;
|
|
273
|
-
}
|
|
274
|
-
else {
|
|
275
|
-
attrs.colspan = null;
|
|
276
|
-
}
|
|
277
|
-
if (nodeAttributes.rowspan !== 1) {
|
|
278
|
-
attrs.rowspan = nodeAttributes.rowspan;
|
|
279
|
-
}
|
|
280
|
-
else {
|
|
281
|
-
attrs.rowspan = null;
|
|
282
|
-
}
|
|
283
|
-
return removeEmptyEntries(attrs);
|
|
284
|
-
};
|
|
285
|
-
var ɵ1$1 = function (node) { return ['table', removeEmptyEntries(node.attrs), 0]; }, ɵ2 = function (node) { return ['tr', removeEmptyEntries(node.attrs), 0]; }, ɵ3 = function (node) { return ['td', setCellAttrs(node.attrs), 0]; }, ɵ4 = function (node) { return ['th', setCellAttrs(node.attrs), 0]; }, ɵ5 = function (node) { return ['tbody', removeEmptyEntries(node.attrs), 0]; }, ɵ6 = function (node) { return ['tfoot', removeEmptyEntries(node.attrs), 0]; }, ɵ7 = function (node) { return ['thead', removeEmptyEntries(node.attrs), 0]; }, ɵ8 = function (node) { return ['col', removeEmptyEntries(node.attrs)]; }, ɵ9 = function (node) { return ['colgroup', removeEmptyEntries(node.attrs), 0]; };
|
|
286
|
-
/**
|
|
287
|
-
* @hidden
|
|
288
|
-
*/
|
|
289
|
-
var tableNodes = {
|
|
290
|
-
// all table node names must start with table - this is needed for the commands to work properly
|
|
291
|
-
table: {
|
|
292
|
-
attrs: __assign({}, commonAttributes(), createDefaultAttributes(['cellspacing', 'cellpadding'])),
|
|
293
|
-
content: '(table_body | table_head | table_foot | table_colgroup)+',
|
|
294
|
-
tableRole: 'table',
|
|
295
|
-
isolating: true,
|
|
296
|
-
group: 'block',
|
|
297
|
-
parseDOM: [
|
|
298
|
-
{
|
|
299
|
-
getAttrs: serializeDOMAttrs,
|
|
300
|
-
tag: 'table'
|
|
301
|
-
}
|
|
302
|
-
],
|
|
303
|
-
toDOM: ɵ1$1
|
|
304
|
-
},
|
|
305
|
-
table_row: {
|
|
306
|
-
content: '(table_cell | table_header)*',
|
|
307
|
-
attrs: __assign({}, commonAttributes()),
|
|
308
|
-
tableRole: 'row',
|
|
309
|
-
parseDOM: [
|
|
310
|
-
{
|
|
311
|
-
getAttrs: serializeDOMAttrs,
|
|
312
|
-
tag: 'tr'
|
|
313
|
-
}
|
|
314
|
-
],
|
|
315
|
-
toDOM: ɵ2
|
|
316
|
-
},
|
|
317
|
-
table_cell: {
|
|
318
|
-
content: 'block+',
|
|
319
|
-
attrs: __assign({}, commonAttributes(), createDefaultAttributes(['headers']), {
|
|
320
|
-
// this is needed for the commands
|
|
321
|
-
colspan: { default: 1 }, rowspan: { default: 1 } }),
|
|
322
|
-
tableRole: 'cell',
|
|
323
|
-
isolating: true,
|
|
324
|
-
parseDOM: [
|
|
325
|
-
{
|
|
326
|
-
getAttrs: serializeDOMAttrs,
|
|
327
|
-
tag: 'td'
|
|
328
|
-
}
|
|
329
|
-
],
|
|
330
|
-
toDOM: ɵ3
|
|
331
|
-
},
|
|
332
|
-
table_header: {
|
|
333
|
-
content: 'block+',
|
|
334
|
-
attrs: __assign({}, commonAttributes(), createDefaultAttributes(['headers', 'abbr', 'scope']), { colspan: { default: 1 }, rowspan: { default: 1 } }),
|
|
335
|
-
tableRole: 'header_cell',
|
|
336
|
-
isolating: true,
|
|
337
|
-
parseDOM: [
|
|
338
|
-
{
|
|
339
|
-
getAttrs: serializeDOMAttrs,
|
|
340
|
-
tag: 'th'
|
|
341
|
-
}
|
|
342
|
-
],
|
|
343
|
-
toDOM: ɵ4
|
|
344
|
-
},
|
|
345
|
-
table_body: {
|
|
346
|
-
attrs: __assign({}, commonAttributes()),
|
|
347
|
-
content: 'table_row+',
|
|
348
|
-
isolating: true,
|
|
349
|
-
parseDOM: [
|
|
350
|
-
{
|
|
351
|
-
getAttrs: serializeDOMAttrs,
|
|
352
|
-
tag: 'tbody'
|
|
353
|
-
}
|
|
354
|
-
],
|
|
355
|
-
toDOM: ɵ5
|
|
356
|
-
},
|
|
357
|
-
table_foot: {
|
|
358
|
-
attrs: __assign({}, commonAttributes()),
|
|
359
|
-
content: 'table_row+',
|
|
360
|
-
isolating: true,
|
|
361
|
-
parseDOM: [
|
|
362
|
-
{
|
|
363
|
-
getAttrs: serializeDOMAttrs,
|
|
364
|
-
tag: 'tfoot'
|
|
365
|
-
}
|
|
366
|
-
],
|
|
367
|
-
toDOM: ɵ6
|
|
368
|
-
},
|
|
369
|
-
table_head: {
|
|
370
|
-
attrs: __assign({}, commonAttributes()),
|
|
371
|
-
content: 'table_row+',
|
|
372
|
-
isolating: true,
|
|
373
|
-
parseDOM: [
|
|
374
|
-
{
|
|
375
|
-
getAttrs: serializeDOMAttrs,
|
|
376
|
-
tag: 'thead'
|
|
377
|
-
}
|
|
378
|
-
],
|
|
379
|
-
toDOM: ɵ7
|
|
380
|
-
},
|
|
381
|
-
table_col: {
|
|
382
|
-
attrs: __assign({}, commonAttributes(), createDefaultAttributes(['span'])),
|
|
383
|
-
selectable: false,
|
|
384
|
-
atom: true,
|
|
385
|
-
parseDOM: [
|
|
386
|
-
{
|
|
387
|
-
getAttrs: serializeDOMAttrs,
|
|
388
|
-
tag: 'col'
|
|
389
|
-
}
|
|
390
|
-
],
|
|
391
|
-
toDOM: ɵ8
|
|
392
|
-
},
|
|
393
|
-
table_colgroup: {
|
|
394
|
-
attrs: __assign({}, commonAttributes(), createDefaultAttributes(['span'])),
|
|
395
|
-
content: 'table_col*',
|
|
396
|
-
selectable: false,
|
|
397
|
-
parseDOM: [
|
|
398
|
-
{
|
|
399
|
-
getAttrs: serializeDOMAttrs,
|
|
400
|
-
tag: 'colgroup'
|
|
401
|
-
}
|
|
402
|
-
],
|
|
403
|
-
toDOM: ɵ9
|
|
404
|
-
}
|
|
405
|
-
};
|
|
406
|
-
|
|
407
|
-
/**
|
|
408
|
-
* @hidden
|
|
409
|
-
*/
|
|
410
|
-
var marks$1 = marks;
|
|
411
|
-
var nodes$1 = Object.assign(nodes, tableNodes, semanticNodes);
|
|
412
|
-
/**
|
|
413
|
-
* @hidden
|
|
414
|
-
*/
|
|
415
|
-
var schema = new Schema({
|
|
416
|
-
marks: marks$1,
|
|
417
|
-
nodes: __assign({}, nodes$1, { blockquote: __assign({}, nodes$1.blockquote, { content: 'inline*' }) })
|
|
418
|
-
});
|
|
419
|
-
|
|
420
|
-
// Because working with row and column-spanning cells is not quite
|
|
421
|
-
// trivial, this code builds up a descriptive structure for a given
|
|
422
|
-
// table node. The structures are cached with the (persistent) table
|
|
423
|
-
// nodes as key, so that they only have to be recomputed when the
|
|
424
|
-
// content of the table changes.
|
|
425
|
-
//
|
|
426
|
-
// This does mean that they have to store table-relative, not
|
|
427
|
-
// document-relative positions. So code that uses them will typically
|
|
428
|
-
// compute the start position of the table and offset positions passed
|
|
429
|
-
// to or gotten from this structure by that amount.
|
|
430
|
-
var readFromCache;
|
|
431
|
-
var addToCache;
|
|
432
|
-
// Prefer using a weak map to cache table maps. Fall back on a
|
|
433
|
-
// fixed-size cache if that's not supported.
|
|
434
|
-
if (typeof WeakMap !== 'undefined') {
|
|
435
|
-
var cache_1 = new WeakMap();
|
|
436
|
-
readFromCache = function (key) { return cache_1.get(key); };
|
|
437
|
-
addToCache = function (key, value) {
|
|
438
|
-
cache_1.set(key, value);
|
|
439
|
-
return value;
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
else {
|
|
443
|
-
var cache_2 = [];
|
|
444
|
-
var cacheSize_1 = 10;
|
|
445
|
-
var cachePos_1 = 0;
|
|
446
|
-
readFromCache = function (key) {
|
|
447
|
-
for (var i = 0; i < cache_2.length; i += 2) {
|
|
448
|
-
if (cache_2[i] === key) {
|
|
449
|
-
return cache_2[i + 1];
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
};
|
|
453
|
-
addToCache = function (key, value) {
|
|
454
|
-
if (cachePos_1 === cacheSize_1) {
|
|
455
|
-
cachePos_1 = 0;
|
|
456
|
-
}
|
|
457
|
-
cache_2[cachePos_1++] = key;
|
|
458
|
-
return (cache_2[cachePos_1++] = value);
|
|
459
|
-
};
|
|
460
|
-
}
|
|
461
|
-
var findWidth = function (table) {
|
|
462
|
-
var width = -1;
|
|
463
|
-
var hasRowSpan = false;
|
|
464
|
-
for (var row = 0; row < table.childCount; row++) {
|
|
465
|
-
var rowNode = table.child(row);
|
|
466
|
-
var rowWidth = 0;
|
|
467
|
-
if (hasRowSpan) {
|
|
468
|
-
for (var j = 0; j < row; j++) {
|
|
469
|
-
var prevRow = table.child(j);
|
|
470
|
-
for (var i = 0; i < prevRow.childCount; i++) {
|
|
471
|
-
var cell = prevRow.child(i);
|
|
472
|
-
if (j + cell.attrs.rowspan > row) {
|
|
473
|
-
rowWidth += cell.attrs.colspan;
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
// check if the cell spans accross multiple columns
|
|
479
|
-
for (var i = 0; i < rowNode.childCount; i++) {
|
|
480
|
-
var cell = rowNode.child(i);
|
|
481
|
-
rowWidth += cell.attrs.colspan;
|
|
482
|
-
if (cell.attrs.rowspan > 1) {
|
|
483
|
-
hasRowSpan = true;
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
if (width === -1) {
|
|
487
|
-
width = rowWidth;
|
|
488
|
-
}
|
|
489
|
-
else if (width !== rowWidth) {
|
|
490
|
-
width = Math.max(width, rowWidth);
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
return width;
|
|
494
|
-
};
|
|
495
|
-
var freshColWidth = function (attrs) {
|
|
496
|
-
if (attrs.colwidth) {
|
|
497
|
-
return attrs.colwidth.slice();
|
|
498
|
-
}
|
|
499
|
-
var result = [];
|
|
500
|
-
for (var i = 0; i < attrs.colspan; i++) {
|
|
501
|
-
result.push(0);
|
|
502
|
-
}
|
|
503
|
-
return result;
|
|
504
|
-
};
|
|
505
|
-
var findBadColWidths = function (map$$1, colWidths, table) {
|
|
506
|
-
if (!map$$1.problems) {
|
|
507
|
-
map$$1.problems = [];
|
|
508
|
-
}
|
|
509
|
-
for (var i = 0, seen = {}; i < map$$1.map.length; i++) {
|
|
510
|
-
var pos = map$$1.map[i];
|
|
511
|
-
if (seen[pos]) {
|
|
512
|
-
continue;
|
|
513
|
-
}
|
|
514
|
-
seen[pos] = true;
|
|
515
|
-
var node = table.nodeAt(pos);
|
|
516
|
-
var updated = null;
|
|
517
|
-
for (var j = 0; j < node.attrs.colspan; j++) {
|
|
518
|
-
var col = (i + j) % map$$1.width;
|
|
519
|
-
var colWidth = colWidths[col * 2];
|
|
520
|
-
if (colWidth != null && (!node.attrs.colwidth || node.attrs.colwidth[j] !== colWidth)) {
|
|
521
|
-
(updated || (updated = freshColWidth(node.attrs)))[j] = colWidth;
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
if (updated) {
|
|
525
|
-
map$$1.problems.unshift({ type: 'colwidth mismatch', pos: pos, colwidth: updated });
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
};
|
|
529
|
-
// Compute a table map.
|
|
530
|
-
var computeMap = function (tableNode) {
|
|
531
|
-
if (!isTable(tableNode) && !isTableBody(tableNode) && !isTableHead(tableNode) && !isTableFoot(tableNode)) {
|
|
532
|
-
throw new RangeError('Not a table node: ' + tableNode.type.name);
|
|
533
|
-
}
|
|
534
|
-
var width = findWidth(tableNode);
|
|
535
|
-
var height = tableNode.childCount;
|
|
536
|
-
var map$$1 = [];
|
|
537
|
-
var mapPos = 0;
|
|
538
|
-
var problems = null;
|
|
539
|
-
var colWidths = [];
|
|
540
|
-
for (var i = 0, e = width * height; i < e; i++) {
|
|
541
|
-
map$$1[i] = 0;
|
|
542
|
-
}
|
|
543
|
-
for (var row = 0, pos = 0; row < height; row++) {
|
|
544
|
-
var rowNode = tableNode.child(row);
|
|
545
|
-
pos++;
|
|
546
|
-
for (var i = 0;; i++) {
|
|
547
|
-
while (mapPos < map$$1.length && map$$1[mapPos] !== 0) {
|
|
548
|
-
mapPos++;
|
|
549
|
-
}
|
|
550
|
-
if (i === rowNode.childCount) {
|
|
551
|
-
break;
|
|
552
|
-
}
|
|
553
|
-
var cellNode = rowNode.child(i);
|
|
554
|
-
var _a = cellNode.attrs, colspan = _a.colspan, rowspan = _a.rowspan, colwidth = _a.colwidth;
|
|
555
|
-
for (var h = 0; h < rowspan; h++) {
|
|
556
|
-
if (h + row >= height) {
|
|
557
|
-
(problems || (problems = [])).push({ type: 'overlong_rowspan', pos: pos, n: rowspan - h });
|
|
558
|
-
break;
|
|
559
|
-
}
|
|
560
|
-
var start = mapPos + h * width;
|
|
561
|
-
for (var w = 0; w < colspan; w++) {
|
|
562
|
-
if (map$$1[start + w] === 0) {
|
|
563
|
-
map$$1[start + w] = pos;
|
|
564
|
-
}
|
|
565
|
-
else {
|
|
566
|
-
(problems || (problems = [])).push({ type: 'collision', row: row, pos: pos, n: colspan - w });
|
|
567
|
-
}
|
|
568
|
-
var colW = colwidth && colwidth[w];
|
|
569
|
-
if (colW) {
|
|
570
|
-
var widthIndex = ((start + w) % width) * 2, prev = colWidths[widthIndex];
|
|
571
|
-
if (prev == null || (prev !== colW && colWidths[widthIndex + 1] === 1)) {
|
|
572
|
-
colWidths[widthIndex] = colW;
|
|
573
|
-
colWidths[widthIndex + 1] = 1;
|
|
574
|
-
}
|
|
575
|
-
else if (prev === colW) {
|
|
576
|
-
colWidths[widthIndex + 1]++;
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
mapPos += colspan;
|
|
582
|
-
pos += cellNode.nodeSize;
|
|
583
|
-
}
|
|
584
|
-
var expectedPos = (row + 1) * width;
|
|
585
|
-
var missing = 0;
|
|
586
|
-
while (mapPos < expectedPos) {
|
|
587
|
-
if (map$$1[mapPos++] === 0) {
|
|
588
|
-
missing++;
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
if (missing) {
|
|
592
|
-
(problems || (problems = [])).push({ type: 'missing', row: row, n: missing });
|
|
593
|
-
}
|
|
594
|
-
pos++;
|
|
595
|
-
}
|
|
596
|
-
var tableMap = new TableMap(width, height, map$$1, problems);
|
|
597
|
-
var badWidths = false;
|
|
598
|
-
// For columns that have defined widths, but whose widths disagree
|
|
599
|
-
// between rows, fix up the cells whose width doesn't match the
|
|
600
|
-
// computed one.
|
|
601
|
-
for (var i = 0; !badWidths && i < colWidths.length; i += 2) {
|
|
602
|
-
if (colWidths[i] != null && colWidths[i + 1] < height) {
|
|
603
|
-
badWidths = true;
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
if (badWidths) {
|
|
607
|
-
findBadColWidths(tableMap, colWidths, tableNode);
|
|
608
|
-
}
|
|
609
|
-
return tableMap;
|
|
610
|
-
};
|
|
611
|
-
/**
|
|
612
|
-
* @hidden
|
|
613
|
-
*/
|
|
614
|
-
var Rect = /** @class */ (function () {
|
|
615
|
-
function Rect(left, top, right, bottom) {
|
|
616
|
-
this.left = left;
|
|
617
|
-
this.top = top;
|
|
618
|
-
this.right = right;
|
|
619
|
-
this.bottom = bottom;
|
|
620
|
-
}
|
|
621
|
-
return Rect;
|
|
622
|
-
}());
|
|
623
|
-
/**
|
|
624
|
-
* @hidden
|
|
625
|
-
*/
|
|
626
|
-
var TableMap = /** @class */ (function () {
|
|
627
|
-
function TableMap(width, height, map$$1, problems) {
|
|
628
|
-
// :: number The width of the table
|
|
629
|
-
this.width = width;
|
|
630
|
-
// :: number The table's height
|
|
631
|
-
this.height = height;
|
|
632
|
-
// :: [number] A width * height array with the start position of
|
|
633
|
-
// the cell covering that part of the table in each slot
|
|
634
|
-
this.map = map$$1;
|
|
635
|
-
// An optional array of problems (cell overlap or non-rectangular
|
|
636
|
-
// shape) for the table, used by the table normalizer.
|
|
637
|
-
this.problems = problems;
|
|
638
|
-
}
|
|
639
|
-
// :: (Node) → TableMap
|
|
640
|
-
// Find the table map for the given table node.
|
|
641
|
-
TableMap.get = function (table) {
|
|
642
|
-
return readFromCache(table) || addToCache(table, computeMap(table));
|
|
643
|
-
};
|
|
644
|
-
// :: (number) → Rect
|
|
645
|
-
// Find the dimensions of the cell at the given position.
|
|
646
|
-
TableMap.prototype.findCell = function (pos) {
|
|
647
|
-
for (var i = 0; i < this.map.length; i++) {
|
|
648
|
-
var curPos = this.map[i];
|
|
649
|
-
if (curPos !== pos) {
|
|
650
|
-
continue;
|
|
651
|
-
}
|
|
652
|
-
var left = i % this.width;
|
|
653
|
-
var top_1 = Math.floor(i / this.width);
|
|
654
|
-
var right = left + 1;
|
|
655
|
-
var bottom = top_1 + 1;
|
|
656
|
-
for (var j = 1; right < this.width && this.map[i + j] === curPos; j++) {
|
|
657
|
-
right++;
|
|
658
|
-
}
|
|
659
|
-
for (var j = 1; bottom < this.height && this.map[i + this.width * j] === curPos; j++) {
|
|
660
|
-
bottom++;
|
|
661
|
-
}
|
|
662
|
-
return new Rect(left, top_1, right, bottom);
|
|
663
|
-
}
|
|
664
|
-
throw new RangeError('No cell with offset ' + pos + ' found');
|
|
665
|
-
};
|
|
666
|
-
// :: (number) → number
|
|
667
|
-
// Find the left side of the cell at the given position.
|
|
668
|
-
TableMap.prototype.colCount = function (pos) {
|
|
669
|
-
for (var i = 0; i < this.map.length; i++) {
|
|
670
|
-
if (this.map[i] === pos) {
|
|
671
|
-
return i % this.width;
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
throw new RangeError('No cell with offset ' + pos + ' found');
|
|
675
|
-
};
|
|
676
|
-
// :: (number, string, number) → ?number
|
|
677
|
-
// Find the next cell in the given direction, starting from the cell
|
|
678
|
-
// at `pos`, if any.
|
|
679
|
-
TableMap.prototype.nextCell = function (pos, axis, dir) {
|
|
680
|
-
var _a = this.findCell(pos), left = _a.left, right = _a.right, top = _a.top, bottom = _a.bottom;
|
|
681
|
-
if (axis === 'horiz') {
|
|
682
|
-
if (dir < 0 ? left === 0 : right === this.width) {
|
|
683
|
-
return null;
|
|
684
|
-
}
|
|
685
|
-
return this.map[top * this.width + (dir < 0 ? left - 1 : right)];
|
|
686
|
-
}
|
|
687
|
-
else {
|
|
688
|
-
if (dir < 0 ? top === 0 : bottom === this.height) {
|
|
689
|
-
return null;
|
|
690
|
-
}
|
|
691
|
-
return this.map[left + this.width * (dir < 0 ? top - 1 : bottom)];
|
|
692
|
-
}
|
|
693
|
-
};
|
|
694
|
-
// :: (number, number) → Rect
|
|
695
|
-
// Get the rectangle spanning the two given cells.
|
|
696
|
-
TableMap.prototype.rectBetween = function (a, b) {
|
|
697
|
-
var _a = this.findCell(a), leftA = _a.left, rightA = _a.right, topA = _a.top, bottomA = _a.bottom;
|
|
698
|
-
var _b = this.findCell(b), leftB = _b.left, rightB = _b.right, topB = _b.top, bottomB = _b.bottom;
|
|
699
|
-
return new Rect(Math.min(leftA, leftB), Math.min(topA, topB), Math.max(rightA, rightB), Math.max(bottomA, bottomB));
|
|
700
|
-
};
|
|
701
|
-
// :: (Rect) → [number]
|
|
702
|
-
// Return the position of all cells that have the top left corner in
|
|
703
|
-
// the given rectangle.
|
|
704
|
-
TableMap.prototype.cellsInRect = function (rect) {
|
|
705
|
-
var result = [];
|
|
706
|
-
var seen = {};
|
|
707
|
-
for (var row = rect.top; row < rect.bottom; row++) {
|
|
708
|
-
for (var col = rect.left; col < rect.right; col++) {
|
|
709
|
-
var index = row * this.width + col, pos = this.map[index];
|
|
710
|
-
if (seen[pos]) {
|
|
711
|
-
continue;
|
|
712
|
-
}
|
|
713
|
-
seen[pos] = true;
|
|
714
|
-
if ((col !== rect.left || !col || this.map[index - 1] !== pos) &&
|
|
715
|
-
(row !== rect.top || !row || this.map[index - this.width] !== pos)) {
|
|
716
|
-
result.push(pos);
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
return result;
|
|
721
|
-
};
|
|
722
|
-
// :: (number, number, Node) → number
|
|
723
|
-
// Return the position at which the cell at the given row and column
|
|
724
|
-
// starts, or would start, if a cell started there.
|
|
725
|
-
TableMap.prototype.positionAt = function (row, col, table) {
|
|
726
|
-
for (var i = 0, rowStart = 0;; i++) {
|
|
727
|
-
var rowEnd = rowStart + table.child(i).nodeSize;
|
|
728
|
-
if (i === row) {
|
|
729
|
-
var index = col + row * this.width, rowEndIndex = (row + 1) * this.width;
|
|
730
|
-
// Skip past cells from previous rows (via rowspan)
|
|
731
|
-
while (index < rowEndIndex && this.map[index] < rowStart) {
|
|
732
|
-
index++;
|
|
733
|
-
}
|
|
734
|
-
return index === rowEndIndex ? rowEnd - 1 : this.map[index];
|
|
735
|
-
}
|
|
736
|
-
rowStart = rowEnd;
|
|
737
|
-
}
|
|
738
|
-
};
|
|
739
|
-
return TableMap;
|
|
740
|
-
}());
|
|
741
|
-
|
|
742
|
-
/**
|
|
743
|
-
* @hidden
|
|
744
|
-
*/
|
|
745
|
-
// ::- A [`Selection`](http://prosemirror.net/docs/ref/#state.Selection)
|
|
746
|
-
// subclass that represents a cell selection spanning part of a table.
|
|
747
|
-
// With the plugin enabled, these will be created when the user
|
|
748
|
-
// selects across cells, and will be drawn by giving selected cells a
|
|
749
|
-
// `selectedCell` CSS class.
|
|
750
|
-
var CellSelection = /** @class */ (function (_super) {
|
|
751
|
-
__extends(CellSelection, _super);
|
|
752
|
-
// :: (ResolvedPos, ?ResolvedPos)
|
|
753
|
-
// A table selection is identified by its anchor and head cells. The
|
|
754
|
-
// positions given to this constructor should point _before_ two
|
|
755
|
-
// cells in the same table. They may be the same, to select a single
|
|
756
|
-
// cell.
|
|
757
|
-
function CellSelection($anchorCell, $headCell) {
|
|
758
|
-
if ($headCell === void 0) { $headCell = $anchorCell; }
|
|
759
|
-
var _this = this;
|
|
760
|
-
var table = $anchorCell.node(-1), map$$1 = TableMap.get(table), start = $anchorCell.start(-1);
|
|
761
|
-
var rect = map$$1.rectBetween($anchorCell.pos - start, $headCell.pos - start);
|
|
762
|
-
var doc = $anchorCell.node(0);
|
|
763
|
-
var cells = map$$1.cellsInRect(rect).filter(function (p) { return p !== $headCell.pos - start; });
|
|
764
|
-
// Make the head cell the first range, so that it counts as the
|
|
765
|
-
// primary part of the selection
|
|
766
|
-
cells.unshift($headCell.pos - start);
|
|
767
|
-
var ranges = cells.map(function (pos) {
|
|
768
|
-
var cell = table.nodeAt(pos), from = pos + start + 1;
|
|
769
|
-
return new SelectionRange(doc.resolve(from), doc.resolve(from + cell.content.size));
|
|
770
|
-
});
|
|
771
|
-
_this = _super.call(this, ranges[0].$from, ranges[0].$to, ranges) || this;
|
|
772
|
-
// :: ResolvedPos
|
|
773
|
-
// A resolved position pointing _in front of_ the anchor cell (the one
|
|
774
|
-
// that doesn't move when extending the selection).
|
|
775
|
-
_this.$anchorCell = $anchorCell;
|
|
776
|
-
// :: ResolvedPos
|
|
777
|
-
// A resolved position pointing in front of the head cell (the one
|
|
778
|
-
// moves when extending the selection).
|
|
779
|
-
_this.$headCell = $headCell;
|
|
780
|
-
return _this;
|
|
781
|
-
}
|
|
782
|
-
// :: (ResolvedPos, ?ResolvedPos) → CellSelection
|
|
783
|
-
// Returns the smallest column selection that covers the given anchor
|
|
784
|
-
// and head cell.
|
|
785
|
-
CellSelection.colSelection = function ($anchorCell, $headCell) {
|
|
786
|
-
if ($headCell === void 0) { $headCell = $anchorCell; }
|
|
787
|
-
var map$$1 = TableMap.get($anchorCell.node(-1));
|
|
788
|
-
var start = $anchorCell.start(-1);
|
|
789
|
-
var anchorRect = map$$1.findCell($anchorCell.pos - start);
|
|
790
|
-
var headRect = map$$1.findCell($headCell.pos - start);
|
|
791
|
-
var doc = $anchorCell.node(0);
|
|
792
|
-
if (anchorRect.top <= headRect.top) {
|
|
793
|
-
if (anchorRect.top > 0) {
|
|
794
|
-
$anchorCell = doc.resolve(start + map$$1.map[anchorRect.left]);
|
|
795
|
-
}
|
|
796
|
-
if (headRect.bottom < map$$1.height) {
|
|
797
|
-
$headCell = doc.resolve(start + map$$1.map[map$$1.width * (map$$1.height - 1) + headRect.right - 1]);
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
else {
|
|
801
|
-
if (headRect.top > 0) {
|
|
802
|
-
$headCell = doc.resolve(start + map$$1.map[headRect.left]);
|
|
803
|
-
}
|
|
804
|
-
if (anchorRect.bottom < map$$1.height) {
|
|
805
|
-
$anchorCell = doc.resolve(start + map$$1.map[map$$1.width * (map$$1.height - 1) + anchorRect.right - 1]);
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
return new CellSelection($anchorCell, $headCell);
|
|
809
|
-
};
|
|
810
|
-
// :: (ResolvedPos, ?ResolvedPos) → CellSelection
|
|
811
|
-
// Returns the smallest row selection that covers the given anchor
|
|
812
|
-
// and head cell.
|
|
813
|
-
CellSelection.rowSelection = function ($anchorCell, $headCell) {
|
|
814
|
-
if ($headCell === void 0) { $headCell = $anchorCell; }
|
|
815
|
-
var map$$1 = TableMap.get($anchorCell.node(-1));
|
|
816
|
-
var start = $anchorCell.start(-1);
|
|
817
|
-
var anchorRect = map$$1.findCell($anchorCell.pos - start);
|
|
818
|
-
var headRect = map$$1.findCell($headCell.pos - start);
|
|
819
|
-
var doc = $anchorCell.node(0);
|
|
820
|
-
if (anchorRect.left <= headRect.left) {
|
|
821
|
-
if (anchorRect.left > 0) {
|
|
822
|
-
$anchorCell = doc.resolve(start + map$$1.map[anchorRect.top * map$$1.width]);
|
|
823
|
-
}
|
|
824
|
-
if (headRect.right < map$$1.width) {
|
|
825
|
-
$headCell = doc.resolve(start + map$$1.map[map$$1.width * (headRect.top + 1) - 1]);
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
|
-
else {
|
|
829
|
-
if (headRect.left > 0) {
|
|
830
|
-
$headCell = doc.resolve(start + map$$1.map[headRect.top * map$$1.width]);
|
|
831
|
-
}
|
|
832
|
-
if (anchorRect.right < map$$1.width) {
|
|
833
|
-
$anchorCell = doc.resolve(start + map$$1.map[map$$1.width * (anchorRect.top + 1) - 1]);
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
return new CellSelection($anchorCell, $headCell);
|
|
837
|
-
};
|
|
838
|
-
CellSelection.fromJSON = function (doc, json) {
|
|
839
|
-
return new CellSelection(doc.resolve(json.anchor), doc.resolve(json.head));
|
|
840
|
-
};
|
|
841
|
-
// :: (Node, number, ?number) → CellSelection
|
|
842
|
-
CellSelection.create = function (doc, anchorCell, headCell) {
|
|
843
|
-
if (headCell === void 0) { headCell = anchorCell; }
|
|
844
|
-
return new CellSelection(doc.resolve(anchorCell), doc.resolve(headCell));
|
|
845
|
-
};
|
|
846
|
-
CellSelection.prototype.map = function (doc, mapping) {
|
|
847
|
-
var $anchorCell = doc.resolve(mapping.map(this.$anchorCell.pos));
|
|
848
|
-
var $headCell = doc.resolve(mapping.map(this.$headCell.pos));
|
|
849
|
-
if (pointsAtCell($anchorCell) && pointsAtCell($headCell) && inSameTable($anchorCell, $headCell)) {
|
|
850
|
-
var tableChanged = this.$anchorCell.node(-1) !== $anchorCell.node(-1);
|
|
851
|
-
if (tableChanged && this.isRowSelection()) {
|
|
852
|
-
return CellSelection.rowSelection($anchorCell, $headCell);
|
|
853
|
-
}
|
|
854
|
-
else {
|
|
855
|
-
if (tableChanged && this.isColSelection()) {
|
|
856
|
-
return CellSelection.colSelection($anchorCell, $headCell);
|
|
857
|
-
}
|
|
858
|
-
else {
|
|
859
|
-
return new CellSelection($anchorCell, $headCell);
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
return TextSelection.between($anchorCell, $headCell);
|
|
864
|
-
};
|
|
865
|
-
// :: () → Slice
|
|
866
|
-
// Returns a rectangular slice of table rows containing the selected
|
|
867
|
-
// cells.
|
|
868
|
-
CellSelection.prototype.content = function () {
|
|
869
|
-
var table = this.$anchorCell.node(-1), map$$1 = TableMap.get(table), start = this.$anchorCell.start(-1);
|
|
870
|
-
var rect = map$$1.rectBetween(this.$anchorCell.pos - start, this.$headCell.pos - start);
|
|
871
|
-
var seen = {}, rows = [];
|
|
872
|
-
for (var row = rect.top; row < rect.bottom; row++) {
|
|
873
|
-
var rowContent = [];
|
|
874
|
-
for (var index = row * map$$1.width + rect.left, col = rect.left; col < rect.right; col++, index++) {
|
|
875
|
-
var pos = map$$1.map[index];
|
|
876
|
-
if (!seen[pos]) {
|
|
877
|
-
seen[pos] = true;
|
|
878
|
-
var cellRect = map$$1.findCell(pos), cell = table.nodeAt(pos);
|
|
879
|
-
var extraLeft = rect.left - cellRect.left, extraRight = cellRect.right - rect.right;
|
|
880
|
-
if (extraLeft > 0 || extraRight > 0) {
|
|
881
|
-
var attrs = cell.attrs;
|
|
882
|
-
if (extraLeft > 0) {
|
|
883
|
-
attrs = removeColSpan(attrs, 0, extraLeft);
|
|
884
|
-
}
|
|
885
|
-
if (extraRight > 0) {
|
|
886
|
-
attrs = removeColSpan(attrs, attrs.colspan - extraRight, extraRight);
|
|
887
|
-
}
|
|
888
|
-
if (cellRect.left < rect.left) {
|
|
889
|
-
cell = cell.type.createAndFill(attrs);
|
|
890
|
-
}
|
|
891
|
-
else {
|
|
892
|
-
cell = cell.type.create(attrs, cell.content);
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
if (cellRect.top < rect.top || cellRect.bottom > rect.bottom) {
|
|
896
|
-
var attrs = setAttr(cell.attrs, 'rowspan', Math.min(cellRect.bottom, rect.bottom) - Math.max(cellRect.top, rect.top));
|
|
897
|
-
if (cellRect.top < rect.top) {
|
|
898
|
-
cell = cell.type.createAndFill(attrs);
|
|
899
|
-
}
|
|
900
|
-
else {
|
|
901
|
-
cell = cell.type.create(attrs, cell.content);
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
rowContent.push(cell);
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
rows.push(table.child(row).copy(Fragment.from(rowContent)));
|
|
908
|
-
}
|
|
909
|
-
var fragment = this.isColSelection() && this.isRowSelection() ? table : rows;
|
|
910
|
-
return new Slice(Fragment.from(fragment), 1, 1);
|
|
911
|
-
};
|
|
912
|
-
CellSelection.prototype.replace = function (tr, content) {
|
|
913
|
-
if (content === void 0) { content = Slice.empty; }
|
|
914
|
-
var mapFrom = tr.steps.length;
|
|
915
|
-
var ranges = this.ranges;
|
|
916
|
-
for (var i = 0; i < ranges.length; i++) {
|
|
917
|
-
var _a = ranges[i], $from = _a.$from, $to = _a.$to;
|
|
918
|
-
var mapping = tr.mapping.slice(mapFrom);
|
|
919
|
-
tr.replace(mapping.map($from.pos), mapping.map($to.pos), i ? Slice.empty : content);
|
|
920
|
-
}
|
|
921
|
-
var sel = Selection.findFrom(tr.doc.resolve(tr.mapping.slice(mapFrom).map(this.to)), -1);
|
|
922
|
-
if (sel) {
|
|
923
|
-
tr.setSelection(sel);
|
|
924
|
-
}
|
|
925
|
-
};
|
|
926
|
-
CellSelection.prototype.replaceWith = function (tr, node) {
|
|
927
|
-
this.replace(tr, new Slice(Fragment.from(node), 0, 0));
|
|
928
|
-
};
|
|
929
|
-
CellSelection.prototype.forEachCell = function (f) {
|
|
930
|
-
var table = this.$anchorCell.node(-1);
|
|
931
|
-
var map$$1 = TableMap.get(table);
|
|
932
|
-
var start = this.$anchorCell.start(-1);
|
|
933
|
-
var cells = map$$1.cellsInRect(map$$1.rectBetween(this.$anchorCell.pos - start, this.$headCell.pos - start));
|
|
934
|
-
for (var i = 0; i < cells.length; i++) {
|
|
935
|
-
f(table.nodeAt(cells[i]), start + cells[i]);
|
|
936
|
-
}
|
|
937
|
-
};
|
|
938
|
-
// :: () → bool
|
|
939
|
-
// True if this selection goes all the way from the top to the
|
|
940
|
-
// bottom of the table.
|
|
941
|
-
CellSelection.prototype.isColSelection = function () {
|
|
942
|
-
var anchorTop = this.$anchorCell.index(-1), headTop = this.$headCell.index(-1);
|
|
943
|
-
if (Math.min(anchorTop, headTop) > 0) {
|
|
944
|
-
return false;
|
|
945
|
-
}
|
|
946
|
-
var anchorBot = anchorTop + this.$anchorCell.nodeAfter.attrs.rowspan;
|
|
947
|
-
var headBot = headTop + this.$headCell.nodeAfter.attrs.rowspan;
|
|
948
|
-
return Math.max(anchorBot, headBot) === this.$headCell.node(-1).childCount;
|
|
949
|
-
};
|
|
950
|
-
// :: () → bool
|
|
951
|
-
// True if this selection goes all the way from the left to the
|
|
952
|
-
// right of the table.
|
|
953
|
-
CellSelection.prototype.isRowSelection = function () {
|
|
954
|
-
var map$$1 = TableMap.get(this.$anchorCell.node(-1));
|
|
955
|
-
var start = this.$anchorCell.start(-1);
|
|
956
|
-
var anchorLeft = map$$1.colCount(this.$anchorCell.pos - start);
|
|
957
|
-
var headLeft = map$$1.colCount(this.$headCell.pos - start);
|
|
958
|
-
if (Math.min(anchorLeft, headLeft) > 0) {
|
|
959
|
-
return false;
|
|
960
|
-
}
|
|
961
|
-
var anchorRight = anchorLeft + this.$anchorCell.nodeAfter.attrs.colspan;
|
|
962
|
-
var headRight = headLeft + this.$headCell.nodeAfter.attrs.colspan;
|
|
963
|
-
return Math.max(anchorRight, headRight) === map$$1.width;
|
|
964
|
-
};
|
|
965
|
-
CellSelection.prototype.eq = function (other) {
|
|
966
|
-
return (other instanceof CellSelection && other.$anchorCell.pos === this.$anchorCell.pos && other.$headCell.pos === this.$headCell.pos);
|
|
967
|
-
};
|
|
968
|
-
CellSelection.prototype.toJSON = function () {
|
|
969
|
-
return { type: 'cell', anchor: this.$anchorCell.pos, head: this.$headCell.pos };
|
|
970
|
-
};
|
|
971
|
-
CellSelection.prototype.getBookmark = function () {
|
|
972
|
-
return new CellBookmark(this.$anchorCell.pos, this.$headCell.pos);
|
|
973
|
-
};
|
|
974
|
-
return CellSelection;
|
|
975
|
-
}(Selection));
|
|
976
|
-
CellSelection.prototype.visible = false;
|
|
977
|
-
Selection.jsonID('table_cell', CellSelection);
|
|
978
|
-
var CellBookmark = /** @class */ (function () {
|
|
979
|
-
function CellBookmark(anchor, head) {
|
|
980
|
-
this.anchor = anchor;
|
|
981
|
-
this.head = head;
|
|
982
|
-
}
|
|
983
|
-
CellBookmark.prototype.map = function (mapping) {
|
|
984
|
-
return new CellBookmark(mapping.map(this.anchor), mapping.map(this.head));
|
|
985
|
-
};
|
|
986
|
-
CellBookmark.prototype.resolve = function (doc) {
|
|
987
|
-
var $anchorCell = doc.resolve(this.anchor), $headCell = doc.resolve(this.head);
|
|
988
|
-
if ($anchorCell.parent.type.spec.tableRole === 'row' &&
|
|
989
|
-
$headCell.parent.type.spec.tableRole === 'row' &&
|
|
990
|
-
$anchorCell.index() < $anchorCell.parent.childCount &&
|
|
991
|
-
$headCell.index() < $headCell.parent.childCount &&
|
|
992
|
-
inSameTable($anchorCell, $headCell)) {
|
|
993
|
-
return new CellSelection($anchorCell, $headCell);
|
|
994
|
-
}
|
|
995
|
-
else {
|
|
996
|
-
return Selection.near($headCell, 1);
|
|
997
|
-
}
|
|
998
|
-
};
|
|
999
|
-
return CellBookmark;
|
|
1000
|
-
}());
|
|
1001
|
-
|
|
1002
|
-
/**
|
|
1003
|
-
* @hidden
|
|
1004
|
-
*/
|
|
1005
|
-
var findParentNodeClosestToPos = function ($pos, predicate) {
|
|
1006
|
-
for (var i = $pos.depth; i > 0; i--) {
|
|
1007
|
-
var node = $pos.node(i);
|
|
1008
|
-
if (predicate(node)) {
|
|
1009
|
-
return {
|
|
1010
|
-
start: $pos.start(i),
|
|
1011
|
-
pos: i > 0 ? $pos.before(i) : 0,
|
|
1012
|
-
depth: i,
|
|
1013
|
-
node: node
|
|
1014
|
-
};
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
};
|
|
1018
|
-
/**
|
|
1019
|
-
* @hidden
|
|
1020
|
-
*/
|
|
1021
|
-
var createTable = function (nodes$$1, rows, columns) {
|
|
1022
|
-
var table = nodes$$1.table, table_body = nodes$$1.table_body, table_row = nodes$$1.table_row, table_cell = nodes$$1.table_cell;
|
|
1023
|
-
var tableRows = [];
|
|
1024
|
-
var cells;
|
|
1025
|
-
for (var r = 0; r < rows + 1; r++) {
|
|
1026
|
-
cells = [];
|
|
1027
|
-
for (var c = 0; c < columns + 1; c++) {
|
|
1028
|
-
cells.push(table_cell.createAndFill());
|
|
1029
|
-
}
|
|
1030
|
-
tableRows.push(table_row.createAndFill(undefined, cells));
|
|
1031
|
-
}
|
|
1032
|
-
var body = table_body.createAndFill(undefined, tableRows);
|
|
1033
|
-
return table.createAndFill(undefined, body);
|
|
1034
|
-
};
|
|
1035
|
-
/**
|
|
1036
|
-
* @hidden
|
|
1037
|
-
*/
|
|
1038
|
-
var isInTable = function (state) {
|
|
1039
|
-
var $head = state.selection.$head;
|
|
1040
|
-
for (var d = $head.depth; d > 0; d--) {
|
|
1041
|
-
if (isTableRow($head.node(d))) {
|
|
1042
|
-
return true;
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
return false;
|
|
1046
|
-
};
|
|
1047
|
-
/**
|
|
1048
|
-
* @hidden
|
|
1049
|
-
*/
|
|
1050
|
-
var setAttr = function (attrs, name, value) {
|
|
1051
|
-
var result = {};
|
|
1052
|
-
// tslint:disable-next-line
|
|
1053
|
-
for (var prop in attrs) {
|
|
1054
|
-
result[prop] = attrs[prop];
|
|
1055
|
-
}
|
|
1056
|
-
result[name] = value;
|
|
1057
|
-
return result;
|
|
1058
|
-
};
|
|
1059
|
-
var cellNear = function ($pos) {
|
|
1060
|
-
for (var after = $pos.nodeAfter, pos = $pos.pos; after; after = after.firstChild, pos++) {
|
|
1061
|
-
var role = after.type.spec.tableRole;
|
|
1062
|
-
if (role === 'cell' || role === 'header_cell') {
|
|
1063
|
-
return $pos.doc.resolve(pos);
|
|
1064
|
-
}
|
|
1065
|
-
}
|
|
1066
|
-
for (var before = $pos.nodeBefore, pos = $pos.pos; before; before = before.lastChild, pos--) {
|
|
1067
|
-
var role = before.type.spec.tableRole;
|
|
1068
|
-
if (role === 'cell' || role === 'header_cell') {
|
|
1069
|
-
return $pos.doc.resolve(pos - before.nodeSize);
|
|
1070
|
-
}
|
|
1071
|
-
}
|
|
1072
|
-
};
|
|
1073
|
-
var cellAround = function ($pos) {
|
|
1074
|
-
for (var d = $pos.depth - 1; d > 0; d--) {
|
|
1075
|
-
if (isTableRow($pos.node(d))) {
|
|
1076
|
-
return $pos.node(0).resolve($pos.before(d + 1));
|
|
1077
|
-
}
|
|
1078
|
-
}
|
|
1079
|
-
return null;
|
|
1080
|
-
};
|
|
1081
|
-
var selectionCell = function (sel) {
|
|
1082
|
-
if (sel instanceof CellSelection && sel.$anchorCell) {
|
|
1083
|
-
return sel.$anchorCell.pos > sel.$headCell.pos ? sel.$anchorCell : sel.$headCell;
|
|
1084
|
-
}
|
|
1085
|
-
else if (sel instanceof NodeSelection && sel.node && isTableCell(sel.node)) {
|
|
1086
|
-
return sel.$anchor;
|
|
1087
|
-
}
|
|
1088
|
-
return cellAround(sel.$head) || cellNear(sel.$head);
|
|
1089
|
-
};
|
|
1090
|
-
/**
|
|
1091
|
-
* @hidden
|
|
1092
|
-
*/
|
|
1093
|
-
// Helper to get the selected rectangle in a table, if any. Adds table
|
|
1094
|
-
// map, table node, and table start offset to the object for
|
|
1095
|
-
// convenience.
|
|
1096
|
-
var selectedRect = function (sel) {
|
|
1097
|
-
// create arr of rect for each table section
|
|
1098
|
-
// there has to be a rect for thead, tbody and tfoot(if each exists)
|
|
1099
|
-
// and NOT for colgroups
|
|
1100
|
-
var $pos = selectionCell(sel);
|
|
1101
|
-
var table = $pos.node(-1);
|
|
1102
|
-
var tableStart = $pos.start(-1);
|
|
1103
|
-
var map$$1 = TableMap.get(table);
|
|
1104
|
-
var rect = sel instanceof CellSelection
|
|
1105
|
-
? map$$1.rectBetween(sel.$anchorCell.pos - tableStart, sel.$headCell.pos - tableStart)
|
|
1106
|
-
: map$$1.findCell($pos.pos - tableStart);
|
|
1107
|
-
rect.tableStart = tableStart;
|
|
1108
|
-
rect.map = map$$1;
|
|
1109
|
-
rect.table = table;
|
|
1110
|
-
return rect;
|
|
1111
|
-
};
|
|
1112
|
-
/**
|
|
1113
|
-
* @hidden
|
|
1114
|
-
*/
|
|
1115
|
-
// this has to be removed since the schema should not have roles inside NodeSpec.
|
|
1116
|
-
var tableNodeTypes = function (schema) {
|
|
1117
|
-
var result = schema.cached.tableNodeTypes;
|
|
1118
|
-
if (!result) {
|
|
1119
|
-
result = schema.cached.tableNodeTypes = {};
|
|
1120
|
-
// tslint:disable-next-line
|
|
1121
|
-
for (var name_1 in schema.nodes) {
|
|
1122
|
-
var type = schema.nodes[name_1];
|
|
1123
|
-
var role = type.spec.tableRole;
|
|
1124
|
-
if (role) {
|
|
1125
|
-
result[role] = type;
|
|
1126
|
-
}
|
|
1127
|
-
}
|
|
1128
|
-
}
|
|
1129
|
-
return result;
|
|
1130
|
-
};
|
|
1131
|
-
/**
|
|
1132
|
-
* @hidden
|
|
1133
|
-
*/
|
|
1134
|
-
var rowIsHeader = function (map$$1, table, row) {
|
|
1135
|
-
var headerCell = tableNodeTypes(table.type.schema).header_cell;
|
|
1136
|
-
for (var col = 0; col < map$$1.width; col++) {
|
|
1137
|
-
if (table.nodeAt(map$$1.map[col + row * map$$1.width]).type !== headerCell) {
|
|
1138
|
-
return false;
|
|
1139
|
-
}
|
|
1140
|
-
}
|
|
1141
|
-
return true;
|
|
1142
|
-
};
|
|
1143
|
-
/**
|
|
1144
|
-
* @hidden
|
|
1145
|
-
*/
|
|
1146
|
-
var addColSpan = function (attrs, pos, n) {
|
|
1147
|
-
if (n === void 0) { n = 1; }
|
|
1148
|
-
var result = setAttr(attrs, 'colspan', attrs.colspan + n);
|
|
1149
|
-
if (result.colwidth) {
|
|
1150
|
-
result.colwidth = result.colwidth.slice();
|
|
1151
|
-
for (var i = 0; i < n; i++) {
|
|
1152
|
-
result.colwidth.splice(pos, 0, 0);
|
|
1153
|
-
}
|
|
1154
|
-
}
|
|
1155
|
-
return result;
|
|
1156
|
-
};
|
|
1157
|
-
/**
|
|
1158
|
-
* @hidden
|
|
1159
|
-
*/
|
|
1160
|
-
var removeColSpan = function (attrs, pos, n) {
|
|
1161
|
-
if (n === void 0) { n = 1; }
|
|
1162
|
-
var result = setAttr(attrs, 'colspan', attrs.colspan - n);
|
|
1163
|
-
if (result.colwidth) {
|
|
1164
|
-
result.colwidth = result.colwidth.slice();
|
|
1165
|
-
result.colwidth.splice(pos, n);
|
|
1166
|
-
if (!result.colwidth.some(function (w) { return w > 0; })) {
|
|
1167
|
-
result.colwidth = null;
|
|
1168
|
-
}
|
|
1169
|
-
}
|
|
1170
|
-
return result;
|
|
1171
|
-
};
|
|
1172
|
-
/**
|
|
1173
|
-
* @hidden
|
|
1174
|
-
*/
|
|
1175
|
-
var isCellEmpty = function (cell) {
|
|
1176
|
-
var c = cell.content;
|
|
1177
|
-
return c.childCount === 1 && c.firstChild.isTextblock && c.firstChild.childCount === 0;
|
|
1178
|
-
};
|
|
1179
|
-
var cellWrapping = function ($pos) {
|
|
1180
|
-
for (var d = $pos.depth; d > 0; d--) {
|
|
1181
|
-
// Sometimes the cell can be in the same depth.
|
|
1182
|
-
var role = $pos.node(d).type.spec.tableRole;
|
|
1183
|
-
if (role === 'cell' || role === 'header_cell') {
|
|
1184
|
-
return $pos.node(d);
|
|
1185
|
-
}
|
|
1186
|
-
}
|
|
1187
|
-
return null;
|
|
1188
|
-
};
|
|
1189
|
-
/**
|
|
1190
|
-
* @hidden
|
|
1191
|
-
*/
|
|
1192
|
-
// Split a selected cell, whose rowpan or colspan is greater than one,
|
|
1193
|
-
// into smaller cells with the cell type (th, td) returned by getType function.
|
|
1194
|
-
var splitCellWithType = function (getCellType) {
|
|
1195
|
-
return function (state, dispatch) {
|
|
1196
|
-
var sel = state.selection;
|
|
1197
|
-
var cellNode;
|
|
1198
|
-
var cellPos;
|
|
1199
|
-
if (!(sel instanceof CellSelection)) {
|
|
1200
|
-
cellNode = cellWrapping(sel.$from);
|
|
1201
|
-
if (!cellNode) {
|
|
1202
|
-
return false;
|
|
1203
|
-
}
|
|
1204
|
-
cellPos = cellAround(sel.$from).pos;
|
|
1205
|
-
}
|
|
1206
|
-
else {
|
|
1207
|
-
if (sel.$anchorCell.pos !== sel.$headCell.pos) {
|
|
1208
|
-
return false;
|
|
1209
|
-
}
|
|
1210
|
-
cellNode = sel.$anchorCell.nodeAfter;
|
|
1211
|
-
cellPos = sel.$anchorCell.pos;
|
|
1212
|
-
}
|
|
1213
|
-
if (cellNode.attrs.colspan === 1 && cellNode.attrs.rowspan === 1) {
|
|
1214
|
-
return false;
|
|
1215
|
-
}
|
|
1216
|
-
if (dispatch) {
|
|
1217
|
-
var baseAttrs = cellNode.attrs;
|
|
1218
|
-
var attrs = [];
|
|
1219
|
-
var colwidth = baseAttrs.colwidth;
|
|
1220
|
-
if (baseAttrs.rowspan > 1) {
|
|
1221
|
-
baseAttrs = setAttr(baseAttrs, 'rowspan', 1);
|
|
1222
|
-
}
|
|
1223
|
-
if (baseAttrs.colspan > 1) {
|
|
1224
|
-
baseAttrs = setAttr(baseAttrs, 'colspan', 1);
|
|
1225
|
-
}
|
|
1226
|
-
var rect = selectedRect(state);
|
|
1227
|
-
var tr = state.tr;
|
|
1228
|
-
for (var i = 0; i < rect.right - rect.left; i++) {
|
|
1229
|
-
attrs.push(colwidth ? setAttr(baseAttrs, 'colwidth', colwidth && colwidth[i] ? [colwidth[i]] : null) : baseAttrs);
|
|
1230
|
-
}
|
|
1231
|
-
var lastCell = void 0;
|
|
1232
|
-
for (var row = rect.top; row < rect.bottom; row++) {
|
|
1233
|
-
var pos = rect.map.positionAt(row, rect.left, rect.table);
|
|
1234
|
-
if (row === rect.top) {
|
|
1235
|
-
pos += cellNode.nodeSize;
|
|
1236
|
-
}
|
|
1237
|
-
for (var col = rect.left, i = 0; col < rect.right; col++, i++) {
|
|
1238
|
-
if (col === rect.left && row === rect.top) {
|
|
1239
|
-
continue;
|
|
1240
|
-
}
|
|
1241
|
-
tr.insert((lastCell = tr.mapping.map(pos + rect.tableStart, 1)), getCellType({ node: cellNode, row: row, col: col }).createAndFill(attrs[i]));
|
|
1242
|
-
}
|
|
1243
|
-
}
|
|
1244
|
-
tr.setNodeMarkup(cellPos, getCellType({ node: cellNode, row: rect.top, col: rect.left }), attrs[0]);
|
|
1245
|
-
if (sel instanceof CellSelection) {
|
|
1246
|
-
tr.setSelection(new CellSelection(tr.doc.resolve(sel.$anchorCell.pos), lastCell && tr.doc.resolve(lastCell)));
|
|
1247
|
-
}
|
|
1248
|
-
dispatch(tr);
|
|
1249
|
-
}
|
|
1250
|
-
return true;
|
|
1251
|
-
};
|
|
1252
|
-
};
|
|
1253
|
-
/**
|
|
1254
|
-
* @hidden
|
|
1255
|
-
*/
|
|
1256
|
-
var pointsAtCell = function ($pos) {
|
|
1257
|
-
return isTableRow($pos.parent) && $pos.nodeAfter;
|
|
1258
|
-
};
|
|
1259
|
-
/**
|
|
1260
|
-
* @hidden
|
|
1261
|
-
*/
|
|
1262
|
-
var inSameTable = function ($a, $b) {
|
|
1263
|
-
return $a.depth === $b.depth && $a.pos >= $b.start(-1) && $a.pos <= $b.end(-1);
|
|
1264
|
-
};
|
|
1265
|
-
/**
|
|
1266
|
-
* @hidden
|
|
1267
|
-
*/
|
|
1268
|
-
var cellsOverlapRectangle = function (_a, rect) {
|
|
1269
|
-
var width = _a.width, height = _a.height, map$$1 = _a.map;
|
|
1270
|
-
var indexTop = rect.top * width + rect.left;
|
|
1271
|
-
var indexLeft = indexTop;
|
|
1272
|
-
var indexBottom = (rect.bottom - 1) * width + rect.left;
|
|
1273
|
-
var indexRight = indexTop + (rect.right - rect.left - 1);
|
|
1274
|
-
for (var i = rect.top; i < rect.bottom; i++) {
|
|
1275
|
-
if ((rect.left > 0 && map$$1[indexLeft] === map$$1[indexLeft - 1]) || (rect.right < width && map$$1[indexRight] === map$$1[indexRight + 1])) {
|
|
1276
|
-
return true;
|
|
1277
|
-
}
|
|
1278
|
-
indexLeft += width;
|
|
1279
|
-
indexRight += width;
|
|
1280
|
-
}
|
|
1281
|
-
for (var i = rect.left; i < rect.right; i++) {
|
|
1282
|
-
if ((rect.top > 0 && map$$1[indexTop] === map$$1[indexTop - width]) ||
|
|
1283
|
-
(rect.bottom < height && map$$1[indexBottom] === map$$1[indexBottom + width])) {
|
|
1284
|
-
return true;
|
|
1285
|
-
}
|
|
1286
|
-
indexTop++;
|
|
1287
|
-
indexBottom++;
|
|
1288
|
-
}
|
|
1289
|
-
return false;
|
|
1290
|
-
};
|
|
1291
|
-
|
|
1292
|
-
/**
|
|
1293
|
-
* @hidden
|
|
1294
|
-
*/
|
|
1295
|
-
var insertTable = function (attrs) { return function (state, dispatch) {
|
|
1296
|
-
var newTable = createTable(state.schema.nodes, attrs.rows, attrs.cols);
|
|
1297
|
-
if (newTable) {
|
|
1298
|
-
insertNode(newTable, true)(state, dispatch);
|
|
1299
|
-
}
|
|
1300
|
-
}; };
|
|
1301
|
-
var addTableGroupColumn = function (tr, _a, col, mainTable, requiredGroup, doc) {
|
|
1302
|
-
var left = _a.left, right = _a.right;
|
|
1303
|
-
var refColumn = col > 0 ? -1 : 0;
|
|
1304
|
-
// not sure if this should be deleted
|
|
1305
|
-
// if (columnIsHeader(map, table, col + refColumn)) {
|
|
1306
|
-
// refColumn = col === 0 || col === map.width ? null : 0;
|
|
1307
|
-
// }
|
|
1308
|
-
var rect;
|
|
1309
|
-
mainTable.node.descendants(function (tableChildNode, offset) {
|
|
1310
|
-
if (requiredGroup(tableChildNode)) {
|
|
1311
|
-
var i_1 = -1;
|
|
1312
|
-
tableChildNode.firstChild.descendants(function (childNode, pos) {
|
|
1313
|
-
if (isTableCell(childNode) || isTableHeaderCell(childNode)) {
|
|
1314
|
-
i_1 = i_1 + 1;
|
|
1315
|
-
if (i_1 === right || i_1 === left) {
|
|
1316
|
-
var selection = new Selection(doc.resolve(pos + offset + mainTable.start), doc.resolve(pos + offset + mainTable.start));
|
|
1317
|
-
rect = selectedRect(selection);
|
|
1318
|
-
}
|
|
1319
|
-
}
|
|
1320
|
-
});
|
|
1321
|
-
}
|
|
1322
|
-
});
|
|
1323
|
-
// Do nothing if thead, tfoot or tbody is missing
|
|
1324
|
-
if (!rect) {
|
|
1325
|
-
return tr;
|
|
1326
|
-
}
|
|
1327
|
-
for (var row = 0; row < rect.map.height; row++) {
|
|
1328
|
-
var index = row * rect.map.width + col;
|
|
1329
|
-
// If this position falls inside a col-spanning cell
|
|
1330
|
-
if (col > 0 && col < rect.map.width && rect.map.map[index - 1] === rect.map.map[index]) {
|
|
1331
|
-
var pos = rect.map.map[index];
|
|
1332
|
-
var cell = rect.table.nodeAt(pos);
|
|
1333
|
-
tr.setNodeMarkup(tr.mapping.map(rect.tableStart + pos), null, addColSpan(cell.attrs, col - rect.map.colCount(pos)));
|
|
1334
|
-
// Skip ahead if rowspan > 1
|
|
1335
|
-
row += cell.attrs.rowspan - 1;
|
|
1336
|
-
}
|
|
1337
|
-
else {
|
|
1338
|
-
var type = rect.table.nodeAt(rect.map.map[index + refColumn]).type;
|
|
1339
|
-
var pos = rect.map.positionAt(row, col, rect.table);
|
|
1340
|
-
tr.insert(tr.mapping.map(rect.tableStart + pos), type.createAndFill());
|
|
1341
|
-
}
|
|
1342
|
-
}
|
|
1343
|
-
return tr;
|
|
1344
|
-
};
|
|
1345
|
-
var removeTableGroupColumn = function (tr, _a, mainTable, requiredGroup, doc) {
|
|
1346
|
-
var right = _a.right, left = _a.left;
|
|
1347
|
-
var rect;
|
|
1348
|
-
mainTable.node.descendants(function (tableChildNode, offset) {
|
|
1349
|
-
if (requiredGroup(tableChildNode)) {
|
|
1350
|
-
var i_2 = -1;
|
|
1351
|
-
tableChildNode.firstChild.descendants(function (childNode, pos) {
|
|
1352
|
-
if (isTableCell(childNode) || isTableHeaderCell(childNode)) {
|
|
1353
|
-
i_2 = i_2 + 1;
|
|
1354
|
-
if (i_2 >= left && i_2 < right) {
|
|
1355
|
-
var resolvedPos = doc.resolve(pos + offset + mainTable.start + childNode.nodeSize);
|
|
1356
|
-
var selection = new Selection(resolvedPos, resolvedPos);
|
|
1357
|
-
rect = selectedRect(selection);
|
|
1358
|
-
}
|
|
1359
|
-
}
|
|
1360
|
-
});
|
|
1361
|
-
}
|
|
1362
|
-
});
|
|
1363
|
-
// Do nothing if thead, tfoot or tbody is missing
|
|
1364
|
-
if (!rect) {
|
|
1365
|
-
return;
|
|
1366
|
-
}
|
|
1367
|
-
for (var i = rect.right - 1;; i--) {
|
|
1368
|
-
removeColumn(tr, rect, i);
|
|
1369
|
-
if (i === rect.left) {
|
|
1370
|
-
break;
|
|
1371
|
-
}
|
|
1372
|
-
rect.table = rect.tableStart ? tr.doc.nodeAt(rect.tableStart - 1) : tr.doc;
|
|
1373
|
-
rect.map = TableMap.get(rect.table);
|
|
1374
|
-
}
|
|
1375
|
-
return;
|
|
1376
|
-
};
|
|
1377
|
-
var removeColumn = function (tr, _a, col) {
|
|
1378
|
-
var map$$1 = _a.map, table = _a.table, tableStart = _a.tableStart;
|
|
1379
|
-
for (var row = 0; row < map$$1.height;) {
|
|
1380
|
-
var index = row * map$$1.width + col;
|
|
1381
|
-
var pos = map$$1.map[index];
|
|
1382
|
-
var cell = table.nodeAt(pos);
|
|
1383
|
-
// If this is part of a col-spanning cell
|
|
1384
|
-
if ((col > 0 && map$$1.map[index - 1] === pos) || (col < map$$1.width - 1 && map$$1.map[index + 1] === pos)) {
|
|
1385
|
-
tr.setNodeMarkup(tr.mapping.map(tableStart + pos), null, removeColSpan(cell.attrs, col - map$$1.colCount(pos)));
|
|
1386
|
-
}
|
|
1387
|
-
else {
|
|
1388
|
-
var start = tr.mapping.map(tableStart + pos);
|
|
1389
|
-
tr.delete(start, start + cell.nodeSize);
|
|
1390
|
-
}
|
|
1391
|
-
row += cell.attrs.rowspan;
|
|
1392
|
-
}
|
|
1393
|
-
};
|
|
1394
|
-
/**
|
|
1395
|
-
* @hidden
|
|
1396
|
-
*/
|
|
1397
|
-
// Command to add a column before the column with the selection.
|
|
1398
|
-
var addColumnBefore$1 = function (state, dispatch) {
|
|
1399
|
-
if (!isInTable(state)) {
|
|
1400
|
-
return false;
|
|
1401
|
-
}
|
|
1402
|
-
if (dispatch) {
|
|
1403
|
-
var rect = selectedRect(state.selection);
|
|
1404
|
-
var mainTable = findParentNodeClosestToPos(state.selection.$anchor, isTable);
|
|
1405
|
-
var tHeadTr = addTableGroupColumn(state.tr, rect, rect.left, mainTable, isTableHead, state.doc);
|
|
1406
|
-
var tBodyTr = addTableGroupColumn(tHeadTr, rect, rect.left, mainTable, isTableBody, state.doc);
|
|
1407
|
-
var tFootTr = addTableGroupColumn(tBodyTr, rect, rect.left, mainTable, isTableFoot, state.doc);
|
|
1408
|
-
dispatch(tFootTr);
|
|
1409
|
-
}
|
|
1410
|
-
return true;
|
|
1411
|
-
};
|
|
1412
|
-
/**
|
|
1413
|
-
* @hidden
|
|
1414
|
-
*/
|
|
1415
|
-
// Command to add a column after the column with the selection.
|
|
1416
|
-
var addColumnAfter$1 = function (state, dispatch) {
|
|
1417
|
-
if (!isInTable(state)) {
|
|
1418
|
-
return false;
|
|
1419
|
-
}
|
|
1420
|
-
if (dispatch) {
|
|
1421
|
-
var rect = selectedRect(state.selection);
|
|
1422
|
-
var mainTable = findParentNodeClosestToPos(state.selection.$anchor, isTable);
|
|
1423
|
-
var theadTr = addTableGroupColumn(state.tr, rect, rect.right, mainTable, isTableHead, state.doc);
|
|
1424
|
-
var tBodyTr = addTableGroupColumn(theadTr, rect, rect.right, mainTable, isTableBody, state.doc);
|
|
1425
|
-
var tFootTr = addTableGroupColumn(tBodyTr, rect, rect.right, mainTable, isTableFoot, state.doc);
|
|
1426
|
-
dispatch(tFootTr);
|
|
1427
|
-
}
|
|
1428
|
-
return true;
|
|
1429
|
-
};
|
|
1430
|
-
var addRow = function (tr, _a, row) {
|
|
1431
|
-
var map$$1 = _a.map, tableStart = _a.tableStart, table = _a.table;
|
|
1432
|
-
var rowPos = tableStart;
|
|
1433
|
-
for (var i = 0; i < row; i++) {
|
|
1434
|
-
rowPos += table.child(i).nodeSize;
|
|
1435
|
-
}
|
|
1436
|
-
var cells = [];
|
|
1437
|
-
var refRow = row > 0 ? -1 : 0;
|
|
1438
|
-
if (rowIsHeader(map$$1, table, row + refRow)) {
|
|
1439
|
-
refRow = row === 0 || row === map$$1.height ? null : 0;
|
|
1440
|
-
}
|
|
1441
|
-
for (var col = 0, index = map$$1.width * row; col < map$$1.width; col++, index++) {
|
|
1442
|
-
// Covered by a rowspan cell
|
|
1443
|
-
if (row > 0 && row < map$$1.height && map$$1.map[index] === map$$1.map[index - map$$1.width]) {
|
|
1444
|
-
var pos = map$$1.map[index];
|
|
1445
|
-
var attrs = table.nodeAt(pos).attrs;
|
|
1446
|
-
tr.setNodeMarkup(tableStart + pos, null, setAttr(attrs, 'rowspan', attrs.rowspan + 1));
|
|
1447
|
-
col += attrs.colspan - 1;
|
|
1448
|
-
}
|
|
1449
|
-
else {
|
|
1450
|
-
var type = refRow == null ? tableNodeTypes(table.type.schema).cell : table.nodeAt(map$$1.map[index + refRow * map$$1.width]).type;
|
|
1451
|
-
cells.push(type.createAndFill());
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
tr.insert(rowPos, tableNodeTypes(table.type.schema).row.create(null, cells));
|
|
1455
|
-
return tr;
|
|
1456
|
-
};
|
|
1457
|
-
/**
|
|
1458
|
-
* @hidden
|
|
1459
|
-
*/
|
|
1460
|
-
// Add a table row before the selection.
|
|
1461
|
-
var addRowBefore$1 = function (state, dispatch) {
|
|
1462
|
-
if (!isInTable(state)) {
|
|
1463
|
-
return false;
|
|
1464
|
-
}
|
|
1465
|
-
if (dispatch) {
|
|
1466
|
-
var rect = selectedRect(state.selection);
|
|
1467
|
-
dispatch(addRow(state.tr, rect, rect.top));
|
|
1468
|
-
}
|
|
1469
|
-
return true;
|
|
1470
|
-
};
|
|
1471
|
-
/**
|
|
1472
|
-
* @hidden
|
|
1473
|
-
*/
|
|
1474
|
-
// Add a table row after the selection.
|
|
1475
|
-
var addRowAfter$1 = function (state, dispatch) {
|
|
1476
|
-
if (!isInTable(state)) {
|
|
1477
|
-
return false;
|
|
1478
|
-
}
|
|
1479
|
-
if (dispatch) {
|
|
1480
|
-
var rect = selectedRect(state.selection);
|
|
1481
|
-
dispatch(addRow(state.tr, rect, rect.bottom));
|
|
1482
|
-
}
|
|
1483
|
-
return true;
|
|
1484
|
-
};
|
|
1485
|
-
/**
|
|
1486
|
-
* @hidden
|
|
1487
|
-
*/
|
|
1488
|
-
// Command function that removes the selected columns from a table.
|
|
1489
|
-
var deleteColumn$1 = function (state, dispatch) {
|
|
1490
|
-
if (!isInTable(state)) {
|
|
1491
|
-
return false;
|
|
1492
|
-
}
|
|
1493
|
-
if (dispatch) {
|
|
1494
|
-
var rect = selectedRect(state.selection);
|
|
1495
|
-
// if only one column left - delete the whole table
|
|
1496
|
-
if (rect.left === 0 && rect.right === rect.map.width) {
|
|
1497
|
-
return deleteTable$1(state, dispatch);
|
|
1498
|
-
}
|
|
1499
|
-
var mainTable = findParentNodeClosestToPos(state.selection.$anchor, isTable);
|
|
1500
|
-
var tr = state.tr;
|
|
1501
|
-
removeTableGroupColumn(tr, rect, mainTable, isTableFoot, tr.doc);
|
|
1502
|
-
removeTableGroupColumn(tr, rect, mainTable, isTableBody, tr.doc);
|
|
1503
|
-
removeTableGroupColumn(tr, rect, mainTable, isTableHead, tr.doc);
|
|
1504
|
-
dispatch(tr);
|
|
1505
|
-
}
|
|
1506
|
-
return true;
|
|
1507
|
-
};
|
|
1508
|
-
var removeRow = function (tr, _a, row) {
|
|
1509
|
-
var map$$1 = _a.map, table = _a.table, tableStart = _a.tableStart;
|
|
1510
|
-
var rowPos = 0;
|
|
1511
|
-
for (var i = 0; i < row; i++) {
|
|
1512
|
-
rowPos += table.child(i).nodeSize;
|
|
1513
|
-
}
|
|
1514
|
-
var nextRow = rowPos + table.child(row).nodeSize;
|
|
1515
|
-
var mapFrom = tr.mapping.maps.length;
|
|
1516
|
-
tr.delete(rowPos + tableStart, nextRow + tableStart);
|
|
1517
|
-
for (var col = 0, index = row * map$$1.width; col < map$$1.width; col++, index++) {
|
|
1518
|
-
var pos = map$$1.map[index];
|
|
1519
|
-
if (row > 0 && pos === map$$1.map[index - map$$1.width]) {
|
|
1520
|
-
// If this cell starts in the row above, simply reduce its rowspan
|
|
1521
|
-
var attrs = table.nodeAt(pos).attrs;
|
|
1522
|
-
tr.setNodeMarkup(tr.mapping.slice(mapFrom).map(pos + tableStart), null, setAttr(attrs, 'rowspan', attrs.rowspan - 1));
|
|
1523
|
-
col += attrs.colspan - 1;
|
|
1524
|
-
}
|
|
1525
|
-
else if (row < map$$1.width && pos === map$$1.map[index + map$$1.width]) {
|
|
1526
|
-
// Else, if it continues in the row below, it has to be moved down
|
|
1527
|
-
var cell = table.nodeAt(pos);
|
|
1528
|
-
var copy = cell.type.create(setAttr(cell.attrs, 'rowspan', cell.attrs.rowspan - 1), cell.content);
|
|
1529
|
-
var newPos = map$$1.positionAt(row + 1, col, table);
|
|
1530
|
-
tr.insert(tr.mapping.slice(mapFrom).map(tableStart + newPos), copy);
|
|
1531
|
-
col += cell.attrs.colspan - 1;
|
|
1532
|
-
}
|
|
1533
|
-
}
|
|
109
|
+
return Object.assign(acc, (_a = {}, _a[curr] = createSemanticNode(curr), _a));
|
|
1534
110
|
};
|
|
1535
111
|
/**
|
|
1536
112
|
* @hidden
|
|
1537
113
|
*/
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
if (!isInTable(state)) {
|
|
1541
|
-
return false;
|
|
1542
|
-
}
|
|
1543
|
-
if (dispatch) {
|
|
1544
|
-
var rect_1 = selectedRect(state.selection);
|
|
1545
|
-
var tr = state.tr;
|
|
1546
|
-
if (rect_1.top === 0 && rect_1.bottom === rect_1.map.height) {
|
|
1547
|
-
var mainTable = findParentNodeClosestToPos(state.selection.$anchor, isTable);
|
|
1548
|
-
if (mainTable.node.childCount === 1) {
|
|
1549
|
-
deleteTable$1(state, dispatch);
|
|
1550
|
-
}
|
|
1551
|
-
else {
|
|
1552
|
-
deleteTableElement(function (n) { return n.type.name === rect_1.table.type.name; })(state, dispatch);
|
|
1553
|
-
}
|
|
1554
|
-
return true;
|
|
1555
|
-
}
|
|
1556
|
-
for (var i = rect_1.bottom - 1;; i--) {
|
|
1557
|
-
removeRow(tr, rect_1, i);
|
|
1558
|
-
if (i === rect_1.top) {
|
|
1559
|
-
break;
|
|
1560
|
-
}
|
|
1561
|
-
rect_1.table = rect_1.tableStart ? tr.doc.nodeAt(rect_1.tableStart - 1) : tr.doc;
|
|
1562
|
-
rect_1.map = TableMap.get(rect_1.table);
|
|
1563
|
-
}
|
|
1564
|
-
dispatch(tr);
|
|
1565
|
-
}
|
|
1566
|
-
return true;
|
|
1567
|
-
};
|
|
114
|
+
var semanticNodes = semanticTagNames.reduce(ɵ1, {});
|
|
115
|
+
|
|
1568
116
|
/**
|
|
1569
117
|
* @hidden
|
|
1570
118
|
*/
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
var mergeCells$1 = function (state, dispatch) {
|
|
1574
|
-
var sel = state.selection;
|
|
1575
|
-
if (!(sel instanceof CellSelection) || sel.$anchorCell.pos === sel.$headCell.pos) {
|
|
1576
|
-
return false;
|
|
1577
|
-
}
|
|
1578
|
-
var rect = selectedRect(state.selection);
|
|
1579
|
-
var map$$1 = rect.map;
|
|
1580
|
-
if (cellsOverlapRectangle(map$$1, rect)) {
|
|
1581
|
-
return false;
|
|
1582
|
-
}
|
|
1583
|
-
if (dispatch) {
|
|
1584
|
-
var tr = state.tr;
|
|
1585
|
-
var seen = {};
|
|
1586
|
-
var content = Fragment.empty;
|
|
1587
|
-
var mergedPos = void 0;
|
|
1588
|
-
var mergedCell = void 0;
|
|
1589
|
-
for (var row = rect.top; row < rect.bottom; row++) {
|
|
1590
|
-
for (var col = rect.left; col < rect.right; col++) {
|
|
1591
|
-
var cellPos = map$$1.map[row * map$$1.width + col], cell = rect.table.nodeAt(cellPos);
|
|
1592
|
-
if (seen[cellPos]) {
|
|
1593
|
-
continue;
|
|
1594
|
-
}
|
|
1595
|
-
seen[cellPos] = true;
|
|
1596
|
-
if (mergedPos === null) {
|
|
1597
|
-
mergedPos = cellPos;
|
|
1598
|
-
mergedCell = cell;
|
|
1599
|
-
}
|
|
1600
|
-
else {
|
|
1601
|
-
if (!isCellEmpty(cell)) {
|
|
1602
|
-
content = content.append(cell.content);
|
|
1603
|
-
}
|
|
1604
|
-
var mapped = tr.mapping.map(cellPos + rect.tableStart);
|
|
1605
|
-
tr.delete(mapped, mapped + cell.nodeSize);
|
|
1606
|
-
}
|
|
1607
|
-
}
|
|
1608
|
-
}
|
|
1609
|
-
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));
|
|
1610
|
-
if (content.size) {
|
|
1611
|
-
var end = mergedPos + 1 + mergedCell.content.size;
|
|
1612
|
-
var start = isCellEmpty(mergedCell) ? mergedPos + 1 : end;
|
|
1613
|
-
tr.replaceWith(start + rect.tableStart, end + rect.tableStart, content);
|
|
1614
|
-
}
|
|
1615
|
-
tr.setSelection(new CellSelection(tr.doc.resolve(mergedPos + rect.tableStart)));
|
|
1616
|
-
dispatch(tr);
|
|
1617
|
-
}
|
|
1618
|
-
return true;
|
|
1619
|
-
};
|
|
119
|
+
var marks$1 = marks;
|
|
120
|
+
var nodes$1 = Object.assign(nodes, semanticNodes);
|
|
1620
121
|
/**
|
|
1621
122
|
* @hidden
|
|
1622
123
|
*/
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
var node = _a.node;
|
|
1629
|
-
return nodeTypes[node.type.spec.tableRole];
|
|
1630
|
-
})(state, dispatch);
|
|
1631
|
-
};
|
|
1632
|
-
var deleteTableElement = function (selector) { return function (state, dispatch) {
|
|
1633
|
-
var $pos = state.selection.$anchor;
|
|
1634
|
-
for (var d = $pos.depth; d > 0; d--) {
|
|
1635
|
-
var node = $pos.node(d);
|
|
1636
|
-
if (selector(node)) {
|
|
1637
|
-
if (dispatch) {
|
|
1638
|
-
var tr = state.tr;
|
|
1639
|
-
tr.delete($pos.before(d), $pos.after(d)).scrollIntoView();
|
|
1640
|
-
dispatch(tr);
|
|
1641
|
-
}
|
|
1642
|
-
return true;
|
|
1643
|
-
}
|
|
1644
|
-
}
|
|
1645
|
-
return false;
|
|
1646
|
-
}; };
|
|
124
|
+
var schema = new Schema({
|
|
125
|
+
marks: marks$1,
|
|
126
|
+
nodes: nodes$1
|
|
127
|
+
});
|
|
128
|
+
|
|
1647
129
|
/**
|
|
1648
130
|
* @hidden
|
|
1649
131
|
*/
|
|
1650
|
-
|
|
1651
|
-
var
|
|
132
|
+
var insertTable = function (attrs) { return function (state, dispatch) {
|
|
133
|
+
var newTable = createTable(state.schema.nodes, attrs.rows, attrs.cols);
|
|
134
|
+
if (newTable) {
|
|
135
|
+
insertNode(newTable, true)(state, dispatch);
|
|
136
|
+
}
|
|
137
|
+
}; };
|
|
1652
138
|
|
|
1653
139
|
var alignRemove = function (state, dispatch) { return alignBlocks(alignRemoveRules)(state, dispatch); };
|
|
1654
|
-
var ɵ1$
|
|
140
|
+
var ɵ1$1 = function (applyToWord) { return expandToWordWrap(toggleInlineFormat, __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, __assign({}, italic, { applyToWord: applyToWord })); }, ɵ9 = function (applyToWord) { return expandToWordWrap(toggleInlineFormat, __assign({}, strikethrough, { applyToWord: applyToWord })); }, ɵ10 = function (applyToWord) { return expandToWordWrap(toggleInlineFormat, __assign({}, subscript, { applyToWord: applyToWord })); }, ɵ11 = function (applyToWord) { return expandToWordWrap(toggleInlineFormat, __assign({}, superscript, { applyToWord: applyToWord })); }, ɵ12 = function (applyToWord) { return expandToWordWrap(toggleInlineFormat, __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); }; };
|
|
1655
141
|
var inlineCommand = {
|
|
1656
|
-
bold: ɵ1$
|
|
1657
|
-
cleanFormatting: ɵ2
|
|
1658
|
-
createLink: ɵ3
|
|
1659
|
-
fontFamily: ɵ4
|
|
1660
|
-
fontSize: ɵ5
|
|
1661
|
-
insertFile: ɵ6
|
|
1662
|
-
insertText: ɵ7
|
|
1663
|
-
italic: ɵ8
|
|
1664
|
-
strikethrough: ɵ9
|
|
142
|
+
bold: ɵ1$1,
|
|
143
|
+
cleanFormatting: ɵ2,
|
|
144
|
+
createLink: ɵ3,
|
|
145
|
+
fontFamily: ɵ4,
|
|
146
|
+
fontSize: ɵ5,
|
|
147
|
+
insertFile: ɵ6,
|
|
148
|
+
insertText: ɵ7,
|
|
149
|
+
italic: ɵ8,
|
|
150
|
+
strikethrough: ɵ9,
|
|
1665
151
|
subscript: ɵ10,
|
|
1666
152
|
superscript: ɵ11,
|
|
1667
153
|
underline: ɵ12,
|
|
@@ -1673,7 +159,7 @@ var inlineCommand = {
|
|
|
1673
159
|
var ɵ17 = function () { return function (state, dispatch) { return isAligned(state, alignCenterRules) ? alignRemove(state, dispatch) : alignBlocks(alignCenterRules)(state, dispatch); }; }, ɵ18 = function () { return function (state, dispatch) { return isAligned(state, alignJustifyRules) ? alignRemove(state, dispatch) : alignBlocks(alignJustifyRules)(state, dispatch); }; }, ɵ19 = function () { return function (state, dispatch) { return isAligned(state, alignLeftRules) ? alignRemove(state, dispatch) : alignBlocks(alignLeftRules)(state, dispatch); }; }, ɵ20 = function () { return function (state, dispatch) { return isAligned(state, alignRightRules) ? alignRemove(state, dispatch) : alignBlocks(alignRightRules)(state, dispatch); }; }, ɵ21 = function (formatAttr) { return formatBlockElements(formatAttr.tag); }, ɵ22 = function () { return getHtml; }, ɵ23 = function () { return indent; }, ɵ24 = function (attrs) { return insertImage(attrs); }, ɵ25 = function () { return toggleOrderedList; }, ɵ26 = function () { return toggleUnorderedList; }, ɵ27 = function () { return outdent; }, ɵ28 = function () { return redo; }, ɵ29 = function (_a) {
|
|
1674
160
|
var content = _a.content, parseOptions = _a.parseOptions;
|
|
1675
161
|
return setHtml(content, 'setHTML', parseOptions);
|
|
1676
|
-
}, ɵ30 = function () { return undo; };
|
|
162
|
+
}, ɵ30 = function () { return undo; }, ɵ31 = function () { return blockquote; };
|
|
1677
163
|
var blockCommand = {
|
|
1678
164
|
alignCenter: ɵ17,
|
|
1679
165
|
alignJustify: ɵ18,
|
|
@@ -1690,20 +176,21 @@ var blockCommand = {
|
|
|
1690
176
|
outdent: ɵ27,
|
|
1691
177
|
redo: ɵ28,
|
|
1692
178
|
setHTML: ɵ29,
|
|
1693
|
-
undo: ɵ30
|
|
179
|
+
undo: ɵ30,
|
|
180
|
+
blockquote: ɵ31
|
|
1694
181
|
};
|
|
1695
|
-
var ɵ
|
|
182
|
+
var ɵ32 = function (attr) { return insertTable(attr); }, ɵ33 = function () { return addColumnBefore; }, ɵ34 = function () { return addColumnAfter; }, ɵ35 = function () { return addRowBefore; }, ɵ36 = function () { return addRowAfter; }, ɵ37 = function () { return deleteRow; }, ɵ38 = function () { return deleteColumn; }, ɵ39 = function () { return mergeCells; }, ɵ40 = function () { return splitCell; }, ɵ41 = function () { return deleteTable; };
|
|
1696
183
|
var tableCommand = {
|
|
1697
|
-
insertTable: ɵ
|
|
1698
|
-
addColumnBefore: ɵ
|
|
1699
|
-
addColumnAfter: ɵ
|
|
1700
|
-
addRowBefore: ɵ
|
|
1701
|
-
addRowAfter: ɵ
|
|
1702
|
-
deleteRow: ɵ
|
|
1703
|
-
deleteColumn: ɵ
|
|
1704
|
-
mergeCells: ɵ
|
|
1705
|
-
splitCell: ɵ
|
|
1706
|
-
deleteTable: ɵ
|
|
184
|
+
insertTable: ɵ32,
|
|
185
|
+
addColumnBefore: ɵ33,
|
|
186
|
+
addColumnAfter: ɵ34,
|
|
187
|
+
addRowBefore: ɵ35,
|
|
188
|
+
addRowAfter: ɵ36,
|
|
189
|
+
deleteRow: ɵ37,
|
|
190
|
+
deleteColumn: ɵ38,
|
|
191
|
+
mergeCells: ɵ39,
|
|
192
|
+
splitCell: ɵ40,
|
|
193
|
+
deleteTable: ɵ41
|
|
1707
194
|
};
|
|
1708
195
|
/**
|
|
1709
196
|
* @hidden
|
|
@@ -1742,6 +229,10 @@ var getToolbarState = function (state, options) { return ({
|
|
|
1742
229
|
selected: activeNode(state),
|
|
1743
230
|
disabled: false
|
|
1744
231
|
},
|
|
232
|
+
blockquote: {
|
|
233
|
+
selected: false,
|
|
234
|
+
disabled: !blockquote(state)
|
|
235
|
+
},
|
|
1745
236
|
indent: {
|
|
1746
237
|
selected: false,
|
|
1747
238
|
disabled: !(canIndentAsListItem(state, state.schema.nodes.list_item) || canBeIndented(state, indentRules))
|
|
@@ -1764,7 +255,11 @@ var getToolbarState = function (state, options) { return ({
|
|
|
1764
255
|
},
|
|
1765
256
|
outdent: {
|
|
1766
257
|
selected: false,
|
|
1767
|
-
disabled
|
|
258
|
+
get disabled() {
|
|
259
|
+
return !(hasNode(state, state.schema.nodes.blockquote) ||
|
|
260
|
+
canOutdentAsListItem(state, outdentRules) ||
|
|
261
|
+
isIndented(state, outdentRules.nodes));
|
|
262
|
+
}
|
|
1768
263
|
},
|
|
1769
264
|
redo: {
|
|
1770
265
|
selected: false,
|
|
@@ -1890,6 +385,7 @@ var initialToolBarState = {
|
|
|
1890
385
|
format: { selected: { text: 'Format', tag: null }, disabled: false },
|
|
1891
386
|
style: { selected: { marks: [], hasNodesWithoutMarks: false }, disabled: false },
|
|
1892
387
|
cleanFormatting: { selected: false, disabled: true },
|
|
388
|
+
blockquote: { selected: false, disabled: false },
|
|
1893
389
|
//indent
|
|
1894
390
|
indent: { selected: false, disabled: false },
|
|
1895
391
|
outdent: { selected: false, disabled: false },
|
|
@@ -1942,6 +438,7 @@ var disabledToolBarState = {
|
|
|
1942
438
|
format: { selected: { text: 'Format', tag: null }, disabled: true },
|
|
1943
439
|
style: { selected: { marks: [], hasNodesWithoutMarks: false }, disabled: true },
|
|
1944
440
|
cleanFormatting: { selected: false, disabled: true },
|
|
441
|
+
blockquote: { selected: false, disabled: true },
|
|
1945
442
|
//indent
|
|
1946
443
|
indent: { selected: false, disabled: true },
|
|
1947
444
|
outdent: { selected: false, disabled: true },
|
|
@@ -1975,6 +472,117 @@ var disabledToolBarState = {
|
|
|
1975
472
|
selectAll: { selected: false, disabled: true }
|
|
1976
473
|
};
|
|
1977
474
|
|
|
475
|
+
/**
|
|
476
|
+
* @hidden
|
|
477
|
+
*/
|
|
478
|
+
function outerWidth(element) {
|
|
479
|
+
var width = element.offsetWidth;
|
|
480
|
+
var style = getComputedStyle(element);
|
|
481
|
+
width += parseFloat(style.marginLeft) || 0 + parseFloat(style.marginRight) || 0;
|
|
482
|
+
return width;
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* @hidden
|
|
486
|
+
*/
|
|
487
|
+
var removeEntries = function (obj, predicate) {
|
|
488
|
+
return Object.keys(obj)
|
|
489
|
+
.filter(function (key) { return predicate(key); })
|
|
490
|
+
.reduce(function (acc, curr) {
|
|
491
|
+
var _a;
|
|
492
|
+
return Object.assign(acc, (_a = {}, _a[curr] = obj[curr], _a));
|
|
493
|
+
}, {});
|
|
494
|
+
};
|
|
495
|
+
/**
|
|
496
|
+
* @hidden
|
|
497
|
+
*/
|
|
498
|
+
var removeEmptyEntries = function (obj) {
|
|
499
|
+
var predicate = function (key) { return obj[key] !== null && obj[key] !== undefined && obj[key] !== ''; };
|
|
500
|
+
return removeEntries(obj, predicate);
|
|
501
|
+
};
|
|
502
|
+
/**
|
|
503
|
+
* @hidden
|
|
504
|
+
*/
|
|
505
|
+
var isNullOrUndefined = function (value) { return value === undefined || value === null; };
|
|
506
|
+
/**
|
|
507
|
+
* @hidden
|
|
508
|
+
*/
|
|
509
|
+
var isPresent = function (value) { return !isNullOrUndefined(value); };
|
|
510
|
+
/**
|
|
511
|
+
* @hidden
|
|
512
|
+
*/
|
|
513
|
+
var detectIE = function () {
|
|
514
|
+
if (!isDocumentAvailable()) {
|
|
515
|
+
return false;
|
|
516
|
+
}
|
|
517
|
+
var ua = window.navigator.userAgent;
|
|
518
|
+
var msie = ua.indexOf('MSIE ');
|
|
519
|
+
var trident = ua.indexOf('Trident/');
|
|
520
|
+
return msie > 0 || trident > 0;
|
|
521
|
+
};
|
|
522
|
+
/**
|
|
523
|
+
* @hidden
|
|
524
|
+
*/
|
|
525
|
+
var safeString = function (value) { return (isNullOrUndefined(value) ? '' : value.toString()); };
|
|
526
|
+
/**
|
|
527
|
+
* @hidden
|
|
528
|
+
*/
|
|
529
|
+
var first = function (arr) { return arr[0]; };
|
|
530
|
+
/**
|
|
531
|
+
* @hidden
|
|
532
|
+
*/
|
|
533
|
+
var last = function (arr) { return arr[arr.length - 1]; };
|
|
534
|
+
/**
|
|
535
|
+
* @hidden
|
|
536
|
+
*/
|
|
537
|
+
var split = function (splitter) { return function (value) { return value.split(splitter); }; };
|
|
538
|
+
/**
|
|
539
|
+
* @hidden
|
|
540
|
+
*/
|
|
541
|
+
var trim = function (value) { return value.trim(); };
|
|
542
|
+
/**
|
|
543
|
+
* @hidden
|
|
544
|
+
*/
|
|
545
|
+
var filter$1 = function (predicate) { return function (arr) { return arr.filter(predicate); }; };
|
|
546
|
+
/**
|
|
547
|
+
* @hidden
|
|
548
|
+
*/
|
|
549
|
+
var getUniqueStyleValues = function (style, cssStyle) {
|
|
550
|
+
if (style.hasNodesWithoutMarks) {
|
|
551
|
+
return '';
|
|
552
|
+
}
|
|
553
|
+
var uniqueMarkValues = style.marks
|
|
554
|
+
.filter(function (m) { return m.type.name === 'style'; })
|
|
555
|
+
.map(function (m) { return m.attrs.style; })
|
|
556
|
+
.map(safeString)
|
|
557
|
+
.map(split(';'))
|
|
558
|
+
.map(filter$1(function (m) { return m.includes(cssStyle); }))
|
|
559
|
+
// guards against empty array
|
|
560
|
+
.map(function (cssStyleValues) { return (cssStyleValues.length !== 0 ? cssStyleValues : [cssStyle + ": INVALID"]); })
|
|
561
|
+
.map(first)
|
|
562
|
+
.map(split(':'))
|
|
563
|
+
.map(last)
|
|
564
|
+
.map(trim)
|
|
565
|
+
.reduce(function (acc, curr) { return (acc.indexOf(curr) > -1 ? acc : acc.concat([curr])); }, []);
|
|
566
|
+
if (uniqueMarkValues.indexOf('INVALID') > -1 || uniqueMarkValues.length !== 1) {
|
|
567
|
+
return '';
|
|
568
|
+
}
|
|
569
|
+
return uniqueMarkValues[0];
|
|
570
|
+
};
|
|
571
|
+
/**
|
|
572
|
+
* @hidden
|
|
573
|
+
*/
|
|
574
|
+
var conditionallyExecute = function (fn) { return function (condition) { return function (param) { return (condition ? fn(param) : param); }; }; };
|
|
575
|
+
/**
|
|
576
|
+
* @hidden
|
|
577
|
+
*/
|
|
578
|
+
var pipe = function () {
|
|
579
|
+
var fns = [];
|
|
580
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
581
|
+
fns[_i] = arguments[_i];
|
|
582
|
+
}
|
|
583
|
+
return function (x) { return fns.reduce(function (y, f) { return f(y); }, x); };
|
|
584
|
+
};
|
|
585
|
+
|
|
1978
586
|
/**
|
|
1979
587
|
* @hidden
|
|
1980
588
|
*/
|
|
@@ -2137,7 +745,7 @@ var ImageDialogComponent = /** @class */ (function (_super) {
|
|
|
2137
745
|
], ImageDialogComponent.prototype, "srcInput", void 0);
|
|
2138
746
|
ImageDialogComponent = __decorate([
|
|
2139
747
|
Component({
|
|
2140
|
-
template: "\n <kendo-dialog-titlebar (close)=\"onCancelAction()\">\n {{ textFor('insertImage') }}\n </kendo-dialog-titlebar>\n <div class=\"k-editor-dialog\">\n <div class=\"k-editor-dialog k-popup-edit-form k-window-content k-content\">\n <div class=\"k-edit-form-container k-window-content\">\n <div class=\"k-edit-label\">\n <label [for]=\"srcInputId\">{{ textFor('imageWebAddress') }}</label>\n </div>\n <div class=\"k-edit-field\">\n <input [id]=\"srcInputId\" #srcInput [formControl]=\"src\" type=\"text\" class=\"k-textbox\" />\n </div>\n <div class=\"k-edit-label\">\n <label [for]=\"altTextInputId\">{{ textFor('imageAltText') }}</label>\n </div>\n <div class=\"k-edit-field\">\n <input [id]=\"altTextInputId\" [formControl]=\"alt\" type=\"text\" class=\"k-textbox\" />\n </div>\n <div class=\"k-edit-label\">\n <label [for]=\"widthInputId\">{{ textFor('imageWidth') }}</label>\n </div>\n <div class=\"k-edit-field\">\n <input [id]=\"widthInputId\" [formControl]=\"width\" type=\"text\" class=\"k-textbox\" />\n </div>\n <div class=\"k-edit-label\">\n <label [for]=\"heightInputId\">{{ textFor('imageHeight') }}</label>\n </div>\n <div class=\"k-edit-field\">\n <input [id]=\"heightInputId\" [formControl]=\"height\" type=\"text\" class=\"k-textbox\" />\n </div>\n </div>\n </div>\n </div>\n <kendo-dialog-actions>\n <button kendoButton (click)=\"onCancelAction()\">{{ textFor('dialogCancel') }}</button>\n <button kendoButton [disabled]=\"imageData.invalid\"\n (click)=\"onConfirmAction()\" [primary]=\"true\">{{ textFor('dialogInsert') }}</button>\n </kendo-dialog-actions>\n "
|
|
748
|
+
template: "\n <kendo-dialog-titlebar (close)=\"onCancelAction()\">\n {{ textFor('insertImage') }}\n </kendo-dialog-titlebar>\n <div class=\"k-editor-dialog\">\n <div class=\"k-editor-dialog k-popup-edit-form k-window-content k-content\">\n <div class=\"k-edit-form-container k-window-content\">\n <div class=\"k-edit-label\">\n <label [for]=\"srcInputId\">{{ textFor('imageWebAddress') }}</label>\n </div>\n <div class=\"k-edit-field\">\n <input [id]=\"srcInputId\" #srcInput [formControl]=\"src\" type=\"text\" class=\"k-textbox k-input k-rounded-md\" />\n </div>\n <div class=\"k-edit-label\">\n <label [for]=\"altTextInputId\">{{ textFor('imageAltText') }}</label>\n </div>\n <div class=\"k-edit-field\">\n <input [id]=\"altTextInputId\" [formControl]=\"alt\" type=\"text\" class=\"k-textbox k-input k-rounded-md\" />\n </div>\n <div class=\"k-edit-label\">\n <label [for]=\"widthInputId\">{{ textFor('imageWidth') }}</label>\n </div>\n <div class=\"k-edit-field\">\n <input [id]=\"widthInputId\" [formControl]=\"width\" type=\"text\" class=\"k-textbox k-input k-rounded-md\" />\n </div>\n <div class=\"k-edit-label\">\n <label [for]=\"heightInputId\">{{ textFor('imageHeight') }}</label>\n </div>\n <div class=\"k-edit-field\">\n <input [id]=\"heightInputId\" [formControl]=\"height\" type=\"text\" class=\"k-textbox k-input k-rounded-md\" />\n </div>\n </div>\n </div>\n </div>\n <kendo-dialog-actions>\n <button kendoButton (click)=\"onCancelAction()\">{{ textFor('dialogCancel') }}</button>\n <button kendoButton [disabled]=\"imageData.invalid\"\n (click)=\"onConfirmAction()\" [primary]=\"true\">{{ textFor('dialogInsert') }}</button>\n </kendo-dialog-actions>\n "
|
|
2141
749
|
}),
|
|
2142
750
|
__metadata("design:paramtypes", [DialogRef,
|
|
2143
751
|
EditorLocalizationService])
|
|
@@ -2253,7 +861,7 @@ var FileLinkDialogComponent = /** @class */ (function (_super) {
|
|
|
2253
861
|
], FileLinkDialogComponent.prototype, "hrefInput", void 0);
|
|
2254
862
|
FileLinkDialogComponent = __decorate([
|
|
2255
863
|
Component({
|
|
2256
|
-
template: "\n <kendo-dialog-titlebar (close)=\"onCancelAction()\">\n {{ titleText }}\n </kendo-dialog-titlebar>\n <div class=\"k-editor-dialog\">\n <div class=\"k-editor-dialog k-popup-edit-form k-window-content k-content\">\n <div class=\"k-edit-form-container k-window-content\">\n <form novalidate [formGroup]=\"linkForm\">\n <div class=\"k-edit-label\">\n <label (click)=\"hrefInput.focus()\">{{ textForWithPrefix('WebAddress') }}</label>\n </div>\n <div class=\"k-edit-field\">\n <input #hrefInput formControlName=\"href\" type=\"text\" class=\"k-textbox\" />\n </div>\n\n <div class=\"k-edit-label\">\n <label (click)=\"textInput.focus()\">{{ textForWithPrefix('Text') }}</label>\n </div>\n <div class=\"k-edit-field\">\n <input #textInput formControlName=\"text\" type=\"text\" class=\"k-textbox\" />\n </div>\n\n <div class=\"k-edit-label\">\n <label (click)=\"titleInput.focus()\">{{ textForWithPrefix('Title') }}</label>\n </div>\n <div class=\"k-edit-field\">\n <input #titleInput formControlName=\"title\" type=\"text\" class=\"k-textbox\" />\n </div>\n <ng-container *ngIf=\"command === 'createLink'\">\n <div class=\"k-edit-label\"></div>\n <div class=\"k-edit-field\">\n <input type=\"checkbox\" id=\"k-target-blank\"
|
|
864
|
+
template: "\n <kendo-dialog-titlebar (close)=\"onCancelAction()\">\n {{ titleText }}\n </kendo-dialog-titlebar>\n <div class=\"k-editor-dialog\">\n <div class=\"k-editor-dialog k-popup-edit-form k-window-content k-content\">\n <div class=\"k-edit-form-container k-window-content\">\n <form novalidate [formGroup]=\"linkForm\">\n <div class=\"k-edit-label\">\n <label (click)=\"hrefInput.focus()\">{{ textForWithPrefix('WebAddress') }}</label>\n </div>\n <div class=\"k-edit-field\">\n <input #hrefInput formControlName=\"href\" type=\"text\" class=\"k-textbox k-input k-rounded-md\" />\n </div>\n\n <div class=\"k-edit-label\">\n <label (click)=\"textInput.focus()\">{{ textForWithPrefix('Text') }}</label>\n </div>\n <div class=\"k-edit-field\">\n <input #textInput formControlName=\"text\" type=\"text\" class=\"k-textbox k-input k-rounded-md\" />\n </div>\n\n <div class=\"k-edit-label\">\n <label (click)=\"titleInput.focus()\">{{ textForWithPrefix('Title') }}</label>\n </div>\n <div class=\"k-edit-field\">\n <input #titleInput formControlName=\"title\" type=\"text\" class=\"k-textbox k-input k-rounded-md\" />\n </div>\n <ng-container *ngIf=\"command === 'createLink'\">\n <div class=\"k-edit-label\"></div>\n <div class=\"k-edit-field\">\n <input type=\"checkbox\" id=\"k-target-blank\" kendoCheckBox formControlName=\"target\" />\n <label class=\"k-checkbox-label\" for=\"k-target-blank\">{{ textForWithPrefix('OpenInNewWindow') }}</label>\n </div>\n </ng-container>\n </form>\n </div>\n </div>\n </div>\n <kendo-dialog-actions>\n <button kendoButton (click)=\"onCancelAction()\">{{ textFor('dialogCancel') }}</button>\n <button kendoButton [disabled]=\"linkForm.invalid\" (click)=\"onConfirmAction()\" [primary]=\"true\">\n {{ textFor('dialogInsert') }}\n </button>\n </kendo-dialog-actions>\n "
|
|
2257
865
|
}),
|
|
2258
866
|
__metadata("design:paramtypes", [DialogRef, EditorLocalizationService])
|
|
2259
867
|
], FileLinkDialogComponent);
|
|
@@ -2273,7 +881,7 @@ var tablesStyles = "\n .ProseMirror .tableWrapper {\n overflow-x: auto;\n
|
|
|
2273
881
|
*/
|
|
2274
882
|
var rtlStyles = 'body { direction: rtl }';
|
|
2275
883
|
|
|
2276
|
-
var ɵ0$
|
|
884
|
+
var ɵ0$2 = function (arg) { return "plugins must be a function, but received " + JSON.stringify(arg) + "."; }, ɵ1$2 = function (arg) { return "pastedContent must be a function, but received " + JSON.stringify(arg) + "."; };
|
|
2277
885
|
/* tslint:disable:variable-name */
|
|
2278
886
|
/**
|
|
2279
887
|
* @hidden
|
|
@@ -2281,9 +889,10 @@ var ɵ0$6 = function (arg) { return "plugins must be a function, but received "
|
|
|
2281
889
|
var EditorErrorMessages = {
|
|
2282
890
|
schemaType: 'Expected value of type Schema. See http://www.telerik.com/kendo-angular-ui/components/editor/schema/',
|
|
2283
891
|
setSchemaOnce: 'The Schema cannot be changed dynamically. See http://www.telerik.com/kendo-angular-ui/components/editor/schema/',
|
|
2284
|
-
pluginsCallbackType: ɵ0$
|
|
892
|
+
pluginsCallbackType: ɵ0$2,
|
|
893
|
+
pastedContentCallbackType: ɵ1$2,
|
|
2285
894
|
setPluginsOnce: 'The plugins cannot be changed dynamically. See http://www.telerik.com/kendo-angular-ui/components/editor/plugins/',
|
|
2286
|
-
setPlaceHolderOnce: 'The placeholder cannot be changed dynamically. See
|
|
895
|
+
setPlaceHolderOnce: 'The placeholder cannot be changed dynamically. See https://www.telerik.com/kendo-angular-ui/components/editor/plugins/#toc-custom-plugins/',
|
|
2287
896
|
printTool: 'The Print tool and functionality are supported only in iframe mode. See https://www.telerik.com/kendo-angular-ui-develop/components/editor/api/EditorPrintButtonDirective/'
|
|
2288
897
|
};
|
|
2289
898
|
|
|
@@ -2300,15 +909,34 @@ var EditorToolsService = /** @class */ (function () {
|
|
|
2300
909
|
return EditorToolsService;
|
|
2301
910
|
}());
|
|
2302
911
|
|
|
912
|
+
/**
|
|
913
|
+
* The Editor [`paste`]({% slug api_editor_editorcomponent %}#toc-paste) event.
|
|
914
|
+
*/
|
|
915
|
+
var EditorPasteEvent = /** @class */ (function (_super) {
|
|
916
|
+
__extends(EditorPasteEvent, _super);
|
|
917
|
+
/**
|
|
918
|
+
* Constructs the event arguments for the `paste` event.
|
|
919
|
+
* @hidden
|
|
920
|
+
*/
|
|
921
|
+
function EditorPasteEvent(cleanedHtml, originalHtml, originalEvent) {
|
|
922
|
+
var _this = _super.call(this) || this;
|
|
923
|
+
_this.cleanedHtml = cleanedHtml;
|
|
924
|
+
_this.originalHtml = originalHtml;
|
|
925
|
+
_this.originalEvent = originalEvent;
|
|
926
|
+
return _this;
|
|
927
|
+
}
|
|
928
|
+
return EditorPasteEvent;
|
|
929
|
+
}(PreventableEvent));
|
|
930
|
+
|
|
2303
931
|
var EMPTY_PARAGRAPH = '<p></p>';
|
|
2304
932
|
var defaultPasteCleanupSettings = {
|
|
2305
933
|
convertMsLists: false,
|
|
2306
934
|
removeAttributes: [],
|
|
2307
935
|
removeHtmlComments: false,
|
|
2308
|
-
removeInvalidHTML:
|
|
936
|
+
removeInvalidHTML: true,
|
|
2309
937
|
removeMsClasses: false,
|
|
2310
938
|
removeMsStyles: false,
|
|
2311
|
-
stripTags: [
|
|
939
|
+
stripTags: []
|
|
2312
940
|
};
|
|
2313
941
|
var removeCommentsIf = conditionallyExecute(removeComments);
|
|
2314
942
|
var removeInvalidHTMLIf = conditionallyExecute(sanitize);
|
|
@@ -2348,14 +976,6 @@ var EditorComponent = /** @class */ (function () {
|
|
|
2348
976
|
* @default false
|
|
2349
977
|
*/
|
|
2350
978
|
this.applyToWord = false;
|
|
2351
|
-
/**
|
|
2352
|
-
* By design, the Editor emits `valueChange`, updates the model and the ToolBar state on each keystroke.
|
|
2353
|
-
* When you are interested in ignoring the new values for a given amout of time and take only the most recent one, you can use the `updateInterval` property.
|
|
2354
|
-
* A possible use case is to get the new values and to update the ToolBar state at a maximum rate per second in order to speed up your application.
|
|
2355
|
-
* The specified interval (in milliseconds) should be a positive number.
|
|
2356
|
-
* By default the `updateInterval` is set to 100 miliseconds. If set to zero the delay will be disabled entirely.
|
|
2357
|
-
*/
|
|
2358
|
-
this.updateInterval = 100;
|
|
2359
979
|
/**
|
|
2360
980
|
* By default, whitespace is collapsed as per HTML's rules.
|
|
2361
981
|
* Set to `true` to preserve whitespace, but normalize newlines to spaces.
|
|
@@ -2381,6 +1001,11 @@ var EditorComponent = /** @class */ (function () {
|
|
|
2381
1001
|
* Fires when the content area of the Editor is focused ([see example]({% slug overview_editor %}#toc-events)).
|
|
2382
1002
|
*/
|
|
2383
1003
|
this.onFocus = new EventEmitter();
|
|
1004
|
+
/**
|
|
1005
|
+
* Fires when the user performs paste in the content area of the Editor ([see example]({% slug overview_editor %}#toc-events)).
|
|
1006
|
+
* The event is preventable. If you cancel it, the Editor content will not change.
|
|
1007
|
+
*/
|
|
1008
|
+
this.paste = new EventEmitter();
|
|
2384
1009
|
/**
|
|
2385
1010
|
* Fires when the content area of the Editor is blurred ([see example]({% slug overview_editor %}#toc-events)).
|
|
2386
1011
|
*/
|
|
@@ -2396,10 +1021,76 @@ var EditorComponent = /** @class */ (function () {
|
|
|
2396
1021
|
this.valueModified = new Subject();
|
|
2397
1022
|
this._readonly = false;
|
|
2398
1023
|
this._placeholder = '';
|
|
1024
|
+
this.inForm = false;
|
|
2399
1025
|
this.afterViewInit = new Subject();
|
|
2400
1026
|
this.contentAreaLoaded = new Subject();
|
|
2401
|
-
this.
|
|
1027
|
+
this.dispatchTransaction = function (tr) {
|
|
1028
|
+
var docChanged = tr.docChanged;
|
|
1029
|
+
if (_this.disabled || (_this.readonly && docChanged)) {
|
|
1030
|
+
return;
|
|
1031
|
+
}
|
|
1032
|
+
if (docChanged) {
|
|
1033
|
+
var doc = tr.doc;
|
|
1034
|
+
var html_1 = getHtml({ doc: doc });
|
|
1035
|
+
_this.trOnChange = tr;
|
|
1036
|
+
_this.htmlOnChange = html_1;
|
|
1037
|
+
_this.ngZone.run(function () {
|
|
1038
|
+
_this.valueModified.next(html_1);
|
|
1039
|
+
});
|
|
1040
|
+
}
|
|
1041
|
+
if (!docChanged || _this.inForm) {
|
|
1042
|
+
_this.view.updateState(_this.view.state.apply(tr));
|
|
1043
|
+
}
|
|
1044
|
+
};
|
|
1045
|
+
this.transformPastedHTML = function (dirtyHtml) {
|
|
1046
|
+
var pasteCleanupSettings = __assign({}, defaultPasteCleanupSettings, _this.pasteCleanupSettings);
|
|
1047
|
+
var html = pipe(removeInvalidHTMLIf(pasteCleanupSettings.removeInvalidHTML), removeCommentsIf(pasteCleanupSettings.removeHtmlComments))(dirtyHtml);
|
|
1048
|
+
var clean = pasteCleanup(html, {
|
|
1049
|
+
convertMsLists: pasteCleanupSettings.convertMsLists,
|
|
1050
|
+
stripTags: pasteCleanupSettings.stripTags.join('|'),
|
|
1051
|
+
attributes: getPasteCleanupAttributes(pasteCleanupSettings)
|
|
1052
|
+
});
|
|
1053
|
+
if (hasObservers(_this.paste)) {
|
|
1054
|
+
var event_1 = new EditorPasteEvent(clean, dirtyHtml, _this._pasteEvent);
|
|
1055
|
+
_this.ngZone.run(function () { return _this.paste.emit(event_1); });
|
|
1056
|
+
return event_1.isDefaultPrevented() ? '' : event_1.cleanedHtml;
|
|
1057
|
+
}
|
|
1058
|
+
return clean;
|
|
1059
|
+
};
|
|
1060
|
+
this.changeValue = function (value) {
|
|
1061
|
+
var prev = _this._value;
|
|
1062
|
+
_this._value = value;
|
|
1063
|
+
if (!_this._view) {
|
|
1064
|
+
return;
|
|
1065
|
+
}
|
|
1066
|
+
if (_this.htmlOnChange === value && _this.trOnChange) {
|
|
1067
|
+
_this.view.updateState(_this.view.state.apply(_this.trOnChange));
|
|
1068
|
+
}
|
|
1069
|
+
else {
|
|
1070
|
+
if ((prev || '') !== (value || '')) {
|
|
1071
|
+
var iframeContentWindowNotPresent = _this.iframe && !_this.container.element.nativeElement.contentWindow;
|
|
1072
|
+
if (iframeContentWindowNotPresent) {
|
|
1073
|
+
return;
|
|
1074
|
+
}
|
|
1075
|
+
var state = _this.view.state;
|
|
1076
|
+
var nextDoc = parseContent(value || '', state.schema, { preserveWhitespace: _this.preserveWhitespace });
|
|
1077
|
+
var tr = state.tr
|
|
1078
|
+
.setSelection(new AllSelection(state.doc))
|
|
1079
|
+
.replaceSelectionWith(nextDoc);
|
|
1080
|
+
_this.view.updateState(state.apply(tr));
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
_this.trOnChange = null;
|
|
1084
|
+
_this.htmlOnChange = null;
|
|
1085
|
+
};
|
|
1086
|
+
this.onChangeCallback = function (value) {
|
|
1087
|
+
_this.changeValue(value);
|
|
1088
|
+
};
|
|
2402
1089
|
this.onTouchedCallback = function (_) { }; // tslint:disable-line:no-empty
|
|
1090
|
+
this.onPaste = function (_view, nativeEvent) {
|
|
1091
|
+
_this._pasteEvent = nativeEvent;
|
|
1092
|
+
return false;
|
|
1093
|
+
};
|
|
2403
1094
|
validatePackage(packageMetadata);
|
|
2404
1095
|
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
2405
1096
|
// https://stackoverflow.com/questions/56572483/chrome-is-synchronously-handling-iframe-loading-whereas-firefox-handles-it-asyn
|
|
@@ -2408,6 +1099,9 @@ var EditorComponent = /** @class */ (function () {
|
|
|
2408
1099
|
EditorComponent_1 = EditorComponent;
|
|
2409
1100
|
Object.defineProperty(EditorComponent.prototype, "value", {
|
|
2410
1101
|
get: function () {
|
|
1102
|
+
if (this.trOnChange) {
|
|
1103
|
+
return this.htmlOnChange;
|
|
1104
|
+
}
|
|
2411
1105
|
var value = this._view ? this.getSource() : this._value;
|
|
2412
1106
|
if (value === EMPTY_PARAGRAPH) {
|
|
2413
1107
|
return this._value ? '' : this._value;
|
|
@@ -2420,23 +1114,7 @@ var EditorComponent = /** @class */ (function () {
|
|
|
2420
1114
|
* Sets the value of the Editor ([see example]({% slug overview_editor %}#toc-basic-usage)).
|
|
2421
1115
|
*/
|
|
2422
1116
|
set: function (value) {
|
|
2423
|
-
|
|
2424
|
-
return;
|
|
2425
|
-
}
|
|
2426
|
-
this._value = value;
|
|
2427
|
-
this._previousValue = value;
|
|
2428
|
-
if (this._view) {
|
|
2429
|
-
var iframeContentWindowNotPresent = this.iframe && !this.container.element.nativeElement.contentWindow;
|
|
2430
|
-
if (iframeContentWindowNotPresent) {
|
|
2431
|
-
return;
|
|
2432
|
-
}
|
|
2433
|
-
this.exec('setHTML', {
|
|
2434
|
-
content: this._value || '',
|
|
2435
|
-
parseOptions: {
|
|
2436
|
-
preserveWhitespace: this.preserveWhitespace
|
|
2437
|
-
}
|
|
2438
|
-
});
|
|
2439
|
-
}
|
|
1117
|
+
this.changeValue(value);
|
|
2440
1118
|
},
|
|
2441
1119
|
enumerable: true,
|
|
2442
1120
|
configurable: true
|
|
@@ -2697,6 +1375,9 @@ var EditorComponent = /** @class */ (function () {
|
|
|
2697
1375
|
};
|
|
2698
1376
|
EditorComponent.prototype.ngOnChanges = function (changes) {
|
|
2699
1377
|
var _this = this;
|
|
1378
|
+
if (changes.value && this.view) {
|
|
1379
|
+
this.changeValue(changes.value.currentValue);
|
|
1380
|
+
}
|
|
2700
1381
|
if (changes.iframe && !changes.iframe.isFirstChange()) {
|
|
2701
1382
|
this.ngZone.onStable.pipe(take(1)).subscribe(function () { return _this.initialize(); });
|
|
2702
1383
|
}
|
|
@@ -2724,7 +1405,7 @@ var EditorComponent = /** @class */ (function () {
|
|
|
2724
1405
|
* @param {any} attr - Optional parameters for the command. Apart from the following list,
|
|
2725
1406
|
* the parameters do not expect specific attributes when you call them:
|
|
2726
1407
|
* - `format` - Accepts an object with the `tag` property.
|
|
2727
|
-
* The supported tags are `p
|
|
1408
|
+
* The supported tags are `p` and any of the `h1` to `h6` heading tags.
|
|
2728
1409
|
* - `createLink` - Accepts an object with the `href`, `title`, and `target` properties. The `href` property is mandatory.
|
|
2729
1410
|
* - `setHTML` - Accepts a `string` parameter.
|
|
2730
1411
|
* - `insertTable` - Accepts an object with the `rows` and `cols` properties. The number values are zero based.
|
|
@@ -2782,8 +1463,6 @@ var EditorComponent = /** @class */ (function () {
|
|
|
2782
1463
|
var command = editorCommands[commandName](attr);
|
|
2783
1464
|
// Executes a ProseMirror command.
|
|
2784
1465
|
command(this._view.state, this._view.dispatch, this._view);
|
|
2785
|
-
// See the `dispatchTransaction` comments.
|
|
2786
|
-
// this.stateChange.emit(updateToolBar(this.view));
|
|
2787
1466
|
};
|
|
2788
1467
|
/**
|
|
2789
1468
|
* Opens a dialog.
|
|
@@ -2868,6 +1547,7 @@ var EditorComponent = /** @class */ (function () {
|
|
|
2868
1547
|
* @hidden
|
|
2869
1548
|
*/
|
|
2870
1549
|
EditorComponent.prototype.writeValue = function (value) {
|
|
1550
|
+
this.inForm = true;
|
|
2871
1551
|
// To avoid confusion, non-existent values are always undefined.
|
|
2872
1552
|
this.value = value === null ? undefined : value;
|
|
2873
1553
|
};
|
|
@@ -2896,7 +1576,6 @@ var EditorComponent = /** @class */ (function () {
|
|
|
2896
1576
|
return;
|
|
2897
1577
|
}
|
|
2898
1578
|
var currentSchema = this.schema || schema;
|
|
2899
|
-
var that = this;
|
|
2900
1579
|
var containerNativeElement = this.container.element.nativeElement;
|
|
2901
1580
|
var contentNode = parseContent((this.value || '').trim(), currentSchema, { preserveWhitespace: this.preserveWhitespace });
|
|
2902
1581
|
if (this.iframe) {
|
|
@@ -2938,16 +1617,13 @@ var EditorComponent = /** @class */ (function () {
|
|
|
2938
1617
|
}
|
|
2939
1618
|
}); }
|
|
2940
1619
|
}),
|
|
2941
|
-
new Plugin({
|
|
2942
|
-
key: new PluginKey('editor-filter-disabled-state'),
|
|
2943
|
-
filterTransaction: function () { return !_this.disabled; }
|
|
2944
|
-
}),
|
|
2945
1620
|
history(),
|
|
2946
1621
|
keymap(buildListKeymap(currentSchema)),
|
|
2947
1622
|
keymap(buildKeymap(currentSchema, { applyToWord: this.applyToWord })),
|
|
2948
1623
|
keymap(baseKeymap),
|
|
2949
1624
|
gapCursor(),
|
|
2950
|
-
imageResizing()
|
|
1625
|
+
imageResizing(),
|
|
1626
|
+
tableEditing()
|
|
2951
1627
|
];
|
|
2952
1628
|
if (this.placeholder) {
|
|
2953
1629
|
defaultPlugins.push(placeholder(this.placeholder));
|
|
@@ -2967,31 +1643,10 @@ var EditorComponent = /** @class */ (function () {
|
|
|
2967
1643
|
_this._view = new EditorView({ mount: _this.viewMountElement }, {
|
|
2968
1644
|
state: state,
|
|
2969
1645
|
editable: function () { return !_this.readonly; },
|
|
2970
|
-
dispatchTransaction:
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
// When the user utilizes keyboard shortcuts—for example, `Ctrl`+`b`—
|
|
2975
|
-
// `tr.docChanged` is `true` and the toolbar is not updated.
|
|
2976
|
-
// A possible future solution is to move the keymaps to the service.
|
|
2977
|
-
// if (!tr.docChanged) {
|
|
2978
|
-
// that.stateChange.emit(updateToolBar(that.view));
|
|
2979
|
-
// }
|
|
2980
|
-
var value = that.value;
|
|
2981
|
-
if (!hasSameMarkup(value, that._previousValue, this.state.schema)) {
|
|
2982
|
-
that._previousValue = value;
|
|
2983
|
-
that.ngZone.run(function () { return that.valueModified.next(value); });
|
|
2984
|
-
}
|
|
2985
|
-
},
|
|
2986
|
-
transformPastedHTML: function (html) {
|
|
2987
|
-
var pasteCleanupSettings = __assign({}, defaultPasteCleanupSettings, _this.pasteCleanupSettings);
|
|
2988
|
-
var clean = pipe(removeCommentsIf(pasteCleanupSettings.removeHtmlComments), removeInvalidHTMLIf(pasteCleanupSettings.removeInvalidHTML))(html);
|
|
2989
|
-
var attributes = getPasteCleanupAttributes(pasteCleanupSettings);
|
|
2990
|
-
return pasteCleanup(clean, {
|
|
2991
|
-
convertMsLists: pasteCleanupSettings.convertMsLists,
|
|
2992
|
-
stripTags: pasteCleanupSettings.stripTags.join('|'),
|
|
2993
|
-
attributes: attributes
|
|
2994
|
-
});
|
|
1646
|
+
dispatchTransaction: _this.dispatchTransaction,
|
|
1647
|
+
transformPastedHTML: _this.transformPastedHTML,
|
|
1648
|
+
handleDOMEvents: {
|
|
1649
|
+
paste: _this.onPaste
|
|
2995
1650
|
}
|
|
2996
1651
|
});
|
|
2997
1652
|
});
|
|
@@ -3007,7 +1662,7 @@ var EditorComponent = /** @class */ (function () {
|
|
|
3007
1662
|
this.subs.add(fromEvent(containerElement, 'focusin')
|
|
3008
1663
|
.subscribe(function () {
|
|
3009
1664
|
if (_this.readonly) {
|
|
3010
|
-
contentAreaClasslist_1.add('k-
|
|
1665
|
+
contentAreaClasslist_1.add('k-focus');
|
|
3011
1666
|
}
|
|
3012
1667
|
if (!_this.focusChangedProgrammatically || _this.shouldEmitFocus) {
|
|
3013
1668
|
_this.ngZone.run(function () { return _this.onFocus.emit(); });
|
|
@@ -3017,7 +1672,7 @@ var EditorComponent = /** @class */ (function () {
|
|
|
3017
1672
|
this.subs.add(fromEvent(containerElement, 'focusout')
|
|
3018
1673
|
.subscribe(function () {
|
|
3019
1674
|
if (_this.readonly) {
|
|
3020
|
-
contentAreaClasslist_1.remove('k-
|
|
1675
|
+
contentAreaClasslist_1.remove('k-focus');
|
|
3021
1676
|
}
|
|
3022
1677
|
if (!_this.focusChangedProgrammatically) {
|
|
3023
1678
|
_this.ngZone.run(function () { return _this.onBlur.emit(); });
|
|
@@ -3032,7 +1687,7 @@ var EditorComponent = /** @class */ (function () {
|
|
|
3032
1687
|
_this.cdr.detectChanges();
|
|
3033
1688
|
}
|
|
3034
1689
|
}));
|
|
3035
|
-
this.subs.add(
|
|
1690
|
+
this.subs.add(this.valueModified.subscribe(function (value) {
|
|
3036
1691
|
_this.onChangeCallback(value);
|
|
3037
1692
|
_this.valueChange.emit(value);
|
|
3038
1693
|
_this.cdr.markForCheck();
|
|
@@ -3126,10 +1781,6 @@ var EditorComponent = /** @class */ (function () {
|
|
|
3126
1781
|
__metadata("design:type", String),
|
|
3127
1782
|
__metadata("design:paramtypes", [String])
|
|
3128
1783
|
], EditorComponent.prototype, "placeholder", null);
|
|
3129
|
-
__decorate([
|
|
3130
|
-
Input(),
|
|
3131
|
-
__metadata("design:type", Number)
|
|
3132
|
-
], EditorComponent.prototype, "updateInterval", void 0);
|
|
3133
1784
|
__decorate([
|
|
3134
1785
|
Input(),
|
|
3135
1786
|
__metadata("design:type", Object)
|
|
@@ -3150,6 +1801,10 @@ var EditorComponent = /** @class */ (function () {
|
|
|
3150
1801
|
Output('focus'),
|
|
3151
1802
|
__metadata("design:type", EventEmitter)
|
|
3152
1803
|
], EditorComponent.prototype, "onFocus", void 0);
|
|
1804
|
+
__decorate([
|
|
1805
|
+
Output(),
|
|
1806
|
+
__metadata("design:type", EventEmitter)
|
|
1807
|
+
], EditorComponent.prototype, "paste", void 0);
|
|
3153
1808
|
__decorate([
|
|
3154
1809
|
Output('blur'),
|
|
3155
1810
|
__metadata("design:type", EventEmitter)
|
|
@@ -3164,7 +1819,7 @@ var EditorComponent = /** @class */ (function () {
|
|
|
3164
1819
|
__metadata("design:paramtypes", [])
|
|
3165
1820
|
], EditorComponent.prototype, "resizableClass", null);
|
|
3166
1821
|
__decorate([
|
|
3167
|
-
HostBinding('class.k-
|
|
1822
|
+
HostBinding('class.k-disabled'),
|
|
3168
1823
|
__metadata("design:type", Boolean),
|
|
3169
1824
|
__metadata("design:paramtypes", [])
|
|
3170
1825
|
], EditorComponent.prototype, "isDisabled", null);
|
|
@@ -3257,7 +1912,7 @@ var EditorComponent = /** @class */ (function () {
|
|
|
3257
1912
|
}
|
|
3258
1913
|
],
|
|
3259
1914
|
/* tslint:disable:max-line-length */
|
|
3260
|
-
template: "\n <ng-container\n kendoEditorLocalizedMessages\n i18n-alignCenter=\"kendo.editor.alignCenter|The title of the tool that aligns text in the center.\"\n alignCenter=\"Center text\"\n i18n-alignJustify=\"kendo.editor.alignJustify|The title of the tool that justifies text both left and right.\"\n alignJustify=\"Justify\"\n i18n-alignLeft=\"kendo.editor.alignLeft|The title of the tool that aligns text on the left.\"\n alignLeft=\"Align text left\"\n i18n-alignRight=\"kendo.editor.alignRight|The title of the tool that aligns text on the right.\"\n alignRight=\"Align text right\"\n i18n-backColor=\"kendo.editor.backColor|The title of the tool that changes the text background color.\"\n backColor=\"Background color\"\n i18n-bold=\"kendo.editor.bold|The title of the tool that makes text bold.\"\n bold=\"Bold\"\n i18n-cleanFormatting=\"kendo.editor.cleanFormatting|The title of the Clean Formatting tool.\"\n cleanFormatting=\"Clean formatting\"\n i18n-createLink=\"kendo.editor.createLink|The title of the tool that creates hyperlinks.\"\n createLink=\"Insert link\"\n i18n-dialogApply=\"kendo.editor.dialogApply|The label of the **Apply** button in all editor dialogs.\"\n dialogApply=\"Apply\"\n i18n-dialogCancel=\"kendo.editor.dialogCancel|The label of the **Cancel** button in all editor dialogs.\"\n dialogCancel=\"Cancel\"\n i18n-dialogInsert=\"kendo.editor.dialogInsert|The label of the **Insert** button in all editor dialogs.\"\n dialogInsert=\"Insert\"\n i18n-dialogUpdate=\"kendo.editor.dialogUpdate|The label of the **Update** button in all editor dialogs.\"\n dialogUpdate=\"Update\"\n i18n-fileText=\"kendo.editor.fileText|The caption for the file text in the insertFile dialog.\"\n fileText=\"Text\"\n i18n-fileTitle=\"kendo.editor.fileTitle|The caption for the file Title in the insertFile dialog.\"\n fileTitle=\"Title\"\n i18n-fileWebAddress=\"kendo.editor.fileWebAddress|The caption for the file URL in the insertFile dialog.\"\n fileWebAddress=\"Web address\"\n i18n-fontFamily=\"kendo.editor.fontFamily|The title of the tool that changes the text font.\"\n fontFamily=\"Select font family\"\n i18n-fontSize=\"kendo.editor.fontSize|The title of the tool that changes the text size.\"\n fontSize=\"Select font size\"\n i18n-foreColor=\"kendo.editor.foreColor|The title of the tool that changes the text color.\"\n foreColor=\"Color\"\n i18n-format=\"kendo.editor.format|The title of the tool that lets users choose block formats.\"\n format=\"Format\"\n i18n-imageAltText=\"kendo.editor.imageAltText|The caption for the image alternate text in the insertImage dialog.\"\n imageAltText=\"Alternate text\"\n i18n-imageHeight=\"kendo.editor.imageHeight|The caption for the image height in the insertImage dialog.\"\n imageHeight=\"Height (px)\"\n i18n-imageWebAddress=\"kendo.editor.imageWebAddress|The caption for the image URL in the insertImage dialog.\"\n imageWebAddress=\"Web address\"\n i18n-imageWidth=\"kendo.editor.imageWidth|The caption for the image width in the insertImage dialog.\"\n imageWidth=\"Width (px)\"\n i18n-indent=\"kendo.editor.indent|The title of the tool that indents the content.\"\n indent=\"Indent\"\n i18n-insertFile=\"kendo.editor.insertFile|The title of the tool that inserts links to files.\"\n insertFile=\"Insert file\"\n i18n-insertImage=\"kendo.editor.insertImage|The title of the tool that inserts images.\"\n insertImage=\"Insert image\"\n i18n-insertOrderedList=\"kendo.editor.insertOrderedList|The title of the tool that inserts an ordered list.\"\n insertOrderedList=\"Insert ordered list\"\n i18n-insertUnorderedList=\"kendo.editor.insertUnorderedList|The title of the tool that inserts an unordered list.\"\n insertUnorderedList=\"Insert unordered list\"\n i18n-italic=\"kendo.editor.italic|The title of the tool that makes text italicized.\"\n italic=\"Italic\"\n i18n-linkOpenInNewWindow=\"kendo.editor.linkOpenInNewWindow|The caption for the checkbox for opening the link in a new window in the createLink dialog.\"\n linkOpenInNewWindow=\"Open link in new window\"\n i18n-linkText=\"kendo.editor.linkText|The caption for the link text in the createLink dialog.\"\n linkText=\"Text\"\n i18n-linkTitle=\"kendo.editor.linkTitle|The caption for the link title in the createLink dialog.\"\n linkTitle=\"Title\"\n i18n-linkWebAddress=\"kendo.editor.linkWebAddress|The caption for the URL in the createLink dialog.\"\n linkWebAddress=\"Web address\"\n i18n-outdent=\"kendo.editor.outdent|The title of the tool that outdents the content.\"\n outdent=\"Outdent\"\n i18n-print=\"kendo.editor.print|The title of the print tool.\"\n print=\"Print\"\n i18n-redo=\"kendo.editor.redo|The title of the tool that undos the last action.\"\n redo=\"Redo\"\n i18n-selectAll=\"kendo.editor.selectAll|The title of the tool that selects all content.\"\n selectAll=\"Select All\"\n i18n-strikethrough=\"kendo.editor.strikethrough|The title of the tool that strikes through text.\"\n strikethrough=\"Strikethrough\"\n i18n-subscript=\"kendo.editor.subscript|The title of the tool that makes text subscript.\"\n subscript=\"Subscript\"\n i18n-superscript=\"kendo.editor.superscript|The title of the tool that makes text superscript.\"\n superscript=\"Superscript\"\n i18n-underline=\"kendo.editor.underline|The title of the tool that underlines text.\"\n underline=\"Underline\"\n i18n-unlink=\"kendo.editor.unlink|The title of the tool that removes hyperlinks.\"\n unlink=\"Remove Link\"\n i18n-undo=\"kendo.editor.undo|The title of the tool that undos the last action.\"\n undo=\"Undo\"\n i18n-viewSource=\"kendo.editor.viewSource|The title of the tool that shows the editor value as HTML.\"\n viewSource=\"View source\"\n i18n-insertTable=\"kendo.editor.insertTable|The title of the tool that inserts table.\"\n insertTable=\"Insert Table\"\n i18n-addColumnBefore=\"kendo.editor.addColumnBefore|The title of the tool that adds new column before currently selected column.\"\n addColumnBefore=\"Add column before\"\n i18n-addColumnAfter=\"kendo.editor.addColumnAfter|The title of the tool that adds new column after currently selected column.\"\n addColumnAfter=\"Add column after\"\n i18n-addRowBefore=\"kendo.editor.addRowBefore|The title of the tool that adds new row before currently selected row.\"\n addRowBefore=\"Add row before\"\n i18n-addRowAfter=\"kendo.editor.addRowAfter|The title of the tool that adds new row after currently selected row.\"\n addRowAfter=\"Add row after\"\n i18n-deleteColumn=\"kendo.editor.deleteColumn|The title of the tool that deletes a table column.\"\n deleteColumn=\"Delete column\"\n i18n-deleteRow=\"kendo.editor.deleteRow|The title of the tool that deletes a table row.\"\n deleteRow=\"Delete row\"\n i18n-deleteTable=\"kendo.editor.deleteTable|The title of the tool that deletes a table.\"\n deleteTable=\"Delete table\"\n >\n </ng-container>\n\n <ng-content select=\"kendo-toolbar\"></ng-content>\n <kendo-toolbar [overflow]=\"true\" [tabindex]=\"readonly ? -1 : 0\" *ngIf=\"!userToolBarElement\" #defaultToolbar>\n <kendo-toolbar-buttongroup>\n <kendo-toolbar-button kendoEditorBoldButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorItalicButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorUnderlineButton></kendo-toolbar-button>\n </kendo-toolbar-buttongroup>\n <kendo-toolbar-dropdownlist kendoEditorFormat></kendo-toolbar-dropdownlist>\n <kendo-toolbar-buttongroup>\n <kendo-toolbar-button kendoEditorAlignLeftButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorAlignCenterButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorAlignRightButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorAlignJustifyButton></kendo-toolbar-button>\n </kendo-toolbar-buttongroup>\n <kendo-toolbar-buttongroup>\n <kendo-toolbar-button kendoEditorInsertUnorderedListButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorInsertOrderedListButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorIndentButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorOutdentButton></kendo-toolbar-button>\n </kendo-toolbar-buttongroup>\n <kendo-toolbar-buttongroup>\n <kendo-toolbar-button kendoEditorCreateLinkButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorUnlinkButton></kendo-toolbar-button>\n </kendo-toolbar-buttongroup>\n <kendo-toolbar-button kendoEditorInsertImageButton></kendo-toolbar-button>\n </kendo-toolbar>\n\n <div *ngIf=\"!iframe\" #content [attr.dir]=\"direction\" class=\"k-editor-content\"></div>\n\n <div class=\"k-editor-content\" *ngIf=\"iframe\">\n <iframe #content frameborder=\"0\" class=\"k-iframe\" (load)=\"iframeOnLoad()\"></iframe>\n </div>\n\n <ng-container #dialogsContainer></ng-container>\n ",
|
|
1915
|
+
template: "\n <ng-container\n kendoEditorLocalizedMessages\n i18n-alignCenter=\"kendo.editor.alignCenter|The title of the tool that aligns text in the center.\"\n alignCenter=\"Center text\"\n i18n-alignJustify=\"kendo.editor.alignJustify|The title of the tool that justifies text both left and right.\"\n alignJustify=\"Justify\"\n i18n-alignLeft=\"kendo.editor.alignLeft|The title of the tool that aligns text on the left.\"\n alignLeft=\"Align text left\"\n i18n-alignRight=\"kendo.editor.alignRight|The title of the tool that aligns text on the right.\"\n alignRight=\"Align text right\"\n i18n-backColor=\"kendo.editor.backColor|The title of the tool that changes the text background color.\"\n backColor=\"Background color\"\n i18n-blockquote=\"kendo.editor.blockquote|The title of the tool that wraps an element in a blockquote\"\n blockquote=\"Quotation\"\n i18n-bold=\"kendo.editor.bold|The title of the tool that makes text bold.\"\n bold=\"Bold\"\n i18n-cleanFormatting=\"kendo.editor.cleanFormatting|The title of the Clean Formatting tool.\"\n cleanFormatting=\"Clean formatting\"\n i18n-createLink=\"kendo.editor.createLink|The title of the tool that creates hyperlinks.\"\n createLink=\"Insert link\"\n i18n-dialogApply=\"kendo.editor.dialogApply|The label of the **Apply** button in all editor dialogs.\"\n dialogApply=\"Apply\"\n i18n-dialogCancel=\"kendo.editor.dialogCancel|The label of the **Cancel** button in all editor dialogs.\"\n dialogCancel=\"Cancel\"\n i18n-dialogInsert=\"kendo.editor.dialogInsert|The label of the **Insert** button in all editor dialogs.\"\n dialogInsert=\"Insert\"\n i18n-dialogUpdate=\"kendo.editor.dialogUpdate|The label of the **Update** button in all editor dialogs.\"\n dialogUpdate=\"Update\"\n i18n-fileText=\"kendo.editor.fileText|The caption for the file text in the insertFile dialog.\"\n fileText=\"Text\"\n i18n-fileTitle=\"kendo.editor.fileTitle|The caption for the file Title in the insertFile dialog.\"\n fileTitle=\"Title\"\n i18n-fileWebAddress=\"kendo.editor.fileWebAddress|The caption for the file URL in the insertFile dialog.\"\n fileWebAddress=\"Web address\"\n i18n-fontFamily=\"kendo.editor.fontFamily|The title of the tool that changes the text font.\"\n fontFamily=\"Select font family\"\n i18n-fontSize=\"kendo.editor.fontSize|The title of the tool that changes the text size.\"\n fontSize=\"Select font size\"\n i18n-foreColor=\"kendo.editor.foreColor|The title of the tool that changes the text color.\"\n foreColor=\"Color\"\n i18n-format=\"kendo.editor.format|The title of the tool that lets users choose block formats.\"\n format=\"Format\"\n i18n-imageAltText=\"kendo.editor.imageAltText|The caption for the image alternate text in the insertImage dialog.\"\n imageAltText=\"Alternate text\"\n i18n-imageHeight=\"kendo.editor.imageHeight|The caption for the image height in the insertImage dialog.\"\n imageHeight=\"Height (px)\"\n i18n-imageWebAddress=\"kendo.editor.imageWebAddress|The caption for the image URL in the insertImage dialog.\"\n imageWebAddress=\"Web address\"\n i18n-imageWidth=\"kendo.editor.imageWidth|The caption for the image width in the insertImage dialog.\"\n imageWidth=\"Width (px)\"\n i18n-indent=\"kendo.editor.indent|The title of the tool that indents the content.\"\n indent=\"Indent\"\n i18n-insertFile=\"kendo.editor.insertFile|The title of the tool that inserts links to files.\"\n insertFile=\"Insert file\"\n i18n-insertImage=\"kendo.editor.insertImage|The title of the tool that inserts images.\"\n insertImage=\"Insert image\"\n i18n-insertOrderedList=\"kendo.editor.insertOrderedList|The title of the tool that inserts an ordered list.\"\n insertOrderedList=\"Insert ordered list\"\n i18n-insertUnorderedList=\"kendo.editor.insertUnorderedList|The title of the tool that inserts an unordered list.\"\n insertUnorderedList=\"Insert unordered list\"\n i18n-italic=\"kendo.editor.italic|The title of the tool that makes text italicized.\"\n italic=\"Italic\"\n i18n-linkOpenInNewWindow=\"kendo.editor.linkOpenInNewWindow|The caption for the checkbox for opening the link in a new window in the createLink dialog.\"\n linkOpenInNewWindow=\"Open link in new window\"\n i18n-linkText=\"kendo.editor.linkText|The caption for the link text in the createLink dialog.\"\n linkText=\"Text\"\n i18n-linkTitle=\"kendo.editor.linkTitle|The caption for the link title in the createLink dialog.\"\n linkTitle=\"Title\"\n i18n-linkWebAddress=\"kendo.editor.linkWebAddress|The caption for the URL in the createLink dialog.\"\n linkWebAddress=\"Web address\"\n i18n-outdent=\"kendo.editor.outdent|The title of the tool that outdents the content.\"\n outdent=\"Outdent\"\n i18n-print=\"kendo.editor.print|The title of the print tool.\"\n print=\"Print\"\n i18n-redo=\"kendo.editor.redo|The title of the tool that undos the last action.\"\n redo=\"Redo\"\n i18n-selectAll=\"kendo.editor.selectAll|The title of the tool that selects all content.\"\n selectAll=\"Select All\"\n i18n-strikethrough=\"kendo.editor.strikethrough|The title of the tool that strikes through text.\"\n strikethrough=\"Strikethrough\"\n i18n-subscript=\"kendo.editor.subscript|The title of the tool that makes text subscript.\"\n subscript=\"Subscript\"\n i18n-superscript=\"kendo.editor.superscript|The title of the tool that makes text superscript.\"\n superscript=\"Superscript\"\n i18n-underline=\"kendo.editor.underline|The title of the tool that underlines text.\"\n underline=\"Underline\"\n i18n-unlink=\"kendo.editor.unlink|The title of the tool that removes hyperlinks.\"\n unlink=\"Remove Link\"\n i18n-undo=\"kendo.editor.undo|The title of the tool that undos the last action.\"\n undo=\"Undo\"\n i18n-viewSource=\"kendo.editor.viewSource|The title of the tool that shows the editor value as HTML.\"\n viewSource=\"View source\"\n i18n-insertTable=\"kendo.editor.insertTable|The title of the tool that inserts table.\"\n insertTable=\"Insert Table\"\n i18n-addColumnBefore=\"kendo.editor.addColumnBefore|The title of the tool that adds new column before currently selected column.\"\n addColumnBefore=\"Add column before\"\n i18n-addColumnAfter=\"kendo.editor.addColumnAfter|The title of the tool that adds new column after currently selected column.\"\n addColumnAfter=\"Add column after\"\n i18n-addRowBefore=\"kendo.editor.addRowBefore|The title of the tool that adds new row before currently selected row.\"\n addRowBefore=\"Add row before\"\n i18n-addRowAfter=\"kendo.editor.addRowAfter|The title of the tool that adds new row after currently selected row.\"\n addRowAfter=\"Add row after\"\n i18n-deleteColumn=\"kendo.editor.deleteColumn|The title of the tool that deletes a table column.\"\n deleteColumn=\"Delete column\"\n i18n-deleteRow=\"kendo.editor.deleteRow|The title of the tool that deletes a table row.\"\n deleteRow=\"Delete row\"\n i18n-deleteTable=\"kendo.editor.deleteTable|The title of the tool that deletes a table.\"\n deleteTable=\"Delete table\"\n >\n </ng-container>\n\n <ng-content select=\"kendo-toolbar\"></ng-content>\n <kendo-toolbar [overflow]=\"true\" [tabindex]=\"readonly ? -1 : 0\" *ngIf=\"!userToolBarElement\" #defaultToolbar>\n <kendo-toolbar-buttongroup>\n <kendo-toolbar-button kendoEditorBoldButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorItalicButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorUnderlineButton></kendo-toolbar-button>\n </kendo-toolbar-buttongroup>\n <kendo-toolbar-dropdownlist kendoEditorFormat></kendo-toolbar-dropdownlist>\n <kendo-toolbar-buttongroup>\n <kendo-toolbar-button kendoEditorAlignLeftButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorAlignCenterButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorAlignRightButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorAlignJustifyButton></kendo-toolbar-button>\n </kendo-toolbar-buttongroup>\n <kendo-toolbar-buttongroup>\n <kendo-toolbar-button kendoEditorInsertUnorderedListButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorInsertOrderedListButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorIndentButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorOutdentButton></kendo-toolbar-button>\n </kendo-toolbar-buttongroup>\n <kendo-toolbar-buttongroup>\n <kendo-toolbar-button kendoEditorCreateLinkButton></kendo-toolbar-button>\n <kendo-toolbar-button kendoEditorUnlinkButton></kendo-toolbar-button>\n </kendo-toolbar-buttongroup>\n <kendo-toolbar-button kendoEditorInsertImageButton></kendo-toolbar-button>\n </kendo-toolbar>\n\n <div *ngIf=\"!iframe\" #content [attr.dir]=\"direction\" class=\"k-editor-content\"></div>\n\n <div class=\"k-editor-content\" *ngIf=\"iframe\">\n <iframe #content srcdoc=\"<!DOCTYPE html>\" frameborder=\"0\" class=\"k-iframe\" (load)=\"iframeOnLoad()\"></iframe>\n </div>\n\n <ng-container #dialogsContainer></ng-container>\n ",
|
|
3261
1916
|
styles: [
|
|
3262
1917
|
"\n >>> .k-editor-content > .ProseMirror {\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n outline: none;\n overflow: auto;\n }\n\n .k-iframe {\n width: 100%;\n height: 100%;\n display: block;\n }\n "
|
|
3263
1918
|
]
|
|
@@ -3329,7 +1984,7 @@ var FormatDropDownListComponent = /** @class */ (function () {
|
|
|
3329
1984
|
Component({
|
|
3330
1985
|
// tslint:disable-next-line:no-forward-ref
|
|
3331
1986
|
selector: 'kendo-editor-format-dropdownlist',
|
|
3332
|
-
template: "\n <kendo-dropdownlist\n #element\n kendoEditorDropDownTool\n [defaultItem]=\"defaultItem\"\n [textField]=\"'text'\"\n [valueField]=\"'tag'\"\n [data]=\"data\"\n [(value)]=\"value\"\n [valuePrimitive]=\"true\"\n [itemDisabled]=\"itemDisabled\"\n [attr.title]=\"title\"\n [disabled]=\"disabled\"\n [tabindex]=\"tabindex\"\n (valueChange)=\"onValueChange($event)\"\n >\n <ng-template kendoDropDownListItemTemplate let-dataItem>\n <ng-container [ngSwitch]=\"dataItem.tag\">\n <span *ngSwitchCase=\"'h1'\" style=\"display: block; font-size: 2em; margin-left: 0; font-weight: bold;\">\n {{ dataItem.text }}\n </span>\n\n <span *ngSwitchCase=\"'h2'\" style=\"display: block; font-size: 1.5em; margin-left: 0; font-weight: bold;\">\n {{ dataItem.text }}\n </span>\n\n <span *ngSwitchCase=\"'h3'\" style=\"display: block; font-size: 1.17em; margin-left: 0; font-weight: bold;\">\n {{ dataItem.text }}\n </span>\n\n <span *ngSwitchCase=\"'h4'\" style=\"display: block; font-size: 1em; margin-left: 0; font-weight: bold;\">\n {{ dataItem.text }}\n </span>\n\n <span *ngSwitchCase=\"'h5'\" style=\"display: block; font-size: .83em; margin-left: 0; font-weight: bold;\">\n {{ dataItem.text }}\n </span>\n\n <span *ngSwitchCase=\"'h6'\" style=\"display: block; font-size: .67em; margin-left: 0; font-weight: bold;\">\n {{ dataItem.text }}\n </span>\n\n <span *ngSwitchCase=\"'p'\" style=\"display: block; margin-left: 0;\">\n {{ dataItem.text }}\n </span>\n\n <span *
|
|
1987
|
+
template: "\n <kendo-dropdownlist\n #element\n kendoEditorDropDownTool\n [defaultItem]=\"defaultItem\"\n [textField]=\"'text'\"\n [valueField]=\"'tag'\"\n [data]=\"data\"\n [(value)]=\"value\"\n [valuePrimitive]=\"true\"\n [itemDisabled]=\"itemDisabled\"\n [attr.title]=\"title\"\n [disabled]=\"disabled\"\n [tabindex]=\"tabindex\"\n (valueChange)=\"onValueChange($event)\"\n >\n <ng-template kendoDropDownListItemTemplate let-dataItem>\n <ng-container [ngSwitch]=\"dataItem.tag\">\n <span *ngSwitchCase=\"'h1'\" style=\"display: block; font-size: 2em; margin-left: 0; font-weight: bold;\">\n {{ dataItem.text }}\n </span>\n\n <span *ngSwitchCase=\"'h2'\" style=\"display: block; font-size: 1.5em; margin-left: 0; font-weight: bold;\">\n {{ dataItem.text }}\n </span>\n\n <span *ngSwitchCase=\"'h3'\" style=\"display: block; font-size: 1.17em; margin-left: 0; font-weight: bold;\">\n {{ dataItem.text }}\n </span>\n\n <span *ngSwitchCase=\"'h4'\" style=\"display: block; font-size: 1em; margin-left: 0; font-weight: bold;\">\n {{ dataItem.text }}\n </span>\n\n <span *ngSwitchCase=\"'h5'\" style=\"display: block; font-size: .83em; margin-left: 0; font-weight: bold;\">\n {{ dataItem.text }}\n </span>\n\n <span *ngSwitchCase=\"'h6'\" style=\"display: block; font-size: .67em; margin-left: 0; font-weight: bold;\">\n {{ dataItem.text }}\n </span>\n\n <span *ngSwitchCase=\"'p'\" style=\"display: block; margin-left: 0;\">\n {{ dataItem.text }}\n </span>\n\n <span *ngSwitchDefault>{{ dataItem.text }}</span>\n </ng-container>\n </ng-template>\n </kendo-dropdownlist>\n "
|
|
3333
1988
|
})
|
|
3334
1989
|
], FormatDropDownListComponent);
|
|
3335
1990
|
return FormatDropDownListComponent;
|
|
@@ -3441,7 +2096,7 @@ var ColorPickerDialogComponent = /** @class */ (function (_super) {
|
|
|
3441
2096
|
], ColorPickerDialogComponent.prototype, "colorPicker", void 0);
|
|
3442
2097
|
ColorPickerDialogComponent = __decorate([
|
|
3443
2098
|
Component({
|
|
3444
|
-
template: "\n <kendo-dialog-titlebar (close)=\"onCancelAction()\">\n {{ textFor(editorCommand) }}\n </kendo-dialog-titlebar>\n <div class=\"k-editor-dialog\">\n <div class=\"k-editor-dialog k-popup-edit-form k-window-content k-content\">\n <div class=\"k-edit-form-container k-window-content\" style=\"text-align: center;\">\n <kendo-colorpicker\n #colorpicker\n [
|
|
2099
|
+
template: "\n <kendo-dialog-titlebar (close)=\"onCancelAction()\">\n {{ textFor(editorCommand) }}\n </kendo-dialog-titlebar>\n <div class=\"k-editor-dialog\">\n <div class=\"k-editor-dialog k-popup-edit-form k-window-content k-content\">\n <div class=\"k-edit-form-container k-window-content\" style=\"text-align: center;\">\n <kendo-colorpicker\n #colorpicker\n [views]=\"['palette']\"\n [format]=\"'hex'\"\n [attr.title]=\"title\"\n [icon]=\"icon\"\n [(value)]=\"value\"\n [paletteSettings]=\"paletteSettings\"\n (activeColorClick)=\"handleActiveColorClick($event)\"\n >\n </kendo-colorpicker>\n </div>\n </div>\n </div>\n <kendo-dialog-actions>\n <button kendoButton (click)=\"onCancelAction()\">{{ textFor('dialogCancel') }}</button>\n <button kendoButton\n (click)=\"onConfirmAction()\" [primary]=\"true\">{{ textFor('dialogApply') }}</button>\n </kendo-dialog-actions>\n "
|
|
3445
2100
|
}),
|
|
3446
2101
|
__metadata("design:paramtypes", [DialogRef,
|
|
3447
2102
|
EditorLocalizationService])
|
|
@@ -3634,7 +2289,6 @@ var EditorFormatComponent = /** @class */ (function (_super) {
|
|
|
3634
2289
|
_this.valueChange = new EventEmitter();
|
|
3635
2290
|
_this._data = [
|
|
3636
2291
|
{ text: 'Paragraph', tag: 'p' },
|
|
3637
|
-
{ text: 'Quotation', tag: 'blockquote' },
|
|
3638
2292
|
{ text: 'Heading 1', tag: 'h1' },
|
|
3639
2293
|
{ text: 'Heading 2', tag: 'h2' },
|
|
3640
2294
|
{ text: 'Heading 3', tag: 'h3' },
|
|
@@ -4323,14 +2977,26 @@ var EditorColorPickerComponent = /** @class */ (function (_super) {
|
|
|
4323
2977
|
*/
|
|
4324
2978
|
_this.disabled = false;
|
|
4325
2979
|
/**
|
|
4326
|
-
* Specifies whether the ColorPicker will render a gradient, palette or
|
|
2980
|
+
* Specifies whether the ColorPicker will render a gradient, palette, or both in its popup.
|
|
4327
2981
|
*
|
|
4328
|
-
* @default 'palette'
|
|
2982
|
+
* @default ['palette']
|
|
4329
2983
|
*/
|
|
4330
|
-
_this.
|
|
2984
|
+
_this.views = ['palette'];
|
|
4331
2985
|
return _this;
|
|
4332
2986
|
}
|
|
4333
2987
|
EditorColorPickerComponent_1 = EditorColorPickerComponent;
|
|
2988
|
+
Object.defineProperty(EditorColorPickerComponent.prototype, "view", {
|
|
2989
|
+
/**
|
|
2990
|
+
* @hidden
|
|
2991
|
+
*
|
|
2992
|
+
* For backward compatibility with configurations using the deprecated "view" input.
|
|
2993
|
+
*/
|
|
2994
|
+
set: function (view) {
|
|
2995
|
+
this.views = [view];
|
|
2996
|
+
},
|
|
2997
|
+
enumerable: true,
|
|
2998
|
+
configurable: true
|
|
2999
|
+
});
|
|
4334
3000
|
Object.defineProperty(EditorColorPickerComponent.prototype, "title", {
|
|
4335
3001
|
/**
|
|
4336
3002
|
* @hidden
|
|
@@ -4412,7 +3078,7 @@ var EditorColorPickerComponent = /** @class */ (function (_super) {
|
|
|
4412
3078
|
editorCommand: this.editorCommand,
|
|
4413
3079
|
paletteSettings: this.paletteSettings,
|
|
4414
3080
|
icon: this.icon,
|
|
4415
|
-
|
|
3081
|
+
views: this.views
|
|
4416
3082
|
});
|
|
4417
3083
|
};
|
|
4418
3084
|
/**
|
|
@@ -4463,8 +3129,13 @@ var EditorColorPickerComponent = /** @class */ (function (_super) {
|
|
|
4463
3129
|
], EditorColorPickerComponent.prototype, "disabled", void 0);
|
|
4464
3130
|
__decorate([
|
|
4465
3131
|
Input(),
|
|
4466
|
-
__metadata("design:type",
|
|
4467
|
-
], EditorColorPickerComponent.prototype, "
|
|
3132
|
+
__metadata("design:type", Array)
|
|
3133
|
+
], EditorColorPickerComponent.prototype, "views", void 0);
|
|
3134
|
+
__decorate([
|
|
3135
|
+
Input(),
|
|
3136
|
+
__metadata("design:type", String),
|
|
3137
|
+
__metadata("design:paramtypes", [String])
|
|
3138
|
+
], EditorColorPickerComponent.prototype, "view", null);
|
|
4468
3139
|
__decorate([
|
|
4469
3140
|
ViewChild('toolbarTemplate', { static: true }),
|
|
4470
3141
|
__metadata("design:type", TemplateRef)
|
|
@@ -4489,7 +3160,7 @@ var EditorColorPickerComponent = /** @class */ (function (_super) {
|
|
|
4489
3160
|
Component({
|
|
4490
3161
|
providers: [{ provide: ToolBarToolComponent, useExisting: forwardRef(function () { return EditorColorPickerComponent_1; }) }],
|
|
4491
3162
|
selector: 'kendo-toolbar-colorpicker',
|
|
4492
|
-
template: "\n <ng-template #toolbarTemplate>\n <kendo-colorpicker\n #colorpicker\n [
|
|
3163
|
+
template: "\n <ng-template #toolbarTemplate>\n <kendo-colorpicker\n #colorpicker\n [views]=\"['palette']\"\n [format]=\"'hex'\"\n [attr.title]=\"title\"\n [icon]=\"icon\"\n [value]=\"value\"\n [paletteSettings]=\"paletteSettings\"\n [disabled]=\"disabled\"\n [tabindex]=\"tabindex\"\n (valueChange)=\"handleValueChange($event)\"\n (activeColorClick)=\"handleActiveColorClick($event)\"\n (open)=\"onOpen(colorpicker)\"\n (close)=\"onClose(colorpicker)\"\n >\n </kendo-colorpicker>\n </ng-template>\n <ng-template #popupTemplate>\n <button\n tabindex=\"-1\"\n type=\"button\"\n kendoButton\n #colorPickerButton\n class=\"k-overflow-button\"\n [icon]=\"icon\"\n [attr.title]=\"title\"\n [disabled]=\"disabled\"\n [tabindex]=\"tabindex\"\n (click)=\"openDialog()\"\n >\n {{ title }}\n </button>\n </ng-template>\n "
|
|
4493
3164
|
}),
|
|
4494
3165
|
__param(0, Host()),
|
|
4495
3166
|
__metadata("design:paramtypes", [EditorComponent,
|
|
@@ -4743,7 +3414,7 @@ var PopupTableGridComponent = /** @class */ (function () {
|
|
|
4743
3414
|
PopupTableGridComponent = __decorate([
|
|
4744
3415
|
Component({
|
|
4745
3416
|
selector: 'kendo-popup-table-grid',
|
|
4746
|
-
template: "\n <div style=\"border-color: inherit;\" (mouseleave)=\"resetState()\" (click)=\"insertTable()\">\n <span *ngFor=\"let i of cells\"\n class=\"k-ct-cell\"\n [class.k-
|
|
3417
|
+
template: "\n <div style=\"border-color: inherit;\" (mouseleave)=\"resetState()\" (click)=\"insertTable()\">\n <span *ngFor=\"let i of cells\"\n class=\"k-ct-cell\"\n [class.k-selected]=\"selected(i)\"\n [class.k-disabled]=\"!selected(i)\"\n (mouseenter)=\"setState(i)\">\n </span>\n </div>\n <div class=\"k-status\" unselectable=\"on\">{{ message }}</div>\n <!-- uncomment when TableWizard is completed\n <div class=\"k-editor-toolbar\" unselectable=\"on\">\n <button type=\"button\" kendoButton class=\"k-tool\" [icon]=\"'table-wizard'\" (click)=\"openTableWizard()\" title=\"Table Wizard\">Table Wizard</button>\n </div>\n -->\n "
|
|
4747
3418
|
})
|
|
4748
3419
|
], PopupTableGridComponent);
|
|
4749
3420
|
return PopupTableGridComponent;
|
|
@@ -4758,6 +3429,7 @@ var commandIcons = {
|
|
|
4758
3429
|
alignLeft: 'align-left',
|
|
4759
3430
|
alignRight: 'align-right',
|
|
4760
3431
|
backColor: 'background',
|
|
3432
|
+
blockquote: 'blockquote',
|
|
4761
3433
|
bold: 'bold',
|
|
4762
3434
|
cleanFormatting: 'clear-css',
|
|
4763
3435
|
createLink: 'link-horizontal',
|
|
@@ -5009,6 +3681,43 @@ var EditorAlignJustifyButtonDirective = /** @class */ (function (_super) {
|
|
|
5009
3681
|
return EditorAlignJustifyButtonDirective;
|
|
5010
3682
|
}(EditorCommandButton));
|
|
5011
3683
|
|
|
3684
|
+
/**
|
|
3685
|
+
* A directive which configures an existing `ToolBarButtonComponent` as an Editor Blockquote tool
|
|
3686
|
+
* ([see example]({% slug toolbartools_editor %}#toc-built-in-tools)).
|
|
3687
|
+
* The directive will predefine the `icon` and `click` event handlers of the button.
|
|
3688
|
+
*
|
|
3689
|
+
* @example
|
|
3690
|
+
* ```ts-no-run
|
|
3691
|
+
* <kendo-toolbar-button kendoEditorBlockquoteButton></kendo-toolbar-button>
|
|
3692
|
+
* ```
|
|
3693
|
+
*
|
|
3694
|
+
* The following example demonstrates how to change the default icon that is applied by the directive.
|
|
3695
|
+
*
|
|
3696
|
+
* @example
|
|
3697
|
+
* ```ts-no-run
|
|
3698
|
+
* <kendo-toolbar-button kendoEditorBlockquoteButton icon="blogger"></kendo-toolbar-button>
|
|
3699
|
+
* ```
|
|
3700
|
+
*/
|
|
3701
|
+
var EditorBlockquoteDirective = /** @class */ (function (_super) {
|
|
3702
|
+
__extends(EditorBlockquoteDirective, _super);
|
|
3703
|
+
function EditorBlockquoteDirective(button, editor, localization, toolsService) {
|
|
3704
|
+
var _this = _super.call(this, 'blockquote', button, editor, localization, toolsService) || this;
|
|
3705
|
+
_this.editor = editor;
|
|
3706
|
+
return _this;
|
|
3707
|
+
}
|
|
3708
|
+
EditorBlockquoteDirective = __decorate([
|
|
3709
|
+
Directive({
|
|
3710
|
+
selector: 'kendo-toolbar-button[kendoEditorBlockquoteButton]'
|
|
3711
|
+
}),
|
|
3712
|
+
__param(1, Host()),
|
|
3713
|
+
__metadata("design:paramtypes", [ToolBarButtonComponent,
|
|
3714
|
+
EditorComponent,
|
|
3715
|
+
EditorLocalizationService,
|
|
3716
|
+
EditorToolsService])
|
|
3717
|
+
], EditorBlockquoteDirective);
|
|
3718
|
+
return EditorBlockquoteDirective;
|
|
3719
|
+
}(EditorCommandButton));
|
|
3720
|
+
|
|
5012
3721
|
/**
|
|
5013
3722
|
* A directive which configures an existing `ToolBarButtonComponent` as an Editor Redo tool
|
|
5014
3723
|
* ([see example]({% slug toolbartools_editor %}#toc-built-in-tools)).
|
|
@@ -6003,6 +4712,10 @@ var Messages = /** @class */ (function (_super) {
|
|
|
6003
4712
|
Input(),
|
|
6004
4713
|
__metadata("design:type", String)
|
|
6005
4714
|
], Messages.prototype, "backColor", void 0);
|
|
4715
|
+
__decorate([
|
|
4716
|
+
Input(),
|
|
4717
|
+
__metadata("design:type", String)
|
|
4718
|
+
], Messages.prototype, "blockquote", void 0);
|
|
6006
4719
|
__decorate([
|
|
6007
4720
|
Input(),
|
|
6008
4721
|
__metadata("design:type", String)
|
|
@@ -6438,7 +5151,9 @@ var COMPONENT_DIRECTIVES = [
|
|
|
6438
5151
|
// print
|
|
6439
5152
|
EditorPrintDirective,
|
|
6440
5153
|
// select all
|
|
6441
|
-
EditorSelectAllButtonDirective
|
|
5154
|
+
EditorSelectAllButtonDirective,
|
|
5155
|
+
// blockquote
|
|
5156
|
+
EditorBlockquoteDirective
|
|
6442
5157
|
];
|
|
6443
5158
|
var TOOLBAR_TOOLS = [
|
|
6444
5159
|
EditorFontSizeComponent,
|
|
@@ -6543,6 +5258,7 @@ var EditorModule = /** @class */ (function () {
|
|
|
6543
5258
|
DialogModule,
|
|
6544
5259
|
DropDownsModule,
|
|
6545
5260
|
NumericTextBoxModule,
|
|
5261
|
+
CheckBoxModule,
|
|
6546
5262
|
ToolBarModule,
|
|
6547
5263
|
TextBoxModule
|
|
6548
5264
|
]
|
|
@@ -6555,4 +5271,4 @@ var EditorModule = /** @class */ (function () {
|
|
|
6555
5271
|
* Generated bundle index. Do not edit.
|
|
6556
5272
|
*/
|
|
6557
5273
|
|
|
6558
|
-
export { ColorPickerDialogComponent, FileLinkDialogComponent, FontFamilyDialogComponent, FontSizeDialogComponent, FormatDialogComponent, ImageDialogComponent, InsertTableDialogComponent, SourceDialogComponent, CustomMessagesComponent, EditorLocalizationService, LocalizedMessagesDirective, Messages, EditorAlignCenterButtonDirective, EditorAlignJustifyButtonDirective, EditorAlignLeftButtonDirective, EditorAlignRightButtonDirective, EditorBackColorDirective, EditorColorPickerComponent, EditorForeColorDirective, EditorCleanFormattingButtonDirective, FontFamilyDropDownListComponent, EditorFontFamilyComponent, FontSizeDropDownListComponent, EditorFontSizeComponent, FormatDropDownListComponent, EditorFormatComponent, EditorRedoButtonDirective, EditorUndoButtonDirective, EditorInsertImageButtonDirective, EditorIndentButtonDirective, EditorOutdentButtonDirective, EditorCreateLinkButtonDirective, EditorInsertFileButtonDirective, EditorUnlinkButtonDirective, EditorInsertOrderedListButtonDirective, EditorInsertUnorderedListButtonDirective, EditorPrintDirective, EditorSelectAllButtonDirective, DropDownToolDirective, EditorCommandBase, EditorCommandButton, EditorCommandDialog, EditorViewSourceButtonDirective, EditorAddColumnAfterButtonDirective, EditorAddColumnBeforeButtonDirective, EditorAddRowAfterButtonDirective, EditorAddRowBeforeButtonDirective, EditorDeleteColumnButtonDirective, EditorDeleteRowButtonDirective, EditorDeleteTableButtonDirective, EditorInsertTableButtonComponent, EditorMergeCellsButtonDirective, EditorSplitCellButtonDirective, PopupTableGridComponent, EditorToolsService, EditorBoldButtonDirective, EditorItalicButtonDirective, EditorStrikethroughButtonDirective, EditorSubscriptButtonDirective, EditorSuperscriptButtonDirective, EditorUnderlineButtonDirective, EditorComponent, EditorModule, schema };
|
|
5274
|
+
export { semanticNodes, semanticTagNames, ColorPickerDialogComponent, FileLinkDialogComponent, FontFamilyDialogComponent, FontSizeDialogComponent, FormatDialogComponent, ImageDialogComponent, InsertTableDialogComponent, SourceDialogComponent, CustomMessagesComponent, EditorLocalizationService, LocalizedMessagesDirective, Messages, EditorAlignCenterButtonDirective, EditorAlignJustifyButtonDirective, EditorAlignLeftButtonDirective, EditorAlignRightButtonDirective, EditorBlockquoteDirective, EditorBackColorDirective, EditorColorPickerComponent, EditorForeColorDirective, EditorCleanFormattingButtonDirective, FontFamilyDropDownListComponent, EditorFontFamilyComponent, FontSizeDropDownListComponent, EditorFontSizeComponent, FormatDropDownListComponent, EditorFormatComponent, EditorRedoButtonDirective, EditorUndoButtonDirective, EditorInsertImageButtonDirective, EditorIndentButtonDirective, EditorOutdentButtonDirective, EditorCreateLinkButtonDirective, EditorInsertFileButtonDirective, EditorUnlinkButtonDirective, EditorInsertOrderedListButtonDirective, EditorInsertUnorderedListButtonDirective, EditorPrintDirective, EditorSelectAllButtonDirective, DropDownToolDirective, EditorCommandBase, EditorCommandButton, EditorCommandDialog, EditorViewSourceButtonDirective, EditorAddColumnAfterButtonDirective, EditorAddColumnBeforeButtonDirective, EditorAddRowAfterButtonDirective, EditorAddRowBeforeButtonDirective, EditorDeleteColumnButtonDirective, EditorDeleteRowButtonDirective, EditorDeleteTableButtonDirective, EditorInsertTableButtonComponent, EditorMergeCellsButtonDirective, EditorSplitCellButtonDirective, PopupTableGridComponent, EditorToolsService, EditorBoldButtonDirective, EditorItalicButtonDirective, EditorStrikethroughButtonDirective, EditorSubscriptButtonDirective, EditorSuperscriptButtonDirective, EditorUnderlineButtonDirective, EditorComponent, EditorModule, schema, EditorPasteEvent };
|