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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/LICENSE.md +1 -1
  2. package/NOTICE.txt +119 -79
  3. package/README.md +1 -1
  4. package/dist/cdn/js/kendo-angular-editor.js +2 -2
  5. package/dist/cdn/main.js +1 -1
  6. package/dist/es/common/error-messages.js +4 -3
  7. package/dist/es/config/command-icons.js +1 -0
  8. package/dist/es/config/commands.js +18 -17
  9. package/dist/es/config/schema.js +2 -4
  10. package/dist/es/config/table-commands.js +1 -363
  11. package/dist/es/dialogs/colorpicker-dialog.component.js +1 -1
  12. package/dist/es/dialogs/file-link-dialog.component.js +1 -1
  13. package/dist/es/dialogs/image-dialog.component.js +1 -1
  14. package/dist/es/editor-toolbar-state.js +12 -2
  15. package/dist/es/editor.component.js +103 -75
  16. package/dist/es/editor.module.js +6 -3
  17. package/dist/es/index.js +2 -0
  18. package/dist/es/localization/messages.js +4 -0
  19. package/dist/es/main.js +1 -0
  20. package/dist/es/package-metadata.js +1 -1
  21. package/dist/{es2015/config/table-nodes.d.ts → es/preventable-events/paste-event-data.js} +0 -5
  22. package/dist/es/preventable-events/paste-event.js +25 -0
  23. package/dist/es/tools/blockquote/editor-blockquote-button.directive.js +48 -0
  24. package/dist/es/tools/colorpicker/editor-colorpicker.component.js +24 -7
  25. package/dist/es/tools/format/editor-format-dropdownlist.component.js +1 -1
  26. package/dist/es/tools/format/editor-format.component.js +0 -1
  27. package/dist/es/tools/tables/popup-table-grid.component.js +1 -1
  28. package/dist/es2015/common/commands.d.ts +1 -1
  29. package/dist/es2015/common/error-messages.js +4 -3
  30. package/dist/es2015/common/format-item.interface.d.ts +1 -1
  31. package/dist/es2015/common/paste-cleanup-settings.d.ts +14 -0
  32. package/dist/es2015/config/command-icons.js +1 -0
  33. package/dist/es2015/config/commands.js +18 -17
  34. package/dist/es2015/config/schema.d.ts +1 -1
  35. package/dist/es2015/config/schema.js +2 -3
  36. package/dist/es2015/config/table-commands.d.ts +0 -36
  37. package/dist/es2015/config/table-commands.js +1 -357
  38. package/dist/es2015/dialogs/colorpicker-dialog.component.js +1 -1
  39. package/dist/es2015/dialogs/file-link-dialog.component.js +4 -4
  40. package/dist/es2015/dialogs/image-dialog.component.js +4 -4
  41. package/dist/es2015/editor-toolbar-state.js +12 -2
  42. package/dist/es2015/editor.component.d.ts +16 -11
  43. package/dist/es2015/editor.component.js +105 -75
  44. package/dist/es2015/editor.module.js +6 -3
  45. package/dist/es2015/index.d.ts +2 -0
  46. package/dist/es2015/index.js +2 -0
  47. package/dist/es2015/index.metadata.json +1 -1
  48. package/dist/es2015/localization/messages.d.ts +4 -0
  49. package/dist/es2015/localization/messages.js +4 -0
  50. package/dist/es2015/main.d.ts +2 -0
  51. package/dist/es2015/main.js +1 -0
  52. package/dist/es2015/package-metadata.js +1 -1
  53. package/dist/es2015/preventable-events/paste-event-data.d.ts +21 -0
  54. package/dist/es2015/preventable-events/paste-event-data.js +4 -0
  55. package/dist/es2015/preventable-events/paste-event.d.ts +27 -0
  56. package/dist/es2015/preventable-events/paste-event.js +20 -0
  57. package/dist/es2015/tools/blockquote/editor-blockquote-button.directive.d.ts +30 -0
  58. package/dist/es2015/tools/blockquote/editor-blockquote-button.directive.js +45 -0
  59. package/dist/es2015/tools/colorpicker/editor-colorpicker.component.d.ts +8 -2
  60. package/dist/es2015/tools/colorpicker/editor-colorpicker.component.js +20 -7
  61. package/dist/es2015/tools/format/editor-format-dropdownlist.component.js +0 -4
  62. package/dist/es2015/tools/format/editor-format.component.js +0 -1
  63. package/dist/es2015/tools/tables/popup-table-grid.component.js +2 -2
  64. package/dist/fesm2015/index.js +354 -1624
  65. package/dist/fesm5/index.js +365 -1649
  66. package/dist/npm/common/error-messages.js +4 -2
  67. package/dist/npm/config/command-icons.js +1 -0
  68. package/dist/npm/config/commands.js +16 -14
  69. package/dist/npm/config/schema.js +2 -4
  70. package/dist/npm/config/table-commands.js +1 -368
  71. package/dist/npm/dialogs/colorpicker-dialog.component.js +1 -1
  72. package/dist/npm/dialogs/file-link-dialog.component.js +1 -1
  73. package/dist/npm/dialogs/image-dialog.component.js +1 -1
  74. package/dist/npm/editor-toolbar-state.js +11 -1
  75. package/dist/npm/editor.component.js +99 -71
  76. package/dist/npm/editor.module.js +7 -4
  77. package/dist/npm/index.js +5 -0
  78. package/dist/npm/localization/messages.js +4 -0
  79. package/dist/npm/main.js +2 -0
  80. package/dist/npm/package-metadata.js +1 -1
  81. package/dist/npm/preventable-events/paste-event-data.js +6 -0
  82. package/dist/npm/preventable-events/paste-event.js +27 -0
  83. package/dist/npm/tools/blockquote/editor-blockquote-button.directive.js +50 -0
  84. package/dist/npm/tools/colorpicker/editor-colorpicker.component.js +24 -7
  85. package/dist/npm/tools/format/editor-format-dropdownlist.component.js +1 -1
  86. package/dist/npm/tools/format/editor-format.component.js +0 -1
  87. package/dist/npm/tools/tables/popup-table-grid.component.js +1 -1
  88. package/dist/systemjs/kendo-angular-editor.js +1 -1
  89. package/package.json +18 -18
  90. package/dist/es/config/table-nodes.js +0 -146
  91. package/dist/es/config/tables/CellSelection.js +0 -268
  92. package/dist/es/config/tables/TableMap.js +0 -333
  93. package/dist/es/config/tables/table-utils.js +0 -302
  94. package/dist/es2015/config/table-nodes.js +0 -145
  95. package/dist/es2015/config/tables/CellSelection.d.ts +0 -35
  96. package/dist/es2015/config/tables/CellSelection.js +0 -256
  97. package/dist/es2015/config/tables/TableMap.d.ts +0 -35
  98. package/dist/es2015/config/tables/TableMap.js +0 -329
  99. package/dist/es2015/config/tables/table-utils.d.ts +0 -77
  100. package/dist/es2015/config/tables/table-utils.js +0 -299
  101. package/dist/npm/config/table-nodes.js +0 -157
  102. package/dist/npm/config/tables/CellSelection.js +0 -270
  103. package/dist/npm/config/tables/TableMap.js +0 -338
  104. package/dist/npm/config/tables/table-utils.js +0 -307
@@ -4,8 +4,9 @@
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  "use strict";
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- var ɵ0 = function (arg) { return "plugins must be a function, but received " + JSON.stringify(arg) + "."; };
7
+ var ɵ0 = function (arg) { return "plugins must be a function, but received " + JSON.stringify(arg) + "."; }, ɵ1 = function (arg) { return "pastedContent must be a function, but received " + JSON.stringify(arg) + "."; };
8
8
  exports.ɵ0 = ɵ0;
9
+ exports.ɵ1 = ɵ1;
9
10
  /* tslint:disable:variable-name */
10
11
  /**
11
12
  * @hidden
@@ -14,7 +15,8 @@ exports.EditorErrorMessages = {
14
15
  schemaType: 'Expected value of type Schema. See http://www.telerik.com/kendo-angular-ui/components/editor/schema/',
15
16
  setSchemaOnce: 'The Schema cannot be changed dynamically. See http://www.telerik.com/kendo-angular-ui/components/editor/schema/',
16
17
  pluginsCallbackType: ɵ0,
18
+ pastedContentCallbackType: ɵ1,
17
19
  setPluginsOnce: 'The plugins cannot be changed dynamically. See http://www.telerik.com/kendo-angular-ui/components/editor/plugins/',
18
- setPlaceHolderOnce: 'The placeholder cannot be changed dynamically. See http://www.telerik.com/kendo-angular-ui/components/editor/placeholder/',
20
+ setPlaceHolderOnce: 'The placeholder cannot be changed dynamically. See https://www.telerik.com/kendo-angular-ui/components/editor/plugins/#toc-custom-plugins/',
19
21
  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/'
20
22
  };
@@ -13,6 +13,7 @@ exports.commandIcons = {
13
13
  alignLeft: 'align-left',
14
14
  alignRight: 'align-right',
15
15
  backColor: 'background',
16
+ blockquote: 'blockquote',
16
17
  bold: 'bold',
17
18
  cleanFormatting: 'clear-css',
18
19
  createLink: 'link-horizontal',
@@ -48,7 +48,7 @@ var inlineCommand = {
48
48
  var ɵ17 = function () { return function (state, dispatch) { return kendo_editor_common_1.isAligned(state, kendo_editor_common_1.alignCenterRules) ? alignRemove(state, dispatch) : kendo_editor_common_1.alignBlocks(kendo_editor_common_1.alignCenterRules)(state, dispatch); }; }, ɵ18 = function () { return function (state, dispatch) { return kendo_editor_common_1.isAligned(state, kendo_editor_common_1.alignJustifyRules) ? alignRemove(state, dispatch) : kendo_editor_common_1.alignBlocks(kendo_editor_common_1.alignJustifyRules)(state, dispatch); }; }, ɵ19 = function () { return function (state, dispatch) { return kendo_editor_common_1.isAligned(state, kendo_editor_common_1.alignLeftRules) ? alignRemove(state, dispatch) : kendo_editor_common_1.alignBlocks(kendo_editor_common_1.alignLeftRules)(state, dispatch); }; }, ɵ20 = function () { return function (state, dispatch) { return kendo_editor_common_1.isAligned(state, kendo_editor_common_1.alignRightRules) ? alignRemove(state, dispatch) : kendo_editor_common_1.alignBlocks(kendo_editor_common_1.alignRightRules)(state, dispatch); }; }, ɵ21 = function (formatAttr) { return kendo_editor_common_1.formatBlockElements(formatAttr.tag); }, ɵ22 = function () { return kendo_editor_common_1.getHtml; }, ɵ23 = function () { return kendo_editor_common_1.indent; }, ɵ24 = function (attrs) { return kendo_editor_common_1.insertImage(attrs); }, ɵ25 = function () { return kendo_editor_common_1.toggleOrderedList; }, ɵ26 = function () { return kendo_editor_common_1.toggleUnorderedList; }, ɵ27 = function () { return kendo_editor_common_1.outdent; }, ɵ28 = function () { return kendo_editor_common_1.redo; }, ɵ29 = function (_a) {
49
49
  var content = _a.content, parseOptions = _a.parseOptions;
50
50
  return kendo_editor_common_1.setHtml(content, 'setHTML', parseOptions);
51
- }, ɵ30 = function () { return kendo_editor_common_1.undo; };
51
+ }, ɵ30 = function () { return kendo_editor_common_1.undo; }, ɵ31 = function () { return kendo_editor_common_1.blockquote; };
52
52
  exports.ɵ17 = ɵ17;
53
53
  exports.ɵ18 = ɵ18;
54
54
  exports.ɵ19 = ɵ19;
@@ -63,6 +63,7 @@ exports.ɵ27 = ɵ27;
63
63
  exports.ɵ28 = ɵ28;
64
64
  exports.ɵ29 = ɵ29;
65
65
  exports.ɵ30 = ɵ30;
66
+ exports.ɵ31 = ɵ31;
66
67
  var blockCommand = {
67
68
  alignCenter: ɵ17,
68
69
  alignJustify: ɵ18,
@@ -79,10 +80,10 @@ var blockCommand = {
79
80
  outdent: ɵ27,
80
81
  redo: ɵ28,
81
82
  setHTML: ɵ29,
82
- undo: ɵ30
83
+ undo: ɵ30,
84
+ blockquote: ɵ31
83
85
  };
84
- var ɵ31 = function (attr) { return table_commands_1.insertTable(attr); }, ɵ32 = function () { return table_commands_1.addColumnBefore; }, ɵ33 = function () { return table_commands_1.addColumnAfter; }, ɵ34 = function () { return table_commands_1.addRowBefore; }, ɵ35 = function () { return table_commands_1.addRowAfter; }, ɵ36 = function () { return table_commands_1.deleteRow; }, ɵ37 = function () { return table_commands_1.deleteColumn; }, ɵ38 = function () { return table_commands_1.mergeCells; }, ɵ39 = function () { return table_commands_1.splitCell; }, ɵ40 = function () { return table_commands_1.deleteTable; };
85
- exports.ɵ31 = ɵ31;
86
+ var ɵ32 = function (attr) { return table_commands_1.insertTable(attr); }, ɵ33 = function () { return kendo_editor_common_1.addColumnBefore; }, ɵ34 = function () { return kendo_editor_common_1.addColumnAfter; }, ɵ35 = function () { return kendo_editor_common_1.addRowBefore; }, ɵ36 = function () { return kendo_editor_common_1.addRowAfter; }, ɵ37 = function () { return kendo_editor_common_1.deleteRow; }, ɵ38 = function () { return kendo_editor_common_1.deleteColumn; }, ɵ39 = function () { return kendo_editor_common_1.mergeCells; }, ɵ40 = function () { return kendo_editor_common_1.splitCell; }, ɵ41 = function () { return kendo_editor_common_1.deleteTable; };
86
87
  exports.ɵ32 = ɵ32;
87
88
  exports.ɵ33 = ɵ33;
88
89
  exports.ɵ34 = ɵ34;
@@ -92,17 +93,18 @@ exports.ɵ37 = ɵ37;
92
93
  exports.ɵ38 = ɵ38;
93
94
  exports.ɵ39 = ɵ39;
94
95
  exports.ɵ40 = ɵ40;
96
+ exports.ɵ41 = ɵ41;
95
97
  var tableCommand = {
96
- insertTable: ɵ31,
97
- addColumnBefore: ɵ32,
98
- addColumnAfter: ɵ33,
99
- addRowBefore: ɵ34,
100
- addRowAfter: ɵ35,
101
- deleteRow: ɵ36,
102
- deleteColumn: ɵ37,
103
- mergeCells: ɵ38,
104
- splitCell: ɵ39,
105
- deleteTable: ɵ40
98
+ insertTable: ɵ32,
99
+ addColumnBefore: ɵ33,
100
+ addColumnAfter: ɵ34,
101
+ addRowBefore: ɵ35,
102
+ addRowAfter: ɵ36,
103
+ deleteRow: ɵ37,
104
+ deleteColumn: ɵ38,
105
+ mergeCells: ɵ39,
106
+ splitCell: ɵ40,
107
+ deleteTable: ɵ41
106
108
  };
107
109
  /**
108
110
  * @hidden
@@ -4,20 +4,18 @@
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  "use strict";
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- var tslib_1 = require("tslib");
8
7
  var semantic_nodes_1 = require("./semantic-nodes");
9
8
  var kendo_editor_common_1 = require("@progress/kendo-editor-common");
10
9
  exports.Schema = kendo_editor_common_1.Schema;
11
- var table_nodes_1 = require("./table-nodes");
12
10
  /**
13
11
  * @hidden
14
12
  */
15
13
  var marks = kendo_editor_common_1.marks;
16
- var nodes = Object.assign(kendo_editor_common_1.nodes, table_nodes_1.tableNodes, semantic_nodes_1.semanticNodes);
14
+ var nodes = Object.assign(kendo_editor_common_1.nodes, semantic_nodes_1.semanticNodes);
17
15
  /**
18
16
  * @hidden
19
17
  */
20
18
  exports.schema = new kendo_editor_common_1.Schema({
21
19
  marks: marks,
22
- nodes: tslib_1.__assign({}, nodes, { blockquote: tslib_1.__assign({}, nodes.blockquote, { content: 'inline*' }) })
20
+ nodes: nodes
23
21
  });
@@ -5,379 +5,12 @@
5
5
  "use strict";
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  var kendo_editor_common_1 = require("@progress/kendo-editor-common");
8
- var table_utils_1 = require("./tables/table-utils");
9
- var utils_1 = require("./utils");
10
- var TableMap_1 = require("./tables/TableMap");
11
- var CellSelection_1 = require("./tables/CellSelection");
12
8
  /**
13
9
  * @hidden
14
10
  */
15
11
  exports.insertTable = function (attrs) { return function (state, dispatch) {
16
- var newTable = table_utils_1.createTable(state.schema.nodes, attrs.rows, attrs.cols);
12
+ var newTable = kendo_editor_common_1.createTable(state.schema.nodes, attrs.rows, attrs.cols);
17
13
  if (newTable) {
18
14
  kendo_editor_common_1.insertNode(newTable, true)(state, dispatch);
19
15
  }
20
16
  }; };
21
- var addTableGroupColumn = function (tr, _a, col, mainTable, requiredGroup, doc) {
22
- var left = _a.left, right = _a.right;
23
- var refColumn = col > 0 ? -1 : 0;
24
- // not sure if this should be deleted
25
- // if (columnIsHeader(map, table, col + refColumn)) {
26
- // refColumn = col === 0 || col === map.width ? null : 0;
27
- // }
28
- var rect;
29
- mainTable.node.descendants(function (tableChildNode, offset) {
30
- if (requiredGroup(tableChildNode)) {
31
- var i_1 = -1;
32
- tableChildNode.firstChild.descendants(function (childNode, pos) {
33
- if (utils_1.isTableCell(childNode) || utils_1.isTableHeaderCell(childNode)) {
34
- i_1 = i_1 + 1;
35
- if (i_1 === right || i_1 === left) {
36
- var selection = new kendo_editor_common_1.Selection(doc.resolve(pos + offset + mainTable.start), doc.resolve(pos + offset + mainTable.start));
37
- rect = table_utils_1.selectedRect(selection);
38
- }
39
- }
40
- });
41
- }
42
- });
43
- // Do nothing if thead, tfoot or tbody is missing
44
- if (!rect) {
45
- return tr;
46
- }
47
- for (var row = 0; row < rect.map.height; row++) {
48
- var index = row * rect.map.width + col;
49
- // If this position falls inside a col-spanning cell
50
- if (col > 0 && col < rect.map.width && rect.map.map[index - 1] === rect.map.map[index]) {
51
- var pos = rect.map.map[index];
52
- var cell = rect.table.nodeAt(pos);
53
- tr.setNodeMarkup(tr.mapping.map(rect.tableStart + pos), null, table_utils_1.addColSpan(cell.attrs, col - rect.map.colCount(pos)));
54
- // Skip ahead if rowspan > 1
55
- row += cell.attrs.rowspan - 1;
56
- }
57
- else {
58
- var type = rect.table.nodeAt(rect.map.map[index + refColumn]).type;
59
- var pos = rect.map.positionAt(row, col, rect.table);
60
- tr.insert(tr.mapping.map(rect.tableStart + pos), type.createAndFill());
61
- }
62
- }
63
- return tr;
64
- };
65
- var ɵ0 = addTableGroupColumn;
66
- exports.ɵ0 = ɵ0;
67
- var removeTableGroupColumn = function (tr, _a, mainTable, requiredGroup, doc) {
68
- var right = _a.right, left = _a.left;
69
- var rect;
70
- mainTable.node.descendants(function (tableChildNode, offset) {
71
- if (requiredGroup(tableChildNode)) {
72
- var i_2 = -1;
73
- tableChildNode.firstChild.descendants(function (childNode, pos) {
74
- if (utils_1.isTableCell(childNode) || utils_1.isTableHeaderCell(childNode)) {
75
- i_2 = i_2 + 1;
76
- if (i_2 >= left && i_2 < right) {
77
- var resolvedPos = doc.resolve(pos + offset + mainTable.start + childNode.nodeSize);
78
- var selection = new kendo_editor_common_1.Selection(resolvedPos, resolvedPos);
79
- rect = table_utils_1.selectedRect(selection);
80
- }
81
- }
82
- });
83
- }
84
- });
85
- // Do nothing if thead, tfoot or tbody is missing
86
- if (!rect) {
87
- return;
88
- }
89
- for (var i = rect.right - 1;; i--) {
90
- removeColumn(tr, rect, i);
91
- if (i === rect.left) {
92
- break;
93
- }
94
- rect.table = rect.tableStart ? tr.doc.nodeAt(rect.tableStart - 1) : tr.doc;
95
- rect.map = TableMap_1.TableMap.get(rect.table);
96
- }
97
- return;
98
- };
99
- var ɵ1 = removeTableGroupColumn;
100
- exports.ɵ1 = ɵ1;
101
- var removeColumn = function (tr, _a, col) {
102
- var map = _a.map, table = _a.table, tableStart = _a.tableStart;
103
- for (var row = 0; row < map.height;) {
104
- var index = row * map.width + col;
105
- var pos = map.map[index];
106
- var cell = table.nodeAt(pos);
107
- // If this is part of a col-spanning cell
108
- if ((col > 0 && map.map[index - 1] === pos) || (col < map.width - 1 && map.map[index + 1] === pos)) {
109
- tr.setNodeMarkup(tr.mapping.map(tableStart + pos), null, table_utils_1.removeColSpan(cell.attrs, col - map.colCount(pos)));
110
- }
111
- else {
112
- var start = tr.mapping.map(tableStart + pos);
113
- tr.delete(start, start + cell.nodeSize);
114
- }
115
- row += cell.attrs.rowspan;
116
- }
117
- };
118
- var ɵ2 = removeColumn;
119
- exports.ɵ2 = ɵ2;
120
- /**
121
- * @hidden
122
- */
123
- // Command to add a column before the column with the selection.
124
- exports.addColumnBefore = function (state, dispatch) {
125
- if (!table_utils_1.isInTable(state)) {
126
- return false;
127
- }
128
- if (dispatch) {
129
- var rect = table_utils_1.selectedRect(state.selection);
130
- var mainTable = table_utils_1.findParentNodeClosestToPos(state.selection.$anchor, utils_1.isTable);
131
- var tHeadTr = addTableGroupColumn(state.tr, rect, rect.left, mainTable, utils_1.isTableHead, state.doc);
132
- var tBodyTr = addTableGroupColumn(tHeadTr, rect, rect.left, mainTable, utils_1.isTableBody, state.doc);
133
- var tFootTr = addTableGroupColumn(tBodyTr, rect, rect.left, mainTable, utils_1.isTableFoot, state.doc);
134
- dispatch(tFootTr);
135
- }
136
- return true;
137
- };
138
- /**
139
- * @hidden
140
- */
141
- // Command to add a column after the column with the selection.
142
- exports.addColumnAfter = function (state, dispatch) {
143
- if (!table_utils_1.isInTable(state)) {
144
- return false;
145
- }
146
- if (dispatch) {
147
- var rect = table_utils_1.selectedRect(state.selection);
148
- var mainTable = table_utils_1.findParentNodeClosestToPos(state.selection.$anchor, utils_1.isTable);
149
- var theadTr = addTableGroupColumn(state.tr, rect, rect.right, mainTable, utils_1.isTableHead, state.doc);
150
- var tBodyTr = addTableGroupColumn(theadTr, rect, rect.right, mainTable, utils_1.isTableBody, state.doc);
151
- var tFootTr = addTableGroupColumn(tBodyTr, rect, rect.right, mainTable, utils_1.isTableFoot, state.doc);
152
- dispatch(tFootTr);
153
- }
154
- return true;
155
- };
156
- var addRow = function (tr, _a, row) {
157
- var map = _a.map, tableStart = _a.tableStart, table = _a.table;
158
- var rowPos = tableStart;
159
- for (var i = 0; i < row; i++) {
160
- rowPos += table.child(i).nodeSize;
161
- }
162
- var cells = [];
163
- var refRow = row > 0 ? -1 : 0;
164
- if (table_utils_1.rowIsHeader(map, table, row + refRow)) {
165
- refRow = row === 0 || row === map.height ? null : 0;
166
- }
167
- for (var col = 0, index = map.width * row; col < map.width; col++, index++) {
168
- // Covered by a rowspan cell
169
- if (row > 0 && row < map.height && map.map[index] === map.map[index - map.width]) {
170
- var pos = map.map[index];
171
- var attrs = table.nodeAt(pos).attrs;
172
- tr.setNodeMarkup(tableStart + pos, null, table_utils_1.setAttr(attrs, 'rowspan', attrs.rowspan + 1));
173
- col += attrs.colspan - 1;
174
- }
175
- else {
176
- var type = refRow == null ? table_utils_1.tableNodeTypes(table.type.schema).cell : table.nodeAt(map.map[index + refRow * map.width]).type;
177
- cells.push(type.createAndFill());
178
- }
179
- }
180
- tr.insert(rowPos, table_utils_1.tableNodeTypes(table.type.schema).row.create(null, cells));
181
- return tr;
182
- };
183
- var ɵ3 = addRow;
184
- exports.ɵ3 = ɵ3;
185
- /**
186
- * @hidden
187
- */
188
- // Add a table row before the selection.
189
- exports.addRowBefore = function (state, dispatch) {
190
- if (!table_utils_1.isInTable(state)) {
191
- return false;
192
- }
193
- if (dispatch) {
194
- var rect = table_utils_1.selectedRect(state.selection);
195
- dispatch(addRow(state.tr, rect, rect.top));
196
- }
197
- return true;
198
- };
199
- /**
200
- * @hidden
201
- */
202
- // Add a table row after the selection.
203
- exports.addRowAfter = function (state, dispatch) {
204
- if (!table_utils_1.isInTable(state)) {
205
- return false;
206
- }
207
- if (dispatch) {
208
- var rect = table_utils_1.selectedRect(state.selection);
209
- dispatch(addRow(state.tr, rect, rect.bottom));
210
- }
211
- return true;
212
- };
213
- /**
214
- * @hidden
215
- */
216
- // Command function that removes the selected columns from a table.
217
- exports.deleteColumn = function (state, dispatch) {
218
- if (!table_utils_1.isInTable(state)) {
219
- return false;
220
- }
221
- if (dispatch) {
222
- var rect = table_utils_1.selectedRect(state.selection);
223
- // if only one column left - delete the whole table
224
- if (rect.left === 0 && rect.right === rect.map.width) {
225
- return exports.deleteTable(state, dispatch);
226
- }
227
- var mainTable = table_utils_1.findParentNodeClosestToPos(state.selection.$anchor, utils_1.isTable);
228
- var tr = state.tr;
229
- removeTableGroupColumn(tr, rect, mainTable, utils_1.isTableFoot, tr.doc);
230
- removeTableGroupColumn(tr, rect, mainTable, utils_1.isTableBody, tr.doc);
231
- removeTableGroupColumn(tr, rect, mainTable, utils_1.isTableHead, tr.doc);
232
- dispatch(tr);
233
- }
234
- return true;
235
- };
236
- var removeRow = function (tr, _a, row) {
237
- var map = _a.map, table = _a.table, tableStart = _a.tableStart;
238
- var rowPos = 0;
239
- for (var i = 0; i < row; i++) {
240
- rowPos += table.child(i).nodeSize;
241
- }
242
- var nextRow = rowPos + table.child(row).nodeSize;
243
- var mapFrom = tr.mapping.maps.length;
244
- tr.delete(rowPos + tableStart, nextRow + tableStart);
245
- for (var col = 0, index = row * map.width; col < map.width; col++, index++) {
246
- var pos = map.map[index];
247
- if (row > 0 && pos === map.map[index - map.width]) {
248
- // If this cell starts in the row above, simply reduce its rowspan
249
- var attrs = table.nodeAt(pos).attrs;
250
- tr.setNodeMarkup(tr.mapping.slice(mapFrom).map(pos + tableStart), null, table_utils_1.setAttr(attrs, 'rowspan', attrs.rowspan - 1));
251
- col += attrs.colspan - 1;
252
- }
253
- else if (row < map.width && pos === map.map[index + map.width]) {
254
- // Else, if it continues in the row below, it has to be moved down
255
- var cell = table.nodeAt(pos);
256
- var copy = cell.type.create(table_utils_1.setAttr(cell.attrs, 'rowspan', cell.attrs.rowspan - 1), cell.content);
257
- var newPos = map.positionAt(row + 1, col, table);
258
- tr.insert(tr.mapping.slice(mapFrom).map(tableStart + newPos), copy);
259
- col += cell.attrs.colspan - 1;
260
- }
261
- }
262
- };
263
- var ɵ4 = removeRow;
264
- exports.ɵ4 = ɵ4;
265
- /**
266
- * @hidden
267
- */
268
- // Remove the selected rows from a table.
269
- exports.deleteRow = function (state, dispatch) {
270
- if (!table_utils_1.isInTable(state)) {
271
- return false;
272
- }
273
- if (dispatch) {
274
- var rect_1 = table_utils_1.selectedRect(state.selection);
275
- var tr = state.tr;
276
- if (rect_1.top === 0 && rect_1.bottom === rect_1.map.height) {
277
- var mainTable = table_utils_1.findParentNodeClosestToPos(state.selection.$anchor, utils_1.isTable);
278
- if (mainTable.node.childCount === 1) {
279
- exports.deleteTable(state, dispatch);
280
- }
281
- else {
282
- deleteTableElement(function (n) { return n.type.name === rect_1.table.type.name; })(state, dispatch);
283
- }
284
- return true;
285
- }
286
- for (var i = rect_1.bottom - 1;; i--) {
287
- removeRow(tr, rect_1, i);
288
- if (i === rect_1.top) {
289
- break;
290
- }
291
- rect_1.table = rect_1.tableStart ? tr.doc.nodeAt(rect_1.tableStart - 1) : tr.doc;
292
- rect_1.map = TableMap_1.TableMap.get(rect_1.table);
293
- }
294
- dispatch(tr);
295
- }
296
- return true;
297
- };
298
- /**
299
- * @hidden
300
- */
301
- // Merge the selected cells into a single cell. Only available when
302
- // the selected cells' outline forms a rectangle.
303
- exports.mergeCells = function (state, dispatch) {
304
- var sel = state.selection;
305
- if (!(sel instanceof CellSelection_1.CellSelection) || sel.$anchorCell.pos === sel.$headCell.pos) {
306
- return false;
307
- }
308
- var rect = table_utils_1.selectedRect(state.selection);
309
- var map = rect.map;
310
- if (table_utils_1.cellsOverlapRectangle(map, rect)) {
311
- return false;
312
- }
313
- if (dispatch) {
314
- var tr = state.tr;
315
- var seen = {};
316
- var content = kendo_editor_common_1.Fragment.empty;
317
- var mergedPos = void 0;
318
- var mergedCell = void 0;
319
- for (var row = rect.top; row < rect.bottom; row++) {
320
- for (var col = rect.left; col < rect.right; col++) {
321
- var cellPos = map.map[row * map.width + col], cell = rect.table.nodeAt(cellPos);
322
- if (seen[cellPos]) {
323
- continue;
324
- }
325
- seen[cellPos] = true;
326
- if (mergedPos === null) {
327
- mergedPos = cellPos;
328
- mergedCell = cell;
329
- }
330
- else {
331
- if (!table_utils_1.isCellEmpty(cell)) {
332
- content = content.append(cell.content);
333
- }
334
- var mapped = tr.mapping.map(cellPos + rect.tableStart);
335
- tr.delete(mapped, mapped + cell.nodeSize);
336
- }
337
- }
338
- }
339
- tr.setNodeMarkup(mergedPos + rect.tableStart, null, table_utils_1.setAttr(table_utils_1.addColSpan(mergedCell.attrs, mergedCell.attrs.colspan, rect.right - rect.left - mergedCell.attrs.colspan), 'rowspan', rect.bottom - rect.top));
340
- if (content.size) {
341
- var end = mergedPos + 1 + mergedCell.content.size;
342
- var start = table_utils_1.isCellEmpty(mergedCell) ? mergedPos + 1 : end;
343
- tr.replaceWith(start + rect.tableStart, end + rect.tableStart, content);
344
- }
345
- tr.setSelection(new CellSelection_1.CellSelection(tr.doc.resolve(mergedPos + rect.tableStart)));
346
- dispatch(tr);
347
- }
348
- return true;
349
- };
350
- /**
351
- * @hidden
352
- */
353
- // Split a selected cell, whose rowpan or colspan is greater than one,
354
- // into smaller cells. Use the first cell type for the new cells.
355
- exports.splitCell = function (state, dispatch) {
356
- var nodeTypes = table_utils_1.tableNodeTypes(state.schema);
357
- return table_utils_1.splitCellWithType(function (_a) {
358
- var node = _a.node;
359
- return nodeTypes[node.type.spec.tableRole];
360
- })(state, dispatch);
361
- };
362
- var deleteTableElement = function (selector) { return function (state, dispatch) {
363
- var $pos = state.selection.$anchor;
364
- for (var d = $pos.depth; d > 0; d--) {
365
- var node = $pos.node(d);
366
- if (selector(node)) {
367
- if (dispatch) {
368
- var tr = state.tr;
369
- tr.delete($pos.before(d), $pos.after(d)).scrollIntoView();
370
- dispatch(tr);
371
- }
372
- return true;
373
- }
374
- }
375
- return false;
376
- }; };
377
- var ɵ5 = deleteTableElement;
378
- exports.ɵ5 = ɵ5;
379
- /**
380
- * @hidden
381
- */
382
- // Deletes the table around the selection, if any.
383
- exports.deleteTable = deleteTableElement(utils_1.isTable);
@@ -61,7 +61,7 @@ var ColorPickerDialogComponent = /** @class */ (function (_super) {
61
61
  ], ColorPickerDialogComponent.prototype, "colorPicker", void 0);
62
62
  ColorPickerDialogComponent = tslib_1.__decorate([
63
63
  core_1.Component({
64
- template: "\n <kendo-dialog-titlebar (close)=\"onCancelAction()\">\n {{ textFor(editorCommand) }}\n </kendo-dialog-titlebar>\n <div class=\"k-editor-dialog\">\n <div class=\"k-editor-dialog k-popup-edit-form k-window-content k-content\">\n <div class=\"k-edit-form-container k-window-content\" style=\"text-align: center;\">\n <kendo-colorpicker\n #colorpicker\n [view]=\"view\"\n [format]=\"'hex'\"\n [attr.title]=\"title\"\n [icon]=\"icon\"\n [(value)]=\"value\"\n [paletteSettings]=\"paletteSettings\"\n (activeColorClick)=\"handleActiveColorClick($event)\"\n >\n </kendo-colorpicker>\n </div>\n </div>\n </div>\n <kendo-dialog-actions>\n <button kendoButton (click)=\"onCancelAction()\">{{ textFor('dialogCancel') }}</button>\n <button kendoButton\n (click)=\"onConfirmAction()\" [primary]=\"true\">{{ textFor('dialogApply') }}</button>\n </kendo-dialog-actions>\n "
64
+ template: "\n <kendo-dialog-titlebar (close)=\"onCancelAction()\">\n {{ textFor(editorCommand) }}\n </kendo-dialog-titlebar>\n <div class=\"k-editor-dialog\">\n <div class=\"k-editor-dialog k-popup-edit-form k-window-content k-content\">\n <div class=\"k-edit-form-container k-window-content\" style=\"text-align: center;\">\n <kendo-colorpicker\n #colorpicker\n [views]=\"['palette']\"\n [format]=\"'hex'\"\n [attr.title]=\"title\"\n [icon]=\"icon\"\n [(value)]=\"value\"\n [paletteSettings]=\"paletteSettings\"\n (activeColorClick)=\"handleActiveColorClick($event)\"\n >\n </kendo-colorpicker>\n </div>\n </div>\n </div>\n <kendo-dialog-actions>\n <button kendoButton (click)=\"onCancelAction()\">{{ textFor('dialogCancel') }}</button>\n <button kendoButton\n (click)=\"onConfirmAction()\" [primary]=\"true\">{{ textFor('dialogApply') }}</button>\n </kendo-dialog-actions>\n "
65
65
  }),
66
66
  tslib_1.__metadata("design:paramtypes", [kendo_angular_dialog_1.DialogRef,
67
67
  editor_localization_service_1.EditorLocalizationService])
@@ -119,7 +119,7 @@ var FileLinkDialogComponent = /** @class */ (function (_super) {
119
119
  ], FileLinkDialogComponent.prototype, "hrefInput", void 0);
120
120
  FileLinkDialogComponent = tslib_1.__decorate([
121
121
  core_1.Component({
122
- template: "\n <kendo-dialog-titlebar (close)=\"onCancelAction()\">\n {{ titleText }}\n </kendo-dialog-titlebar>\n <div class=\"k-editor-dialog\">\n <div class=\"k-editor-dialog k-popup-edit-form k-window-content k-content\">\n <div class=\"k-edit-form-container k-window-content\">\n <form novalidate [formGroup]=\"linkForm\">\n <div class=\"k-edit-label\">\n <label (click)=\"hrefInput.focus()\">{{ textForWithPrefix('WebAddress') }}</label>\n </div>\n <div class=\"k-edit-field\">\n <input #hrefInput formControlName=\"href\" type=\"text\" class=\"k-textbox\" />\n </div>\n\n <div class=\"k-edit-label\">\n <label (click)=\"textInput.focus()\">{{ textForWithPrefix('Text') }}</label>\n </div>\n <div class=\"k-edit-field\">\n <input #textInput formControlName=\"text\" type=\"text\" class=\"k-textbox\" />\n </div>\n\n <div class=\"k-edit-label\">\n <label (click)=\"titleInput.focus()\">{{ textForWithPrefix('Title') }}</label>\n </div>\n <div class=\"k-edit-field\">\n <input #titleInput formControlName=\"title\" type=\"text\" class=\"k-textbox\" />\n </div>\n <ng-container *ngIf=\"command === 'createLink'\">\n <div class=\"k-edit-label\"></div>\n <div class=\"k-edit-field\">\n <input type=\"checkbox\" id=\"k-target-blank\" class=\"k-checkbox\" formControlName=\"target\" />\n <label class=\"k-checkbox-label\" for=\"k-target-blank\">{{ textForWithPrefix('OpenInNewWindow') }}</label>\n </div>\n </ng-container>\n </form>\n </div>\n </div>\n </div>\n <kendo-dialog-actions>\n <button kendoButton (click)=\"onCancelAction()\">{{ textFor('dialogCancel') }}</button>\n <button kendoButton [disabled]=\"linkForm.invalid\" (click)=\"onConfirmAction()\" [primary]=\"true\">\n {{ textFor('dialogInsert') }}\n </button>\n </kendo-dialog-actions>\n "
122
+ template: "\n <kendo-dialog-titlebar (close)=\"onCancelAction()\">\n {{ titleText }}\n </kendo-dialog-titlebar>\n <div class=\"k-editor-dialog\">\n <div class=\"k-editor-dialog k-popup-edit-form k-window-content k-content\">\n <div class=\"k-edit-form-container k-window-content\">\n <form novalidate [formGroup]=\"linkForm\">\n <div class=\"k-edit-label\">\n <label (click)=\"hrefInput.focus()\">{{ textForWithPrefix('WebAddress') }}</label>\n </div>\n <div class=\"k-edit-field\">\n <input #hrefInput formControlName=\"href\" type=\"text\" class=\"k-textbox k-input k-rounded-md\" />\n </div>\n\n <div class=\"k-edit-label\">\n <label (click)=\"textInput.focus()\">{{ textForWithPrefix('Text') }}</label>\n </div>\n <div class=\"k-edit-field\">\n <input #textInput formControlName=\"text\" type=\"text\" class=\"k-textbox k-input k-rounded-md\" />\n </div>\n\n <div class=\"k-edit-label\">\n <label (click)=\"titleInput.focus()\">{{ textForWithPrefix('Title') }}</label>\n </div>\n <div class=\"k-edit-field\">\n <input #titleInput formControlName=\"title\" type=\"text\" class=\"k-textbox k-input k-rounded-md\" />\n </div>\n <ng-container *ngIf=\"command === 'createLink'\">\n <div class=\"k-edit-label\"></div>\n <div class=\"k-edit-field\">\n <input type=\"checkbox\" id=\"k-target-blank\" kendoCheckBox formControlName=\"target\" />\n <label class=\"k-checkbox-label\" for=\"k-target-blank\">{{ textForWithPrefix('OpenInNewWindow') }}</label>\n </div>\n </ng-container>\n </form>\n </div>\n </div>\n </div>\n <kendo-dialog-actions>\n <button kendoButton (click)=\"onCancelAction()\">{{ textFor('dialogCancel') }}</button>\n <button kendoButton [disabled]=\"linkForm.invalid\" (click)=\"onConfirmAction()\" [primary]=\"true\">\n {{ textFor('dialogInsert') }}\n </button>\n </kendo-dialog-actions>\n "
123
123
  }),
124
124
  tslib_1.__metadata("design:paramtypes", [kendo_angular_dialog_1.DialogRef, editor_localization_service_1.EditorLocalizationService])
125
125
  ], FileLinkDialogComponent);
@@ -94,7 +94,7 @@ var ImageDialogComponent = /** @class */ (function (_super) {
94
94
  ], ImageDialogComponent.prototype, "srcInput", void 0);
95
95
  ImageDialogComponent = tslib_1.__decorate([
96
96
  core_1.Component({
97
- template: "\n <kendo-dialog-titlebar (close)=\"onCancelAction()\">\n {{ textFor('insertImage') }}\n </kendo-dialog-titlebar>\n <div class=\"k-editor-dialog\">\n <div class=\"k-editor-dialog k-popup-edit-form k-window-content k-content\">\n <div class=\"k-edit-form-container k-window-content\">\n <div class=\"k-edit-label\">\n <label [for]=\"srcInputId\">{{ textFor('imageWebAddress') }}</label>\n </div>\n <div class=\"k-edit-field\">\n <input [id]=\"srcInputId\" #srcInput [formControl]=\"src\" type=\"text\" class=\"k-textbox\" />\n </div>\n <div class=\"k-edit-label\">\n <label [for]=\"altTextInputId\">{{ textFor('imageAltText') }}</label>\n </div>\n <div class=\"k-edit-field\">\n <input [id]=\"altTextInputId\" [formControl]=\"alt\" type=\"text\" class=\"k-textbox\" />\n </div>\n <div class=\"k-edit-label\">\n <label [for]=\"widthInputId\">{{ textFor('imageWidth') }}</label>\n </div>\n <div class=\"k-edit-field\">\n <input [id]=\"widthInputId\" [formControl]=\"width\" type=\"text\" class=\"k-textbox\" />\n </div>\n <div class=\"k-edit-label\">\n <label [for]=\"heightInputId\">{{ textFor('imageHeight') }}</label>\n </div>\n <div class=\"k-edit-field\">\n <input [id]=\"heightInputId\" [formControl]=\"height\" type=\"text\" class=\"k-textbox\" />\n </div>\n </div>\n </div>\n </div>\n <kendo-dialog-actions>\n <button kendoButton (click)=\"onCancelAction()\">{{ textFor('dialogCancel') }}</button>\n <button kendoButton [disabled]=\"imageData.invalid\"\n (click)=\"onConfirmAction()\" [primary]=\"true\">{{ textFor('dialogInsert') }}</button>\n </kendo-dialog-actions>\n "
97
+ template: "\n <kendo-dialog-titlebar (close)=\"onCancelAction()\">\n {{ textFor('insertImage') }}\n </kendo-dialog-titlebar>\n <div class=\"k-editor-dialog\">\n <div class=\"k-editor-dialog k-popup-edit-form k-window-content k-content\">\n <div class=\"k-edit-form-container k-window-content\">\n <div class=\"k-edit-label\">\n <label [for]=\"srcInputId\">{{ textFor('imageWebAddress') }}</label>\n </div>\n <div class=\"k-edit-field\">\n <input [id]=\"srcInputId\" #srcInput [formControl]=\"src\" type=\"text\" class=\"k-textbox k-input k-rounded-md\" />\n </div>\n <div class=\"k-edit-label\">\n <label [for]=\"altTextInputId\">{{ textFor('imageAltText') }}</label>\n </div>\n <div class=\"k-edit-field\">\n <input [id]=\"altTextInputId\" [formControl]=\"alt\" type=\"text\" class=\"k-textbox k-input k-rounded-md\" />\n </div>\n <div class=\"k-edit-label\">\n <label [for]=\"widthInputId\">{{ textFor('imageWidth') }}</label>\n </div>\n <div class=\"k-edit-field\">\n <input [id]=\"widthInputId\" [formControl]=\"width\" type=\"text\" class=\"k-textbox k-input k-rounded-md\" />\n </div>\n <div class=\"k-edit-label\">\n <label [for]=\"heightInputId\">{{ textFor('imageHeight') }}</label>\n </div>\n <div class=\"k-edit-field\">\n <input [id]=\"heightInputId\" [formControl]=\"height\" type=\"text\" class=\"k-textbox k-input k-rounded-md\" />\n </div>\n </div>\n </div>\n </div>\n <kendo-dialog-actions>\n <button kendoButton (click)=\"onCancelAction()\">{{ textFor('dialogCancel') }}</button>\n <button kendoButton [disabled]=\"imageData.invalid\"\n (click)=\"onConfirmAction()\" [primary]=\"true\">{{ textFor('dialogInsert') }}</button>\n </kendo-dialog-actions>\n "
98
98
  }),
99
99
  tslib_1.__metadata("design:paramtypes", [kendo_angular_dialog_1.DialogRef,
100
100
  editor_localization_service_1.EditorLocalizationService])
@@ -38,6 +38,10 @@ exports.getToolbarState = function (state, options) { return ({
38
38
  selected: kendo_editor_common_2.activeNode(state),
39
39
  disabled: false
40
40
  },
41
+ blockquote: {
42
+ selected: false,
43
+ disabled: !kendo_editor_common_1.blockquote(state)
44
+ },
41
45
  indent: {
42
46
  selected: false,
43
47
  disabled: !(kendo_editor_common_2.canIndentAsListItem(state, state.schema.nodes.list_item) || kendo_editor_common_2.canBeIndented(state, kendo_editor_common_2.indentRules))
@@ -60,7 +64,11 @@ exports.getToolbarState = function (state, options) { return ({
60
64
  },
61
65
  outdent: {
62
66
  selected: false,
63
- disabled: !(kendo_editor_common_2.canOutdentAsListItem(state, kendo_editor_common_2.outdentRules) || kendo_editor_common_2.canBeIndented(state, kendo_editor_common_2.outdentRules))
67
+ get disabled() {
68
+ return !(kendo_editor_common_2.hasNode(state, state.schema.nodes.blockquote) ||
69
+ kendo_editor_common_2.canOutdentAsListItem(state, kendo_editor_common_2.outdentRules) ||
70
+ kendo_editor_common_1.isIndented(state, kendo_editor_common_2.outdentRules.nodes));
71
+ }
64
72
  },
65
73
  redo: {
66
74
  selected: false,
@@ -186,6 +194,7 @@ exports.initialToolBarState = {
186
194
  format: { selected: { text: 'Format', tag: null }, disabled: false },
187
195
  style: { selected: { marks: [], hasNodesWithoutMarks: false }, disabled: false },
188
196
  cleanFormatting: { selected: false, disabled: true },
197
+ blockquote: { selected: false, disabled: false },
189
198
  //indent
190
199
  indent: { selected: false, disabled: false },
191
200
  outdent: { selected: false, disabled: false },
@@ -238,6 +247,7 @@ exports.disabledToolBarState = {
238
247
  format: { selected: { text: 'Format', tag: null }, disabled: true },
239
248
  style: { selected: { marks: [], hasNodesWithoutMarks: false }, disabled: true },
240
249
  cleanFormatting: { selected: false, disabled: true },
250
+ blockquote: { selected: false, disabled: true },
241
251
  //indent
242
252
  indent: { selected: false, disabled: true },
243
253
  outdent: { selected: false, disabled: true },