@worktile/theia 1.2.9 → 1.2.13

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 (92) hide show
  1. package/bundles/worktile-theia.umd.js +886 -225
  2. package/bundles/worktile-theia.umd.js.map +1 -1
  3. package/components/column-resize/column-resize.directive.d.ts +3 -3
  4. package/components/inline-toolbar/inline-toolbar.component.d.ts +26 -0
  5. package/components/inline-toolbar/inline-toolbar.component.scss +19 -0
  6. package/components/nav-split-line/nav-split-line.component.d.ts +6 -1
  7. package/components/toolbar/toolbar.component.d.ts +2 -1
  8. package/components/toolbar-dropdown/toolbar-dropdown.component.scss +3 -0
  9. package/components/toolbar-item/toolbar-item.component.d.ts +14 -5
  10. package/constants/node-types.d.ts +0 -1
  11. package/constants/toolbar.d.ts +6 -2
  12. package/custom-types.d.ts +3 -0
  13. package/editor.component.d.ts +8 -4
  14. package/editor.module.d.ts +59 -52
  15. package/esm2015/components/color-select/color-select.component.js +3 -2
  16. package/esm2015/components/column-resize/column-resize.directive.js +1 -1
  17. package/esm2015/components/inline-toolbar/inline-toolbar.component.js +139 -0
  18. package/esm2015/components/nav-split-line/nav-split-line.component.js +26 -5
  19. package/esm2015/components/toolbar/toolbar.component.js +7 -6
  20. package/esm2015/components/toolbar-base-item/toolbar-base-item.component.js +3 -2
  21. package/esm2015/components/toolbar-group/toolbar-group.component.js +1 -1
  22. package/esm2015/components/toolbar-item/toolbar-item.component.js +70 -24
  23. package/esm2015/constants/node-types.js +1 -2
  24. package/esm2015/constants/toolbar.js +37 -5
  25. package/esm2015/custom-types.js +1 -1
  26. package/esm2015/editor.component.js +40 -23
  27. package/esm2015/editor.module.js +15 -6
  28. package/esm2015/interfaces/toolbar.js +1 -1
  29. package/esm2015/plugins/deserializers/deserialize-html.plugin.js +12 -3
  30. package/esm2015/plugins/deserializers/deserialize-md.plugin.js +2 -2
  31. package/esm2015/plugins/image/image.plugin.js +1 -2
  32. package/esm2015/plugins/index.js +8 -4
  33. package/esm2015/plugins/link/link.plugin.js +7 -2
  34. package/esm2015/plugins/list/list.plugin.js +7 -7
  35. package/esm2015/plugins/list/queries/get-start-list-item.js +9 -2
  36. package/esm2015/plugins/list/queries/is-selection-in-same-list-item.js +17 -0
  37. package/esm2015/plugins/paint-format/options.js +54 -0
  38. package/esm2015/plugins/paint-format/paint-format.editor.js +67 -0
  39. package/esm2015/plugins/placeholder/placeholder.component.js +79 -0
  40. package/esm2015/plugins/public-api.js +2 -1
  41. package/esm2015/plugins/quick-insert/components/quick-insert.component.js +77 -0
  42. package/esm2015/plugins/quick-insert/components/quick-toolbar/quick-toolbar.component.js +75 -0
  43. package/esm2015/plugins/quick-insert/quick-insert.editor.js +61 -0
  44. package/esm2015/plugins/quick-insert/quick-insert.plugint.js +38 -0
  45. package/esm2015/plugins/table/components/row/row.component.js +3 -1
  46. package/esm2015/plugins/table/components/table.component.js +6 -3
  47. package/esm2015/plugins/table/components/td/td.component.js +2 -1
  48. package/esm2015/plugins/table/components/toolbar/table-toolbar.component.js +1 -1
  49. package/esm2015/plugins/table/table.plugin.js +34 -55
  50. package/esm2015/plugins/table/table.types.js +1 -1
  51. package/esm2015/plugins/table/utils/normalize-table.js +31 -0
  52. package/esm2015/public-api.js +2 -1
  53. package/esm2015/queries/is-container-type.js +2 -2
  54. package/esm2015/services/context.service.js +10 -2
  55. package/esm2015/services/toolbar.service.js +5 -5
  56. package/esm2015/transforms/index.js +2 -3
  57. package/esm2015/utils/auto-focus.js +3 -3
  58. package/esm2015/utils/fragment.js +24 -2
  59. package/esm2015/utils/is-clean-empty-paragraph.js +32 -0
  60. package/esm2015/utils/weak-maps.js +2 -1
  61. package/fesm2015/worktile-theia.js +865 -223
  62. package/fesm2015/worktile-theia.js.map +1 -1
  63. package/interfaces/toolbar.d.ts +3 -2
  64. package/package.json +1 -1
  65. package/plugins/list/queries/get-start-list-item.d.ts +8 -2
  66. package/plugins/list/queries/is-selection-in-same-list-item.d.ts +5 -0
  67. package/plugins/paint-format/options.d.ts +2 -0
  68. package/plugins/paint-format/paint-format.editor.d.ts +7 -0
  69. package/{components → plugins}/placeholder/placeholder.component.d.ts +6 -6
  70. package/{components → plugins}/placeholder/placeholder.component.scss +0 -0
  71. package/plugins/public-api.d.ts +1 -0
  72. package/plugins/quick-insert/components/quick-insert.component.d.ts +25 -0
  73. package/plugins/quick-insert/components/quick-insert.component.scss +21 -0
  74. package/plugins/quick-insert/components/quick-toolbar/quick-toolbar.component.d.ts +29 -0
  75. package/plugins/quick-insert/components/quick-toolbar/quick-toolbar.component.scss +21 -0
  76. package/plugins/quick-insert/quick-insert.editor.d.ts +8 -0
  77. package/plugins/quick-insert/quick-insert.plugint.d.ts +2 -0
  78. package/plugins/table/components/table.component.d.ts +1 -0
  79. package/plugins/table/table.types.d.ts +7 -0
  80. package/plugins/table/utils/normalize-table.d.ts +2 -0
  81. package/public-api.d.ts +1 -0
  82. package/services/context.service.d.ts +2 -0
  83. package/services/toolbar.service.d.ts +1 -1
  84. package/styles/editor.scss +33 -11
  85. package/styles/index.scss +5 -2
  86. package/transforms/index.d.ts +1 -2
  87. package/utils/fragment.d.ts +5 -0
  88. package/utils/is-clean-empty-paragraph.d.ts +8 -0
  89. package/utils/weak-maps.d.ts +1 -0
  90. package/esm2015/components/placeholder/placeholder.component.js +0 -88
  91. package/esm2015/transforms/insert-elements.js +0 -22
  92. package/transforms/insert-elements.d.ts +0 -2
@@ -5,7 +5,7 @@ import { DOCUMENT, CommonModule } from '@angular/common';
5
5
  import * as i4$2 from '@angular/forms';
6
6
  import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
7
7
  import * as i1 from 'slate-angular';
8
- import { BaseTextComponent, BaseElementComponent, AngularEditor, NODE_TO_PARENT, NODE_TO_INDEX, IS_SAFARI, hotkeys, getPlainText as getPlainText$1, hasBlockCard, isCardLeft, FAKE_RIGHT_BLOCK_CARD_OFFSET, ELEMENT_TO_COMPONENT, withAngular, SlateModule } from 'slate-angular';
8
+ import { BaseTextComponent, BaseElementComponent, AngularEditor, NODE_TO_PARENT, NODE_TO_INDEX, IS_SAFARI, hotkeys, getPlainText as getPlainText$1, hasBlockCard, isCardLeft, FAKE_RIGHT_BLOCK_CARD_OFFSET, ELEMENT_TO_COMPONENT, EDITOR_TO_ELEMENT, isComponentType, withAngular, SlateModule } from 'slate-angular';
9
9
  import { mixinUnsubscribe, MixinBase } from 'ngx-tethys/core';
10
10
  import isHotkey from 'is-hotkey';
11
11
  import { Element as Element$1, Editor, Range, Node, Span, Path, Text, Point, Transforms, createEditor } from 'slate';
@@ -50,9 +50,10 @@ import { ThySharedModule } from 'ngx-tethys/shared';
50
50
  import * as i1$6 from 'ngx-tethys';
51
51
  import { coerceCssPixelValue } from '@angular/cdk/coercion';
52
52
  import { PortalInjector, ComponentPortal } from '@angular/cdk/portal';
53
+ import * as i2$3 from 'ngx-tethys/list';
54
+ import { ThyListModule } from 'ngx-tethys/list';
53
55
  import { ThyAutocompleteModule } from 'ngx-tethys/autocomplete';
54
56
  import { ThyAvatarModule } from 'ngx-tethys/avatar';
55
- import { ThyListModule } from 'ngx-tethys/list';
56
57
  import { ThySelectModule } from 'ngx-tethys/select';
57
58
 
58
59
  const PICTURE_ACCEPTED_UPLOAD_MIME = ['image/png', 'image/jpeg', 'image/gif', 'image/bmp'];
@@ -121,7 +122,6 @@ var MarkTypes;
121
122
  var ToolbarActionTypes;
122
123
  (function (ToolbarActionTypes) {
123
124
  ToolbarActionTypes["split"] = "split";
124
- ToolbarActionTypes["save"] = "save";
125
125
  ToolbarActionTypes["undo"] = "undo";
126
126
  ToolbarActionTypes["redo"] = "redo";
127
127
  ToolbarActionTypes["paintformat"] = "paintformat";
@@ -163,12 +163,17 @@ const VOID_BLOCK_TYPES = [ElementKinds.image, ElementKinds.hr];
163
163
  const BLOCK_DELETEBACKWARD_TYPES = [ElementKinds.tableCell];
164
164
 
165
165
  const TheToolbarGroupToken = new InjectionToken('the-toolbar-group-token');
166
- const BLOCK_TOOLBAR_HOTKEY = '/';
166
+ const QUICK_TOOLBAR_HOTKEY = '/';
167
167
  var DropdownMode;
168
168
  (function (DropdownMode) {
169
169
  DropdownMode["icon"] = "icon-mode";
170
170
  DropdownMode["text"] = "text-mode";
171
171
  })(DropdownMode || (DropdownMode = {}));
172
+ var ToolbarItemMode;
173
+ (function (ToolbarItemMode) {
174
+ ToolbarItemMode[ToolbarItemMode["horizontal"] = 0] = "horizontal";
175
+ ToolbarItemMode[ToolbarItemMode["vertical"] = 1] = "vertical";
176
+ })(ToolbarItemMode || (ToolbarItemMode = {}));
172
177
  const DefaultGlobalToolbarDefinition = [
173
178
  ElementKinds.headingList,
174
179
  ToolbarActionTypes.split,
@@ -193,8 +198,35 @@ const DefaultGlobalToolbarDefinition = [
193
198
  ElementKinds.blockquote,
194
199
  ElementKinds.code
195
200
  ];
196
- const DefaultInlineToolbarDefinition = [];
197
- const DefaultBlockToolbarDefinition = [ElementKinds.image];
201
+ const DefaultInlineToolbarDefinition = [
202
+ ToolbarActionTypes.clean,
203
+ ToolbarActionTypes.split,
204
+ MarkTypes.bold,
205
+ MarkTypes.italic,
206
+ MarkTypes.underline,
207
+ MarkTypes.strike,
208
+ MarkTypes.codeLine,
209
+ MarkTypes.color,
210
+ MarkTypes.backgroundColor,
211
+ ToolbarActionTypes.split,
212
+ ToolbarActionTypes.alignType,
213
+ ToolbarActionTypes.split,
214
+ ElementKinds.link
215
+ ];
216
+ const DefaultQuickToolbarDefinition = [
217
+ ...STANDARD_HEADING_TYPES,
218
+ ToolbarActionTypes.split,
219
+ ElementKinds.numberedList,
220
+ ElementKinds.bulletedList,
221
+ ElementKinds.checkItem,
222
+ ToolbarActionTypes.split,
223
+ ElementKinds.link,
224
+ ElementKinds.image,
225
+ ElementKinds.table,
226
+ ElementKinds.blockquote,
227
+ ElementKinds.hr,
228
+ ElementKinds.code
229
+ ];
198
230
  const ToolbarMoreGroup = {
199
231
  key: 'more',
200
232
  icon: 'more'
@@ -1008,7 +1040,10 @@ const extractFragment = (data, deleteKey = ELEMENT_UNIQUE_ID) => {
1008
1040
  const fragment = data.getData(`application/${CLIPBOARD_FORMAT_KEY}`);
1009
1041
  if (fragment) {
1010
1042
  const decoded = decodeURIComponent(window.atob(fragment));
1011
- const nodes = JSON.parse(decoded);
1043
+ let nodes = JSON.parse(decoded);
1044
+ if (!Array.isArray(nodes)) {
1045
+ nodes = [nodes];
1046
+ }
1012
1047
  // delete key to avoid duplicate keys
1013
1048
  if (deleteKey) {
1014
1049
  deleteElementKey(nodes, deleteKey);
@@ -1028,6 +1063,25 @@ function deleteElementKey(nodes, key) {
1028
1063
  });
1029
1064
  return nodes;
1030
1065
  }
1066
+ /**
1067
+ * 删除 text 节点的 颜色/背景色
1068
+ * @param node
1069
+ */
1070
+ function deleteColorAndBackgroundColorOfText(node) {
1071
+ node.children.forEach((child) => {
1072
+ if (Text.isText(child)) {
1073
+ if (child['color']) {
1074
+ delete child['color'];
1075
+ }
1076
+ if (child['background-color']) {
1077
+ delete child['background-color'];
1078
+ }
1079
+ }
1080
+ else {
1081
+ deleteColorAndBackgroundColorOfText(child);
1082
+ }
1083
+ });
1084
+ }
1031
1085
 
1032
1086
  const isAcrossBlocks = (editor, fragment) => {
1033
1087
  const startBlock = getStartBlock(editor, fragment[0]);
@@ -1140,7 +1194,7 @@ const getSelectionMarks = (editor) => {
1140
1194
  return marks;
1141
1195
  };
1142
1196
 
1143
- const isContainer = (editor, value) => Element$1.isElement(value) && editor.isContainer(value);
1197
+ const isContainer = (editor, value) => Element$1.isElement(value) && editor.isContainer && editor.isContainer(value);
1144
1198
 
1145
1199
  const getContainerBlocks = (editor) => {
1146
1200
  const containerNode = Editor.above(editor, {
@@ -1409,28 +1463,9 @@ const setEndSelection = (editor) => {
1409
1463
  AngularEditor.focus(editor);
1410
1464
  };
1411
1465
 
1412
- const insertTheElements = (editor, nodes) => {
1413
- if (Range.isExpanded(editor.selection)) {
1414
- Editor.deleteFragment(editor);
1415
- }
1416
- const isEmptyParagraph$1 = isEmptyParagraph(editor, editor.selection.anchor);
1417
- const parentPath = Path.parent(editor.selection.anchor.path);
1418
- Editor.withoutNormalizing(editor, () => {
1419
- Transforms.insertNodes(editor, nodes);
1420
- if (parentPath.length && isEmptyParagraph$1) {
1421
- Transforms.delete(editor, { at: parentPath });
1422
- const lastPath = parentPath.pop();
1423
- Transforms.select(editor, Editor.end(editor, [...parentPath, lastPath + nodes.length - 1]));
1424
- }
1425
- else {
1426
- const lastPath = parentPath.pop();
1427
- Transforms.select(editor, Editor.end(editor, [...parentPath, lastPath + nodes.length]));
1428
- }
1429
- });
1430
- };
1431
-
1432
1466
  const THE_EDITOR_UUID = new WeakMap();
1433
1467
  const THE_EDITOR_CONVERSION_HINT_REF = new WeakMap();
1468
+ const THE_EDITOR_QUICK_TOOLBAR_REF = new WeakMap();
1434
1469
 
1435
1470
  const closeConversionHint = (editor) => {
1436
1471
  const hintRef = THE_EDITOR_CONVERSION_HINT_REF.get(editor);
@@ -1492,7 +1527,6 @@ var index = /*#__PURE__*/Object.freeze({
1492
1527
  splitNode: splitNode,
1493
1528
  deleteElement: deleteElement,
1494
1529
  setEndSelection: setEndSelection,
1495
- insertTheElements: insertTheElements,
1496
1530
  closeConversionHint: closeConversionHint,
1497
1531
  handleContinualDeleteBackward: handleContinualDeleteBackward,
1498
1532
  handleContinualInsertBreak: handleContinualInsertBreak
@@ -1958,7 +1992,7 @@ const withDeserializeMd = (options) => (editor) => {
1958
1992
  editor.undo();
1959
1993
  setTimeout(() => {
1960
1994
  Transforms.select(editor, oldRange);
1961
- insertTheElements(editor, fragment);
1995
+ Transforms.insertFragment(editor, fragment);
1962
1996
  AngularEditor.focus(editor);
1963
1997
  });
1964
1998
  return;
@@ -2199,10 +2233,18 @@ class TheContextService {
2199
2233
  }
2200
2234
  getOptions() {
2201
2235
  if (!this.options.width) {
2202
- this.options.width = this.options.nativeElement.querySelector('.slate-editable-container').offsetWidth - 30;
2236
+ const firstElementChild = this.getFirstElementChild();
2237
+ this.options.width = firstElementChild.offsetWidth;
2203
2238
  }
2204
2239
  return this.options;
2205
2240
  }
2241
+ getEditableElement() {
2242
+ return this.options.nativeElement.querySelector('.the-editor-typo');
2243
+ }
2244
+ getFirstElementChild() {
2245
+ const editableElement = this.getEditableElement();
2246
+ return editableElement === null || editableElement === void 0 ? void 0 : editableElement.firstElementChild;
2247
+ }
2206
2248
  setUploadFileList(file) {
2207
2249
  this.fileList.push(file);
2208
2250
  }
@@ -2468,7 +2510,6 @@ const withImage = (editor) => {
2468
2510
  return element.type === ElementKinds.image || isVoid(element);
2469
2511
  };
2470
2512
  editor.insertData = (data) => {
2471
- // TODO:: 底层有点问题,粘贴多张图片时只能识别一张
2472
2513
  if (data.files.length) {
2473
2514
  const imageFiles = [];
2474
2515
  for (const file of data.files) {
@@ -2597,13 +2638,19 @@ const getListTypes = () => {
2597
2638
  return [ElementKinds.bulletedList, ElementKinds.numberedList];
2598
2639
  };
2599
2640
 
2641
+ /**
2642
+ * 获取 List 中 ListItems,过滤掉空列表嵌套
2643
+ * @param node
2644
+ * @param initialValue
2645
+ * @returns
2646
+ */
2600
2647
  const getStartListItem = (node, initialValue) => {
2601
2648
  if (!initialValue) {
2602
2649
  initialValue = [];
2603
2650
  }
2604
2651
  if (node) {
2605
2652
  return node.reduce((result, current) => {
2606
- if (current.type == ElementKinds.listItem && current.children[0].type === ElementKinds.default) {
2653
+ if ((current.type === ElementKinds.listItem && !getListTypes().includes(current.children[0].type))) {
2607
2654
  result.push(current);
2608
2655
  }
2609
2656
  else {
@@ -3257,6 +3304,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
3257
3304
  }]
3258
3305
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; } });
3259
3306
 
3307
+ /**
3308
+ * Is the selection in same li
3309
+ */
3310
+ const isSelectionInSameListItem = (editor) => {
3311
+ const { selection } = editor;
3312
+ if (!selection) {
3313
+ return false;
3314
+ }
3315
+ const [start, end] = Range.edges(selection);
3316
+ const startListItemEntry = getAboveByType(editor, ElementKinds.listItem, { at: start.path });
3317
+ const endListItemEntry = getAboveByType(editor, ElementKinds.listItem, { at: end.path });
3318
+ return startListItemEntry && endListItemEntry && Path.equals(startListItemEntry[1], endListItemEntry[1]);
3319
+ };
3320
+
3260
3321
  const withList = ({ validLiChildrenTypes } = {}) => (editor) => {
3261
3322
  const { insertBreak, deleteBackward, onKeydown, insertData, setFragmentData, renderElement } = editor;
3262
3323
  const resetBlockTypesListRule = {
@@ -3339,15 +3400,14 @@ const withList = ({ validLiChildrenTypes } = {}) => (editor) => {
3339
3400
  const fragmentElement = fragmentData[0];
3340
3401
  if (getListTypes().includes(fragmentElement.type)) {
3341
3402
  const startNodes = getStartListItem([fragmentElement.children[0]]);
3342
- // 复制列表中的图片时startNodes长度为零
3343
- if (startNodes.length === 0) {
3344
- setFragmentData(unit);
3345
- return;
3346
- }
3347
3403
  const children = startNodes.concat(fragmentElement.children.slice(1));
3348
- const fragmentNodes = [
3404
+ let fragmentNodes = [
3349
3405
  Object.assign(Object.assign({}, fragmentElement), { children })
3350
3406
  ];
3407
+ if (isSelectionInSameListItem(editor)) {
3408
+ // 仅仅复制列表中的内容
3409
+ fragmentNodes = children[0].children;
3410
+ }
3351
3411
  const fragment = fragmentNodes.concat(fragmentData.slice(1));
3352
3412
  const domRange = AngularEditor.toDOMRange(editor, selection);
3353
3413
  const contents = domRange.cloneContents();
@@ -5614,6 +5674,7 @@ class TheColorSelectComponent {
5614
5674
  }
5615
5675
  }
5616
5676
  _selectColor(event, color) {
5677
+ event.preventDefault();
5617
5678
  event.stopPropagation();
5618
5679
  if (this.option.specialColor && color === this.option.specialColor) {
5619
5680
  color = '';
@@ -5644,7 +5705,7 @@ class TheColorSelectComponent {
5644
5705
  }
5645
5706
  }
5646
5707
  TheColorSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheColorSelectComponent, deps: [{ token: i1$3.ThyPopoverRef }], target: i0.ɵɵFactoryTarget.Component });
5647
- TheColorSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheColorSelectComponent, selector: "the-color-select", inputs: { selectedColor: "selectedColor", selectAction: "selectAction", showCustom: "showCustom", colors: "colors", option: "option" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)", "mousedown": "handleMouseDown($event)", "keydown": "handleKeydown($event)" } }, ngImport: i0, template: "<div class=\"color-container\">\n <div class=\"colors\">\n <div *ngFor=\"let row of selectColors; let rowIndex = index\">\n <span\n class=\"color-item\"\n *ngFor=\"let _color of row.rowValue; let i = index\"\n [ngClass]=\"_color.classMaps\"\n (mousedown)=\"_selectColor($event, _color.value)\"\n >\n <span [ngStyle]=\"{ background: _color.value }\">\n <thy-icon\n thyIconName=\"check\"\n [ngStyle]=\"{ color: row.tickColor }\"\n ></thy-icon>\n </span>\n </span>\n </div>\n </div>\n <div\n *ngIf=\"option.showCustom\"\n class=\"select-color\"\n >\n <span\n class=\"color\"\n [ngStyle]=\"{ background: selectedColor }\"\n ></span>\n #\n <input\n thyInput\n maxlength=\"6\"\n (keydown.enter)=\"customInputColorEnter($event)\"\n onkeyup=\"value=value.replace(/[^0-9A-Fa-f]/g,'')\"\n class=\"value\"\n [(ngModel)]=\"customColor\"\n (ngModelChange)=\"colorChange(false)\"\n />\n </div>\n</div>\n", components: [{ type: i4$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], directives: [{ type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i5.ThyInputDirective, selector: "[thyInput]", inputs: ["thySize", "thyAutocomplete"] }, { type: i4$2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { type: i4$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
5708
+ TheColorSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheColorSelectComponent, selector: "the-color-select", inputs: { selectedColor: "selectedColor", selectAction: "selectAction", showCustom: "showCustom", colors: "colors", option: "option" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)", "mousedown": "handleMouseDown($event)", "keydown": "handleKeydown($event)" } }, ngImport: i0, template: "<div class=\"color-container\">\n <div class=\"colors\">\n <div *ngFor=\"let row of selectColors; let rowIndex = index\">\n <span\n class=\"color-item\"\n *ngFor=\"let _color of row.rowValue; let i = index\"\n [ngClass]=\"_color.classMaps\"\n (mousedown)=\"_selectColor($event, _color.value)\"\n >\n <span [ngStyle]=\"{ background: _color.value }\">\n <thy-icon thyIconName=\"check\" [ngStyle]=\"{ color: row.tickColor }\"></thy-icon>\n </span>\n </span>\n </div>\n </div>\n <div *ngIf=\"option.showCustom\" class=\"select-color\">\n <span class=\"color\" [ngStyle]=\"{ background: selectedColor }\"></span>\n #\n <input\n thyInput\n maxlength=\"6\"\n (keydown.enter)=\"customInputColorEnter($event)\"\n onkeyup=\"value=value.replace(/[^0-9A-Fa-f]/g,'')\"\n class=\"value\"\n [(ngModel)]=\"customColor\"\n (ngModelChange)=\"colorChange(false)\"\n />\n </div>\n</div>\n", components: [{ type: i4$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], directives: [{ type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i5.ThyInputDirective, selector: "[thyInput]", inputs: ["thySize", "thyAutocomplete"] }, { type: i4$2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { type: i4$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
5648
5709
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheColorSelectComponent, decorators: [{
5649
5710
  type: Component,
5650
5711
  args: [{
@@ -5760,9 +5821,10 @@ const ColorEditor = {
5760
5821
 
5761
5822
  class TheToolbarBaseItemComponent {
5762
5823
  execute(event) {
5824
+ var _a;
5763
5825
  event.preventDefault();
5764
5826
  event.stopPropagation();
5765
- if (!this.itemMousedownHandle && !this.editor.selection) {
5827
+ if (!this.itemMousedownHandle && !((_a = this.editor) === null || _a === void 0 ? void 0 : _a.selection)) {
5766
5828
  const lastNode = getLastNode(this.editor, 1);
5767
5829
  const end = Editor.end(this.editor, lastNode[1]);
5768
5830
  Transforms.select(this.editor, end);
@@ -6717,6 +6779,7 @@ const withLink = (editor) => {
6717
6779
  editor.insertText = text => {
6718
6780
  if (text && isUrl(text)) {
6719
6781
  LinkEditor.wrapLink(editor, text, text);
6782
+ Transforms.move(editor, { distance: 1, unit: "offset" });
6720
6783
  }
6721
6784
  else {
6722
6785
  insertText(text);
@@ -6724,8 +6787,10 @@ const withLink = (editor) => {
6724
6787
  };
6725
6788
  editor.insertData = data => {
6726
6789
  const text = data.getData('text/plain');
6727
- if (text && isUrl(text)) {
6790
+ const fragment = data.getData(`application/${CLIPBOARD_FORMAT_KEY}`);
6791
+ if (text && isUrl(text) && !fragment) {
6728
6792
  LinkEditor.wrapLink(editor, text, text);
6793
+ Transforms.move(editor, { distance: 1, unit: "offset" });
6729
6794
  }
6730
6795
  else {
6731
6796
  insertData(data);
@@ -7557,18 +7622,38 @@ function setCellMenuInvisibility(editor, menuList, selectedCells, isActiveSelect
7557
7622
  }
7558
7623
 
7559
7624
  class NavSplitLineComponent {
7560
- constructor() { }
7625
+ constructor() {
7626
+ this.mode = ToolbarItemMode.vertical;
7627
+ this.theNavSplitLine = true;
7628
+ }
7629
+ get horizontal() {
7630
+ return this.mode === ToolbarItemMode.horizontal;
7631
+ }
7632
+ get vertical() {
7633
+ return this.mode === ToolbarItemMode.vertical;
7634
+ }
7561
7635
  ngOnInit() { }
7562
7636
  }
7563
7637
  NavSplitLineComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: NavSplitLineComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
7564
- NavSplitLineComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: NavSplitLineComponent, selector: "nav-split-line", ngImport: i0, template: '', isInline: true });
7638
+ NavSplitLineComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: NavSplitLineComponent, selector: "nav-split-line", inputs: { mode: "mode" }, host: { properties: { "class.the-nav-split-line": "this.theNavSplitLine", "class.horizontal": "this.horizontal", "class.vertical": "this.vertical" } }, ngImport: i0, template: '', isInline: true });
7565
7639
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: NavSplitLineComponent, decorators: [{
7566
7640
  type: Component,
7567
7641
  args: [{
7568
7642
  selector: 'nav-split-line',
7569
7643
  template: ''
7570
7644
  }]
7571
- }], ctorParameters: function () { return []; } });
7645
+ }], ctorParameters: function () { return []; }, propDecorators: { mode: [{
7646
+ type: Input
7647
+ }], theNavSplitLine: [{
7648
+ type: HostBinding,
7649
+ args: ['class.the-nav-split-line']
7650
+ }], horizontal: [{
7651
+ type: HostBinding,
7652
+ args: ['class.horizontal']
7653
+ }], vertical: [{
7654
+ type: HostBinding,
7655
+ args: ['class.vertical']
7656
+ }] } });
7572
7657
 
7573
7658
  class TheTableToolbarComponent {
7574
7659
  constructor(ngZone, colorSelectService, popoverRef) {
@@ -7680,7 +7765,7 @@ class TheTableToolbarComponent {
7680
7765
  }
7681
7766
  }
7682
7767
  TheTableToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheTableToolbarComponent, deps: [{ token: i0.NgZone }, { token: TheColorSelectService }, { token: i1$3.ThyPopoverRef }], target: i0.ɵɵFactoryTarget.Component });
7683
- TheTableToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheTableToolbarComponent, selector: "the-table-toolbar", inputs: { tableStore: "tableStore", isActiveSelect: "isActiveSelect" }, ngImport: i0, template: "<thy-icon-nav>\n <ng-container *ngFor=\"let item of cellMenuList\">\n <a href=\"javascript:;\" thyIconNavLink *ngIf=\"!item.invisibility\" [thyTooltip]=\"item.name\" (mousedown)=\"item.actionHandle()\">\n <thy-icon [thyIconName]=\"item.icon\"></thy-icon>\n </a>\n </ng-container>\n <nav-split-line *ngIf=\"!isActiveSelect && isShowSplitLine\"></nav-split-line>\n <a href=\"javascript:;\" thyIconNavLink thyTooltip=\"\u5355\u5143\u683C\u80CC\u666F\" (mousedown)=\"openSelectColor($event)\">\n <thy-icon thyIconName=\"background-tt\" thyIconType=\"twotone\" [thyTwotoneColor]=\"selectedColor\"></thy-icon>\n </a>\n <nav-split-line *ngIf=\"deleteIcon\"></nav-split-line>\n <a\n *ngIf=\"deleteIcon\"\n href=\"javascript:;\"\n thyIconNavLink\n [thyTooltip]=\"iconName\"\n class=\"danger\"\n [thyIconNavLinkIcon]=\"deleteIcon\"\n (mousedown)=\"onDelete($event)\"\n (mouseenter)=\"onEnterDelete($event)\"\n (mouseleave)=\"onLeaveDelete($event)\"\n ></a>\n</thy-icon-nav>\n", components: [{ type: i2.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }, { type: i2.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: NavSplitLineComponent, selector: "nav-split-line" }], directives: [{ type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
7768
+ TheTableToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheTableToolbarComponent, selector: "the-table-toolbar", inputs: { tableStore: "tableStore", isActiveSelect: "isActiveSelect" }, ngImport: i0, template: "<thy-icon-nav>\n <ng-container *ngFor=\"let item of cellMenuList\">\n <a href=\"javascript:;\" thyIconNavLink *ngIf=\"!item.invisibility\" [thyTooltip]=\"item.name\" (mousedown)=\"item.actionHandle()\">\n <thy-icon [thyIconName]=\"item.icon\"></thy-icon>\n </a>\n </ng-container>\n <nav-split-line *ngIf=\"!isActiveSelect && isShowSplitLine\"></nav-split-line>\n <a href=\"javascript:;\" thyIconNavLink thyTooltip=\"\u5355\u5143\u683C\u80CC\u666F\" (mousedown)=\"openSelectColor($event)\">\n <thy-icon thyIconName=\"background-tt\" thyIconType=\"twotone\" [thyTwotoneColor]=\"selectedColor\"></thy-icon>\n </a>\n <nav-split-line *ngIf=\"deleteIcon\"></nav-split-line>\n <a\n *ngIf=\"deleteIcon\"\n href=\"javascript:;\"\n thyIconNavLink\n [thyTooltip]=\"iconName\"\n class=\"danger\"\n [thyIconNavLinkIcon]=\"deleteIcon\"\n (mousedown)=\"onDelete($event)\"\n (mouseenter)=\"onEnterDelete($event)\"\n (mouseleave)=\"onLeaveDelete($event)\"\n ></a>\n</thy-icon-nav>\n", components: [{ type: i2.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }, { type: i2.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: NavSplitLineComponent, selector: "nav-split-line", inputs: ["mode"] }], directives: [{ type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
7684
7769
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheTableToolbarComponent, decorators: [{
7685
7770
  type: Component,
7686
7771
  args: [{
@@ -8329,9 +8414,12 @@ class TheTableComponent extends TheBaseElementComponent {
8329
8414
  useRowControls() {
8330
8415
  if (this.selection) {
8331
8416
  this.rowControls = this.calculateRowControls();
8332
- this.cdr.detectChanges();
8417
+ this.cdr.markForCheck();
8333
8418
  }
8334
8419
  }
8420
+ detectChanges() {
8421
+ this.cdr.detectChanges();
8422
+ }
8335
8423
  calculateMinRowSpanCellForRows() {
8336
8424
  const table = this.element;
8337
8425
  const cells = table.children.map((row, index) => {
@@ -8593,7 +8681,7 @@ TheTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", vers
8593
8681
  provide: TheTableToken,
8594
8682
  useExisting: TheTableComponent
8595
8683
  }
8596
- ], viewQueries: [{ propertyName: "tableWrapper", first: true, predicate: ["tableWrapper"], descendants: true, read: ElementRef, static: true }, { propertyName: "theTableElement", first: true, predicate: ["theTable"], descendants: true, read: ElementRef, static: true }, { propertyName: "tbodyElement", first: true, predicate: ["tbody"], descendants: true, read: ElementRef, static: true }], usesInheritance: true, ngImport: i0, template: "<div\n class=\"the-table-container\"\n theColumnResize\n [ngClass]=\"{\n 'the-table-with-controls': isInTable,\n 'the-table-selection-hide': tableStore.isCellSelecting || tableStore.isRightClicking\n }\"\n>\n <div class=\"the-table-row-controls-wrapper\" *ngIf=\"!readonly\">\n <div>\n <div\n class=\"the-table-corner-controls\"\n [ngClass]=\"{ active: isSelectedAllCell, dangerous: tableStore.isSelectedTable && tableStore.dangerousCells.length > 0 }\"\n >\n <button type=\"button\" class=\"the-table-corner-button\" (mousedown)=\"onSelectTable($event)\"></button>\n <div class=\"the-table-corner-controls-insert-row-marker\">\n <the-table-insert-mark type=\"row\" [at]=\"0\" [tableStore]=\"tableStore\"></the-table-insert-mark>\n </div>\n <div class=\"the-table-corner-controls-insert-column-marker\">\n <the-table-insert-mark type=\"column\" [at]=\"0\" [tableStore]=\"tableStore\"></the-table-insert-mark>\n </div>\n </div>\n <div class=\"the-table-row-controls\">\n <div class=\"the-table-row-controls-inner\">\n <div\n class=\"the-table-row-controls-button-wrap\"\n *ngFor=\"let control of rowControls; let i = index; trackBy: trackByFnRowCotrols\"\n [ngClass]=\"{\n active: tableStore.selectedRowsIndex.includes(control.rowIndex),\n dangerous: tableStore.dangerousRowsIndex.includes(control.rowIndex) && tableStore.dangerousCells.length > 0\n }\"\n >\n <button\n (mousedown)=\"onRowMouseDown($event, control.rowIndex)\"\n type=\"button\"\n [ngStyle]=\"{ height: control.height + 1 + 'px' }\"\n class=\"the-table-row-controls-button the-table-controls-button\"\n ></button>\n <the-table-insert-mark type=\"row\" [at]=\"control.rowIndex + 1\" [tableStore]=\"tableStore\"></the-table-insert-mark>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"the-table-wrapper\" #tableWrapper>\n <table class=\"the-table\" #theTable [ngClass]=\"{ 'the-table-with-controls': isInTable }\">\n <colgroup *ngIf=\"columns\">\n <col *ngFor=\"let col of columns\" [ngStyle]=\"{ width: col.width + 'px' }\" />\n </colgroup>\n <thead>\n <tr class=\"the-table-col-controls-wrapper\">\n <th\n class=\"the-table-col-controls\"\n (mousedown)=\"onColMouseDown($event, i)\"\n *ngFor=\"let control of colControls; let i = index; trackBy: trackByFnColCotrols\"\n >\n <the-table-insert-mark\n *ngIf=\"isInTable\"\n type=\"column\"\n [at]=\"i + 1\"\n [tableStore]=\"tableStore\"\n ></the-table-insert-mark>\n <div\n class=\"the-table-col-controls-inner\"\n [ngClass]=\"{\n active: tableStore.selectedColumnsIndex.includes(i),\n dangerous: tableStore.dangerousColumnsIndex.includes(i) && tableStore.dangerousCells.length > 0\n }\"\n ></div>\n </th>\n </tr>\n </thead>\n <tbody #tbody>\n <slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"> </slate-children>\n </tbody>\n </table>\n </div>\n</div>\n", components: [{ type: TheInsertMarkComponent, selector: "the-table-insert-mark", inputs: ["type", "at", "tableStore"] }, { type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }], directives: [{ type: TheColumnResizeDirective, selector: "div[theColumnResize]" }, { type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
8684
+ ], viewQueries: [{ propertyName: "tableWrapper", first: true, predicate: ["tableWrapper"], descendants: true, read: ElementRef, static: true }, { propertyName: "theTableElement", first: true, predicate: ["theTable"], descendants: true, read: ElementRef, static: true }, { propertyName: "tbodyElement", first: true, predicate: ["tbody"], descendants: true, read: ElementRef, static: true }], usesInheritance: true, ngImport: i0, template: "<div\n class=\"the-table-container\"\n theColumnResize\n [ngClass]=\"{\n 'the-table-with-controls': isInTable,\n 'the-table-selection-hide': tableStore.isCellSelecting || tableStore.isRightClicking\n }\"\n>\n <div class=\"the-table-row-controls-wrapper\" *ngIf=\"!readonly && isInTable\">\n <div>\n <div\n class=\"the-table-corner-controls\"\n [ngClass]=\"{ active: isSelectedAllCell, dangerous: tableStore.isSelectedTable && tableStore.dangerousCells.length > 0 }\"\n >\n <button type=\"button\" class=\"the-table-corner-button\" (mousedown)=\"onSelectTable($event)\"></button>\n <div class=\"the-table-corner-controls-insert-row-marker\">\n <the-table-insert-mark type=\"row\" [at]=\"0\" [tableStore]=\"tableStore\"></the-table-insert-mark>\n </div>\n <div class=\"the-table-corner-controls-insert-column-marker\">\n <the-table-insert-mark type=\"column\" [at]=\"0\" [tableStore]=\"tableStore\"></the-table-insert-mark>\n </div>\n </div>\n <div class=\"the-table-row-controls\">\n <div class=\"the-table-row-controls-inner\">\n <div\n class=\"the-table-row-controls-button-wrap\"\n *ngFor=\"let control of rowControls; let i = index; trackBy: trackByFnRowCotrols\"\n [ngClass]=\"{\n active: tableStore.selectedRowsIndex.includes(control.rowIndex),\n dangerous: tableStore.dangerousRowsIndex.includes(control.rowIndex) && tableStore.dangerousCells.length > 0\n }\"\n >\n <button\n (mousedown)=\"onRowMouseDown($event, control.rowIndex)\"\n type=\"button\"\n [ngStyle]=\"{ height: control.height + 1 + 'px' }\"\n class=\"the-table-row-controls-button the-table-controls-button\"\n ></button>\n <the-table-insert-mark type=\"row\" [at]=\"control.rowIndex + 1\" [tableStore]=\"tableStore\"></the-table-insert-mark>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"the-table-wrapper\" #tableWrapper>\n <table class=\"the-table\" #theTable [ngClass]=\"{ 'the-table-with-controls': isInTable }\">\n <colgroup *ngIf=\"columns\">\n <col *ngFor=\"let col of columns\" [ngStyle]=\"{ width: col.width + 'px' }\" />\n </colgroup>\n <thead>\n <tr class=\"the-table-col-controls-wrapper\">\n <th\n class=\"the-table-col-controls\"\n (mousedown)=\"onColMouseDown($event, i)\"\n *ngFor=\"let control of colControls; let i = index; trackBy: trackByFnColCotrols\"\n >\n <the-table-insert-mark\n *ngIf=\"isInTable\"\n type=\"column\"\n [at]=\"i + 1\"\n [tableStore]=\"tableStore\"\n ></the-table-insert-mark>\n <div\n class=\"the-table-col-controls-inner\"\n [ngClass]=\"{\n active: tableStore.selectedColumnsIndex.includes(i),\n dangerous: tableStore.dangerousColumnsIndex.includes(i) && tableStore.dangerousCells.length > 0\n }\"\n ></div>\n </th>\n </tr>\n </thead>\n <tbody #tbody>\n <slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"> </slate-children>\n </tbody>\n </table>\n </div>\n</div>\n", components: [{ type: TheInsertMarkComponent, selector: "the-table-insert-mark", inputs: ["type", "at", "tableStore"] }, { type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }], directives: [{ type: TheColumnResizeDirective, selector: "div[theColumnResize]" }, { type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
8597
8685
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheTableComponent, decorators: [{
8598
8686
  type: Component,
8599
8687
  args: [{
@@ -8677,11 +8765,13 @@ class TheTableRowComponent extends TheBaseElementComponent {
8677
8765
  super.onContextChange();
8678
8766
  if (this.initialized) {
8679
8767
  this.useBackground();
8768
+ this.useHeight();
8680
8769
  }
8681
8770
  }
8682
8771
  ngOnInit() {
8683
8772
  super.ngOnInit();
8684
8773
  this.useBackground();
8774
+ this.useHeight();
8685
8775
  }
8686
8776
  useBackground() {
8687
8777
  if (this.element.header && !this.backgroundColor) {
@@ -9426,6 +9516,7 @@ class TheTdComponent extends TheBaseElementComponent {
9426
9516
  this.applyRowSize(deltaSize);
9427
9517
  }
9428
9518
  this.tableComponent.useRowControls();
9519
+ this.tableComponent.detectChanges();
9429
9520
  this.updateOverlayHandleSizeAndOffset();
9430
9521
  }
9431
9522
  _createOverlayForHandle() {
@@ -9681,6 +9772,36 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
9681
9772
  args: ['cellInner', { static: true }]
9682
9773
  }] } });
9683
9774
 
9775
+ const normalizeTable = (table) => {
9776
+ const normalizedNodes = [];
9777
+ const rowHeight = table.children.length;
9778
+ const columnWidth = table.children[0].children.length;
9779
+ table.children.forEach((row, rowIndex) => {
9780
+ row.children.forEach((cell, columnIndex) => {
9781
+ // case 1
9782
+ if (cell.colspan || cell.rowspan) {
9783
+ const rowspan = cell.rowspan || 1;
9784
+ const colspan = cell.colspan || 1;
9785
+ if (rowspan > rowHeight - rowIndex) {
9786
+ cell.rowspan = rowHeight - rowIndex;
9787
+ }
9788
+ if (colspan > columnWidth - columnIndex) {
9789
+ cell.colspan = columnWidth - columnIndex;
9790
+ }
9791
+ return;
9792
+ }
9793
+ // case 2
9794
+ if (cell.hidden && !normalizedNodes.includes(cell)) {
9795
+ const origin = calcOriginSpan(table, rowIndex, columnIndex);
9796
+ if (!origin) {
9797
+ delete table.children[rowIndex].children[columnIndex].hidden;
9798
+ }
9799
+ }
9800
+ });
9801
+ });
9802
+ return table;
9803
+ };
9804
+
9684
9805
  const withTable = (editor) => {
9685
9806
  const { deleteBackward, deleteForward, onKeydown, setFragmentData, insertData, normalizeNode, isBlockCard, renderElement, deleteCutData, isContainer } = editor;
9686
9807
  editor.deleteBackward = unit => {
@@ -9858,67 +9979,45 @@ const withTable = (editor) => {
9858
9979
  return;
9859
9980
  }
9860
9981
  const { selection } = editor;
9861
- const element = TablePosition.create(opts, editor, selection.anchor.path);
9862
- const tableComponent = ELEMENT_TO_COMPONENT.get(element.table);
9982
+ const tablePosition = TablePosition.create(opts, editor, selection.anchor.path);
9983
+ const tableComponent = ELEMENT_TO_COMPONENT.get(tablePosition.table);
9863
9984
  const cells = tableComponent.tableStore.selectedCells;
9864
- const tableContent = {};
9865
- let contents;
9866
- let cellNode;
9867
- let fragment;
9868
- if (cells.length > 0) {
9869
- const selectNodes = getSelectCellNode(editor, cells);
9870
- const selectedColumnsIndex = tableComponent.tableStore.selectedColumnsIndex || [];
9871
- const selectedRowsIndex = tableComponent.tableStore.selectedRowsIndex || [];
9985
+ let tableFragment = null;
9986
+ if (tableComponent.tableStore.selectedRowsIndex.length > 0) {
9987
+ const rows = tablePosition.table.children.slice(tableComponent.tableStore.selectedRowsIndex[0], tableComponent.tableStore.selectedRowsIndex[tableComponent.tableStore.selectedRowsIndex.length - 1] + 1);
9988
+ tableFragment = Object.assign(Object.assign({}, tablePosition.table), { children: rows });
9989
+ }
9990
+ else if (cells.length > 0) {
9991
+ const tempRows = {};
9872
9992
  for (const cell of cells) {
9873
9993
  const { row, col } = cell;
9874
- const cellPath = [...element.tableEntry[1], row, col];
9875
- cellNode = Node.get(editor, cellPath);
9876
- const cellRange = Editor.range(editor, cellPath);
9877
- const domRange = AngularEditor.toDOMRange(editor, cellRange);
9878
- if (!contents) {
9879
- contents = domRange.cloneContents();
9880
- }
9881
- else {
9882
- contents.append(domRange.cloneContents());
9883
- }
9884
- if ((selectedColumnsIndex.length === 1 && cellNode.colspan > 1) ||
9885
- (selectedRowsIndex.length === 1 && cellNode.rowspan > 1)) {
9886
- cellNode = Object.assign(Object.assign({}, cellNode), { colspan: selectedColumnsIndex.length === 1 ? null : cellNode.colspan, rowspan: selectedRowsIndex.length === 1 ? null : cellNode.rowspan });
9887
- }
9888
- if (cellNode.hidden) {
9889
- const origin = calcOriginSpan(element.table, row, col);
9890
- const selectedOrigin = origin && selectNodes.filter(item => item.node.key === origin.key);
9891
- if (!selectedOrigin || !selectedOrigin.length) {
9892
- cellNode = Object.assign(Object.assign({}, cellNode), { hidden: null });
9893
- }
9894
- }
9895
- if (!tableContent[row]) {
9896
- tableContent[row] = [];
9994
+ const cellPath = [...tablePosition.tableEntry[1], row, col];
9995
+ const cellNode = Node.get(editor, cellPath);
9996
+ if (!tempRows[row]) {
9997
+ tempRows[row] = [];
9897
9998
  }
9898
- tableContent[row].push(cellNode);
9999
+ tempRows[row].push(cellNode);
9899
10000
  }
9900
- const tableFragment = [
10001
+ const rows = Object.values(tempRows).map((item) => {
10002
+ return {
10003
+ type: ElementKinds.tableRow,
10004
+ children: item
10005
+ };
10006
+ });
10007
+ tableFragment =
9901
10008
  {
9902
10009
  type: ElementKinds.table,
9903
- children: Object.values(tableContent).map((item) => {
9904
- return {
9905
- type: ElementKinds.tableRow,
9906
- children: item
9907
- };
9908
- })
9909
- }
9910
- ];
9911
- fragment = tableFragment;
9912
- const stringObj = JSON.stringify(fragment);
10010
+ children: rows
10011
+ };
10012
+ }
10013
+ if (tableFragment) {
10014
+ tableFragment = normalizeTable(_.cloneDeep(tableFragment));
10015
+ tableFragment = [tableFragment];
10016
+ const stringObj = JSON.stringify(tableFragment);
9913
10017
  const encoded = window.btoa(encodeURIComponent(stringObj));
9914
10018
  unit.setData(`application/${CLIPBOARD_FORMAT_KEY}`, encoded);
9915
- const div = document.createElement('div');
9916
- div.appendChild(contents);
9917
- div.setAttribute('hidden', 'true');
9918
- document.body.appendChild(div);
9919
- unit.setData('text/html', div.innerHTML);
9920
- unit.setData('text/plain', getPlainText$1(div));
9921
- document.body.removeChild(div);
10019
+ // unit.setData('text/html', div.innerHTML);
10020
+ unit.setData('text/plain', Node.string(tableFragment));
9922
10021
  return;
9923
10022
  }
9924
10023
  setFragmentData(unit);
@@ -10077,7 +10176,14 @@ const withDeserializeHMTL = (editor) => {
10077
10176
  if (html && !slateFragment) {
10078
10177
  const htmlDom = new DOMParser().parseFromString(html, 'text/html');
10079
10178
  const fragment = TheiaConverter.convertToTheia(Array.from(htmlDom.body.children));
10080
- insertTheElements(editor, fragment);
10179
+ // 无法识别HTML内容时后退一下:识别纯文本
10180
+ if (fragment.length === 1 && Editor.isEmpty(editor, fragment[0]) && fragment[0].type === ElementKinds.paragraph) {
10181
+ insertData(data);
10182
+ return;
10183
+ }
10184
+ // 过滤 text 节点的 color/background-color 属性
10185
+ fragment.forEach((node) => deleteColorAndBackgroundColorOfText(node));
10186
+ Transforms.insertFragment(editor, fragment);
10081
10187
  return;
10082
10188
  }
10083
10189
  insertData(data);
@@ -10227,6 +10333,383 @@ const VerticalAlignOptions = [
10227
10333
  }
10228
10334
  ];
10229
10335
 
10336
+ const PaintFormatEditor = {
10337
+ formatBrush(editor) {
10338
+ const contextService = editor.injector.get(TheContextService);
10339
+ const obj = {};
10340
+ for (const key of MarkProps) {
10341
+ const k = contextService.paintFormatStatus.marks[key];
10342
+ obj[key] = k || null;
10343
+ }
10344
+ const block = anchorBlock(editor);
10345
+ if (block && Range.isCollapsed(editor.selection)) {
10346
+ // TODO:: 在撤销时有bug, 临时使用withoutSaving处理
10347
+ HistoryEditor.withoutSaving(editor, () => {
10348
+ const path = TheEditor.findPath(editor, block);
10349
+ setMarks(editor, obj, path);
10350
+ });
10351
+ }
10352
+ else {
10353
+ setMarks(editor, obj);
10354
+ }
10355
+ PaintFormatEditor.cancelFormatBrushStatus(editor);
10356
+ },
10357
+ isActive(editor) {
10358
+ const contextService = editor.injector.get(TheContextService);
10359
+ const res = contextService.paintFormatStatus.isActive;
10360
+ return res;
10361
+ },
10362
+ enableFormatBrush(editor) {
10363
+ const contextService = editor.injector.get(TheContextService);
10364
+ if (contextService.paintFormatStatus.isActive) {
10365
+ return PaintFormatEditor.cancelFormatBrushStatus(editor);
10366
+ }
10367
+ contextService.paintFormatStatus = {
10368
+ isActive: true,
10369
+ marks: getSelectionMarks(editor)
10370
+ };
10371
+ const element = EDITOR_TO_ELEMENT.get(editor);
10372
+ element.classList.add('pointer-paint');
10373
+ contextService.onMouseUp$
10374
+ .pipe(skip(1), filter(event => element.contains(event.target)), take(1))
10375
+ .subscribe((event) => {
10376
+ if (contextService.paintFormatStatus.isActive) {
10377
+ PaintFormatEditor.formatBrush(editor);
10378
+ }
10379
+ });
10380
+ editor.onChange();
10381
+ },
10382
+ cancelFormatBrushStatus(editor) {
10383
+ const contextService = editor.injector.get(TheContextService);
10384
+ contextService.paintFormatStatus = {
10385
+ isActive: false,
10386
+ marks: {}
10387
+ };
10388
+ const element = EDITOR_TO_ELEMENT.get(editor);
10389
+ element.classList.remove('pointer-paint');
10390
+ editor.onChange();
10391
+ }
10392
+ };
10393
+
10394
+ const PaintFormatOptions = [
10395
+ {
10396
+ key: ToolbarActionTypes.undo,
10397
+ icon: 'undo',
10398
+ name: '撤销',
10399
+ execute: (editor) => editor.undo()
10400
+ },
10401
+ {
10402
+ key: ToolbarActionTypes.redo,
10403
+ icon: 'redo',
10404
+ name: '重做',
10405
+ execute: (editor) => editor.redo()
10406
+ },
10407
+ {
10408
+ key: ToolbarActionTypes.paintformat,
10409
+ icon: 'paintformat',
10410
+ name: '格式刷',
10411
+ execute: PaintFormatEditor.enableFormatBrush,
10412
+ active: PaintFormatEditor.isActive
10413
+ },
10414
+ {
10415
+ key: ToolbarActionTypes.clean,
10416
+ icon: 'clean',
10417
+ name: '清除格式',
10418
+ execute: (editor) => {
10419
+ const { selection } = editor;
10420
+ if (!selection) {
10421
+ return;
10422
+ }
10423
+ if (TableEditor.clearMark(editor)) {
10424
+ return;
10425
+ }
10426
+ if (Range.isCollapsed(selection)) {
10427
+ const marks = Editor.marks(editor);
10428
+ for (const key of Object.keys(marks)) {
10429
+ Editor.removeMark(editor, key);
10430
+ }
10431
+ }
10432
+ else {
10433
+ const unsetMarks = {};
10434
+ MarkProps.forEach(key => {
10435
+ unsetMarks[key] = null;
10436
+ });
10437
+ setMarks(editor, unsetMarks);
10438
+ }
10439
+ }
10440
+ }
10441
+ ];
10442
+
10443
+ /**
10444
+ * whether the current node is a clean paragraph
10445
+ * @param editor
10446
+ * @param text
10447
+ * @returns boolean
10448
+ */
10449
+ const isCleanEmptyParagraph = (editor) => {
10450
+ const isCollapsedCursor = TheEditor.isFocused(editor) && editor.selection && Range.isCollapsed(editor.selection);
10451
+ if (!isCollapsedCursor) {
10452
+ return false;
10453
+ }
10454
+ const block = Node.ancestor(editor, [editor.selection.anchor.path[0]]);
10455
+ const textIndent = 'textIndent';
10456
+ const align = 'align';
10457
+ const hasTextIndent = block[textIndent];
10458
+ const hasAlign = block[align];
10459
+ if (Node.string(block) === '' &&
10460
+ Element$1.isElement(block) &&
10461
+ block.type === ElementKinds.paragraph &&
10462
+ block.children.length === 1 &&
10463
+ Text.isText(block.children[0]) &&
10464
+ !Editor.isVoid(editor, block) &&
10465
+ !hasTextIndent &&
10466
+ !hasAlign) {
10467
+ return true;
10468
+ }
10469
+ return false;
10470
+ };
10471
+
10472
+ class TheToolbarItemComponent extends TheToolbarBaseItemComponent {
10473
+ constructor(ngZone, cfr) {
10474
+ super();
10475
+ this.ngZone = ngZone;
10476
+ this.cfr = cfr;
10477
+ this.itemMode = ToolbarItemMode.horizontal;
10478
+ this.ToolbarItemMode = ToolbarItemMode;
10479
+ this.active = false;
10480
+ }
10481
+ ngOnInit() {
10482
+ var _a, _b;
10483
+ if (((_a = this.item) === null || _a === void 0 ? void 0 : _a.quickItemComponent) && isComponentType((_b = this.item) === null || _b === void 0 ? void 0 : _b.quickItemComponent)) {
10484
+ this.renderToolbarItem();
10485
+ }
10486
+ }
10487
+ statusChange(editor) {
10488
+ var _a, _b;
10489
+ this.active = ((_a = this.item) === null || _a === void 0 ? void 0 : _a.active) ? (_b = this.item) === null || _b === void 0 ? void 0 : _b.active(editor) : false;
10490
+ }
10491
+ execute(event) {
10492
+ var _a, _b, _c;
10493
+ super.execute(event);
10494
+ if (!((_a = this.item) === null || _a === void 0 ? void 0 : _a.execute) || ((_b = this.editor) === null || _b === void 0 ? void 0 : _b.disabled)) {
10495
+ return;
10496
+ }
10497
+ (_c = this.item) === null || _c === void 0 ? void 0 : _c.execute(this.editor);
10498
+ }
10499
+ renderToolbarItem() {
10500
+ this.ngZone.run(() => {
10501
+ const toolbarItemFactory = this.cfr.resolveComponentFactory(this.item.quickItemComponent);
10502
+ const tollbarItemRef = this.toolbarContainer.createComponent(toolbarItemFactory);
10503
+ tollbarItemRef.instance.editor = this.editor;
10504
+ tollbarItemRef.instance.item = this.item;
10505
+ tollbarItemRef.instance.itemMode = ToolbarItemMode.vertical;
10506
+ });
10507
+ }
10508
+ }
10509
+ TheToolbarItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarItemComponent, deps: [{ token: i0.NgZone }, { token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Component });
10510
+ TheToolbarItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheToolbarItemComponent, selector: "the-toolbar-item", inputs: { item: "item", editor: "editor", itemMode: "itemMode" }, host: { classAttribute: "the-toolbar-item" }, viewQueries: [{ propertyName: "toolbarContainer", first: true, predicate: ["toolbarContainer"], descendants: true, read: ViewContainerRef, static: true }], usesInheritance: true, ngImport: i0, template: `
10511
+ <ng-container *ngIf="itemMode === ToolbarItemMode.horizontal; else selectionItem">
10512
+ <a
10513
+ thyIconNavLink
10514
+ [thyIconNavLinkIcon]="item.icon"
10515
+ [thyTooltip]="item.name"
10516
+ thyTooltipPlacement="top"
10517
+ [thyIconNavLinkActive]="active"
10518
+ (mousedown)="execute($event)"
10519
+ ></a>
10520
+ </ng-container>
10521
+ <ng-template #selectionItem>
10522
+ <ng-container *ngIf="!item?.quickItemComponent">
10523
+ <thy-icon [thyIconName]="item?.icon" [thyIconRotate]="0" class="quick-toolbar-icon"></thy-icon>
10524
+ <span class="quick-toolbar-name">{{ item?.name }}</span>
10525
+ </ng-container>
10526
+ </ng-template>
10527
+ <ng-container #toolbarContainer></ng-container>
10528
+ `, isInline: true, components: [{ type: i2.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], directives: [{ type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
10529
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarItemComponent, decorators: [{
10530
+ type: Component,
10531
+ args: [{
10532
+ selector: 'the-toolbar-item',
10533
+ template: `
10534
+ <ng-container *ngIf="itemMode === ToolbarItemMode.horizontal; else selectionItem">
10535
+ <a
10536
+ thyIconNavLink
10537
+ [thyIconNavLinkIcon]="item.icon"
10538
+ [thyTooltip]="item.name"
10539
+ thyTooltipPlacement="top"
10540
+ [thyIconNavLinkActive]="active"
10541
+ (mousedown)="execute($event)"
10542
+ ></a>
10543
+ </ng-container>
10544
+ <ng-template #selectionItem>
10545
+ <ng-container *ngIf="!item?.quickItemComponent">
10546
+ <thy-icon [thyIconName]="item?.icon" [thyIconRotate]="0" class="quick-toolbar-icon"></thy-icon>
10547
+ <span class="quick-toolbar-name">{{ item?.name }}</span>
10548
+ </ng-container>
10549
+ </ng-template>
10550
+ <ng-container #toolbarContainer></ng-container>
10551
+ `,
10552
+ host: {
10553
+ class: 'the-toolbar-item'
10554
+ }
10555
+ }]
10556
+ }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.ComponentFactoryResolver }]; }, propDecorators: { item: [{
10557
+ type: Input
10558
+ }], editor: [{
10559
+ type: Input
10560
+ }], itemMode: [{
10561
+ type: Input
10562
+ }], toolbarContainer: [{
10563
+ type: ViewChild,
10564
+ args: ['toolbarContainer', { read: ViewContainerRef, static: true }]
10565
+ }] } });
10566
+
10567
+ class TheQuickToolbarComponent extends mixinUnsubscribe(MixinBase) {
10568
+ constructor(popoverRef, elementRef) {
10569
+ super();
10570
+ this.popoverRef = popoverRef;
10571
+ this.elementRef = elementRef;
10572
+ this.ToolbarItemMode = ToolbarItemMode;
10573
+ this.ToolbarActionTypes = ToolbarActionTypes;
10574
+ }
10575
+ handleMouseDown(event) {
10576
+ if (!this.elementRef.nativeElement.contains(event.target)) {
10577
+ this.popoverRef.close();
10578
+ }
10579
+ else {
10580
+ event.preventDefault();
10581
+ }
10582
+ }
10583
+ handleEnter() {
10584
+ this.popoverRef.close();
10585
+ }
10586
+ ngOnInit() {
10587
+ this.editorElement = AngularEditor.toDOMNode(this.editor, this.editor);
10588
+ }
10589
+ stopPropagation(event) {
10590
+ event.preventDefault();
10591
+ }
10592
+ selectionChange(event) {
10593
+ this.removeHotKey();
10594
+ const toolbarItem = this.quickToolbarItems.find(item => item.key === event.value);
10595
+ if (toolbarItem === null || toolbarItem === void 0 ? void 0 : toolbarItem.execute) {
10596
+ toolbarItem.execute(this.editor);
10597
+ }
10598
+ }
10599
+ removeHotKey() {
10600
+ const node = Node.get(this.editor, this.editor.selection.anchor.path);
10601
+ if (node && Text.equals({ text: QUICK_TOOLBAR_HOTKEY }, node)) {
10602
+ Editor.deleteBackward(this.editor);
10603
+ }
10604
+ }
10605
+ ngOnDestroy() {
10606
+ super.ngOnDestroy();
10607
+ }
10608
+ }
10609
+ TheQuickToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheQuickToolbarComponent, deps: [{ token: i1$3.ThyPopoverRef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
10610
+ TheQuickToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheQuickToolbarComponent, selector: "the-quick-toolbar", inputs: { editor: "editor", quickToolbarItems: "quickToolbarItems" }, host: { listeners: { "document: mousedown": "handleMouseDown($event)", "document: keydown.enter": "handleEnter()" } }, usesInheritance: true, ngImport: i0, template: "<thy-selection-list\n class=\"the-quick-toolbar\"\n [thyBindKeyEventContainer]=\"editorElement\"\n (thySelectionChange)=\"selectionChange($event)\"\n [thyMultiple]=\"false\"\n>\n <ng-container *ngFor=\"let item of quickToolbarItems\">\n <ng-container *ngIf=\"item.key !== ToolbarActionTypes.split; else splitLine\">\n <thy-list-option [thyValue]=\"item?.key\" (mousedown)=\"stopPropagation($event)\">\n <the-toolbar-item [editor]=\"editor\" [item]=\"item\" [itemMode]=\"ToolbarItemMode.vertical\"></the-toolbar-item>\n </thy-list-option>\n </ng-container>\n </ng-container>\n</thy-selection-list>\n\n<ng-template #splitLine>\n <nav-split-line [mode]=\"ToolbarItemMode.horizontal\"></nav-split-line>\n</ng-template>\n", components: [{ type: i2$3.ThySelectionListComponent, selector: "thy-selection-list,[thy-selection-list]", inputs: ["thyMultiple", "thyBindKeyEventContainer", "thyScrollContainer", "thyBeforeKeydown", "thyUniqueKey", "thyCompareWith", "thyLayout", "thyAutoActiveFirstItem", "thySize", "thySpaceKeyEnabled"], outputs: ["thySelectionChange"] }, { type: i5$3.ThyListOptionComponent, selector: "thy-list-option,[thy-list-option]", inputs: ["id", "thyValue", "thyDisabled"] }, { type: TheToolbarItemComponent, selector: "the-toolbar-item", inputs: ["item", "editor", "itemMode"] }, { type: NavSplitLineComponent, selector: "nav-split-line", inputs: ["mode"] }], directives: [{ type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
10611
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheQuickToolbarComponent, decorators: [{
10612
+ type: Component,
10613
+ args: [{
10614
+ selector: 'the-quick-toolbar',
10615
+ templateUrl: 'quick-toolbar.component.html'
10616
+ }]
10617
+ }], ctorParameters: function () { return [{ type: i1$3.ThyPopoverRef }, { type: i0.ElementRef }]; }, propDecorators: { editor: [{
10618
+ type: Input
10619
+ }], quickToolbarItems: [{
10620
+ type: Input
10621
+ }], handleMouseDown: [{
10622
+ type: HostListener,
10623
+ args: ['document: mousedown', ['$event']]
10624
+ }], handleEnter: [{
10625
+ type: HostListener,
10626
+ args: ['document: keydown.enter']
10627
+ }] } });
10628
+
10629
+ const OperationTypes = ['insert_text', 'remove_node', 'merge_node'];
10630
+ const QuickInsertEditor = {
10631
+ openQuickToolbar(editor, toolbarItems, origin) {
10632
+ const overlay = editor.injector.get(Overlay);
10633
+ const viewContainerRef = editor.injector.get(ViewContainerRef);
10634
+ const thyPopover = editor.injector.get(ThyPopover);
10635
+ const quickToolbarRef = thyPopover.open(TheQuickToolbarComponent, {
10636
+ initialState: {
10637
+ editor,
10638
+ quickToolbarItems: toolbarItems
10639
+ },
10640
+ origin,
10641
+ viewContainerRef: viewContainerRef,
10642
+ backdropClosable: true,
10643
+ placement: 'bottomLeft',
10644
+ offset: 4,
10645
+ hasBackdrop: false,
10646
+ insideClosable: true,
10647
+ panelClass: 'the-quick-toolbar-container',
10648
+ scrollStrategy: overlay.scrollStrategies.reposition(),
10649
+ manualClosure: true
10650
+ });
10651
+ THE_EDITOR_QUICK_TOOLBAR_REF.set(editor, quickToolbarRef);
10652
+ },
10653
+ closeQuickToolbar(editor) {
10654
+ const quickToolbarRef = THE_EDITOR_QUICK_TOOLBAR_REF.get(editor);
10655
+ if (quickToolbarRef) {
10656
+ quickToolbarRef.close();
10657
+ THE_EDITOR_QUICK_TOOLBAR_REF.set(editor, null);
10658
+ }
10659
+ },
10660
+ isOpenToolbar(editor, opTypes = OperationTypes) {
10661
+ const isCollapsedCursor = TheEditor.isFocused(editor) && editor.selection && Range.isCollapsed(editor.selection);
10662
+ if (!isCollapsedCursor) {
10663
+ return false;
10664
+ }
10665
+ const block = Node.ancestor(editor, [editor.selection.anchor.path[0]]);
10666
+ const { undos } = editor.history;
10667
+ const lastBatch = undos[undos.length - 1];
10668
+ const lastOp = lastBatch && lastBatch[lastBatch.length - 1];
10669
+ if (lastOp &&
10670
+ block.children.length === 1 &&
10671
+ block.type === ElementKinds.paragraph &&
10672
+ Node.string(block) === QUICK_TOOLBAR_HOTKEY &&
10673
+ opTypes.includes(lastOp.type) &&
10674
+ (lastOp.text === QUICK_TOOLBAR_HOTKEY || lastOp.text === undefined)) {
10675
+ return true;
10676
+ }
10677
+ return false;
10678
+ }
10679
+ };
10680
+
10681
+ const withQuickInsert = (editor) => {
10682
+ const { onKeydown, deleteBackward, onChange } = editor;
10683
+ editor.onKeydown = (event) => {
10684
+ if (event.key === QUICK_TOOLBAR_HOTKEY && isCleanEmptyParagraph(editor)) {
10685
+ const rootNode = AngularEditor.toDOMNode(editor, Node.ancestor(editor, [editor.selection.anchor.path[0]]));
10686
+ const theEditorComponent = editor.injector.get(TheEditorComponent);
10687
+ const quickToolbars = theEditorComponent.quickToolbarItems;
10688
+ QuickInsertEditor.openQuickToolbar(editor, quickToolbars, rootNode);
10689
+ }
10690
+ onKeydown(event);
10691
+ };
10692
+ editor.deleteBackward = unit => {
10693
+ if (!QuickInsertEditor.isOpenToolbar(editor, ['remove_text'])) {
10694
+ QuickInsertEditor.closeQuickToolbar(editor);
10695
+ }
10696
+ deleteBackward(unit);
10697
+ };
10698
+ editor.onChange = () => {
10699
+ var _a;
10700
+ onChange();
10701
+ if (editor.selection) {
10702
+ const editorComponent = editor.injector.get(TheEditorComponent);
10703
+ (_a = editorComponent.quickInsertInstance) === null || _a === void 0 ? void 0 : _a.checkStatus();
10704
+ const block = Node.ancestor(editor, [editor.selection.anchor.path[0]]);
10705
+ if (!isCleanEmptyParagraph(editor) && Node.string(block) !== QUICK_TOOLBAR_HOTKEY) {
10706
+ QuickInsertEditor.closeQuickToolbar(editor);
10707
+ }
10708
+ }
10709
+ };
10710
+ return editor;
10711
+ };
10712
+
10230
10713
  const internalPlugins = [
10231
10714
  withTheHistory,
10232
10715
  withAutoInsertData(),
@@ -10234,7 +10717,6 @@ const internalPlugins = [
10234
10717
  withRemoveVoid,
10235
10718
  withBlockCard,
10236
10719
  withResetType,
10237
- withImage,
10238
10720
  withIndent([ElementKinds.checkItem, ElementKinds.numberedList, ElementKinds.bulletedList, ElementKinds.paragraph, ...HEADING_TYPES]),
10239
10721
  withList({ validLiChildrenTypes: [ElementKinds.image] }),
10240
10722
  withLink,
@@ -10254,7 +10736,9 @@ const internalPlugins = [
10254
10736
  withInsertParagraphNodes(),
10255
10737
  withGetFragment(),
10256
10738
  withDeserializeHMTL,
10257
- withDeserializeMd()
10739
+ withDeserializeMd(),
10740
+ withImage,
10741
+ withQuickInsert
10258
10742
  ];
10259
10743
  const internalToolbarItems = [
10260
10744
  ...AlignOptions,
@@ -10269,7 +10753,8 @@ const internalToolbarItems = [
10269
10753
  ...CodeOptions,
10270
10754
  ...LinkOptions,
10271
10755
  ...TableOptions,
10272
- ...VerticalAlignOptions
10756
+ ...VerticalAlignOptions,
10757
+ ...PaintFormatOptions
10273
10758
  ];
10274
10759
  const toolbarCompose = (toolbarItems = []) => {
10275
10760
  return [...internalToolbarItems, ...toolbarItems];
@@ -10308,11 +10793,11 @@ const shortcuts = (editor, event) => {
10308
10793
  };
10309
10794
 
10310
10795
  class TheToolbarService {
10311
- initialize(toolbarItems, global = DefaultGlobalToolbarDefinition, inline = DefaultInlineToolbarDefinition, block = DefaultBlockToolbarDefinition) {
10796
+ initialize(toolbarItems, global = DefaultGlobalToolbarDefinition, inline = DefaultInlineToolbarDefinition, quick = DefaultQuickToolbarDefinition) {
10312
10797
  const toolbarDefinition = {
10313
10798
  global,
10314
- block,
10315
- inline
10799
+ inline,
10800
+ quick
10316
10801
  };
10317
10802
  const toolbarOperations = new Map();
10318
10803
  toolbarItems.forEach(i => toolbarOperations.set(i.key, i));
@@ -10354,10 +10839,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
10354
10839
 
10355
10840
  const autoFocus = (editor, isFocus) => {
10356
10841
  setTimeout(() => {
10357
- if (editor && isFocus) {
10842
+ if (editor && editor.children.length > 0 && isFocus) {
10358
10843
  HistoryEditor.withoutMerging(editor, () => {
10359
- AngularEditor.focus(editor);
10360
10844
  Transforms.select(editor, Editor.start(editor, [0]));
10845
+ AngularEditor.focus(editor);
10361
10846
  });
10362
10847
  }
10363
10848
  });
@@ -10391,59 +10876,6 @@ const autoScrollViewHandle = (editor, scrollContainer) => {
10391
10876
  previousHeight = currentHeight;
10392
10877
  };
10393
10878
 
10394
- class TheToolbarItemComponent extends TheToolbarBaseItemComponent {
10395
- constructor() {
10396
- super();
10397
- this.active = false;
10398
- }
10399
- statusChange(editor) {
10400
- var _a, _b;
10401
- this.active = ((_a = this.item) === null || _a === void 0 ? void 0 : _a.active) ? (_b = this.item) === null || _b === void 0 ? void 0 : _b.active(editor) : false;
10402
- }
10403
- execute(event) {
10404
- var _a, _b, _c;
10405
- super.execute(event);
10406
- if (!((_a = this.item) === null || _a === void 0 ? void 0 : _a.execute) || ((_b = this.editor) === null || _b === void 0 ? void 0 : _b.disabled)) {
10407
- return;
10408
- }
10409
- (_c = this.item) === null || _c === void 0 ? void 0 : _c.execute(this.editor);
10410
- }
10411
- }
10412
- TheToolbarItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
10413
- TheToolbarItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheToolbarItemComponent, selector: "the-toolbar-item", inputs: { item: "item", editor: "editor" }, host: { classAttribute: "the-toolbar-item" }, usesInheritance: true, ngImport: i0, template: `
10414
- <a
10415
- thyIconNavLink
10416
- [thyIconNavLinkIcon]="item.icon"
10417
- [thyTooltip]="item.name"
10418
- thyTooltipPlacement="top"
10419
- [thyIconNavLinkActive]="active"
10420
- (mousedown)="execute($event)"
10421
- ></a>
10422
- `, isInline: true, components: [{ type: i2.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }], directives: [{ type: i7.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
10423
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarItemComponent, decorators: [{
10424
- type: Component,
10425
- args: [{
10426
- selector: 'the-toolbar-item',
10427
- template: `
10428
- <a
10429
- thyIconNavLink
10430
- [thyIconNavLinkIcon]="item.icon"
10431
- [thyTooltip]="item.name"
10432
- thyTooltipPlacement="top"
10433
- [thyIconNavLinkActive]="active"
10434
- (mousedown)="execute($event)"
10435
- ></a>
10436
- `,
10437
- host: {
10438
- class: 'the-toolbar-item'
10439
- }
10440
- }]
10441
- }], ctorParameters: function () { return []; }, propDecorators: { item: [{
10442
- type: Input
10443
- }], editor: [{
10444
- type: Input
10445
- }] } });
10446
-
10447
10879
  class TheToolbarComponent {
10448
10880
  constructor(cfr, elementRef, ngZone, toolbarGroupComponent) {
10449
10881
  this.cfr = cfr;
@@ -10451,6 +10883,7 @@ class TheToolbarComponent {
10451
10883
  this.ngZone = ngZone;
10452
10884
  this.toolbarGroupComponent = toolbarGroupComponent;
10453
10885
  this.toolbarItems = [];
10886
+ this.containerClass = [];
10454
10887
  this.isMore = true;
10455
10888
  this.components = new Map();
10456
10889
  this.moreGroupMenu = ToolbarMoreGroup;
@@ -10476,9 +10909,8 @@ class TheToolbarComponent {
10476
10909
  }
10477
10910
  }
10478
10911
  setToolbarClass() {
10479
- if (this.editor) {
10480
- const toolbarClass = getToolbarClass(this.editor);
10481
- this.elementRef.nativeElement.classList.add(toolbarClass);
10912
+ if (this.editor && !!this.containerClass.length) {
10913
+ this.elementRef.nativeElement.classList.add(...this.containerClass);
10482
10914
  }
10483
10915
  }
10484
10916
  resizeElement() {
@@ -10648,7 +11080,7 @@ class TheToolbarComponent {
10648
11080
  }
10649
11081
  }
10650
11082
  TheToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarComponent, deps: [{ token: i0.ComponentFactoryResolver }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: TheToolbarGroupToken }], target: i0.ɵɵFactoryTarget.Component });
10651
- TheToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheToolbarComponent, selector: "the-toolbar", inputs: { editor: "editor", toolbarItems: "toolbarItems", align: "align", isMore: "isMore", afterTemplate: "afterTemplate" }, host: { classAttribute: "the-toolbar-container" }, viewQueries: [{ propertyName: "toolbarContainer", first: true, predicate: ["toolbarContainer"], descendants: true, read: ViewContainerRef, static: true }], usesOnChanges: true, ngImport: i0, template: "<thy-icon-nav [style.justifyContent]=\"align\">\n <ng-container #toolbarContainer></ng-container>\n <ng-content></ng-content>\n <ng-template *ngIf=\"afterTemplate\" [ngTemplateOutlet]=\"afterTemplate\"></ng-template>\n</thy-icon-nav>\n", components: [{ type: i2.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }], directives: [{ type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
11083
+ TheToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheToolbarComponent, selector: "the-toolbar", inputs: { editor: "editor", toolbarItems: "toolbarItems", align: "align", containerClass: "containerClass", isMore: "isMore", afterTemplate: "afterTemplate" }, host: { classAttribute: "the-toolbar-container" }, viewQueries: [{ propertyName: "toolbarContainer", first: true, predicate: ["toolbarContainer"], descendants: true, read: ViewContainerRef, static: true }], usesOnChanges: true, ngImport: i0, template: "<thy-icon-nav [style.justifyContent]=\"align\">\n <ng-container #toolbarContainer></ng-container>\n <ng-content></ng-content>\n <ng-template *ngIf=\"afterTemplate\" [ngTemplateOutlet]=\"afterTemplate\"></ng-template>\n</thy-icon-nav>\n", components: [{ type: i2.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }], directives: [{ type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
10652
11084
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarComponent, decorators: [{
10653
11085
  type: Component,
10654
11086
  args: [{
@@ -10667,6 +11099,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
10667
11099
  type: Input
10668
11100
  }], align: [{
10669
11101
  type: Input
11102
+ }], containerClass: [{
11103
+ type: Input
10670
11104
  }], isMore: [{
10671
11105
  type: Input
10672
11106
  }], afterTemplate: [{
@@ -10676,52 +11110,242 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
10676
11110
  args: ['toolbarContainer', { read: ViewContainerRef, static: true }]
10677
11111
  }] } });
10678
11112
 
10679
- class ThePlaceholderComponent {
10680
- constructor(renderer, elementRef) {
11113
+ class TheInlineToolbarComponent {
11114
+ constructor(elementRef, scrollDispatcher, cdr, ngZone, contextService) {
11115
+ this.elementRef = elementRef;
11116
+ this.scrollDispatcher = scrollDispatcher;
11117
+ this.cdr = cdr;
11118
+ this.ngZone = ngZone;
11119
+ this.contextService = contextService;
11120
+ this.destroy$ = new Subject();
11121
+ }
11122
+ ngOnInit() {
11123
+ this.scrollDispatcher
11124
+ .scrolled()
11125
+ .pipe(takeUntil(this.destroy$))
11126
+ .subscribe(() => {
11127
+ this.updateInlineToolbar();
11128
+ this.cdr.detectChanges();
11129
+ });
11130
+ this.ngZone.runOutsideAngular(() => {
11131
+ merge(fromEvent(document, 'mouseup').pipe(filter((e) => e.button !== 2)), fromEvent(document, 'keyup').pipe(filter((e) => !e.shiftKey)))
11132
+ .pipe(debounceTime(200), takeUntil(this.destroy$))
11133
+ .subscribe(() => {
11134
+ var _a;
11135
+ this.updateInlineToolbar();
11136
+ (_a = this.inlineToolbar) === null || _a === void 0 ? void 0 : _a.statusChange(this.editor);
11137
+ this.cdr.detectChanges();
11138
+ });
11139
+ });
11140
+ }
11141
+ updateInlineToolbar() {
11142
+ const inlineToolbar = this.elementRef.nativeElement.firstElementChild;
11143
+ if (!this.editor.selection) {
11144
+ inlineToolbar.removeAttribute('style');
11145
+ return;
11146
+ }
11147
+ const anchorBlock$1 = anchorBlock(this.editor);
11148
+ if (!inlineToolbar || !anchorBlock$1) {
11149
+ return;
11150
+ }
11151
+ const { editor } = this;
11152
+ const { selection } = editor;
11153
+ if (!selection ||
11154
+ !AngularEditor.isFocused(editor) ||
11155
+ Range.isCollapsed(selection) ||
11156
+ Editor.string(editor, selection) === '') {
11157
+ inlineToolbar.removeAttribute('style');
11158
+ return;
11159
+ }
11160
+ if (!THE_INLINE_TOOLBAR_TYPES.includes(anchorBlock$1.type)) {
11161
+ return;
11162
+ }
11163
+ const native = window.getSelection();
11164
+ if (native.type !== 'None') {
11165
+ const range = native.getRangeAt(0);
11166
+ this.updatePosition(inlineToolbar, range);
11167
+ }
11168
+ }
11169
+ updatePosition(toolbarElement, range) {
11170
+ let boundary = range.getBoundingClientRect();
11171
+ if (!boundary || (boundary.height === 0 && boundary.width === 0 && range.startContainer === range.endContainer)) {
11172
+ if (range.startContainer.nodeType === 1 && range.startContainer.querySelector('img')) {
11173
+ boundary = range.startContainer.querySelector('img').getBoundingClientRect();
11174
+ }
11175
+ else {
11176
+ boundary = range.startContainer.getBoundingClientRect();
11177
+ }
11178
+ }
11179
+ const editableElement = this.contextService.getEditableElement();
11180
+ const editableRect = editableElement.getBoundingClientRect();
11181
+ const toolbarHeight = toolbarElement.offsetHeight;
11182
+ const toolbarWidth = toolbarElement.offsetWidth;
11183
+ const halfOffsetWidth = toolbarWidth / 2;
11184
+ const defaultLeft = -halfOffsetWidth;
11185
+ const offsetLeft = boundary.left - editableRect.left;
11186
+ const isTopLeft = offsetLeft - 30 > halfOffsetWidth; // 30: editable padding left
11187
+ const isTopRight = editableRect.width - offsetLeft - boundary.width / 2 < halfOffsetWidth;
11188
+ const positions = {};
11189
+ positions.top = boundary.top - toolbarHeight;
11190
+ positions.right = 'initial';
11191
+ positions.left = boundary.left;
11192
+ if (isTopLeft) {
11193
+ positions.left = boundary.left + boundary.width / 2 + defaultLeft;
11194
+ }
11195
+ if (isTopRight) {
11196
+ positions.left = boundary.right - toolbarWidth;
11197
+ }
11198
+ for (let key of Object.keys(positions)) {
11199
+ toolbarElement.style[key] = positions[key] + (isNaN(positions[key]) ? '' : 'px');
11200
+ }
11201
+ toolbarElement.style.opacity = '1';
11202
+ }
11203
+ ngOnDestroy() {
11204
+ this.destroy$.next();
11205
+ this.destroy$.complete();
11206
+ }
11207
+ }
11208
+ TheInlineToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheInlineToolbarComponent, deps: [{ token: i0.ElementRef }, { token: i2$1.ScrollDispatcher }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: TheContextService }], target: i0.ɵɵFactoryTarget.Component });
11209
+ TheInlineToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheInlineToolbarComponent, selector: "the-inline-toolbar", inputs: { editor: "editor", toolbarItems: "toolbarItems" }, host: { properties: { "class.hide": "toolbarItems.length === 0" } }, viewQueries: [{ propertyName: "inlineToolbar", first: true, predicate: ["inlineToolbar"], descendants: true }], ngImport: i0, template: `<the-toolbar
11210
+ #inlineToolbar
11211
+ class="the-inline-toolbar"
11212
+ [editor]="editor"
11213
+ [toolbarItems]="toolbarItems"
11214
+ [isMore]="false"
11215
+ ></the-toolbar> `, isInline: true, components: [{ type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "containerClass", "isMore", "afterTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
11216
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheInlineToolbarComponent, decorators: [{
11217
+ type: Component,
11218
+ args: [{
11219
+ selector: 'the-inline-toolbar',
11220
+ template: `<the-toolbar
11221
+ #inlineToolbar
11222
+ class="the-inline-toolbar"
11223
+ [editor]="editor"
11224
+ [toolbarItems]="toolbarItems"
11225
+ [isMore]="false"
11226
+ ></the-toolbar> `,
11227
+ host: {
11228
+ '[class.hide]': 'toolbarItems.length === 0'
11229
+ },
11230
+ changeDetection: ChangeDetectionStrategy.OnPush
11231
+ }]
11232
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i2$1.ScrollDispatcher }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: TheContextService }]; }, propDecorators: { editor: [{
11233
+ type: Input
11234
+ }], toolbarItems: [{
11235
+ type: Input
11236
+ }], inlineToolbar: [{
11237
+ type: ViewChild,
11238
+ args: ['inlineToolbar']
11239
+ }] } });
11240
+
11241
+ class TheQuickInsertComponent {
11242
+ constructor(renderer, elementRef, cdr) {
10681
11243
  this.renderer = renderer;
10682
11244
  this.elementRef = elementRef;
11245
+ this.cdr = cdr;
11246
+ this.isHide = true;
11247
+ this.defaultIconName = 'plus-circle-thin';
11248
+ this.iconNameFill = 'plus-circle-thin-fill';
11249
+ this.displayIconName = this.defaultIconName;
11250
+ }
11251
+ handleMousedownNativeElement(event) {
11252
+ event.preventDefault();
11253
+ event.stopPropagation();
11254
+ }
11255
+ checkStatus() {
11256
+ const { editor } = this;
11257
+ if (isCleanEmptyParagraph(editor)) {
11258
+ setTimeout(() => {
11259
+ var _a;
11260
+ const block = Node.ancestor(editor, [(_a = editor === null || editor === void 0 ? void 0 : editor.selection) === null || _a === void 0 ? void 0 : _a.anchor.path[0]]);
11261
+ const rootNode = AngularEditor.toDOMNode(editor, block);
11262
+ this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
11263
+ });
11264
+ return;
11265
+ }
10683
11266
  this.isHide = true;
10684
11267
  }
10685
- get selection() {
10686
- return this.editor.selection;
11268
+ updatePosition(left, top) {
11269
+ this.isHide = false;
11270
+ this.renderer.setStyle(this.elementRef.nativeElement, 'top', `${top}px`);
11271
+ this.renderer.setStyle(this.elementRef.nativeElement, 'left', `${left}px`);
11272
+ }
11273
+ mouseEnter(event) {
11274
+ this.displayIconName = this.iconNameFill;
11275
+ this.cdr.markForCheck();
11276
+ }
11277
+ mouseLeave(event) {
11278
+ this.displayIconName = this.defaultIconName;
11279
+ this.cdr.markForCheck();
11280
+ }
11281
+ handleClick(event) {
11282
+ event.stopPropagation();
11283
+ event.preventDefault();
11284
+ QuickInsertEditor.openQuickToolbar(this.editor, this.quickToolbarItems, this.iconElement.nativeElement);
11285
+ }
11286
+ }
11287
+ TheQuickInsertComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheQuickInsertComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
11288
+ TheQuickInsertComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheQuickInsertComponent, selector: "[theQuickInsert]", inputs: { editor: "editor", quickToolbarItems: "quickToolbarItems" }, host: { listeners: { "mousedown": "handleMousedownNativeElement($event)" }, properties: { "class.hide": "isHide" }, classAttribute: "the-quick-insert" }, viewQueries: [{ propertyName: "iconElement", first: true, predicate: ["iconElement"], descendants: true, read: ElementRef }], ngImport: i0, template: "<thy-icon\n #iconElement\n [thyIconName]=\"displayIconName\"\n class=\"quick-insert-icon text-desc font-size-xlg\"\n (mouseenter)=\"mouseEnter($event)\"\n (mouseleave)=\"mouseLeave($event)\"\n (mousedown)=\"handleClick($event)\"\n></thy-icon>\n", components: [{ type: i4$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }] });
11289
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheQuickInsertComponent, decorators: [{
11290
+ type: Component,
11291
+ args: [{
11292
+ selector: '[theQuickInsert]',
11293
+ templateUrl: './quick-insert.component.html',
11294
+ host: {
11295
+ class: 'the-quick-insert',
11296
+ '[class.hide]': 'isHide'
11297
+ }
11298
+ }]
11299
+ }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { editor: [{
11300
+ type: Input
11301
+ }], quickToolbarItems: [{
11302
+ type: Input
11303
+ }], iconElement: [{
11304
+ type: ViewChild,
11305
+ args: ['iconElement', { read: ElementRef, static: false }]
11306
+ }], handleMousedownNativeElement: [{
11307
+ type: HostListener,
11308
+ args: ['mousedown', ['$event']]
11309
+ }] } });
11310
+
11311
+ class ThePlaceholderComponent {
11312
+ constructor(renderer, elementRef, contextService) {
11313
+ this.renderer = renderer;
11314
+ this.elementRef = elementRef;
11315
+ this.contextService = contextService;
11316
+ this.isHide = true;
10687
11317
  }
10688
11318
  handleCompositionStart() {
10689
- this.hide();
11319
+ var _a;
11320
+ if ((_a = this.editor) === null || _a === void 0 ? void 0 : _a.selection) {
11321
+ this.hide();
11322
+ }
10690
11323
  }
10691
11324
  handleCompositionEnd(event) {
10692
11325
  if (!event.data) {
10693
11326
  this.checkStatus();
10694
11327
  }
10695
11328
  }
10696
- checkStatus(value) {
11329
+ checkStatus() {
10697
11330
  const { editor } = this;
10698
- const children = value ? value : editor.children;
10699
11331
  // empty content and no selection processing
10700
- if (this.autoFocus && !this.selection && isEmptyContent(children)) {
10701
- this.updatePosition(30, 51);
10702
- this.isHide = false;
11332
+ if (!editor.selection && isEmptyContent(editor.children)) {
11333
+ const firstElementChild = this.contextService.getFirstElementChild();
11334
+ const offsetTop = firstElementChild.offsetTop;
11335
+ const offsetLeft = firstElementChild.offsetLeft;
11336
+ this.updatePosition(offsetLeft, offsetTop);
10703
11337
  return;
10704
11338
  }
10705
- if (AngularEditor.isFocused(editor) && this.selection && Range.isCollapsed(this.selection)) {
10706
- const block = Node.ancestor(editor, [this.selection.anchor.path[0]]);
10707
- const textIndent = 'textIndent';
10708
- const align = 'align';
10709
- const hasTextIndent = block[textIndent];
10710
- const hasAlign = block[align];
10711
- if (Node.string(block) === '' &&
10712
- Element$1.isElement(block) &&
10713
- block.type === ElementKinds.paragraph &&
10714
- block.children.length === 1 &&
10715
- Text.isText(block.children[0]) &&
10716
- !Editor.isVoid(editor, block) &&
10717
- !hasTextIndent &&
10718
- !hasAlign) {
10719
- const rootNode = AngularEditor.toDOMNode(this.editor, block);
11339
+ if (isCleanEmptyParagraph(editor)) {
11340
+ setTimeout(() => {
11341
+ var _a;
11342
+ const block = Node.ancestor(editor, [(_a = editor === null || editor === void 0 ? void 0 : editor.selection) === null || _a === void 0 ? void 0 : _a.anchor.path[0]]);
11343
+ const rootNode = AngularEditor.toDOMNode(editor, block);
10720
11344
  this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
10721
- return;
10722
- }
11345
+ });
11346
+ return;
10723
11347
  }
10724
- this.hide();
11348
+ this.isHide = true;
10725
11349
  }
10726
11350
  updatePosition(left, top) {
10727
11351
  this.isHide = false;
@@ -10732,8 +11356,8 @@ class ThePlaceholderComponent {
10732
11356
  this.isHide = true;
10733
11357
  }
10734
11358
  }
10735
- ThePlaceholderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: ThePlaceholderComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
10736
- ThePlaceholderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: ThePlaceholderComponent, selector: "div[thePlaceholder]", inputs: { editor: "editor", autoFocus: "autoFocus", placeholder: "placeholder" }, host: { listeners: { "document:compositionstart": "handleCompositionStart()", "document:compositionend": "handleCompositionEnd($event)" }, properties: { "class.hide": "isHide" }, classAttribute: "the-placeholder" }, ngImport: i0, template: `{{ placeholder }}`, isInline: true });
11359
+ ThePlaceholderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: ThePlaceholderComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: TheContextService }], target: i0.ɵɵFactoryTarget.Component });
11360
+ ThePlaceholderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: ThePlaceholderComponent, selector: "div[thePlaceholder]", inputs: { editor: "editor", placeholder: "placeholder" }, host: { listeners: { "document:compositionstart": "handleCompositionStart()", "document:compositionend": "handleCompositionEnd($event)" }, properties: { "class.hide": "isHide" }, classAttribute: "the-placeholder" }, ngImport: i0, template: `{{ placeholder }}`, isInline: true });
10737
11361
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: ThePlaceholderComponent, decorators: [{
10738
11362
  type: Component,
10739
11363
  args: [{
@@ -10744,9 +11368,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
10744
11368
  '[class.hide]': 'isHide'
10745
11369
  }
10746
11370
  }]
10747
- }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }]; }, propDecorators: { editor: [{
10748
- type: Input
10749
- }], autoFocus: [{
11371
+ }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: TheContextService }]; }, propDecorators: { editor: [{
10750
11372
  type: Input
10751
11373
  }], placeholder: [{
10752
11374
  type: Input
@@ -10831,7 +11453,6 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
10831
11453
  this.theOnDOMEvent = new EventEmitter();
10832
11454
  this.theEditorCreated = new EventEmitter();
10833
11455
  this._plugins = [];
10834
- this.globalToolbarItems = [];
10835
11456
  this.autoScrollView = _.debounce(function (editor, scrollContainer) {
10836
11457
  return autoScrollViewHandle(editor, scrollContainer);
10837
11458
  }, 80);
@@ -10922,8 +11543,11 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
10922
11543
  this.onSlaCompositionEnd = (event) => { };
10923
11544
  this.onSlaDragStart = (event) => { };
10924
11545
  this.onSlaDragOver = (event) => { };
10925
- this.trackBy = (element) => {
10926
- return element.key;
11546
+ this.onDrop = (event) => {
11547
+ event.stopPropagation();
11548
+ this.theOnDOMEvent.emit({
11549
+ nativeEvent: event
11550
+ });
10927
11551
  };
10928
11552
  }
10929
11553
  get theGlobalToolbarInstance() {
@@ -10933,20 +11557,27 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
10933
11557
  var _a, _b;
10934
11558
  return ((_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.maxHeight) ? `${(_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.maxHeight}px` : null;
10935
11559
  }
11560
+ get quickToolbarItems() {
11561
+ var _a;
11562
+ return (_a = this.toolbarEntity) === null || _a === void 0 ? void 0 : _a.quick;
11563
+ }
10936
11564
  ngOnInit() {
10937
11565
  this.initialize();
10938
11566
  this.onErrorHandler();
10939
11567
  }
10940
11568
  ngOnChanges(changes) {
10941
- var _a, _b, _c;
11569
+ var _a, _b, _c, _d, _e;
10942
11570
  const options = changes.theOptions;
10943
11571
  if (options) {
10944
11572
  this.initializeOptions();
10945
11573
  }
11574
+ if (((_a = options.currentValue) === null || _a === void 0 ? void 0 : _a.readonly) !== ((_b = options.previousValue) === null || _b === void 0 ? void 0 : _b.readonly)) {
11575
+ this.applyAutoFocus();
11576
+ }
10946
11577
  if (changes['theDecorate']) {
10947
11578
  this.generateDecorate();
10948
11579
  }
10949
- if (((_a = this.editor) === null || _a === void 0 ? void 0 : _a.selection) && (((_b = options === null || options === void 0 ? void 0 : options.currentValue) === null || _b === void 0 ? void 0 : _b.readonly) || ((_c = options === null || options === void 0 ? void 0 : options.currentValue) === null || _c === void 0 ? void 0 : _c.disabled))) {
11580
+ if (((_c = this.editor) === null || _c === void 0 ? void 0 : _c.selection) && (((_d = options === null || options === void 0 ? void 0 : options.currentValue) === null || _d === void 0 ? void 0 : _d.readonly) || ((_e = options === null || options === void 0 ? void 0 : options.currentValue) === null || _e === void 0 ? void 0 : _e.disabled))) {
10950
11581
  Transforms.deselect(this.editor);
10951
11582
  }
10952
11583
  }
@@ -10979,31 +11610,32 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
10979
11610
  }
10980
11611
  }
10981
11612
  applyAutoFocus() {
10982
- var _a, _b, _c, _d;
10983
- if (((_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.autoFocus) && !((_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.readonly) && !((_c = this.theOptions) === null || _c === void 0 ? void 0 : _c.disabled)) {
10984
- autoFocus(this.editor, (_d = this.theOptions) === null || _d === void 0 ? void 0 : _d.autoFocus);
11613
+ var _a, _b, _c;
11614
+ if (!((_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.disabled) && !((_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.readonly)) {
11615
+ autoFocus(this.editor, (_c = this.theOptions) === null || _c === void 0 ? void 0 : _c.autoFocus);
10985
11616
  }
10986
11617
  }
10987
11618
  toolbarCalculate() {
10988
11619
  var _a;
10989
11620
  const toolbar = (_a = this === null || this === void 0 ? void 0 : this.theOptions) === null || _a === void 0 ? void 0 : _a.toolbar;
10990
11621
  const toolbarItems = toolbarCompose(toolbar === null || toolbar === void 0 ? void 0 : toolbar.toolbarItems);
10991
- const toolbarOption = this.toolbarService.initialize(toolbarItems, toolbar === null || toolbar === void 0 ? void 0 : toolbar.global, toolbar === null || toolbar === void 0 ? void 0 : toolbar.block, toolbar === null || toolbar === void 0 ? void 0 : toolbar.inline);
10992
- this.globalToolbarItems = toolbarOption.toolbarEntity.global;
11622
+ const toolbarOption = this.toolbarService.initialize(toolbarItems, toolbar === null || toolbar === void 0 ? void 0 : toolbar.global, toolbar === null || toolbar === void 0 ? void 0 : toolbar.inline, toolbar === null || toolbar === void 0 ? void 0 : toolbar.quick);
11623
+ this.globalToolbarClass = ['the-global-toolbar', getToolbarClass(this.editor)];
11624
+ this.toolbarEntity = toolbarOption.toolbarEntity;
10993
11625
  if (this.theGlobalToolbar) {
10994
11626
  this.theGlobalToolbarInstance.editor = this.editor;
10995
11627
  this.theGlobalToolbarInstance.toolbarItems = toolbarOption.toolbarEntity.global;
11628
+ this.theGlobalToolbarInstance.containerClass = this.globalToolbarClass;
10996
11629
  this.theGlobalToolbarInstance.align = toolbar === null || toolbar === void 0 ? void 0 : toolbar.align;
10997
11630
  this.theGlobalToolbarInstance.setToolbarClass();
10998
11631
  this.theGlobalToolbarInstance.renderToolbarView();
10999
11632
  }
11000
11633
  }
11001
11634
  writeValue(value) {
11002
- var _a, _b;
11635
+ var _a;
11003
11636
  const data = dataDeserialize((_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.mode, value);
11004
11637
  // data-deserialize
11005
11638
  this.editorValue = data;
11006
- (_b = this.placeholderInstance) === null || _b === void 0 ? void 0 : _b.checkStatus(data);
11007
11639
  }
11008
11640
  registerOnChange(fn) {
11009
11641
  this.onChangeCallback = fn;
@@ -11012,13 +11644,14 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
11012
11644
  this.onTouchedCallback = fn;
11013
11645
  }
11014
11646
  valueChange(value) {
11015
- var _a, _b, _c, _d, _e;
11647
+ var _a, _b, _c, _d, _e, _f;
11016
11648
  (_a = this.theGlobalToolbarInstance) === null || _a === void 0 ? void 0 : _a.statusChange(this.editor);
11017
- (_b = this.placeholderInstance) === null || _b === void 0 ? void 0 : _b.checkStatus();
11649
+ (_b = this.quickInsertInstance) === null || _b === void 0 ? void 0 : _b.checkStatus();
11650
+ (_c = this.placeholderInstance) === null || _c === void 0 ? void 0 : _c.checkStatus();
11018
11651
  // auto scroll view
11019
- const scrollContainer = (_c = this.theOptions) === null || _c === void 0 ? void 0 : _c.scrollContainer;
11020
- const maxHeight = (_d = this.theOptions) === null || _d === void 0 ? void 0 : _d.maxHeight;
11021
- if (!((_e = this.theOptions) === null || _e === void 0 ? void 0 : _e.readonly) && (scrollContainer || maxHeight)) {
11652
+ const scrollContainer = (_d = this.theOptions) === null || _d === void 0 ? void 0 : _d.scrollContainer;
11653
+ const maxHeight = (_e = this.theOptions) === null || _e === void 0 ? void 0 : _e.maxHeight;
11654
+ if (!((_f = this.theOptions) === null || _f === void 0 ? void 0 : _f.readonly) && (scrollContainer || maxHeight)) {
11022
11655
  const container = maxHeight ? DEFAULT_SCROLL_CONTAINER : scrollContainer;
11023
11656
  this.autoScrollView(this.editor, container);
11024
11657
  }
@@ -11143,7 +11776,7 @@ TheEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
11143
11776
  useExisting: forwardRef(() => TheEditorComponent),
11144
11777
  multi: true
11145
11778
  }
11146
- ], viewQueries: [{ propertyName: "templateInstance", first: true, predicate: ["templateInstance"], descendants: true, static: true }, { propertyName: "globalToolbarInstance", first: true, predicate: ["globalToolbar"], descendants: true }, { propertyName: "placeholderInstance", first: true, predicate: ["placeholder"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<the-toolbar\n *ngIf=\"!theOptions?.readonly && !theGlobalToolbar\"\n [ngClass]=\"{\n 'the-toolbar-disabled': theOptions?.disabled\n }\"\n #globalToolbar\n [editor]=\"editor\"\n [toolbarItems]=\"globalToolbarItems\"\n [align]=\"theOptions?.toolbar?.align\"\n></the-toolbar>\n\n<div\n class=\"the-editable-container\"\n [ngClass]=\"{\n 'the-editor-disabled': theOptions?.disabled,\n 'max-height': maxHeight\n }\"\n [ngStyle]=\"{ 'max-height': maxHeight }\"\n>\n <slate-editable\n class=\"the-editor-typo\"\n [editor]=\"editor\"\n [ngModel]=\"editorValue\"\n (ngModelChange)=\"valueChange($event)\"\n [decorate]=\"decorate\"\n [renderElement]=\"renderElement\"\n [renderText]=\"renderText\"\n [renderLeaf]=\"renderLeaf\"\n [readonly]=\"theOptions?.readonly || theOptions?.disabled\"\n [keydown]=\"onKeyDown\"\n [click]=\"onClick\"\n [paste]=\"onSlaPaste\"\n [beforeInput]=\"onSlaBeforeInput\"\n [blur]=\"onSlaBlur\"\n [focus]=\"onSlaFocus\"\n [copy]=\"onSlaCopy\"\n [cut]=\"onSlaCut\"\n [isStrictDecorate]=\"false\"\n [compositionStart]=\"onSlaCompositionStart\"\n [compositionEnd]=\"onSlaCompositionEnd\"\n [dragStart]=\"onSlaDragStart\"\n [dragOver]=\"onSlaDragOver\"\n [trackBy]=\"trackBy\"\n (mousedown)=\"mousedown($event)\"\n ></slate-editable>\n <div\n *ngIf=\"theOptions?.placeholder\"\n #placeholder\n thePlaceholder\n [editor]=\"editor\"\n [autoFocus]=\"theOptions?.placeholder?.autoFocus\"\n [placeholder]=\"theOptions?.placeholder\"\n ></div>\n <the-template #templateInstance></the-template>\n</div>\n", components: [{ type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "isMore", "afterTemplate"] }, { type: i1.SlateEditableComponent, selector: "slate-editable", inputs: ["editor", "renderElement", "renderLeaf", "renderText", "decorate", "isStrictDecorate", "trackBy", "readonly", "beforeInput", "blur", "click", "compositionEnd", "compositionStart", "copy", "cut", "dragOver", "dragStart", "dragEnd", "drop", "focus", "keydown", "paste", "spellCheck", "autoCorrect", "autoCapitalize"] }, { type: ThePlaceholderComponent, selector: "div[thePlaceholder]", inputs: ["editor", "autoFocus", "placeholder"] }, { type: TheTemplateComponent, selector: "the-template,[theTemplate]" }], directives: [{ type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i4$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
11779
+ ], viewQueries: [{ propertyName: "templateInstance", first: true, predicate: ["templateInstance"], descendants: true, static: true }, { propertyName: "globalToolbarInstance", first: true, predicate: ["globalToolbar"], descendants: true }, { propertyName: "quickInsertInstance", first: true, predicate: ["quickInsert"], descendants: true, static: true }, { propertyName: "placeholderInstance", first: true, predicate: ["placeholder"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<the-toolbar\n *ngIf=\"!theOptions?.readonly && !theGlobalToolbar\"\n [ngClass]=\"{\n 'the-toolbar-disabled': theOptions?.disabled\n }\"\n #globalToolbar\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarEntity.global\"\n [containerClass]=\"globalToolbarClass\"\n [align]=\"theOptions?.toolbar?.align\"\n></the-toolbar>\n\n<div\n class=\"the-editable-container\"\n [ngClass]=\"{\n 'the-editor-disabled': theOptions?.disabled,\n 'max-height': maxHeight\n }\"\n [ngStyle]=\"{ 'max-height': maxHeight }\"\n>\n <slate-editable\n class=\"the-editor-typo\"\n [editor]=\"editor\"\n [ngModel]=\"editorValue\"\n (ngModelChange)=\"valueChange($event)\"\n [decorate]=\"decorate\"\n [renderElement]=\"renderElement\"\n [renderText]=\"renderText\"\n [renderLeaf]=\"renderLeaf\"\n [readonly]=\"theOptions?.readonly || theOptions?.disabled\"\n [keydown]=\"onKeyDown\"\n [click]=\"onClick\"\n [paste]=\"onSlaPaste\"\n [beforeInput]=\"onSlaBeforeInput\"\n [blur]=\"onSlaBlur\"\n [focus]=\"onSlaFocus\"\n [copy]=\"onSlaCopy\"\n [cut]=\"onSlaCut\"\n [isStrictDecorate]=\"false\"\n [compositionStart]=\"onSlaCompositionStart\"\n [compositionEnd]=\"onSlaCompositionEnd\"\n [dragStart]=\"onSlaDragStart\"\n [dragOver]=\"onSlaDragOver\"\n [drop]=\"onDrop\"\n (mousedown)=\"mousedown($event)\"\n ></slate-editable>\n <the-inline-toolbar *ngIf=\"!theOptions?.readonly\" [editor]=\"editor\" [toolbarItems]=\"toolbarEntity.inline\"></the-inline-toolbar>\n <div #quickInsert theQuickInsert [editor]=\"editor\" [quickToolbarItems]=\"quickToolbarItems\"></div>\n <div #placeholder thePlaceholder [editor]=\"editor\" [placeholder]=\"theOptions?.placeholder\"></div>\n <the-template #templateInstance></the-template>\n</div>\n", components: [{ type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "containerClass", "isMore", "afterTemplate"] }, { type: i1.SlateEditableComponent, selector: "slate-editable", inputs: ["editor", "renderElement", "renderLeaf", "renderText", "decorate", "isStrictDecorate", "trackBy", "readonly", "beforeInput", "blur", "click", "compositionEnd", "compositionStart", "copy", "cut", "dragOver", "dragStart", "dragEnd", "drop", "focus", "keydown", "paste", "spellCheck", "autoCorrect", "autoCapitalize"] }, { type: TheInlineToolbarComponent, selector: "the-inline-toolbar", inputs: ["editor", "toolbarItems"] }, { type: TheQuickInsertComponent, selector: "[theQuickInsert]", inputs: ["editor", "quickToolbarItems"] }, { type: ThePlaceholderComponent, selector: "div[thePlaceholder]", inputs: ["editor", "placeholder"] }, { type: TheTemplateComponent, selector: "the-template,[theTemplate]" }], directives: [{ type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i4$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
11147
11780
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheEditorComponent, decorators: [{
11148
11781
  type: Component,
11149
11782
  args: [{
@@ -11186,6 +11819,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
11186
11819
  }], globalToolbarInstance: [{
11187
11820
  type: ViewChild,
11188
11821
  args: ['globalToolbar']
11822
+ }], quickInsertInstance: [{
11823
+ type: ViewChild,
11824
+ args: ['quickInsert', { static: true }]
11189
11825
  }], placeholderInstance: [{
11190
11826
  type: ViewChild,
11191
11827
  args: ['placeholder']
@@ -11304,7 +11940,7 @@ class TheToolbarGroupComponent {
11304
11940
  }
11305
11941
  }
11306
11942
  TheToolbarGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarGroupComponent, deps: [{ token: i0.ElementRef }, { token: i1$3.ThyPopover }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component });
11307
- TheToolbarGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheToolbarGroupComponent, selector: "the-toolbar-group", inputs: { menus: "menus", item: "item" }, host: { listeners: { "mousedown": "mousedownHandler($event)", "click": "clickHandle($event)" }, classAttribute: "the-toolbar-group" }, viewQueries: [{ propertyName: "groupTemplate", first: true, predicate: ["groupTemplate"], descendants: true, read: TemplateRef, static: true }], ngImport: i0, template: "<a thyIconNavLink [thyIconNavLinkIcon]=\"item.icon\" [thyTooltip]=\"item?.name\" thyTooltipPlacement=\"top\" [thyIconNavLinkActive]=\"active\"></a>\n\n<ng-template #groupTemplate>\n <the-toolbar class=\"group\" [editor]=\"editor\" [toolbarItems]=\"menus\" [isMore]=\"false\"></the-toolbar>\n</ng-template>\n", components: [{ type: i2.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "isMore", "afterTemplate"] }], directives: [{ type: i7.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
11943
+ TheToolbarGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheToolbarGroupComponent, selector: "the-toolbar-group", inputs: { menus: "menus", item: "item" }, host: { listeners: { "mousedown": "mousedownHandler($event)", "click": "clickHandle($event)" }, classAttribute: "the-toolbar-group" }, viewQueries: [{ propertyName: "groupTemplate", first: true, predicate: ["groupTemplate"], descendants: true, read: TemplateRef, static: true }], ngImport: i0, template: "<a thyIconNavLink [thyIconNavLinkIcon]=\"item.icon\" [thyTooltip]=\"item?.name\" thyTooltipPlacement=\"top\" [thyIconNavLinkActive]=\"active\"></a>\n\n<ng-template #groupTemplate>\n <the-toolbar class=\"group\" [editor]=\"editor\" [toolbarItems]=\"menus\" [isMore]=\"false\"></the-toolbar>\n</ng-template>\n", components: [{ type: i2.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "containerClass", "isMore", "afterTemplate"] }], directives: [{ type: i7.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
11308
11944
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarGroupComponent, decorators: [{
11309
11945
  type: Component,
11310
11946
  args: [{
@@ -11351,10 +11987,12 @@ const COMPONENTS = [
11351
11987
  TheToolbarDropdownComponent,
11352
11988
  TheToolbarGroupComponent,
11353
11989
  TheToolbarItemComponent,
11990
+ TheInlineToolbarComponent,
11354
11991
  NavSplitLineComponent,
11355
11992
  TheTextComponent,
11356
11993
  TheDefaultElementComponent,
11357
- ThePlaceholderComponent,
11994
+ TheQuickInsertComponent,
11995
+ TheQuickToolbarComponent,
11358
11996
  TheColorSelectComponent,
11359
11997
  TheColorToolbarItemComponent,
11360
11998
  TheContextMenuComponent,
@@ -11381,7 +12019,8 @@ const PLUGIN_COMPONENTS = [
11381
12019
  TheTableToolbarComponent,
11382
12020
  TheTableComponent,
11383
12021
  TheTableRowComponent,
11384
- TheTdComponent
12022
+ TheTdComponent,
12023
+ ThePlaceholderComponent
11385
12024
  ];
11386
12025
  const PIPES = [ElementStylePipe, ElementClassPipe];
11387
12026
  class TheEditorModule {
@@ -11391,10 +12030,12 @@ TheEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version
11391
12030
  TheToolbarDropdownComponent,
11392
12031
  TheToolbarGroupComponent,
11393
12032
  TheToolbarItemComponent,
12033
+ TheInlineToolbarComponent,
11394
12034
  NavSplitLineComponent,
11395
12035
  TheTextComponent,
11396
12036
  TheDefaultElementComponent,
11397
- ThePlaceholderComponent,
12037
+ TheQuickInsertComponent,
12038
+ TheQuickToolbarComponent,
11398
12039
  TheColorSelectComponent,
11399
12040
  TheColorToolbarItemComponent,
11400
12041
  TheContextMenuComponent,
@@ -11418,7 +12059,8 @@ TheEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version
11418
12059
  TheTableToolbarComponent,
11419
12060
  TheTableComponent,
11420
12061
  TheTableRowComponent,
11421
- TheTdComponent], imports: [CommonModule, SlateModule, FormsModule, ThyIconModule,
12062
+ TheTdComponent,
12063
+ ThePlaceholderComponent], imports: [CommonModule, SlateModule, FormsModule, ThyIconModule,
11422
12064
  ThyAvatarModule,
11423
12065
  ThyNavModule,
11424
12066
  ThyFormModule,
@@ -11465,5 +12107,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
11465
12107
  * Generated bundle index. Do not edit.
11466
12108
  */
11467
12109
 
11468
- export { ALIGN_BLOCK_TYPES, A_TAG_REL_ATTR, AlignEditor, Alignment, BLOCK_DELETEBACKWARD_TYPES, BLOCK_INSERT_ORIGIN, BLOCK_TOOLBAR_HOTKEY, BlockquoteEditor, CLIPBOARD_FORMAT_KEY, CODEMIRROR_PADDING_TOP, CODE_MODES, COMPONENTS, CONTAINER_BLOCKS, CodeEditor, CodeMode, ColorEditor, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DefaultBlockToolbarDefinition, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DropdownMode, ELEMENT_UNIQUE_ID, ElementKinds, ErrorCodes, HEADING_TYPES, HeadingEditor, HrEditor, ImageEditor, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LinkEditor, ListEditor, MarkEditor, MarkProps, MarkTypes, PICTURE_ACCEPTED_UPLOAD_MIME, PICTURE_ACCEPTED_UPLOAD_SIZE, PLUGIN_COMPONENTS, STANDARD_HEADING_TYPES, TAB_SPACE, THE_CODE_MODE_PROVIDER, THE_CODE_MODE_TOKEN, THE_EDITOR_CONVERSION_HINT_REF, THE_EDITOR_UUID, THE_INLINE_TOOLBAR_TYPES, THE_UPLOAD_SERVICE_TOKEN, TableEditor, TheBaseElementComponent, TheCodeMode, TheContextService, TheDataMode, TheDefaultElementComponent, TheEditor, TheEditorComponent, TheEditorModule, TheImageComponent, TheMode, index$1 as TheQueries, TheToolbarComponent, TheToolbarDropdownComponent, TheToolbarGroupComponent, TheToolbarGroupToken, TheToolbarItemComponent, TheToolbarService, index as TheTransforms, TodoItemEditor, ToolbarActionTypes, ToolbarAlignment, ToolbarItemType, ToolbarMoreGroup, VOID_BLOCK_TYPES, VerticalAlignEditor, VerticalAlignment, ZERO_WIDTH_CHAR, createEmptyParagraph, dataDeserialize, dataSerializing, getToolbarClass, htmlToTheia, inValidTypes, plainToTheia, toolbarCompose, withTheEditor };
12110
+ export { ALIGN_BLOCK_TYPES, A_TAG_REL_ATTR, AlignEditor, Alignment, BLOCK_DELETEBACKWARD_TYPES, BLOCK_INSERT_ORIGIN, BlockquoteEditor, CLIPBOARD_FORMAT_KEY, CODEMIRROR_PADDING_TOP, CODE_MODES, COMPONENTS, CONTAINER_BLOCKS, CodeEditor, CodeMode, ColorEditor, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DefaultQuickToolbarDefinition, DropdownMode, ELEMENT_UNIQUE_ID, ElementKinds, ErrorCodes, HEADING_TYPES, HeadingEditor, HrEditor, ImageEditor, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LinkEditor, ListEditor, MarkEditor, MarkProps, MarkTypes, PICTURE_ACCEPTED_UPLOAD_MIME, PICTURE_ACCEPTED_UPLOAD_SIZE, PLUGIN_COMPONENTS, QUICK_TOOLBAR_HOTKEY, QuickInsertEditor, STANDARD_HEADING_TYPES, TAB_SPACE, THE_CODE_MODE_PROVIDER, THE_CODE_MODE_TOKEN, THE_EDITOR_CONVERSION_HINT_REF, THE_EDITOR_QUICK_TOOLBAR_REF, THE_EDITOR_UUID, THE_INLINE_TOOLBAR_TYPES, THE_UPLOAD_SERVICE_TOKEN, TableEditor, TheBaseElementComponent, TheCodeMode, TheContextService, TheDataMode, TheDefaultElementComponent, TheEditor, TheEditorComponent, TheEditorModule, TheImageComponent, TheMode, index$1 as TheQueries, TheToolbarBaseItemComponent, TheToolbarComponent, TheToolbarDropdownComponent, TheToolbarGroupComponent, TheToolbarGroupToken, TheToolbarItemComponent, TheToolbarService, index as TheTransforms, TodoItemEditor, ToolbarActionTypes, ToolbarAlignment, ToolbarItemMode, ToolbarItemType, ToolbarMoreGroup, VOID_BLOCK_TYPES, VerticalAlignEditor, VerticalAlignment, ZERO_WIDTH_CHAR, createEmptyParagraph, dataDeserialize, dataSerializing, getToolbarClass, htmlToTheia, inValidTypes, plainToTheia, toolbarCompose, withTheEditor };
11469
12111
  //# sourceMappingURL=worktile-theia.js.map