@worktile/theia 1.2.7 → 1.2.11

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 (84) hide show
  1. package/bundles/worktile-theia.umd.js +802 -162
  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/code.d.ts +7 -7
  9. package/constants/node-types.d.ts +0 -1
  10. package/constants/toolbar.d.ts +6 -2
  11. package/custom-types.d.ts +1 -0
  12. package/editor.component.d.ts +6 -4
  13. package/editor.module.d.ts +59 -52
  14. package/esm2015/components/color-select/color-select.component.js +3 -2
  15. package/esm2015/components/inline-toolbar/inline-toolbar.component.js +136 -0
  16. package/esm2015/components/nav-split-line/nav-split-line.component.js +26 -5
  17. package/esm2015/components/toolbar-base-item/toolbar-base-item.component.js +3 -2
  18. package/esm2015/components/toolbar-item/toolbar-item.component.js +70 -24
  19. package/esm2015/constants/code.js +7 -7
  20. package/esm2015/constants/node-types.js +1 -2
  21. package/esm2015/constants/toolbar.js +37 -5
  22. package/esm2015/custom-types.js +1 -1
  23. package/esm2015/editor.component.js +24 -19
  24. package/esm2015/editor.module.js +20 -8
  25. package/esm2015/interfaces/toolbar.js +1 -1
  26. package/esm2015/plugins/code/code.component.js +13 -8
  27. package/esm2015/plugins/common/auto-insert-data..js +2 -3
  28. package/esm2015/plugins/common/get-fragment.plugin.js +4 -4
  29. package/esm2015/plugins/deserializers/deserialize-html.plugin.js +8 -1
  30. package/esm2015/plugins/image/image.plugin.js +1 -2
  31. package/esm2015/plugins/index.js +8 -4
  32. package/esm2015/plugins/link/link.plugin.js +7 -2
  33. package/esm2015/plugins/list/list.plugin.js +9 -9
  34. package/esm2015/plugins/list/queries/get-start-list-item.js +9 -2
  35. package/esm2015/plugins/list/queries/is-selection-in-same-list-item.js +17 -0
  36. package/esm2015/plugins/node-id/node-id.plugin.js +7 -2
  37. package/esm2015/plugins/paint-format/options.js +54 -0
  38. package/esm2015/plugins/paint-format/paint-format.editor.js +67 -0
  39. package/esm2015/plugins/placeholder/placeholder.component.js +75 -0
  40. package/esm2015/plugins/public-api.js +2 -1
  41. package/esm2015/plugins/quick-insert/components/quick-insert.component.js +76 -0
  42. package/esm2015/plugins/quick-insert/components/quick-toolbar/quick-toolbar.component.js +75 -0
  43. package/esm2015/plugins/quick-insert/quick-insert.editor.js +61 -0
  44. package/esm2015/plugins/quick-insert/quick-insert.plugint.js +37 -0
  45. package/esm2015/plugins/table/components/row/row.component.js +3 -1
  46. package/esm2015/plugins/table/components/table.component.js +6 -3
  47. package/esm2015/plugins/table/components/td/td.component.js +2 -1
  48. package/esm2015/plugins/table/components/toolbar/table-toolbar.component.js +1 -1
  49. package/esm2015/plugins/table/table.plugin.js +3 -3
  50. package/esm2015/plugins/vertical-align/toolbar-item.component.js +11 -6
  51. package/esm2015/public-api.js +2 -1
  52. package/esm2015/services/context.service.js +2 -2
  53. package/esm2015/services/toolbar.service.js +5 -5
  54. package/esm2015/utils/auto-focus.js +2 -2
  55. package/esm2015/utils/fragment.js +3 -3
  56. package/esm2015/utils/is-clean-empty-paragraph.js +32 -0
  57. package/esm2015/utils/weak-maps.js +2 -1
  58. package/fesm2015/worktile-theia.js +778 -160
  59. package/fesm2015/worktile-theia.js.map +1 -1
  60. package/interfaces/toolbar.d.ts +3 -2
  61. package/package.json +1 -1
  62. package/plugins/code/code.component.d.ts +3 -2
  63. package/plugins/list/queries/get-start-list-item.d.ts +8 -2
  64. package/plugins/list/queries/is-selection-in-same-list-item.d.ts +5 -0
  65. package/plugins/paint-format/options.d.ts +2 -0
  66. package/plugins/paint-format/paint-format.editor.d.ts +7 -0
  67. package/{components → plugins}/placeholder/placeholder.component.d.ts +5 -6
  68. package/{components → plugins}/placeholder/placeholder.component.scss +0 -0
  69. package/plugins/public-api.d.ts +1 -0
  70. package/plugins/quick-insert/components/quick-insert.component.d.ts +25 -0
  71. package/plugins/quick-insert/components/quick-insert.component.scss +21 -0
  72. package/plugins/quick-insert/components/quick-toolbar/quick-toolbar.component.d.ts +29 -0
  73. package/plugins/quick-insert/components/quick-toolbar/quick-toolbar.component.scss +21 -0
  74. package/plugins/quick-insert/quick-insert.editor.d.ts +8 -0
  75. package/plugins/quick-insert/quick-insert.plugint.d.ts +2 -0
  76. package/plugins/table/components/table.component.d.ts +1 -0
  77. package/plugins/vertical-align/toolbar-item.component.d.ts +1 -0
  78. package/public-api.d.ts +1 -0
  79. package/services/toolbar.service.d.ts +1 -1
  80. package/styles/editor.scss +41 -15
  81. package/styles/index.scss +5 -2
  82. package/utils/is-clean-empty-paragraph.d.ts +8 -0
  83. package/utils/weak-maps.d.ts +1 -0
  84. 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'
@@ -274,17 +306,17 @@ const CODE_MODES = [
274
306
  value: 'htmlmixed'
275
307
  }
276
308
  ];
277
- const EditorMode = {
309
+ const CodeMode = {
278
310
  default: 'default',
279
311
  print: 'print'
280
312
  };
281
- class TheEditorConfig {
313
+ class TheCodeMode {
282
314
  }
283
- const THE_EDITOR_CONFIG_TOKEN = new InjectionToken('the-editor-config');
284
- const THE_EDITOR_CONFIG_PROVIDER = {
285
- provide: THE_EDITOR_CONFIG_TOKEN,
315
+ const THE_CODE_MODE_TOKEN = new InjectionToken('the-code-mode');
316
+ const THE_CODE_MODE_PROVIDER = {
317
+ provide: THE_CODE_MODE_TOKEN,
286
318
  useValue: {
287
- mode: EditorMode.default
319
+ mode: CodeMode.default
288
320
  }
289
321
  };
290
322
  const CODEMIRROR_PADDING_TOP = 10;
@@ -1004,7 +1036,7 @@ const getEndBlock = (editor, fragment) => {
1004
1036
  }
1005
1037
  return fragment;
1006
1038
  };
1007
- const extractFragment = (data, deleteKey) => {
1039
+ const extractFragment = (data, deleteKey = ELEMENT_UNIQUE_ID) => {
1008
1040
  const fragment = data.getData(`application/${CLIPBOARD_FORMAT_KEY}`);
1009
1041
  if (fragment) {
1010
1042
  const decoded = decodeURIComponent(window.atob(fragment));
@@ -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);
@@ -2036,7 +2069,7 @@ const withAutoInsertData = (validChildren) => (editor) => {
2036
2069
  allElementOptions = Object.values(extraInfo);
2037
2070
  }
2038
2071
  const indivisibleTypes = allElementOptions.filter(item => item.isIndivisible).map(item => item.type);
2039
- const fragment = extractFragment(data, ELEMENT_UNIQUE_ID);
2072
+ const fragment = extractFragment(data);
2040
2073
  if (fragment) {
2041
2074
  if (isAcrossBlocks(editor, fragment) || Editor.isVoid(editor, fragment[0])) {
2042
2075
  const { selection } = 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();
@@ -3431,7 +3482,7 @@ const withList = ({ validLiChildrenTypes } = {}) => (editor) => {
3431
3482
  };
3432
3483
  editor.insertData = (data) => {
3433
3484
  const text = data.getData('text/plain');
3434
- const fragment = extractFragment(data, ELEMENT_UNIQUE_ID);
3485
+ const fragment = extractFragment(data);
3435
3486
  const aboveEntry = Editor.above(editor, {
3436
3487
  match: n => Editor.isBlock(editor, n) && n.type === ElementKinds.listItem
3437
3488
  });
@@ -3785,7 +3836,7 @@ const withMark = () => (editor) => {
3785
3836
 
3786
3837
  const withNodeID = ({ idKey = 'id', idCreator = () => Date.now(), filterText = true, filter = () => true } = {}) => (e) => {
3787
3838
  const editor = e;
3788
- const { apply } = editor;
3839
+ const { apply, getFragment } = editor;
3789
3840
  const idPropsCreator = () => ({ [idKey]: idCreator() });
3790
3841
  editor.removedIDs = new Set();
3791
3842
  editor.apply = (operation) => {
@@ -3824,6 +3875,10 @@ const withNodeID = ({ idKey = 'id', idCreator = () => Date.now(), filterText = t
3824
3875
  }
3825
3876
  return apply(operation);
3826
3877
  };
3878
+ editor.getFragment = () => {
3879
+ const fragment = _.cloneDeep(getFragment());
3880
+ return deleteElementKey(fragment, idKey);
3881
+ };
3827
3882
  return editor;
3828
3883
  };
3829
3884
 
@@ -4284,9 +4339,9 @@ const withGetFragment = (elementKinds = []) => (editor) => {
4284
4339
  const { selection } = editor;
4285
4340
  const containerBlocks = [...elementKinds, ...getContainerBlocks(editor)];
4286
4341
  if (selection && selection.anchor.path[0] === selection.focus.path[0]) {
4287
- const fragmentData = Node.fragment(editor, selection);
4342
+ const fragmentData = getFragment();
4288
4343
  const nodes = getSelectionNodesByType(editor, fragmentData, containerBlocks);
4289
- return nodes && Element$1.isElement(nodes) ? nodes.children : getFragment();
4344
+ return nodes && Element$1.isElement(nodes) ? nodes.children : fragmentData;
4290
4345
  }
4291
4346
  return getFragment();
4292
4347
  };
@@ -5610,6 +5665,7 @@ class TheColorSelectComponent {
5610
5665
  }
5611
5666
  }
5612
5667
  _selectColor(event, color) {
5668
+ event.preventDefault();
5613
5669
  event.stopPropagation();
5614
5670
  if (this.option.specialColor && color === this.option.specialColor) {
5615
5671
  color = '';
@@ -5640,7 +5696,7 @@ class TheColorSelectComponent {
5640
5696
  }
5641
5697
  }
5642
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 });
5643
- 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 });
5644
5700
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheColorSelectComponent, decorators: [{
5645
5701
  type: Component,
5646
5702
  args: [{
@@ -5756,9 +5812,10 @@ const ColorEditor = {
5756
5812
 
5757
5813
  class TheToolbarBaseItemComponent {
5758
5814
  execute(event) {
5815
+ var _a;
5759
5816
  event.preventDefault();
5760
5817
  event.stopPropagation();
5761
- if (!this.itemMousedownHandle && !this.editor.selection) {
5818
+ if (!this.itemMousedownHandle && !((_a = this.editor) === null || _a === void 0 ? void 0 : _a.selection)) {
5762
5819
  const lastNode = getLastNode(this.editor, 1);
5763
5820
  const end = Editor.end(this.editor, lastNode[1]);
5764
5821
  Transforms.select(this.editor, end);
@@ -6167,15 +6224,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
6167
6224
  }] } });
6168
6225
 
6169
6226
  class TheCodeComponent extends TheBaseElementComponent {
6170
- constructor(elementRef, cdr, thyNotifyService, ngZone) {
6227
+ constructor(elementRef, cdr, thyNotifyService, ngZone, mode) {
6171
6228
  super(elementRef, cdr);
6172
6229
  this.elementRef = elementRef;
6173
6230
  this.cdr = cdr;
6174
6231
  this.thyNotifyService = thyNotifyService;
6175
6232
  this.ngZone = ngZone;
6233
+ this.mode = mode;
6176
6234
  this.startRenderCodemirror = false;
6177
6235
  this.dropdownMode = DropdownMode;
6178
- this.maxHeight = 350 - CODEMIRROR_PADDING_TOP * 2;
6236
+ this.maxHeight = this.mode === CodeMode.default ? 350 - CODEMIRROR_PADDING_TOP * 2 : 0;
6179
6237
  this.codeMirrorFocused = false;
6180
6238
  this.menus = CODE_MODES.map(item => {
6181
6239
  return { key: item.value, name: item.showName };
@@ -6186,7 +6244,7 @@ class TheCodeComponent extends TheBaseElementComponent {
6186
6244
  readOnly: false,
6187
6245
  autofocus: false,
6188
6246
  lineWiseCopyCut: true,
6189
- lineWrapping: false,
6247
+ lineWrapping: this.mode === CodeMode.default ? false : true,
6190
6248
  cursorBlinkRate: 500
6191
6249
  };
6192
6250
  this.actives = this.menus[0];
@@ -6284,7 +6342,7 @@ class TheCodeComponent extends TheBaseElementComponent {
6284
6342
  this.options = Object.assign(Object.assign({}, this.options), { readOnly: this.readonly, cursorBlinkRate: this.readonly ? -1 : 500 });
6285
6343
  }
6286
6344
  }
6287
- TheCodeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheCodeComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1$4.ThyNotifyService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
6345
+ TheCodeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheCodeComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1$4.ThyNotifyService }, { token: i0.NgZone }, { token: THE_CODE_MODE_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
6288
6346
  TheCodeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheCodeComponent, selector: "div[theCode]", viewQueries: [{ propertyName: "codemirror", first: true, predicate: ["codemirror"], descendants: true, read: CodeMirrorComponent }], usesInheritance: true, ngImport: i0, template: "<div contenteditable=\"false\" class=\"the-block-operation\" *ngIf=\"codeMirrorFocused && !options.readOnly\">\n <thy-icon-nav>\n <the-toolbar-dropdown [menus]=\"menus\" [item]=\"actives\" [itemMousedownHandle]=\"onChangeLangulage\"></the-toolbar-dropdown>\n <a\n href=\"javascript:;\"\n thyIconNavLink\n thyIconNavLinkIcon=\"copy\"\n thyTooltip=\"\u590D\u5236\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"onCopy($event)\"\n ></a>\n <a\n href=\"javascript:;\"\n thyIconNavLink\n thyIconNavLinkIcon=\"trash\"\n thyTooltip=\"\u5220\u9664\"\n class=\"remove-link\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"onDelete($event)\"\n ></a>\n </thy-icon-nav>\n</div>\n\n<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n<ng-codemirror\n *ngIf=\"startRenderCodemirror\"\n #codemirror\n contenteditable=\"false\"\n class=\"ng-codemirror-wrapper\"\n [ngStyle]=\"{ maxHeight: maxHeight > 0 ? maxHeight + 'px' : 'auto' }\"\n [options]=\"options\"\n [ngModel]=\"code\"\n [delayRefreshTime]=\"300\"\n (ngModelChange)=\"codeChange($event)\"\n (focusChange)=\"focusChange($event)\"\n [autoMaxHeight]=\"maxHeight\"\n></ng-codemirror>\n", components: [{ type: i2.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }, { type: TheToolbarDropdownComponent, selector: "the-toolbar-dropdown", inputs: ["toolbarItem", "menus", "mode", "item", "itemMousedownHandle"] }, { type: i2.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { type: i5$2.CodeMirrorComponent, selector: "ng-codemirror, [ngCodeMirror]", inputs: ["autoMaxHeight", "delayRefreshTime", "options"], outputs: ["focusChange"] }], 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"] }, { 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
6289
6347
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheCodeComponent, decorators: [{
6290
6348
  type: Component,
@@ -6293,7 +6351,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
6293
6351
  templateUrl: './code.component.html',
6294
6352
  changeDetection: ChangeDetectionStrategy.OnPush
6295
6353
  }]
6296
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$4.ThyNotifyService }, { type: i0.NgZone }]; }, propDecorators: { codemirror: [{
6354
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$4.ThyNotifyService }, { type: i0.NgZone }, { type: CodeMode, decorators: [{
6355
+ type: Inject,
6356
+ args: [THE_CODE_MODE_TOKEN]
6357
+ }] }]; }, propDecorators: { codemirror: [{
6297
6358
  type: ViewChild,
6298
6359
  args: ['codemirror', { read: CodeMirrorComponent, static: false }]
6299
6360
  }] } });
@@ -6709,6 +6770,7 @@ const withLink = (editor) => {
6709
6770
  editor.insertText = text => {
6710
6771
  if (text && isUrl(text)) {
6711
6772
  LinkEditor.wrapLink(editor, text, text);
6773
+ Transforms.move(editor, { distance: 1, unit: "offset" });
6712
6774
  }
6713
6775
  else {
6714
6776
  insertText(text);
@@ -6716,8 +6778,10 @@ const withLink = (editor) => {
6716
6778
  };
6717
6779
  editor.insertData = data => {
6718
6780
  const text = data.getData('text/plain');
6719
- if (text && isUrl(text)) {
6781
+ const fragment = data.getData(`application/${CLIPBOARD_FORMAT_KEY}`);
6782
+ if (text && isUrl(text) && !fragment) {
6720
6783
  LinkEditor.wrapLink(editor, text, text);
6784
+ Transforms.move(editor, { distance: 1, unit: "offset" });
6721
6785
  }
6722
6786
  else {
6723
6787
  insertData(data);
@@ -7549,18 +7613,38 @@ function setCellMenuInvisibility(editor, menuList, selectedCells, isActiveSelect
7549
7613
  }
7550
7614
 
7551
7615
  class NavSplitLineComponent {
7552
- 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
+ }
7553
7626
  ngOnInit() { }
7554
7627
  }
7555
7628
  NavSplitLineComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: NavSplitLineComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
7556
- 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 });
7557
7630
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: NavSplitLineComponent, decorators: [{
7558
7631
  type: Component,
7559
7632
  args: [{
7560
7633
  selector: 'nav-split-line',
7561
7634
  template: ''
7562
7635
  }]
7563
- }], 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
+ }] } });
7564
7648
 
7565
7649
  class TheTableToolbarComponent {
7566
7650
  constructor(ngZone, colorSelectService, popoverRef) {
@@ -7672,7 +7756,7 @@ class TheTableToolbarComponent {
7672
7756
  }
7673
7757
  }
7674
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 });
7675
- 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"] }] });
7676
7760
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheTableToolbarComponent, decorators: [{
7677
7761
  type: Component,
7678
7762
  args: [{
@@ -8321,9 +8405,12 @@ class TheTableComponent extends TheBaseElementComponent {
8321
8405
  useRowControls() {
8322
8406
  if (this.selection) {
8323
8407
  this.rowControls = this.calculateRowControls();
8324
- this.cdr.detectChanges();
8408
+ this.cdr.markForCheck();
8325
8409
  }
8326
8410
  }
8411
+ detectChanges() {
8412
+ this.cdr.detectChanges();
8413
+ }
8327
8414
  calculateMinRowSpanCellForRows() {
8328
8415
  const table = this.element;
8329
8416
  const cells = table.children.map((row, index) => {
@@ -8585,7 +8672,7 @@ TheTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", vers
8585
8672
  provide: TheTableToken,
8586
8673
  useExisting: TheTableComponent
8587
8674
  }
8588
- ], 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"] }] });
8589
8676
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheTableComponent, decorators: [{
8590
8677
  type: Component,
8591
8678
  args: [{
@@ -8669,11 +8756,13 @@ class TheTableRowComponent extends TheBaseElementComponent {
8669
8756
  super.onContextChange();
8670
8757
  if (this.initialized) {
8671
8758
  this.useBackground();
8759
+ this.useHeight();
8672
8760
  }
8673
8761
  }
8674
8762
  ngOnInit() {
8675
8763
  super.ngOnInit();
8676
8764
  this.useBackground();
8765
+ this.useHeight();
8677
8766
  }
8678
8767
  useBackground() {
8679
8768
  if (this.element.header && !this.backgroundColor) {
@@ -9418,6 +9507,7 @@ class TheTdComponent extends TheBaseElementComponent {
9418
9507
  this.applyRowSize(deltaSize);
9419
9508
  }
9420
9509
  this.tableComponent.useRowControls();
9510
+ this.tableComponent.detectChanges();
9421
9511
  this.updateOverlayHandleSizeAndOffset();
9422
9512
  }
9423
9513
  _createOverlayForHandle() {
@@ -9916,7 +10006,7 @@ const withTable = (editor) => {
9916
10006
  setFragmentData(unit);
9917
10007
  };
9918
10008
  editor.insertData = data => {
9919
- const fragment = extractFragment(data, ELEMENT_UNIQUE_ID);
10009
+ const fragment = extractFragment(data);
9920
10010
  if (fragment) {
9921
10011
  const opts = new TableOptions$1();
9922
10012
  const { selection } = editor;
@@ -10069,6 +10159,11 @@ const withDeserializeHMTL = (editor) => {
10069
10159
  if (html && !slateFragment) {
10070
10160
  const htmlDom = new DOMParser().parseFromString(html, 'text/html');
10071
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
+ }
10072
10167
  insertTheElements(editor, fragment);
10073
10168
  return;
10074
10169
  }
@@ -10104,14 +10199,16 @@ class TheVerticalToolbarItemComponent extends TheToolbarBaseItemComponent {
10104
10199
  get isOpened() {
10105
10200
  return this.dropdownPopoverRef && this.dropdownPopoverRef.getOverlayRef() && this.dropdownPopoverRef.getOverlayRef().hasAttached();
10106
10201
  }
10202
+ handleDocumentMouseDown(event) {
10203
+ if (!this.elementRef.nativeElement.contains(event.target)) {
10204
+ this.close();
10205
+ }
10206
+ }
10107
10207
  ngOnInit() { }
10108
10208
  statusChange(editor) {
10109
10209
  var _a, _b;
10110
10210
  this.active = ((_a = this.toolbarItem) === null || _a === void 0 ? void 0 : _a.active) ? (_b = this.toolbarItem) === null || _b === void 0 ? void 0 : _b.active(editor) : false;
10111
10211
  this.activeMenu = this.menusActive(editor);
10112
- if (!this.active) {
10113
- this.close();
10114
- }
10115
10212
  }
10116
10213
  menusActive(editor) {
10117
10214
  return this.menus.find(i => {
@@ -10157,7 +10254,7 @@ class TheVerticalToolbarItemComponent extends TheToolbarBaseItemComponent {
10157
10254
  }
10158
10255
  }
10159
10256
  TheVerticalToolbarItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheVerticalToolbarItemComponent, deps: [{ token: i0.ElementRef }, { token: i1$6.ThyPopover }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component });
10160
- TheVerticalToolbarItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheVerticalToolbarItemComponent, selector: "the-toolbar-vertical-align-item", inputs: { item: "item", menus: "menus", editor: "editor", toolbarItem: "toolbarItem" }, host: { properties: { "class.hide": "!active" }, classAttribute: "the-toolbar-dropdown-container verticalAlign" }, viewQueries: [{ propertyName: "template", first: true, predicate: ["VerticalAlignItems"], descendants: true, read: TemplateRef, static: true }], usesInheritance: true, ngImport: i0, template: "<a\n thyIconNavLink\n class=\"icon-mode link-with-down\"\n [thyTooltip]=\"toolbarItem?.name\"\n [thyIconNavLinkActive]=\"isOpened\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"execute($event)\"\n>\n <thy-icon [thyIconName]=\"activeMenu?.icon\"></thy-icon>\n <thy-icon class=\"caret-down-icon font-size-sm text-desc\" thyIconName=\"caret-down\"></thy-icon>\n</a>\n\n<ng-template #VerticalAlignItems>\n <thy-action-menu class=\"dropdown\">\n <ng-container *ngFor=\"let menu of toolbarItem?.includes\">\n <a\n thyActionMenuItem\n href=\"javascript:;\"\n [thyActionMenuItemActive]=\"menu.key === activeMenu?.key\"\n [ngStyle]=\"menu?.styles\"\n (mousedown)=\"itemMousedown($event, menu)\"\n >\n <span *ngIf=\"menu.icon\" thyActionMenuItemIcon>\n <thy-icon [thyIconName]=\"menu?.icon\"></thy-icon>\n </span>\n <span thyActionMenuItemName>{{ menu.name }}</span>\n </a>\n </ng-container>\n </thy-action-menu>\n</ng-template>\n", components: [{ type: i2.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i5$1.ThyActionMenuComponent, selector: "thy-action-menu", inputs: ["thyTheme", "thyWidth"] }], directives: [{ type: i7.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5$1.ThyActionMenuItemDirective, selector: "[thyActionMenuItem]", inputs: ["thyDisabled", "thyType"] }, { type: i5$1.ThyActionMenuItemActiveDirective, selector: "[thyActionMenuItemActive]", inputs: ["thyActionMenuItemActive"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5$1.ThyActionMenuItemIconDirective, selector: "[thyActionMenuItemIcon]" }, { type: i5$1.ThyActionMenuItemNameDirective, selector: "[thyActionMenuItemName]" }] });
10257
+ TheVerticalToolbarItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheVerticalToolbarItemComponent, selector: "the-toolbar-vertical-align-item", inputs: { item: "item", menus: "menus", editor: "editor", toolbarItem: "toolbarItem" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)" }, properties: { "class.hide": "!active" }, classAttribute: "the-toolbar-dropdown-container verticalAlign" }, viewQueries: [{ propertyName: "template", first: true, predicate: ["VerticalAlignItems"], descendants: true, read: TemplateRef, static: true }], usesInheritance: true, ngImport: i0, template: "<a\n thyIconNavLink\n class=\"icon-mode link-with-down\"\n [thyTooltip]=\"toolbarItem?.name\"\n [thyIconNavLinkActive]=\"isOpened\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"execute($event)\"\n>\n <thy-icon [thyIconName]=\"activeMenu?.icon\"></thy-icon>\n <thy-icon class=\"caret-down-icon font-size-sm text-desc\" thyIconName=\"caret-down\"></thy-icon>\n</a>\n\n<ng-template #VerticalAlignItems>\n <thy-action-menu class=\"dropdown\">\n <ng-container *ngFor=\"let menu of toolbarItem?.includes\">\n <a\n thyActionMenuItem\n href=\"javascript:;\"\n [thyActionMenuItemActive]=\"menu.key === activeMenu?.key\"\n [ngStyle]=\"menu?.styles\"\n (mousedown)=\"itemMousedown($event, menu)\"\n >\n <span *ngIf=\"menu.icon\" thyActionMenuItemIcon>\n <thy-icon [thyIconName]=\"menu?.icon\"></thy-icon>\n </span>\n <span thyActionMenuItemName>{{ menu.name }}</span>\n </a>\n </ng-container>\n </thy-action-menu>\n</ng-template>\n", components: [{ type: i2.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i4$1.ThyIconComponent, selector: "thy-icon", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { type: i5$1.ThyActionMenuComponent, selector: "thy-action-menu", inputs: ["thyTheme", "thyWidth"] }], directives: [{ type: i7.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5$1.ThyActionMenuItemDirective, selector: "[thyActionMenuItem]", inputs: ["thyDisabled", "thyType"] }, { type: i5$1.ThyActionMenuItemActiveDirective, selector: "[thyActionMenuItemActive]", inputs: ["thyActionMenuItemActive"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5$1.ThyActionMenuItemIconDirective, selector: "[thyActionMenuItemIcon]" }, { type: i5$1.ThyActionMenuItemNameDirective, selector: "[thyActionMenuItemName]" }] });
10161
10258
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheVerticalToolbarItemComponent, decorators: [{
10162
10259
  type: Component,
10163
10260
  args: [{
@@ -10179,6 +10276,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
10179
10276
  }], template: [{
10180
10277
  type: ViewChild,
10181
10278
  args: ['VerticalAlignItems', { read: TemplateRef, static: true }]
10279
+ }], handleDocumentMouseDown: [{
10280
+ type: HostListener,
10281
+ args: ['document: mousedown', ['$event']]
10182
10282
  }] } });
10183
10283
 
10184
10284
  const VerticalAlignOptions = [
@@ -10214,6 +10314,382 @@ const VerticalAlignOptions = [
10214
10314
  }
10215
10315
  ];
10216
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
+
10217
10693
  const internalPlugins = [
10218
10694
  withTheHistory,
10219
10695
  withAutoInsertData(),
@@ -10221,7 +10697,6 @@ const internalPlugins = [
10221
10697
  withRemoveVoid,
10222
10698
  withBlockCard,
10223
10699
  withResetType,
10224
- withImage,
10225
10700
  withIndent([ElementKinds.checkItem, ElementKinds.numberedList, ElementKinds.bulletedList, ElementKinds.paragraph, ...HEADING_TYPES]),
10226
10701
  withList({ validLiChildrenTypes: [ElementKinds.image] }),
10227
10702
  withLink,
@@ -10241,7 +10716,9 @@ const internalPlugins = [
10241
10716
  withInsertParagraphNodes(),
10242
10717
  withGetFragment(),
10243
10718
  withDeserializeHMTL,
10244
- withDeserializeMd()
10719
+ withDeserializeMd(),
10720
+ withImage,
10721
+ withQuickInsert
10245
10722
  ];
10246
10723
  const internalToolbarItems = [
10247
10724
  ...AlignOptions,
@@ -10256,7 +10733,8 @@ const internalToolbarItems = [
10256
10733
  ...CodeOptions,
10257
10734
  ...LinkOptions,
10258
10735
  ...TableOptions,
10259
- ...VerticalAlignOptions
10736
+ ...VerticalAlignOptions,
10737
+ ...PaintFormatOptions
10260
10738
  ];
10261
10739
  const toolbarCompose = (toolbarItems = []) => {
10262
10740
  return [...internalToolbarItems, ...toolbarItems];
@@ -10295,11 +10773,11 @@ const shortcuts = (editor, event) => {
10295
10773
  };
10296
10774
 
10297
10775
  class TheToolbarService {
10298
- initialize(toolbarItems, global = DefaultGlobalToolbarDefinition, inline = DefaultInlineToolbarDefinition, block = DefaultBlockToolbarDefinition) {
10776
+ initialize(toolbarItems, global = DefaultGlobalToolbarDefinition, inline = DefaultInlineToolbarDefinition, quick = DefaultQuickToolbarDefinition) {
10299
10777
  const toolbarDefinition = {
10300
10778
  global,
10301
- block,
10302
- inline
10779
+ inline,
10780
+ quick
10303
10781
  };
10304
10782
  const toolbarOperations = new Map();
10305
10783
  toolbarItems.forEach(i => toolbarOperations.set(i.key, i));
@@ -10341,7 +10819,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
10341
10819
 
10342
10820
  const autoFocus = (editor, isFocus) => {
10343
10821
  setTimeout(() => {
10344
- if (editor && isFocus) {
10822
+ if (editor && editor.children.length > 0 && isFocus) {
10345
10823
  HistoryEditor.withoutMerging(editor, () => {
10346
10824
  AngularEditor.focus(editor);
10347
10825
  Transforms.select(editor, Editor.start(editor, [0]));
@@ -10378,59 +10856,6 @@ const autoScrollViewHandle = (editor, scrollContainer) => {
10378
10856
  previousHeight = currentHeight;
10379
10857
  };
10380
10858
 
10381
- class TheToolbarItemComponent extends TheToolbarBaseItemComponent {
10382
- constructor() {
10383
- super();
10384
- this.active = false;
10385
- }
10386
- statusChange(editor) {
10387
- var _a, _b;
10388
- 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;
10389
- }
10390
- execute(event) {
10391
- var _a, _b, _c;
10392
- super.execute(event);
10393
- if (!((_a = this.item) === null || _a === void 0 ? void 0 : _a.execute) || ((_b = this.editor) === null || _b === void 0 ? void 0 : _b.disabled)) {
10394
- return;
10395
- }
10396
- (_c = this.item) === null || _c === void 0 ? void 0 : _c.execute(this.editor);
10397
- }
10398
- }
10399
- TheToolbarItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
10400
- 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: `
10401
- <a
10402
- thyIconNavLink
10403
- [thyIconNavLinkIcon]="item.icon"
10404
- [thyTooltip]="item.name"
10405
- thyTooltipPlacement="top"
10406
- [thyIconNavLinkActive]="active"
10407
- (mousedown)="execute($event)"
10408
- ></a>
10409
- `, 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"] }] });
10410
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarItemComponent, decorators: [{
10411
- type: Component,
10412
- args: [{
10413
- selector: 'the-toolbar-item',
10414
- template: `
10415
- <a
10416
- thyIconNavLink
10417
- [thyIconNavLinkIcon]="item.icon"
10418
- [thyTooltip]="item.name"
10419
- thyTooltipPlacement="top"
10420
- [thyIconNavLinkActive]="active"
10421
- (mousedown)="execute($event)"
10422
- ></a>
10423
- `,
10424
- host: {
10425
- class: 'the-toolbar-item'
10426
- }
10427
- }]
10428
- }], ctorParameters: function () { return []; }, propDecorators: { item: [{
10429
- type: Input
10430
- }], editor: [{
10431
- type: Input
10432
- }] } });
10433
-
10434
10859
  class TheToolbarComponent {
10435
10860
  constructor(cfr, elementRef, ngZone, toolbarGroupComponent) {
10436
10861
  this.cfr = cfr;
@@ -10663,52 +11088,236 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
10663
11088
  args: ['toolbarContainer', { read: ViewContainerRef, static: true }]
10664
11089
  }] } });
10665
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 ||
11131
+ !AngularEditor.isFocused(editor) ||
11132
+ Range.isCollapsed(selection) ||
11133
+ Editor.string(editor, selection) === '') {
11134
+ inlineToolbar.removeAttribute('style');
11135
+ return;
11136
+ }
11137
+ if (!THE_INLINE_TOOLBAR_TYPES.includes(anchorBlock$1.type)) {
11138
+ return;
11139
+ }
11140
+ const native = window.getSelection();
11141
+ if (native.type !== 'None') {
11142
+ const range = native.getRangeAt(0);
11143
+ this.updatePosition(inlineToolbar, range);
11144
+ }
11145
+ }
11146
+ updatePosition(toolbarElement, range) {
11147
+ let boundary = range.getBoundingClientRect();
11148
+ if (!boundary || (boundary.height === 0 && boundary.width === 0 && range.startContainer === range.endContainer)) {
11149
+ if (range.startContainer.nodeType === 1 && range.startContainer.querySelector('img')) {
11150
+ boundary = range.startContainer.querySelector('img').getBoundingClientRect();
11151
+ }
11152
+ else {
11153
+ boundary = range.startContainer.getBoundingClientRect();
11154
+ }
11155
+ }
11156
+ const editableRect = document.querySelector('.the-editor-typo').getBoundingClientRect();
11157
+ const toolbarHeight = toolbarElement.offsetHeight;
11158
+ const toolbarWidth = toolbarElement.offsetWidth;
11159
+ const halfOffsetWidth = toolbarWidth / 2;
11160
+ const defaultLeft = -halfOffsetWidth;
11161
+ const offsetLeft = boundary.left - editableRect.left;
11162
+ const isTopLeft = offsetLeft - 30 > halfOffsetWidth; // 30: editable padding left
11163
+ const isTopRight = editableRect.width - offsetLeft - boundary.width / 2 < halfOffsetWidth;
11164
+ const positions = {};
11165
+ positions.top = boundary.top - toolbarHeight;
11166
+ positions.right = 'initial';
11167
+ positions.left = boundary.left;
11168
+ if (isTopLeft) {
11169
+ positions.left = boundary.left + boundary.width / 2 + defaultLeft;
11170
+ }
11171
+ if (isTopRight) {
11172
+ positions.left = boundary.right - toolbarWidth;
11173
+ }
11174
+ for (let key of Object.keys(positions)) {
11175
+ toolbarElement.style[key] = positions[key] + (isNaN(positions[key]) ? '' : 'px');
11176
+ }
11177
+ toolbarElement.style.opacity = '1';
11178
+ }
11179
+ ngOnDestroy() {
11180
+ this.destroy$.next();
11181
+ this.destroy$.complete();
11182
+ }
11183
+ }
11184
+ 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 });
11185
+ 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
11186
+ #inlineToolbar
11187
+ class="the-inline-toolbar"
11188
+ [editor]="editor"
11189
+ [toolbarItems]="toolbarItems"
11190
+ [isMore]="false"
11191
+ ></the-toolbar> `, isInline: true, components: [{ type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "isMore", "afterTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
11192
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheInlineToolbarComponent, decorators: [{
11193
+ type: Component,
11194
+ args: [{
11195
+ selector: 'the-inline-toolbar',
11196
+ template: `<the-toolbar
11197
+ #inlineToolbar
11198
+ class="the-inline-toolbar"
11199
+ [editor]="editor"
11200
+ [toolbarItems]="toolbarItems"
11201
+ [isMore]="false"
11202
+ ></the-toolbar> `,
11203
+ host: {
11204
+ '[class.hide]': 'toolbarItems.length === 0'
11205
+ },
11206
+ changeDetection: ChangeDetectionStrategy.OnPush
11207
+ }]
11208
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i2$1.ScrollDispatcher }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }]; }, propDecorators: { editor: [{
11209
+ type: Input
11210
+ }], toolbarItems: [{
11211
+ type: Input
11212
+ }], inlineToolbar: [{
11213
+ type: ViewChild,
11214
+ args: ['inlineToolbar']
11215
+ }] } });
11216
+
11217
+ class TheQuickInsertComponent {
11218
+ constructor(renderer, elementRef, cdr) {
11219
+ this.renderer = renderer;
11220
+ this.elementRef = elementRef;
11221
+ this.cdr = cdr;
11222
+ this.isHide = true;
11223
+ this.defaultIconName = 'plus-circle-thin';
11224
+ this.iconNameFill = 'plus-circle-thin-fill';
11225
+ this.displayIconName = this.defaultIconName;
11226
+ }
11227
+ handleMousedownNativeElement(event) {
11228
+ event.preventDefault();
11229
+ event.stopPropagation();
11230
+ }
11231
+ checkStatus() {
11232
+ var _a;
11233
+ const { editor } = this;
11234
+ if (isCleanEmptyParagraph(editor)) {
11235
+ 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]]);
11236
+ const rootNode = AngularEditor.toDOMNode(editor, block);
11237
+ this.isHide = false;
11238
+ this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
11239
+ return;
11240
+ }
11241
+ this.isHide = true;
11242
+ }
11243
+ updatePosition(left, top) {
11244
+ this.isHide = false;
11245
+ this.renderer.setStyle(this.elementRef.nativeElement, 'top', `${top}px`);
11246
+ this.renderer.setStyle(this.elementRef.nativeElement, 'left', `${left}px`);
11247
+ }
11248
+ mouseEnter(event) {
11249
+ this.displayIconName = this.iconNameFill;
11250
+ this.cdr.markForCheck();
11251
+ }
11252
+ mouseLeave(event) {
11253
+ this.displayIconName = this.defaultIconName;
11254
+ this.cdr.markForCheck();
11255
+ }
11256
+ handleClick(event) {
11257
+ event.stopPropagation();
11258
+ event.preventDefault();
11259
+ QuickInsertEditor.openQuickToolbar(this.editor, this.quickToolbarItems, this.iconElement.nativeElement);
11260
+ }
11261
+ }
11262
+ 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 });
11263
+ 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"] }] });
11264
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheQuickInsertComponent, decorators: [{
11265
+ type: Component,
11266
+ args: [{
11267
+ selector: '[theQuickInsert]',
11268
+ templateUrl: './quick-insert.component.html',
11269
+ host: {
11270
+ class: 'the-quick-insert',
11271
+ '[class.hide]': 'isHide'
11272
+ }
11273
+ }]
11274
+ }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { editor: [{
11275
+ type: Input
11276
+ }], quickToolbarItems: [{
11277
+ type: Input
11278
+ }], iconElement: [{
11279
+ type: ViewChild,
11280
+ args: ['iconElement', { read: ElementRef, static: false }]
11281
+ }], handleMousedownNativeElement: [{
11282
+ type: HostListener,
11283
+ args: ['mousedown', ['$event']]
11284
+ }] } });
11285
+
10666
11286
  class ThePlaceholderComponent {
10667
11287
  constructor(renderer, elementRef) {
10668
11288
  this.renderer = renderer;
10669
11289
  this.elementRef = elementRef;
10670
11290
  this.isHide = true;
10671
11291
  }
10672
- get selection() {
10673
- return this.editor.selection;
10674
- }
10675
11292
  handleCompositionStart() {
10676
- this.hide();
11293
+ var _a;
11294
+ if ((_a = this.editor) === null || _a === void 0 ? void 0 : _a.selection) {
11295
+ this.hide();
11296
+ }
10677
11297
  }
10678
11298
  handleCompositionEnd(event) {
10679
11299
  if (!event.data) {
10680
11300
  this.checkStatus();
10681
11301
  }
10682
11302
  }
10683
- checkStatus(value) {
11303
+ checkStatus() {
11304
+ var _a, _b, _c;
10684
11305
  const { editor } = this;
10685
- const children = value ? value : editor.children;
10686
11306
  // empty content and no selection processing
10687
- if (this.autoFocus && !this.selection && isEmptyContent(children)) {
10688
- this.updatePosition(30, 51);
10689
- this.isHide = false;
11307
+ if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.autoFocus) && !(editor === null || editor === void 0 ? void 0 : editor.selection) && isEmptyContent(editor.children)) {
11308
+ // normal top is 28, but margin-top: -41px is set when maxHeight is set, so top is 69
11309
+ const firstTop = ((_b = this.options) === null || _b === void 0 ? void 0 : _b.maxHeight) ? 69 : 28;
11310
+ this.updatePosition(30, firstTop);
10690
11311
  return;
10691
11312
  }
10692
- if (AngularEditor.isFocused(editor) && this.selection && Range.isCollapsed(this.selection)) {
10693
- const block = Node.ancestor(editor, [this.selection.anchor.path[0]]);
10694
- const textIndent = 'textIndent';
10695
- const align = 'align';
10696
- const hasTextIndent = block[textIndent];
10697
- const hasAlign = block[align];
10698
- if (Node.string(block) === '' &&
10699
- Element$1.isElement(block) &&
10700
- block.type === ElementKinds.paragraph &&
10701
- block.children.length === 1 &&
10702
- Text.isText(block.children[0]) &&
10703
- !Editor.isVoid(editor, block) &&
10704
- !hasTextIndent &&
10705
- !hasAlign) {
10706
- const rootNode = AngularEditor.toDOMNode(this.editor, block);
10707
- this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
10708
- return;
10709
- }
11313
+ if (isCleanEmptyParagraph(editor)) {
11314
+ 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]]);
11315
+ const rootNode = AngularEditor.toDOMNode(editor, block);
11316
+ this.isHide = false;
11317
+ this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
11318
+ return;
10710
11319
  }
10711
- this.hide();
11320
+ this.isHide = true;
10712
11321
  }
10713
11322
  updatePosition(left, top) {
10714
11323
  this.isHide = false;
@@ -10720,12 +11329,12 @@ class ThePlaceholderComponent {
10720
11329
  }
10721
11330
  }
10722
11331
  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 });
10723
- 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 });
11332
+ 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 });
10724
11333
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: ThePlaceholderComponent, decorators: [{
10725
11334
  type: Component,
10726
11335
  args: [{
10727
11336
  selector: 'div[thePlaceholder]',
10728
- template: `{{ placeholder }}`,
11337
+ template: `{{ options?.placeholder }}`,
10729
11338
  host: {
10730
11339
  class: 'the-placeholder',
10731
11340
  '[class.hide]': 'isHide'
@@ -10733,9 +11342,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
10733
11342
  }]
10734
11343
  }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }]; }, propDecorators: { editor: [{
10735
11344
  type: Input
10736
- }], autoFocus: [{
10737
- type: Input
10738
- }], placeholder: [{
11345
+ }], options: [{
10739
11346
  type: Input
10740
11347
  }], handleCompositionStart: [{
10741
11348
  type: HostListener,
@@ -10818,7 +11425,6 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
10818
11425
  this.theOnDOMEvent = new EventEmitter();
10819
11426
  this.theEditorCreated = new EventEmitter();
10820
11427
  this._plugins = [];
10821
- this.globalToolbarItems = [];
10822
11428
  this.autoScrollView = _.debounce(function (editor, scrollContainer) {
10823
11429
  return autoScrollViewHandle(editor, scrollContainer);
10824
11430
  }, 80);
@@ -10909,9 +11515,6 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
10909
11515
  this.onSlaCompositionEnd = (event) => { };
10910
11516
  this.onSlaDragStart = (event) => { };
10911
11517
  this.onSlaDragOver = (event) => { };
10912
- this.trackBy = (element) => {
10913
- return element.key;
10914
- };
10915
11518
  }
10916
11519
  get theGlobalToolbarInstance() {
10917
11520
  return this.theGlobalToolbar ? this.theGlobalToolbar : this.globalToolbarInstance;
@@ -10920,6 +11523,10 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
10920
11523
  var _a, _b;
10921
11524
  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;
10922
11525
  }
11526
+ get quickToolbarItems() {
11527
+ var _a;
11528
+ return (_a = this.toolbarEntity) === null || _a === void 0 ? void 0 : _a.quick;
11529
+ }
10923
11530
  ngOnInit() {
10924
11531
  this.initialize();
10925
11532
  this.onErrorHandler();
@@ -10975,8 +11582,8 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
10975
11582
  var _a;
10976
11583
  const toolbar = (_a = this === null || this === void 0 ? void 0 : this.theOptions) === null || _a === void 0 ? void 0 : _a.toolbar;
10977
11584
  const toolbarItems = toolbarCompose(toolbar === null || toolbar === void 0 ? void 0 : toolbar.toolbarItems);
10978
- 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);
10979
- this.globalToolbarItems = toolbarOption.toolbarEntity.global;
11585
+ 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);
11586
+ this.toolbarEntity = toolbarOption.toolbarEntity;
10980
11587
  if (this.theGlobalToolbar) {
10981
11588
  this.theGlobalToolbarInstance.editor = this.editor;
10982
11589
  this.theGlobalToolbarInstance.toolbarItems = toolbarOption.toolbarEntity.global;
@@ -10986,11 +11593,10 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
10986
11593
  }
10987
11594
  }
10988
11595
  writeValue(value) {
10989
- var _a, _b;
11596
+ var _a;
10990
11597
  const data = dataDeserialize((_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.mode, value);
10991
11598
  // data-deserialize
10992
11599
  this.editorValue = data;
10993
- (_b = this.placeholderInstance) === null || _b === void 0 ? void 0 : _b.checkStatus(data);
10994
11600
  }
10995
11601
  registerOnChange(fn) {
10996
11602
  this.onChangeCallback = fn;
@@ -10999,13 +11605,14 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
10999
11605
  this.onTouchedCallback = fn;
11000
11606
  }
11001
11607
  valueChange(value) {
11002
- var _a, _b, _c, _d, _e;
11608
+ var _a, _b, _c, _d;
11003
11609
  (_a = this.theGlobalToolbarInstance) === null || _a === void 0 ? void 0 : _a.statusChange(this.editor);
11004
- (_b = this.placeholderInstance) === null || _b === void 0 ? void 0 : _b.checkStatus();
11610
+ this.quickInsertInstance.checkStatus();
11611
+ this.placeholderInstance.checkStatus();
11005
11612
  // auto scroll view
11006
- const scrollContainer = (_c = this.theOptions) === null || _c === void 0 ? void 0 : _c.scrollContainer;
11007
- const maxHeight = (_d = this.theOptions) === null || _d === void 0 ? void 0 : _d.maxHeight;
11008
- if (!((_e = this.theOptions) === null || _e === void 0 ? void 0 : _e.readonly) && (scrollContainer || maxHeight)) {
11613
+ const scrollContainer = (_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.scrollContainer;
11614
+ const maxHeight = (_c = this.theOptions) === null || _c === void 0 ? void 0 : _c.maxHeight;
11615
+ if (!((_d = this.theOptions) === null || _d === void 0 ? void 0 : _d.readonly) && (scrollContainer || maxHeight)) {
11009
11616
  const container = maxHeight ? DEFAULT_SCROLL_CONTAINER : scrollContainer;
11010
11617
  this.autoScrollView(this.editor, container);
11011
11618
  }
@@ -11130,7 +11737,7 @@ TheEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
11130
11737
  useExisting: forwardRef(() => TheEditorComponent),
11131
11738
  multi: true
11132
11739
  }
11133
- ], viewQueries: [{ propertyName: "templateInstance", first: true, predicate: ["templateInstance"], descendants: true, static: true }, { propertyName: "globalToolbarInstance", first: true, predicate: ["globalToolbar"], descendants: true }, { propertyName: "placeholderInstance", first: true, predicate: ["placeholder"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<the-toolbar\n *ngIf=\"!theOptions?.readonly && !theGlobalToolbar\"\n [ngClass]=\"{\n 'the-toolbar-disabled': theOptions?.disabled\n }\"\n #globalToolbar\n [editor]=\"editor\"\n [toolbarItems]=\"globalToolbarItems\"\n [align]=\"theOptions?.toolbar?.align\"\n></the-toolbar>\n\n<div\n class=\"the-editable-container\"\n [ngClass]=\"{\n 'the-editor-disabled': theOptions?.disabled\n }\"\n [ngStyle]=\"{ 'max-height': maxHeight }\"\n>\n <slate-editable\n class=\"the-editor-typo\"\n [editor]=\"editor\"\n [ngModel]=\"editorValue\"\n (ngModelChange)=\"valueChange($event)\"\n [decorate]=\"decorate\"\n [renderElement]=\"renderElement\"\n [renderText]=\"renderText\"\n [renderLeaf]=\"renderLeaf\"\n [readonly]=\"theOptions?.readonly || theOptions?.disabled\"\n [keydown]=\"onKeyDown\"\n [click]=\"onClick\"\n [paste]=\"onSlaPaste\"\n [beforeInput]=\"onSlaBeforeInput\"\n [blur]=\"onSlaBlur\"\n [focus]=\"onSlaFocus\"\n [copy]=\"onSlaCopy\"\n [cut]=\"onSlaCut\"\n [isStrictDecorate]=\"false\"\n [compositionStart]=\"onSlaCompositionStart\"\n [compositionEnd]=\"onSlaCompositionEnd\"\n [dragStart]=\"onSlaDragStart\"\n [dragOver]=\"onSlaDragOver\"\n [trackBy]=\"trackBy\"\n (mousedown)=\"mousedown($event)\"\n ></slate-editable>\n <div\n *ngIf=\"theOptions?.placeholder\"\n #placeholder\n thePlaceholder\n [editor]=\"editor\"\n [autoFocus]=\"theOptions?.placeholder?.autoFocus\"\n [placeholder]=\"theOptions?.placeholder\"\n ></div>\n <the-template #templateInstance></the-template>\n</div>\n", components: [{ type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "isMore", "afterTemplate"] }, { type: i1.SlateEditableComponent, selector: "slate-editable", inputs: ["editor", "renderElement", "renderLeaf", "renderText", "decorate", "isStrictDecorate", "trackBy", "readonly", "beforeInput", "blur", "click", "compositionEnd", "compositionStart", "copy", "cut", "dragOver", "dragStart", "dragEnd", "drop", "focus", "keydown", "paste", "spellCheck", "autoCorrect", "autoCapitalize"] }, { type: ThePlaceholderComponent, selector: "div[thePlaceholder]", inputs: ["editor", "autoFocus", "placeholder"] }, { type: TheTemplateComponent, selector: "the-template,[theTemplate]" }], directives: [{ type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i4$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
11740
+ ], 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 class=\"the-global-toolbar\"\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"] }] });
11134
11741
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheEditorComponent, decorators: [{
11135
11742
  type: Component,
11136
11743
  args: [{
@@ -11173,6 +11780,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
11173
11780
  }], globalToolbarInstance: [{
11174
11781
  type: ViewChild,
11175
11782
  args: ['globalToolbar']
11783
+ }], quickInsertInstance: [{
11784
+ type: ViewChild,
11785
+ args: ['quickInsert']
11176
11786
  }], placeholderInstance: [{
11177
11787
  type: ViewChild,
11178
11788
  args: ['placeholder']
@@ -11338,10 +11948,12 @@ const COMPONENTS = [
11338
11948
  TheToolbarDropdownComponent,
11339
11949
  TheToolbarGroupComponent,
11340
11950
  TheToolbarItemComponent,
11951
+ TheInlineToolbarComponent,
11341
11952
  NavSplitLineComponent,
11342
11953
  TheTextComponent,
11343
11954
  TheDefaultElementComponent,
11344
- ThePlaceholderComponent,
11955
+ TheQuickInsertComponent,
11956
+ TheQuickToolbarComponent,
11345
11957
  TheColorSelectComponent,
11346
11958
  TheColorToolbarItemComponent,
11347
11959
  TheContextMenuComponent,
@@ -11368,7 +11980,8 @@ const PLUGIN_COMPONENTS = [
11368
11980
  TheTableToolbarComponent,
11369
11981
  TheTableComponent,
11370
11982
  TheTableRowComponent,
11371
- TheTdComponent
11983
+ TheTdComponent,
11984
+ ThePlaceholderComponent
11372
11985
  ];
11373
11986
  const PIPES = [ElementStylePipe, ElementClassPipe];
11374
11987
  class TheEditorModule {
@@ -11378,10 +11991,12 @@ TheEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version
11378
11991
  TheToolbarDropdownComponent,
11379
11992
  TheToolbarGroupComponent,
11380
11993
  TheToolbarItemComponent,
11994
+ TheInlineToolbarComponent,
11381
11995
  NavSplitLineComponent,
11382
11996
  TheTextComponent,
11383
11997
  TheDefaultElementComponent,
11384
- ThePlaceholderComponent,
11998
+ TheQuickInsertComponent,
11999
+ TheQuickToolbarComponent,
11385
12000
  TheColorSelectComponent,
11386
12001
  TheColorToolbarItemComponent,
11387
12002
  TheContextMenuComponent,
@@ -11405,7 +12020,8 @@ TheEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version
11405
12020
  TheTableToolbarComponent,
11406
12021
  TheTableComponent,
11407
12022
  TheTableRowComponent,
11408
- TheTdComponent], imports: [CommonModule, SlateModule, FormsModule, ThyIconModule,
12023
+ TheTdComponent,
12024
+ ThePlaceholderComponent], imports: [CommonModule, SlateModule, FormsModule, ThyIconModule,
11409
12025
  ThyAvatarModule,
11410
12026
  ThyNavModule,
11411
12027
  ThyFormModule,
@@ -11424,7 +12040,8 @@ TheEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version
11424
12040
  {
11425
12041
  provide: TheToolbarGroupToken,
11426
12042
  useValue: TheToolbarGroupComponent
11427
- }
12043
+ },
12044
+ THE_CODE_MODE_PROVIDER
11428
12045
  ], imports: [[CommonModule, SlateModule, FormsModule, ...TETHYS, CodemirrorModule, TheColumnSizeModule]] });
11429
12046
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheEditorModule, decorators: [{
11430
12047
  type: NgModule,
@@ -11437,7 +12054,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
11437
12054
  {
11438
12055
  provide: TheToolbarGroupToken,
11439
12056
  useValue: TheToolbarGroupComponent
11440
- }
12057
+ },
12058
+ THE_CODE_MODE_PROVIDER
11441
12059
  ]
11442
12060
  }]
11443
12061
  }] });
@@ -11450,5 +12068,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
11450
12068
  * Generated bundle index. Do not edit.
11451
12069
  */
11452
12070
 
11453
- 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, ColorEditor, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DefaultBlockToolbarDefinition, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DropdownMode, ELEMENT_UNIQUE_ID, EditorMode, 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_EDITOR_CONFIG_PROVIDER, THE_EDITOR_CONFIG_TOKEN, THE_EDITOR_CONVERSION_HINT_REF, THE_EDITOR_UUID, THE_INLINE_TOOLBAR_TYPES, THE_UPLOAD_SERVICE_TOKEN, TableEditor, TheBaseElementComponent, TheContextService, TheDataMode, TheDefaultElementComponent, TheEditor, TheEditorComponent, TheEditorConfig, 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 };
12071
+ 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 };
11454
12072
  //# sourceMappingURL=worktile-theia.js.map