@worktile/theia 2.4.6 → 2.4.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.
@@ -379,11 +379,6 @@
379
379
  var DEFAULT_SCROLL_CONTAINER = '.the-editable-container';
380
380
  var ELEMENT_UNIQUE_ID = 'key';
381
381
  var ZERO_WIDTH_CHAR = '\u200B';
382
- exports.TheMode = void 0;
383
- (function (TheMode) {
384
- TheMode["fullMode"] = "full";
385
- TheMode["liteMode"] = "lite";
386
- })(exports.TheMode || (exports.TheMode = {}));
387
382
 
388
383
  exports.ElementKinds = void 0;
389
384
  (function (ElementKinds) {
@@ -591,22 +586,6 @@
591
586
  value: 'htmlmixed'
592
587
  }
593
588
  ];
594
- var CodeMode = {
595
- default: 'default',
596
- print: 'print'
597
- };
598
- var TheCodeConfig = /** @class */ (function () {
599
- function TheCodeConfig() {
600
- }
601
- return TheCodeConfig;
602
- }());
603
- var THE_CODE_MODE_TOKEN = new i0.InjectionToken('the-code-mode');
604
- var THE_CODE_MODE_PROVIDER = {
605
- provide: THE_CODE_MODE_TOKEN,
606
- useValue: {
607
- mode: CodeMode.default
608
- }
609
- };
610
589
  var CODEMIRROR_PADDING_TOP = 10;
611
590
 
612
591
  var TheToolbarGroupToken = new i0.InjectionToken('the-toolbar-group-token');
@@ -791,6 +770,23 @@
791
770
  TheDataMode["json"] = "json";
792
771
  TheDataMode["html"] = "html";
793
772
  })(exports.TheDataMode || (exports.TheDataMode = {}));
773
+ exports.TheMode = void 0;
774
+ (function (TheMode) {
775
+ TheMode["default"] = "default";
776
+ TheMode["print"] = "print";
777
+ })(exports.TheMode || (exports.TheMode = {}));
778
+ var TheModeConfig = /** @class */ (function () {
779
+ function TheModeConfig() {
780
+ }
781
+ return TheModeConfig;
782
+ }());
783
+ var THE_MODE_TOKEN = new i0.InjectionToken('the-mode');
784
+ var THE_MODE_PROVIDER = {
785
+ provide: THE_MODE_TOKEN,
786
+ useValue: {
787
+ mode: exports.TheMode.default
788
+ }
789
+ };
794
790
 
795
791
  exports.ToolbarItemType = void 0;
796
792
  (function (ToolbarItemType) {
@@ -7366,7 +7362,7 @@
7366
7362
  _this.config = config;
7367
7363
  _this.startRenderCodemirror = false;
7368
7364
  _this.dropdownMode = exports.DropdownMode;
7369
- _this.maxHeight = _this.config.mode === CodeMode.default ? 350 - CODEMIRROR_PADDING_TOP * 2 : 0;
7365
+ _this.maxHeight = _this.config.mode === exports.TheMode.default ? 350 - CODEMIRROR_PADDING_TOP * 2 : 0;
7370
7366
  _this.menus = CODE_MODES.map(function (item) {
7371
7367
  return { key: item.value, name: item.showName };
7372
7368
  });
@@ -7380,7 +7376,7 @@
7380
7376
  readOnly: false,
7381
7377
  autofocus: false,
7382
7378
  lineWiseCopyCut: true,
7383
- lineWrapping: _this.config.mode === CodeMode.default ? false : true,
7379
+ lineWrapping: _this.config.mode === exports.TheMode.default ? false : true,
7384
7380
  cursorBlinkRate: 500
7385
7381
  };
7386
7382
  _this.actives = _this.menus[0];
@@ -7567,7 +7563,7 @@
7567
7563
  };
7568
7564
  return TheCodeComponent;
7569
7565
  }(TheBaseElementComponent));
7570
- TheCodeComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheCodeComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }, { token: i1__namespace$4.ThyNotifyService }, { token: TheContextService }, { token: i0__namespace.NgZone }, { token: THE_CODE_MODE_TOKEN }], target: i0__namespace.ɵɵFactoryTarget.Component });
7566
+ TheCodeComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheCodeComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }, { token: i1__namespace$4.ThyNotifyService }, { token: TheContextService }, { token: i0__namespace.NgZone }, { token: THE_MODE_TOKEN }], target: i0__namespace.ɵɵFactoryTarget.Component });
7571
7567
  TheCodeComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheCodeComponent, selector: "div[theCode]", viewQueries: [{ propertyName: "codemirror", first: true, predicate: ["codemirror"], descendants: true, read: i8.CodeMirrorComponent }], usesInheritance: true, ngImport: i0__namespace, template: "<div contenteditable=\"false\" class=\"the-code-block-operation\" *ngIf=\"isCollapsed && codemirror && !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 <nav-split-line [mode]=\"ToolbarItemMode.vertical\"></nav-split-line>\n <span class=\"auto-wrap d-flex align-items-center\">\n <span>\u81EA\u52A8\u6362\u884C</span>\n <thy-switch\n class=\"auto-wrap-btn d-flex\"\n [(ngModel)]=\"options.lineWrapping\"\n (ngModelChange)=\"onChangeWrap($event)\"\n thySize=\"sm\"\n ></thy-switch>\n </span>\n </thy-icon-nav>\n</div>\n\n<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n\n<!-- \u53EA\u8BFB\u6A21\u5F0F\u4E0BCodeMirror-sizer\u9AD8\u5EA6\u6BD4\u7F16\u8F91\u6A21\u5F0F\u4E0B\u591A2px\uFF0C\u8BBE\u7F6EthyMinHeight\u4E3A46px\u9632\u6B62\u62D6\u62FD\u5230\u6700\u5C0F\u9AD8\u5EA6\u65F6\u53EA\u8BFB\u6A21\u5F0F\u4E0B\u51FA\u73B0\u6EDA\u52A8\u6761 -->\n<div\n thyResizable\n [thyMinHeight]=\"46\"\n [thyBounds]=\"resizeBounds\"\n [style.height.px]=\"resizeHeight\"\n (thyResize)=\"onResize($event)\"\n (thyResizeEnd)=\"onEndResize()\"\n class=\"resize-code-container\"\n [ngClass]=\"{ focus: isCollapsed, readonly: options.readOnly, active: isHightLight && isCollapsed }\"\n>\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 >\n </ng-codemirror>\n <thy-resize-handle thyDirection=\"bottom\" class=\"code-resize-icon\" *ngIf=\"isCollapsed && !options.readOnly\"></thy-resize-handle>\n</div>\n", components: [{ type: i3__namespace$1.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }, { type: TheToolbarDropdownComponent, selector: "the-toolbar-dropdown", inputs: ["toolbarItem", "menus", "mode", "item", "itemMousedownHandle"] }, { type: i3__namespace$1.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: NavSplitLineComponent, selector: "nav-split-line", inputs: ["mode"] }, { type: i6__namespace$1.ThySwitchComponent, selector: "thy-switch", inputs: ["thyType", "thySize", "thyDisabled"], outputs: ["thyChange"] }, { type: i1__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { type: i8__namespace.CodeMirrorComponent, selector: "ng-codemirror, [ngCodeMirror]", inputs: ["autoMaxHeight", "delayRefreshTime", "options"], outputs: ["focusChange"] }, { type: i9__namespace.ThyResizeHandleComponent, selector: "thy-resize-handle, [thy-resize-handle]", inputs: ["thyDirection"], outputs: ["thyMouseDown"], exportAs: ["thyResizeHandle"] }], directives: [{ type: i10__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5__namespace.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i4__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4__namespace.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i9__namespace.ThyResizableDirective, selector: "[thyResizable]", inputs: ["thyBounds", "thyMaxHeight", "thyMaxWidth", "thyMinHeight", "thyMinWidth", "thyGridColumnCount", "thyMaxColumn", "thyMinColumn", "thyLockAspectRatio", "thyPreview", "thyDisabled"], outputs: ["thyResize", "thyResizeEnd", "thyResizeStart"] }, { type: i10__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i10__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
7572
7568
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheCodeComponent, decorators: [{
7573
7569
  type: i0.Component,
@@ -7577,9 +7573,9 @@
7577
7573
  changeDetection: i0.ChangeDetectionStrategy.OnPush
7578
7574
  }]
7579
7575
  }], ctorParameters: function () {
7580
- return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }, { type: i1__namespace$4.ThyNotifyService }, { type: TheContextService }, { type: i0__namespace.NgZone }, { type: TheCodeConfig, decorators: [{
7576
+ return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }, { type: i1__namespace$4.ThyNotifyService }, { type: TheContextService }, { type: i0__namespace.NgZone }, { type: TheModeConfig, decorators: [{
7581
7577
  type: i0.Inject,
7582
- args: [THE_CODE_MODE_TOKEN]
7578
+ args: [THE_MODE_TOKEN]
7583
7579
  }] }];
7584
7580
  }, propDecorators: { codemirror: [{
7585
7581
  type: i0.ViewChild,
@@ -9794,19 +9790,41 @@
9794
9790
  };
9795
9791
  TheTableComponent.prototype.ngAfterViewInit = function () {
9796
9792
  var _this = this;
9797
- this.ngZone.onStable.pipe(operators.take(1)).subscribe(function () {
9798
- var blockCardElement = _this.nativeElement.closest('slate-block-card');
9799
- if (blockCardElement) {
9800
- blockCardElement.classList.add("slate-block-card-" + _this.element.type);
9801
- }
9802
- _this.tableStore.initEditor(_this.editor);
9803
- _this.subscribeCellsChange();
9804
- _this.subscribeCellPositionChange();
9805
- _this.listenTableContextMenuEvent();
9806
- _this.useTableWrapperWidth();
9807
- // need view render complete
9808
- _this.useRowControls();
9809
- });
9793
+ this.ngZone.onStable.pipe(operators.take(1)).subscribe(function () { return __awaiter(_this, void 0, void 0, function () {
9794
+ var _a, blockCardElement, loadImageDone;
9795
+ var _this = this;
9796
+ return __generator(this, function (_c) {
9797
+ switch (_c.label) {
9798
+ case 0:
9799
+ blockCardElement = this.nativeElement.closest('slate-block-card');
9800
+ if (blockCardElement) {
9801
+ blockCardElement.classList.add("slate-block-card-" + this.element.type);
9802
+ }
9803
+ this.tableStore.initEditor(this.editor);
9804
+ this.subscribeCellsChange();
9805
+ this.subscribeCellPositionChange();
9806
+ this.listenTableContextMenuEvent();
9807
+ this.useTableWrapperWidth();
9808
+ if (!((_a = this.element.options) === null || _a === void 0 ? void 0 : _a.numberedColumn)) return [3 /*break*/, 2];
9809
+ return [4 /*yield*/, this.resolveImage()];
9810
+ case 1:
9811
+ loadImageDone = _c.sent();
9812
+ // 等待序号列表格内图片加载完成后再去渲染表格行高度
9813
+ if (loadImageDone) {
9814
+ setTimeout(function () {
9815
+ _this.useRowControls();
9816
+ _this.cdr.detectChanges();
9817
+ }, 200); // 200ms:通过通知打开页面动画加载时间
9818
+ }
9819
+ return [3 /*break*/, 3];
9820
+ case 2:
9821
+ this.useRowControls();
9822
+ this.cdr.markForCheck();
9823
+ _c.label = 3;
9824
+ case 3: return [2 /*return*/];
9825
+ }
9826
+ });
9827
+ }); });
9810
9828
  };
9811
9829
  TheTableComponent.prototype.subscribeCellPositionChange = function () {
9812
9830
  var _this = this;
@@ -9841,7 +9859,6 @@
9841
9859
  var _a;
9842
9860
  if (this.selection || ((_a = this.element.options) === null || _a === void 0 ? void 0 : _a.numberedColumn)) {
9843
9861
  this.rowControls = this.calculateRowControls();
9844
- this.cdr.markForCheck();
9845
9862
  }
9846
9863
  };
9847
9864
  TheTableComponent.prototype.detectChanges = function () {
@@ -9945,6 +9962,24 @@
9945
9962
  });
9946
9963
  return belowRowlHeight;
9947
9964
  };
9965
+ TheTableComponent.prototype.resolveImage = function () {
9966
+ var imageElements = this.nativeElement.querySelectorAll('img');
9967
+ if (imageElements.length) {
9968
+ var imageResolves_1 = [];
9969
+ imageElements.forEach(function (item) {
9970
+ var image = new Image();
9971
+ var imageLoad = new Promise(function (resolve) {
9972
+ image.onload = function () {
9973
+ resolve(true);
9974
+ };
9975
+ image.src = item.getAttribute('src');
9976
+ });
9977
+ imageResolves_1.push(imageLoad);
9978
+ });
9979
+ return Promise.all(imageResolves_1);
9980
+ }
9981
+ return Promise.resolve(true);
9982
+ };
9948
9983
  TheTableComponent.prototype.getColControls = function () {
9949
9984
  var _a, _b;
9950
9985
  this.colControls = ((_b = (_a = this.element) === null || _a === void 0 ? void 0 : _a.children[0]) === null || _b === void 0 ? void 0 : _b.children) || [];
@@ -12649,78 +12684,6 @@
12649
12684
  args: ['class.disabled']
12650
12685
  }] } });
12651
12686
 
12652
- var onKeydownTextIndent = function (editor, event, kinds, textIndentDisabled) {
12653
- var selection = editor.selection;
12654
- var isExpanded = slate.Range.isExpanded(selection);
12655
- var nodes = Array.from(slate.Editor.nodes(editor, {
12656
- mode: 'highest',
12657
- match: function (node) { return slate.Element.isElement(node) && kinds.includes(node.type); }
12658
- }));
12659
- var _a = __read(nodes, 1), startBlock = _a[0];
12660
- if (!startBlock) {
12661
- return false;
12662
- }
12663
- var _b = __read(startBlock, 2), block = _b[0], path = _b[1];
12664
- var isStart = slate.Editor.isStart(editor, selection.anchor, path);
12665
- if (isHotkey.isKeyHotkey('Tab', event)) {
12666
- event.preventDefault();
12667
- if (startBlock && (isExpanded || isStart)) {
12668
- if (!editor.isVoid(block)) {
12669
- var textIndent = block.textIndent, type = block.type;
12670
- // do not apply first-line indentation for lists
12671
- if (!textIndent && !textIndentDisabled.includes(type)) {
12672
- IndentEditor.setTextIndent(editor, kinds, 2);
12673
- return true;
12674
- }
12675
- else {
12676
- IndentEditor.setIndent(editor);
12677
- return true;
12678
- }
12679
- }
12680
- }
12681
- else {
12682
- editor.insertText(TAB_SPACE);
12683
- return true;
12684
- }
12685
- }
12686
- if (isHotkey.isKeyHotkey('shift+Tab', event)) {
12687
- if (startBlock && (isExpanded || isStart)) {
12688
- if (!editor.isVoid(block)) {
12689
- return IndentEditor.cancelTextIntent(editor, event, block, kinds);
12690
- }
12691
- }
12692
- }
12693
- if (selection && slate.Range.isCollapsed(selection) && i1.hotkeys.isDeleteBackward(event)) {
12694
- if (startBlock && isStart) {
12695
- return IndentEditor.cancelTextIntent(editor, event, block, kinds);
12696
- }
12697
- }
12698
- return false;
12699
- };
12700
-
12701
- var withIndent = function (kinds) { return function (editor) {
12702
- var onKeydown = editor.onKeydown;
12703
- editor.onKeydown = function (event) {
12704
- var _a, _b, _c, _d;
12705
- var indentTypes = kinds;
12706
- var disableIndentTypes = [exports.ElementKinds.bulletedList, exports.ElementKinds.numberedList, exports.ElementKinds.checkItem];
12707
- if ((_b = (_a = editor.extraIndentOptions) === null || _a === void 0 ? void 0 : _a.indentTypes) === null || _b === void 0 ? void 0 : _b.length) {
12708
- indentTypes = mergIndentTypes(kinds, editor.extraIndentOptions.indentTypes);
12709
- }
12710
- if ((_d = (_c = editor.extraIndentOptions) === null || _c === void 0 ? void 0 : _c.disabledIndentTypes) === null || _d === void 0 ? void 0 : _d.length) {
12711
- disableIndentTypes = mergIndentTypes(disableIndentTypes, editor.extraIndentOptions.disabledIndentTypes);
12712
- }
12713
- var isContinue = !onKeydownTextIndent(editor, event, indentTypes, disableIndentTypes);
12714
- if (isContinue) {
12715
- onKeydown(event);
12716
- }
12717
- };
12718
- return editor;
12719
- }; };
12720
- var mergIndentTypes = function (defaultTypes, indentTypes) {
12721
- return Array.from(new Set(__spreadArray(__spreadArray([], __read(defaultTypes)), __read(indentTypes))));
12722
- };
12723
-
12724
12687
  var MaxIndent = 11;
12725
12688
  var includesIndentTypes = __spreadArray([
12726
12689
  exports.ElementKinds.checkItem,
@@ -12728,15 +12691,11 @@
12728
12691
  exports.ElementKinds.bulletedList,
12729
12692
  exports.ElementKinds.paragraph
12730
12693
  ], __read(HEADING_TYPES));
12731
- var getIndentTypes = function (editor) {
12732
- var indentTypes = editor.extraIndentOptions ? editor.extraIndentOptions.indentTypes : [];
12733
- return mergIndentTypes(includesIndentTypes, indentTypes);
12734
- };
12735
12694
  var IndentEditor = {
12736
12695
  setIndent: function (editor) {
12737
12696
  var nodes = Array.from(slate.Editor.nodes(editor, {
12738
12697
  mode: 'highest',
12739
- match: function (n) { return slate.Element.isElement(n) && getIndentTypes(editor).includes(n.type); }
12698
+ match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
12740
12699
  }));
12741
12700
  var _a = __read(nodes, 1), startBlock = _a[0];
12742
12701
  if (startBlock) {
@@ -12746,7 +12705,7 @@
12746
12705
  if (indent <= MaxIndent) {
12747
12706
  slate.Transforms.setNodes(editor, { indent: indent }, {
12748
12707
  mode: 'highest',
12749
- match: function (n) { return slate.Element.isElement(n) && getIndentTypes(editor).includes(n.type); }
12708
+ match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
12750
12709
  });
12751
12710
  }
12752
12711
  }
@@ -12754,7 +12713,7 @@
12754
12713
  cancelIndent: function (editor) {
12755
12714
  var nodes = Array.from(slate.Editor.nodes(editor, {
12756
12715
  mode: 'highest',
12757
- match: function (n) { return slate.Element.isElement(n) && getIndentTypes(editor).includes(n.type); }
12716
+ match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
12758
12717
  }));
12759
12718
  var _a = __read(nodes, 1), startBlock = _a[0];
12760
12719
  if (startBlock) {
@@ -12762,7 +12721,7 @@
12762
12721
  indent = indent === 1 ? null : (indent -= 1);
12763
12722
  slate.Transforms.setNodes(editor, { indent: indent }, {
12764
12723
  mode: 'highest',
12765
- match: function (n) { return slate.Element.isElement(n) && getIndentTypes(editor).includes(n.type); }
12724
+ match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
12766
12725
  });
12767
12726
  }
12768
12727
  },
@@ -12795,7 +12754,7 @@
12795
12754
  isDisabled: function (editor) {
12796
12755
  if (editor.selection) {
12797
12756
  var anchorBlock$1 = anchorBlock(editor);
12798
- return anchorBlock$1 && !getIndentTypes(editor).includes(anchorBlock$1 === null || anchorBlock$1 === void 0 ? void 0 : anchorBlock$1.type);
12757
+ return anchorBlock$1 && !includesIndentTypes.includes(anchorBlock$1 === null || anchorBlock$1 === void 0 ? void 0 : anchorBlock$1.type);
12799
12758
  }
12800
12759
  return false;
12801
12760
  }
@@ -12825,6 +12784,71 @@
12825
12784
  }
12826
12785
  ];
12827
12786
 
12787
+ var onKeydownTextIndent = function (editor, event, kinds, textIndentDisabled) {
12788
+ var selection = editor.selection;
12789
+ var isExpanded = slate.Range.isExpanded(selection);
12790
+ var nodes = Array.from(slate.Editor.nodes(editor, {
12791
+ mode: 'highest',
12792
+ match: function (node) { return slate.Element.isElement(node) && kinds.includes(node.type); }
12793
+ }));
12794
+ var _a = __read(nodes, 1), startBlock = _a[0];
12795
+ if (!startBlock) {
12796
+ return false;
12797
+ }
12798
+ var _b = __read(startBlock, 2), block = _b[0], path = _b[1];
12799
+ var isStart = slate.Editor.isStart(editor, selection.anchor, path);
12800
+ if (isHotkey.isKeyHotkey('Tab', event)) {
12801
+ event.preventDefault();
12802
+ if (startBlock && (isExpanded || isStart)) {
12803
+ if (!editor.isVoid(block)) {
12804
+ var textIndent = block.textIndent, type = block.type;
12805
+ // do not apply first-line indentation for lists
12806
+ if (!textIndent && !textIndentDisabled.includes(type)) {
12807
+ IndentEditor.setTextIndent(editor, kinds, 2);
12808
+ return true;
12809
+ }
12810
+ else {
12811
+ IndentEditor.setIndent(editor);
12812
+ return true;
12813
+ }
12814
+ }
12815
+ }
12816
+ else {
12817
+ editor.insertText(TAB_SPACE);
12818
+ return true;
12819
+ }
12820
+ }
12821
+ if (isHotkey.isKeyHotkey('shift+Tab', event)) {
12822
+ if (startBlock && (isExpanded || isStart)) {
12823
+ if (!editor.isVoid(block)) {
12824
+ return IndentEditor.cancelTextIntent(editor, event, block, kinds);
12825
+ }
12826
+ }
12827
+ }
12828
+ if (selection && slate.Range.isCollapsed(selection) && i1.hotkeys.isDeleteBackward(event)) {
12829
+ if (startBlock && isStart) {
12830
+ return IndentEditor.cancelTextIntent(editor, event, block, kinds);
12831
+ }
12832
+ }
12833
+ return false;
12834
+ };
12835
+
12836
+ var withIndent = function (kinds) { return function (editor) {
12837
+ var onKeydown = editor.onKeydown;
12838
+ editor.onKeydown = function (event) {
12839
+ var indentTypes = kinds;
12840
+ var disableIndentTypes = [exports.ElementKinds.bulletedList, exports.ElementKinds.numberedList, exports.ElementKinds.checkItem];
12841
+ var isContinue = !onKeydownTextIndent(editor, event, indentTypes, disableIndentTypes);
12842
+ if (isContinue) {
12843
+ onKeydown(event);
12844
+ }
12845
+ };
12846
+ return editor;
12847
+ }; };
12848
+ var mergIndentTypes = function (defaultTypes, indentTypes) {
12849
+ return Array.from(new Set(__spreadArray(__spreadArray([], __read(defaultTypes)), __read(indentTypes))));
12850
+ };
12851
+
12828
12852
  var internalPlugins = [
12829
12853
  withTheHistory,
12830
12854
  withAutoInsertData(),
@@ -13800,13 +13824,12 @@
13800
13824
  };
13801
13825
  TheEditorComponent.prototype.initialize = function () {
13802
13826
  var _this = this;
13803
- var _a, _b, _c, _d;
13827
+ var _a, _b, _c;
13804
13828
  this.editor = withTheEditor(this.thePlugins, slateHistory.withHistory(i1.withAngular(slate.createEditor(), CLIPBOARD_FORMAT_KEY)));
13805
13829
  this.generateDecorate();
13806
13830
  this.editor.disabled = (_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.disabled;
13807
13831
  this.editor.extraElementOptions = (_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.extraElementOptions;
13808
13832
  this.editor.extraAutoFormatRules = (_c = this.theOptions) === null || _c === void 0 ? void 0 : _c.extraAutoFormatRules;
13809
- this.editor.extraIndentOptions = (_d = this.theOptions) === null || _d === void 0 ? void 0 : _d.extraIndentOptions;
13810
13833
  this.editor.options = this.theOptions;
13811
13834
  setEditorUUID(this.editor, idCreator());
13812
13835
  this.theContextService.initialize({
@@ -13940,30 +13963,24 @@
13940
13963
  };
13941
13964
  TheEditorComponent.prototype.mousedown = function (event) {
13942
13965
  var editableElement = i1.AngularEditor.toDOMNode(this.editor, this.editor);
13943
- if (event.target === editableElement) {
13944
- var rectEditable = editableElement.getBoundingClientRect();
13966
+ var rectEditable = editableElement.getBoundingClientRect();
13967
+ var absoluteElement = document.elementFromPoint(event.x, event.y);
13968
+ if (!editableElement.isEqualNode(absoluteElement)) {
13969
+ var blockCardElement = absoluteElement.querySelector('.slate-block-card');
13970
+ if (!blockCardElement)
13971
+ return;
13972
+ }
13973
+ var paddingRight = window.getComputedStyle(editableElement, null).paddingRight;
13974
+ var paddingRightPixels = coercePixelsFromCssValue(paddingRight);
13975
+ var fakeRightX = rectEditable.right - paddingRightPixels - 50;
13976
+ var relativeElement = document.elementFromPoint(fakeRightX, event.y);
13977
+ var relativeBlockCardElement = relativeElement.closest('.slate-block-card');
13978
+ if (relativeBlockCardElement) {
13945
13979
  var centerX = rectEditable.x + rectEditable.width / 2;
13946
- var _g = window.getComputedStyle(editableElement, null), paddingLeft = _g.paddingLeft, paddingRight = _g.paddingRight;
13947
- var paddingLeftPixels = coercePixelsFromCssValue(paddingLeft);
13948
- var paddingRightPixels = coercePixelsFromCssValue(paddingRight);
13949
- var fakeLeftX = rectEditable.x + paddingLeftPixels + 50;
13950
- var fakeRightX = rectEditable.right - paddingRightPixels - 50;
13951
- var relativeElement = document.elementFromPoint(fakeLeftX, event.y);
13952
- var relativeBlockCardElement = relativeElement.closest('.slate-block-card');
13953
- if (!relativeBlockCardElement) {
13954
- relativeElement = document.elementFromPoint(fakeRightX, event.y);
13955
- relativeBlockCardElement = relativeElement.closest('.slate-block-card');
13956
- }
13957
- if (relativeBlockCardElement) {
13958
- var blockCardEntry = i1.AngularEditor.toSlateCardEntry(this.editor, relativeBlockCardElement.firstElementChild);
13959
- if (blockCardEntry && blockCardEntry[1]) {
13960
- var rootNodePath = blockCardEntry[1].slice(0, 1);
13961
- var rootNode = getNode(this.editor, rootNodePath);
13962
- if (this.editor.isBlockCard(rootNode)) {
13963
- event.preventDefault();
13964
- i1.AngularEditor.moveBlockCard(this.editor, rootNode, { direction: event.x < centerX ? 'left' : 'right' });
13965
- }
13966
- }
13980
+ var blockCardEntry = i1.AngularEditor.toSlateCardEntry(this.editor, relativeBlockCardElement.firstElementChild);
13981
+ if (blockCardEntry && this.editor.isBlockCard(blockCardEntry[0])) {
13982
+ event.preventDefault();
13983
+ i1.AngularEditor.moveBlockCard(this.editor, blockCardEntry[0], { direction: event.x < centerX ? 'left' : 'right' });
13967
13984
  }
13968
13985
  }
13969
13986
  };
@@ -14350,7 +14367,7 @@
14350
14367
  provide: TheToolbarGroupToken,
14351
14368
  useValue: TheToolbarGroupComponent
14352
14369
  },
14353
- THE_CODE_MODE_PROVIDER
14370
+ THE_MODE_PROVIDER
14354
14371
  ], imports: [__spreadArray(__spreadArray([i10.CommonModule, i1.SlateModule, i4.FormsModule], __read(TETHYS)), [i8.CodemirrorModule, TheColumnSizeModule])] });
14355
14372
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheEditorModule, decorators: [{
14356
14373
  type: i0.NgModule,
@@ -14364,7 +14381,7 @@
14364
14381
  provide: TheToolbarGroupToken,
14365
14382
  useValue: TheToolbarGroupComponent
14366
14383
  },
14367
- THE_CODE_MODE_PROVIDER
14384
+ THE_MODE_PROVIDER
14368
14385
  ]
14369
14386
  }]
14370
14387
  }] });
@@ -14389,7 +14406,6 @@
14389
14406
  exports.CONTAINER_BLOCKS = CONTAINER_BLOCKS;
14390
14407
  exports.CONTROL_KEY = CONTROL_KEY;
14391
14408
  exports.CodeEditor = CodeEditor;
14392
- exports.CodeMode = CodeMode;
14393
14409
  exports.ColorEditor = ColorEditor;
14394
14410
  exports.DEFAULT_LANGUAGE = DEFAULT_LANGUAGE;
14395
14411
  exports.DEFAULT_SCROLL_CONTAINER = DEFAULT_SCROLL_CONTAINER;
@@ -14404,6 +14420,7 @@
14404
14420
  exports.HrEditor = HrEditor;
14405
14421
  exports.IS_MAC = IS_MAC;
14406
14422
  exports.ImageEditor = ImageEditor;
14423
+ exports.IndentEditor = IndentEditor;
14407
14424
  exports.LINK_DEFAULT_TEXT = LINK_DEFAULT_TEXT;
14408
14425
  exports.LIST_BLOCK_TYPES = LIST_BLOCK_TYPES;
14409
14426
  exports.LinkEditor = LinkEditor;
@@ -14417,22 +14434,23 @@
14417
14434
  exports.QuickInsertEditor = QuickInsertEditor;
14418
14435
  exports.STANDARD_HEADING_TYPES = STANDARD_HEADING_TYPES;
14419
14436
  exports.TAB_SPACE = TAB_SPACE;
14420
- exports.THE_CODE_MODE_PROVIDER = THE_CODE_MODE_PROVIDER;
14421
- exports.THE_CODE_MODE_TOKEN = THE_CODE_MODE_TOKEN;
14422
14437
  exports.THE_EDITOR_CONVERSION_HINT_REF = THE_EDITOR_CONVERSION_HINT_REF;
14423
14438
  exports.THE_EDITOR_QUICK_TOOLBAR_REF = THE_EDITOR_QUICK_TOOLBAR_REF;
14424
14439
  exports.THE_EDITOR_UUID = THE_EDITOR_UUID;
14425
14440
  exports.THE_INLINE_TOOLBAR_TYPES = THE_INLINE_TOOLBAR_TYPES;
14441
+ exports.THE_MODE_PROVIDER = THE_MODE_PROVIDER;
14442
+ exports.THE_MODE_TOKEN = THE_MODE_TOKEN;
14426
14443
  exports.THE_UPLOAD_SERVICE_TOKEN = THE_UPLOAD_SERVICE_TOKEN;
14427
14444
  exports.TableEditor = TableEditor;
14428
14445
  exports.TheBaseElementComponent = TheBaseElementComponent;
14429
- exports.TheCodeConfig = TheCodeConfig;
14430
14446
  exports.TheContextService = TheContextService;
14431
14447
  exports.TheDefaultElementComponent = TheDefaultElementComponent;
14432
14448
  exports.TheEditor = TheEditor;
14433
14449
  exports.TheEditorComponent = TheEditorComponent;
14434
14450
  exports.TheEditorModule = TheEditorModule;
14435
14451
  exports.TheImageComponent = TheImageComponent;
14452
+ exports.TheIndentToolbarComponent = TheIndentToolbarComponent;
14453
+ exports.TheModeConfig = TheModeConfig;
14436
14454
  exports.TheQueries = index$1;
14437
14455
  exports.TheToolbarBaseItemComponent = TheToolbarBaseItemComponent;
14438
14456
  exports.TheToolbarComponent = TheToolbarComponent;
@@ -14459,6 +14477,7 @@
14459
14477
  exports.getToolbarClass = getToolbarClass;
14460
14478
  exports.htmlToTheia = htmlToTheia;
14461
14479
  exports.inValidTypes = inValidTypes;
14480
+ exports.includesIndentTypes = includesIndentTypes;
14462
14481
  exports.isCleanEmptyParagraph = isCleanEmptyParagraph;
14463
14482
  exports.isPureEmptyParagraph = isPureEmptyParagraph;
14464
14483
  exports.mergeElementOptions = mergeElementOptions;