@worktile/theia 1.2.9 → 1.2.10

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 (73) hide show
  1. package/bundles/worktile-theia.umd.js +731 -133
  2. package/bundles/worktile-theia.umd.js.map +1 -1
  3. package/components/inline-toolbar/inline-toolbar.component.d.ts +24 -0
  4. package/components/inline-toolbar/inline-toolbar.component.scss +18 -0
  5. package/components/nav-split-line/nav-split-line.component.d.ts +6 -1
  6. package/components/toolbar-dropdown/toolbar-dropdown.component.scss +3 -0
  7. package/components/toolbar-item/toolbar-item.component.d.ts +14 -5
  8. package/constants/node-types.d.ts +0 -1
  9. package/constants/toolbar.d.ts +6 -2
  10. package/custom-types.d.ts +1 -0
  11. package/editor.component.d.ts +6 -4
  12. package/editor.module.d.ts +59 -52
  13. package/esm2015/components/color-select/color-select.component.js +3 -2
  14. package/esm2015/components/inline-toolbar/inline-toolbar.component.js +123 -0
  15. package/esm2015/components/nav-split-line/nav-split-line.component.js +26 -5
  16. package/esm2015/components/toolbar-base-item/toolbar-base-item.component.js +3 -2
  17. package/esm2015/components/toolbar-item/toolbar-item.component.js +70 -24
  18. package/esm2015/constants/node-types.js +1 -2
  19. package/esm2015/constants/toolbar.js +37 -5
  20. package/esm2015/custom-types.js +1 -1
  21. package/esm2015/editor.component.js +24 -19
  22. package/esm2015/editor.module.js +15 -6
  23. package/esm2015/interfaces/toolbar.js +1 -1
  24. package/esm2015/plugins/deserializers/deserialize-html.plugin.js +8 -1
  25. package/esm2015/plugins/image/image.plugin.js +1 -2
  26. package/esm2015/plugins/index.js +8 -4
  27. package/esm2015/plugins/link/link.plugin.js +7 -2
  28. package/esm2015/plugins/list/list.plugin.js +7 -7
  29. package/esm2015/plugins/list/queries/get-start-list-item.js +9 -2
  30. package/esm2015/plugins/list/queries/is-selection-in-same-list-item.js +17 -0
  31. package/esm2015/plugins/paint-format/options.js +54 -0
  32. package/esm2015/plugins/paint-format/paint-format.editor.js +67 -0
  33. package/esm2015/plugins/placeholder/placeholder.component.js +75 -0
  34. package/esm2015/plugins/public-api.js +2 -1
  35. package/esm2015/plugins/quick-insert/components/quick-insert.component.js +76 -0
  36. package/esm2015/plugins/quick-insert/components/quick-toolbar/quick-toolbar.component.js +75 -0
  37. package/esm2015/plugins/quick-insert/quick-insert.editor.js +61 -0
  38. package/esm2015/plugins/quick-insert/quick-insert.plugint.js +37 -0
  39. package/esm2015/plugins/table/components/row/row.component.js +3 -1
  40. package/esm2015/plugins/table/components/table.component.js +6 -3
  41. package/esm2015/plugins/table/components/td/td.component.js +2 -1
  42. package/esm2015/plugins/table/components/toolbar/table-toolbar.component.js +1 -1
  43. package/esm2015/public-api.js +2 -1
  44. package/esm2015/services/context.service.js +2 -2
  45. package/esm2015/services/toolbar.service.js +5 -5
  46. package/esm2015/utils/auto-focus.js +2 -2
  47. package/esm2015/utils/is-clean-empty-paragraph.js +32 -0
  48. package/esm2015/utils/weak-maps.js +2 -1
  49. package/fesm2015/worktile-theia.js +726 -136
  50. package/fesm2015/worktile-theia.js.map +1 -1
  51. package/interfaces/toolbar.d.ts +3 -2
  52. package/package.json +1 -1
  53. package/plugins/list/queries/get-start-list-item.d.ts +8 -2
  54. package/plugins/list/queries/is-selection-in-same-list-item.d.ts +5 -0
  55. package/plugins/paint-format/options.d.ts +2 -0
  56. package/plugins/paint-format/paint-format.editor.d.ts +7 -0
  57. package/{components → plugins}/placeholder/placeholder.component.d.ts +5 -6
  58. package/{components → plugins}/placeholder/placeholder.component.scss +0 -0
  59. package/plugins/public-api.d.ts +1 -0
  60. package/plugins/quick-insert/components/quick-insert.component.d.ts +25 -0
  61. package/plugins/quick-insert/components/quick-insert.component.scss +21 -0
  62. package/plugins/quick-insert/components/quick-toolbar/quick-toolbar.component.d.ts +29 -0
  63. package/plugins/quick-insert/components/quick-toolbar/quick-toolbar.component.scss +21 -0
  64. package/plugins/quick-insert/quick-insert.editor.d.ts +8 -0
  65. package/plugins/quick-insert/quick-insert.plugint.d.ts +2 -0
  66. package/plugins/table/components/table.component.d.ts +1 -0
  67. package/public-api.d.ts +1 -0
  68. package/services/toolbar.service.d.ts +1 -1
  69. package/styles/editor.scss +31 -9
  70. package/styles/index.scss +5 -2
  71. package/utils/is-clean-empty-paragraph.d.ts +8 -0
  72. package/utils/weak-maps.d.ts +1 -0
  73. package/esm2015/components/placeholder/placeholder.component.js +0 -88
@@ -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'
@@ -1431,6 +1463,7 @@ const insertTheElements = (editor, nodes) => {
1431
1463
 
1432
1464
  const THE_EDITOR_UUID = new WeakMap();
1433
1465
  const THE_EDITOR_CONVERSION_HINT_REF = new WeakMap();
1466
+ const THE_EDITOR_QUICK_TOOLBAR_REF = new WeakMap();
1434
1467
 
1435
1468
  const closeConversionHint = (editor) => {
1436
1469
  const hintRef = THE_EDITOR_CONVERSION_HINT_REF.get(editor);
@@ -2199,7 +2232,7 @@ class TheContextService {
2199
2232
  }
2200
2233
  getOptions() {
2201
2234
  if (!this.options.width) {
2202
- this.options.width = this.options.nativeElement.querySelector('.slate-editable-container').offsetWidth - 30;
2235
+ this.options.width = this.options.nativeElement.querySelector('.slate-editable-container').firstElementChild.offsetWidth;
2203
2236
  }
2204
2237
  return this.options;
2205
2238
  }
@@ -2468,7 +2501,6 @@ const withImage = (editor) => {
2468
2501
  return element.type === ElementKinds.image || isVoid(element);
2469
2502
  };
2470
2503
  editor.insertData = (data) => {
2471
- // TODO:: 底层有点问题,粘贴多张图片时只能识别一张
2472
2504
  if (data.files.length) {
2473
2505
  const imageFiles = [];
2474
2506
  for (const file of data.files) {
@@ -2597,13 +2629,19 @@ const getListTypes = () => {
2597
2629
  return [ElementKinds.bulletedList, ElementKinds.numberedList];
2598
2630
  };
2599
2631
 
2632
+ /**
2633
+ * 获取 List 中 ListItems,过滤掉空列表嵌套
2634
+ * @param node
2635
+ * @param initialValue
2636
+ * @returns
2637
+ */
2600
2638
  const getStartListItem = (node, initialValue) => {
2601
2639
  if (!initialValue) {
2602
2640
  initialValue = [];
2603
2641
  }
2604
2642
  if (node) {
2605
2643
  return node.reduce((result, current) => {
2606
- if (current.type == ElementKinds.listItem && current.children[0].type === ElementKinds.default) {
2644
+ if ((current.type === ElementKinds.listItem && !getListTypes().includes(current.children[0].type))) {
2607
2645
  result.push(current);
2608
2646
  }
2609
2647
  else {
@@ -3257,6 +3295,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
3257
3295
  }]
3258
3296
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; } });
3259
3297
 
3298
+ /**
3299
+ * Is the selection in same li
3300
+ */
3301
+ const isSelectionInSameListItem = (editor) => {
3302
+ const { selection } = editor;
3303
+ if (!selection) {
3304
+ return false;
3305
+ }
3306
+ const [start, end] = Range.edges(selection);
3307
+ const startListItemEntry = getAboveByType(editor, ElementKinds.listItem, { at: start.path });
3308
+ const endListItemEntry = getAboveByType(editor, ElementKinds.listItem, { at: end.path });
3309
+ return startListItemEntry && endListItemEntry && Path.equals(startListItemEntry[1], endListItemEntry[1]);
3310
+ };
3311
+
3260
3312
  const withList = ({ validLiChildrenTypes } = {}) => (editor) => {
3261
3313
  const { insertBreak, deleteBackward, onKeydown, insertData, setFragmentData, renderElement } = editor;
3262
3314
  const resetBlockTypesListRule = {
@@ -3339,15 +3391,14 @@ const withList = ({ validLiChildrenTypes } = {}) => (editor) => {
3339
3391
  const fragmentElement = fragmentData[0];
3340
3392
  if (getListTypes().includes(fragmentElement.type)) {
3341
3393
  const startNodes = getStartListItem([fragmentElement.children[0]]);
3342
- // 复制列表中的图片时startNodes长度为零
3343
- if (startNodes.length === 0) {
3344
- setFragmentData(unit);
3345
- return;
3346
- }
3347
3394
  const children = startNodes.concat(fragmentElement.children.slice(1));
3348
- const fragmentNodes = [
3395
+ let fragmentNodes = [
3349
3396
  Object.assign(Object.assign({}, fragmentElement), { children })
3350
3397
  ];
3398
+ if (isSelectionInSameListItem(editor)) {
3399
+ // 仅仅复制列表中的内容
3400
+ fragmentNodes = children[0].children;
3401
+ }
3351
3402
  const fragment = fragmentNodes.concat(fragmentData.slice(1));
3352
3403
  const domRange = AngularEditor.toDOMRange(editor, selection);
3353
3404
  const contents = domRange.cloneContents();
@@ -5614,6 +5665,7 @@ class TheColorSelectComponent {
5614
5665
  }
5615
5666
  }
5616
5667
  _selectColor(event, color) {
5668
+ event.preventDefault();
5617
5669
  event.stopPropagation();
5618
5670
  if (this.option.specialColor && color === this.option.specialColor) {
5619
5671
  color = '';
@@ -5644,7 +5696,7 @@ class TheColorSelectComponent {
5644
5696
  }
5645
5697
  }
5646
5698
  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 });
5699
+ 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
5700
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheColorSelectComponent, decorators: [{
5649
5701
  type: Component,
5650
5702
  args: [{
@@ -5760,9 +5812,10 @@ const ColorEditor = {
5760
5812
 
5761
5813
  class TheToolbarBaseItemComponent {
5762
5814
  execute(event) {
5815
+ var _a;
5763
5816
  event.preventDefault();
5764
5817
  event.stopPropagation();
5765
- if (!this.itemMousedownHandle && !this.editor.selection) {
5818
+ if (!this.itemMousedownHandle && !((_a = this.editor) === null || _a === void 0 ? void 0 : _a.selection)) {
5766
5819
  const lastNode = getLastNode(this.editor, 1);
5767
5820
  const end = Editor.end(this.editor, lastNode[1]);
5768
5821
  Transforms.select(this.editor, end);
@@ -6717,6 +6770,7 @@ const withLink = (editor) => {
6717
6770
  editor.insertText = text => {
6718
6771
  if (text && isUrl(text)) {
6719
6772
  LinkEditor.wrapLink(editor, text, text);
6773
+ Transforms.move(editor, { distance: 1, unit: "offset" });
6720
6774
  }
6721
6775
  else {
6722
6776
  insertText(text);
@@ -6724,8 +6778,10 @@ const withLink = (editor) => {
6724
6778
  };
6725
6779
  editor.insertData = data => {
6726
6780
  const text = data.getData('text/plain');
6727
- if (text && isUrl(text)) {
6781
+ const fragment = data.getData(`application/${CLIPBOARD_FORMAT_KEY}`);
6782
+ if (text && isUrl(text) && !fragment) {
6728
6783
  LinkEditor.wrapLink(editor, text, text);
6784
+ Transforms.move(editor, { distance: 1, unit: "offset" });
6729
6785
  }
6730
6786
  else {
6731
6787
  insertData(data);
@@ -7557,18 +7613,38 @@ function setCellMenuInvisibility(editor, menuList, selectedCells, isActiveSelect
7557
7613
  }
7558
7614
 
7559
7615
  class NavSplitLineComponent {
7560
- constructor() { }
7616
+ constructor() {
7617
+ this.mode = ToolbarItemMode.vertical;
7618
+ this.theNavSplitLine = true;
7619
+ }
7620
+ get horizontal() {
7621
+ return this.mode === ToolbarItemMode.horizontal;
7622
+ }
7623
+ get vertical() {
7624
+ return this.mode === ToolbarItemMode.vertical;
7625
+ }
7561
7626
  ngOnInit() { }
7562
7627
  }
7563
7628
  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 });
7629
+ 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
7630
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: NavSplitLineComponent, decorators: [{
7566
7631
  type: Component,
7567
7632
  args: [{
7568
7633
  selector: 'nav-split-line',
7569
7634
  template: ''
7570
7635
  }]
7571
- }], ctorParameters: function () { return []; } });
7636
+ }], ctorParameters: function () { return []; }, propDecorators: { mode: [{
7637
+ type: Input
7638
+ }], theNavSplitLine: [{
7639
+ type: HostBinding,
7640
+ args: ['class.the-nav-split-line']
7641
+ }], horizontal: [{
7642
+ type: HostBinding,
7643
+ args: ['class.horizontal']
7644
+ }], vertical: [{
7645
+ type: HostBinding,
7646
+ args: ['class.vertical']
7647
+ }] } });
7572
7648
 
7573
7649
  class TheTableToolbarComponent {
7574
7650
  constructor(ngZone, colorSelectService, popoverRef) {
@@ -7680,7 +7756,7 @@ class TheTableToolbarComponent {
7680
7756
  }
7681
7757
  }
7682
7758
  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"] }] });
7759
+ 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
7760
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheTableToolbarComponent, decorators: [{
7685
7761
  type: Component,
7686
7762
  args: [{
@@ -8329,9 +8405,12 @@ class TheTableComponent extends TheBaseElementComponent {
8329
8405
  useRowControls() {
8330
8406
  if (this.selection) {
8331
8407
  this.rowControls = this.calculateRowControls();
8332
- this.cdr.detectChanges();
8408
+ this.cdr.markForCheck();
8333
8409
  }
8334
8410
  }
8411
+ detectChanges() {
8412
+ this.cdr.detectChanges();
8413
+ }
8335
8414
  calculateMinRowSpanCellForRows() {
8336
8415
  const table = this.element;
8337
8416
  const cells = table.children.map((row, index) => {
@@ -8593,7 +8672,7 @@ TheTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", vers
8593
8672
  provide: TheTableToken,
8594
8673
  useExisting: TheTableComponent
8595
8674
  }
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"] }] });
8675
+ ], 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
8676
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheTableComponent, decorators: [{
8598
8677
  type: Component,
8599
8678
  args: [{
@@ -8677,11 +8756,13 @@ class TheTableRowComponent extends TheBaseElementComponent {
8677
8756
  super.onContextChange();
8678
8757
  if (this.initialized) {
8679
8758
  this.useBackground();
8759
+ this.useHeight();
8680
8760
  }
8681
8761
  }
8682
8762
  ngOnInit() {
8683
8763
  super.ngOnInit();
8684
8764
  this.useBackground();
8765
+ this.useHeight();
8685
8766
  }
8686
8767
  useBackground() {
8687
8768
  if (this.element.header && !this.backgroundColor) {
@@ -9426,6 +9507,7 @@ class TheTdComponent extends TheBaseElementComponent {
9426
9507
  this.applyRowSize(deltaSize);
9427
9508
  }
9428
9509
  this.tableComponent.useRowControls();
9510
+ this.tableComponent.detectChanges();
9429
9511
  this.updateOverlayHandleSizeAndOffset();
9430
9512
  }
9431
9513
  _createOverlayForHandle() {
@@ -10077,6 +10159,11 @@ const withDeserializeHMTL = (editor) => {
10077
10159
  if (html && !slateFragment) {
10078
10160
  const htmlDom = new DOMParser().parseFromString(html, 'text/html');
10079
10161
  const fragment = TheiaConverter.convertToTheia(Array.from(htmlDom.body.children));
10162
+ // 无法识别HTML内容时后退一下:识别纯文本
10163
+ if (fragment.length === 1 && Editor.isEmpty(editor, fragment[0]) && fragment[0].type === ElementKinds.paragraph) {
10164
+ insertData(data);
10165
+ return;
10166
+ }
10080
10167
  insertTheElements(editor, fragment);
10081
10168
  return;
10082
10169
  }
@@ -10227,6 +10314,382 @@ const VerticalAlignOptions = [
10227
10314
  }
10228
10315
  ];
10229
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
+ onChange();
10681
+ if (editor.selection) {
10682
+ const editorComponent = editor.injector.get(TheEditorComponent);
10683
+ editorComponent.quickInsertInstance.checkStatus();
10684
+ const block = Node.ancestor(editor, [editor.selection.anchor.path[0]]);
10685
+ if (!isCleanEmptyParagraph(editor) && Node.string(block) !== QUICK_TOOLBAR_HOTKEY) {
10686
+ QuickInsertEditor.closeQuickToolbar(editor);
10687
+ }
10688
+ }
10689
+ };
10690
+ return editor;
10691
+ };
10692
+
10230
10693
  const internalPlugins = [
10231
10694
  withTheHistory,
10232
10695
  withAutoInsertData(),
@@ -10234,7 +10697,6 @@ const internalPlugins = [
10234
10697
  withRemoveVoid,
10235
10698
  withBlockCard,
10236
10699
  withResetType,
10237
- withImage,
10238
10700
  withIndent([ElementKinds.checkItem, ElementKinds.numberedList, ElementKinds.bulletedList, ElementKinds.paragraph, ...HEADING_TYPES]),
10239
10701
  withList({ validLiChildrenTypes: [ElementKinds.image] }),
10240
10702
  withLink,
@@ -10254,7 +10716,9 @@ const internalPlugins = [
10254
10716
  withInsertParagraphNodes(),
10255
10717
  withGetFragment(),
10256
10718
  withDeserializeHMTL,
10257
- withDeserializeMd()
10719
+ withDeserializeMd(),
10720
+ withImage,
10721
+ withQuickInsert
10258
10722
  ];
10259
10723
  const internalToolbarItems = [
10260
10724
  ...AlignOptions,
@@ -10269,7 +10733,8 @@ const internalToolbarItems = [
10269
10733
  ...CodeOptions,
10270
10734
  ...LinkOptions,
10271
10735
  ...TableOptions,
10272
- ...VerticalAlignOptions
10736
+ ...VerticalAlignOptions,
10737
+ ...PaintFormatOptions
10273
10738
  ];
10274
10739
  const toolbarCompose = (toolbarItems = []) => {
10275
10740
  return [...internalToolbarItems, ...toolbarItems];
@@ -10308,11 +10773,11 @@ const shortcuts = (editor, event) => {
10308
10773
  };
10309
10774
 
10310
10775
  class TheToolbarService {
10311
- initialize(toolbarItems, global = DefaultGlobalToolbarDefinition, inline = DefaultInlineToolbarDefinition, block = DefaultBlockToolbarDefinition) {
10776
+ initialize(toolbarItems, global = DefaultGlobalToolbarDefinition, inline = DefaultInlineToolbarDefinition, quick = DefaultQuickToolbarDefinition) {
10312
10777
  const toolbarDefinition = {
10313
10778
  global,
10314
- block,
10315
- inline
10779
+ inline,
10780
+ quick
10316
10781
  };
10317
10782
  const toolbarOperations = new Map();
10318
10783
  toolbarItems.forEach(i => toolbarOperations.set(i.key, i));
@@ -10354,7 +10819,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
10354
10819
 
10355
10820
  const autoFocus = (editor, isFocus) => {
10356
10821
  setTimeout(() => {
10357
- if (editor && isFocus) {
10822
+ if (editor && editor.children.length > 0 && isFocus) {
10358
10823
  HistoryEditor.withoutMerging(editor, () => {
10359
10824
  AngularEditor.focus(editor);
10360
10825
  Transforms.select(editor, Editor.start(editor, [0]));
@@ -10391,59 +10856,6 @@ const autoScrollViewHandle = (editor, scrollContainer) => {
10391
10856
  previousHeight = currentHeight;
10392
10857
  };
10393
10858
 
10394
- class TheToolbarItemComponent extends TheToolbarBaseItemComponent {
10395
- constructor() {
10396
- super();
10397
- this.active = false;
10398
- }
10399
- statusChange(editor) {
10400
- var _a, _b;
10401
- this.active = ((_a = this.item) === null || _a === void 0 ? void 0 : _a.active) ? (_b = this.item) === null || _b === void 0 ? void 0 : _b.active(editor) : false;
10402
- }
10403
- execute(event) {
10404
- var _a, _b, _c;
10405
- super.execute(event);
10406
- if (!((_a = this.item) === null || _a === void 0 ? void 0 : _a.execute) || ((_b = this.editor) === null || _b === void 0 ? void 0 : _b.disabled)) {
10407
- return;
10408
- }
10409
- (_c = this.item) === null || _c === void 0 ? void 0 : _c.execute(this.editor);
10410
- }
10411
- }
10412
- TheToolbarItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
10413
- TheToolbarItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheToolbarItemComponent, selector: "the-toolbar-item", inputs: { item: "item", editor: "editor" }, host: { classAttribute: "the-toolbar-item" }, usesInheritance: true, ngImport: i0, template: `
10414
- <a
10415
- thyIconNavLink
10416
- [thyIconNavLinkIcon]="item.icon"
10417
- [thyTooltip]="item.name"
10418
- thyTooltipPlacement="top"
10419
- [thyIconNavLinkActive]="active"
10420
- (mousedown)="execute($event)"
10421
- ></a>
10422
- `, isInline: true, components: [{ type: i2.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }], directives: [{ type: i7.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }] });
10423
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarItemComponent, decorators: [{
10424
- type: Component,
10425
- args: [{
10426
- selector: 'the-toolbar-item',
10427
- template: `
10428
- <a
10429
- thyIconNavLink
10430
- [thyIconNavLinkIcon]="item.icon"
10431
- [thyTooltip]="item.name"
10432
- thyTooltipPlacement="top"
10433
- [thyIconNavLinkActive]="active"
10434
- (mousedown)="execute($event)"
10435
- ></a>
10436
- `,
10437
- host: {
10438
- class: 'the-toolbar-item'
10439
- }
10440
- }]
10441
- }], ctorParameters: function () { return []; }, propDecorators: { item: [{
10442
- type: Input
10443
- }], editor: [{
10444
- type: Input
10445
- }] } });
10446
-
10447
10859
  class TheToolbarComponent {
10448
10860
  constructor(cfr, elementRef, ngZone, toolbarGroupComponent) {
10449
10861
  this.cfr = cfr;
@@ -10676,52 +11088,223 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
10676
11088
  args: ['toolbarContainer', { read: ViewContainerRef, static: true }]
10677
11089
  }] } });
10678
11090
 
11091
+ class TheInlineToolbarComponent {
11092
+ constructor(elementRef, scrollDispatcher, cdr, ngZone) {
11093
+ this.elementRef = elementRef;
11094
+ this.scrollDispatcher = scrollDispatcher;
11095
+ this.cdr = cdr;
11096
+ this.ngZone = ngZone;
11097
+ this.destroy$ = new Subject();
11098
+ }
11099
+ ngOnInit() {
11100
+ this.scrollDispatcher
11101
+ .scrolled()
11102
+ .pipe(takeUntil(this.destroy$))
11103
+ .subscribe(() => {
11104
+ this.updateInlineToolbar();
11105
+ this.cdr.detectChanges();
11106
+ });
11107
+ this.ngZone.runOutsideAngular(() => {
11108
+ merge(fromEvent(document, 'mouseup').pipe(filter((e) => e.button !== 2)), fromEvent(document, 'keyup').pipe(filter((e) => !e.shiftKey)))
11109
+ .pipe(debounceTime(200), takeUntil(this.destroy$))
11110
+ .subscribe(() => {
11111
+ var _a;
11112
+ this.updateInlineToolbar();
11113
+ (_a = this.inlineToolbar) === null || _a === void 0 ? void 0 : _a.statusChange(this.editor);
11114
+ this.cdr.detectChanges();
11115
+ });
11116
+ });
11117
+ }
11118
+ updateInlineToolbar() {
11119
+ const inlineToolbar = this.elementRef.nativeElement.firstElementChild;
11120
+ if (!this.editor.selection) {
11121
+ inlineToolbar.removeAttribute('style');
11122
+ return;
11123
+ }
11124
+ const anchorBlock$1 = anchorBlock(this.editor);
11125
+ if (!inlineToolbar || !anchorBlock$1) {
11126
+ return;
11127
+ }
11128
+ const { editor } = this;
11129
+ const { selection } = editor;
11130
+ if (!selection || !AngularEditor.isFocused(editor) || Range.isCollapsed(selection) || Editor.string(editor, selection) === '') {
11131
+ inlineToolbar.removeAttribute('style');
11132
+ return;
11133
+ }
11134
+ if (!THE_INLINE_TOOLBAR_TYPES.includes(anchorBlock$1.type)) {
11135
+ return;
11136
+ }
11137
+ const native = window.getSelection();
11138
+ if (native.type !== 'None') {
11139
+ const range = native.getRangeAt(0);
11140
+ this.updatePosition(inlineToolbar, range);
11141
+ }
11142
+ }
11143
+ updatePosition(toolbarElement, range) {
11144
+ let boundary = range.getBoundingClientRect();
11145
+ if (!boundary || (boundary.height === 0 && boundary.width === 0 && range.startContainer === range.endContainer)) {
11146
+ if (range.startContainer.nodeType === 1 && range.startContainer.querySelector('img')) {
11147
+ boundary = range.startContainer.querySelector('img').getBoundingClientRect();
11148
+ }
11149
+ else {
11150
+ boundary = range.startContainer.getBoundingClientRect();
11151
+ }
11152
+ }
11153
+ const toolbarHeight = toolbarElement.offsetHeight;
11154
+ const toolbarWidth = toolbarElement.offsetWidth;
11155
+ const halfOffsetWidth = toolbarWidth / 2;
11156
+ const defaultLeft = -halfOffsetWidth;
11157
+ const positions = {};
11158
+ positions.top = boundary.top - toolbarHeight;
11159
+ positions.left = boundary.left + boundary.width / 2 + defaultLeft;
11160
+ positions.right = 'initial';
11161
+ ['top', 'left', 'right'].forEach(key => {
11162
+ toolbarElement.style[key] = positions[key] + (isNaN(positions[key]) ? '' : 'px');
11163
+ });
11164
+ toolbarElement.style.opacity = '1';
11165
+ }
11166
+ ngOnDestroy() {
11167
+ this.destroy$.next();
11168
+ this.destroy$.complete();
11169
+ }
11170
+ }
11171
+ 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 });
11172
+ 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
11173
+ #inlineToolbar
11174
+ class="the-inline-toolbar"
11175
+ [editor]="editor"
11176
+ [toolbarItems]="toolbarItems"
11177
+ [isMore]="false"
11178
+ ></the-toolbar> `, isInline: true, components: [{ type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "isMore", "afterTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
11179
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheInlineToolbarComponent, decorators: [{
11180
+ type: Component,
11181
+ args: [{
11182
+ selector: 'the-inline-toolbar',
11183
+ template: `<the-toolbar
11184
+ #inlineToolbar
11185
+ class="the-inline-toolbar"
11186
+ [editor]="editor"
11187
+ [toolbarItems]="toolbarItems"
11188
+ [isMore]="false"
11189
+ ></the-toolbar> `,
11190
+ host: {
11191
+ '[class.hide]': 'toolbarItems.length === 0'
11192
+ },
11193
+ changeDetection: ChangeDetectionStrategy.OnPush
11194
+ }]
11195
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i2$1.ScrollDispatcher }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }]; }, propDecorators: { editor: [{
11196
+ type: Input
11197
+ }], toolbarItems: [{
11198
+ type: Input
11199
+ }], inlineToolbar: [{
11200
+ type: ViewChild,
11201
+ args: ['inlineToolbar']
11202
+ }] } });
11203
+
11204
+ class TheQuickInsertComponent {
11205
+ constructor(renderer, elementRef, cdr) {
11206
+ this.renderer = renderer;
11207
+ this.elementRef = elementRef;
11208
+ this.cdr = cdr;
11209
+ this.isHide = true;
11210
+ this.defaultIconName = 'plus-circle-thin';
11211
+ this.iconNameFill = 'plus-circle-thin-fill';
11212
+ this.displayIconName = this.defaultIconName;
11213
+ }
11214
+ handleMousedownNativeElement(event) {
11215
+ event.preventDefault();
11216
+ event.stopPropagation();
11217
+ }
11218
+ checkStatus() {
11219
+ var _a;
11220
+ const { editor } = this;
11221
+ if (isCleanEmptyParagraph(editor)) {
11222
+ 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]]);
11223
+ const rootNode = AngularEditor.toDOMNode(editor, block);
11224
+ this.isHide = false;
11225
+ this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
11226
+ return;
11227
+ }
11228
+ this.isHide = true;
11229
+ }
11230
+ updatePosition(left, top) {
11231
+ this.isHide = false;
11232
+ this.renderer.setStyle(this.elementRef.nativeElement, 'top', `${top}px`);
11233
+ this.renderer.setStyle(this.elementRef.nativeElement, 'left', `${left}px`);
11234
+ }
11235
+ mouseEnter(event) {
11236
+ this.displayIconName = this.iconNameFill;
11237
+ this.cdr.markForCheck();
11238
+ }
11239
+ mouseLeave(event) {
11240
+ this.displayIconName = this.defaultIconName;
11241
+ this.cdr.markForCheck();
11242
+ }
11243
+ handleClick(event) {
11244
+ event.stopPropagation();
11245
+ event.preventDefault();
11246
+ QuickInsertEditor.openQuickToolbar(this.editor, this.quickToolbarItems, this.iconElement.nativeElement);
11247
+ }
11248
+ }
11249
+ 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 });
11250
+ 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"] }] });
11251
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheQuickInsertComponent, decorators: [{
11252
+ type: Component,
11253
+ args: [{
11254
+ selector: '[theQuickInsert]',
11255
+ templateUrl: './quick-insert.component.html',
11256
+ host: {
11257
+ class: 'the-quick-insert',
11258
+ '[class.hide]': 'isHide'
11259
+ }
11260
+ }]
11261
+ }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { editor: [{
11262
+ type: Input
11263
+ }], quickToolbarItems: [{
11264
+ type: Input
11265
+ }], iconElement: [{
11266
+ type: ViewChild,
11267
+ args: ['iconElement', { read: ElementRef, static: false }]
11268
+ }], handleMousedownNativeElement: [{
11269
+ type: HostListener,
11270
+ args: ['mousedown', ['$event']]
11271
+ }] } });
11272
+
10679
11273
  class ThePlaceholderComponent {
10680
11274
  constructor(renderer, elementRef) {
10681
11275
  this.renderer = renderer;
10682
11276
  this.elementRef = elementRef;
10683
11277
  this.isHide = true;
10684
11278
  }
10685
- get selection() {
10686
- return this.editor.selection;
10687
- }
10688
11279
  handleCompositionStart() {
10689
- this.hide();
11280
+ var _a;
11281
+ if ((_a = this.editor) === null || _a === void 0 ? void 0 : _a.selection) {
11282
+ this.hide();
11283
+ }
10690
11284
  }
10691
11285
  handleCompositionEnd(event) {
10692
11286
  if (!event.data) {
10693
11287
  this.checkStatus();
10694
11288
  }
10695
11289
  }
10696
- checkStatus(value) {
11290
+ checkStatus() {
11291
+ var _a, _b, _c;
10697
11292
  const { editor } = this;
10698
- const children = value ? value : editor.children;
10699
11293
  // empty content and no selection processing
10700
- if (this.autoFocus && !this.selection && isEmptyContent(children)) {
10701
- this.updatePosition(30, 51);
10702
- this.isHide = false;
11294
+ if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.autoFocus) && !(editor === null || editor === void 0 ? void 0 : editor.selection) && isEmptyContent(editor.children)) {
11295
+ // normal top is 28, but margin-top: -41px is set when maxHeight is set, so top is 69
11296
+ const firstTop = ((_b = this.options) === null || _b === void 0 ? void 0 : _b.maxHeight) ? 69 : 28;
11297
+ this.updatePosition(30, firstTop);
10703
11298
  return;
10704
11299
  }
10705
- if (AngularEditor.isFocused(editor) && this.selection && Range.isCollapsed(this.selection)) {
10706
- const block = Node.ancestor(editor, [this.selection.anchor.path[0]]);
10707
- const textIndent = 'textIndent';
10708
- const align = 'align';
10709
- const hasTextIndent = block[textIndent];
10710
- const hasAlign = block[align];
10711
- if (Node.string(block) === '' &&
10712
- Element$1.isElement(block) &&
10713
- block.type === ElementKinds.paragraph &&
10714
- block.children.length === 1 &&
10715
- Text.isText(block.children[0]) &&
10716
- !Editor.isVoid(editor, block) &&
10717
- !hasTextIndent &&
10718
- !hasAlign) {
10719
- const rootNode = AngularEditor.toDOMNode(this.editor, block);
10720
- this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
10721
- return;
10722
- }
11300
+ if (isCleanEmptyParagraph(editor)) {
11301
+ const block = Node.ancestor(editor, [(_c = editor === null || editor === void 0 ? void 0 : editor.selection) === null || _c === void 0 ? void 0 : _c.anchor.path[0]]);
11302
+ const rootNode = AngularEditor.toDOMNode(editor, block);
11303
+ this.isHide = false;
11304
+ this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
11305
+ return;
10723
11306
  }
10724
- this.hide();
11307
+ this.isHide = true;
10725
11308
  }
10726
11309
  updatePosition(left, top) {
10727
11310
  this.isHide = false;
@@ -10733,12 +11316,12 @@ class ThePlaceholderComponent {
10733
11316
  }
10734
11317
  }
10735
11318
  ThePlaceholderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: ThePlaceholderComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
10736
- ThePlaceholderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: ThePlaceholderComponent, selector: "div[thePlaceholder]", inputs: { editor: "editor", autoFocus: "autoFocus", placeholder: "placeholder" }, host: { listeners: { "document:compositionstart": "handleCompositionStart()", "document:compositionend": "handleCompositionEnd($event)" }, properties: { "class.hide": "isHide" }, classAttribute: "the-placeholder" }, ngImport: i0, template: `{{ placeholder }}`, isInline: true });
11319
+ 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 });
10737
11320
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: ThePlaceholderComponent, decorators: [{
10738
11321
  type: Component,
10739
11322
  args: [{
10740
11323
  selector: 'div[thePlaceholder]',
10741
- template: `{{ placeholder }}`,
11324
+ template: `{{ options?.placeholder }}`,
10742
11325
  host: {
10743
11326
  class: 'the-placeholder',
10744
11327
  '[class.hide]': 'isHide'
@@ -10746,9 +11329,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
10746
11329
  }]
10747
11330
  }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }]; }, propDecorators: { editor: [{
10748
11331
  type: Input
10749
- }], autoFocus: [{
10750
- type: Input
10751
- }], placeholder: [{
11332
+ }], options: [{
10752
11333
  type: Input
10753
11334
  }], handleCompositionStart: [{
10754
11335
  type: HostListener,
@@ -10831,7 +11412,6 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
10831
11412
  this.theOnDOMEvent = new EventEmitter();
10832
11413
  this.theEditorCreated = new EventEmitter();
10833
11414
  this._plugins = [];
10834
- this.globalToolbarItems = [];
10835
11415
  this.autoScrollView = _.debounce(function (editor, scrollContainer) {
10836
11416
  return autoScrollViewHandle(editor, scrollContainer);
10837
11417
  }, 80);
@@ -10922,9 +11502,6 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
10922
11502
  this.onSlaCompositionEnd = (event) => { };
10923
11503
  this.onSlaDragStart = (event) => { };
10924
11504
  this.onSlaDragOver = (event) => { };
10925
- this.trackBy = (element) => {
10926
- return element.key;
10927
- };
10928
11505
  }
10929
11506
  get theGlobalToolbarInstance() {
10930
11507
  return this.theGlobalToolbar ? this.theGlobalToolbar : this.globalToolbarInstance;
@@ -10933,6 +11510,10 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
10933
11510
  var _a, _b;
10934
11511
  return ((_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.maxHeight) ? `${(_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.maxHeight}px` : null;
10935
11512
  }
11513
+ get quickToolbarItems() {
11514
+ var _a;
11515
+ return (_a = this.toolbarEntity) === null || _a === void 0 ? void 0 : _a.quick;
11516
+ }
10936
11517
  ngOnInit() {
10937
11518
  this.initialize();
10938
11519
  this.onErrorHandler();
@@ -10988,8 +11569,8 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
10988
11569
  var _a;
10989
11570
  const toolbar = (_a = this === null || this === void 0 ? void 0 : this.theOptions) === null || _a === void 0 ? void 0 : _a.toolbar;
10990
11571
  const toolbarItems = toolbarCompose(toolbar === null || toolbar === void 0 ? void 0 : toolbar.toolbarItems);
10991
- const toolbarOption = this.toolbarService.initialize(toolbarItems, toolbar === null || toolbar === void 0 ? void 0 : toolbar.global, toolbar === null || toolbar === void 0 ? void 0 : toolbar.block, toolbar === null || toolbar === void 0 ? void 0 : toolbar.inline);
10992
- this.globalToolbarItems = toolbarOption.toolbarEntity.global;
11572
+ 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);
11573
+ this.toolbarEntity = toolbarOption.toolbarEntity;
10993
11574
  if (this.theGlobalToolbar) {
10994
11575
  this.theGlobalToolbarInstance.editor = this.editor;
10995
11576
  this.theGlobalToolbarInstance.toolbarItems = toolbarOption.toolbarEntity.global;
@@ -10999,11 +11580,10 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
10999
11580
  }
11000
11581
  }
11001
11582
  writeValue(value) {
11002
- var _a, _b;
11583
+ var _a;
11003
11584
  const data = dataDeserialize((_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.mode, value);
11004
11585
  // data-deserialize
11005
11586
  this.editorValue = data;
11006
- (_b = this.placeholderInstance) === null || _b === void 0 ? void 0 : _b.checkStatus(data);
11007
11587
  }
11008
11588
  registerOnChange(fn) {
11009
11589
  this.onChangeCallback = fn;
@@ -11012,13 +11592,14 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
11012
11592
  this.onTouchedCallback = fn;
11013
11593
  }
11014
11594
  valueChange(value) {
11015
- var _a, _b, _c, _d, _e;
11595
+ var _a, _b, _c, _d;
11016
11596
  (_a = this.theGlobalToolbarInstance) === null || _a === void 0 ? void 0 : _a.statusChange(this.editor);
11017
- (_b = this.placeholderInstance) === null || _b === void 0 ? void 0 : _b.checkStatus();
11597
+ this.quickInsertInstance.checkStatus();
11598
+ this.placeholderInstance.checkStatus();
11018
11599
  // auto scroll view
11019
- const scrollContainer = (_c = this.theOptions) === null || _c === void 0 ? void 0 : _c.scrollContainer;
11020
- const maxHeight = (_d = this.theOptions) === null || _d === void 0 ? void 0 : _d.maxHeight;
11021
- if (!((_e = this.theOptions) === null || _e === void 0 ? void 0 : _e.readonly) && (scrollContainer || maxHeight)) {
11600
+ const scrollContainer = (_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.scrollContainer;
11601
+ const maxHeight = (_c = this.theOptions) === null || _c === void 0 ? void 0 : _c.maxHeight;
11602
+ if (!((_d = this.theOptions) === null || _d === void 0 ? void 0 : _d.readonly) && (scrollContainer || maxHeight)) {
11022
11603
  const container = maxHeight ? DEFAULT_SCROLL_CONTAINER : scrollContainer;
11023
11604
  this.autoScrollView(this.editor, container);
11024
11605
  }
@@ -11143,7 +11724,7 @@ TheEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
11143
11724
  useExisting: forwardRef(() => TheEditorComponent),
11144
11725
  multi: true
11145
11726
  }
11146
- ], viewQueries: [{ propertyName: "templateInstance", first: true, predicate: ["templateInstance"], descendants: true, static: true }, { propertyName: "globalToolbarInstance", first: true, predicate: ["globalToolbar"], descendants: true }, { propertyName: "placeholderInstance", first: true, predicate: ["placeholder"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<the-toolbar\n *ngIf=\"!theOptions?.readonly && !theGlobalToolbar\"\n [ngClass]=\"{\n 'the-toolbar-disabled': theOptions?.disabled\n }\"\n #globalToolbar\n [editor]=\"editor\"\n [toolbarItems]=\"globalToolbarItems\"\n [align]=\"theOptions?.toolbar?.align\"\n></the-toolbar>\n\n<div\n class=\"the-editable-container\"\n [ngClass]=\"{\n 'the-editor-disabled': theOptions?.disabled,\n 'max-height': maxHeight\n }\"\n [ngStyle]=\"{ 'max-height': maxHeight }\"\n>\n <slate-editable\n class=\"the-editor-typo\"\n [editor]=\"editor\"\n [ngModel]=\"editorValue\"\n (ngModelChange)=\"valueChange($event)\"\n [decorate]=\"decorate\"\n [renderElement]=\"renderElement\"\n [renderText]=\"renderText\"\n [renderLeaf]=\"renderLeaf\"\n [readonly]=\"theOptions?.readonly || theOptions?.disabled\"\n [keydown]=\"onKeyDown\"\n [click]=\"onClick\"\n [paste]=\"onSlaPaste\"\n [beforeInput]=\"onSlaBeforeInput\"\n [blur]=\"onSlaBlur\"\n [focus]=\"onSlaFocus\"\n [copy]=\"onSlaCopy\"\n [cut]=\"onSlaCut\"\n [isStrictDecorate]=\"false\"\n [compositionStart]=\"onSlaCompositionStart\"\n [compositionEnd]=\"onSlaCompositionEnd\"\n [dragStart]=\"onSlaDragStart\"\n [dragOver]=\"onSlaDragOver\"\n [trackBy]=\"trackBy\"\n (mousedown)=\"mousedown($event)\"\n ></slate-editable>\n <div\n *ngIf=\"theOptions?.placeholder\"\n #placeholder\n thePlaceholder\n [editor]=\"editor\"\n [autoFocus]=\"theOptions?.placeholder?.autoFocus\"\n [placeholder]=\"theOptions?.placeholder\"\n ></div>\n <the-template #templateInstance></the-template>\n</div>\n", components: [{ type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "isMore", "afterTemplate"] }, { type: i1.SlateEditableComponent, selector: "slate-editable", inputs: ["editor", "renderElement", "renderLeaf", "renderText", "decorate", "isStrictDecorate", "trackBy", "readonly", "beforeInput", "blur", "click", "compositionEnd", "compositionStart", "copy", "cut", "dragOver", "dragStart", "dragEnd", "drop", "focus", "keydown", "paste", "spellCheck", "autoCorrect", "autoCapitalize"] }, { type: ThePlaceholderComponent, selector: "div[thePlaceholder]", inputs: ["editor", "autoFocus", "placeholder"] }, { type: TheTemplateComponent, selector: "the-template,[theTemplate]" }], directives: [{ type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i4$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
11727
+ ], 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 }, { 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 [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", "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"] }] });
11147
11728
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheEditorComponent, decorators: [{
11148
11729
  type: Component,
11149
11730
  args: [{
@@ -11186,6 +11767,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
11186
11767
  }], globalToolbarInstance: [{
11187
11768
  type: ViewChild,
11188
11769
  args: ['globalToolbar']
11770
+ }], quickInsertInstance: [{
11771
+ type: ViewChild,
11772
+ args: ['quickInsert']
11189
11773
  }], placeholderInstance: [{
11190
11774
  type: ViewChild,
11191
11775
  args: ['placeholder']
@@ -11351,10 +11935,12 @@ const COMPONENTS = [
11351
11935
  TheToolbarDropdownComponent,
11352
11936
  TheToolbarGroupComponent,
11353
11937
  TheToolbarItemComponent,
11938
+ TheInlineToolbarComponent,
11354
11939
  NavSplitLineComponent,
11355
11940
  TheTextComponent,
11356
11941
  TheDefaultElementComponent,
11357
- ThePlaceholderComponent,
11942
+ TheQuickInsertComponent,
11943
+ TheQuickToolbarComponent,
11358
11944
  TheColorSelectComponent,
11359
11945
  TheColorToolbarItemComponent,
11360
11946
  TheContextMenuComponent,
@@ -11381,7 +11967,8 @@ const PLUGIN_COMPONENTS = [
11381
11967
  TheTableToolbarComponent,
11382
11968
  TheTableComponent,
11383
11969
  TheTableRowComponent,
11384
- TheTdComponent
11970
+ TheTdComponent,
11971
+ ThePlaceholderComponent
11385
11972
  ];
11386
11973
  const PIPES = [ElementStylePipe, ElementClassPipe];
11387
11974
  class TheEditorModule {
@@ -11391,10 +11978,12 @@ TheEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version
11391
11978
  TheToolbarDropdownComponent,
11392
11979
  TheToolbarGroupComponent,
11393
11980
  TheToolbarItemComponent,
11981
+ TheInlineToolbarComponent,
11394
11982
  NavSplitLineComponent,
11395
11983
  TheTextComponent,
11396
11984
  TheDefaultElementComponent,
11397
- ThePlaceholderComponent,
11985
+ TheQuickInsertComponent,
11986
+ TheQuickToolbarComponent,
11398
11987
  TheColorSelectComponent,
11399
11988
  TheColorToolbarItemComponent,
11400
11989
  TheContextMenuComponent,
@@ -11418,7 +12007,8 @@ TheEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version
11418
12007
  TheTableToolbarComponent,
11419
12008
  TheTableComponent,
11420
12009
  TheTableRowComponent,
11421
- TheTdComponent], imports: [CommonModule, SlateModule, FormsModule, ThyIconModule,
12010
+ TheTdComponent,
12011
+ ThePlaceholderComponent], imports: [CommonModule, SlateModule, FormsModule, ThyIconModule,
11422
12012
  ThyAvatarModule,
11423
12013
  ThyNavModule,
11424
12014
  ThyFormModule,
@@ -11465,5 +12055,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
11465
12055
  * Generated bundle index. Do not edit.
11466
12056
  */
11467
12057
 
11468
- export { ALIGN_BLOCK_TYPES, A_TAG_REL_ATTR, AlignEditor, Alignment, BLOCK_DELETEBACKWARD_TYPES, BLOCK_INSERT_ORIGIN, BLOCK_TOOLBAR_HOTKEY, BlockquoteEditor, CLIPBOARD_FORMAT_KEY, CODEMIRROR_PADDING_TOP, CODE_MODES, COMPONENTS, CONTAINER_BLOCKS, CodeEditor, CodeMode, ColorEditor, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DefaultBlockToolbarDefinition, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DropdownMode, ELEMENT_UNIQUE_ID, ElementKinds, ErrorCodes, HEADING_TYPES, HeadingEditor, HrEditor, ImageEditor, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LinkEditor, ListEditor, MarkEditor, MarkProps, MarkTypes, PICTURE_ACCEPTED_UPLOAD_MIME, PICTURE_ACCEPTED_UPLOAD_SIZE, PLUGIN_COMPONENTS, STANDARD_HEADING_TYPES, TAB_SPACE, THE_CODE_MODE_PROVIDER, THE_CODE_MODE_TOKEN, THE_EDITOR_CONVERSION_HINT_REF, THE_EDITOR_UUID, THE_INLINE_TOOLBAR_TYPES, THE_UPLOAD_SERVICE_TOKEN, TableEditor, TheBaseElementComponent, TheCodeMode, TheContextService, TheDataMode, TheDefaultElementComponent, TheEditor, TheEditorComponent, TheEditorModule, TheImageComponent, TheMode, index$1 as TheQueries, TheToolbarComponent, TheToolbarDropdownComponent, TheToolbarGroupComponent, TheToolbarGroupToken, TheToolbarItemComponent, TheToolbarService, index as TheTransforms, TodoItemEditor, ToolbarActionTypes, ToolbarAlignment, ToolbarItemType, ToolbarMoreGroup, VOID_BLOCK_TYPES, VerticalAlignEditor, VerticalAlignment, ZERO_WIDTH_CHAR, createEmptyParagraph, dataDeserialize, dataSerializing, getToolbarClass, htmlToTheia, inValidTypes, plainToTheia, toolbarCompose, withTheEditor };
12058
+ export { ALIGN_BLOCK_TYPES, A_TAG_REL_ATTR, AlignEditor, Alignment, BLOCK_DELETEBACKWARD_TYPES, BLOCK_INSERT_ORIGIN, BlockquoteEditor, CLIPBOARD_FORMAT_KEY, CODEMIRROR_PADDING_TOP, CODE_MODES, COMPONENTS, CONTAINER_BLOCKS, CodeEditor, CodeMode, ColorEditor, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DefaultQuickToolbarDefinition, DropdownMode, ELEMENT_UNIQUE_ID, ElementKinds, ErrorCodes, HEADING_TYPES, HeadingEditor, HrEditor, ImageEditor, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LinkEditor, ListEditor, MarkEditor, MarkProps, MarkTypes, PICTURE_ACCEPTED_UPLOAD_MIME, PICTURE_ACCEPTED_UPLOAD_SIZE, PLUGIN_COMPONENTS, QUICK_TOOLBAR_HOTKEY, QuickInsertEditor, STANDARD_HEADING_TYPES, TAB_SPACE, THE_CODE_MODE_PROVIDER, THE_CODE_MODE_TOKEN, THE_EDITOR_CONVERSION_HINT_REF, THE_EDITOR_QUICK_TOOLBAR_REF, THE_EDITOR_UUID, THE_INLINE_TOOLBAR_TYPES, THE_UPLOAD_SERVICE_TOKEN, TableEditor, TheBaseElementComponent, TheCodeMode, TheContextService, TheDataMode, TheDefaultElementComponent, TheEditor, TheEditorComponent, TheEditorModule, TheImageComponent, TheMode, index$1 as TheQueries, TheToolbarBaseItemComponent, TheToolbarComponent, TheToolbarDropdownComponent, TheToolbarGroupComponent, TheToolbarGroupToken, TheToolbarItemComponent, TheToolbarService, index as TheTransforms, TodoItemEditor, ToolbarActionTypes, ToolbarAlignment, ToolbarItemMode, ToolbarItemType, ToolbarMoreGroup, VOID_BLOCK_TYPES, VerticalAlignEditor, VerticalAlignment, ZERO_WIDTH_CHAR, createEmptyParagraph, dataDeserialize, dataSerializing, getToolbarClass, htmlToTheia, inValidTypes, plainToTheia, toolbarCompose, withTheEditor };
11469
12059
  //# sourceMappingURL=worktile-theia.js.map