@worktile/theia 2.4.4 → 2.4.7

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 (32) hide show
  1. package/bundles/worktile-theia.umd.js +190 -139
  2. package/bundles/worktile-theia.umd.js.map +1 -1
  3. package/esm2015/editor.component.js +2 -3
  4. package/esm2015/interfaces/editor.js +1 -1
  5. package/esm2015/plugins/indent/indent.editor.js +7 -12
  6. package/esm2015/plugins/indent/indent.plugin.js +1 -8
  7. package/esm2015/plugins/index.js +1 -1
  8. package/esm2015/plugins/public-api.js +3 -1
  9. package/esm2015/plugins/quick-insert/quick-insert.plugin.js +14 -4
  10. package/esm2015/plugins/table/components/table.component.js +37 -6
  11. package/esm2015/plugins/todo-item/todo-item.component.js +4 -3
  12. package/esm2015/queries/get-directly-parent.js +12 -0
  13. package/esm2015/queries/index.js +4 -2
  14. package/esm2015/queries/is-types-in-parent.js +16 -0
  15. package/esm2015/transforms/index.js +2 -3
  16. package/esm2015/transforms/insert-element-next.js +24 -3
  17. package/fesm2015/worktile-theia.js +171 -132
  18. package/fesm2015/worktile-theia.js.map +1 -1
  19. package/interfaces/editor.d.ts +1 -3
  20. package/package.json +1 -1
  21. package/plugins/indent/indent.editor.d.ts +1 -0
  22. package/plugins/public-api.d.ts +2 -0
  23. package/plugins/table/components/table.component.d.ts +1 -0
  24. package/plugins/table/components/table.component.scss +7 -2
  25. package/plugins/todo-item/todo-item.component.scss +1 -1
  26. package/queries/get-directly-parent.d.ts +2 -0
  27. package/queries/index.d.ts +3 -1
  28. package/queries/is-types-in-parent.d.ts +2 -0
  29. package/styles/editor.scss +3 -3
  30. package/transforms/index.d.ts +1 -2
  31. package/esm2015/transforms/insert-element-node.js +0 -36
  32. package/transforms/insert-element-node.d.ts +0 -2
@@ -1716,6 +1716,30 @@
1716
1716
  return !containerNode ? CONTAINER_BLOCKS : __spreadArray(__spreadArray([], __read(CONTAINER_BLOCKS)), [containerNode[0].type]);
1717
1717
  };
1718
1718
 
1719
+ var getDirectlyParent = function (editor) {
1720
+ var _a = __read(getBlockAbove(editor), 2), anchorPath = _a[1];
1721
+ if (!anchorPath)
1722
+ return;
1723
+ var parentEntry = getParent(editor, anchorPath);
1724
+ if (!parentEntry)
1725
+ return;
1726
+ return parentEntry;
1727
+ };
1728
+
1729
+ var isTypesInParent = function (editor, types) {
1730
+ if (!Array.isArray(types)) {
1731
+ types = [types];
1732
+ }
1733
+ var _a = __read(getBlockAbove(editor), 2), anchorPath = _a[1];
1734
+ if (!anchorPath)
1735
+ return false;
1736
+ var parentEntry = slate.Editor.above(editor, { match: function (n) { return types.includes(n.type); } });
1737
+ if (!parentEntry)
1738
+ return false;
1739
+ var _b = __read(parentEntry, 1), parentNode = _b[0];
1740
+ return types.includes(parentNode.type);
1741
+ };
1742
+
1719
1743
  var index$1 = /*#__PURE__*/Object.freeze({
1720
1744
  __proto__: null,
1721
1745
  getLastNode: getLastNode,
@@ -1743,6 +1767,7 @@
1743
1767
  getPlainText: getPlainText,
1744
1768
  getSelectionMarks: getSelectionMarks,
1745
1769
  getContainerBlocks: getContainerBlocks,
1770
+ getDirectlyParent: getDirectlyParent,
1746
1771
  isAncestor: isAncestor,
1747
1772
  isCollapsed: isCollapsed,
1748
1773
  isEmptyParagraph: isEmptyParagraph,
@@ -1765,6 +1790,7 @@
1765
1790
  isEmptyContent: isEmptyContent,
1766
1791
  isEmptyParagraphByPath: isEmptyParagraphByPath,
1767
1792
  isContainer: isContainer,
1793
+ isTypesInParent: isTypesInParent,
1768
1794
  anchorBlock: anchorBlock,
1769
1795
  anchorBlockEntry: anchorBlockEntry,
1770
1796
  anchorInlineEntry: anchorInlineEntry,
@@ -1776,11 +1802,32 @@
1776
1802
  });
1777
1803
 
1778
1804
  var insertElementNext = function (editor, node) {
1805
+ var _a;
1779
1806
  if (slate.Range.isExpanded(editor.selection)) {
1780
1807
  slate.Editor.deleteFragment(editor);
1781
1808
  }
1782
- var anchorBlockPath = anchorBlockEntry(editor)[1];
1783
- var isEmpty = isEmptyParagraph(editor);
1809
+ var allowContainerOperateTypes = ((_a = editor.options) === null || _a === void 0 ? void 0 : _a.allowContainerOperateTypes) || [];
1810
+ var isAllowContainerInsert = isTypesInParent(editor, allowContainerOperateTypes);
1811
+ var isBlockCardCursor$1 = isBlockCardCursor(editor);
1812
+ var containerBlocks = getContainerBlocks(editor);
1813
+ var isContainer = isNodeTypeIn(editor, containerBlocks, { at: editor.selection });
1814
+ var _b = __read(anchorBlockEntry(editor), 2), anchorBlock = _b[0], anchorBlockPath = _b[1];
1815
+ var isEmpty = slate.Editor.isEmpty(editor, anchorBlock);
1816
+ if (isAllowContainerInsert && isContainer && !isBlockCardCursor$1) {
1817
+ var _c = __read(slate.Editor.above(editor, {
1818
+ match: function (n) { return slate.Editor.isBlock(editor, n) && allowContainerOperateTypes.includes(n.type); },
1819
+ at: editor.selection
1820
+ }), 2), containerPath_1 = _c[1];
1821
+ slate.Editor.withoutNormalizing(editor, function () {
1822
+ var containerPathFirstPath = anchorBlockPath.slice(0, containerPath_1.length + 1);
1823
+ slate.Transforms.insertNodes(editor, node, { at: slate.Path.next(containerPathFirstPath) });
1824
+ slate.Transforms.select(editor, slate.Editor.start(editor, slate.Path.next(containerPathFirstPath)));
1825
+ if (isEmpty) {
1826
+ slate.Transforms.removeNodes(editor, { at: anchorBlockPath });
1827
+ }
1828
+ });
1829
+ return;
1830
+ }
1784
1831
  var nextPath = slate.Path.next([anchorBlockPath[0]]);
1785
1832
  slate.Transforms.insertNodes(editor, node, { at: nextPath });
1786
1833
  if (isEmpty && anchorBlockPath.length === 1) {
@@ -1995,40 +2042,6 @@
1995
2042
  return false;
1996
2043
  }
1997
2044
 
1998
- var insertElementNode = function (editor, node) {
1999
- if (slate.Range.isExpanded(editor.selection)) {
2000
- slate.Editor.deleteFragment(editor);
2001
- }
2002
- var isBlockCardCursor$1 = isBlockCardCursor(editor);
2003
- var containerBlocks = getContainerBlocks(editor);
2004
- var isContainer = isNodeTypeIn(editor, containerBlocks, { at: editor.selection });
2005
- var _a = __read(anchorBlockEntry(editor), 2), anchorBlock = _a[0], anchorBlockPath = _a[1];
2006
- var isEmpty = slate.Editor.isEmpty(editor, anchorBlock);
2007
- if (isContainer && !isBlockCardCursor$1) {
2008
- var _b = __read(slate.Editor.above(editor, {
2009
- match: function (n) { return slate.Editor.isBlock(editor, n) && containerBlocks.includes(n.type); },
2010
- at: editor.selection
2011
- }), 2), containerPath_1 = _b[1];
2012
- slate.Editor.withoutNormalizing(editor, function () {
2013
- var containerPathFirstPath = anchorBlockPath.slice(0, containerPath_1.length + 1);
2014
- slate.Transforms.insertNodes(editor, node, { at: slate.Path.next(containerPathFirstPath), select: true });
2015
- if (isEmpty) {
2016
- slate.Transforms.removeNodes(editor, { at: anchorBlockPath });
2017
- }
2018
- });
2019
- return;
2020
- }
2021
- var nextPath = slate.Path.next([anchorBlockPath[0]]);
2022
- slate.Transforms.insertNodes(editor, node, { at: nextPath });
2023
- if (isEmpty && anchorBlockPath.length === 1) {
2024
- slate.Transforms.delete(editor, { at: anchorBlockPath });
2025
- slate.Transforms.select(editor, slate.Editor.start(editor, anchorBlockPath));
2026
- }
2027
- else {
2028
- slate.Transforms.select(editor, slate.Editor.start(editor, nextPath));
2029
- }
2030
- };
2031
-
2032
2045
  var index = /*#__PURE__*/Object.freeze({
2033
2046
  __proto__: null,
2034
2047
  setMarks: setMarks,
@@ -2048,8 +2061,7 @@
2048
2061
  setEndSelection: setEndSelection,
2049
2062
  closeConversionHint: closeConversionHint,
2050
2063
  handleContinualDeleteBackward: handleContinualDeleteBackward,
2051
- handleContinualInsertBreak: handleContinualInsertBreak,
2052
- insertElementNode: insertElementNode
2064
+ handleContinualInsertBreak: handleContinualInsertBreak
2053
2065
  });
2054
2066
 
2055
2067
  var TheConversionHintComponent = /** @class */ (function () {
@@ -4087,6 +4099,7 @@
4087
4099
  _this.elementRef = elementRef;
4088
4100
  _this.cdr = cdr;
4089
4101
  _this.ctxService = ctxService;
4102
+ // 类名 the-temp-*: 临时解决因受portal影响样式问题,后期改回the-
4090
4103
  _this.checkItemClass = true;
4091
4104
  return _this;
4092
4105
  }
@@ -4115,7 +4128,7 @@
4115
4128
  return TheTodoItemComponent;
4116
4129
  }(TheBaseElementComponent));
4117
4130
  TheTodoItemComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheTodoItemComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }, { token: TheContextService }], target: i0__namespace.ɵɵFactoryTarget.Component });
4118
- TheTodoItemComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheTodoItemComponent, selector: "div[theTodoItem]", host: { properties: { "class.the-check-item": "this.checkItemClass", "attr.the-level": "this.level" } }, usesInheritance: true, ngImport: i0__namespace, template: "\n <span contenteditable=\"false\" class=\"todo-item-status\">\n <input #checkbox type=\"checkbox\" [checked]=\"element.checked\" (click)=\"onCheck(checkbox.checked)\" />\n </span>\n <span><slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children></span>\n ", isInline: true, components: [{ type: i1__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
4131
+ TheTodoItemComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheTodoItemComponent, selector: "div[theTodoItem]", host: { properties: { "class.the-temp-check-item": "this.checkItemClass", "attr.the-level": "this.level" } }, usesInheritance: true, ngImport: i0__namespace, template: "\n <span contenteditable=\"false\" class=\"todo-item-status\">\n <input #checkbox type=\"checkbox\" [checked]=\"element.checked\" (click)=\"onCheck(checkbox.checked)\" />\n </span>\n <span><slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children></span>\n ", isInline: true, components: [{ type: i1__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
4119
4132
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheTodoItemComponent, decorators: [{
4120
4133
  type: i0.Component,
4121
4134
  args: [{
@@ -4124,7 +4137,7 @@
4124
4137
  }]
4125
4138
  }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }, { type: TheContextService }]; }, propDecorators: { checkItemClass: [{
4126
4139
  type: i0.HostBinding,
4127
- args: ['class.the-check-item']
4140
+ args: ['class.the-temp-check-item']
4128
4141
  }], level: [{
4129
4142
  type: i0.HostBinding,
4130
4143
  args: ['attr.the-level']
@@ -9781,19 +9794,41 @@
9781
9794
  };
9782
9795
  TheTableComponent.prototype.ngAfterViewInit = function () {
9783
9796
  var _this = this;
9784
- this.ngZone.onStable.pipe(operators.take(1)).subscribe(function () {
9785
- var blockCardElement = _this.nativeElement.closest('slate-block-card');
9786
- if (blockCardElement) {
9787
- blockCardElement.classList.add("slate-block-card-" + _this.element.type);
9788
- }
9789
- _this.tableStore.initEditor(_this.editor);
9790
- _this.subscribeCellsChange();
9791
- _this.subscribeCellPositionChange();
9792
- _this.listenTableContextMenuEvent();
9793
- _this.useTableWrapperWidth();
9794
- // need view render complete
9795
- _this.useRowControls();
9796
- });
9797
+ this.ngZone.onStable.pipe(operators.take(1)).subscribe(function () { return __awaiter(_this, void 0, void 0, function () {
9798
+ var _a, blockCardElement, loadImageDone;
9799
+ var _this = this;
9800
+ return __generator(this, function (_c) {
9801
+ switch (_c.label) {
9802
+ case 0:
9803
+ blockCardElement = this.nativeElement.closest('slate-block-card');
9804
+ if (blockCardElement) {
9805
+ blockCardElement.classList.add("slate-block-card-" + this.element.type);
9806
+ }
9807
+ this.tableStore.initEditor(this.editor);
9808
+ this.subscribeCellsChange();
9809
+ this.subscribeCellPositionChange();
9810
+ this.listenTableContextMenuEvent();
9811
+ this.useTableWrapperWidth();
9812
+ if (!((_a = this.element.options) === null || _a === void 0 ? void 0 : _a.numberedColumn)) return [3 /*break*/, 2];
9813
+ return [4 /*yield*/, this.resolveImage()];
9814
+ case 1:
9815
+ loadImageDone = _c.sent();
9816
+ // 等待序号列表格内图片加载完成后再去渲染表格行高度
9817
+ if (loadImageDone) {
9818
+ setTimeout(function () {
9819
+ _this.useRowControls();
9820
+ _this.cdr.detectChanges();
9821
+ }, 200); // 200ms:通过通知打开页面动画加载时间
9822
+ }
9823
+ return [3 /*break*/, 3];
9824
+ case 2:
9825
+ this.useRowControls();
9826
+ this.cdr.markForCheck();
9827
+ _c.label = 3;
9828
+ case 3: return [2 /*return*/];
9829
+ }
9830
+ });
9831
+ }); });
9797
9832
  };
9798
9833
  TheTableComponent.prototype.subscribeCellPositionChange = function () {
9799
9834
  var _this = this;
@@ -9828,7 +9863,6 @@
9828
9863
  var _a;
9829
9864
  if (this.selection || ((_a = this.element.options) === null || _a === void 0 ? void 0 : _a.numberedColumn)) {
9830
9865
  this.rowControls = this.calculateRowControls();
9831
- this.cdr.markForCheck();
9832
9866
  }
9833
9867
  };
9834
9868
  TheTableComponent.prototype.detectChanges = function () {
@@ -9932,6 +9966,24 @@
9932
9966
  });
9933
9967
  return belowRowlHeight;
9934
9968
  };
9969
+ TheTableComponent.prototype.resolveImage = function () {
9970
+ var imageElements = this.nativeElement.querySelectorAll('img');
9971
+ if (imageElements.length) {
9972
+ var imageResolves_1 = [];
9973
+ imageElements.forEach(function (item) {
9974
+ var image = new Image();
9975
+ var imageLoad = new Promise(function (resolve) {
9976
+ image.onload = function () {
9977
+ resolve(true);
9978
+ };
9979
+ image.src = item.getAttribute('src');
9980
+ });
9981
+ imageResolves_1.push(imageLoad);
9982
+ });
9983
+ return Promise.all(imageResolves_1);
9984
+ }
9985
+ return Promise.resolve(true);
9986
+ };
9935
9987
  TheTableComponent.prototype.getColControls = function () {
9936
9988
  var _a, _b;
9937
9989
  this.colControls = ((_b = (_a = this.element) === null || _a === void 0 ? void 0 : _a.children[0]) === null || _b === void 0 ? void 0 : _b.children) || [];
@@ -12280,12 +12332,18 @@
12280
12332
  editor.onKeydown = function (event) {
12281
12333
  var _a;
12282
12334
  if (event.key === QUICK_TOOLBAR_HOTKEY) {
12283
- var types = __spreadArray([], __read((((_a = editor.options) === null || _a === void 0 ? void 0 : _a.triggerQuickToolbarTypes) || [])));
12335
+ var types = __spreadArray([], __read((((_a = editor.options) === null || _a === void 0 ? void 0 : _a.allowContainerOperateTypes) || [])));
12284
12336
  var _b = __read(getBlockAbove(editor), 1), block = _b[0];
12285
12337
  if (isPureEmptyParagraph(editor, block) && allowOpenQuickToolbar(editor, types)) {
12286
12338
  presseingQuickInsertHotkey = true;
12287
12339
  }
12288
12340
  }
12341
+ var quickToolbarRef = THE_EDITOR_QUICK_TOOLBAR_REF.get(editor);
12342
+ var isMoveUp = i1.hotkeys.isMoveUp(event);
12343
+ var isMoveDown = i1.hotkeys.isMoveDown(event);
12344
+ if (quickToolbarRef && (isMoveUp || isMoveDown)) {
12345
+ return;
12346
+ }
12289
12347
  onKeydown(event);
12290
12348
  };
12291
12349
  editor.deleteBackward = function (unit) {
@@ -12310,7 +12368,9 @@
12310
12368
  else {
12311
12369
  presseingQuickInsertHotkey = false;
12312
12370
  }
12313
- if (QuickInsertEditor.isOpenedToolbar(editor) && !isPureEmptyParagraph(editor, block) && slate.Node.string(block) !== QUICK_TOOLBAR_HOTKEY) {
12371
+ if (QuickInsertEditor.isOpenedToolbar(editor) &&
12372
+ !isPureEmptyParagraph(editor, block) &&
12373
+ slate.Node.string(block) !== QUICK_TOOLBAR_HOTKEY) {
12314
12374
  QuickInsertEditor.closeQuickInsertToolbar(editor);
12315
12375
  }
12316
12376
  }
@@ -12628,78 +12688,6 @@
12628
12688
  args: ['class.disabled']
12629
12689
  }] } });
12630
12690
 
12631
- var onKeydownTextIndent = function (editor, event, kinds, textIndentDisabled) {
12632
- var selection = editor.selection;
12633
- var isExpanded = slate.Range.isExpanded(selection);
12634
- var nodes = Array.from(slate.Editor.nodes(editor, {
12635
- mode: 'highest',
12636
- match: function (node) { return slate.Element.isElement(node) && kinds.includes(node.type); }
12637
- }));
12638
- var _a = __read(nodes, 1), startBlock = _a[0];
12639
- if (!startBlock) {
12640
- return false;
12641
- }
12642
- var _b = __read(startBlock, 2), block = _b[0], path = _b[1];
12643
- var isStart = slate.Editor.isStart(editor, selection.anchor, path);
12644
- if (isHotkey.isKeyHotkey('Tab', event)) {
12645
- event.preventDefault();
12646
- if (startBlock && (isExpanded || isStart)) {
12647
- if (!editor.isVoid(block)) {
12648
- var textIndent = block.textIndent, type = block.type;
12649
- // do not apply first-line indentation for lists
12650
- if (!textIndent && !textIndentDisabled.includes(type)) {
12651
- IndentEditor.setTextIndent(editor, kinds, 2);
12652
- return true;
12653
- }
12654
- else {
12655
- IndentEditor.setIndent(editor);
12656
- return true;
12657
- }
12658
- }
12659
- }
12660
- else {
12661
- editor.insertText(TAB_SPACE);
12662
- return true;
12663
- }
12664
- }
12665
- if (isHotkey.isKeyHotkey('shift+Tab', event)) {
12666
- if (startBlock && (isExpanded || isStart)) {
12667
- if (!editor.isVoid(block)) {
12668
- return IndentEditor.cancelTextIntent(editor, event, block, kinds);
12669
- }
12670
- }
12671
- }
12672
- if (selection && slate.Range.isCollapsed(selection) && i1.hotkeys.isDeleteBackward(event)) {
12673
- if (startBlock && isStart) {
12674
- return IndentEditor.cancelTextIntent(editor, event, block, kinds);
12675
- }
12676
- }
12677
- return false;
12678
- };
12679
-
12680
- var withIndent = function (kinds) { return function (editor) {
12681
- var onKeydown = editor.onKeydown;
12682
- editor.onKeydown = function (event) {
12683
- var _a, _b, _c, _d;
12684
- var indentTypes = kinds;
12685
- var disableIndentTypes = [exports.ElementKinds.bulletedList, exports.ElementKinds.numberedList, exports.ElementKinds.checkItem];
12686
- if ((_b = (_a = editor.extraIndentOptions) === null || _a === void 0 ? void 0 : _a.indentTypes) === null || _b === void 0 ? void 0 : _b.length) {
12687
- indentTypes = mergIndentTypes(kinds, editor.extraIndentOptions.indentTypes);
12688
- }
12689
- if ((_d = (_c = editor.extraIndentOptions) === null || _c === void 0 ? void 0 : _c.disabledIndentTypes) === null || _d === void 0 ? void 0 : _d.length) {
12690
- disableIndentTypes = mergIndentTypes(disableIndentTypes, editor.extraIndentOptions.disabledIndentTypes);
12691
- }
12692
- var isContinue = !onKeydownTextIndent(editor, event, indentTypes, disableIndentTypes);
12693
- if (isContinue) {
12694
- onKeydown(event);
12695
- }
12696
- };
12697
- return editor;
12698
- }; };
12699
- var mergIndentTypes = function (defaultTypes, indentTypes) {
12700
- return Array.from(new Set(__spreadArray(__spreadArray([], __read(defaultTypes)), __read(indentTypes))));
12701
- };
12702
-
12703
12691
  var MaxIndent = 11;
12704
12692
  var includesIndentTypes = __spreadArray([
12705
12693
  exports.ElementKinds.checkItem,
@@ -12707,15 +12695,11 @@
12707
12695
  exports.ElementKinds.bulletedList,
12708
12696
  exports.ElementKinds.paragraph
12709
12697
  ], __read(HEADING_TYPES));
12710
- var getIndentTypes = function (editor) {
12711
- var indentTypes = editor.extraIndentOptions ? editor.extraIndentOptions.indentTypes : [];
12712
- return mergIndentTypes(includesIndentTypes, indentTypes);
12713
- };
12714
12698
  var IndentEditor = {
12715
12699
  setIndent: function (editor) {
12716
12700
  var nodes = Array.from(slate.Editor.nodes(editor, {
12717
12701
  mode: 'highest',
12718
- match: function (n) { return slate.Element.isElement(n) && getIndentTypes(editor).includes(n.type); }
12702
+ match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
12719
12703
  }));
12720
12704
  var _a = __read(nodes, 1), startBlock = _a[0];
12721
12705
  if (startBlock) {
@@ -12725,7 +12709,7 @@
12725
12709
  if (indent <= MaxIndent) {
12726
12710
  slate.Transforms.setNodes(editor, { indent: indent }, {
12727
12711
  mode: 'highest',
12728
- match: function (n) { return slate.Element.isElement(n) && getIndentTypes(editor).includes(n.type); }
12712
+ match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
12729
12713
  });
12730
12714
  }
12731
12715
  }
@@ -12733,7 +12717,7 @@
12733
12717
  cancelIndent: function (editor) {
12734
12718
  var nodes = Array.from(slate.Editor.nodes(editor, {
12735
12719
  mode: 'highest',
12736
- match: function (n) { return slate.Element.isElement(n) && getIndentTypes(editor).includes(n.type); }
12720
+ match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
12737
12721
  }));
12738
12722
  var _a = __read(nodes, 1), startBlock = _a[0];
12739
12723
  if (startBlock) {
@@ -12741,7 +12725,7 @@
12741
12725
  indent = indent === 1 ? null : (indent -= 1);
12742
12726
  slate.Transforms.setNodes(editor, { indent: indent }, {
12743
12727
  mode: 'highest',
12744
- match: function (n) { return slate.Element.isElement(n) && getIndentTypes(editor).includes(n.type); }
12728
+ match: function (n) { return slate.Element.isElement(n) && includesIndentTypes.includes(n.type); }
12745
12729
  });
12746
12730
  }
12747
12731
  },
@@ -12774,7 +12758,7 @@
12774
12758
  isDisabled: function (editor) {
12775
12759
  if (editor.selection) {
12776
12760
  var anchorBlock$1 = anchorBlock(editor);
12777
- return anchorBlock$1 && !getIndentTypes(editor).includes(anchorBlock$1 === null || anchorBlock$1 === void 0 ? void 0 : anchorBlock$1.type);
12761
+ return anchorBlock$1 && !includesIndentTypes.includes(anchorBlock$1 === null || anchorBlock$1 === void 0 ? void 0 : anchorBlock$1.type);
12778
12762
  }
12779
12763
  return false;
12780
12764
  }
@@ -12804,6 +12788,71 @@
12804
12788
  }
12805
12789
  ];
12806
12790
 
12791
+ var onKeydownTextIndent = function (editor, event, kinds, textIndentDisabled) {
12792
+ var selection = editor.selection;
12793
+ var isExpanded = slate.Range.isExpanded(selection);
12794
+ var nodes = Array.from(slate.Editor.nodes(editor, {
12795
+ mode: 'highest',
12796
+ match: function (node) { return slate.Element.isElement(node) && kinds.includes(node.type); }
12797
+ }));
12798
+ var _a = __read(nodes, 1), startBlock = _a[0];
12799
+ if (!startBlock) {
12800
+ return false;
12801
+ }
12802
+ var _b = __read(startBlock, 2), block = _b[0], path = _b[1];
12803
+ var isStart = slate.Editor.isStart(editor, selection.anchor, path);
12804
+ if (isHotkey.isKeyHotkey('Tab', event)) {
12805
+ event.preventDefault();
12806
+ if (startBlock && (isExpanded || isStart)) {
12807
+ if (!editor.isVoid(block)) {
12808
+ var textIndent = block.textIndent, type = block.type;
12809
+ // do not apply first-line indentation for lists
12810
+ if (!textIndent && !textIndentDisabled.includes(type)) {
12811
+ IndentEditor.setTextIndent(editor, kinds, 2);
12812
+ return true;
12813
+ }
12814
+ else {
12815
+ IndentEditor.setIndent(editor);
12816
+ return true;
12817
+ }
12818
+ }
12819
+ }
12820
+ else {
12821
+ editor.insertText(TAB_SPACE);
12822
+ return true;
12823
+ }
12824
+ }
12825
+ if (isHotkey.isKeyHotkey('shift+Tab', event)) {
12826
+ if (startBlock && (isExpanded || isStart)) {
12827
+ if (!editor.isVoid(block)) {
12828
+ return IndentEditor.cancelTextIntent(editor, event, block, kinds);
12829
+ }
12830
+ }
12831
+ }
12832
+ if (selection && slate.Range.isCollapsed(selection) && i1.hotkeys.isDeleteBackward(event)) {
12833
+ if (startBlock && isStart) {
12834
+ return IndentEditor.cancelTextIntent(editor, event, block, kinds);
12835
+ }
12836
+ }
12837
+ return false;
12838
+ };
12839
+
12840
+ var withIndent = function (kinds) { return function (editor) {
12841
+ var onKeydown = editor.onKeydown;
12842
+ editor.onKeydown = function (event) {
12843
+ var indentTypes = kinds;
12844
+ var disableIndentTypes = [exports.ElementKinds.bulletedList, exports.ElementKinds.numberedList, exports.ElementKinds.checkItem];
12845
+ var isContinue = !onKeydownTextIndent(editor, event, indentTypes, disableIndentTypes);
12846
+ if (isContinue) {
12847
+ onKeydown(event);
12848
+ }
12849
+ };
12850
+ return editor;
12851
+ }; };
12852
+ var mergIndentTypes = function (defaultTypes, indentTypes) {
12853
+ return Array.from(new Set(__spreadArray(__spreadArray([], __read(defaultTypes)), __read(indentTypes))));
12854
+ };
12855
+
12807
12856
  var internalPlugins = [
12808
12857
  withTheHistory,
12809
12858
  withAutoInsertData(),
@@ -13779,13 +13828,12 @@
13779
13828
  };
13780
13829
  TheEditorComponent.prototype.initialize = function () {
13781
13830
  var _this = this;
13782
- var _a, _b, _c, _d;
13831
+ var _a, _b, _c;
13783
13832
  this.editor = withTheEditor(this.thePlugins, slateHistory.withHistory(i1.withAngular(slate.createEditor(), CLIPBOARD_FORMAT_KEY)));
13784
13833
  this.generateDecorate();
13785
13834
  this.editor.disabled = (_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.disabled;
13786
13835
  this.editor.extraElementOptions = (_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.extraElementOptions;
13787
13836
  this.editor.extraAutoFormatRules = (_c = this.theOptions) === null || _c === void 0 ? void 0 : _c.extraAutoFormatRules;
13788
- this.editor.extraIndentOptions = (_d = this.theOptions) === null || _d === void 0 ? void 0 : _d.extraIndentOptions;
13789
13837
  this.editor.options = this.theOptions;
13790
13838
  setEditorUUID(this.editor, idCreator());
13791
13839
  this.theContextService.initialize({
@@ -14383,6 +14431,7 @@
14383
14431
  exports.HrEditor = HrEditor;
14384
14432
  exports.IS_MAC = IS_MAC;
14385
14433
  exports.ImageEditor = ImageEditor;
14434
+ exports.IndentEditor = IndentEditor;
14386
14435
  exports.LINK_DEFAULT_TEXT = LINK_DEFAULT_TEXT;
14387
14436
  exports.LIST_BLOCK_TYPES = LIST_BLOCK_TYPES;
14388
14437
  exports.LinkEditor = LinkEditor;
@@ -14412,6 +14461,7 @@
14412
14461
  exports.TheEditorComponent = TheEditorComponent;
14413
14462
  exports.TheEditorModule = TheEditorModule;
14414
14463
  exports.TheImageComponent = TheImageComponent;
14464
+ exports.TheIndentToolbarComponent = TheIndentToolbarComponent;
14415
14465
  exports.TheQueries = index$1;
14416
14466
  exports.TheToolbarBaseItemComponent = TheToolbarBaseItemComponent;
14417
14467
  exports.TheToolbarComponent = TheToolbarComponent;
@@ -14438,6 +14488,7 @@
14438
14488
  exports.getToolbarClass = getToolbarClass;
14439
14489
  exports.htmlToTheia = htmlToTheia;
14440
14490
  exports.inValidTypes = inValidTypes;
14491
+ exports.includesIndentTypes = includesIndentTypes;
14441
14492
  exports.isCleanEmptyParagraph = isCleanEmptyParagraph;
14442
14493
  exports.isPureEmptyParagraph = isPureEmptyParagraph;
14443
14494
  exports.mergeElementOptions = mergeElementOptions;