@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
@@ -1317,6 +1317,30 @@ const getContainerBlocks = (editor) => {
1317
1317
  return !containerNode ? CONTAINER_BLOCKS : [...CONTAINER_BLOCKS, containerNode[0].type];
1318
1318
  };
1319
1319
 
1320
+ const getDirectlyParent = (editor) => {
1321
+ const [, anchorPath] = getBlockAbove(editor);
1322
+ if (!anchorPath)
1323
+ return;
1324
+ const parentEntry = getParent(editor, anchorPath);
1325
+ if (!parentEntry)
1326
+ return;
1327
+ return parentEntry;
1328
+ };
1329
+
1330
+ const isTypesInParent = (editor, types) => {
1331
+ if (!Array.isArray(types)) {
1332
+ types = [types];
1333
+ }
1334
+ const [, anchorPath] = getBlockAbove(editor);
1335
+ if (!anchorPath)
1336
+ return false;
1337
+ const parentEntry = Editor.above(editor, { match: n => types.includes(n.type) });
1338
+ if (!parentEntry)
1339
+ return false;
1340
+ const [parentNode] = parentEntry;
1341
+ return types.includes(parentNode.type);
1342
+ };
1343
+
1320
1344
  var index$1 = /*#__PURE__*/Object.freeze({
1321
1345
  __proto__: null,
1322
1346
  getLastNode: getLastNode,
@@ -1344,6 +1368,7 @@ var index$1 = /*#__PURE__*/Object.freeze({
1344
1368
  getPlainText: getPlainText,
1345
1369
  getSelectionMarks: getSelectionMarks,
1346
1370
  getContainerBlocks: getContainerBlocks,
1371
+ getDirectlyParent: getDirectlyParent,
1347
1372
  isAncestor: isAncestor,
1348
1373
  isCollapsed: isCollapsed,
1349
1374
  isEmptyParagraph: isEmptyParagraph,
@@ -1366,6 +1391,7 @@ var index$1 = /*#__PURE__*/Object.freeze({
1366
1391
  isEmptyContent: isEmptyContent,
1367
1392
  isEmptyParagraphByPath: isEmptyParagraphByPath,
1368
1393
  isContainer: isContainer,
1394
+ isTypesInParent: isTypesInParent,
1369
1395
  anchorBlock: anchorBlock,
1370
1396
  anchorBlockEntry: anchorBlockEntry,
1371
1397
  anchorInlineEntry: anchorInlineEntry,
@@ -1377,11 +1403,32 @@ var index$1 = /*#__PURE__*/Object.freeze({
1377
1403
  });
1378
1404
 
1379
1405
  const insertElementNext = (editor, node) => {
1406
+ var _a;
1380
1407
  if (Range.isExpanded(editor.selection)) {
1381
1408
  Editor.deleteFragment(editor);
1382
1409
  }
1383
- const anchorBlockPath = anchorBlockEntry(editor)[1];
1384
- const isEmpty = isEmptyParagraph(editor);
1410
+ const allowContainerOperateTypes = ((_a = editor.options) === null || _a === void 0 ? void 0 : _a.allowContainerOperateTypes) || [];
1411
+ const isAllowContainerInsert = isTypesInParent(editor, allowContainerOperateTypes);
1412
+ const isBlockCardCursor$1 = isBlockCardCursor(editor);
1413
+ const containerBlocks = getContainerBlocks(editor);
1414
+ const isContainer = isNodeTypeIn(editor, containerBlocks, { at: editor.selection });
1415
+ const [anchorBlock, anchorBlockPath] = anchorBlockEntry(editor);
1416
+ const isEmpty = Editor.isEmpty(editor, anchorBlock);
1417
+ if (isAllowContainerInsert && isContainer && !isBlockCardCursor$1) {
1418
+ const [, containerPath] = Editor.above(editor, {
1419
+ match: n => Editor.isBlock(editor, n) && allowContainerOperateTypes.includes(n.type),
1420
+ at: editor.selection
1421
+ });
1422
+ Editor.withoutNormalizing(editor, () => {
1423
+ const containerPathFirstPath = anchorBlockPath.slice(0, containerPath.length + 1);
1424
+ Transforms.insertNodes(editor, node, { at: Path.next(containerPathFirstPath) });
1425
+ Transforms.select(editor, Editor.start(editor, Path.next(containerPathFirstPath)));
1426
+ if (isEmpty) {
1427
+ Transforms.removeNodes(editor, { at: anchorBlockPath });
1428
+ }
1429
+ });
1430
+ return;
1431
+ }
1385
1432
  const nextPath = Path.next([anchorBlockPath[0]]);
1386
1433
  Transforms.insertNodes(editor, node, { at: nextPath });
1387
1434
  if (isEmpty && anchorBlockPath.length === 1) {
@@ -1589,40 +1636,6 @@ function handleContinualInsertBreak(editor, lowestBlock, type) {
1589
1636
  return false;
1590
1637
  }
1591
1638
 
1592
- const insertElementNode = (editor, node) => {
1593
- if (Range.isExpanded(editor.selection)) {
1594
- Editor.deleteFragment(editor);
1595
- }
1596
- const isBlockCardCursor$1 = isBlockCardCursor(editor);
1597
- const containerBlocks = getContainerBlocks(editor);
1598
- const isContainer = isNodeTypeIn(editor, containerBlocks, { at: editor.selection });
1599
- const [anchorBlock, anchorBlockPath] = anchorBlockEntry(editor);
1600
- const isEmpty = Editor.isEmpty(editor, anchorBlock);
1601
- if (isContainer && !isBlockCardCursor$1) {
1602
- const [, containerPath] = Editor.above(editor, {
1603
- match: n => Editor.isBlock(editor, n) && containerBlocks.includes(n.type),
1604
- at: editor.selection
1605
- });
1606
- Editor.withoutNormalizing(editor, () => {
1607
- const containerPathFirstPath = anchorBlockPath.slice(0, containerPath.length + 1);
1608
- Transforms.insertNodes(editor, node, { at: Path.next(containerPathFirstPath), select: true });
1609
- if (isEmpty) {
1610
- Transforms.removeNodes(editor, { at: anchorBlockPath });
1611
- }
1612
- });
1613
- return;
1614
- }
1615
- const nextPath = Path.next([anchorBlockPath[0]]);
1616
- Transforms.insertNodes(editor, node, { at: nextPath });
1617
- if (isEmpty && anchorBlockPath.length === 1) {
1618
- Transforms.delete(editor, { at: anchorBlockPath });
1619
- Transforms.select(editor, Editor.start(editor, anchorBlockPath));
1620
- }
1621
- else {
1622
- Transforms.select(editor, Editor.start(editor, nextPath));
1623
- }
1624
- };
1625
-
1626
1639
  var index = /*#__PURE__*/Object.freeze({
1627
1640
  __proto__: null,
1628
1641
  setMarks: setMarks,
@@ -1642,8 +1655,7 @@ var index = /*#__PURE__*/Object.freeze({
1642
1655
  setEndSelection: setEndSelection,
1643
1656
  closeConversionHint: closeConversionHint,
1644
1657
  handleContinualDeleteBackward: handleContinualDeleteBackward,
1645
- handleContinualInsertBreak: handleContinualInsertBreak,
1646
- insertElementNode: insertElementNode
1658
+ handleContinualInsertBreak: handleContinualInsertBreak
1647
1659
  });
1648
1660
 
1649
1661
  class TheConversionHintComponent {
@@ -3575,6 +3587,7 @@ class TheTodoItemComponent extends TheBaseElementComponent {
3575
3587
  this.elementRef = elementRef;
3576
3588
  this.cdr = cdr;
3577
3589
  this.ctxService = ctxService;
3590
+ // 类名 the-temp-*: 临时解决因受portal影响样式问题,后期改回the-
3578
3591
  this.checkItemClass = true;
3579
3592
  }
3580
3593
  get level() {
@@ -3597,7 +3610,7 @@ class TheTodoItemComponent extends TheBaseElementComponent {
3597
3610
  }
3598
3611
  }
3599
3612
  TheTodoItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheTodoItemComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: TheContextService }], target: i0.ɵɵFactoryTarget.Component });
3600
- TheTodoItemComponent.ɵcmp = i0.ɵɵ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, template: `
3613
+ TheTodoItemComponent.ɵcmp = i0.ɵɵ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, template: `
3601
3614
  <span contenteditable="false" class="todo-item-status">
3602
3615
  <input #checkbox type="checkbox" [checked]="element.checked" (click)="onCheck(checkbox.checked)" />
3603
3616
  </span>
@@ -3616,7 +3629,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
3616
3629
  }]
3617
3630
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: TheContextService }]; }, propDecorators: { checkItemClass: [{
3618
3631
  type: HostBinding,
3619
- args: ['class.the-check-item']
3632
+ args: ['class.the-temp-check-item']
3620
3633
  }], level: [{
3621
3634
  type: HostBinding,
3622
3635
  args: ['attr.the-level']
@@ -9042,7 +9055,8 @@ class TheTableComponent extends TheBaseElementComponent {
9042
9055
  this.getIsInTable();
9043
9056
  }
9044
9057
  ngAfterViewInit() {
9045
- this.ngZone.onStable.pipe(take(1)).subscribe(() => {
9058
+ this.ngZone.onStable.pipe(take(1)).subscribe(() => __awaiter(this, void 0, void 0, function* () {
9059
+ var _a;
9046
9060
  const blockCardElement = this.nativeElement.closest('slate-block-card');
9047
9061
  if (blockCardElement) {
9048
9062
  blockCardElement.classList.add(`slate-block-card-${this.element.type}`);
@@ -9052,9 +9066,21 @@ class TheTableComponent extends TheBaseElementComponent {
9052
9066
  this.subscribeCellPositionChange();
9053
9067
  this.listenTableContextMenuEvent();
9054
9068
  this.useTableWrapperWidth();
9055
- // need view render complete
9056
- this.useRowControls();
9057
- });
9069
+ if ((_a = this.element.options) === null || _a === void 0 ? void 0 : _a.numberedColumn) {
9070
+ const loadImageDone = yield this.resolveImage();
9071
+ // 等待序号列表格内图片加载完成后再去渲染表格行高度
9072
+ if (loadImageDone) {
9073
+ setTimeout(() => {
9074
+ this.useRowControls();
9075
+ this.cdr.detectChanges();
9076
+ }, 200); // 200ms:通过通知打开页面动画加载时间
9077
+ }
9078
+ }
9079
+ else {
9080
+ this.useRowControls();
9081
+ this.cdr.markForCheck();
9082
+ }
9083
+ }));
9058
9084
  }
9059
9085
  subscribeCellPositionChange() {
9060
9086
  this.tableStore
@@ -9087,7 +9113,6 @@ class TheTableComponent extends TheBaseElementComponent {
9087
9113
  var _a;
9088
9114
  if (this.selection || ((_a = this.element.options) === null || _a === void 0 ? void 0 : _a.numberedColumn)) {
9089
9115
  this.rowControls = this.calculateRowControls();
9090
- this.cdr.markForCheck();
9091
9116
  }
9092
9117
  }
9093
9118
  detectChanges() {
@@ -9189,6 +9214,24 @@ class TheTableComponent extends TheBaseElementComponent {
9189
9214
  });
9190
9215
  return belowRowlHeight;
9191
9216
  }
9217
+ resolveImage() {
9218
+ const imageElements = this.nativeElement.querySelectorAll('img');
9219
+ if (imageElements.length) {
9220
+ const imageResolves = [];
9221
+ imageElements.forEach(item => {
9222
+ const image = new Image();
9223
+ const imageLoad = new Promise(resolve => {
9224
+ image.onload = () => {
9225
+ resolve(true);
9226
+ };
9227
+ image.src = item.getAttribute('src');
9228
+ });
9229
+ imageResolves.push(imageLoad);
9230
+ });
9231
+ return Promise.all(imageResolves);
9232
+ }
9233
+ return Promise.resolve(true);
9234
+ }
9192
9235
  getColControls() {
9193
9236
  var _a, _b;
9194
9237
  this.colControls = ((_b = (_a = this.element) === null || _a === void 0 ? void 0 : _a.children[0]) === null || _b === void 0 ? void 0 : _b.children) || [];
@@ -11428,12 +11471,18 @@ const withQuickInsert = (editor) => {
11428
11471
  editor.onKeydown = (event) => {
11429
11472
  var _a;
11430
11473
  if (event.key === QUICK_TOOLBAR_HOTKEY) {
11431
- const types = [...(((_a = editor.options) === null || _a === void 0 ? void 0 : _a.triggerQuickToolbarTypes) || [])];
11432
- const [block,] = getBlockAbove(editor);
11474
+ const types = [...(((_a = editor.options) === null || _a === void 0 ? void 0 : _a.allowContainerOperateTypes) || [])];
11475
+ const [block] = getBlockAbove(editor);
11433
11476
  if (isPureEmptyParagraph(editor, block) && allowOpenQuickToolbar(editor, types)) {
11434
11477
  presseingQuickInsertHotkey = true;
11435
11478
  }
11436
11479
  }
11480
+ const quickToolbarRef = THE_EDITOR_QUICK_TOOLBAR_REF.get(editor);
11481
+ const isMoveUp = hotkeys.isMoveUp(event);
11482
+ const isMoveDown = hotkeys.isMoveDown(event);
11483
+ if (quickToolbarRef && (isMoveUp || isMoveDown)) {
11484
+ return;
11485
+ }
11437
11486
  onKeydown(event);
11438
11487
  };
11439
11488
  editor.deleteBackward = unit => {
@@ -11458,7 +11507,9 @@ const withQuickInsert = (editor) => {
11458
11507
  else {
11459
11508
  presseingQuickInsertHotkey = false;
11460
11509
  }
11461
- if (QuickInsertEditor.isOpenedToolbar(editor) && !isPureEmptyParagraph(editor, block) && Node.string(block) !== QUICK_TOOLBAR_HOTKEY) {
11510
+ if (QuickInsertEditor.isOpenedToolbar(editor) &&
11511
+ !isPureEmptyParagraph(editor, block) &&
11512
+ Node.string(block) !== QUICK_TOOLBAR_HOTKEY) {
11462
11513
  QuickInsertEditor.closeQuickInsertToolbar(editor);
11463
11514
  }
11464
11515
  }
@@ -11762,78 +11813,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
11762
11813
  args: ['class.disabled']
11763
11814
  }] } });
11764
11815
 
11765
- const onKeydownTextIndent = (editor, event, kinds, textIndentDisabled) => {
11766
- const { selection } = editor;
11767
- const isExpanded = Range.isExpanded(selection);
11768
- const nodes = Array.from(Editor.nodes(editor, {
11769
- mode: 'highest',
11770
- match: node => Element$1.isElement(node) && kinds.includes(node.type)
11771
- }));
11772
- const [startBlock] = nodes;
11773
- if (!startBlock) {
11774
- return false;
11775
- }
11776
- const [block, path] = startBlock;
11777
- const isStart = Editor.isStart(editor, selection.anchor, path);
11778
- if (isKeyHotkey('Tab', event)) {
11779
- event.preventDefault();
11780
- if (startBlock && (isExpanded || isStart)) {
11781
- if (!editor.isVoid(block)) {
11782
- let { textIndent, type } = block;
11783
- // do not apply first-line indentation for lists
11784
- if (!textIndent && !textIndentDisabled.includes(type)) {
11785
- IndentEditor.setTextIndent(editor, kinds, 2);
11786
- return true;
11787
- }
11788
- else {
11789
- IndentEditor.setIndent(editor);
11790
- return true;
11791
- }
11792
- }
11793
- }
11794
- else {
11795
- editor.insertText(TAB_SPACE);
11796
- return true;
11797
- }
11798
- }
11799
- if (isKeyHotkey('shift+Tab', event)) {
11800
- if (startBlock && (isExpanded || isStart)) {
11801
- if (!editor.isVoid(block)) {
11802
- return IndentEditor.cancelTextIntent(editor, event, block, kinds);
11803
- }
11804
- }
11805
- }
11806
- if (selection && Range.isCollapsed(selection) && hotkeys.isDeleteBackward(event)) {
11807
- if (startBlock && isStart) {
11808
- return IndentEditor.cancelTextIntent(editor, event, block, kinds);
11809
- }
11810
- }
11811
- return false;
11812
- };
11813
-
11814
- const withIndent = (kinds) => (editor) => {
11815
- const { onKeydown } = editor;
11816
- editor.onKeydown = (event) => {
11817
- var _a, _b, _c, _d;
11818
- let indentTypes = kinds;
11819
- let disableIndentTypes = [ElementKinds.bulletedList, ElementKinds.numberedList, ElementKinds.checkItem];
11820
- if ((_b = (_a = editor.extraIndentOptions) === null || _a === void 0 ? void 0 : _a.indentTypes) === null || _b === void 0 ? void 0 : _b.length) {
11821
- indentTypes = mergIndentTypes(kinds, editor.extraIndentOptions.indentTypes);
11822
- }
11823
- if ((_d = (_c = editor.extraIndentOptions) === null || _c === void 0 ? void 0 : _c.disabledIndentTypes) === null || _d === void 0 ? void 0 : _d.length) {
11824
- disableIndentTypes = mergIndentTypes(disableIndentTypes, editor.extraIndentOptions.disabledIndentTypes);
11825
- }
11826
- const isContinue = !onKeydownTextIndent(editor, event, indentTypes, disableIndentTypes);
11827
- if (isContinue) {
11828
- onKeydown(event);
11829
- }
11830
- };
11831
- return editor;
11832
- };
11833
- const mergIndentTypes = (defaultTypes, indentTypes) => {
11834
- return Array.from(new Set([...defaultTypes, ...indentTypes]));
11835
- };
11836
-
11837
11816
  const MaxIndent = 11;
11838
11817
  const includesIndentTypes = [
11839
11818
  ElementKinds.checkItem,
@@ -11842,15 +11821,11 @@ const includesIndentTypes = [
11842
11821
  ElementKinds.paragraph,
11843
11822
  ...HEADING_TYPES
11844
11823
  ];
11845
- const getIndentTypes = editor => {
11846
- let indentTypes = editor.extraIndentOptions ? editor.extraIndentOptions.indentTypes : [];
11847
- return mergIndentTypes(includesIndentTypes, indentTypes);
11848
- };
11849
11824
  const IndentEditor = {
11850
11825
  setIndent(editor) {
11851
11826
  const nodes = Array.from(Editor.nodes(editor, {
11852
11827
  mode: 'highest',
11853
- match: n => Element$1.isElement(n) && getIndentTypes(editor).includes(n.type)
11828
+ match: n => Element$1.isElement(n) && includesIndentTypes.includes(n.type)
11854
11829
  }));
11855
11830
  const [startBlock] = nodes;
11856
11831
  if (startBlock) {
@@ -11860,7 +11835,7 @@ const IndentEditor = {
11860
11835
  if (indent <= MaxIndent) {
11861
11836
  Transforms.setNodes(editor, { indent }, {
11862
11837
  mode: 'highest',
11863
- match: n => Element$1.isElement(n) && getIndentTypes(editor).includes(n.type)
11838
+ match: n => Element$1.isElement(n) && includesIndentTypes.includes(n.type)
11864
11839
  });
11865
11840
  }
11866
11841
  }
@@ -11868,7 +11843,7 @@ const IndentEditor = {
11868
11843
  cancelIndent(editor) {
11869
11844
  const nodes = Array.from(Editor.nodes(editor, {
11870
11845
  mode: 'highest',
11871
- match: n => Element$1.isElement(n) && getIndentTypes(editor).includes(n.type)
11846
+ match: n => Element$1.isElement(n) && includesIndentTypes.includes(n.type)
11872
11847
  }));
11873
11848
  const [startBlock] = nodes;
11874
11849
  if (startBlock) {
@@ -11876,7 +11851,7 @@ const IndentEditor = {
11876
11851
  indent = indent === 1 ? null : (indent -= 1);
11877
11852
  Transforms.setNodes(editor, { indent }, {
11878
11853
  mode: 'highest',
11879
- match: n => Element$1.isElement(n) && getIndentTypes(editor).includes(n.type)
11854
+ match: n => Element$1.isElement(n) && includesIndentTypes.includes(n.type)
11880
11855
  });
11881
11856
  }
11882
11857
  },
@@ -11909,7 +11884,7 @@ const IndentEditor = {
11909
11884
  isDisabled(editor) {
11910
11885
  if (editor.selection) {
11911
11886
  const anchorBlock$1 = anchorBlock(editor);
11912
- return anchorBlock$1 && !getIndentTypes(editor).includes(anchorBlock$1 === null || anchorBlock$1 === void 0 ? void 0 : anchorBlock$1.type);
11887
+ return anchorBlock$1 && !includesIndentTypes.includes(anchorBlock$1 === null || anchorBlock$1 === void 0 ? void 0 : anchorBlock$1.type);
11913
11888
  }
11914
11889
  return false;
11915
11890
  }
@@ -11939,6 +11914,71 @@ const IndentOptions = [
11939
11914
  }
11940
11915
  ];
11941
11916
 
11917
+ const onKeydownTextIndent = (editor, event, kinds, textIndentDisabled) => {
11918
+ const { selection } = editor;
11919
+ const isExpanded = Range.isExpanded(selection);
11920
+ const nodes = Array.from(Editor.nodes(editor, {
11921
+ mode: 'highest',
11922
+ match: node => Element$1.isElement(node) && kinds.includes(node.type)
11923
+ }));
11924
+ const [startBlock] = nodes;
11925
+ if (!startBlock) {
11926
+ return false;
11927
+ }
11928
+ const [block, path] = startBlock;
11929
+ const isStart = Editor.isStart(editor, selection.anchor, path);
11930
+ if (isKeyHotkey('Tab', event)) {
11931
+ event.preventDefault();
11932
+ if (startBlock && (isExpanded || isStart)) {
11933
+ if (!editor.isVoid(block)) {
11934
+ let { textIndent, type } = block;
11935
+ // do not apply first-line indentation for lists
11936
+ if (!textIndent && !textIndentDisabled.includes(type)) {
11937
+ IndentEditor.setTextIndent(editor, kinds, 2);
11938
+ return true;
11939
+ }
11940
+ else {
11941
+ IndentEditor.setIndent(editor);
11942
+ return true;
11943
+ }
11944
+ }
11945
+ }
11946
+ else {
11947
+ editor.insertText(TAB_SPACE);
11948
+ return true;
11949
+ }
11950
+ }
11951
+ if (isKeyHotkey('shift+Tab', event)) {
11952
+ if (startBlock && (isExpanded || isStart)) {
11953
+ if (!editor.isVoid(block)) {
11954
+ return IndentEditor.cancelTextIntent(editor, event, block, kinds);
11955
+ }
11956
+ }
11957
+ }
11958
+ if (selection && Range.isCollapsed(selection) && hotkeys.isDeleteBackward(event)) {
11959
+ if (startBlock && isStart) {
11960
+ return IndentEditor.cancelTextIntent(editor, event, block, kinds);
11961
+ }
11962
+ }
11963
+ return false;
11964
+ };
11965
+
11966
+ const withIndent = (kinds) => (editor) => {
11967
+ const { onKeydown } = editor;
11968
+ editor.onKeydown = (event) => {
11969
+ let indentTypes = kinds;
11970
+ let disableIndentTypes = [ElementKinds.bulletedList, ElementKinds.numberedList, ElementKinds.checkItem];
11971
+ const isContinue = !onKeydownTextIndent(editor, event, indentTypes, disableIndentTypes);
11972
+ if (isContinue) {
11973
+ onKeydown(event);
11974
+ }
11975
+ };
11976
+ return editor;
11977
+ };
11978
+ const mergIndentTypes = (defaultTypes, indentTypes) => {
11979
+ return Array.from(new Set([...defaultTypes, ...indentTypes]));
11980
+ };
11981
+
11942
11982
  const internalPlugins = [
11943
11983
  withTheHistory,
11944
11984
  withAutoInsertData(),
@@ -12838,13 +12878,12 @@ class TheEditorComponent extends mixinUnsubscribe(MixinBase) {
12838
12878
  super.ngOnDestroy();
12839
12879
  }
12840
12880
  initialize() {
12841
- var _a, _b, _c, _d;
12881
+ var _a, _b, _c;
12842
12882
  this.editor = withTheEditor(this.thePlugins, withHistory(withAngular(createEditor(), CLIPBOARD_FORMAT_KEY)));
12843
12883
  this.generateDecorate();
12844
12884
  this.editor.disabled = (_a = this.theOptions) === null || _a === void 0 ? void 0 : _a.disabled;
12845
12885
  this.editor.extraElementOptions = (_b = this.theOptions) === null || _b === void 0 ? void 0 : _b.extraElementOptions;
12846
12886
  this.editor.extraAutoFormatRules = (_c = this.theOptions) === null || _c === void 0 ? void 0 : _c.extraAutoFormatRules;
12847
- this.editor.extraIndentOptions = (_d = this.theOptions) === null || _d === void 0 ? void 0 : _d.extraIndentOptions;
12848
12887
  this.editor.options = this.theOptions;
12849
12888
  setEditorUUID(this.editor, idCreator());
12850
12889
  this.theContextService.initialize({
@@ -13390,5 +13429,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
13390
13429
  * Generated bundle index. Do not edit.
13391
13430
  */
13392
13431
 
13393
- 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, Indents, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LayoutTypes, 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, coercePixelsFromCssValue, createEmptyParagraph, dataDeserialize, dataSerializing, getColsTotalWidth, getElementClassByPrefix, getElementHeight, getElementWidth, getRowsTotalHeight, getToolbarClass, htmlToTheia, inValidTypes, isCleanEmptyParagraph, isPureEmptyParagraph, mergeElementOptions, plainToTheia, toolbarCompose, useElementStyle, withTheEditor };
13432
+ 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, IndentEditor, Indents, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LayoutTypes, 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, TheIndentToolbarComponent, 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, coercePixelsFromCssValue, createEmptyParagraph, dataDeserialize, dataSerializing, getColsTotalWidth, getElementClassByPrefix, getElementHeight, getElementWidth, getRowsTotalHeight, getToolbarClass, htmlToTheia, inValidTypes, includesIndentTypes, isCleanEmptyParagraph, isPureEmptyParagraph, mergeElementOptions, plainToTheia, toolbarCompose, useElementStyle, withTheEditor };
13394
13433
  //# sourceMappingURL=worktile-theia.js.map