@worktile/theia 1.2.8 → 1.2.12

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 (90) hide show
  1. package/bundles/worktile-theia.umd.js +793 -158
  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 +24 -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 +7 -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 +136 -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 +23 -15
  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 +76 -0
  40. package/esm2015/plugins/public-api.js +2 -1
  41. package/esm2015/plugins/quick-insert/components/quick-insert.component.js +76 -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.types.js +1 -1
  50. package/esm2015/plugins/vertical-align/toolbar-item.component.js +11 -6
  51. package/esm2015/public-api.js +2 -1
  52. package/esm2015/queries/is-container-type.js +2 -2
  53. package/esm2015/services/context.service.js +2 -2
  54. package/esm2015/services/toolbar.service.js +5 -5
  55. package/esm2015/transforms/index.js +2 -3
  56. package/esm2015/utils/auto-focus.js +2 -2
  57. package/esm2015/utils/fragment.js +20 -1
  58. package/esm2015/utils/is-clean-empty-paragraph.js +32 -0
  59. package/esm2015/utils/weak-maps.js +2 -1
  60. package/fesm2015/worktile-theia.js +778 -164
  61. package/fesm2015/worktile-theia.js.map +1 -1
  62. package/interfaces/toolbar.d.ts +3 -2
  63. package/package.json +1 -1
  64. package/plugins/list/queries/get-start-list-item.d.ts +8 -2
  65. package/plugins/list/queries/is-selection-in-same-list-item.d.ts +5 -0
  66. package/plugins/paint-format/options.d.ts +2 -0
  67. package/plugins/paint-format/paint-format.editor.d.ts +7 -0
  68. package/{components → plugins}/placeholder/placeholder.component.d.ts +5 -6
  69. package/{components → plugins}/placeholder/placeholder.component.scss +0 -0
  70. package/plugins/public-api.d.ts +1 -0
  71. package/plugins/quick-insert/components/quick-insert.component.d.ts +25 -0
  72. package/plugins/quick-insert/components/quick-insert.component.scss +21 -0
  73. package/plugins/quick-insert/components/quick-toolbar/quick-toolbar.component.d.ts +29 -0
  74. package/plugins/quick-insert/components/quick-toolbar/quick-toolbar.component.scss +21 -0
  75. package/plugins/quick-insert/quick-insert.editor.d.ts +8 -0
  76. package/plugins/quick-insert/quick-insert.plugint.d.ts +2 -0
  77. package/plugins/table/components/table.component.d.ts +1 -0
  78. package/plugins/table/table.types.d.ts +7 -0
  79. package/plugins/vertical-align/toolbar-item.component.d.ts +1 -0
  80. package/public-api.d.ts +1 -0
  81. package/services/toolbar.service.d.ts +1 -1
  82. package/styles/editor.scss +41 -15
  83. package/styles/index.scss +5 -2
  84. package/transforms/index.d.ts +1 -2
  85. package/utils/fragment.d.ts +5 -0
  86. package/utils/is-clean-empty-paragraph.d.ts +8 -0
  87. package/utils/weak-maps.d.ts +1 -0
  88. package/esm2015/components/placeholder/placeholder.component.js +0 -88
  89. package/esm2015/transforms/insert-elements.js +0 -22
  90. 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'
@@ -1028,6 +1060,25 @@ function deleteElementKey(nodes, key) {
1028
1060
  });
1029
1061
  return nodes;
1030
1062
  }
1063
+ /**
1064
+ * 删除 text 节点的 颜色/背景色
1065
+ * @param node
1066
+ */
1067
+ function deleteColorAndBackgroundColorOfText(node) {
1068
+ node.children.forEach((child) => {
1069
+ if (Text.isText(child)) {
1070
+ if (child['color']) {
1071
+ delete child['color'];
1072
+ }
1073
+ if (child['background-color']) {
1074
+ delete child['background-color'];
1075
+ }
1076
+ }
1077
+ else {
1078
+ deleteColorAndBackgroundColorOfText(child);
1079
+ }
1080
+ });
1081
+ }
1031
1082
 
1032
1083
  const isAcrossBlocks = (editor, fragment) => {
1033
1084
  const startBlock = getStartBlock(editor, fragment[0]);
@@ -1140,7 +1191,7 @@ const getSelectionMarks = (editor) => {
1140
1191
  return marks;
1141
1192
  };
1142
1193
 
1143
- const isContainer = (editor, value) => Element$1.isElement(value) && editor.isContainer(value);
1194
+ const isContainer = (editor, value) => Element$1.isElement(value) && editor.isContainer && editor.isContainer(value);
1144
1195
 
1145
1196
  const getContainerBlocks = (editor) => {
1146
1197
  const containerNode = Editor.above(editor, {
@@ -1409,28 +1460,9 @@ const setEndSelection = (editor) => {
1409
1460
  AngularEditor.focus(editor);
1410
1461
  };
1411
1462
 
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
1463
  const THE_EDITOR_UUID = new WeakMap();
1433
1464
  const THE_EDITOR_CONVERSION_HINT_REF = new WeakMap();
1465
+ const THE_EDITOR_QUICK_TOOLBAR_REF = new WeakMap();
1434
1466
 
1435
1467
  const closeConversionHint = (editor) => {
1436
1468
  const hintRef = THE_EDITOR_CONVERSION_HINT_REF.get(editor);
@@ -1492,7 +1524,6 @@ var index = /*#__PURE__*/Object.freeze({
1492
1524
  splitNode: splitNode,
1493
1525
  deleteElement: deleteElement,
1494
1526
  setEndSelection: setEndSelection,
1495
- insertTheElements: insertTheElements,
1496
1527
  closeConversionHint: closeConversionHint,
1497
1528
  handleContinualDeleteBackward: handleContinualDeleteBackward,
1498
1529
  handleContinualInsertBreak: handleContinualInsertBreak
@@ -1958,7 +1989,7 @@ const withDeserializeMd = (options) => (editor) => {
1958
1989
  editor.undo();
1959
1990
  setTimeout(() => {
1960
1991
  Transforms.select(editor, oldRange);
1961
- insertTheElements(editor, fragment);
1992
+ Transforms.insertFragment(editor, fragment);
1962
1993
  AngularEditor.focus(editor);
1963
1994
  });
1964
1995
  return;
@@ -2199,7 +2230,7 @@ class TheContextService {
2199
2230
  }
2200
2231
  getOptions() {
2201
2232
  if (!this.options.width) {
2202
- this.options.width = this.options.nativeElement.querySelector('.slate-editable-container').offsetWidth - 30;
2233
+ this.options.width = this.options.nativeElement.querySelector('.slate-editable-container').firstElementChild.offsetWidth;
2203
2234
  }
2204
2235
  return this.options;
2205
2236
  }
@@ -2468,7 +2499,6 @@ const withImage = (editor) => {
2468
2499
  return element.type === ElementKinds.image || isVoid(element);
2469
2500
  };
2470
2501
  editor.insertData = (data) => {
2471
- // TODO:: 底层有点问题,粘贴多张图片时只能识别一张
2472
2502
  if (data.files.length) {
2473
2503
  const imageFiles = [];
2474
2504
  for (const file of data.files) {
@@ -2597,13 +2627,19 @@ const getListTypes = () => {
2597
2627
  return [ElementKinds.bulletedList, ElementKinds.numberedList];
2598
2628
  };
2599
2629
 
2630
+ /**
2631
+ * 获取 List 中 ListItems,过滤掉空列表嵌套
2632
+ * @param node
2633
+ * @param initialValue
2634
+ * @returns
2635
+ */
2600
2636
  const getStartListItem = (node, initialValue) => {
2601
2637
  if (!initialValue) {
2602
2638
  initialValue = [];
2603
2639
  }
2604
2640
  if (node) {
2605
2641
  return node.reduce((result, current) => {
2606
- if (current.type == ElementKinds.listItem && current.children[0].type === ElementKinds.default) {
2642
+ if ((current.type === ElementKinds.listItem && !getListTypes().includes(current.children[0].type))) {
2607
2643
  result.push(current);
2608
2644
  }
2609
2645
  else {
@@ -3257,6 +3293,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
3257
3293
  }]
3258
3294
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; } });
3259
3295
 
3296
+ /**
3297
+ * Is the selection in same li
3298
+ */
3299
+ const isSelectionInSameListItem = (editor) => {
3300
+ const { selection } = editor;
3301
+ if (!selection) {
3302
+ return false;
3303
+ }
3304
+ const [start, end] = Range.edges(selection);
3305
+ const startListItemEntry = getAboveByType(editor, ElementKinds.listItem, { at: start.path });
3306
+ const endListItemEntry = getAboveByType(editor, ElementKinds.listItem, { at: end.path });
3307
+ return startListItemEntry && endListItemEntry && Path.equals(startListItemEntry[1], endListItemEntry[1]);
3308
+ };
3309
+
3260
3310
  const withList = ({ validLiChildrenTypes } = {}) => (editor) => {
3261
3311
  const { insertBreak, deleteBackward, onKeydown, insertData, setFragmentData, renderElement } = editor;
3262
3312
  const resetBlockTypesListRule = {
@@ -3339,15 +3389,14 @@ const withList = ({ validLiChildrenTypes } = {}) => (editor) => {
3339
3389
  const fragmentElement = fragmentData[0];
3340
3390
  if (getListTypes().includes(fragmentElement.type)) {
3341
3391
  const startNodes = getStartListItem([fragmentElement.children[0]]);
3342
- // 复制列表中的图片时startNodes长度为零
3343
- if (startNodes.length === 0) {
3344
- setFragmentData(unit);
3345
- return;
3346
- }
3347
3392
  const children = startNodes.concat(fragmentElement.children.slice(1));
3348
- const fragmentNodes = [
3393
+ let fragmentNodes = [
3349
3394
  Object.assign(Object.assign({}, fragmentElement), { children })
3350
3395
  ];
3396
+ if (isSelectionInSameListItem(editor)) {
3397
+ // 仅仅复制列表中的内容
3398
+ fragmentNodes = children[0].children;
3399
+ }
3351
3400
  const fragment = fragmentNodes.concat(fragmentData.slice(1));
3352
3401
  const domRange = AngularEditor.toDOMRange(editor, selection);
3353
3402
  const contents = domRange.cloneContents();
@@ -5614,6 +5663,7 @@ class TheColorSelectComponent {
5614
5663
  }
5615
5664
  }
5616
5665
  _selectColor(event, color) {
5666
+ event.preventDefault();
5617
5667
  event.stopPropagation();
5618
5668
  if (this.option.specialColor && color === this.option.specialColor) {
5619
5669
  color = '';
@@ -5644,7 +5694,7 @@ class TheColorSelectComponent {
5644
5694
  }
5645
5695
  }
5646
5696
  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 });
5697
+ 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
5698
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheColorSelectComponent, decorators: [{
5649
5699
  type: Component,
5650
5700
  args: [{
@@ -5760,9 +5810,10 @@ const ColorEditor = {
5760
5810
 
5761
5811
  class TheToolbarBaseItemComponent {
5762
5812
  execute(event) {
5813
+ var _a;
5763
5814
  event.preventDefault();
5764
5815
  event.stopPropagation();
5765
- if (!this.itemMousedownHandle && !this.editor.selection) {
5816
+ if (!this.itemMousedownHandle && !((_a = this.editor) === null || _a === void 0 ? void 0 : _a.selection)) {
5766
5817
  const lastNode = getLastNode(this.editor, 1);
5767
5818
  const end = Editor.end(this.editor, lastNode[1]);
5768
5819
  Transforms.select(this.editor, end);
@@ -6717,6 +6768,7 @@ const withLink = (editor) => {
6717
6768
  editor.insertText = text => {
6718
6769
  if (text && isUrl(text)) {
6719
6770
  LinkEditor.wrapLink(editor, text, text);
6771
+ Transforms.move(editor, { distance: 1, unit: "offset" });
6720
6772
  }
6721
6773
  else {
6722
6774
  insertText(text);
@@ -6724,8 +6776,10 @@ const withLink = (editor) => {
6724
6776
  };
6725
6777
  editor.insertData = data => {
6726
6778
  const text = data.getData('text/plain');
6727
- if (text && isUrl(text)) {
6779
+ const fragment = data.getData(`application/${CLIPBOARD_FORMAT_KEY}`);
6780
+ if (text && isUrl(text) && !fragment) {
6728
6781
  LinkEditor.wrapLink(editor, text, text);
6782
+ Transforms.move(editor, { distance: 1, unit: "offset" });
6729
6783
  }
6730
6784
  else {
6731
6785
  insertData(data);
@@ -7557,18 +7611,38 @@ function setCellMenuInvisibility(editor, menuList, selectedCells, isActiveSelect
7557
7611
  }
7558
7612
 
7559
7613
  class NavSplitLineComponent {
7560
- constructor() { }
7614
+ constructor() {
7615
+ this.mode = ToolbarItemMode.vertical;
7616
+ this.theNavSplitLine = true;
7617
+ }
7618
+ get horizontal() {
7619
+ return this.mode === ToolbarItemMode.horizontal;
7620
+ }
7621
+ get vertical() {
7622
+ return this.mode === ToolbarItemMode.vertical;
7623
+ }
7561
7624
  ngOnInit() { }
7562
7625
  }
7563
7626
  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 });
7627
+ 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
7628
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: NavSplitLineComponent, decorators: [{
7566
7629
  type: Component,
7567
7630
  args: [{
7568
7631
  selector: 'nav-split-line',
7569
7632
  template: ''
7570
7633
  }]
7571
- }], ctorParameters: function () { return []; } });
7634
+ }], ctorParameters: function () { return []; }, propDecorators: { mode: [{
7635
+ type: Input
7636
+ }], theNavSplitLine: [{
7637
+ type: HostBinding,
7638
+ args: ['class.the-nav-split-line']
7639
+ }], horizontal: [{
7640
+ type: HostBinding,
7641
+ args: ['class.horizontal']
7642
+ }], vertical: [{
7643
+ type: HostBinding,
7644
+ args: ['class.vertical']
7645
+ }] } });
7572
7646
 
7573
7647
  class TheTableToolbarComponent {
7574
7648
  constructor(ngZone, colorSelectService, popoverRef) {
@@ -7680,7 +7754,7 @@ class TheTableToolbarComponent {
7680
7754
  }
7681
7755
  }
7682
7756
  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"] }] });
7757
+ 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
7758
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheTableToolbarComponent, decorators: [{
7685
7759
  type: Component,
7686
7760
  args: [{
@@ -8329,9 +8403,12 @@ class TheTableComponent extends TheBaseElementComponent {
8329
8403
  useRowControls() {
8330
8404
  if (this.selection) {
8331
8405
  this.rowControls = this.calculateRowControls();
8332
- this.cdr.detectChanges();
8406
+ this.cdr.markForCheck();
8333
8407
  }
8334
8408
  }
8409
+ detectChanges() {
8410
+ this.cdr.detectChanges();
8411
+ }
8335
8412
  calculateMinRowSpanCellForRows() {
8336
8413
  const table = this.element;
8337
8414
  const cells = table.children.map((row, index) => {
@@ -8593,7 +8670,7 @@ TheTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", vers
8593
8670
  provide: TheTableToken,
8594
8671
  useExisting: TheTableComponent
8595
8672
  }
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"] }] });
8673
+ ], 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
8674
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheTableComponent, decorators: [{
8598
8675
  type: Component,
8599
8676
  args: [{
@@ -8677,11 +8754,13 @@ class TheTableRowComponent extends TheBaseElementComponent {
8677
8754
  super.onContextChange();
8678
8755
  if (this.initialized) {
8679
8756
  this.useBackground();
8757
+ this.useHeight();
8680
8758
  }
8681
8759
  }
8682
8760
  ngOnInit() {
8683
8761
  super.ngOnInit();
8684
8762
  this.useBackground();
8763
+ this.useHeight();
8685
8764
  }
8686
8765
  useBackground() {
8687
8766
  if (this.element.header && !this.backgroundColor) {
@@ -9426,6 +9505,7 @@ class TheTdComponent extends TheBaseElementComponent {
9426
9505
  this.applyRowSize(deltaSize);
9427
9506
  }
9428
9507
  this.tableComponent.useRowControls();
9508
+ this.tableComponent.detectChanges();
9429
9509
  this.updateOverlayHandleSizeAndOffset();
9430
9510
  }
9431
9511
  _createOverlayForHandle() {
@@ -10077,7 +10157,14 @@ const withDeserializeHMTL = (editor) => {
10077
10157
  if (html && !slateFragment) {
10078
10158
  const htmlDom = new DOMParser().parseFromString(html, 'text/html');
10079
10159
  const fragment = TheiaConverter.convertToTheia(Array.from(htmlDom.body.children));
10080
- insertTheElements(editor, fragment);
10160
+ // 无法识别HTML内容时后退一下:识别纯文本
10161
+ if (fragment.length === 1 && Editor.isEmpty(editor, fragment[0]) && fragment[0].type === ElementKinds.paragraph) {
10162
+ insertData(data);
10163
+ return;
10164
+ }
10165
+ // 过滤 text 节点的 color/background-color 属性
10166
+ fragment.forEach((node) => deleteColorAndBackgroundColorOfText(node));
10167
+ Transforms.insertFragment(editor, fragment);
10081
10168
  return;
10082
10169
  }
10083
10170
  insertData(data);
@@ -10112,14 +10199,16 @@ class TheVerticalToolbarItemComponent extends TheToolbarBaseItemComponent {
10112
10199
  get isOpened() {
10113
10200
  return this.dropdownPopoverRef && this.dropdownPopoverRef.getOverlayRef() && this.dropdownPopoverRef.getOverlayRef().hasAttached();
10114
10201
  }
10202
+ handleDocumentMouseDown(event) {
10203
+ if (!this.elementRef.nativeElement.contains(event.target)) {
10204
+ this.close();
10205
+ }
10206
+ }
10115
10207
  ngOnInit() { }
10116
10208
  statusChange(editor) {
10117
10209
  var _a, _b;
10118
10210
  this.active = ((_a = this.toolbarItem) === null || _a === void 0 ? void 0 : _a.active) ? (_b = this.toolbarItem) === null || _b === void 0 ? void 0 : _b.active(editor) : false;
10119
10211
  this.activeMenu = this.menusActive(editor);
10120
- if (!this.active) {
10121
- this.close();
10122
- }
10123
10212
  }
10124
10213
  menusActive(editor) {
10125
10214
  return this.menus.find(i => {
@@ -10165,7 +10254,7 @@ class TheVerticalToolbarItemComponent extends TheToolbarBaseItemComponent {
10165
10254
  }
10166
10255
  }
10167
10256
  TheVerticalToolbarItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheVerticalToolbarItemComponent, deps: [{ token: i0.ElementRef }, { token: i1$6.ThyPopover }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component });
10168
- TheVerticalToolbarItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheVerticalToolbarItemComponent, selector: "the-toolbar-vertical-align-item", inputs: { item: "item", menus: "menus", editor: "editor", toolbarItem: "toolbarItem" }, host: { properties: { "class.hide": "!active" }, classAttribute: "the-toolbar-dropdown-container verticalAlign" }, viewQueries: [{ propertyName: "template", first: true, predicate: ["VerticalAlignItems"], descendants: true, read: TemplateRef, static: true }], usesInheritance: true, ngImport: i0, template: "<a\n thyIconNavLink\n class=\"icon-mode link-with-down\"\n [thyTooltip]=\"toolbarItem?.name\"\n [thyIconNavLinkActive]=\"isOpened\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"execute($event)\"\n>\n <thy-icon [thyIconName]=\"activeMenu?.icon\"></thy-icon>\n <thy-icon class=\"caret-down-icon font-size-sm text-desc\" thyIconName=\"caret-down\"></thy-icon>\n</a>\n\n<ng-template #VerticalAlignItems>\n <thy-action-menu class=\"dropdown\">\n <ng-container *ngFor=\"let menu of toolbarItem?.includes\">\n <a\n thyActionMenuItem\n href=\"javascript:;\"\n [thyActionMenuItemActive]=\"menu.key === activeMenu?.key\"\n [ngStyle]=\"menu?.styles\"\n (mousedown)=\"itemMousedown($event, menu)\"\n >\n <span *ngIf=\"menu.icon\" thyActionMenuItemIcon>\n <thy-icon [thyIconName]=\"menu?.icon\"></thy-icon>\n </span>\n <span thyActionMenuItemName>{{ menu.name }}</span>\n </a>\n </ng-container>\n </thy-action-menu>\n</ng-template>\n", components: [{ type: i2.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i5$1.ThyActionMenuComponent, selector: "thy-action-menu", inputs: ["thyTheme", "thyWidth"] }], directives: [{ type: i7.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5$1.ThyActionMenuItemDirective, selector: "[thyActionMenuItem]", inputs: ["thyDisabled", "thyType"] }, { type: i5$1.ThyActionMenuItemActiveDirective, selector: "[thyActionMenuItemActive]", inputs: ["thyActionMenuItemActive"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5$1.ThyActionMenuItemIconDirective, selector: "[thyActionMenuItemIcon]" }, { type: i5$1.ThyActionMenuItemNameDirective, selector: "[thyActionMenuItemName]" }] });
10257
+ TheVerticalToolbarItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheVerticalToolbarItemComponent, selector: "the-toolbar-vertical-align-item", inputs: { item: "item", menus: "menus", editor: "editor", toolbarItem: "toolbarItem" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)" }, properties: { "class.hide": "!active" }, classAttribute: "the-toolbar-dropdown-container verticalAlign" }, viewQueries: [{ propertyName: "template", first: true, predicate: ["VerticalAlignItems"], descendants: true, read: TemplateRef, static: true }], usesInheritance: true, ngImport: i0, template: "<a\n thyIconNavLink\n class=\"icon-mode link-with-down\"\n [thyTooltip]=\"toolbarItem?.name\"\n [thyIconNavLinkActive]=\"isOpened\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"execute($event)\"\n>\n <thy-icon [thyIconName]=\"activeMenu?.icon\"></thy-icon>\n <thy-icon class=\"caret-down-icon font-size-sm text-desc\" thyIconName=\"caret-down\"></thy-icon>\n</a>\n\n<ng-template #VerticalAlignItems>\n <thy-action-menu class=\"dropdown\">\n <ng-container *ngFor=\"let menu of toolbarItem?.includes\">\n <a\n thyActionMenuItem\n href=\"javascript:;\"\n [thyActionMenuItemActive]=\"menu.key === activeMenu?.key\"\n [ngStyle]=\"menu?.styles\"\n (mousedown)=\"itemMousedown($event, menu)\"\n >\n <span *ngIf=\"menu.icon\" thyActionMenuItemIcon>\n <thy-icon [thyIconName]=\"menu?.icon\"></thy-icon>\n </span>\n <span thyActionMenuItemName>{{ menu.name }}</span>\n </a>\n </ng-container>\n </thy-action-menu>\n</ng-template>\n", components: [{ type: i2.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i5$1.ThyActionMenuComponent, selector: "thy-action-menu", inputs: ["thyTheme", "thyWidth"] }], directives: [{ type: i7.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5$1.ThyActionMenuItemDirective, selector: "[thyActionMenuItem]", inputs: ["thyDisabled", "thyType"] }, { type: i5$1.ThyActionMenuItemActiveDirective, selector: "[thyActionMenuItemActive]", inputs: ["thyActionMenuItemActive"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5$1.ThyActionMenuItemIconDirective, selector: "[thyActionMenuItemIcon]" }, { type: i5$1.ThyActionMenuItemNameDirective, selector: "[thyActionMenuItemName]" }] });
10169
10258
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheVerticalToolbarItemComponent, decorators: [{
10170
10259
  type: Component,
10171
10260
  args: [{
@@ -10187,6 +10276,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
10187
10276
  }], template: [{
10188
10277
  type: ViewChild,
10189
10278
  args: ['VerticalAlignItems', { read: TemplateRef, static: true }]
10279
+ }], handleDocumentMouseDown: [{
10280
+ type: HostListener,
10281
+ args: ['document: mousedown', ['$event']]
10190
10282
  }] } });
10191
10283
 
10192
10284
  const VerticalAlignOptions = [
@@ -10222,6 +10314,383 @@ const VerticalAlignOptions = [
10222
10314
  }
10223
10315
  ];
10224
10316
 
10317
+ const PaintFormatEditor = {
10318
+ formatBrush(editor) {
10319
+ const contextService = editor.injector.get(TheContextService);
10320
+ const obj = {};
10321
+ for (const key of MarkProps) {
10322
+ const k = contextService.paintFormatStatus.marks[key];
10323
+ obj[key] = k || null;
10324
+ }
10325
+ const block = anchorBlock(editor);
10326
+ if (block && Range.isCollapsed(editor.selection)) {
10327
+ // TODO:: 在撤销时有bug, 临时使用withoutSaving处理
10328
+ HistoryEditor.withoutSaving(editor, () => {
10329
+ const path = TheEditor.findPath(editor, block);
10330
+ setMarks(editor, obj, path);
10331
+ });
10332
+ }
10333
+ else {
10334
+ setMarks(editor, obj);
10335
+ }
10336
+ PaintFormatEditor.cancelFormatBrushStatus(editor);
10337
+ },
10338
+ isActive(editor) {
10339
+ const contextService = editor.injector.get(TheContextService);
10340
+ const res = contextService.paintFormatStatus.isActive;
10341
+ return res;
10342
+ },
10343
+ enableFormatBrush(editor) {
10344
+ const contextService = editor.injector.get(TheContextService);
10345
+ if (contextService.paintFormatStatus.isActive) {
10346
+ return PaintFormatEditor.cancelFormatBrushStatus(editor);
10347
+ }
10348
+ contextService.paintFormatStatus = {
10349
+ isActive: true,
10350
+ marks: getSelectionMarks(editor)
10351
+ };
10352
+ const element = EDITOR_TO_ELEMENT.get(editor);
10353
+ element.classList.add('pointer-paint');
10354
+ contextService.onMouseUp$
10355
+ .pipe(skip(1), filter(event => element.contains(event.target)), take(1))
10356
+ .subscribe((event) => {
10357
+ if (contextService.paintFormatStatus.isActive) {
10358
+ PaintFormatEditor.formatBrush(editor);
10359
+ }
10360
+ });
10361
+ editor.onChange();
10362
+ },
10363
+ cancelFormatBrushStatus(editor) {
10364
+ const contextService = editor.injector.get(TheContextService);
10365
+ contextService.paintFormatStatus = {
10366
+ isActive: false,
10367
+ marks: {}
10368
+ };
10369
+ const element = EDITOR_TO_ELEMENT.get(editor);
10370
+ element.classList.remove('pointer-paint');
10371
+ editor.onChange();
10372
+ }
10373
+ };
10374
+
10375
+ const PaintFormatOptions = [
10376
+ {
10377
+ key: ToolbarActionTypes.undo,
10378
+ icon: 'undo',
10379
+ name: '撤销',
10380
+ execute: (editor) => editor.undo()
10381
+ },
10382
+ {
10383
+ key: ToolbarActionTypes.redo,
10384
+ icon: 'redo',
10385
+ name: '重做',
10386
+ execute: (editor) => editor.redo()
10387
+ },
10388
+ {
10389
+ key: ToolbarActionTypes.paintformat,
10390
+ icon: 'paintformat',
10391
+ name: '格式刷',
10392
+ execute: PaintFormatEditor.enableFormatBrush,
10393
+ active: PaintFormatEditor.isActive
10394
+ },
10395
+ {
10396
+ key: ToolbarActionTypes.clean,
10397
+ icon: 'clean',
10398
+ name: '清除格式',
10399
+ execute: (editor) => {
10400
+ const { selection } = editor;
10401
+ if (!selection) {
10402
+ return;
10403
+ }
10404
+ if (TableEditor.clearMark(editor)) {
10405
+ return;
10406
+ }
10407
+ if (Range.isCollapsed(selection)) {
10408
+ const marks = Editor.marks(editor);
10409
+ for (const key of Object.keys(marks)) {
10410
+ Editor.removeMark(editor, key);
10411
+ }
10412
+ }
10413
+ else {
10414
+ const unsetMarks = {};
10415
+ MarkProps.forEach(key => {
10416
+ unsetMarks[key] = null;
10417
+ });
10418
+ setMarks(editor, unsetMarks);
10419
+ }
10420
+ }
10421
+ }
10422
+ ];
10423
+
10424
+ /**
10425
+ * whether the current node is a clean paragraph
10426
+ * @param editor
10427
+ * @param text
10428
+ * @returns boolean
10429
+ */
10430
+ const isCleanEmptyParagraph = (editor) => {
10431
+ const isCollapsedCursor = TheEditor.isFocused(editor) && editor.selection && Range.isCollapsed(editor.selection);
10432
+ if (!isCollapsedCursor) {
10433
+ return false;
10434
+ }
10435
+ const block = Node.ancestor(editor, [editor.selection.anchor.path[0]]);
10436
+ const textIndent = 'textIndent';
10437
+ const align = 'align';
10438
+ const hasTextIndent = block[textIndent];
10439
+ const hasAlign = block[align];
10440
+ if (Node.string(block) === '' &&
10441
+ Element$1.isElement(block) &&
10442
+ block.type === ElementKinds.paragraph &&
10443
+ block.children.length === 1 &&
10444
+ Text.isText(block.children[0]) &&
10445
+ !Editor.isVoid(editor, block) &&
10446
+ !hasTextIndent &&
10447
+ !hasAlign) {
10448
+ return true;
10449
+ }
10450
+ return false;
10451
+ };
10452
+
10453
+ class TheToolbarItemComponent extends TheToolbarBaseItemComponent {
10454
+ constructor(ngZone, cfr) {
10455
+ super();
10456
+ this.ngZone = ngZone;
10457
+ this.cfr = cfr;
10458
+ this.itemMode = ToolbarItemMode.horizontal;
10459
+ this.ToolbarItemMode = ToolbarItemMode;
10460
+ this.active = false;
10461
+ }
10462
+ ngOnInit() {
10463
+ var _a, _b;
10464
+ if (((_a = this.item) === null || _a === void 0 ? void 0 : _a.quickItemComponent) && isComponentType((_b = this.item) === null || _b === void 0 ? void 0 : _b.quickItemComponent)) {
10465
+ this.renderToolbarItem();
10466
+ }
10467
+ }
10468
+ statusChange(editor) {
10469
+ var _a, _b;
10470
+ 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;
10471
+ }
10472
+ execute(event) {
10473
+ var _a, _b, _c;
10474
+ super.execute(event);
10475
+ if (!((_a = this.item) === null || _a === void 0 ? void 0 : _a.execute) || ((_b = this.editor) === null || _b === void 0 ? void 0 : _b.disabled)) {
10476
+ return;
10477
+ }
10478
+ (_c = this.item) === null || _c === void 0 ? void 0 : _c.execute(this.editor);
10479
+ }
10480
+ renderToolbarItem() {
10481
+ this.ngZone.run(() => {
10482
+ const toolbarItemFactory = this.cfr.resolveComponentFactory(this.item.quickItemComponent);
10483
+ const tollbarItemRef = this.toolbarContainer.createComponent(toolbarItemFactory);
10484
+ tollbarItemRef.instance.editor = this.editor;
10485
+ tollbarItemRef.instance.item = this.item;
10486
+ tollbarItemRef.instance.itemMode = ToolbarItemMode.vertical;
10487
+ });
10488
+ }
10489
+ }
10490
+ 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 });
10491
+ 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: `
10492
+ <ng-container *ngIf="itemMode === ToolbarItemMode.horizontal; else selectionItem">
10493
+ <a
10494
+ thyIconNavLink
10495
+ [thyIconNavLinkIcon]="item.icon"
10496
+ [thyTooltip]="item.name"
10497
+ thyTooltipPlacement="top"
10498
+ [thyIconNavLinkActive]="active"
10499
+ (mousedown)="execute($event)"
10500
+ ></a>
10501
+ </ng-container>
10502
+ <ng-template #selectionItem>
10503
+ <ng-container *ngIf="!item?.quickItemComponent">
10504
+ <thy-icon [thyIconName]="item?.icon" [thyIconRotate]="0" class="quick-toolbar-icon"></thy-icon>
10505
+ <span class="quick-toolbar-name">{{ item?.name }}</span>
10506
+ </ng-container>
10507
+ </ng-template>
10508
+ <ng-container #toolbarContainer></ng-container>
10509
+ `, 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"] }] });
10510
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarItemComponent, decorators: [{
10511
+ type: Component,
10512
+ args: [{
10513
+ selector: 'the-toolbar-item',
10514
+ template: `
10515
+ <ng-container *ngIf="itemMode === ToolbarItemMode.horizontal; else selectionItem">
10516
+ <a
10517
+ thyIconNavLink
10518
+ [thyIconNavLinkIcon]="item.icon"
10519
+ [thyTooltip]="item.name"
10520
+ thyTooltipPlacement="top"
10521
+ [thyIconNavLinkActive]="active"
10522
+ (mousedown)="execute($event)"
10523
+ ></a>
10524
+ </ng-container>
10525
+ <ng-template #selectionItem>
10526
+ <ng-container *ngIf="!item?.quickItemComponent">
10527
+ <thy-icon [thyIconName]="item?.icon" [thyIconRotate]="0" class="quick-toolbar-icon"></thy-icon>
10528
+ <span class="quick-toolbar-name">{{ item?.name }}</span>
10529
+ </ng-container>
10530
+ </ng-template>
10531
+ <ng-container #toolbarContainer></ng-container>
10532
+ `,
10533
+ host: {
10534
+ class: 'the-toolbar-item'
10535
+ }
10536
+ }]
10537
+ }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.ComponentFactoryResolver }]; }, propDecorators: { item: [{
10538
+ type: Input
10539
+ }], editor: [{
10540
+ type: Input
10541
+ }], itemMode: [{
10542
+ type: Input
10543
+ }], toolbarContainer: [{
10544
+ type: ViewChild,
10545
+ args: ['toolbarContainer', { read: ViewContainerRef, static: true }]
10546
+ }] } });
10547
+
10548
+ class TheQuickToolbarComponent extends mixinUnsubscribe(MixinBase) {
10549
+ constructor(popoverRef, elementRef) {
10550
+ super();
10551
+ this.popoverRef = popoverRef;
10552
+ this.elementRef = elementRef;
10553
+ this.ToolbarItemMode = ToolbarItemMode;
10554
+ this.ToolbarActionTypes = ToolbarActionTypes;
10555
+ }
10556
+ handleMouseDown(event) {
10557
+ if (!this.elementRef.nativeElement.contains(event.target)) {
10558
+ this.popoverRef.close();
10559
+ }
10560
+ else {
10561
+ event.preventDefault();
10562
+ }
10563
+ }
10564
+ handleEnter() {
10565
+ this.popoverRef.close();
10566
+ }
10567
+ ngOnInit() {
10568
+ this.editorElement = AngularEditor.toDOMNode(this.editor, this.editor);
10569
+ }
10570
+ stopPropagation(event) {
10571
+ event.preventDefault();
10572
+ }
10573
+ selectionChange(event) {
10574
+ this.removeHotKey();
10575
+ const toolbarItem = this.quickToolbarItems.find(item => item.key === event.value);
10576
+ if (toolbarItem === null || toolbarItem === void 0 ? void 0 : toolbarItem.execute) {
10577
+ toolbarItem.execute(this.editor);
10578
+ }
10579
+ }
10580
+ removeHotKey() {
10581
+ const node = Node.get(this.editor, this.editor.selection.anchor.path);
10582
+ if (node && Text.equals({ text: QUICK_TOOLBAR_HOTKEY }, node)) {
10583
+ Editor.deleteBackward(this.editor);
10584
+ }
10585
+ }
10586
+ ngOnDestroy() {
10587
+ super.ngOnDestroy();
10588
+ }
10589
+ }
10590
+ 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 });
10591
+ 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"] }] });
10592
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheQuickToolbarComponent, decorators: [{
10593
+ type: Component,
10594
+ args: [{
10595
+ selector: 'the-quick-toolbar',
10596
+ templateUrl: 'quick-toolbar.component.html'
10597
+ }]
10598
+ }], ctorParameters: function () { return [{ type: i1$3.ThyPopoverRef }, { type: i0.ElementRef }]; }, propDecorators: { editor: [{
10599
+ type: Input
10600
+ }], quickToolbarItems: [{
10601
+ type: Input
10602
+ }], handleMouseDown: [{
10603
+ type: HostListener,
10604
+ args: ['document: mousedown', ['$event']]
10605
+ }], handleEnter: [{
10606
+ type: HostListener,
10607
+ args: ['document: keydown.enter']
10608
+ }] } });
10609
+
10610
+ const OperationTypes = ['insert_text', 'remove_node', 'merge_node'];
10611
+ const QuickInsertEditor = {
10612
+ openQuickToolbar(editor, toolbarItems, origin) {
10613
+ const overlay = editor.injector.get(Overlay);
10614
+ const viewContainerRef = editor.injector.get(ViewContainerRef);
10615
+ const thyPopover = editor.injector.get(ThyPopover);
10616
+ const quickToolbarRef = thyPopover.open(TheQuickToolbarComponent, {
10617
+ initialState: {
10618
+ editor,
10619
+ quickToolbarItems: toolbarItems
10620
+ },
10621
+ origin,
10622
+ viewContainerRef: viewContainerRef,
10623
+ backdropClosable: true,
10624
+ placement: 'bottomLeft',
10625
+ offset: 4,
10626
+ hasBackdrop: false,
10627
+ insideClosable: true,
10628
+ panelClass: 'the-quick-toolbar-container',
10629
+ scrollStrategy: overlay.scrollStrategies.reposition(),
10630
+ manualClosure: true
10631
+ });
10632
+ THE_EDITOR_QUICK_TOOLBAR_REF.set(editor, quickToolbarRef);
10633
+ },
10634
+ closeQuickToolbar(editor) {
10635
+ const quickToolbarRef = THE_EDITOR_QUICK_TOOLBAR_REF.get(editor);
10636
+ if (quickToolbarRef) {
10637
+ quickToolbarRef.close();
10638
+ THE_EDITOR_QUICK_TOOLBAR_REF.set(editor, null);
10639
+ }
10640
+ },
10641
+ isOpenToolbar(editor, opTypes = OperationTypes) {
10642
+ const isCollapsedCursor = TheEditor.isFocused(editor) && editor.selection && Range.isCollapsed(editor.selection);
10643
+ if (!isCollapsedCursor) {
10644
+ return false;
10645
+ }
10646
+ const block = Node.ancestor(editor, [editor.selection.anchor.path[0]]);
10647
+ const { undos } = editor.history;
10648
+ const lastBatch = undos[undos.length - 1];
10649
+ const lastOp = lastBatch && lastBatch[lastBatch.length - 1];
10650
+ if (lastOp &&
10651
+ block.children.length === 1 &&
10652
+ block.type === ElementKinds.paragraph &&
10653
+ Node.string(block) === QUICK_TOOLBAR_HOTKEY &&
10654
+ opTypes.includes(lastOp.type) &&
10655
+ (lastOp.text === QUICK_TOOLBAR_HOTKEY || lastOp.text === undefined)) {
10656
+ return true;
10657
+ }
10658
+ return false;
10659
+ }
10660
+ };
10661
+
10662
+ const withQuickInsert = (editor) => {
10663
+ const { onKeydown, deleteBackward, onChange } = editor;
10664
+ editor.onKeydown = (event) => {
10665
+ if (event.key === QUICK_TOOLBAR_HOTKEY && isCleanEmptyParagraph(editor)) {
10666
+ const rootNode = AngularEditor.toDOMNode(editor, Node.ancestor(editor, [editor.selection.anchor.path[0]]));
10667
+ const theEditorComponent = editor.injector.get(TheEditorComponent);
10668
+ const quickToolbars = theEditorComponent.quickToolbarItems;
10669
+ QuickInsertEditor.openQuickToolbar(editor, quickToolbars, rootNode);
10670
+ }
10671
+ onKeydown(event);
10672
+ };
10673
+ editor.deleteBackward = unit => {
10674
+ if (!QuickInsertEditor.isOpenToolbar(editor, ['remove_text'])) {
10675
+ QuickInsertEditor.closeQuickToolbar(editor);
10676
+ }
10677
+ deleteBackward(unit);
10678
+ };
10679
+ editor.onChange = () => {
10680
+ var _a;
10681
+ onChange();
10682
+ if (editor.selection) {
10683
+ const editorComponent = editor.injector.get(TheEditorComponent);
10684
+ (_a = editorComponent.quickInsertInstance) === null || _a === void 0 ? void 0 : _a.checkStatus();
10685
+ const block = Node.ancestor(editor, [editor.selection.anchor.path[0]]);
10686
+ if (!isCleanEmptyParagraph(editor) && Node.string(block) !== QUICK_TOOLBAR_HOTKEY) {
10687
+ QuickInsertEditor.closeQuickToolbar(editor);
10688
+ }
10689
+ }
10690
+ };
10691
+ return editor;
10692
+ };
10693
+
10225
10694
  const internalPlugins = [
10226
10695
  withTheHistory,
10227
10696
  withAutoInsertData(),
@@ -10229,7 +10698,6 @@ const internalPlugins = [
10229
10698
  withRemoveVoid,
10230
10699
  withBlockCard,
10231
10700
  withResetType,
10232
- withImage,
10233
10701
  withIndent([ElementKinds.checkItem, ElementKinds.numberedList, ElementKinds.bulletedList, ElementKinds.paragraph, ...HEADING_TYPES]),
10234
10702
  withList({ validLiChildrenTypes: [ElementKinds.image] }),
10235
10703
  withLink,
@@ -10249,7 +10717,9 @@ const internalPlugins = [
10249
10717
  withInsertParagraphNodes(),
10250
10718
  withGetFragment(),
10251
10719
  withDeserializeHMTL,
10252
- withDeserializeMd()
10720
+ withDeserializeMd(),
10721
+ withImage,
10722
+ withQuickInsert
10253
10723
  ];
10254
10724
  const internalToolbarItems = [
10255
10725
  ...AlignOptions,
@@ -10264,7 +10734,8 @@ const internalToolbarItems = [
10264
10734
  ...CodeOptions,
10265
10735
  ...LinkOptions,
10266
10736
  ...TableOptions,
10267
- ...VerticalAlignOptions
10737
+ ...VerticalAlignOptions,
10738
+ ...PaintFormatOptions
10268
10739
  ];
10269
10740
  const toolbarCompose = (toolbarItems = []) => {
10270
10741
  return [...internalToolbarItems, ...toolbarItems];
@@ -10303,11 +10774,11 @@ const shortcuts = (editor, event) => {
10303
10774
  };
10304
10775
 
10305
10776
  class TheToolbarService {
10306
- initialize(toolbarItems, global = DefaultGlobalToolbarDefinition, inline = DefaultInlineToolbarDefinition, block = DefaultBlockToolbarDefinition) {
10777
+ initialize(toolbarItems, global = DefaultGlobalToolbarDefinition, inline = DefaultInlineToolbarDefinition, quick = DefaultQuickToolbarDefinition) {
10307
10778
  const toolbarDefinition = {
10308
10779
  global,
10309
- block,
10310
- inline
10780
+ inline,
10781
+ quick
10311
10782
  };
10312
10783
  const toolbarOperations = new Map();
10313
10784
  toolbarItems.forEach(i => toolbarOperations.set(i.key, i));
@@ -10349,7 +10820,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
10349
10820
 
10350
10821
  const autoFocus = (editor, isFocus) => {
10351
10822
  setTimeout(() => {
10352
- if (editor && isFocus) {
10823
+ if (editor && editor.children.length > 0 && isFocus) {
10353
10824
  HistoryEditor.withoutMerging(editor, () => {
10354
10825
  AngularEditor.focus(editor);
10355
10826
  Transforms.select(editor, Editor.start(editor, [0]));
@@ -10386,59 +10857,6 @@ const autoScrollViewHandle = (editor, scrollContainer) => {
10386
10857
  previousHeight = currentHeight;
10387
10858
  };
10388
10859
 
10389
- class TheToolbarItemComponent extends TheToolbarBaseItemComponent {
10390
- constructor() {
10391
- super();
10392
- this.active = false;
10393
- }
10394
- statusChange(editor) {
10395
- var _a, _b;
10396
- 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;
10397
- }
10398
- execute(event) {
10399
- var _a, _b, _c;
10400
- super.execute(event);
10401
- if (!((_a = this.item) === null || _a === void 0 ? void 0 : _a.execute) || ((_b = this.editor) === null || _b === void 0 ? void 0 : _b.disabled)) {
10402
- return;
10403
- }
10404
- (_c = this.item) === null || _c === void 0 ? void 0 : _c.execute(this.editor);
10405
- }
10406
- }
10407
- TheToolbarItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
10408
- 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: `
10409
- <a
10410
- thyIconNavLink
10411
- [thyIconNavLinkIcon]="item.icon"
10412
- [thyTooltip]="item.name"
10413
- thyTooltipPlacement="top"
10414
- [thyIconNavLinkActive]="active"
10415
- (mousedown)="execute($event)"
10416
- ></a>
10417
- `, 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"] }] });
10418
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarItemComponent, decorators: [{
10419
- type: Component,
10420
- args: [{
10421
- selector: 'the-toolbar-item',
10422
- template: `
10423
- <a
10424
- thyIconNavLink
10425
- [thyIconNavLinkIcon]="item.icon"
10426
- [thyTooltip]="item.name"
10427
- thyTooltipPlacement="top"
10428
- [thyIconNavLinkActive]="active"
10429
- (mousedown)="execute($event)"
10430
- ></a>
10431
- `,
10432
- host: {
10433
- class: 'the-toolbar-item'
10434
- }
10435
- }]
10436
- }], ctorParameters: function () { return []; }, propDecorators: { item: [{
10437
- type: Input
10438
- }], editor: [{
10439
- type: Input
10440
- }] } });
10441
-
10442
10860
  class TheToolbarComponent {
10443
10861
  constructor(cfr, elementRef, ngZone, toolbarGroupComponent) {
10444
10862
  this.cfr = cfr;
@@ -10446,6 +10864,7 @@ class TheToolbarComponent {
10446
10864
  this.ngZone = ngZone;
10447
10865
  this.toolbarGroupComponent = toolbarGroupComponent;
10448
10866
  this.toolbarItems = [];
10867
+ this.containerClass = [];
10449
10868
  this.isMore = true;
10450
10869
  this.components = new Map();
10451
10870
  this.moreGroupMenu = ToolbarMoreGroup;
@@ -10471,9 +10890,8 @@ class TheToolbarComponent {
10471
10890
  }
10472
10891
  }
10473
10892
  setToolbarClass() {
10474
- if (this.editor) {
10475
- const toolbarClass = getToolbarClass(this.editor);
10476
- this.elementRef.nativeElement.classList.add(toolbarClass);
10893
+ if (this.editor && !!this.containerClass.length) {
10894
+ this.elementRef.nativeElement.classList.add(...this.containerClass);
10477
10895
  }
10478
10896
  }
10479
10897
  resizeElement() {
@@ -10643,7 +11061,7 @@ class TheToolbarComponent {
10643
11061
  }
10644
11062
  }
10645
11063
  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 });
10646
- 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"] }] });
11064
+ 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"] }] });
10647
11065
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarComponent, decorators: [{
10648
11066
  type: Component,
10649
11067
  args: [{
@@ -10662,6 +11080,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
10662
11080
  type: Input
10663
11081
  }], align: [{
10664
11082
  type: Input
11083
+ }], containerClass: [{
11084
+ type: Input
10665
11085
  }], isMore: [{
10666
11086
  type: Input
10667
11087
  }], afterTemplate: [{
@@ -10671,52 +11091,237 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
10671
11091
  args: ['toolbarContainer', { read: ViewContainerRef, static: true }]
10672
11092
  }] } });
10673
11093
 
11094
+ class TheInlineToolbarComponent {
11095
+ constructor(elementRef, scrollDispatcher, cdr, ngZone) {
11096
+ this.elementRef = elementRef;
11097
+ this.scrollDispatcher = scrollDispatcher;
11098
+ this.cdr = cdr;
11099
+ this.ngZone = ngZone;
11100
+ this.destroy$ = new Subject();
11101
+ }
11102
+ ngOnInit() {
11103
+ this.scrollDispatcher
11104
+ .scrolled()
11105
+ .pipe(takeUntil(this.destroy$))
11106
+ .subscribe(() => {
11107
+ this.updateInlineToolbar();
11108
+ this.cdr.detectChanges();
11109
+ });
11110
+ this.ngZone.runOutsideAngular(() => {
11111
+ merge(fromEvent(document, 'mouseup').pipe(filter((e) => e.button !== 2)), fromEvent(document, 'keyup').pipe(filter((e) => !e.shiftKey)))
11112
+ .pipe(debounceTime(200), takeUntil(this.destroy$))
11113
+ .subscribe(() => {
11114
+ var _a;
11115
+ this.updateInlineToolbar();
11116
+ (_a = this.inlineToolbar) === null || _a === void 0 ? void 0 : _a.statusChange(this.editor);
11117
+ this.cdr.detectChanges();
11118
+ });
11119
+ });
11120
+ }
11121
+ updateInlineToolbar() {
11122
+ const inlineToolbar = this.elementRef.nativeElement.firstElementChild;
11123
+ if (!this.editor.selection) {
11124
+ inlineToolbar.removeAttribute('style');
11125
+ return;
11126
+ }
11127
+ const anchorBlock$1 = anchorBlock(this.editor);
11128
+ if (!inlineToolbar || !anchorBlock$1) {
11129
+ return;
11130
+ }
11131
+ const { editor } = this;
11132
+ const { selection } = editor;
11133
+ if (!selection ||
11134
+ !AngularEditor.isFocused(editor) ||
11135
+ Range.isCollapsed(selection) ||
11136
+ Editor.string(editor, selection) === '') {
11137
+ inlineToolbar.removeAttribute('style');
11138
+ return;
11139
+ }
11140
+ if (!THE_INLINE_TOOLBAR_TYPES.includes(anchorBlock$1.type)) {
11141
+ return;
11142
+ }
11143
+ const native = window.getSelection();
11144
+ if (native.type !== 'None') {
11145
+ const range = native.getRangeAt(0);
11146
+ this.updatePosition(inlineToolbar, range);
11147
+ }
11148
+ }
11149
+ updatePosition(toolbarElement, range) {
11150
+ let boundary = range.getBoundingClientRect();
11151
+ if (!boundary || (boundary.height === 0 && boundary.width === 0 && range.startContainer === range.endContainer)) {
11152
+ if (range.startContainer.nodeType === 1 && range.startContainer.querySelector('img')) {
11153
+ boundary = range.startContainer.querySelector('img').getBoundingClientRect();
11154
+ }
11155
+ else {
11156
+ boundary = range.startContainer.getBoundingClientRect();
11157
+ }
11158
+ }
11159
+ const editableRect = document.querySelector('.the-editor-typo').getBoundingClientRect();
11160
+ const toolbarHeight = toolbarElement.offsetHeight;
11161
+ const toolbarWidth = toolbarElement.offsetWidth;
11162
+ const halfOffsetWidth = toolbarWidth / 2;
11163
+ const defaultLeft = -halfOffsetWidth;
11164
+ const offsetLeft = boundary.left - editableRect.left;
11165
+ const isTopLeft = offsetLeft - 30 > halfOffsetWidth; // 30: editable padding left
11166
+ const isTopRight = editableRect.width - offsetLeft - boundary.width / 2 < halfOffsetWidth;
11167
+ const positions = {};
11168
+ positions.top = boundary.top - toolbarHeight;
11169
+ positions.right = 'initial';
11170
+ positions.left = boundary.left;
11171
+ if (isTopLeft) {
11172
+ positions.left = boundary.left + boundary.width / 2 + defaultLeft;
11173
+ }
11174
+ if (isTopRight) {
11175
+ positions.left = boundary.right - toolbarWidth;
11176
+ }
11177
+ for (let key of Object.keys(positions)) {
11178
+ toolbarElement.style[key] = positions[key] + (isNaN(positions[key]) ? '' : 'px');
11179
+ }
11180
+ toolbarElement.style.opacity = '1';
11181
+ }
11182
+ ngOnDestroy() {
11183
+ this.destroy$.next();
11184
+ this.destroy$.complete();
11185
+ }
11186
+ }
11187
+ 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 }], target: i0.ɵɵFactoryTarget.Component });
11188
+ 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
11189
+ #inlineToolbar
11190
+ class="the-inline-toolbar"
11191
+ [editor]="editor"
11192
+ [toolbarItems]="toolbarItems"
11193
+ [isMore]="false"
11194
+ ></the-toolbar> `, isInline: true, components: [{ type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "containerClass", "isMore", "afterTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
11195
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheInlineToolbarComponent, decorators: [{
11196
+ type: Component,
11197
+ args: [{
11198
+ selector: 'the-inline-toolbar',
11199
+ template: `<the-toolbar
11200
+ #inlineToolbar
11201
+ class="the-inline-toolbar"
11202
+ [editor]="editor"
11203
+ [toolbarItems]="toolbarItems"
11204
+ [isMore]="false"
11205
+ ></the-toolbar> `,
11206
+ host: {
11207
+ '[class.hide]': 'toolbarItems.length === 0'
11208
+ },
11209
+ changeDetection: ChangeDetectionStrategy.OnPush
11210
+ }]
11211
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i2$1.ScrollDispatcher }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }]; }, propDecorators: { editor: [{
11212
+ type: Input
11213
+ }], toolbarItems: [{
11214
+ type: Input
11215
+ }], inlineToolbar: [{
11216
+ type: ViewChild,
11217
+ args: ['inlineToolbar']
11218
+ }] } });
11219
+
11220
+ class TheQuickInsertComponent {
11221
+ constructor(renderer, elementRef, cdr) {
11222
+ this.renderer = renderer;
11223
+ this.elementRef = elementRef;
11224
+ this.cdr = cdr;
11225
+ this.isHide = true;
11226
+ this.defaultIconName = 'plus-circle-thin';
11227
+ this.iconNameFill = 'plus-circle-thin-fill';
11228
+ this.displayIconName = this.defaultIconName;
11229
+ }
11230
+ handleMousedownNativeElement(event) {
11231
+ event.preventDefault();
11232
+ event.stopPropagation();
11233
+ }
11234
+ checkStatus() {
11235
+ var _a;
11236
+ const { editor } = this;
11237
+ if (isCleanEmptyParagraph(editor)) {
11238
+ 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]]);
11239
+ const rootNode = AngularEditor.toDOMNode(editor, block);
11240
+ this.isHide = false;
11241
+ this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
11242
+ return;
11243
+ }
11244
+ this.isHide = true;
11245
+ }
11246
+ updatePosition(left, top) {
11247
+ this.isHide = false;
11248
+ this.renderer.setStyle(this.elementRef.nativeElement, 'top', `${top}px`);
11249
+ this.renderer.setStyle(this.elementRef.nativeElement, 'left', `${left}px`);
11250
+ }
11251
+ mouseEnter(event) {
11252
+ this.displayIconName = this.iconNameFill;
11253
+ this.cdr.markForCheck();
11254
+ }
11255
+ mouseLeave(event) {
11256
+ this.displayIconName = this.defaultIconName;
11257
+ this.cdr.markForCheck();
11258
+ }
11259
+ handleClick(event) {
11260
+ event.stopPropagation();
11261
+ event.preventDefault();
11262
+ QuickInsertEditor.openQuickToolbar(this.editor, this.quickToolbarItems, this.iconElement.nativeElement);
11263
+ }
11264
+ }
11265
+ 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 });
11266
+ 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"] }] });
11267
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheQuickInsertComponent, decorators: [{
11268
+ type: Component,
11269
+ args: [{
11270
+ selector: '[theQuickInsert]',
11271
+ templateUrl: './quick-insert.component.html',
11272
+ host: {
11273
+ class: 'the-quick-insert',
11274
+ '[class.hide]': 'isHide'
11275
+ }
11276
+ }]
11277
+ }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { editor: [{
11278
+ type: Input
11279
+ }], quickToolbarItems: [{
11280
+ type: Input
11281
+ }], iconElement: [{
11282
+ type: ViewChild,
11283
+ args: ['iconElement', { read: ElementRef, static: false }]
11284
+ }], handleMousedownNativeElement: [{
11285
+ type: HostListener,
11286
+ args: ['mousedown', ['$event']]
11287
+ }] } });
11288
+
10674
11289
  class ThePlaceholderComponent {
10675
11290
  constructor(renderer, elementRef) {
10676
11291
  this.renderer = renderer;
10677
11292
  this.elementRef = elementRef;
10678
11293
  this.isHide = true;
10679
11294
  }
10680
- get selection() {
10681
- return this.editor.selection;
10682
- }
10683
11295
  handleCompositionStart() {
10684
- this.hide();
11296
+ var _a;
11297
+ if ((_a = this.editor) === null || _a === void 0 ? void 0 : _a.selection) {
11298
+ this.hide();
11299
+ }
10685
11300
  }
10686
11301
  handleCompositionEnd(event) {
10687
11302
  if (!event.data) {
10688
11303
  this.checkStatus();
10689
11304
  }
10690
11305
  }
10691
- checkStatus(value) {
11306
+ checkStatus() {
11307
+ var _a, _b;
10692
11308
  const { editor } = this;
10693
- const children = value ? value : editor.children;
10694
11309
  // empty content and no selection processing
10695
- if (this.autoFocus && !this.selection && isEmptyContent(children)) {
10696
- this.updatePosition(30, 51);
10697
- this.isHide = false;
11310
+ if (!(editor === null || editor === void 0 ? void 0 : editor.selection) && isEmptyContent(editor.children)) {
11311
+ // normal top is 28, but margin-top: -41px is set when maxHeight is set, so top is 69
11312
+ const firstTop = ((_a = this.options) === null || _a === void 0 ? void 0 : _a.maxHeight) ? 69 : 28;
11313
+ this.updatePosition(30, firstTop);
10698
11314
  return;
10699
11315
  }
10700
- if (AngularEditor.isFocused(editor) && this.selection && Range.isCollapsed(this.selection)) {
10701
- const block = Node.ancestor(editor, [this.selection.anchor.path[0]]);
10702
- const textIndent = 'textIndent';
10703
- const align = 'align';
10704
- const hasTextIndent = block[textIndent];
10705
- const hasAlign = block[align];
10706
- if (Node.string(block) === '' &&
10707
- Element$1.isElement(block) &&
10708
- block.type === ElementKinds.paragraph &&
10709
- block.children.length === 1 &&
10710
- Text.isText(block.children[0]) &&
10711
- !Editor.isVoid(editor, block) &&
10712
- !hasTextIndent &&
10713
- !hasAlign) {
10714
- const rootNode = AngularEditor.toDOMNode(this.editor, block);
11316
+ if (isCleanEmptyParagraph(editor)) {
11317
+ const block = Node.ancestor(editor, [(_b = editor === null || editor === void 0 ? void 0 : editor.selection) === null || _b === void 0 ? void 0 : _b.anchor.path[0]]);
11318
+ const rootNode = AngularEditor.toDOMNode(editor, block);
11319
+ setTimeout(() => {
10715
11320
  this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
10716
- return;
10717
- }
11321
+ });
11322
+ return;
10718
11323
  }
10719
- this.hide();
11324
+ this.isHide = true;
10720
11325
  }
10721
11326
  updatePosition(left, top) {
10722
11327
  this.isHide = false;
@@ -10728,12 +11333,12 @@ class ThePlaceholderComponent {
10728
11333
  }
10729
11334
  }
10730
11335
  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 });
10731
- 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 });
11336
+ ThePlaceholderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: ThePlaceholderComponent, selector: "div[thePlaceholder]", inputs: { editor: "editor", options: "options" }, host: { listeners: { "document:compositionstart": "handleCompositionStart()", "document:compositionend": "handleCompositionEnd($event)" }, properties: { "class.hide": "isHide" }, classAttribute: "the-placeholder" }, ngImport: i0, template: `{{ options?.placeholder }}`, isInline: true });
10732
11337
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: ThePlaceholderComponent, decorators: [{
10733
11338
  type: Component,
10734
11339
  args: [{
10735
11340
  selector: 'div[thePlaceholder]',
10736
- template: `{{ placeholder }}`,
11341
+ template: `{{ options?.placeholder }}`,
10737
11342
  host: {
10738
11343
  class: 'the-placeholder',
10739
11344
  '[class.hide]': 'isHide'
@@ -10741,9 +11346,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
10741
11346
  }]
10742
11347
  }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }]; }, propDecorators: { editor: [{
10743
11348
  type: Input
10744
- }], autoFocus: [{
10745
- type: Input
10746
- }], placeholder: [{
11349
+ }], options: [{
10747
11350
  type: Input
10748
11351
  }], handleCompositionStart: [{
10749
11352
  type: HostListener,
@@ -10826,7 +11429,6 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
10826
11429
  this.theOnDOMEvent = new EventEmitter();
10827
11430
  this.theEditorCreated = new EventEmitter();
10828
11431
  this._plugins = [];
10829
- this.globalToolbarItems = [];
10830
11432
  this.autoScrollView = _.debounce(function (editor, scrollContainer) {
10831
11433
  return autoScrollViewHandle(editor, scrollContainer);
10832
11434
  }, 80);
@@ -10917,9 +11519,6 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
10917
11519
  this.onSlaCompositionEnd = (event) => { };
10918
11520
  this.onSlaDragStart = (event) => { };
10919
11521
  this.onSlaDragOver = (event) => { };
10920
- this.trackBy = (element) => {
10921
- return element.key;
10922
- };
10923
11522
  }
10924
11523
  get theGlobalToolbarInstance() {
10925
11524
  return this.theGlobalToolbar ? this.theGlobalToolbar : this.globalToolbarInstance;
@@ -10928,6 +11527,10 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
10928
11527
  var _a, _b;
10929
11528
  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;
10930
11529
  }
11530
+ get quickToolbarItems() {
11531
+ var _a;
11532
+ return (_a = this.toolbarEntity) === null || _a === void 0 ? void 0 : _a.quick;
11533
+ }
10931
11534
  ngOnInit() {
10932
11535
  this.initialize();
10933
11536
  this.onErrorHandler();
@@ -10983,22 +11586,23 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
10983
11586
  var _a;
10984
11587
  const toolbar = (_a = this === null || this === void 0 ? void 0 : this.theOptions) === null || _a === void 0 ? void 0 : _a.toolbar;
10985
11588
  const toolbarItems = toolbarCompose(toolbar === null || toolbar === void 0 ? void 0 : toolbar.toolbarItems);
10986
- 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);
10987
- this.globalToolbarItems = toolbarOption.toolbarEntity.global;
11589
+ 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);
11590
+ this.globalToolbarClass = ['the-global-toolbar', getToolbarClass(this.editor)];
11591
+ this.toolbarEntity = toolbarOption.toolbarEntity;
10988
11592
  if (this.theGlobalToolbar) {
10989
11593
  this.theGlobalToolbarInstance.editor = this.editor;
10990
11594
  this.theGlobalToolbarInstance.toolbarItems = toolbarOption.toolbarEntity.global;
11595
+ this.theGlobalToolbarInstance.containerClass = this.globalToolbarClass;
10991
11596
  this.theGlobalToolbarInstance.align = toolbar === null || toolbar === void 0 ? void 0 : toolbar.align;
10992
11597
  this.theGlobalToolbarInstance.setToolbarClass();
10993
11598
  this.theGlobalToolbarInstance.renderToolbarView();
10994
11599
  }
10995
11600
  }
10996
11601
  writeValue(value) {
10997
- var _a, _b;
11602
+ var _a;
10998
11603
  const data = dataDeserialize((_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.mode, value);
10999
11604
  // data-deserialize
11000
11605
  this.editorValue = data;
11001
- (_b = this.placeholderInstance) === null || _b === void 0 ? void 0 : _b.checkStatus(data);
11002
11606
  }
11003
11607
  registerOnChange(fn) {
11004
11608
  this.onChangeCallback = fn;
@@ -11009,7 +11613,8 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
11009
11613
  valueChange(value) {
11010
11614
  var _a, _b, _c, _d, _e;
11011
11615
  (_a = this.theGlobalToolbarInstance) === null || _a === void 0 ? void 0 : _a.statusChange(this.editor);
11012
- (_b = this.placeholderInstance) === null || _b === void 0 ? void 0 : _b.checkStatus();
11616
+ (_b = this.quickInsertInstance) === null || _b === void 0 ? void 0 : _b.checkStatus();
11617
+ this.placeholderInstance.checkStatus();
11013
11618
  // auto scroll view
11014
11619
  const scrollContainer = (_c = this.theOptions) === null || _c === void 0 ? void 0 : _c.scrollContainer;
11015
11620
  const maxHeight = (_d = this.theOptions) === null || _d === void 0 ? void 0 : _d.maxHeight;
@@ -11138,7 +11743,7 @@ TheEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
11138
11743
  useExisting: forwardRef(() => TheEditorComponent),
11139
11744
  multi: true
11140
11745
  }
11141
- ], 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 }\"\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"] }] });
11746
+ ], 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 (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\" [options]=\"theOptions\"></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", "options"] }, { 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"] }] });
11142
11747
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheEditorComponent, decorators: [{
11143
11748
  type: Component,
11144
11749
  args: [{
@@ -11181,6 +11786,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
11181
11786
  }], globalToolbarInstance: [{
11182
11787
  type: ViewChild,
11183
11788
  args: ['globalToolbar']
11789
+ }], quickInsertInstance: [{
11790
+ type: ViewChild,
11791
+ args: ['quickInsert', { static: true }]
11184
11792
  }], placeholderInstance: [{
11185
11793
  type: ViewChild,
11186
11794
  args: ['placeholder']
@@ -11299,7 +11907,7 @@ class TheToolbarGroupComponent {
11299
11907
  }
11300
11908
  }
11301
11909
  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 });
11302
- 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"] }] });
11910
+ 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"] }] });
11303
11911
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarGroupComponent, decorators: [{
11304
11912
  type: Component,
11305
11913
  args: [{
@@ -11346,10 +11954,12 @@ const COMPONENTS = [
11346
11954
  TheToolbarDropdownComponent,
11347
11955
  TheToolbarGroupComponent,
11348
11956
  TheToolbarItemComponent,
11957
+ TheInlineToolbarComponent,
11349
11958
  NavSplitLineComponent,
11350
11959
  TheTextComponent,
11351
11960
  TheDefaultElementComponent,
11352
- ThePlaceholderComponent,
11961
+ TheQuickInsertComponent,
11962
+ TheQuickToolbarComponent,
11353
11963
  TheColorSelectComponent,
11354
11964
  TheColorToolbarItemComponent,
11355
11965
  TheContextMenuComponent,
@@ -11376,7 +11986,8 @@ const PLUGIN_COMPONENTS = [
11376
11986
  TheTableToolbarComponent,
11377
11987
  TheTableComponent,
11378
11988
  TheTableRowComponent,
11379
- TheTdComponent
11989
+ TheTdComponent,
11990
+ ThePlaceholderComponent
11380
11991
  ];
11381
11992
  const PIPES = [ElementStylePipe, ElementClassPipe];
11382
11993
  class TheEditorModule {
@@ -11386,10 +11997,12 @@ TheEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version
11386
11997
  TheToolbarDropdownComponent,
11387
11998
  TheToolbarGroupComponent,
11388
11999
  TheToolbarItemComponent,
12000
+ TheInlineToolbarComponent,
11389
12001
  NavSplitLineComponent,
11390
12002
  TheTextComponent,
11391
12003
  TheDefaultElementComponent,
11392
- ThePlaceholderComponent,
12004
+ TheQuickInsertComponent,
12005
+ TheQuickToolbarComponent,
11393
12006
  TheColorSelectComponent,
11394
12007
  TheColorToolbarItemComponent,
11395
12008
  TheContextMenuComponent,
@@ -11413,7 +12026,8 @@ TheEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version
11413
12026
  TheTableToolbarComponent,
11414
12027
  TheTableComponent,
11415
12028
  TheTableRowComponent,
11416
- TheTdComponent], imports: [CommonModule, SlateModule, FormsModule, ThyIconModule,
12029
+ TheTdComponent,
12030
+ ThePlaceholderComponent], imports: [CommonModule, SlateModule, FormsModule, ThyIconModule,
11417
12031
  ThyAvatarModule,
11418
12032
  ThyNavModule,
11419
12033
  ThyFormModule,
@@ -11460,5 +12074,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
11460
12074
  * Generated bundle index. Do not edit.
11461
12075
  */
11462
12076
 
11463
- 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 };
12077
+ 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 };
11464
12078
  //# sourceMappingURL=worktile-theia.js.map