@progress/kendo-angular-editor 2.5.0-dev.202111261548 → 3.0.0-dev.202201121058

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/cdn/js/kendo-angular-editor.js +2 -2
  2. package/dist/cdn/main.js +1 -1
  3. package/dist/es/common/error-messages.js +3 -2
  4. package/dist/es/config/commands.js +2 -2
  5. package/dist/es/config/schema.js +1 -2
  6. package/dist/es/config/table-commands.js +1 -363
  7. package/dist/es/editor.component.js +99 -71
  8. package/dist/es/main.js +1 -0
  9. package/dist/es/package-metadata.js +1 -1
  10. package/dist/{es2015/config/table-nodes.d.ts → es/preventable-events/paste-event-data.js} +0 -5
  11. package/dist/es/preventable-events/paste-event.js +25 -0
  12. package/dist/es2015/common/error-messages.js +3 -2
  13. package/dist/es2015/common/paste-cleanup-settings.d.ts +14 -0
  14. package/dist/es2015/config/commands.js +2 -2
  15. package/dist/es2015/config/schema.js +1 -2
  16. package/dist/es2015/config/table-commands.d.ts +0 -36
  17. package/dist/es2015/config/table-commands.js +1 -357
  18. package/dist/es2015/editor.component.d.ts +15 -10
  19. package/dist/es2015/editor.component.js +99 -71
  20. package/dist/es2015/index.metadata.json +1 -1
  21. package/dist/es2015/main.d.ts +2 -0
  22. package/dist/es2015/main.js +1 -0
  23. package/dist/es2015/package-metadata.js +1 -1
  24. package/dist/es2015/preventable-events/paste-event-data.d.ts +21 -0
  25. package/dist/es2015/preventable-events/paste-event-data.js +4 -0
  26. package/dist/es2015/preventable-events/paste-event.d.ts +27 -0
  27. package/dist/es2015/preventable-events/paste-event.js +20 -0
  28. package/dist/fesm2015/index.js +263 -1596
  29. package/dist/fesm5/index.js +285 -1641
  30. package/dist/npm/common/error-messages.js +3 -1
  31. package/dist/npm/config/commands.js +1 -1
  32. package/dist/npm/config/schema.js +1 -2
  33. package/dist/npm/config/table-commands.js +1 -368
  34. package/dist/npm/editor.component.js +95 -67
  35. package/dist/npm/main.js +2 -0
  36. package/dist/npm/package-metadata.js +1 -1
  37. package/dist/npm/preventable-events/paste-event-data.js +6 -0
  38. package/dist/npm/preventable-events/paste-event.js +27 -0
  39. package/dist/systemjs/kendo-angular-editor.js +1 -1
  40. package/package.json +5 -5
  41. package/dist/es/config/table-nodes.js +0 -146
  42. package/dist/es/config/tables/CellSelection.js +0 -268
  43. package/dist/es/config/tables/TableMap.js +0 -333
  44. package/dist/es/config/tables/table-utils.js +0 -302
  45. package/dist/es2015/config/table-nodes.js +0 -145
  46. package/dist/es2015/config/tables/CellSelection.d.ts +0 -35
  47. package/dist/es2015/config/tables/CellSelection.js +0 -256
  48. package/dist/es2015/config/tables/TableMap.d.ts +0 -35
  49. package/dist/es2015/config/tables/TableMap.js +0 -329
  50. package/dist/es2015/config/tables/table-utils.d.ts +0 -77
  51. package/dist/es2015/config/tables/table-utils.js +0 -299
  52. package/dist/npm/config/table-nodes.js +0 -157
  53. package/dist/npm/config/tables/CellSelection.js +0 -270
  54. package/dist/npm/config/tables/TableMap.js +0 -338
  55. package/dist/npm/config/tables/table-utils.js +0 -307
@@ -5,12 +5,12 @@
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, merge, BehaviorSubject, zip, interval } from 'rxjs';
9
- import { take, filter, auditTime, map, concatMap, takeUntil } from 'rxjs/operators';
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, SelectionRange, TextSelection, Fragment, Slice, Selection, NodeSelection, 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, hasMark, activeNode, canIndentAsListItem, canBeIndented, indentRules, hasNode, canOutdentAsListItem, outdentRules, getActiveMarks, expandSelection, addColumnBefore, addColumnAfter, addRowBefore, addRowAfter, deleteRow, deleteColumn, mergeCells, splitCell, deleteTable, getNodeFromSelection, getMark, getSelectionText, parseContent, Plugin, PluginKey, history, keymap, buildListKeymap, buildKeymap, baseKeymap, gapCursor, imageResizing, placeholder, EditorState, EditorView, hasSameMarkup, pasteCleanup, removeComments, sanitize, removeAttribute, sanitizeStyleAttr, sanitizeClassAttr } from '@progress/kendo-editor-common';
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, addColumnBefore, addColumnAfter, addRowBefore, addRowAfter, deleteRow, deleteColumn, mergeCells, splitCell, deleteTable, hasMark, activeNode, canIndentAsListItem, canBeIndented, indentRules, hasNode, canOutdentAsListItem, outdentRules, 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';
@@ -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: 1637941374,
30
+ publishDate: 1641984793,
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
  };
@@ -70,1598 +70,84 @@ var getAttributes = function (dom) {
70
70
  /**
71
71
  * @hidden
72
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
- /**
81
- * @hidden
82
- */
83
- var commonAttributes = function () {
84
- return __assign({}, createDefaultAttributes(['class', 'id', 'style']));
85
- };
86
- /**
87
- * @hidden
88
- */
89
- var createDefaultAttributes = function (attrs) {
90
- if (attrs === void 0) { attrs = []; }
91
- return __assign({}, attrs.reduce(function (acc, curr) {
92
- var _a;
93
- return (__assign({}, acc, (_a = {}, _a[curr] = { default: null }, _a)));
94
- }, {}));
95
- };
96
- /**
97
- * @hidden
98
- */
99
- 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
-
133
- var createSemanticNode = function (tagName) { return ({
134
- // Uncaught SyntaxError: Mixing inline and block content (in content expression '(block | inline)*')
135
- // content: '(block | inline)*',
136
- content: 'block*',
137
- group: 'block',
138
- attrs: __assign({}, commonAttributes()),
139
- parseDOM: [{
140
- tag: tagName,
141
- getAttrs: getAttributes
142
- }],
143
- toDOM: function (node) { return hasAttrs(node.attrs) ? [tagName, getAttrs(node.attrs), hole] : [tagName, hole]; }
144
- }); };
145
- /**
146
- * @hidden
147
- */
148
- var semanticTagNames = ['article', 'main', 'nav', 'header', 'footer', 'aside', 'section'];
149
- var ɵ1 = function (acc, curr) {
150
- 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;
73
+ var commonAttributes = function () {
74
+ return __assign({}, createDefaultAttributes(['class', 'id', 'style']));
1456
75
  };
1457
76
  /**
1458
77
  * @hidden
1459
78
  */
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;
79
+ var createDefaultAttributes = function (attrs) {
80
+ if (attrs === void 0) { attrs = []; }
81
+ return __assign({}, attrs.reduce(function (acc, curr) {
82
+ var _a;
83
+ return (__assign({}, acc, (_a = {}, _a[curr] = { default: null }, _a)));
84
+ }, {}));
1470
85
  };
1471
86
  /**
1472
87
  * @hidden
1473
88
  */
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
- };
89
+ var hole = 0;
90
+
91
+ var createSemanticNode = function (tagName) { return ({
92
+ // Uncaught SyntaxError: Mixing inline and block content (in content expression '(block | inline)*')
93
+ // content: '(block | inline)*',
94
+ content: 'block*',
95
+ group: 'block',
96
+ attrs: __assign({}, commonAttributes()),
97
+ parseDOM: [{
98
+ tag: tagName,
99
+ getAttrs: getAttributes
100
+ }],
101
+ toDOM: function (node) { return hasAttrs(node.attrs) ? [tagName, getAttrs(node.attrs), hole] : [tagName, hole]; }
102
+ }); };
1485
103
  /**
1486
104
  * @hidden
1487
105
  */
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
- }
106
+ var semanticTagNames = ['article', 'main', 'nav', 'header', 'footer', 'aside', 'section'];
107
+ var ɵ1 = function (acc, curr) {
108
+ var _a;
109
+ return Object.assign(acc, (_a = {}, _a[curr] = createSemanticNode(curr), _a));
1534
110
  };
1535
111
  /**
1536
112
  * @hidden
1537
113
  */
1538
- // Remove the selected rows from a table.
1539
- var deleteRow$1 = function (state, dispatch) {
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
- // Merge the selected cells into a single cell. Only available when
1572
- // the selected cells' outline forms a rectangle.
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
- // Split a selected cell, whose rowpan or colspan is greater than one,
1624
- // into smaller cells. Use the first cell type for the new cells.
1625
- var splitCell$1 = function (state, dispatch) {
1626
- var nodeTypes = tableNodeTypes(state.schema);
1627
- return splitCellWithType(function (_a) {
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: __assign({}, nodes$1, { blockquote: __assign({}, nodes$1.blockquote, { content: 'inline*' }) })
127
+ });
128
+
1647
129
  /**
1648
130
  * @hidden
1649
131
  */
1650
- // Deletes the table around the selection, if any.
1651
- var deleteTable$1 = deleteTableElement(isTable);
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$5 = function (applyToWord) { return expandToWordWrap(toggleInlineFormat, __assign({}, bold, { applyToWord: applyToWord })); }, ɵ2$4 = function (options) { return cleanFormatting(options); }, ɵ3$4 = function (attrs) { return expandToWordWrap(applyLink, { mark: 'link', attrs: attrs.value, applyToWord: attrs.applyToWord }); }, ɵ4$2 = function (attrs) { return expandToWordWrap(applyInlineStyle, { style: 'font-family', value: attrs.value, applyToWord: attrs.applyToWord }); }, ɵ5$2 = function (attrs) { return expandToWordWrap(applyInlineStyle, { style: 'font-size', value: attrs.value + 'px', applyToWord: attrs.applyToWord }); }, ɵ6$1 = function (attrs) { return expandToWordWrap(applyLink, { mark: 'link', attrs: attrs, applyToWord: attrs.applyToWord }); }, ɵ7$1 = function (text) { return insertText(text); }, ɵ8$1 = function (applyToWord) { return expandToWordWrap(toggleInlineFormat, __assign({}, italic, { applyToWord: applyToWord })); }, ɵ9$1 = 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); }; };
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$5,
1657
- cleanFormatting: ɵ2$4,
1658
- createLink: ɵ3$4,
1659
- fontFamily: ɵ4$2,
1660
- fontSize: ɵ5$2,
1661
- insertFile: ɵ6$1,
1662
- insertText: ɵ7$1,
1663
- italic: ɵ8$1,
1664
- strikethrough: ɵ9$1,
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,
@@ -1692,7 +178,7 @@ var blockCommand = {
1692
178
  setHTML: ɵ29,
1693
179
  undo: ɵ30
1694
180
  };
1695
- var ɵ31 = function (attr) { return insertTable(attr); }, ɵ32 = function () { return addColumnBefore$1; }, ɵ33 = function () { return addColumnAfter$1; }, ɵ34 = function () { return addRowBefore$1; }, ɵ35 = function () { return addRowAfter$1; }, ɵ36 = function () { return deleteRow$1; }, ɵ37 = function () { return deleteColumn$1; }, ɵ38 = function () { return mergeCells$1; }, ɵ39 = function () { return splitCell$1; }, ɵ40 = function () { return deleteTable$1; };
181
+ var ɵ31 = function (attr) { return insertTable(attr); }, ɵ32 = function () { return addColumnBefore; }, ɵ33 = function () { return addColumnAfter; }, ɵ34 = function () { return addRowBefore; }, ɵ35 = function () { return addRowAfter; }, ɵ36 = function () { return deleteRow; }, ɵ37 = function () { return deleteColumn; }, ɵ38 = function () { return mergeCells; }, ɵ39 = function () { return splitCell; }, ɵ40 = function () { return deleteTable; };
1696
182
  var tableCommand = {
1697
183
  insertTable: ɵ31,
1698
184
  addColumnBefore: ɵ32,
@@ -1975,6 +461,117 @@ var disabledToolBarState = {
1975
461
  selectAll: { selected: false, disabled: true }
1976
462
  };
1977
463
 
464
+ /**
465
+ * @hidden
466
+ */
467
+ function outerWidth(element) {
468
+ var width = element.offsetWidth;
469
+ var style = getComputedStyle(element);
470
+ width += parseFloat(style.marginLeft) || 0 + parseFloat(style.marginRight) || 0;
471
+ return width;
472
+ }
473
+ /**
474
+ * @hidden
475
+ */
476
+ var removeEntries = function (obj, predicate) {
477
+ return Object.keys(obj)
478
+ .filter(function (key) { return predicate(key); })
479
+ .reduce(function (acc, curr) {
480
+ var _a;
481
+ return Object.assign(acc, (_a = {}, _a[curr] = obj[curr], _a));
482
+ }, {});
483
+ };
484
+ /**
485
+ * @hidden
486
+ */
487
+ var removeEmptyEntries = function (obj) {
488
+ var predicate = function (key) { return obj[key] !== null && obj[key] !== undefined && obj[key] !== ''; };
489
+ return removeEntries(obj, predicate);
490
+ };
491
+ /**
492
+ * @hidden
493
+ */
494
+ var isNullOrUndefined = function (value) { return value === undefined || value === null; };
495
+ /**
496
+ * @hidden
497
+ */
498
+ var isPresent = function (value) { return !isNullOrUndefined(value); };
499
+ /**
500
+ * @hidden
501
+ */
502
+ var detectIE = function () {
503
+ if (!isDocumentAvailable()) {
504
+ return false;
505
+ }
506
+ var ua = window.navigator.userAgent;
507
+ var msie = ua.indexOf('MSIE ');
508
+ var trident = ua.indexOf('Trident/');
509
+ return msie > 0 || trident > 0;
510
+ };
511
+ /**
512
+ * @hidden
513
+ */
514
+ var safeString = function (value) { return (isNullOrUndefined(value) ? '' : value.toString()); };
515
+ /**
516
+ * @hidden
517
+ */
518
+ var first = function (arr) { return arr[0]; };
519
+ /**
520
+ * @hidden
521
+ */
522
+ var last = function (arr) { return arr[arr.length - 1]; };
523
+ /**
524
+ * @hidden
525
+ */
526
+ var split = function (splitter) { return function (value) { return value.split(splitter); }; };
527
+ /**
528
+ * @hidden
529
+ */
530
+ var trim = function (value) { return value.trim(); };
531
+ /**
532
+ * @hidden
533
+ */
534
+ var filter$1 = function (predicate) { return function (arr) { return arr.filter(predicate); }; };
535
+ /**
536
+ * @hidden
537
+ */
538
+ var getUniqueStyleValues = function (style, cssStyle) {
539
+ if (style.hasNodesWithoutMarks) {
540
+ return '';
541
+ }
542
+ var uniqueMarkValues = style.marks
543
+ .filter(function (m) { return m.type.name === 'style'; })
544
+ .map(function (m) { return m.attrs.style; })
545
+ .map(safeString)
546
+ .map(split(';'))
547
+ .map(filter$1(function (m) { return m.includes(cssStyle); }))
548
+ // guards against empty array
549
+ .map(function (cssStyleValues) { return (cssStyleValues.length !== 0 ? cssStyleValues : [cssStyle + ": INVALID"]); })
550
+ .map(first)
551
+ .map(split(':'))
552
+ .map(last)
553
+ .map(trim)
554
+ .reduce(function (acc, curr) { return (acc.indexOf(curr) > -1 ? acc : acc.concat([curr])); }, []);
555
+ if (uniqueMarkValues.indexOf('INVALID') > -1 || uniqueMarkValues.length !== 1) {
556
+ return '';
557
+ }
558
+ return uniqueMarkValues[0];
559
+ };
560
+ /**
561
+ * @hidden
562
+ */
563
+ var conditionallyExecute = function (fn) { return function (condition) { return function (param) { return (condition ? fn(param) : param); }; }; };
564
+ /**
565
+ * @hidden
566
+ */
567
+ var pipe = function () {
568
+ var fns = [];
569
+ for (var _i = 0; _i < arguments.length; _i++) {
570
+ fns[_i] = arguments[_i];
571
+ }
572
+ return function (x) { return fns.reduce(function (y, f) { return f(y); }, x); };
573
+ };
574
+
1978
575
  /**
1979
576
  * @hidden
1980
577
  */
@@ -2273,7 +870,7 @@ var tablesStyles = "\n .ProseMirror .tableWrapper {\n overflow-x: auto;\n
2273
870
  */
2274
871
  var rtlStyles = 'body { direction: rtl }';
2275
872
 
2276
- var ɵ0$6 = function (arg) { return "plugins must be a function, but received " + JSON.stringify(arg) + "."; };
873
+ 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
874
  /* tslint:disable:variable-name */
2278
875
  /**
2279
876
  * @hidden
@@ -2281,7 +878,8 @@ var ɵ0$6 = function (arg) { return "plugins must be a function, but received "
2281
878
  var EditorErrorMessages = {
2282
879
  schemaType: 'Expected value of type Schema. See http://www.telerik.com/kendo-angular-ui/components/editor/schema/',
2283
880
  setSchemaOnce: 'The Schema cannot be changed dynamically. See http://www.telerik.com/kendo-angular-ui/components/editor/schema/',
2284
- pluginsCallbackType: ɵ0$6,
881
+ pluginsCallbackType: ɵ0$2,
882
+ pastedContentCallbackType: ɵ1$2,
2285
883
  setPluginsOnce: 'The plugins cannot be changed dynamically. See http://www.telerik.com/kendo-angular-ui/components/editor/plugins/',
2286
884
  setPlaceHolderOnce: 'The placeholder cannot be changed dynamically. See http://www.telerik.com/kendo-angular-ui/components/editor/placeholder/',
2287
885
  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/'
@@ -2300,15 +898,34 @@ var EditorToolsService = /** @class */ (function () {
2300
898
  return EditorToolsService;
2301
899
  }());
2302
900
 
901
+ /**
902
+ * The Editor [`paste`]({% slug api_editor_editorcomponent %}#toc-paste) event.
903
+ */
904
+ var EditorPasteEvent = /** @class */ (function (_super) {
905
+ __extends(EditorPasteEvent, _super);
906
+ /**
907
+ * Constructs the event arguments for the `paste` event.
908
+ * @hidden
909
+ */
910
+ function EditorPasteEvent(cleanedHtml, originalHtml, originalEvent) {
911
+ var _this = _super.call(this) || this;
912
+ _this.cleanedHtml = cleanedHtml;
913
+ _this.originalHtml = originalHtml;
914
+ _this.originalEvent = originalEvent;
915
+ return _this;
916
+ }
917
+ return EditorPasteEvent;
918
+ }(PreventableEvent));
919
+
2303
920
  var EMPTY_PARAGRAPH = '<p></p>';
2304
921
  var defaultPasteCleanupSettings = {
2305
922
  convertMsLists: false,
2306
923
  removeAttributes: [],
2307
924
  removeHtmlComments: false,
2308
- removeInvalidHTML: false,
925
+ removeInvalidHTML: true,
2309
926
  removeMsClasses: false,
2310
927
  removeMsStyles: false,
2311
- stripTags: ['']
928
+ stripTags: []
2312
929
  };
2313
930
  var removeCommentsIf = conditionallyExecute(removeComments);
2314
931
  var removeInvalidHTMLIf = conditionallyExecute(sanitize);
@@ -2348,14 +965,6 @@ var EditorComponent = /** @class */ (function () {
2348
965
  * @default false
2349
966
  */
2350
967
  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
968
  /**
2360
969
  * By default, whitespace is collapsed as per HTML's rules.
2361
970
  * Set to `true` to preserve whitespace, but normalize newlines to spaces.
@@ -2381,6 +990,11 @@ var EditorComponent = /** @class */ (function () {
2381
990
  * Fires when the content area of the Editor is focused ([see example]({% slug overview_editor %}#toc-events)).
2382
991
  */
2383
992
  this.onFocus = new EventEmitter();
993
+ /**
994
+ * Fires when the user performs paste in the content area of the Editor ([see example]({% slug overview_editor %}#toc-events)).
995
+ * The event is preventable. If you cancel it, the Editor content will not change.
996
+ */
997
+ this.paste = new EventEmitter();
2384
998
  /**
2385
999
  * Fires when the content area of the Editor is blurred ([see example]({% slug overview_editor %}#toc-events)).
2386
1000
  */
@@ -2396,10 +1010,76 @@ var EditorComponent = /** @class */ (function () {
2396
1010
  this.valueModified = new Subject();
2397
1011
  this._readonly = false;
2398
1012
  this._placeholder = '';
1013
+ this.inForm = false;
2399
1014
  this.afterViewInit = new Subject();
2400
1015
  this.contentAreaLoaded = new Subject();
2401
- this.onChangeCallback = function (_) { }; // tslint:disable-line:no-empty
1016
+ this.dispatchTransaction = function (tr) {
1017
+ var docChanged = tr.docChanged;
1018
+ if (_this.disabled || (_this.readonly && docChanged)) {
1019
+ return;
1020
+ }
1021
+ if (docChanged) {
1022
+ var doc = tr.doc;
1023
+ var html_1 = getHtml({ doc: doc });
1024
+ _this.trOnChange = tr;
1025
+ _this.htmlOnChange = html_1;
1026
+ _this.ngZone.run(function () {
1027
+ _this.valueModified.next(html_1);
1028
+ });
1029
+ }
1030
+ if (!docChanged || _this.inForm) {
1031
+ _this.view.updateState(_this.view.state.apply(tr));
1032
+ }
1033
+ };
1034
+ this.transformPastedHTML = function (dirtyHtml) {
1035
+ var pasteCleanupSettings = __assign({}, defaultPasteCleanupSettings, _this.pasteCleanupSettings);
1036
+ var html = pipe(removeInvalidHTMLIf(pasteCleanupSettings.removeInvalidHTML), removeCommentsIf(pasteCleanupSettings.removeHtmlComments))(dirtyHtml);
1037
+ var clean = pasteCleanup(html, {
1038
+ convertMsLists: pasteCleanupSettings.convertMsLists,
1039
+ stripTags: pasteCleanupSettings.stripTags.join('|'),
1040
+ attributes: getPasteCleanupAttributes(pasteCleanupSettings)
1041
+ });
1042
+ if (hasObservers(_this.paste)) {
1043
+ var event_1 = new EditorPasteEvent(clean, dirtyHtml, _this._pasteEvent);
1044
+ _this.ngZone.run(function () { return _this.paste.emit(event_1); });
1045
+ return event_1.isDefaultPrevented() ? '' : event_1.cleanedHtml;
1046
+ }
1047
+ return clean;
1048
+ };
1049
+ this.changeValue = function (value) {
1050
+ var prev = _this._value;
1051
+ _this._value = value;
1052
+ if (!_this._view) {
1053
+ return;
1054
+ }
1055
+ if (_this.htmlOnChange === value && _this.trOnChange) {
1056
+ _this.view.updateState(_this.view.state.apply(_this.trOnChange));
1057
+ }
1058
+ else {
1059
+ if ((prev || '') !== (value || '')) {
1060
+ var iframeContentWindowNotPresent = _this.iframe && !_this.container.element.nativeElement.contentWindow;
1061
+ if (iframeContentWindowNotPresent) {
1062
+ return;
1063
+ }
1064
+ var state = _this.view.state;
1065
+ var nextDoc = parseContent(value || '', state.schema, { preserveWhitespace: _this.preserveWhitespace });
1066
+ var tr = state.tr
1067
+ .setSelection(new AllSelection(state.doc))
1068
+ .replaceSelectionWith(nextDoc);
1069
+ _this.view.updateState(state.apply(tr));
1070
+ }
1071
+ }
1072
+ _this.trOnChange = null;
1073
+ _this.htmlOnChange = null;
1074
+ };
1075
+ this.onChangeCallback = function (value) {
1076
+ _this.changeValue(value);
1077
+ };
2402
1078
  this.onTouchedCallback = function (_) { }; // tslint:disable-line:no-empty
1079
+ this.onPaste = function (_view, nativeEvent) {
1080
+ _this._pasteEvent = nativeEvent;
1081
+ return false;
1082
+ };
2403
1083
  validatePackage(packageMetadata);
2404
1084
  this.direction = localization.rtl ? 'rtl' : 'ltr';
2405
1085
  // https://stackoverflow.com/questions/56572483/chrome-is-synchronously-handling-iframe-loading-whereas-firefox-handles-it-asyn
@@ -2408,6 +1088,9 @@ var EditorComponent = /** @class */ (function () {
2408
1088
  EditorComponent_1 = EditorComponent;
2409
1089
  Object.defineProperty(EditorComponent.prototype, "value", {
2410
1090
  get: function () {
1091
+ if (this.trOnChange) {
1092
+ return this.htmlOnChange;
1093
+ }
2411
1094
  var value = this._view ? this.getSource() : this._value;
2412
1095
  if (value === EMPTY_PARAGRAPH) {
2413
1096
  return this._value ? '' : this._value;
@@ -2420,23 +1103,7 @@ var EditorComponent = /** @class */ (function () {
2420
1103
  * Sets the value of the Editor ([see example]({% slug overview_editor %}#toc-basic-usage)).
2421
1104
  */
2422
1105
  set: function (value) {
2423
- if (this._previousValue === value) {
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
- }
1106
+ this.changeValue(value);
2440
1107
  },
2441
1108
  enumerable: true,
2442
1109
  configurable: true
@@ -2697,6 +1364,9 @@ var EditorComponent = /** @class */ (function () {
2697
1364
  };
2698
1365
  EditorComponent.prototype.ngOnChanges = function (changes) {
2699
1366
  var _this = this;
1367
+ if (changes.value && this.view) {
1368
+ this.changeValue(changes.value.currentValue);
1369
+ }
2700
1370
  if (changes.iframe && !changes.iframe.isFirstChange()) {
2701
1371
  this.ngZone.onStable.pipe(take(1)).subscribe(function () { return _this.initialize(); });
2702
1372
  }
@@ -2782,8 +1452,6 @@ var EditorComponent = /** @class */ (function () {
2782
1452
  var command = editorCommands[commandName](attr);
2783
1453
  // Executes a ProseMirror command.
2784
1454
  command(this._view.state, this._view.dispatch, this._view);
2785
- // See the `dispatchTransaction` comments.
2786
- // this.stateChange.emit(updateToolBar(this.view));
2787
1455
  };
2788
1456
  /**
2789
1457
  * Opens a dialog.
@@ -2868,6 +1536,7 @@ var EditorComponent = /** @class */ (function () {
2868
1536
  * @hidden
2869
1537
  */
2870
1538
  EditorComponent.prototype.writeValue = function (value) {
1539
+ this.inForm = true;
2871
1540
  // To avoid confusion, non-existent values are always undefined.
2872
1541
  this.value = value === null ? undefined : value;
2873
1542
  };
@@ -2896,7 +1565,6 @@ var EditorComponent = /** @class */ (function () {
2896
1565
  return;
2897
1566
  }
2898
1567
  var currentSchema = this.schema || schema;
2899
- var that = this;
2900
1568
  var containerNativeElement = this.container.element.nativeElement;
2901
1569
  var contentNode = parseContent((this.value || '').trim(), currentSchema, { preserveWhitespace: this.preserveWhitespace });
2902
1570
  if (this.iframe) {
@@ -2938,16 +1606,13 @@ var EditorComponent = /** @class */ (function () {
2938
1606
  }
2939
1607
  }); }
2940
1608
  }),
2941
- new Plugin({
2942
- key: new PluginKey('editor-filter-disabled-state'),
2943
- filterTransaction: function () { return !_this.disabled; }
2944
- }),
2945
1609
  history(),
2946
1610
  keymap(buildListKeymap(currentSchema)),
2947
1611
  keymap(buildKeymap(currentSchema, { applyToWord: this.applyToWord })),
2948
1612
  keymap(baseKeymap),
2949
1613
  gapCursor(),
2950
- imageResizing()
1614
+ imageResizing(),
1615
+ tableEditing()
2951
1616
  ];
2952
1617
  if (this.placeholder) {
2953
1618
  defaultPlugins.push(placeholder(this.placeholder));
@@ -2967,31 +1632,10 @@ var EditorComponent = /** @class */ (function () {
2967
1632
  _this._view = new EditorView({ mount: _this.viewMountElement }, {
2968
1633
  state: state,
2969
1634
  editable: function () { return !_this.readonly; },
2970
- dispatchTransaction: function (tr) {
2971
- // `this` is bound to the view instance.
2972
- this.updateState(this.state.apply(tr));
2973
- // that.cdr.detectChanges();
2974
- // When the user utilizes keyboard shortcuts&mdash;for example, `Ctrl`+`b`&mdash;
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
- });
1635
+ dispatchTransaction: _this.dispatchTransaction,
1636
+ transformPastedHTML: _this.transformPastedHTML,
1637
+ handleDOMEvents: {
1638
+ paste: _this.onPaste
2995
1639
  }
2996
1640
  });
2997
1641
  });
@@ -3032,7 +1676,7 @@ var EditorComponent = /** @class */ (function () {
3032
1676
  _this.cdr.detectChanges();
3033
1677
  }
3034
1678
  }));
3035
- this.subs.add(merge(this.valueModified.pipe(filter(function () { return _this.updateInterval > 0; }), auditTime(this.updateInterval)), this.valueModified.pipe(filter(function () { return _this.updateInterval === 0; }))).subscribe(function (value) {
1679
+ this.subs.add(this.valueModified.subscribe(function (value) {
3036
1680
  _this.onChangeCallback(value);
3037
1681
  _this.valueChange.emit(value);
3038
1682
  _this.cdr.markForCheck();
@@ -3126,10 +1770,6 @@ var EditorComponent = /** @class */ (function () {
3126
1770
  __metadata("design:type", String),
3127
1771
  __metadata("design:paramtypes", [String])
3128
1772
  ], EditorComponent.prototype, "placeholder", null);
3129
- __decorate([
3130
- Input(),
3131
- __metadata("design:type", Number)
3132
- ], EditorComponent.prototype, "updateInterval", void 0);
3133
1773
  __decorate([
3134
1774
  Input(),
3135
1775
  __metadata("design:type", Object)
@@ -3150,6 +1790,10 @@ var EditorComponent = /** @class */ (function () {
3150
1790
  Output('focus'),
3151
1791
  __metadata("design:type", EventEmitter)
3152
1792
  ], EditorComponent.prototype, "onFocus", void 0);
1793
+ __decorate([
1794
+ Output(),
1795
+ __metadata("design:type", EventEmitter)
1796
+ ], EditorComponent.prototype, "paste", void 0);
3153
1797
  __decorate([
3154
1798
  Output('blur'),
3155
1799
  __metadata("design:type", EventEmitter)
@@ -3257,7 +1901,7 @@ var EditorComponent = /** @class */ (function () {
3257
1901
  }
3258
1902
  ],
3259
1903
  /* 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 ",
1904
+ 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 srcdoc=\"<!DOCTYPE html>\" frameborder=\"0\" class=\"k-iframe\" (load)=\"iframeOnLoad()\"></iframe>\n </div>\n\n <ng-container #dialogsContainer></ng-container>\n ",
3261
1905
  styles: [
3262
1906
  "\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
1907
  ]
@@ -6555,4 +5199,4 @@ var EditorModule = /** @class */ (function () {
6555
5199
  * Generated bundle index. Do not edit.
6556
5200
  */
6557
5201
 
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 };
5202
+ 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, EditorPasteEvent };