@worktile/theia 2.1.5 → 2.1.9

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 (38) hide show
  1. package/bundles/worktile-theia.umd.js +170 -191
  2. package/bundles/worktile-theia.umd.js.map +1 -1
  3. package/editor.component.d.ts +3 -4
  4. package/editor.module.d.ts +26 -28
  5. package/esm2015/components/toolbar/toolbar.component.js +6 -6
  6. package/esm2015/constants/toolbar.js +1 -4
  7. package/esm2015/editor.component.js +19 -20
  8. package/esm2015/editor.module.js +1 -4
  9. package/esm2015/interfaces/editor.js +1 -1
  10. package/esm2015/plugins/common/move-selection.plugin.js +48 -3
  11. package/esm2015/plugins/image/image.component.js +1 -1
  12. package/esm2015/plugins/inline-code/inline-code.component.js +14 -15
  13. package/esm2015/plugins/inline-code/inline-code.editor.js +7 -3
  14. package/esm2015/plugins/inline-code/inline-code.plugin.js +2 -2
  15. package/esm2015/plugins/link/edit/link-edit.component.js +1 -1
  16. package/esm2015/plugins/link/link.component.js +13 -3
  17. package/esm2015/plugins/list/transforms/insert-list-item.js +11 -7
  18. package/esm2015/plugins/quick-insert/components/quick-insert.component.js +17 -9
  19. package/esm2015/plugins/table/transforms/insert-table.js +2 -2
  20. package/esm2015/transforms/handle-continual-insert-break.js +1 -4
  21. package/esm2015/utils/index.js +2 -1
  22. package/esm2015/utils/is-inline.js +10 -0
  23. package/fesm2015/worktile-theia.js +162 -171
  24. package/fesm2015/worktile-theia.js.map +1 -1
  25. package/interfaces/editor.d.ts +3 -3
  26. package/package.json +1 -1
  27. package/plugins/inline-code/inline-code.component.d.ts +2 -7
  28. package/plugins/inline-code/inline-code.editor.d.ts +2 -2
  29. package/plugins/link/link.component.d.ts +1 -0
  30. package/plugins/quick-insert/components/quick-insert.component.d.ts +3 -1
  31. package/plugins/table/transforms/insert-table.d.ts +1 -1
  32. package/styles/index.scss +0 -1
  33. package/styles/typo.scss +4 -1
  34. package/utils/index.d.ts +1 -0
  35. package/utils/is-inline.d.ts +2 -0
  36. package/esm2015/plugins/placeholder/placeholder.component.js +0 -83
  37. package/plugins/placeholder/placeholder.component.d.ts +0 -21
  38. package/plugins/placeholder/placeholder.component.scss +0 -10
@@ -210,7 +210,6 @@ var ToolbarItemMode;
210
210
  })(ToolbarItemMode || (ToolbarItemMode = {}));
211
211
  const DefaultGlobalToolbarDefinition = [
212
212
  ElementKinds.headingList,
213
- MarkTypes.fontSize,
214
213
  ToolbarActionTypes.split,
215
214
  MarkTypes.bold,
216
215
  MarkTypes.italic,
@@ -225,7 +224,6 @@ const DefaultGlobalToolbarDefinition = [
225
224
  ToolbarActionTypes.split,
226
225
  ElementKinds.numberedList,
227
226
  ElementKinds.bulletedList,
228
- // ElementKinds.checkItem,
229
227
  ToolbarActionTypes.split,
230
228
  ElementKinds.link,
231
229
  ElementKinds.image,
@@ -253,7 +251,6 @@ const DefaultQuickToolbarDefinition = [
253
251
  ToolbarActionTypes.split,
254
252
  ElementKinds.numberedList,
255
253
  ElementKinds.bulletedList,
256
- // ElementKinds.checkItem,
257
254
  ToolbarActionTypes.split,
258
255
  ElementKinds.link,
259
256
  ElementKinds.image,
@@ -1539,9 +1536,6 @@ function handleContinualInsertBreak(editor, lowestBlock, type) {
1539
1536
  const aboveResult = Editor.above(editor, {
1540
1537
  match: n => Editor.isBlock(editor, n) && n.type === type
1541
1538
  });
1542
- if (isEnd) {
1543
- editor.marks = {};
1544
- }
1545
1539
  if (aboveResult && aboveResult[0] && isEnd && isEmpty) {
1546
1540
  const wrapBlock = aboveResult[0];
1547
1541
  if (wrapBlock.type === type) {
@@ -1785,8 +1779,12 @@ const InlineCodeEditor = {
1785
1779
  unwrapInlineCode(editor) {
1786
1780
  Transforms.unwrapNodes(editor, { match: n => Element$1.isElement(n) && n.type === ElementKinds.inlineCode });
1787
1781
  },
1788
- isInlineCodeActive(editor) {
1789
- const [inlineCode] = Editor.nodes(editor, { match: n => Element$1.isElement(n) && n.type === ElementKinds.inlineCode });
1782
+ isInlineCodeActive(editor, path) {
1783
+ var _a;
1784
+ const [inlineCode] = Editor.nodes(editor, {
1785
+ at: path ? path : (_a = editor.selection) === null || _a === void 0 ? void 0 : _a.anchor.path,
1786
+ match: n => Element$1.isElement(n) && n.type === ElementKinds.inlineCode
1787
+ });
1790
1788
  return !!inlineCode;
1791
1789
  }
1792
1790
  };
@@ -2050,6 +2048,35 @@ const getToolbarClass = (editor) => {
2050
2048
  const IS_MAC = typeof window != 'undefined' && /Mac|iPod|iPhone|iPad/.test(window.navigator.platform);
2051
2049
  const CONTROL_KEY = IS_MAC ? '⌘' : 'Ctrl';
2052
2050
 
2051
+ /**
2052
+ * whether the current node is a clean paragraph
2053
+ * @param editor
2054
+ * @param text
2055
+ * @returns boolean
2056
+ */
2057
+ const isCleanEmptyParagraph = (editor) => {
2058
+ const isCollapsedCursor = TheEditor.isFocused(editor) && editor.selection && Range.isCollapsed(editor.selection);
2059
+ if (!isCollapsedCursor) {
2060
+ return false;
2061
+ }
2062
+ const block = Node.ancestor(editor, [editor.selection.anchor.path[0]]);
2063
+ const textIndent = 'textIndent';
2064
+ const align = 'align';
2065
+ const hasTextIndent = block[textIndent];
2066
+ const hasAlign = block[align];
2067
+ if (Node.string(block) === '' &&
2068
+ Element$1.isElement(block) &&
2069
+ block.type === ElementKinds.paragraph &&
2070
+ block.children.length === 1 &&
2071
+ Text.isText(block.children[0]) &&
2072
+ !Editor.isVoid(editor, block) &&
2073
+ !hasTextIndent &&
2074
+ !hasAlign) {
2075
+ return true;
2076
+ }
2077
+ return false;
2078
+ };
2079
+
2053
2080
  const withDeserializeMd = (options) => (editor) => {
2054
2081
  const { insertData, onKeydown } = editor;
2055
2082
  editor.onKeydown = (event) => {
@@ -2533,7 +2560,7 @@ class TheImageComponent extends TheBaseElementComponent {
2533
2560
  }
2534
2561
  }
2535
2562
  TheImageComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheImageComponent, deps: [{ token: i0.ElementRef }, { token: i1$2.DomSanitizer }, { token: THE_UPLOAD_SERVICE_TOKEN }, { token: i0.ChangeDetectorRef }, { token: TheContextService }], target: i0.ɵɵFactoryTarget.Component });
2536
- TheImageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheImageComponent, selector: "the-image, [theImage]", viewQueries: [{ propertyName: "imageContent", first: true, predicate: ["imageContent"], descendants: true }, { propertyName: "img", first: true, predicate: ["img"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n<div class=\"image-container\" contenteditable=\"false\" [style.textAlign]=\"imageEntry.align || 'center'\">\n <div\n #imageContent\n *ngIf=\"imageEntry.thumbUrl\"\n class=\"image-content\"\n [class.pointer]=\"!selection\"\n [ngStyle]=\"{ width: imageEntry.width + 'px', height: imageEntry.height + 'px' }\"\n >\n <img #img class=\"main-image\" [src]=\"imageEntry.thumbUrl\" [alt]=\"imageEntry.name\" />\n <div *ngIf=\"selection\" class=\"image-profile\" [class.outline]=\"selection\">\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, '-xl')\" class=\"image-pointer left top\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, 'xl')\" class=\"image-pointer right top\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, 'xl')\" class=\"image-pointer right bottom\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, '-xl')\" class=\"image-pointer left bottom\"></span>\n </div>\n <div *ngIf=\"uploading\" class=\"uploading\">\n <div class=\"uploading-percentage\">\n <thy-progress thyType=\"primary\" [thyValue]=\"percentage\" thySize=\"sm\"></thy-progress>\n <thy-icon (click)=\"cancelUpload($event)\" thyIconName=\"close-circle-bold-fill\" thyIconLegging=\"true\"></thy-icon>\n </div>\n </div>\n <div *ngIf=\"!uploading\" class=\"layer\" (mousedown)=\"preview($event)\" [class.readonly]=\"readonly\"></div>\n </div>\n <div *ngIf=\"!imageEntry.thumbUrl\" class=\"image-loading\" contenteditable=\"false\">\n <thy-icon thyIconName=\"image\"></thy-icon>\n </div>\n</div>\n", components: [{ type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { type: i4.ThyProgressComponent, selector: "thy-progress", inputs: ["thyType", "thyTips", "thyValue", "thySize", "thyMax"] }, { 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: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
2563
+ TheImageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheImageComponent, selector: "the-image, [theImage]", viewQueries: [{ propertyName: "imageContent", first: true, predicate: ["imageContent"], descendants: true }, { propertyName: "img", first: true, predicate: ["img"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n<div class=\"image-container\" contenteditable=\"false\" [style.textAlign]=\"imageEntry.align || 'center'\">\n <div\n #imageContent\n *ngIf=\"imageEntry.thumbUrl\"\n class=\"image-content\"\n [class.pointer]=\"!selection\"\n [ngStyle]=\"{ width: imageEntry.width + 'px', height: imageEntry.height + 'px' }\"\n >\n <img #img class=\"main-image\" [src]=\"imageEntry.thumbUrl\" [alt]=\"imageEntry.name\" />\n <div *ngIf=\"selection\" class=\"image-profile\" [class.outline]=\"selection\">\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, '-xl')\" class=\"image-pointer left top\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, 'xl')\" class=\"image-pointer right top\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, 'xl')\" class=\"image-pointer right bottom\"></span>\n <span *ngIf=\"isCollapsed\" (mousedown)=\"startDrag($event, '-xl')\" class=\"image-pointer left bottom\"></span>\n </div>\n <div *ngIf=\"uploading\" class=\"uploading\">\n <div class=\"uploading-percentage\">\n <thy-progress thyType=\"primary\" [thyValue]=\"percentage\" thySize=\"sm\"></thy-progress>\n <thy-icon (click)=\"cancelUpload($event)\" thyIconName=\"close-circle-bold-fill\" thyIconLegging=\"true\"></thy-icon>\n </div>\n </div>\n <div *ngIf=\"!uploading\" class=\"layer\" (mousedown)=\"preview($event)\" [class.readonly]=\"readonly\"></div>\n </div>\n <div *ngIf=\"!imageEntry.thumbUrl\" class=\"image-loading\" contenteditable=\"false\">\n <thy-icon thyIconName=\"image\"></thy-icon>\n </div>\n</div>\n", components: [{ type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { type: i4.ThyProgressComponent, selector: "thy-progress", inputs: ["thyType", "thySize", "thyValue", "thyMax", "thyTips"] }, { 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: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
2537
2564
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheImageComponent, decorators: [{
2538
2565
  type: Component,
2539
2566
  args: [{
@@ -3017,14 +3044,17 @@ const insertListItem = (editor) => {
3017
3044
  }
3018
3045
  else {
3019
3046
  /**
3020
- * If end, insert a list item after and select it
3047
+ * If end, split nodes
3021
3048
  */
3022
3049
  Editor.withoutNormalizing(editor, () => {
3023
- Transforms.insertNodes(editor, {
3024
- type: ElementKinds.listItem,
3025
- children: [{ type: ElementKinds.paragraph, children: [{ text: '' }] }]
3026
- }, { at: nextListItemPath });
3027
- Transforms.select(editor, nextListItemPath);
3050
+ Transforms.splitNodes(editor, {
3051
+ always: true,
3052
+ mode: 'highest',
3053
+ match: node => {
3054
+ const path = node && TheEditor.findPath(editor, node);
3055
+ return path && path.length === nextListItemPath.length;
3056
+ }
3057
+ });
3028
3058
  });
3029
3059
  }
3030
3060
  /**
@@ -4542,8 +4572,17 @@ const withBlockCard = (editor) => {
4542
4572
  return editor;
4543
4573
  };
4544
4574
 
4575
+ const isInline = (editor, path) => {
4576
+ var _a;
4577
+ const [inlineNode] = Editor.nodes(editor, {
4578
+ at: path ? path : (_a = editor.selection) === null || _a === void 0 ? void 0 : _a.anchor.path,
4579
+ match: n => Element$1.isElement(n) && Editor.isInline(editor, n) && !Editor.isVoid(editor, n)
4580
+ });
4581
+ return !!inlineNode;
4582
+ };
4583
+
4545
4584
  const withMoveSelection = (editor) => {
4546
- const { onClick, deleteBackward } = editor;
4585
+ const { onClick, deleteBackward, onKeydown } = editor;
4547
4586
  editor.onClick = (event) => {
4548
4587
  const domSelection = window.getSelection();
4549
4588
  if (domSelection && !domSelection.isCollapsed && event.detail >= 2 && editor.selection) {
@@ -4574,6 +4613,50 @@ const withMoveSelection = (editor) => {
4574
4613
  }
4575
4614
  deleteBackward(unit);
4576
4615
  };
4616
+ editor.onKeydown = (event) => {
4617
+ const { selection } = editor;
4618
+ if (!selection || !selection.anchor || !selection.focus) {
4619
+ onKeydown(event);
4620
+ return;
4621
+ }
4622
+ const isMoveBackward = hotkeys.isMoveBackward(event);
4623
+ const isMoveForward = hotkeys.isMoveForward(event);
4624
+ const isCollapsed$1 = selection && isCollapsed(selection);
4625
+ const isInlineNode = isInline(editor);
4626
+ if (isCollapsed$1 && isMoveForward) {
4627
+ let isInlineCodeBefore = false;
4628
+ if (!isInlineNode) {
4629
+ try {
4630
+ const { path } = Editor.after(editor, selection);
4631
+ if (path) {
4632
+ isInlineCodeBefore = isInline(editor, path);
4633
+ }
4634
+ }
4635
+ catch (error) { }
4636
+ }
4637
+ if (isInlineNode || isInlineCodeBefore) {
4638
+ event.preventDefault();
4639
+ Transforms.move(editor, { unit: 'offset' });
4640
+ return;
4641
+ }
4642
+ }
4643
+ if (isCollapsed$1 && isMoveBackward) {
4644
+ let isInlineCodeAfter = false;
4645
+ if (!isInlineNode) {
4646
+ try {
4647
+ const { path } = Editor.before(editor, selection);
4648
+ isInlineCodeAfter = isInline(editor, path);
4649
+ }
4650
+ catch (error) { }
4651
+ }
4652
+ if (isInlineNode || isInlineCodeAfter) {
4653
+ event.preventDefault();
4654
+ Transforms.move(editor, { unit: 'offset', reverse: true });
4655
+ return;
4656
+ }
4657
+ }
4658
+ onKeydown(event);
4659
+ };
4577
4660
  return editor;
4578
4661
  };
4579
4662
 
@@ -5138,7 +5221,7 @@ function insertRow(opts, editor, count = 1, at // row index
5138
5221
  /**
5139
5222
  * Insert a new table
5140
5223
  */
5141
- function insertTable(opts, editor, columns = 3, rows = 3, getCellContent) {
5224
+ function insertTable(opts, editor, rows = 3, columns = 3, getCellContent) {
5142
5225
  const { selection } = editor;
5143
5226
  if (!(selection === null || selection === void 0 ? void 0 : selection.anchor)) {
5144
5227
  return;
@@ -6916,7 +6999,7 @@ class TheLinkEditComponent {
6916
6999
  }
6917
7000
  }
6918
7001
  TheLinkEditComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheLinkEditComponent, deps: [{ token: i1$3.ThyPopoverRef }], target: i0.ɵɵFactoryTarget.Component });
6919
- TheLinkEditComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheLinkEditComponent, selector: "the-link-edit", inputs: { tag: "tag", node: "node", link: "link", text: "text", originSelection: "originSelection" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)" }, properties: { "class": "this.className" } }, ngImport: i0, template: "<form\n thyForm\n #linkForm=\"thyForm\"\n [thyFormValidatorConfig]=\"validatorConfig\"\n name=\"linkForm\"\n>\n <thy-form-group thyLabelText=\"\u6587\u672C\">\n <input\n thyInput\n placeholder=\"\u8BF7\u8F93\u5165\u6587\u672C\"\n required\n name=\"text\"\n [(ngModel)]=\"text\"\n thyAutofocus\n type=\"text\"\n />\n </thy-form-group>\n <thy-form-group thyLabelText=\"\u94FE\u63A5\">\n <input\n name=\"link\"\n thyInput\n placeholder=\"\u8BF7\u8F93\u5165\u94FE\u63A5\"\n required\n type=\"text\"\n #linkControl=\"ngModel\"\n [(ngModel)]=\"link\"\n />\n </thy-form-group>\n <thy-form-group-footer>\n <div class=\"btn-pair\">\n <button\n thyButton=\"link-secondary\"\n thySize=\"sm\"\n (click)=\"closePopover()\"\n >\u53D6\u6D88</button>\n <button\n thyButton=\"primary-square\"\n thySize=\"sm\"\n (thyFormSubmit)=\"applyLink(linkForm)\"\n >\u5E94\u7528</button>\n </div>\n </thy-form-group-footer>\n</form>\n", components: [{ type: i2$1.ThyFormGroupComponent, selector: "thy-form-group", inputs: ["thyLabelText", "thyLabelTextTranslateKey", "thyLabelRequired", "thyLabelPaddingTopClear", "thyFeedbackIcon", "thyTips", "thyTipsTranslateKey", "thyRowFill"] }, { type: i2$1.ThyFormGroupFooterComponent, selector: "thy-form-group-footer", inputs: ["thyAlign"] }, { type: i1$5.ThyButtonComponent, selector: "thy-button,[thy-button],[thyButton]", inputs: ["thyButton", "thyType", "thyLoading", "thyLoadingText", "thySize", "thyIcon", "thySquare", "thyBlock"] }], directives: [{ type: i4$2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i4$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4$2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i2$1.ThyFormDirective, selector: "[thyForm],[thy-form]", inputs: ["thyLayout", "thyEnterKeyMode", "thyFormValidatorConfig"], exportAs: ["thyForm"] }, { type: i5$3.ThyAutofocusDirective, selector: "input[thyAutofocus],textarea[thyAutofocus]", inputs: ["thyAutoSelect", "thyAutofocus"] }, { 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.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { 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"] }, { type: i2$1.ThyFormSubmitDirective, selector: "[thyFormSubmit],[thy-form-submit]", outputs: ["thyFormSubmit"] }] });
7002
+ TheLinkEditComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheLinkEditComponent, selector: "the-link-edit", inputs: { tag: "tag", node: "node", link: "link", text: "text", originSelection: "originSelection" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)" }, properties: { "class": "this.className" } }, ngImport: i0, template: "<form\n thyForm\n #linkForm=\"thyForm\"\n [thyFormValidatorConfig]=\"validatorConfig\"\n name=\"linkForm\"\n>\n <thy-form-group thyLabelText=\"\u6587\u672C\">\n <input\n thyInput\n placeholder=\"\u8BF7\u8F93\u5165\u6587\u672C\"\n required\n name=\"text\"\n [(ngModel)]=\"text\"\n thyAutofocus\n type=\"text\"\n />\n </thy-form-group>\n <thy-form-group thyLabelText=\"\u94FE\u63A5\">\n <input\n name=\"link\"\n thyInput\n placeholder=\"\u8BF7\u8F93\u5165\u94FE\u63A5\"\n required\n type=\"text\"\n #linkControl=\"ngModel\"\n [(ngModel)]=\"link\"\n />\n </thy-form-group>\n <thy-form-group-footer>\n <div class=\"btn-pair\">\n <button\n thyButton=\"link-secondary\"\n thySize=\"sm\"\n (click)=\"closePopover()\"\n >\u53D6\u6D88</button>\n <button\n thyButton=\"primary-square\"\n thySize=\"sm\"\n (thyFormSubmit)=\"applyLink(linkForm)\"\n >\u5E94\u7528</button>\n </div>\n </thy-form-group-footer>\n</form>\n", components: [{ type: i2$1.ThyFormGroupComponent, selector: "thy-form-group", inputs: ["thyLabelText", "thyLabelTextTranslateKey", "thyLabelRequired", "thyLabelPaddingTopClear", "thyFeedbackIcon", "thyTipsMode", "thyTips", "thyTipsTranslateKey", "thyRowFill"] }, { type: i2$1.ThyFormGroupFooterComponent, selector: "thy-form-group-footer", inputs: ["thyAlign"] }, { type: i1$5.ThyButtonComponent, selector: "thy-button,[thy-button],[thyButton]", inputs: ["thyButton", "thyType", "thyLoading", "thyLoadingText", "thySize", "thyIcon", "thySquare", "thyBlock"] }], directives: [{ type: i4$2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i4$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4$2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i2$1.ThyFormDirective, selector: "[thyForm],[thy-form]", inputs: ["thyLayout", "thyEnterKeyMode", "thyFormValidatorConfig"], exportAs: ["thyForm"] }, { type: i5$3.ThyAutofocusDirective, selector: "input[thyAutofocus],textarea[thyAutofocus]", inputs: ["thyAutoSelect", "thyAutofocus"] }, { 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.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { 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"] }, { type: i2$1.ThyFormSubmitDirective, selector: "[thyFormSubmit],[thy-form-submit]", outputs: ["thyFormSubmit"] }] });
6920
7003
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheLinkEditComponent, decorators: [{
6921
7004
  type: Component,
6922
7005
  args: [{
@@ -7071,14 +7154,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
7071
7154
  args: ['click', ['$event']]
7072
7155
  }] } });
7073
7156
  class TheLinkComponent extends TheBaseLinkComponent {
7157
+ constructor() {
7158
+ super(...arguments);
7159
+ // Put this at the start and end of an inline component to work around this Chromium bug:
7160
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=1249405
7161
+ this.inlineChromiumBugfix = '$' + String.fromCodePoint(160);
7162
+ }
7074
7163
  }
7075
7164
  TheLinkComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheLinkComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
7076
- TheLinkComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheLinkComponent, selector: "span[theLink]", usesInheritance: true, ngImport: i0, template: `<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>`, isInline: true, components: [{ type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
7165
+ TheLinkComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheLinkComponent, selector: "span[theLink]", usesInheritance: true, ngImport: i0, template: ` <span contenteditable="false" style="font-size: 0;">{{ inlineChromiumBugfix }}</span>
7166
+ <slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>
7167
+ <span contenteditable="false" style="font-size: 0;">{{ inlineChromiumBugfix }}</span>`, isInline: true, components: [{ type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
7077
7168
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheLinkComponent, decorators: [{
7078
7169
  type: Component,
7079
7170
  args: [{
7080
7171
  selector: 'span[theLink]',
7081
- template: `<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>`
7172
+ template: ` <span contenteditable="false" style="font-size: 0;">{{ inlineChromiumBugfix }}</span>
7173
+ <slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>
7174
+ <span contenteditable="false" style="font-size: 0;">{{ inlineChromiumBugfix }}</span>`
7082
7175
  }]
7083
7176
  }] });
7084
7177
  class TheReadonlyLinkComponent extends TheBaseLinkComponent {
@@ -10790,35 +10883,6 @@ const PaintFormatOptions = [
10790
10883
  }
10791
10884
  ];
10792
10885
 
10793
- /**
10794
- * whether the current node is a clean paragraph
10795
- * @param editor
10796
- * @param text
10797
- * @returns boolean
10798
- */
10799
- const isCleanEmptyParagraph = (editor) => {
10800
- const isCollapsedCursor = TheEditor.isFocused(editor) && editor.selection && Range.isCollapsed(editor.selection);
10801
- if (!isCollapsedCursor) {
10802
- return false;
10803
- }
10804
- const block = Node.ancestor(editor, [editor.selection.anchor.path[0]]);
10805
- const textIndent = 'textIndent';
10806
- const align = 'align';
10807
- const hasTextIndent = block[textIndent];
10808
- const hasAlign = block[align];
10809
- if (Node.string(block) === '' &&
10810
- Element$1.isElement(block) &&
10811
- block.type === ElementKinds.paragraph &&
10812
- block.children.length === 1 &&
10813
- Text.isText(block.children[0]) &&
10814
- !Editor.isVoid(editor, block) &&
10815
- !hasTextIndent &&
10816
- !hasAlign) {
10817
- return true;
10818
- }
10819
- return false;
10820
- };
10821
-
10822
10886
  class TheToolbarItemComponent extends TheToolbarBaseItemComponent {
10823
10887
  constructor(ngZone, cfr) {
10824
10888
  super();
@@ -11203,30 +11267,29 @@ const InlineCodeOptions = [
11203
11267
  ];
11204
11268
 
11205
11269
  class TheInlineCodeComponent extends TheBaseElementComponent {
11206
- constructor(elementRef, cdr) {
11207
- super(elementRef, cdr);
11208
- this.elementRef = elementRef;
11209
- this.cdr = cdr;
11210
- }
11211
- ngOnInit() {
11212
- super.ngOnInit();
11213
- }
11214
- ngOnDestroy() {
11215
- super.ngOnDestroy();
11270
+ constructor() {
11271
+ super(...arguments);
11272
+ // Put this at the start and end of an inline component to work around this Chromium bug:
11273
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=1249405
11274
+ this.inlineChromiumBugfix = '$' + String.fromCodePoint(160);
11216
11275
  }
11217
11276
  }
11218
- TheInlineCodeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheInlineCodeComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
11219
- TheInlineCodeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheInlineCodeComponent, selector: "span[theInlineCode]", usesInheritance: true, ngImport: i0, template: '<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>', isInline: true, components: [{ type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
11277
+ TheInlineCodeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheInlineCodeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
11278
+ TheInlineCodeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheInlineCodeComponent, selector: "span[theInlineCode]", usesInheritance: true, ngImport: i0, template: ` <span contenteditable="false" style="font-size: 0;">{{ inlineChromiumBugfix }}</span>
11279
+ <slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>
11280
+ <span contenteditable="false" style="font-size: 0;">{{ inlineChromiumBugfix }}</span>`, isInline: true, components: [{ type: i1.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
11220
11281
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheInlineCodeComponent, decorators: [{
11221
11282
  type: Component,
11222
11283
  args: [{
11223
11284
  selector: 'span[theInlineCode]',
11224
- template: '<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>'
11285
+ template: ` <span contenteditable="false" style="font-size: 0;">{{ inlineChromiumBugfix }}</span>
11286
+ <slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>
11287
+ <span contenteditable="false" style="font-size: 0;">{{ inlineChromiumBugfix }}</span>`
11225
11288
  }]
11226
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; } });
11289
+ }] });
11227
11290
 
11228
11291
  const withInlineCode = (editor) => {
11229
- const { isInline, renderElement, insertText } = editor;
11292
+ const { isInline, renderElement, insertText, onKeydown } = editor;
11230
11293
  editor.isInline = (element) => {
11231
11294
  return element.type === ElementKinds.inlineCode ? true : isInline(element);
11232
11295
  };
@@ -11655,15 +11718,15 @@ class TheToolbarComponent {
11655
11718
  return TheToolbarItemComponent;
11656
11719
  }
11657
11720
  getDropdownItem(item) {
11658
- var _a;
11721
+ var _a, _b, _c;
11659
11722
  let dropdownKey = item === null || item === void 0 ? void 0 : item.dropdownItemKey;
11660
11723
  // modify the fontsize option externally
11661
- const contextService = this.editor.injector.get(TheContextService);
11662
- const fontSize = contextService.getDefaultFontSize();
11663
- if (item.key === MarkTypes.fontSize && fontSize) {
11724
+ const contextService = (_b = (_a = this.editor) === null || _a === void 0 ? void 0 : _a.injector) === null || _b === void 0 ? void 0 : _b.get(TheContextService);
11725
+ const fontSize = contextService === null || contextService === void 0 ? void 0 : contextService.getDefaultFontSize();
11726
+ if (contextService && item.key === MarkTypes.fontSize && fontSize) {
11664
11727
  dropdownKey = fontSize;
11665
11728
  }
11666
- return (_a = item === null || item === void 0 ? void 0 : item.includes) === null || _a === void 0 ? void 0 : _a.find((item) => item.key === dropdownKey);
11729
+ return (_c = item === null || item === void 0 ? void 0 : item.includes) === null || _c === void 0 ? void 0 : _c.find((item) => item.key === dropdownKey);
11667
11730
  }
11668
11731
  }
11669
11732
  TheToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheToolbarComponent, deps: [{ token: i0.ComponentFactoryResolver }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: TheToolbarGroupToken }], target: i0.ɵɵFactoryTarget.Component });
@@ -11830,6 +11893,7 @@ class TheQuickInsertComponent {
11830
11893
  this.renderer = renderer;
11831
11894
  this.elementRef = elementRef;
11832
11895
  this.cdr = cdr;
11896
+ this.isVisible = false;
11833
11897
  this.isHide = true;
11834
11898
  this.defaultIconName = 'plus-circle-thin';
11835
11899
  this.iconNameFill = 'plus-circle-thin-fill';
@@ -11840,18 +11904,21 @@ class TheQuickInsertComponent {
11840
11904
  event.stopPropagation();
11841
11905
  }
11842
11906
  checkStatus() {
11907
+ var _a;
11843
11908
  const { editor } = this;
11844
- if (isCleanEmptyParagraph(editor)) {
11845
- setTimeout(() => {
11846
- var _a;
11847
- 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]]);
11848
- const rootNode = AngularEditor.toDOMNode(editor, block);
11849
- this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
11850
- });
11909
+ if (this.isVisible && isCleanEmptyParagraph(editor) && !this.hasExcludeAttribute()) {
11910
+ 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]]);
11911
+ const rootNode = AngularEditor.toDOMNode(editor, block);
11912
+ this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
11851
11913
  return;
11852
11914
  }
11853
11915
  this.isHide = true;
11854
11916
  }
11917
+ hasExcludeAttribute() {
11918
+ const marks = getSelectionMarks(this.editor);
11919
+ const fontSizeMark = marks[MarkTypes.fontSize];
11920
+ return fontSizeMark;
11921
+ }
11855
11922
  updatePosition(left, top) {
11856
11923
  this.isHide = false;
11857
11924
  this.renderer.setStyle(this.elementRef.nativeElement, 'top', `${top}px`);
@@ -11872,7 +11939,7 @@ class TheQuickInsertComponent {
11872
11939
  }
11873
11940
  }
11874
11941
  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 });
11875
- 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"] }] });
11942
+ TheQuickInsertComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheQuickInsertComponent, selector: "[theQuickInsert]", inputs: { editor: "editor", quickToolbarItems: "quickToolbarItems", isVisible: "isVisible" }, 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"] }] });
11876
11943
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheQuickInsertComponent, decorators: [{
11877
11944
  type: Component,
11878
11945
  args: [{
@@ -11887,6 +11954,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
11887
11954
  type: Input
11888
11955
  }], quickToolbarItems: [{
11889
11956
  type: Input
11957
+ }], isVisible: [{
11958
+ type: Input
11890
11959
  }], iconElement: [{
11891
11960
  type: ViewChild,
11892
11961
  args: ['iconElement', { read: ElementRef, static: false }]
@@ -11895,82 +11964,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
11895
11964
  args: ['mousedown', ['$event']]
11896
11965
  }] } });
11897
11966
 
11898
- class ThePlaceholderComponent {
11899
- constructor(renderer, elementRef, contextService) {
11900
- this.renderer = renderer;
11901
- this.elementRef = elementRef;
11902
- this.contextService = contextService;
11903
- this.isHide = true;
11904
- }
11905
- handleCompositionStart() {
11906
- var _a;
11907
- if ((_a = this.editor) === null || _a === void 0 ? void 0 : _a.selection) {
11908
- this.hide();
11909
- }
11910
- }
11911
- handleCompositionEnd(event) {
11912
- if (!event.data) {
11913
- this.checkStatus();
11914
- }
11915
- }
11916
- checkStatus() {
11917
- var _a, _b, _c;
11918
- const { editor } = this;
11919
- const isEmptyShow = typeof ((_a = this.options) === null || _a === void 0 ? void 0 : _a.isEmptyShowPlaceholder) === 'undefined' ? true : this.options.isEmptyShowPlaceholder;
11920
- const isMustShow = (_b = this.options) === null || _b === void 0 ? void 0 : _b.isMustShowPlaceholder;
11921
- const isReadonly = (_c = this.options) === null || _c === void 0 ? void 0 : _c.readonly;
11922
- // empty content and no selection processing
11923
- if (!isReadonly && isEmptyShow && isEmptyContent(editor.children)) {
11924
- const firstElementChild = this.contextService.getFirstElementChild();
11925
- const offsetTop = firstElementChild.offsetTop;
11926
- const offsetLeft = firstElementChild.offsetLeft;
11927
- this.updatePosition(offsetLeft, offsetTop);
11928
- return;
11929
- }
11930
- if (isMustShow && isCleanEmptyParagraph(editor)) {
11931
- setTimeout(() => {
11932
- var _a;
11933
- 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]]);
11934
- const rootNode = AngularEditor.toDOMNode(editor, block);
11935
- this.updatePosition(rootNode.offsetLeft, rootNode.offsetTop);
11936
- });
11937
- return;
11938
- }
11939
- this.isHide = true;
11940
- }
11941
- updatePosition(left, top) {
11942
- this.isHide = false;
11943
- this.renderer.setStyle(this.elementRef.nativeElement, 'top', `${top}px`);
11944
- this.renderer.setStyle(this.elementRef.nativeElement, 'left', `${left}px`);
11945
- }
11946
- hide() {
11947
- this.isHide = true;
11948
- }
11949
- }
11950
- ThePlaceholderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: ThePlaceholderComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: TheContextService }], target: i0.ɵɵFactoryTarget.Component });
11951
- 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 });
11952
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: ThePlaceholderComponent, decorators: [{
11953
- type: Component,
11954
- args: [{
11955
- selector: 'div[thePlaceholder]',
11956
- template: `{{ options?.placeholder }}`,
11957
- host: {
11958
- class: 'the-placeholder',
11959
- '[class.hide]': 'isHide'
11960
- }
11961
- }]
11962
- }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: TheContextService }]; }, propDecorators: { editor: [{
11963
- type: Input
11964
- }], options: [{
11965
- type: Input
11966
- }], handleCompositionStart: [{
11967
- type: HostListener,
11968
- args: ['document:compositionstart']
11969
- }], handleCompositionEnd: [{
11970
- type: HostListener,
11971
- args: ['document:compositionend', ['$event']]
11972
- }] } });
11973
-
11974
11967
  class TheTemplateComponent {
11975
11968
  constructor() {
11976
11969
  this.renderElement = (element) => {
@@ -12032,13 +12025,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
12032
12025
  }] } });
12033
12026
 
12034
12027
  class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
12035
- constructor(toolbarService, theContextService, viewContainerRef, elementRef, ngZone) {
12028
+ constructor(toolbarService, theContextService, viewContainerRef, elementRef, ngZone, cdr) {
12036
12029
  super();
12037
12030
  this.toolbarService = toolbarService;
12038
12031
  this.theContextService = theContextService;
12039
12032
  this.viewContainerRef = viewContainerRef;
12040
12033
  this.elementRef = elementRef;
12041
12034
  this.ngZone = ngZone;
12035
+ this.cdr = cdr;
12042
12036
  this.thePlugins = [];
12043
12037
  this.theOnSave = new EventEmitter();
12044
12038
  this.theOnDOMEvent = new EventEmitter();
@@ -12189,9 +12183,7 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
12189
12183
  });
12190
12184
  this.toolbarCalculate();
12191
12185
  setTimeout(() => {
12192
- var _a;
12193
12186
  this.theEditorCreated.emit(this.editor);
12194
- (_a = this.placeholderInstance) === null || _a === void 0 ? void 0 : _a.checkStatus();
12195
12187
  this.applyAutoFocus();
12196
12188
  });
12197
12189
  }
@@ -12233,6 +12225,7 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
12233
12225
  const data = dataDeserialize((_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.mode, value);
12234
12226
  // data-deserialize
12235
12227
  this.editorValue = data;
12228
+ this.cdr.markForCheck();
12236
12229
  }
12237
12230
  registerOnChange(fn) {
12238
12231
  this.onChangeCallback = fn;
@@ -12242,13 +12235,16 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
12242
12235
  }
12243
12236
  valueChange(value) {
12244
12237
  var _a, _b, _c, _d, _e, _f;
12245
- (_a = this.theGlobalToolbarInstance) === null || _a === void 0 ? void 0 : _a.statusChange(this.editor);
12246
- (_b = this.quickInsertInstance) === null || _b === void 0 ? void 0 : _b.checkStatus();
12247
- (_c = this.placeholderInstance) === null || _c === void 0 ? void 0 : _c.checkStatus();
12238
+ const isEditable = !((_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.readonly) && !((_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.disabled);
12239
+ (_c = this.theGlobalToolbarInstance) === null || _c === void 0 ? void 0 : _c.statusChange(this.editor);
12240
+ // quick insert button
12241
+ if (isEditable) {
12242
+ (_d = this.quickInsertInstance) === null || _d === void 0 ? void 0 : _d.checkStatus();
12243
+ }
12248
12244
  // auto scroll view
12249
- const scrollContainer = (_d = this.theOptions) === null || _d === void 0 ? void 0 : _d.scrollContainer;
12250
- const maxHeight = (_e = this.theOptions) === null || _e === void 0 ? void 0 : _e.maxHeight;
12251
- if (!((_f = this.theOptions) === null || _f === void 0 ? void 0 : _f.readonly) && (scrollContainer || maxHeight)) {
12245
+ const scrollContainer = (_e = this.theOptions) === null || _e === void 0 ? void 0 : _e.scrollContainer;
12246
+ const maxHeight = (_f = this.theOptions) === null || _f === void 0 ? void 0 : _f.maxHeight;
12247
+ if (isEditable && (scrollContainer || maxHeight)) {
12252
12248
  const container = maxHeight ? DEFAULT_SCROLL_CONTAINER : scrollContainer;
12253
12249
  this.autoScrollView(this.editor, container);
12254
12250
  }
@@ -12363,7 +12359,7 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
12363
12359
  };
12364
12360
  }
12365
12361
  }
12366
- TheEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheEditorComponent, deps: [{ token: TheToolbarService }, { token: TheContextService }, { token: i0.ViewContainerRef }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
12362
+ TheEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheEditorComponent, deps: [{ token: TheToolbarService }, { token: TheContextService }, { token: i0.ViewContainerRef }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
12367
12363
  TheEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.7", type: TheEditorComponent, selector: "the-editor, theEditor", inputs: { theOptions: "theOptions", thePlugins: "thePlugins", theGlobalToolbar: "theGlobalToolbar", theDecorate: "theDecorate", theOnError: "theOnError" }, outputs: { theOnSave: "theOnSave", theOnDOMEvent: "theOnDOMEvent", theEditorCreated: "theEditorCreated" }, host: { properties: { "class.the-editor-readonly": "theOptions?.readonly" }, classAttribute: "the-editor" }, providers: [
12368
12364
  TheToolbarService,
12369
12365
  TheContextService,
@@ -12373,7 +12369,7 @@ TheEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
12373
12369
  useExisting: forwardRef(() => TheEditorComponent),
12374
12370
  multi: true
12375
12371
  }
12376
- ], viewQueries: [{ propertyName: "templateInstance", first: true, predicate: ["templateInstance"], descendants: true, static: true }, { propertyName: "globalToolbarInstance", first: true, predicate: ["globalToolbar"], descendants: true }, { propertyName: "quickInsertInstance", first: true, predicate: ["quickInsert"], descendants: true, static: true }, { propertyName: "placeholderInstance", first: true, predicate: ["placeholder"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<the-toolbar\n *ngIf=\"!theOptions?.readonly && !theGlobalToolbar\"\n [ngClass]=\"{\n 'the-toolbar-disabled': theOptions?.disabled\n }\"\n #globalToolbar\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarEntity.global\"\n [containerClass]=\"globalToolbarClass\"\n [align]=\"theOptions?.toolbar?.align\"\n></the-toolbar>\n\n<div\n class=\"the-editable-container\"\n [ngClass]=\"{\n 'the-editor-disabled': theOptions?.disabled,\n 'max-height': maxHeight\n }\"\n [ngStyle]=\"{ 'max-height': maxHeight }\"\n>\n <slate-editable\n class=\"the-editor-typo\"\n [editor]=\"editor\"\n [ngModel]=\"editorValue\"\n (ngModelChange)=\"valueChange($event)\"\n [decorate]=\"decorate\"\n [renderElement]=\"renderElement\"\n [renderText]=\"renderText\"\n [renderLeaf]=\"renderLeaf\"\n [readonly]=\"theOptions?.readonly || theOptions?.disabled\"\n [keydown]=\"onKeyDown\"\n [click]=\"onClick\"\n [paste]=\"onSlaPaste\"\n [beforeInput]=\"onSlaBeforeInput\"\n [blur]=\"onSlaBlur\"\n [focus]=\"onSlaFocus\"\n [copy]=\"onSlaCopy\"\n [cut]=\"onSlaCut\"\n [isStrictDecorate]=\"false\"\n [compositionStart]=\"onSlaCompositionStart\"\n [compositionEnd]=\"onSlaCompositionEnd\"\n [dragStart]=\"onSlaDragStart\"\n [dragOver]=\"onSlaDragOver\"\n [drop]=\"onDrop\"\n (mousedown)=\"mousedown($event)\"\n ></slate-editable>\n <the-inline-toolbar *ngIf=\"!theOptions?.readonly\" [editor]=\"editor\" [toolbarItems]=\"toolbarEntity.inline\"></the-inline-toolbar>\n <div #quickInsert theQuickInsert [editor]=\"editor\" [quickToolbarItems]=\"quickToolbarItems\"></div>\n <div #placeholder thePlaceholder [editor]=\"editor\" [options]=\"theOptions\"></div>\n <the-template #templateInstance></the-template>\n</div>\n", components: [{ type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "containerClass", "isMore", "afterTemplate"] }, { type: i1.SlateEditableComponent, selector: "slate-editable", inputs: ["editor", "renderElement", "renderLeaf", "renderText", "decorate", "placeholderDecorate", "isStrictDecorate", "trackBy", "readonly", "placeholder", "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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
12372
+ ], viewQueries: [{ propertyName: "templateInstance", first: true, predicate: ["templateInstance"], descendants: true, static: true }, { propertyName: "globalToolbarInstance", first: true, predicate: ["globalToolbar"], descendants: true }, { propertyName: "quickInsertInstance", first: true, predicate: ["quickInsert"], descendants: true, static: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<the-toolbar\n *ngIf=\"!theOptions?.readonly && !theGlobalToolbar\"\n [ngClass]=\"{\n 'the-toolbar-disabled': theOptions?.disabled\n }\"\n #globalToolbar\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarEntity.global\"\n [containerClass]=\"globalToolbarClass\"\n [align]=\"theOptions?.toolbar?.align\"\n></the-toolbar>\n\n<div\n class=\"the-editable-container\"\n [ngClass]=\"{\n 'the-editor-disabled': theOptions?.disabled,\n 'max-height': maxHeight\n }\"\n [ngStyle]=\"{ 'max-height': maxHeight }\"\n>\n <slate-editable\n class=\"the-editor-typo\"\n [editor]=\"editor\"\n [ngModel]=\"editorValue\"\n (ngModelChange)=\"valueChange($event)\"\n [decorate]=\"decorate\"\n [placeholder]=\"theOptions?.placeholder\"\n [placeholderDecorate]=\"theOptions?.placeholderDecorate ? theOptions?.placeholderDecorate : null\"\n [renderElement]=\"renderElement\"\n [renderText]=\"renderText\"\n [renderLeaf]=\"renderLeaf\"\n [readonly]=\"theOptions?.readonly || theOptions?.disabled\"\n [keydown]=\"onKeyDown\"\n [click]=\"onClick\"\n [paste]=\"onSlaPaste\"\n [beforeInput]=\"onSlaBeforeInput\"\n [blur]=\"onSlaBlur\"\n [focus]=\"onSlaFocus\"\n [copy]=\"onSlaCopy\"\n [cut]=\"onSlaCut\"\n [isStrictDecorate]=\"false\"\n [compositionStart]=\"onSlaCompositionStart\"\n [compositionEnd]=\"onSlaCompositionEnd\"\n [dragStart]=\"onSlaDragStart\"\n [dragOver]=\"onSlaDragOver\"\n [drop]=\"onDrop\"\n (mousedown)=\"mousedown($event)\"\n ></slate-editable>\n <the-inline-toolbar *ngIf=\"!theOptions?.readonly\" [editor]=\"editor\" [toolbarItems]=\"toolbarEntity.inline\"></the-inline-toolbar>\n <div\n #quickInsert\n theQuickInsert\n [editor]=\"editor\"\n [quickToolbarItems]=\"quickToolbarItems\"\n [isVisible]=\"theOptions?.quickInsertVisible\"\n ></div>\n <the-template #templateInstance></the-template>\n</div>\n", components: [{ type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "containerClass", "isMore", "afterTemplate"] }, { type: i1.SlateEditableComponent, selector: "slate-editable", inputs: ["editor", "renderElement", "renderLeaf", "renderText", "decorate", "placeholderDecorate", "isStrictDecorate", "trackBy", "readonly", "placeholder", "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", "isVisible"] }, { 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
12377
12373
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: TheEditorComponent, decorators: [{
12378
12374
  type: Component,
12379
12375
  args: [{
@@ -12395,7 +12391,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
12395
12391
  '[class.the-editor-readonly]': 'theOptions?.readonly'
12396
12392
  }
12397
12393
  }]
12398
- }], ctorParameters: function () { return [{ type: TheToolbarService }, { type: TheContextService }, { type: i0.ViewContainerRef }, { type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { theOptions: [{
12394
+ }], ctorParameters: function () { return [{ type: TheToolbarService }, { type: TheContextService }, { type: i0.ViewContainerRef }, { type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { theOptions: [{
12399
12395
  type: Input
12400
12396
  }], thePlugins: [{
12401
12397
  type: Input
@@ -12420,9 +12416,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
12420
12416
  }], quickInsertInstance: [{
12421
12417
  type: ViewChild,
12422
12418
  args: ['quickInsert', { static: true }]
12423
- }], placeholderInstance: [{
12424
- type: ViewChild,
12425
- args: ['placeholder']
12426
12419
  }] } });
12427
12420
 
12428
12421
  const ENTRY_COMMON_COMPONENTS = [TheColumnResizeOverlayHandleComponent];
@@ -12620,7 +12613,6 @@ const PLUGIN_COMPONENTS = [
12620
12613
  TheTableComponent,
12621
12614
  TheTableRowComponent,
12622
12615
  TheTdComponent,
12623
- ThePlaceholderComponent,
12624
12616
  TheInlineCodeComponent
12625
12617
  ];
12626
12618
  const PIPES = [ElementStylePipe, ElementClassPipe];
@@ -12661,7 +12653,6 @@ TheEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version
12661
12653
  TheTableComponent,
12662
12654
  TheTableRowComponent,
12663
12655
  TheTdComponent,
12664
- ThePlaceholderComponent,
12665
12656
  TheInlineCodeComponent], imports: [CommonModule, SlateModule, FormsModule, ThyIconModule,
12666
12657
  ThyAvatarModule,
12667
12658
  ThyNavModule,
@@ -12711,5 +12702,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
12711
12702
  * Generated bundle index. Do not edit.
12712
12703
  */
12713
12704
 
12714
- export { ALIGN_BLOCK_TYPES, A_TAG_REL_ATTR, AlignEditor, Alignment, BLOCK_DELETEBACKWARD_TYPES, BlockquoteEditor, CLIPBOARD_FORMAT_KEY, CODEMIRROR_PADDING_TOP, CODE_MODES, COMPONENTS, CONTAINER_BLOCKS, CONTROL_KEY, CodeEditor, CodeMode, ColorEditor, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DefaultQuickToolbarDefinition, DropdownMode, ELEMENT_UNIQUE_ID, ElementKinds, ErrorCodes, FontSizeTypes, FontSizes, HEADING_TYPES, HeadingEditor, HrEditor, IS_MAC, 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, TheCodeConfig, 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 };
12705
+ export { ALIGN_BLOCK_TYPES, A_TAG_REL_ATTR, AlignEditor, Alignment, BLOCK_DELETEBACKWARD_TYPES, BlockquoteEditor, CLIPBOARD_FORMAT_KEY, CODEMIRROR_PADDING_TOP, CODE_MODES, COMPONENTS, CONTAINER_BLOCKS, CONTROL_KEY, CodeEditor, CodeMode, ColorEditor, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DefaultQuickToolbarDefinition, DropdownMode, ELEMENT_UNIQUE_ID, ElementKinds, ErrorCodes, FontSizeTypes, FontSizes, HEADING_TYPES, HeadingEditor, HrEditor, IS_MAC, 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, TheCodeConfig, 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, isCleanEmptyParagraph, plainToTheia, toolbarCompose, withTheEditor };
12715
12706
  //# sourceMappingURL=worktile-theia.js.map