@worktile/theia 16.3.2 → 16.3.4

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 (43) hide show
  1. package/editor.module.d.ts +1 -1
  2. package/esm2022/components/contextmenu/contextmenu.component.mjs +1 -1
  3. package/esm2022/plugins/code/code.component.mjs +8 -8
  4. package/esm2022/plugins/code/code.editor.mjs +18 -7
  5. package/esm2022/plugins/color/toolbar-item.component.mjs +1 -1
  6. package/esm2022/plugins/image/image.component.mjs +5 -8
  7. package/esm2022/plugins/image/image.editor.mjs +19 -4
  8. package/esm2022/plugins/image/image.plugin.mjs +3 -3
  9. package/esm2022/plugins/link/edit/link-edit.component.mjs +4 -15
  10. package/esm2022/plugins/link/link.component.mjs +4 -4
  11. package/esm2022/plugins/link/link.editor.mjs +21 -4
  12. package/esm2022/plugins/link/link.plugin.mjs +3 -3
  13. package/esm2022/plugins/public-api.mjs +2 -1
  14. package/esm2022/plugins/table/components/table.component.mjs +3 -2
  15. package/esm2022/plugins/table/components/toolbar/table-options.component.mjs +3 -3
  16. package/esm2022/plugins/table/components/toolbar/table-toolbar.component.mjs +7 -17
  17. package/esm2022/plugins/table/table.editor.mjs +101 -17
  18. package/esm2022/plugins/table/table.plugin.mjs +2 -2
  19. package/esm2022/plugins/table/table.store.mjs +1 -25
  20. package/esm2022/plugins/table/utils/remove-row-column.mjs +3 -4
  21. package/esm2022/services/table-contextmenu.service.mjs +6 -8
  22. package/esm2022/transforms/delete-node-by-type.mjs +10 -0
  23. package/esm2022/transforms/index.mjs +4 -2
  24. package/esm2022/transforms/set-node-by-type.mjs +10 -0
  25. package/esm2022/utils/copy-node.mjs +5 -2
  26. package/fesm2022/worktile-theia.mjs +347 -275
  27. package/fesm2022/worktile-theia.mjs.map +1 -1
  28. package/package.json +1 -1
  29. package/plugins/code/code.editor.d.ts +2 -3
  30. package/plugins/image/image.component.d.ts +1 -4
  31. package/plugins/image/image.editor.d.ts +4 -7
  32. package/plugins/link/edit/link-edit.component.d.ts +3 -2
  33. package/plugins/link/link.editor.d.ts +3 -1
  34. package/plugins/public-api.d.ts +1 -0
  35. package/plugins/table/table.editor.d.ts +13 -6
  36. package/plugins/table/table.store.d.ts +0 -3
  37. package/transforms/delete-node-by-type.d.ts +3 -0
  38. package/transforms/index.d.ts +3 -1
  39. package/transforms/set-node-by-type.d.ts +3 -0
  40. package/esm2022/plugins/table/utils/set-cells-background-color.mjs +0 -22
  41. package/esm2022/plugins/table/utils/set-node-options.mjs +0 -11
  42. package/plugins/table/utils/set-cells-background-color.d.ts +0 -3
  43. package/plugins/table/utils/set-node-options.d.ts +0 -3
@@ -29,6 +29,7 @@ import { mixinUnsubscribe, MixinBase, ScrollToService } from 'ngx-tethys/core';
29
29
  import { isKeyHotkey } from 'is-hotkey';
30
30
  import { Subject, fromEvent, timer, combineLatest, Observable, BehaviorSubject, merge, ReplaySubject, takeUntil as takeUntil$1 } from 'rxjs';
31
31
  import { takeUntil, debounceTime, take, delay, map as map$1, filter, startWith, distinctUntilChanged, skip, share, mapTo, pairwise } from 'rxjs/operators';
32
+ import isUrl from 'is-url';
32
33
  import * as i6$1 from 'ngx-tethys/input';
33
34
  import { ThyInputModule } from 'ngx-tethys/input';
34
35
  import * as i10 from 'ngx-tethys/empty';
@@ -52,7 +53,6 @@ import { ThyImageDirective, ThyImageModule } from 'ngx-tethys/image';
52
53
  import { ThyUploadStatus } from 'ngx-tethys/upload';
53
54
  import * as i9$1 from 'ngx-tethys/progress';
54
55
  import { ThyProgressModule } from 'ngx-tethys/progress';
55
- import isUrl from 'is-url';
56
56
  import * as i3 from 'ngx-tethys/form';
57
57
  import { ThyFormModule } from 'ngx-tethys/form';
58
58
  import * as i5$1 from 'ngx-tethys/shared';
@@ -2132,7 +2132,10 @@ function copyNode(editor, element, thyNotifyService, codeMirrorEditor) {
2132
2132
  if (IS_SAFARI) {
2133
2133
  copyNodeForSafari(editor, element);
2134
2134
  }
2135
- document.execCommand('copy') ? thyNotifyService.success('复制成功') : thyNotifyService.error('复制失败');
2135
+ const isSuccess = document.execCommand('copy');
2136
+ if (thyNotifyService) {
2137
+ isSuccess ? thyNotifyService.success('复制成功') : thyNotifyService.error('复制失败');
2138
+ }
2136
2139
  if (IS_SAFARI) {
2137
2140
  window.getSelection().removeAllRanges();
2138
2141
  }
@@ -4389,12 +4392,29 @@ function handleContinualInsertBreak(editor, lowestBlock, type) {
4389
4392
  return false;
4390
4393
  }
4391
4394
 
4395
+ const deleteNodeByType = (editor, type) => {
4396
+ const node = getAboveByType(editor, type);
4397
+ const element = node && node[0];
4398
+ if (element) {
4399
+ deleteElement(editor, element);
4400
+ }
4401
+ };
4402
+
4403
+ const setNodeByType = (editor, props, type) => {
4404
+ const node = getAboveByType(editor, type);
4405
+ const path = node && node[1];
4406
+ if (path) {
4407
+ Transforms.setNodes(editor, props, { at: path });
4408
+ }
4409
+ };
4410
+
4392
4411
  var index = /*#__PURE__*/Object.freeze({
4393
4412
  __proto__: null,
4394
4413
  applyDeepToNodes: applyDeepToNodes,
4395
4414
  clearMarks: clearMarks,
4396
4415
  closeConversionHint: closeConversionHint,
4397
4416
  deleteElement: deleteElement,
4417
+ deleteNodeByType: deleteNodeByType,
4398
4418
  handleContinualDeleteBackward: handleContinualDeleteBackward,
4399
4419
  handleContinualInsertBreak: handleContinualInsertBreak,
4400
4420
  insertElements: insertElements,
@@ -4405,6 +4425,7 @@ var index = /*#__PURE__*/Object.freeze({
4405
4425
  setEndSelection: setEndSelection,
4406
4426
  setMarks: setMarks,
4407
4427
  setNode: setNode,
4428
+ setNodeByType: setNodeByType,
4408
4429
  unWrap: unWrap,
4409
4430
  unwrapNodesByType: unwrapNodesByType
4410
4431
  });
@@ -4762,11 +4783,14 @@ const BlockquoteEditor = {
4762
4783
  };
4763
4784
 
4764
4785
  const CodeEditor = {
4765
- setCodeAttribute(editor, element, value) {
4766
- const at = AngularEditor.findPath(editor, element);
4767
- Transforms.setNodes(editor, value, {
4768
- at
4769
- });
4786
+ setCodeAttribute(editor, props, element) {
4787
+ if (!element) {
4788
+ setNodeByType(editor, props, ElementKinds.code);
4789
+ }
4790
+ else {
4791
+ const path = findPath(editor, element);
4792
+ Transforms.setNodes(editor, props, { at: path });
4793
+ }
4770
4794
  },
4771
4795
  insertCode(editor) {
4772
4796
  const isSelectContent = Editor.string(editor, editor.selection);
@@ -4802,6 +4826,14 @@ const CodeEditor = {
4802
4826
  };
4803
4827
  insertElements(editor, codeElement);
4804
4828
  }
4829
+ },
4830
+ removeCode(editor, code) {
4831
+ if (code) {
4832
+ deleteElement(editor, code);
4833
+ }
4834
+ else {
4835
+ deleteNodeByType(editor, ElementKinds.code);
4836
+ }
4805
4837
  }
4806
4838
  };
4807
4839
 
@@ -4950,15 +4982,21 @@ const ImageEditor = {
4950
4982
  }
4951
4983
  return true;
4952
4984
  },
4953
- isImageActive(editor) {
4985
+ isActive(editor) {
4954
4986
  const [match] = Editor.nodes(editor, {
4955
4987
  match: n => Element$1.isElement(n) && n.type === ElementKinds.image,
4956
4988
  universal: true
4957
4989
  });
4958
4990
  return !!match;
4959
4991
  },
4960
- setImageNode(editor, path, partial) {
4961
- Transforms.setNodes(editor, partial, { at: path });
4992
+ setImageNode(editor, props, image) {
4993
+ if (!image) {
4994
+ setNodeByType(editor, props, ElementKinds.image);
4995
+ }
4996
+ else {
4997
+ const path = findPath(editor, image);
4998
+ Transforms.setNodes(editor, props, { at: path });
4999
+ }
4962
5000
  },
4963
5001
  isBase64(url) {
4964
5002
  return isString(url) && url.includes('base64');
@@ -4976,6 +5014,14 @@ const ImageEditor = {
4976
5014
  if (externalSource) {
4977
5015
  image.externalSource = externalSource;
4978
5016
  }
5017
+ },
5018
+ removeImage(editor, image) {
5019
+ if (image) {
5020
+ deleteElement(editor, image);
5021
+ }
5022
+ else {
5023
+ deleteNodeByType(editor, ElementKinds.image);
5024
+ }
4979
5025
  }
4980
5026
  };
4981
5027
 
@@ -5078,7 +5124,7 @@ const LinkEditor = {
5078
5124
  });
5079
5125
  }
5080
5126
  else {
5081
- const isActive = LinkEditor.isLinkActive(editor);
5127
+ const isActive = LinkEditor.isActive(editor);
5082
5128
  if (isActive) {
5083
5129
  LinkEditor.unwrapLink(editor);
5084
5130
  return;
@@ -5097,12 +5143,12 @@ const LinkEditor = {
5097
5143
  });
5098
5144
  }
5099
5145
  },
5100
- isLinkActive(editor) {
5146
+ isActive(editor) {
5101
5147
  const [link] = Editor.nodes(editor, { match: n => Element$1.isElement(n) && n.type === ElementKinds.link });
5102
5148
  return !!link;
5103
5149
  },
5104
5150
  wrapLink(editor, text, url) {
5105
- if (LinkEditor.isLinkActive(editor)) {
5151
+ if (LinkEditor.isActive(editor)) {
5106
5152
  LinkEditor.unwrapLink(editor);
5107
5153
  }
5108
5154
  const { selection } = editor;
@@ -5122,6 +5168,21 @@ const LinkEditor = {
5122
5168
  },
5123
5169
  unwrapLink(editor) {
5124
5170
  Transforms.unwrapNodes(editor, { match: n => Element$1.isElement(n) && n.type === ElementKinds.link });
5171
+ },
5172
+ updateLink(editor, element, url, text) {
5173
+ if (isUrl(url)) {
5174
+ const path = TheEditor.findPath(editor, element);
5175
+ if (element.url !== url) {
5176
+ Transforms.setNodes(editor, { url: url }, { at: path });
5177
+ }
5178
+ if (Node.string(element) !== text) {
5179
+ const [start, end] = Editor.edges(editor, path);
5180
+ Transforms.insertText(editor, text, { at: { anchor: end, focus: end } });
5181
+ Transforms.delete(editor, { at: { anchor: start, focus: end } });
5182
+ }
5183
+ TheEditor.focus(editor);
5184
+ Transforms.select(editor, Editor.after(editor, path));
5185
+ }
5125
5186
  }
5126
5187
  };
5127
5188
 
@@ -6447,6 +6508,151 @@ function setCellIndent(editor, indentType, child, at) {
6447
6508
  }
6448
6509
  }
6449
6510
 
6511
+ function splitCell(editor) {
6512
+ const tablePosition = createTablePosition(editor);
6513
+ const { cell, table, cellEntry } = tablePosition;
6514
+ if ((!cell.rowspan && !cell.colspan) || (cell.rowspan === 1 && cell.colspan === 1))
6515
+ return editor;
6516
+ const cellRow = tablePosition.getRowIndex();
6517
+ const cellCol = tablePosition.getColumnIndex();
6518
+ resetTableCell(editor, table, cell, cellRow, cellCol);
6519
+ Transforms.select(editor, cellEntry[1]);
6520
+ Transforms.collapse(editor, { edge: 'end' });
6521
+ }
6522
+ function resetTableCell(editor, table, cell, cellRow, cellCol) {
6523
+ const rowSpanIndex = cellRow + (cell.rowspan || 1) - 1;
6524
+ const colSpanIndex = cellCol + (cell.colspan || 1) - 1;
6525
+ Editor.withoutNormalizing(editor, () => {
6526
+ table.children.map((row, rowIndex) => {
6527
+ row.children.map((col, colIndex) => {
6528
+ if (rowIndex >= cellRow && rowIndex <= rowSpanIndex && colIndex >= cellCol && colIndex <= colSpanIndex) {
6529
+ const path = findPath(editor, col);
6530
+ Transforms.setNodes(editor, { colspan: null, rowspan: null, hidden: null }, { at: path });
6531
+ }
6532
+ });
6533
+ });
6534
+ });
6535
+ }
6536
+
6537
+ const getTableEntry = (editor) => {
6538
+ const { tableEntry } = createTablePosition(editor);
6539
+ return tableEntry;
6540
+ };
6541
+ const getTablePath = (editor) => {
6542
+ const tableEntry = getTableEntry(editor);
6543
+ return tableEntry[1];
6544
+ };
6545
+ const getTable = (editor) => {
6546
+ const { tableEntry } = createTablePosition(editor);
6547
+ return tableEntry[0];
6548
+ };
6549
+ const getSelectedCell = (editor) => {
6550
+ if (editor && editor.selection) {
6551
+ const { cell } = createTablePosition(editor);
6552
+ return cell;
6553
+ }
6554
+ return null;
6555
+ };
6556
+
6557
+ function isSelectedCellMerged(editor) {
6558
+ if (editor && editor.selection) {
6559
+ const opts = new TableOptions();
6560
+ const { anchor } = editor.selection;
6561
+ const { cell } = TablePosition.create(opts, editor, anchor.path);
6562
+ if (cell) {
6563
+ return (cell.colspan && cell.colspan !== 1) || (cell.rowspan && cell.rowspan !== 1);
6564
+ }
6565
+ }
6566
+ return false;
6567
+ }
6568
+ function getLeftCellDict(selectCellNodes) {
6569
+ return selectCellNodes.reduce((dict, cell) => {
6570
+ if (!dict[cell.row]) {
6571
+ dict[cell.row] = cell;
6572
+ }
6573
+ return dict;
6574
+ }, {});
6575
+ }
6576
+ function calculateCellSpan(selectCellNodes, leftCellDict) {
6577
+ let rowspan = 0, colspan = 0, crossCount = -1;
6578
+ selectCellNodes
6579
+ .filter(item => !item.node.hidden)
6580
+ .forEach(item => {
6581
+ const { row } = item;
6582
+ if (item.row === selectCellNodes[0].row) {
6583
+ colspan += item.node.colspan || 1;
6584
+ }
6585
+ const maxRowSpan = leftCellDict[row].maxRowSpan || 1;
6586
+ leftCellDict[row].maxRowSpan = (item.node.rowspan || 1) > maxRowSpan ? item.node.rowspan : maxRowSpan;
6587
+ });
6588
+ Object.values(leftCellDict).forEach((item) => {
6589
+ const { row, maxRowSpan } = item;
6590
+ if (crossCount < row) {
6591
+ rowspan += maxRowSpan;
6592
+ crossCount = row + maxRowSpan - 1;
6593
+ }
6594
+ });
6595
+ return { rowspan, colspan };
6596
+ }
6597
+ function mergeCell(editor, selectedCells) {
6598
+ sortCell(selectedCells);
6599
+ const selectCellNodes = getSelectCellNode(editor, selectedCells);
6600
+ Editor.withoutNormalizing(editor, () => {
6601
+ let leftTopCellPath;
6602
+ const leftCellDict = getLeftCellDict(selectCellNodes);
6603
+ selectCellNodes.forEach((cell, index) => {
6604
+ const { row, node } = cell;
6605
+ if (node) {
6606
+ const cellPath = findPath(editor, node);
6607
+ if (index === 0) {
6608
+ leftTopCellPath = cellPath;
6609
+ }
6610
+ else {
6611
+ mergeCellContent(editor, leftTopCellPath, cellPath);
6612
+ Transforms.setNodes(editor, { colspan: null, rowspan: null, hidden: true }, { at: cellPath });
6613
+ }
6614
+ }
6615
+ });
6616
+ let { rowspan, colspan } = calculateCellSpan(selectCellNodes, leftCellDict);
6617
+ Transforms.setNodes(editor, { rowspan, colspan }, { at: leftTopCellPath });
6618
+ Transforms.select(editor, leftTopCellPath);
6619
+ Transforms.collapse(editor, { edge: 'end' });
6620
+ });
6621
+ }
6622
+ function mergeCellContent(editor, leftTopCellPath, cellPath) {
6623
+ Editor.withoutNormalizing(editor, () => {
6624
+ const { path } = Editor.end(editor, leftTopCellPath);
6625
+ const endRange = Editor.range(editor, Editor.start(editor, cellPath), Editor.end(editor, cellPath));
6626
+ let tableCell;
6627
+ path.pop();
6628
+ const nextPath = Path.next(path);
6629
+ Transforms.moveNodes(editor, {
6630
+ at: endRange,
6631
+ to: nextPath,
6632
+ match: node => {
6633
+ if (Element$1.isElement(node) && node.type === ElementKinds.tableCell) {
6634
+ tableCell = node;
6635
+ }
6636
+ if (Element$1.isElement(node) && node.type && tableCell && tableCell.children.includes(node)) {
6637
+ const isSingleEmptyParagraph = tableCell.children.length === 1 && Editor.isEmpty(editor, node) && node.type === ElementKinds.default;
6638
+ return !isSingleEmptyParagraph && true;
6639
+ }
6640
+ }
6641
+ });
6642
+ });
6643
+ }
6644
+ // 计算合并前的单元格
6645
+ function getCellPositionsBeforeMerge(editor, { row, col }) {
6646
+ const pos = createTablePosition(editor);
6647
+ const { rowspan, colspan } = pos.findCellByPath({ row, col });
6648
+ if (rowspan || colspan) {
6649
+ const colSpan = colspan ?? 1;
6650
+ const rowSpan = rowspan ?? 1;
6651
+ return getCellPositionsFromRange(row, col, row + rowSpan, col + colSpan);
6652
+ }
6653
+ return [{ row, col }];
6654
+ }
6655
+
6450
6656
  const TableEditor = {
6451
6657
  insertTable(editor, optionsParam) {
6452
6658
  const opts = new TableOptions(optionsParam);
@@ -6476,11 +6682,81 @@ const TableEditor = {
6476
6682
  const opts = new TableOptions(optionsParam);
6477
6683
  clearCell(opts, editor, nodeEntry);
6478
6684
  },
6685
+ setCellsBackgroundColor(editor, color, cells) {
6686
+ if (!cells) {
6687
+ cells = TableEditor.getSelectedCells(editor) || [];
6688
+ }
6689
+ if (cells.length) {
6690
+ // 点击自定义颜色面板输入框设置颜色值时,会丢失焦点和选区(目前无法做到焦点同时存在于编辑器和输入框)
6691
+ let location;
6692
+ if (!editor.selection) {
6693
+ const { rangeRef } = THE_EDITOR_PREVIOUS_SELECTION.get(editor);
6694
+ location = rangeRef.current.anchor;
6695
+ }
6696
+ const isHeader = TableEditor.isActiveHeader(editor, location);
6697
+ if (color === 'transparent' ||
6698
+ (color === TableHeaderBackgroundColor && isHeader) ||
6699
+ (color === SpecialBackgroundColor && !isHeader)) {
6700
+ color = null;
6701
+ }
6702
+ Editor.withoutNormalizing(editor, () => {
6703
+ cells.map(cell => {
6704
+ const cellPath = AngularEditor.findPath(editor, cell);
6705
+ Transforms.setNodes(editor, { backgroundColor: color }, { at: cellPath });
6706
+ });
6707
+ });
6708
+ }
6709
+ },
6710
+ mergeCell(editor) {
6711
+ const selectedCellsPosition = TableEditor.getSelectedCellPositions(editor);
6712
+ selectedCellsPosition.length && mergeCell(editor, selectedCellsPosition);
6713
+ },
6714
+ splitCell(editor) {
6715
+ splitCell(editor);
6716
+ },
6717
+ setTableOptions(editor, newOptions) {
6718
+ const tablePosition = createTablePosition(editor);
6719
+ const tablePath = getTablePath(editor);
6720
+ const table = tablePosition.table;
6721
+ const options = { ...table.options, ...newOptions };
6722
+ Transforms.setNodes(editor, { options }, { at: tablePath });
6723
+ },
6724
+ setEquallyColumn(editor) {
6725
+ const [tableEntry] = Editor.nodes(editor, { at: editor.selection, match: (n) => n.type === ElementKinds.table });
6726
+ const tableElement = (tableEntry && tableEntry[0]);
6727
+ if (tableElement) {
6728
+ const columns = tableElement.columns;
6729
+ const sumWidth = columns.reduce((previousValue, currentValue) => {
6730
+ return previousValue + currentValue.width;
6731
+ }, 0);
6732
+ const equalColumns = columns.map(() => {
6733
+ return { width: sumWidth / columns.length };
6734
+ });
6735
+ setNode(editor, { columns: equalColumns }, tableElement);
6736
+ }
6737
+ },
6738
+ clearCellsContent(editor, cells) {
6739
+ if (!cells) {
6740
+ cells = TableEditor.getSelectedCells(editor) || [];
6741
+ }
6742
+ if (cells.length > 0) {
6743
+ const tablePosition = createTablePosition(editor);
6744
+ if (tablePosition.isInTable()) {
6745
+ Editor.withoutNormalizing(editor, () => {
6746
+ cells.forEach(cell => {
6747
+ const path = TheEditor.findPath(editor, cell);
6748
+ TableEditor.clearCell(editor, [cell, path]);
6749
+ });
6750
+ });
6751
+ Transforms.select(editor, Editor.start(editor, tablePosition.cellEntry[1]));
6752
+ }
6753
+ }
6754
+ },
6479
6755
  isActive(editor) {
6480
6756
  const [table] = Editor.nodes(editor, { match: n => Element$1.isElement(n) && n.type === ElementKinds.table });
6481
6757
  return !!table;
6482
6758
  },
6483
- getSelectedCells(editor) {
6759
+ getSelectedCellPositions(editor) {
6484
6760
  const tableNode = getAboveByType(editor, ElementKinds.table);
6485
6761
  if (tableNode) {
6486
6762
  const tableComponent = ELEMENT_TO_COMPONENT.get(tableNode[0]);
@@ -6491,18 +6767,27 @@ const TableEditor = {
6491
6767
  }
6492
6768
  return null;
6493
6769
  },
6494
- setAlign(editor, alignment) {
6770
+ getSelectedCells(editor) {
6771
+ const tableNode = getAboveByType(editor, ElementKinds.table);
6772
+ if (tableNode) {
6773
+ const tableComponent = ELEMENT_TO_COMPONENT.get(tableNode[0]);
6774
+ return tableComponent?.tableStore?.selectedCells || null;
6775
+ }
6776
+ return null;
6777
+ },
6778
+ setAlign(editor, alignment, cells) {
6495
6779
  return TableEditor.handleSelectedCells(editor, (_, cellRange) => {
6496
6780
  Transforms.setNodes(editor, { align: alignment }, {
6497
6781
  at: cellRange,
6498
6782
  match: (n) => ALIGN_BLOCK_TYPES.includes(n.type)
6499
6783
  });
6500
- });
6784
+ }, cells);
6501
6785
  },
6502
- setVerticalAlign(editor, alignment) {
6786
+ setVerticalAlign(editor, alignment, cells) {
6503
6787
  const isSelected = TableEditor.handleSelectedCells(editor, cellPath => {
6504
6788
  Transforms.setNodes(editor, { verticalAlign: alignment }, { at: cellPath });
6505
- });
6789
+ }, cells);
6790
+ console.log(isSelected);
6506
6791
  if (!isSelected) {
6507
6792
  const cellEntry = getAboveByType(editor, ElementKinds.tableCell);
6508
6793
  if (cellEntry) {
@@ -6518,7 +6803,7 @@ const TableEditor = {
6518
6803
  return true;
6519
6804
  },
6520
6805
  isVerticalAlignActive(editor, alignment) {
6521
- const cells = TableEditor.getSelectedCells(editor);
6806
+ const cells = TableEditor.getSelectedCellPositions(editor);
6522
6807
  if (cells) {
6523
6808
  const lastCell = cells[cells.length - 1];
6524
6809
  const tableNode = getAboveByType(editor, ElementKinds.table);
@@ -6574,17 +6859,17 @@ const TableEditor = {
6574
6859
  setMarks(editor, marks, cellRange);
6575
6860
  });
6576
6861
  },
6577
- handleSelectedCells(editor, handle) {
6578
- const cells = TableEditor.getSelectedCells(editor);
6862
+ handleSelectedCells(editor, handle, cells) {
6863
+ if (!cells) {
6864
+ cells = TableEditor.getSelectedCells(editor);
6865
+ }
6579
6866
  if (cells) {
6580
- const tableNode = getAboveByType(editor, ElementKinds.table);
6581
6867
  Editor.withoutNormalizing(editor, () => {
6582
- for (const cell of cells) {
6583
- const { row, col } = cell;
6584
- const cellPath = [...tableNode[1], row, col];
6868
+ cells.forEach(cell => {
6869
+ const cellPath = TheEditor.findPath(editor, cell);
6585
6870
  const cellRange = { anchor: Editor.start(editor, cellPath), focus: Editor.end(editor, cellPath) };
6586
6871
  handle(cellPath, cellRange);
6587
- }
6872
+ });
6588
6873
  });
6589
6874
  return true;
6590
6875
  }
@@ -6618,14 +6903,14 @@ const TableEditor = {
6618
6903
  match: n => Element$1.isElement(n) &&
6619
6904
  ((n.type === ElementKinds.tableRow && n.header) || (n.type === ElementKinds.table && n.options?.headerRow))
6620
6905
  });
6621
- const selectedCells = TableEditor.getSelectedCells(editor) ?? [];
6906
+ const selectedCells = TableEditor.getSelectedCellPositions(editor) ?? [];
6622
6907
  sortCell(selectedCells);
6623
6908
  const isContainHeaderRow = !!selectedCells && selectedCells[0].row === 0;
6624
6909
  return isHeaderRow && isContainHeaderRow;
6625
6910
  },
6626
6911
  hasHeaderColumnCell(editor) {
6627
6912
  const table = getAboveByType(editor, ElementKinds.table);
6628
- const selectedCells = TableEditor.getSelectedCells(editor) ?? [];
6913
+ const selectedCells = TableEditor.getSelectedCellPositions(editor) ?? [];
6629
6914
  sortCell(selectedCells);
6630
6915
  const isContainHeaderColumn = !!selectedCells && selectedCells[0].col === 0;
6631
6916
  const isHeaderColumn = table && table[0] && table[0]?.options?.headerColumn;
@@ -7225,7 +7510,7 @@ class TheCodeComponent extends TheBaseElementComponent {
7225
7510
  this.onChangeLanguage = item => {
7226
7511
  this.options = { ...this.options, mode: item.key };
7227
7512
  this.activeLanguage = item;
7228
- CodeEditor.setCodeAttribute(this.editor, this.element, { language: item.key });
7513
+ CodeEditor.setCodeAttribute(this.editor, { language: item.key }, this.element);
7229
7514
  };
7230
7515
  }
7231
7516
  onContextChange() {
@@ -7346,10 +7631,11 @@ class TheCodeComponent extends TheBaseElementComponent {
7346
7631
  }
7347
7632
  codeChange($event) {
7348
7633
  this.isHightLight = false;
7349
- CodeEditor.setCodeAttribute(this.editor, this.element, { content: $event });
7634
+ CodeEditor.setCodeAttribute(this.editor, { content: $event }, this.element);
7350
7635
  }
7351
7636
  onDelete(event) {
7352
- deleteElement(this.editor, this.element);
7637
+ event.preventDefault();
7638
+ CodeEditor.removeCode(this.editor, this.element);
7353
7639
  }
7354
7640
  onCopy(event) {
7355
7641
  event.preventDefault();
@@ -7387,19 +7673,19 @@ class TheCodeComponent extends TheBaseElementComponent {
7387
7673
  }
7388
7674
  onEndResize() {
7389
7675
  Transforms.select(this.editor, AngularEditor.findPath(this.editor, this.element));
7390
- CodeEditor.setCodeAttribute(this.editor, this.element, { height: this.resizeHeight });
7676
+ CodeEditor.setCodeAttribute(this.editor, { height: this.resizeHeight }, this.element);
7391
7677
  }
7392
7678
  onChangeWrap(value) {
7393
7679
  this.isHightLight = false;
7394
7680
  this.options = { ...this.options, lineWrapping: value || false };
7395
- CodeEditor.setCodeAttribute(this.editor, this.element, { autoWrap: value ? value : null });
7681
+ CodeEditor.setCodeAttribute(this.editor, { autoWrap: value ? value : null }, this.element);
7396
7682
  }
7397
7683
  ngOnDestroy() {
7398
7684
  this.destroy$.next();
7399
7685
  this.destroy$.complete();
7400
7686
  }
7401
7687
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: TheCodeComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1$2.ThyNotifyService }, { token: TheContextService }, { token: i0.NgZone }, { token: i1$1.ThyPopover }, { token: i0.ViewContainerRef }, { token: i2$1.Overlay }], target: i0.ɵɵFactoryTarget.Component }); }
7402
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.4", type: TheCodeComponent, selector: "div[theCode]", viewQueries: [{ propertyName: "toolbar", first: true, predicate: ["toolbar"], descendants: true, read: TemplateRef, static: true }, { propertyName: "codemirror", first: true, predicate: ["codemirror"], descendants: true, read: CodeMirrorComponent }, { propertyName: "toolbarDropdownComponent", first: true, predicate: TheToolbarDropdownComponent, descendants: true, read: TheToolbarDropdownComponent }], usesInheritance: true, ngImport: i0, template: "<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: isCollapsedAndNonReadonly, readonly: options.readOnly, active: isHightLight && isCollapsedAndNonReadonly }\"\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=\"isCollapsedAndNonReadonly\"></thy-resize-handle>\n</div>\n\n<ng-template #toolbar>\n <thy-actions thySize=\"xxs\" thePreventDefault>\n <the-toolbar-dropdown\n [menus]=\"menus\"\n [toolbarItem]=\"activeLanguage\"\n [dropdownItemKey]=\"activeLanguage?.key\"\n [itemMousedownHandle]=\"onChangeLanguage\"\n >\n </the-toolbar-dropdown>\n <span class=\"auto-wrap d-flex align-items-center px-2 text-secondary\">\n <span>\u81EA\u52A8\u6362\u884C</span>\n <thy-switch\n class=\"auto-wrap-btn d-flex ml-1\"\n [(ngModel)]=\"options.lineWrapping\"\n (ngModelChange)=\"onChangeWrap($event)\"\n thySize=\"sm\"\n ></thy-switch>\n </span>\n <a href=\"javascript:;\" thyAction thyActionIcon=\"copy\" thyTooltip=\"\u590D\u5236\" thyTooltipPlacement=\"top\" (click)=\"onCopy($event)\"></a>\n <thy-divider class=\"mr-2 ml-1 align-self-center\" [thyVertical]=\"true\" thyColor=\"light\"></thy-divider>\n <a\n href=\"javascript:;\"\n thyAction\n thyType=\"danger\"\n thyActionIcon=\"trash\"\n thyTooltip=\"\u5220\u9664\"\n thyTooltipPlacement=\"top\"\n (click)=\"onDelete($event)\"\n ></a>\n </thy-actions>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i1.SlateChildren, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { kind: "directive", type: i2$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i8.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { kind: "directive", type: i9.ThyResizableDirective, selector: "[thyResizable]", inputs: ["thyBounds", "thyMaxHeight", "thyMaxWidth", "thyMinHeight", "thyMinWidth", "thyGridColumnCount", "thyMaxColumn", "thyMinColumn", "thyLockAspectRatio", "thyPreview", "thyDisabled"], outputs: ["thyResize", "thyResizeStart", "thyResizeEnd"] }, { kind: "component", type: i9.ThyResizeHandleComponent, selector: "thy-resize-handle, [thy-resize-handle]", inputs: ["thyDirection", "thyLine"], outputs: ["thyMouseDown"], exportAs: ["thyResizeHandle"] }, { kind: "component", type: i10$1.ThySwitchComponent, selector: "thy-switch", inputs: ["thyType", "thySize", "thyDisabled"], outputs: ["thyChange"] }, { kind: "component", type: i7.ThyActionComponent, selector: "thy-action, [thyAction]", inputs: ["thyType", "thyIcon", "thyActionIcon", "thyActive", "thyActionActive", "thyTheme", "thyHoverIcon", "thyDisabled"] }, { kind: "component", type: i7.ThyActionsComponent, selector: "thy-actions", inputs: ["thySize"] }, { kind: "component", type: i8$1.ThyDividerComponent, selector: "thy-divider", inputs: ["thyVertical", "thyStyle", "thyColor", "thyText", "thyTextDirection", "thyDeeper"] }, { kind: "component", type: i13.CodeMirrorComponent, selector: "ng-codemirror, [ngCodeMirror]", inputs: ["autoMaxHeight", "options", "delayRefreshTime"], outputs: ["focusChange"] }, { kind: "component", type: TheToolbarDropdownComponent, selector: "the-toolbar-dropdown" }, { kind: "directive", type: ThePreventDefaultDirective, selector: "[thePreventDefault]", exportAs: ["thePreventDefault"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
7688
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.4", type: TheCodeComponent, selector: "div[theCode]", viewQueries: [{ propertyName: "toolbar", first: true, predicate: ["toolbar"], descendants: true, read: TemplateRef, static: true }, { propertyName: "codemirror", first: true, predicate: ["codemirror"], descendants: true, read: CodeMirrorComponent }, { propertyName: "toolbarDropdownComponent", first: true, predicate: TheToolbarDropdownComponent, descendants: true, read: TheToolbarDropdownComponent }], usesInheritance: true, ngImport: i0, template: "<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: isCollapsedAndNonReadonly, readonly: options.readOnly, active: isHightLight && isCollapsedAndNonReadonly }\"\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=\"isCollapsedAndNonReadonly\"></thy-resize-handle>\n</div>\n\n<ng-template #toolbar>\n <thy-actions thySize=\"xxs\" thePreventDefault>\n <the-toolbar-dropdown\n [menus]=\"menus\"\n [toolbarItem]=\"activeLanguage\"\n [dropdownItemKey]=\"activeLanguage?.key\"\n [itemMousedownHandle]=\"onChangeLanguage\"\n >\n </the-toolbar-dropdown>\n <span class=\"auto-wrap d-flex align-items-center px-2 text-secondary\">\n <span>\u81EA\u52A8\u6362\u884C</span>\n <thy-switch\n class=\"auto-wrap-btn d-flex ml-1\"\n [(ngModel)]=\"options.lineWrapping\"\n (ngModelChange)=\"onChangeWrap($event)\"\n thySize=\"sm\"\n ></thy-switch>\n </span>\n <a href=\"javascript:;\" thyAction thyActionIcon=\"copy\" thyTooltip=\"\u590D\u5236\" thyTooltipPlacement=\"top\" (click)=\"onCopy($event)\"></a>\n <thy-divider class=\"mr-2 ml-1 align-self-center\" [thyVertical]=\"true\" thyColor=\"light\"></thy-divider>\n <a\n href=\"javascript:;\"\n thyAction\n thyType=\"danger\"\n thyActionIcon=\"trash\"\n thyTooltip=\"\u5220\u9664\"\n thyTooltipPlacement=\"top\"\n (click)=\"onDelete($event)\"\n ></a>\n </thy-actions>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i1.SlateChildren, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { kind: "directive", type: i2$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i8.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { kind: "directive", type: i9.ThyResizableDirective, selector: "[thyResizable]", inputs: ["thyBounds", "thyMaxHeight", "thyMaxWidth", "thyMinHeight", "thyMinWidth", "thyGridColumnCount", "thyMaxColumn", "thyMinColumn", "thyLockAspectRatio", "thyPreview", "thyDisabled"], outputs: ["thyResize", "thyResizeStart", "thyResizeEnd"] }, { kind: "component", type: i9.ThyResizeHandleComponent, selector: "thy-resize-handle, [thy-resize-handle]", inputs: ["thyDirection", "thyLine"], outputs: ["thyMouseDown"], exportAs: ["thyResizeHandle"] }, { kind: "component", type: i10$1.ThySwitchComponent, selector: "thy-switch", inputs: ["thyType", "thySize", "thyDisabled", "thyLoading"], outputs: ["thyChange"] }, { kind: "component", type: i7.ThyActionComponent, selector: "thy-action, [thyAction]", inputs: ["thyType", "thyIcon", "thyActionIcon", "thyActive", "thyActionActive", "thyTheme", "thyHoverIcon", "thyDisabled"] }, { kind: "component", type: i7.ThyActionsComponent, selector: "thy-actions", inputs: ["thySize"] }, { kind: "component", type: i8$1.ThyDividerComponent, selector: "thy-divider", inputs: ["thyVertical", "thyStyle", "thyColor", "thyText", "thyTextDirection", "thyDeeper"] }, { kind: "component", type: i13.CodeMirrorComponent, selector: "ng-codemirror, [ngCodeMirror]", inputs: ["autoMaxHeight", "options", "delayRefreshTime"], outputs: ["focusChange"] }, { kind: "component", type: TheToolbarDropdownComponent, selector: "the-toolbar-dropdown" }, { kind: "directive", type: ThePreventDefaultDirective, selector: "[thePreventDefault]", exportAs: ["thePreventDefault"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
7403
7689
  }
7404
7690
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: TheCodeComponent, decorators: [{
7405
7691
  type: Component,
@@ -7513,7 +7799,7 @@ class TheColorToolbarItemComponent extends TheBaseToolbarItem {
7513
7799
  ColorEditor.setColor(this.editor, this.selectedColor, this.type);
7514
7800
  }
7515
7801
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: TheColorToolbarItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
7516
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.4", type: TheColorToolbarItemComponent, selector: "the-color-toolbar-item", host: { classAttribute: "the-toolbar-item" }, usesInheritance: true, ngImport: i0, template: "<a\n href=\"javascript:;\"\n thyAction\n [thyActionActive]=\"active\"\n [thyTooltip]=\"toolbarItem.name\"\n thyTooltipPlacement=\"top\"\n thyColorPicker\n thyPlacement=\"bottomLeft\"\n [(ngModel)]=\"selectedColor\"\n (ngModelChange)=\"changeColor($event)\"\n (mousedown)=\"preventDefault($event)\"\n>\n <thy-icon\n [thyIconName]=\"toolbarItem.icon\"\n thyIconType=\"twotone\"\n [thyTwotoneColor]=\"active ?? (toolbarItem.key === 'color' ? defaultColorLine : defaultBackgroundColorLine)\"\n ></thy-icon>\n <thy-icon class=\"link-down-icon font-size-sm text-desc ml-1\" thyIconName=\"caret-down\"></thy-icon>\n</a>\n", dependencies: [{ kind: "directive", type: i2$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i4.ThyIconComponent, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { kind: "directive", type: i8.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { kind: "component", type: i7.ThyActionComponent, selector: "thy-action, [thyAction]", inputs: ["thyType", "thyIcon", "thyActionIcon", "thyActive", "thyActionActive", "thyTheme", "thyHoverIcon", "thyDisabled"] }, { kind: "directive", type: i5.ThyColorPickerDirective, selector: "[thyColorPicker]", inputs: ["thyOffset", "thyHasBackdrop", "thyDefaultColor", "thyTransparentColorSelectable", "thyPresetColors", "thyPlacement", "thyTrigger", "thyShowDelay", "thyHideDelay"], outputs: ["thyPanelOpen", "thyPanelClose"] }] }); }
7802
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.4", type: TheColorToolbarItemComponent, selector: "the-color-toolbar-item", host: { classAttribute: "the-toolbar-item" }, usesInheritance: true, ngImport: i0, template: "<a\n href=\"javascript:;\"\n thyAction\n [thyActionActive]=\"active\"\n [thyTooltip]=\"toolbarItem.name\"\n thyTooltipPlacement=\"top\"\n thyColorPicker\n thyPlacement=\"bottomLeft\"\n [(ngModel)]=\"selectedColor\"\n (ngModelChange)=\"changeColor($event)\"\n (mousedown)=\"preventDefault($event)\"\n>\n <thy-icon\n [thyIconName]=\"toolbarItem.icon\"\n thyIconType=\"twotone\"\n [thyTwotoneColor]=\"active ?? (toolbarItem.key === 'color' ? defaultColorLine : defaultBackgroundColorLine)\"\n ></thy-icon>\n <thy-icon class=\"link-down-icon font-size-sm text-desc ml-1\" thyIconName=\"caret-down\"></thy-icon>\n</a>\n", dependencies: [{ kind: "directive", type: i2$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i4.ThyIconComponent, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { kind: "directive", type: i8.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { kind: "component", type: i7.ThyActionComponent, selector: "thy-action, [thyAction]", inputs: ["thyType", "thyIcon", "thyActionIcon", "thyActive", "thyActionActive", "thyTheme", "thyHoverIcon", "thyDisabled"] }, { kind: "directive", type: i5.ThyColorPickerDirective, selector: "[thyColorPicker]", inputs: ["thyOffset", "thyHasBackdrop", "thyDefaultColor", "thyTransparentColorSelectable", "thyPresetColors", "thyPlacement", "thyTrigger", "thyShowDelay", "thyHideDelay", "thyDisabled"], outputs: ["thyPanelOpen", "thyPanelClose"] }] }); }
7517
7803
  }
7518
7804
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: TheColorToolbarItemComponent, decorators: [{
7519
7805
  type: Component,
@@ -8948,8 +9234,7 @@ class TheImageComponent extends TheBaseElementComponent {
8948
9234
  width = maxWidth;
8949
9235
  // clear `layout` when the image is adjusted to the maximum value under rich media
8950
9236
  if (this.imageEntry?.layout) {
8951
- const path = findPath(this.editor, this.element);
8952
- ImageEditor.setImageNode(this.editor, path, { layout: undefined });
9237
+ ImageEditor.setImageNode(this.editor, { layout: undefined }, this.element);
8953
9238
  }
8954
9239
  }
8955
9240
  if (width <= 100) {
@@ -9039,10 +9324,9 @@ class TheImageComponent extends TheBaseElementComponent {
9039
9324
  const { layout, align } = this.imageEntry;
9040
9325
  return key && ((key === align && !layout) || key === layout);
9041
9326
  }
9042
- setImageNode(e, partial) {
9327
+ setImageNode(e, props) {
9043
9328
  e.preventDefault();
9044
- const path = findPath(this.editor, this.element);
9045
- ImageEditor.setImageNode(this.editor, path, partial);
9329
+ ImageEditor.setImageNode(this.editor, props, this.element);
9046
9330
  }
9047
9331
  setBlockCardLayoutAttr() {
9048
9332
  Promise.resolve().then(() => {
@@ -9060,7 +9344,7 @@ class TheImageComponent extends TheBaseElementComponent {
9060
9344
  }
9061
9345
  onDelete(event) {
9062
9346
  event.preventDefault();
9063
- deleteElement(this.editor, this.element);
9347
+ ImageEditor.removeImage(this.editor, this.element);
9064
9348
  }
9065
9349
  createPositionStrategy() {
9066
9350
  const bottomPosition = {
@@ -9167,7 +9451,7 @@ const createImagePlugin = createPluginFactory({
9167
9451
  icon: 'image',
9168
9452
  name: '图片',
9169
9453
  execute: editor => ImageEditor.openUpload(editor),
9170
- active: editor => ImageEditor.isImageActive(editor)
9454
+ active: editor => ImageEditor.isActive(editor)
9171
9455
  }
9172
9456
  ],
9173
9457
  menuItems: [
@@ -9175,7 +9459,7 @@ const createImagePlugin = createPluginFactory({
9175
9459
  key: ElementKinds.image,
9176
9460
  keywords: 'tp,tupian,image,photo,picture,图片',
9177
9461
  execute: editor => ImageEditor.openUpload(editor),
9178
- active: editor => ImageEditor.isImageActive(editor),
9462
+ active: editor => ImageEditor.isActive(editor),
9179
9463
  name: '图片',
9180
9464
  menuIcon: PluginMenuIcons.image,
9181
9465
  description: '支持 jpg、jpeg 等格式图像',
@@ -9471,17 +9755,7 @@ class TheLinkEditComponent {
9471
9755
  applyLink(form) {
9472
9756
  const link = this.link.trim();
9473
9757
  if (isUrl(link)) {
9474
- const linkPath = findPath(this.editor, this.node);
9475
- if (this.originLink !== link) {
9476
- Transforms.setNodes(this.editor, { url: link }, { at: linkPath });
9477
- }
9478
- if (this.originText !== this.text) {
9479
- const [start, end] = Editor.edges(this.editor, linkPath);
9480
- Transforms.insertText(this.editor, this.text, { at: { anchor: end, focus: end } });
9481
- Transforms.delete(this.editor, { at: { anchor: start, focus: end } });
9482
- }
9483
- TheEditor.focus(this.editor);
9484
- Transforms.select(this.editor, Editor.after(this.editor, linkPath));
9758
+ LinkEditor.updateLink(this.editor, this.node, link, this.text);
9485
9759
  this.closePopover(LinkCloseTypes.apply);
9486
9760
  }
9487
9761
  else {
@@ -9581,7 +9855,7 @@ class TheBaseLinkComponent extends TheBaseElementComponent {
9581
9855
  this.openLinkEdit(LinkTags.edit);
9582
9856
  },
9583
9857
  deleteHandle: () => {
9584
- Transforms.unwrapNodes(this.editor, { match: n => Element$1.isElement(n) && n.type === ElementKinds.link });
9858
+ LinkEditor.unwrapLink(this.editor);
9585
9859
  this.closeHoverPopover();
9586
9860
  }
9587
9861
  },
@@ -9711,7 +9985,7 @@ const createLinkPlugin = createPluginFactory({
9711
9985
  icon: 'link-insert',
9712
9986
  name: '链接',
9713
9987
  execute: editor => LinkEditor.insertLink(editor),
9714
- active: editor => LinkEditor.isLinkActive(editor)
9988
+ active: editor => LinkEditor.isActive(editor)
9715
9989
  }
9716
9990
  ],
9717
9991
  menuItems: [
@@ -9720,7 +9994,7 @@ const createLinkPlugin = createPluginFactory({
9720
9994
  keywords: 'lj,lianjie,link,链接',
9721
9995
  description: '支持插入链接',
9722
9996
  execute: editor => LinkEditor.insertLink(editor),
9723
- active: editor => LinkEditor.isLinkActive(editor),
9997
+ active: editor => LinkEditor.isActive(editor),
9724
9998
  type: ThePluginMenuItemType.icon,
9725
9999
  name: '链接',
9726
10000
  displayKey: '/lj',
@@ -11510,7 +11784,7 @@ class TheContextMenuComponent {
11510
11784
  }
11511
11785
  ngOnInit() { }
11512
11786
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: TheContextMenuComponent, deps: [{ token: i0.ElementRef }, { token: i1$1.ThyPopoverRef }], target: i0.ɵɵFactoryTarget.Component }); }
11513
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.4", type: TheContextMenuComponent, selector: "the-contextmenu", inputs: { menuEntities: "menuEntities", actionHandle: "actionHandle", activeHandle: "activeHandle", deactivateHandle: "deactivateHandle" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)", "mousedown": "handleMouseDown($event)" }, properties: { "class.the-overlay-menu-wrap": "this.wrap" } }, ngImport: i0, template: "<div class=\"thy-dropdown-menu\">\n <ng-container *ngFor=\"let menuItem of menuEntities\">\n <ng-container *ngIf=\"menuItem.visibility && !menuItem?.isInputNumber && menuItem.key !== 'background-color'\">\n <ng-template [ngTemplateOutlet]=\"defaultMenuTemplate\" [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"></ng-template>\n </ng-container>\n <ng-container *ngIf=\"menuItem.visibility && menuItem.key === 'background-color'\">\n <ng-template [ngTemplateOutlet]=\"backgroundColorTemplate\" [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"></ng-template>\n </ng-container>\n <ng-container *ngIf=\"menuItem.visibility && menuItem?.isInputNumber\">\n <ng-template [ngTemplateOutlet]=\"inputNumberMenuTemplate\" [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"></ng-template>\n </ng-container>\n <thy-dropdown-menu-divider *ngIf=\"menuItem.divider && menuItem.visibility\"></thy-dropdown-menu-divider>\n </ng-container>\n</div>\n\n<ng-template #defaultMenuTemplate let-item>\n <a\n href=\"javascript:;\"\n thyDropdownMenuItem\n (mousedown)=\"itemMousedown($event, item)\"\n (mouseenter)=\"itemMouseenter($event, item)\"\n (mouseleave)=\"itemMouseleave($event, item)\"\n >\n <span thyDropdownMenuItemIcon>\n <thy-icon [thyIconName]=\"item.icon\"></thy-icon>\n </span>\n <span thyDropdownMenuItemName>{{ item.name }}</span>\n <span *ngIf=\"item.extendIcon\" thyDropdownMenuItemExtendIcon>\n <thy-icon thyIconName=\"{{ item.extendIcon }}\"></thy-icon>\n </span>\n </a>\n</ng-template>\n\n<ng-template #backgroundColorTemplate let-item>\n <a\n href=\"javascript:;\"\n thyDropdownMenuItem\n thyColorPicker\n thyTrigger=\"hover\"\n thyPlacement=\"rightTop\"\n [(ngModel)]=\"item.backgroundColor\"\n (ngModelChange)=\"changeColor($event, item)\"\n [thyHasBackdrop]=\"false\"\n >\n <span thyDropdownMenuItemIcon>\n <thy-icon [thyIconName]=\"item.icon\" thyIconType=\"twotone\" [thyTwotoneColor]=\"item.backgroundColor\"></thy-icon>\n </span>\n <span thyDropdownMenuItemName>{{ item.name }}</span>\n <span *ngIf=\"item.extendIcon\" thyDropdownMenuItemExtendIcon>\n <thy-icon thyIconName=\"{{ item.extendIcon }}\"></thy-icon>\n </span>\n </a>\n</ng-template>\n\n<ng-template #inputNumberMenuTemplate let-item>\n <a href=\"javascript:;\" class=\"the-input-number-menu\" thyDropdownMenuItem (click)=\"itemMousedown($event, item)\">\n <span thyDropdownMenuItemIcon>\n <thy-icon [thyIconName]=\"item.icon\"></thy-icon>\n </span>\n <span thyDropdownMenuItemName class=\"d-flex align-items-center\">\n {{ item.name }}\n <thy-input-number\n #inputNumber\n class=\"mx-2\"\n thySize=\"sm\"\n [(ngModel)]=\"item.count\"\n [thyStep]=\"1\"\n [thyMin]=\"1\"\n (click)=\"inputNumberFocus($event)\"\n (thyEnter)=\"itemEnterHandle($event, item)\"\n thyStopPropagation\n ></thy-input-number>\n {{ item.nameSuffix }}\n </span>\n </a>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i4.ThyIconComponent, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { kind: "directive", type: i5$1.ThyEnterDirective, selector: "[thyEnter]", outputs: ["thyEnter"] }, { kind: "directive", type: i5$1.ThyStopPropagationDirective, selector: "[thyStopPropagation]", inputs: ["thyStopPropagation"] }, { kind: "component", type: i6.ThyDropdownMenuDividerComponent, selector: "thy-dropdown-menu-divider" }, { kind: "directive", type: i6.ThyDropdownMenuItemDirective, selector: "[thyDropdownMenuItem]", inputs: ["thyType", "thyDisabled"] }, { kind: "directive", type: i6.ThyDropdownMenuItemNameDirective, selector: "[thyDropdownMenuItemName]" }, { kind: "directive", type: i6.ThyDropdownMenuItemIconDirective, selector: "[thyDropdownMenuItemIcon]" }, { kind: "directive", type: i6.ThyDropdownMenuItemExtendIconDirective, selector: "[thyDropdownMenuItemExtendIcon]" }, { kind: "component", type: i7$1.ThyInputNumberComponent, selector: "thy-input-number", inputs: ["thyAutoFocus", "thyPlaceholder", "thyDisabled", "thyMax", "thyMin", "thyStep", "thySize", "thyPrecision", "thySuffix"], outputs: ["thyBlur", "thyFocus"] }, { kind: "directive", type: i5.ThyColorPickerDirective, selector: "[thyColorPicker]", inputs: ["thyOffset", "thyHasBackdrop", "thyDefaultColor", "thyTransparentColorSelectable", "thyPresetColors", "thyPlacement", "thyTrigger", "thyShowDelay", "thyHideDelay"], outputs: ["thyPanelOpen", "thyPanelClose"] }] }); }
11787
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.4", type: TheContextMenuComponent, selector: "the-contextmenu", inputs: { menuEntities: "menuEntities", actionHandle: "actionHandle", activeHandle: "activeHandle", deactivateHandle: "deactivateHandle" }, host: { listeners: { "document: mousedown": "handleDocumentMouseDown($event)", "mousedown": "handleMouseDown($event)" }, properties: { "class.the-overlay-menu-wrap": "this.wrap" } }, ngImport: i0, template: "<div class=\"thy-dropdown-menu\">\n <ng-container *ngFor=\"let menuItem of menuEntities\">\n <ng-container *ngIf=\"menuItem.visibility && !menuItem?.isInputNumber && menuItem.key !== 'background-color'\">\n <ng-template [ngTemplateOutlet]=\"defaultMenuTemplate\" [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"></ng-template>\n </ng-container>\n <ng-container *ngIf=\"menuItem.visibility && menuItem.key === 'background-color'\">\n <ng-template [ngTemplateOutlet]=\"backgroundColorTemplate\" [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"></ng-template>\n </ng-container>\n <ng-container *ngIf=\"menuItem.visibility && menuItem?.isInputNumber\">\n <ng-template [ngTemplateOutlet]=\"inputNumberMenuTemplate\" [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"></ng-template>\n </ng-container>\n <thy-dropdown-menu-divider *ngIf=\"menuItem.divider && menuItem.visibility\"></thy-dropdown-menu-divider>\n </ng-container>\n</div>\n\n<ng-template #defaultMenuTemplate let-item>\n <a\n href=\"javascript:;\"\n thyDropdownMenuItem\n (mousedown)=\"itemMousedown($event, item)\"\n (mouseenter)=\"itemMouseenter($event, item)\"\n (mouseleave)=\"itemMouseleave($event, item)\"\n >\n <span thyDropdownMenuItemIcon>\n <thy-icon [thyIconName]=\"item.icon\"></thy-icon>\n </span>\n <span thyDropdownMenuItemName>{{ item.name }}</span>\n <span *ngIf=\"item.extendIcon\" thyDropdownMenuItemExtendIcon>\n <thy-icon thyIconName=\"{{ item.extendIcon }}\"></thy-icon>\n </span>\n </a>\n</ng-template>\n\n<ng-template #backgroundColorTemplate let-item>\n <a\n href=\"javascript:;\"\n thyDropdownMenuItem\n thyColorPicker\n thyTrigger=\"hover\"\n thyPlacement=\"rightTop\"\n [(ngModel)]=\"item.backgroundColor\"\n (ngModelChange)=\"changeColor($event, item)\"\n [thyHasBackdrop]=\"false\"\n >\n <span thyDropdownMenuItemIcon>\n <thy-icon [thyIconName]=\"item.icon\" thyIconType=\"twotone\" [thyTwotoneColor]=\"item.backgroundColor\"></thy-icon>\n </span>\n <span thyDropdownMenuItemName>{{ item.name }}</span>\n <span *ngIf=\"item.extendIcon\" thyDropdownMenuItemExtendIcon>\n <thy-icon thyIconName=\"{{ item.extendIcon }}\"></thy-icon>\n </span>\n </a>\n</ng-template>\n\n<ng-template #inputNumberMenuTemplate let-item>\n <a href=\"javascript:;\" class=\"the-input-number-menu\" thyDropdownMenuItem (click)=\"itemMousedown($event, item)\">\n <span thyDropdownMenuItemIcon>\n <thy-icon [thyIconName]=\"item.icon\"></thy-icon>\n </span>\n <span thyDropdownMenuItemName class=\"d-flex align-items-center\">\n {{ item.name }}\n <thy-input-number\n #inputNumber\n class=\"mx-2\"\n thySize=\"sm\"\n [(ngModel)]=\"item.count\"\n [thyStep]=\"1\"\n [thyMin]=\"1\"\n (click)=\"inputNumberFocus($event)\"\n (thyEnter)=\"itemEnterHandle($event, item)\"\n thyStopPropagation\n ></thy-input-number>\n {{ item.nameSuffix }}\n </span>\n </a>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i4.ThyIconComponent, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { kind: "directive", type: i5$1.ThyEnterDirective, selector: "[thyEnter]", outputs: ["thyEnter"] }, { kind: "directive", type: i5$1.ThyStopPropagationDirective, selector: "[thyStopPropagation]", inputs: ["thyStopPropagation"] }, { kind: "component", type: i6.ThyDropdownMenuDividerComponent, selector: "thy-dropdown-menu-divider" }, { kind: "directive", type: i6.ThyDropdownMenuItemDirective, selector: "[thyDropdownMenuItem]", inputs: ["thyType", "thyDisabled"] }, { kind: "directive", type: i6.ThyDropdownMenuItemNameDirective, selector: "[thyDropdownMenuItemName]" }, { kind: "directive", type: i6.ThyDropdownMenuItemIconDirective, selector: "[thyDropdownMenuItemIcon]" }, { kind: "directive", type: i6.ThyDropdownMenuItemExtendIconDirective, selector: "[thyDropdownMenuItemExtendIcon]" }, { kind: "component", type: i7$1.ThyInputNumberComponent, selector: "thy-input-number", inputs: ["thyAutoFocus", "thyPlaceholder", "thyDisabled", "thyMax", "thyMin", "thyStep", "thySize", "thyPrecision", "thySuffix"], outputs: ["thyBlur", "thyFocus"] }, { kind: "directive", type: i5.ThyColorPickerDirective, selector: "[thyColorPicker]", inputs: ["thyOffset", "thyHasBackdrop", "thyDefaultColor", "thyTransparentColorSelectable", "thyPresetColors", "thyPlacement", "thyTrigger", "thyShowDelay", "thyHideDelay", "thyDisabled"], outputs: ["thyPanelOpen", "thyPanelClose"] }] }); }
11514
11788
  }
11515
11789
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: TheContextMenuComponent, decorators: [{
11516
11790
  type: Component,
@@ -11534,133 +11808,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImpor
11534
11808
  args: ['mousedown', ['$event']]
11535
11809
  }] } });
11536
11810
 
11537
- function isSelectedCellMerged(editor) {
11538
- if (editor && editor.selection) {
11539
- const opts = new TableOptions();
11540
- const { anchor } = editor.selection;
11541
- const { cell } = TablePosition.create(opts, editor, anchor.path);
11542
- if (cell) {
11543
- return (cell.colspan && cell.colspan !== 1) || (cell.rowspan && cell.rowspan !== 1);
11544
- }
11545
- }
11546
- return false;
11547
- }
11548
- function getLeftCellDict(selectCellNodes) {
11549
- return selectCellNodes.reduce((dict, cell) => {
11550
- if (!dict[cell.row]) {
11551
- dict[cell.row] = cell;
11552
- }
11553
- return dict;
11554
- }, {});
11555
- }
11556
- function calculateCellSpan(selectCellNodes, leftCellDict) {
11557
- let rowspan = 0, colspan = 0, crossCount = -1;
11558
- selectCellNodes
11559
- .filter(item => !item.node.hidden)
11560
- .forEach(item => {
11561
- const { row } = item;
11562
- if (item.row === selectCellNodes[0].row) {
11563
- colspan += item.node.colspan || 1;
11564
- }
11565
- const maxRowSpan = leftCellDict[row].maxRowSpan || 1;
11566
- leftCellDict[row].maxRowSpan = (item.node.rowspan || 1) > maxRowSpan ? item.node.rowspan : maxRowSpan;
11567
- });
11568
- Object.values(leftCellDict).forEach((item) => {
11569
- const { row, maxRowSpan } = item;
11570
- if (crossCount < row) {
11571
- rowspan += maxRowSpan;
11572
- crossCount = row + maxRowSpan - 1;
11573
- }
11574
- });
11575
- return { rowspan, colspan };
11576
- }
11577
- function mergeCell(editor, selectedCells) {
11578
- sortCell(selectedCells);
11579
- const selectCellNodes = getSelectCellNode(editor, selectedCells);
11580
- Editor.withoutNormalizing(editor, () => {
11581
- let leftTopCellPath;
11582
- const leftCellDict = getLeftCellDict(selectCellNodes);
11583
- selectCellNodes.forEach((cell, index) => {
11584
- const { row, node } = cell;
11585
- if (node) {
11586
- const cellPath = findPath(editor, node);
11587
- if (index === 0) {
11588
- leftTopCellPath = cellPath;
11589
- }
11590
- else {
11591
- mergeCellContent(editor, leftTopCellPath, cellPath);
11592
- Transforms.setNodes(editor, { colspan: null, rowspan: null, hidden: true }, { at: cellPath });
11593
- }
11594
- }
11595
- });
11596
- let { rowspan, colspan } = calculateCellSpan(selectCellNodes, leftCellDict);
11597
- Transforms.setNodes(editor, { rowspan, colspan }, { at: leftTopCellPath });
11598
- Transforms.select(editor, leftTopCellPath);
11599
- Transforms.collapse(editor, { edge: 'end' });
11600
- });
11601
- }
11602
- function mergeCellContent(editor, leftTopCellPath, cellPath) {
11603
- Editor.withoutNormalizing(editor, () => {
11604
- const { path } = Editor.end(editor, leftTopCellPath);
11605
- const endRange = Editor.range(editor, Editor.start(editor, cellPath), Editor.end(editor, cellPath));
11606
- let tableCell;
11607
- path.pop();
11608
- const nextPath = Path.next(path);
11609
- Transforms.moveNodes(editor, {
11610
- at: endRange,
11611
- to: nextPath,
11612
- match: node => {
11613
- if (Element$1.isElement(node) && node.type === ElementKinds.tableCell) {
11614
- tableCell = node;
11615
- }
11616
- if (Element$1.isElement(node) && node.type && tableCell && tableCell.children.includes(node)) {
11617
- const isSingleEmptyParagraph = tableCell.children.length === 1 && Editor.isEmpty(editor, node) && node.type === ElementKinds.default;
11618
- return !isSingleEmptyParagraph && true;
11619
- }
11620
- }
11621
- });
11622
- });
11623
- }
11624
- // 计算合并前的单元格
11625
- function getCellPositionsBeforeMerge(editor, { row, col }) {
11626
- const pos = createTablePosition(editor);
11627
- const { rowspan, colspan } = pos.findCellByPath({ row, col });
11628
- if (rowspan || colspan) {
11629
- const colSpan = colspan ?? 1;
11630
- const rowSpan = rowspan ?? 1;
11631
- return getCellPositionsFromRange(row, col, row + rowSpan, col + colSpan);
11632
- }
11633
- return [{ row, col }];
11634
- }
11635
-
11636
- const getTableEntry = (editor) => {
11637
- const { tableEntry } = createTablePosition(editor);
11638
- return tableEntry;
11639
- };
11640
- const getTablePath = (editor) => {
11641
- const tableEntry = getTableEntry(editor);
11642
- return tableEntry[1];
11643
- };
11644
- const getTable = (editor) => {
11645
- const { tableEntry } = createTablePosition(editor);
11646
- return tableEntry[0];
11647
- };
11648
- const getSelectedCell = (editor) => {
11649
- if (editor && editor.selection) {
11650
- const { cell } = createTablePosition(editor);
11651
- return cell;
11652
- }
11653
- return null;
11654
- };
11655
-
11656
- function setTableOptions(editor, newOptions) {
11657
- const tablePosition = createTablePosition(editor);
11658
- const tablePath = getTablePath(editor);
11659
- const table = tablePosition.table;
11660
- const options = { ...table.options, ...newOptions };
11661
- Transforms.setNodes(editor, { options }, { at: tablePath });
11662
- }
11663
-
11664
11811
  function removeColumnOrRows(editor, tableStore, options) {
11665
11812
  const { isSelectedTable } = tableStore;
11666
11813
  const selectedRowsIndex = options?.selectedRowsIndex || tableStore.selectedRowsIndex;
@@ -11674,7 +11821,7 @@ function removeColumnOrRows(editor, tableStore, options) {
11674
11821
  if (selectedRowsIndex.length > 0 && selectedColumnsIndex.length === 0) {
11675
11822
  // 删除行时取消标题行
11676
11823
  if (tablePosition.table && tableComponent.headerRow && selectedRowsIndex.includes(0)) {
11677
- setTableOptions(editor, { headerRow: false });
11824
+ TableEditor.setTableOptions(editor, { headerRow: false });
11678
11825
  // headerRow 兼容代码, 取消标题行的时候同时设置 row 中的 header 属性
11679
11826
  if (tablePosition.table.children[0].header) {
11680
11827
  const rowPath = TheEditor.findPath(editor, tablePosition.table.children[0]);
@@ -11691,7 +11838,7 @@ function removeColumnOrRows(editor, tableStore, options) {
11691
11838
  if (selectedColumnsIndex.length > 0 && selectedRowsIndex.length === 0) {
11692
11839
  // 删除列时取消标题列
11693
11840
  if (tablePosition.table && tablePosition.table.options?.headerColumn && selectedColumnsIndex.includes(0)) {
11694
- setTableOptions(editor, { headerColumn: false });
11841
+ TableEditor.setTableOptions(editor, { headerColumn: false });
11695
11842
  }
11696
11843
  selectedColumnsIndex
11697
11844
  .sort((a, b) => b - a)
@@ -11702,25 +11849,6 @@ function removeColumnOrRows(editor, tableStore, options) {
11702
11849
  }
11703
11850
  }
11704
11851
 
11705
- const setSelectedCellsBackgroundColor = (editor, color, tableStore) => {
11706
- // 点击自定义颜色面板输入框设置颜色值时,会丢失焦点和选区(目前无法做到焦点同时存在于编辑器和输入框)
11707
- let location;
11708
- if (!editor.selection) {
11709
- const { rangeRef } = THE_EDITOR_PREVIOUS_SELECTION.get(editor);
11710
- location = rangeRef.current.anchor;
11711
- }
11712
- const isHeader = TableEditor.isActiveHeader(editor, location);
11713
- if (color === 'transparent') {
11714
- color = null;
11715
- }
11716
- if ((color === TableHeaderBackgroundColor && isHeader) || (color === SpecialBackgroundColor && !isHeader)) {
11717
- tableStore.setSelectedCellsBackgroundColor(null);
11718
- }
11719
- else {
11720
- tableStore.setSelectedCellsBackgroundColor(color);
11721
- }
11722
- };
11723
-
11724
11852
  function setCellMenuVisibility(editor, menuList, tableInfo) {
11725
11853
  const { selectedCellPositions, isFullscreen, isSelectedTable, selectedRowsIndex, selectedColumnsIndex } = tableInfo;
11726
11854
  const isCellMerged = isSelectedCellMerged(editor);
@@ -11761,32 +11889,6 @@ function setCellMenuVisibility(editor, menuList, tableInfo) {
11761
11889
  });
11762
11890
  }
11763
11891
 
11764
- function splitCell(editor) {
11765
- const tablePosition = createTablePosition(editor);
11766
- const { cell, table, cellEntry } = tablePosition;
11767
- if ((!cell.rowspan && !cell.colspan) || (cell.rowspan === 1 && cell.colspan === 1))
11768
- return editor;
11769
- const cellRow = tablePosition.getRowIndex();
11770
- const cellCol = tablePosition.getColumnIndex();
11771
- resetTableCell(editor, table, cell, cellRow, cellCol);
11772
- Transforms.select(editor, cellEntry[1]);
11773
- Transforms.collapse(editor, { edge: 'end' });
11774
- }
11775
- function resetTableCell(editor, table, cell, cellRow, cellCol) {
11776
- const rowSpanIndex = cellRow + (cell.rowspan || 1) - 1;
11777
- const colSpanIndex = cellCol + (cell.colspan || 1) - 1;
11778
- Editor.withoutNormalizing(editor, () => {
11779
- table.children.map((row, rowIndex) => {
11780
- row.children.map((col, colIndex) => {
11781
- if (rowIndex >= cellRow && rowIndex <= rowSpanIndex && colIndex >= cellCol && colIndex <= colSpanIndex) {
11782
- const path = findPath(editor, col);
11783
- Transforms.setNodes(editor, { colspan: null, rowspan: null, hidden: null }, { at: path });
11784
- }
11785
- });
11786
- });
11787
- });
11788
- }
11789
-
11790
11892
  const getMinAndMaxCellIndex = (editor, selectedCellPositions, maxRow, maxCol, minRow, minCol, table) => {
11791
11893
  const beforeCols = [];
11792
11894
  const beforeRows = [];
@@ -12166,29 +12268,6 @@ class TableStore {
12166
12268
  this.dangerousColumnsIndex = [...Array(pos.getWidth())].map((_, i) => i);
12167
12269
  this.dangerousCells$.next(cells);
12168
12270
  }
12169
- setSelectedCellsBackgroundColor(backgroundColor) {
12170
- const cells = this.selectedCells$.getValue();
12171
- Editor.withoutNormalizing(this.editor, () => {
12172
- cells.map(cell => {
12173
- const cellPath = AngularEditor.findPath(this.editor, cell);
12174
- Transforms.setNodes(this.editor, { backgroundColor }, { at: cellPath });
12175
- });
12176
- });
12177
- }
12178
- clearSelectedCellsContent() {
12179
- const cells = this.getSelectedCellPositions();
12180
- const tablePosition = createTablePosition(this.editor);
12181
- if (tablePosition.isInTable()) {
12182
- Editor.withoutNormalizing(this.editor, () => {
12183
- for (const { row, col } of cells) {
12184
- const cellPath = [...tablePosition.tableEntry[1], row, col];
12185
- const node = Node.get(this.editor, cellPath);
12186
- TableEditor.clearCell(this.editor, [node, cellPath]);
12187
- }
12188
- });
12189
- Transforms.select(this.editor, Editor.start(this.editor, tablePosition.cellEntry[1]));
12190
- }
12191
- }
12192
12271
  /**
12193
12272
  * 聚焦单元格并设置聚焦相关路径及元素
12194
12273
  */
@@ -12308,7 +12387,7 @@ class TheTableContextMenuService {
12308
12387
  visibility: true,
12309
12388
  actionHandle: () => { },
12310
12389
  activeHandle: (event, item) => {
12311
- setSelectedCellsBackgroundColor(this.editor, item.backgroundColor, this.tableStore);
12390
+ TableEditor.setCellsBackgroundColor(this.editor, item.backgroundColor);
12312
12391
  },
12313
12392
  deactivateHandle: (event) => {
12314
12393
  if (event.relatedTarget instanceof HTMLElement) {
@@ -12378,7 +12457,7 @@ class TheTableContextMenuService {
12378
12457
  name: '清空选中区域',
12379
12458
  visibility: true,
12380
12459
  actionHandle: () => {
12381
- this.tableStore.clearSelectedCellsContent();
12460
+ TableEditor.clearCellsContent(this.editor);
12382
12461
  this.tableStore.selectFirstCell();
12383
12462
  }
12384
12463
  },
@@ -12388,7 +12467,7 @@ class TheTableContextMenuService {
12388
12467
  name: '合并单元格',
12389
12468
  visibility: true,
12390
12469
  actionHandle: () => {
12391
- mergeCell(this.editor, this.tableStore.getSelectedCellPositions());
12470
+ TableEditor.mergeCell(this.editor);
12392
12471
  }
12393
12472
  },
12394
12473
  {
@@ -12398,7 +12477,7 @@ class TheTableContextMenuService {
12398
12477
  divider: true,
12399
12478
  visibility: true,
12400
12479
  actionHandle: () => {
12401
- splitCell(this.editor);
12480
+ TableEditor.splitCell(this.editor);
12402
12481
  }
12403
12482
  },
12404
12483
  {
@@ -12630,7 +12709,7 @@ class TheTableOptionsComponent {
12630
12709
  currentOption.isActive = !option.isActive;
12631
12710
  const tableOption = {};
12632
12711
  tableOption[option.key] = currentOption.isActive || false;
12633
- setTableOptions(this.editor, { ...tableOption });
12712
+ TableEditor.setTableOptions(this.editor, { ...tableOption });
12634
12713
  // headerRow 兼容代码, 取消标题行的时候同时设置 row 中的 header 属性
12635
12714
  if (option.key === TableOperations.headerRow && !tableOption[option.key] && this.table.children[0].header) {
12636
12715
  const rowPath = TheEditor.findPath(this.editor, this.table.children[0]);
@@ -12697,7 +12776,7 @@ class TheTableToolbarComponent {
12697
12776
  visibility: false,
12698
12777
  icon: 'table-merge-cells',
12699
12778
  actionHandle: () => {
12700
- mergeCell(this.editor, this.tableStore.getSelectedCellPositions());
12779
+ TableEditor.mergeCell(this.editor);
12701
12780
  this.popoverRef.close();
12702
12781
  this.tableStore.clearSelectedCells();
12703
12782
  }
@@ -12708,7 +12787,7 @@ class TheTableToolbarComponent {
12708
12787
  visibility: false,
12709
12788
  icon: 'table-unmerge-cells',
12710
12789
  actionHandle: () => {
12711
- splitCell(this.editor);
12790
+ TableEditor.splitCell(this.editor);
12712
12791
  this.popoverRef.close();
12713
12792
  this.tableStore.clearSelectedCells();
12714
12793
  }
@@ -12775,7 +12854,7 @@ class TheTableToolbarComponent {
12775
12854
  e.stopPropagation();
12776
12855
  }
12777
12856
  changeColor(newColor) {
12778
- setSelectedCellsBackgroundColor(this.editor, newColor, this.tableStore);
12857
+ TableEditor.setCellsBackgroundColor(this.editor, newColor);
12779
12858
  this.selectedColor = newColor;
12780
12859
  }
12781
12860
  setFullscreen(event) {
@@ -12792,14 +12871,7 @@ class TheTableToolbarComponent {
12792
12871
  }
12793
12872
  setEquallyColumnHandle(event) {
12794
12873
  this.preventDefault(event);
12795
- const columns = this.tableElement.columns;
12796
- const sumWidth = columns.reduce((previousValue, currentValue) => {
12797
- return previousValue + currentValue.width;
12798
- }, 0);
12799
- const equalColumns = columns.map(() => {
12800
- return { width: sumWidth / columns.length };
12801
- });
12802
- setNode(this.editor, { columns: equalColumns }, this.tableElement);
12874
+ TableEditor.setEquallyColumn(this.editor);
12803
12875
  }
12804
12876
  openTableOptionMenu(event) {
12805
12877
  this.preventDefault(event);
@@ -12819,7 +12891,7 @@ class TheTableToolbarComponent {
12819
12891
  });
12820
12892
  }
12821
12893
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: TheTableToolbarComponent, deps: [{ token: i1$1.ThyPopover }, { token: i1$1.ThyPopoverRef }, { token: i1$2.ThyNotifyService }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component }); }
12822
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.4", type: TheTableToolbarComponent, selector: "the-table-toolbar", inputs: { tableStore: "tableStore", tableElement: "tableElement" }, ngImport: i0, template: "<thy-actions thySize=\"xxs\" (mousedown)=\"preventDefault($event)\">\n <ng-container *ngFor=\"let item of cellMenuList\">\n <a\n *ngIf=\"item.visibility\"\n href=\"javascript:;\"\n thyAction\n [thyActionIcon]=\"item.icon\"\n [thyTooltip]=\"item.name\"\n (click)=\"item.actionHandle()\"\n ></a>\n </ng-container>\n <thy-divider *ngIf=\"hasDivider\" class=\"mr-2 ml-1 align-self-center\" [thyVertical]=\"true\" thyColor=\"light\"> </thy-divider>\n <a\n href=\"javascript:;\"\n thyAction\n thyTooltip=\"\u5355\u5143\u683C\u80CC\u666F\"\n thyColorPicker\n [(ngModel)]=\"selectedColor\"\n (ngModelChange)=\"changeColor($event)\"\n (click)=\"openColorPanel($event)\"\n thyPlacement=\"bottomLeft\"\n [thyHasBackdrop]=\"false\"\n >\n <thy-icon thyIconName=\"background-tt\" thyIconType=\"twotone\" [thyTwotoneColor]=\"selectedColor\"></thy-icon>\n </a>\n <a\n href=\"javascript:;\"\n *ngIf=\"tableStore.isSelectedTable && !isColumnEqual\"\n thyAction\n thyTooltip=\"\u5217\u7B49\u5BBD\"\n (click)=\"setEquallyColumnHandle($event)\"\n >\n <thy-icon thyIconName=\"table-column-equal-width\"></thy-icon>\n </a>\n <a\n href=\"javascript:;\"\n *ngIf=\"tableStore.isSelectedTable && tableOptions?.showFullscreen\"\n thyAction\n thyTooltip=\"\u5168\u5C4F\"\n (click)=\"setFullscreen($event)\"\n >\n <thy-icon thyIconName=\"arrows-alt\"></thy-icon>\n </a>\n <a\n *ngIf=\"tableStore.isSelectedTable && !tableStore?.isFullscreen\"\n class=\"fullscreen-hidden\"\n href=\"javascript:;\"\n thyAction\n thyActionIcon=\"copy\"\n thyTooltip=\"\u590D\u5236\"\n (click)=\"onCopy($event)\"\n ></a>\n <ng-container *ngIf=\"tableStore.isSelectedTable\">\n <thy-divider class=\"mr-2 ml-1 align-self-center\" [thyVertical]=\"true\" thyColor=\"light\"></thy-divider>\n <a href=\"javascript:;\" class=\"link-with-down\" thyAction (mousedown)=\"preventDefault($event)\" (click)=\"openTableOptionMenu($event)\">\n <span>\u8868\u683C\u9009\u9879</span>\n <thy-icon class=\"font-size-sm text-desc ml-1\" thyIconName=\"caret-down\"></thy-icon>\n </a>\n </ng-container>\n <ng-container *ngIf=\"tableStore?.isFullscreen ? deleteIcon && !tableStore.isSelectedTable : deleteIcon\">\n <thy-divider class=\"mr-2 ml-1 align-self-center\" [thyVertical]=\"true\" thyColor=\"light\"></thy-divider>\n <a\n href=\"javascript:;\"\n thyAction\n thyType=\"danger\"\n [thyActionIcon]=\"deleteIcon\"\n [thyTooltip]=\"iconName\"\n (click)=\"onDelete($event)\"\n (mouseenter)=\"onEnterDelete($event)\"\n (mouseleave)=\"onLeaveDelete($event)\"\n ></a>\n </ng-container>\n</thy-actions>\n", dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i4.ThyIconComponent, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { kind: "directive", type: i8.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { kind: "component", type: i7.ThyActionComponent, selector: "thy-action, [thyAction]", inputs: ["thyType", "thyIcon", "thyActionIcon", "thyActive", "thyActionActive", "thyTheme", "thyHoverIcon", "thyDisabled"] }, { kind: "component", type: i7.ThyActionsComponent, selector: "thy-actions", inputs: ["thySize"] }, { kind: "component", type: i8$1.ThyDividerComponent, selector: "thy-divider", inputs: ["thyVertical", "thyStyle", "thyColor", "thyText", "thyTextDirection", "thyDeeper"] }, { kind: "directive", type: i5.ThyColorPickerDirective, selector: "[thyColorPicker]", inputs: ["thyOffset", "thyHasBackdrop", "thyDefaultColor", "thyTransparentColorSelectable", "thyPresetColors", "thyPlacement", "thyTrigger", "thyShowDelay", "thyHideDelay"], outputs: ["thyPanelOpen", "thyPanelClose"] }] }); }
12894
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.4", type: TheTableToolbarComponent, selector: "the-table-toolbar", inputs: { tableStore: "tableStore", tableElement: "tableElement" }, ngImport: i0, template: "<thy-actions thySize=\"xxs\" (mousedown)=\"preventDefault($event)\">\n <ng-container *ngFor=\"let item of cellMenuList\">\n <a\n *ngIf=\"item.visibility\"\n href=\"javascript:;\"\n thyAction\n [thyActionIcon]=\"item.icon\"\n [thyTooltip]=\"item.name\"\n (click)=\"item.actionHandle()\"\n ></a>\n </ng-container>\n <thy-divider *ngIf=\"hasDivider\" class=\"mr-2 ml-1 align-self-center\" [thyVertical]=\"true\" thyColor=\"light\"> </thy-divider>\n <a\n href=\"javascript:;\"\n thyAction\n thyTooltip=\"\u5355\u5143\u683C\u80CC\u666F\"\n thyColorPicker\n [(ngModel)]=\"selectedColor\"\n (ngModelChange)=\"changeColor($event)\"\n (click)=\"openColorPanel($event)\"\n thyPlacement=\"bottomLeft\"\n [thyHasBackdrop]=\"false\"\n >\n <thy-icon thyIconName=\"background-tt\" thyIconType=\"twotone\" [thyTwotoneColor]=\"selectedColor\"></thy-icon>\n </a>\n <a\n href=\"javascript:;\"\n *ngIf=\"tableStore.isSelectedTable && !isColumnEqual\"\n thyAction\n thyTooltip=\"\u5217\u7B49\u5BBD\"\n (click)=\"setEquallyColumnHandle($event)\"\n >\n <thy-icon thyIconName=\"table-column-equal-width\"></thy-icon>\n </a>\n <a\n href=\"javascript:;\"\n *ngIf=\"tableStore.isSelectedTable && tableOptions?.showFullscreen\"\n thyAction\n thyTooltip=\"\u5168\u5C4F\"\n (click)=\"setFullscreen($event)\"\n >\n <thy-icon thyIconName=\"arrows-alt\"></thy-icon>\n </a>\n <a\n *ngIf=\"tableStore.isSelectedTable && !tableStore?.isFullscreen\"\n class=\"fullscreen-hidden\"\n href=\"javascript:;\"\n thyAction\n thyActionIcon=\"copy\"\n thyTooltip=\"\u590D\u5236\"\n (click)=\"onCopy($event)\"\n ></a>\n <ng-container *ngIf=\"tableStore.isSelectedTable\">\n <thy-divider class=\"mr-2 ml-1 align-self-center\" [thyVertical]=\"true\" thyColor=\"light\"></thy-divider>\n <a href=\"javascript:;\" class=\"link-with-down\" thyAction (mousedown)=\"preventDefault($event)\" (click)=\"openTableOptionMenu($event)\">\n <span>\u8868\u683C\u9009\u9879</span>\n <thy-icon class=\"font-size-sm text-desc ml-1\" thyIconName=\"caret-down\"></thy-icon>\n </a>\n </ng-container>\n <ng-container *ngIf=\"tableStore?.isFullscreen ? deleteIcon && !tableStore.isSelectedTable : deleteIcon\">\n <thy-divider class=\"mr-2 ml-1 align-self-center\" [thyVertical]=\"true\" thyColor=\"light\"></thy-divider>\n <a\n href=\"javascript:;\"\n thyAction\n thyType=\"danger\"\n [thyActionIcon]=\"deleteIcon\"\n [thyTooltip]=\"iconName\"\n (click)=\"onDelete($event)\"\n (mouseenter)=\"onEnterDelete($event)\"\n (mouseleave)=\"onLeaveDelete($event)\"\n ></a>\n </ng-container>\n</thy-actions>\n", dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i4.ThyIconComponent, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { kind: "directive", type: i8.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { kind: "component", type: i7.ThyActionComponent, selector: "thy-action, [thyAction]", inputs: ["thyType", "thyIcon", "thyActionIcon", "thyActive", "thyActionActive", "thyTheme", "thyHoverIcon", "thyDisabled"] }, { kind: "component", type: i7.ThyActionsComponent, selector: "thy-actions", inputs: ["thySize"] }, { kind: "component", type: i8$1.ThyDividerComponent, selector: "thy-divider", inputs: ["thyVertical", "thyStyle", "thyColor", "thyText", "thyTextDirection", "thyDeeper"] }, { kind: "directive", type: i5.ThyColorPickerDirective, selector: "[thyColorPicker]", inputs: ["thyOffset", "thyHasBackdrop", "thyDefaultColor", "thyTransparentColorSelectable", "thyPresetColors", "thyPlacement", "thyTrigger", "thyShowDelay", "thyHideDelay", "thyDisabled"], outputs: ["thyPanelOpen", "thyPanelClose"] }] }); }
12823
12895
  }
12824
12896
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: TheTableToolbarComponent, decorators: [{
12825
12897
  type: Component,
@@ -13901,7 +13973,7 @@ class TheTableComponent extends TheBaseElementComponent {
13901
13973
  }), takeUntil(this.destroy$))
13902
13974
  .subscribe((e) => {
13903
13975
  if (e.type === 'keydown') {
13904
- this.tableStore.clearSelectedCellsContent();
13976
+ TableEditor.clearCellsContent(this.editor);
13905
13977
  }
13906
13978
  const isCurrentTableElement = this.nativeElement.contains(e.target);
13907
13979
  if (!isCurrentTableElement || (!this.tableStore.pointerSelection && !this.tableStore.areaSelection)) {
@@ -15681,7 +15753,7 @@ const withTable = (editor) => {
15681
15753
  TableEditor.removeTable(editor);
15682
15754
  }
15683
15755
  else {
15684
- tableComponent.tableStore.clearSelectedCellsContent();
15756
+ TableEditor.clearCellsContent(editor);
15685
15757
  }
15686
15758
  tableComponent.tableService.closeToolbar();
15687
15759
  });
@@ -16889,5 +16961,5 @@ const withTestPlugin = (plugins, initValue) => {
16889
16961
  * Generated bundle index. Do not edit.
16890
16962
  */
16891
16963
 
16892
- export { ALIGN_BLOCK_TYPES, A_TAG_REL_ATTR, AlignEditor, Alignment, BLOCK_DELETE_BACKWARD_TYPES, BlockquoteEditor, CLIPBOARD_FORMAT_KEY, CODEMIRROR_PADDING_TOP, CODE_MODES, COMPONENTS, CONTAINER_BLOCKS, CONTROL_KEY, CodeEditor, ColorEditor, ColumnResizeNotifierSource, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DISABLED_OPERATE_TYPES, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DefaultPluginMenu, DropdownMode, ELEMENT_UNIQUE_ID, ElementKinds, ErrorCodes, FontSizeTypes, FontSizes, HEADING_TYPES, HeadingEditor, HoveredCellInfo, HrEditor, IS_MAC, ImageEditor, IndentEditor, Indents, InlineCodeEditor, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LayoutTypes, LinkEditor, ListEditor, MarkEditor, MarkProps, MarkTypes, MentionEditor, PICTURE_ACCEPTED_UPLOAD_MIME, PICTURE_ACCEPTED_UPLOAD_SIZE, PLUGIN_COMPONENTS, PluginKeys, PluginMenuIcons, PluginMenuSvgs, Position, QuickInsertEditor, STANDARD_HEADING_TYPES, ScrollDirection, SpecialBackgroundColor, TAB_SPACE, THE_EDITOR_CONVERSION_HINT_REF, THE_EDITOR_ORIGIN_ANCHOR, THE_EDITOR_POPOVER_REF, THE_EDITOR_PREVIOUS_SELECTION, THE_EDITOR_UUID, THE_INLINE_TOOLBAR_TYPES, THE_LISTBOX_PARENT_GROUP_TOKEN, THE_LISTBOX_PARENT_OPTION_TOKEN, THE_LISTBOX_TOKEN, THE_MODE_PROVIDER, THE_MODE_TOKEN, THE_PLUGIN_MENU_REF, THE_UPLOAD_SERVICE_TOKEN, TableCellEventDispatcher, TableEditor, TableHeaderBackgroundColor, TheBaseElementComponent, TheBaseSuggestion, TheBaseToolbarDropdown, TheBaseToolbarItem, TheContextService, TheDataMode, TheDefaultElementComponent, TheEditor, TheEditorComponent, TheEditorModule, TheImageComponent, TheListboxDirective, TheListboxGroupDirective, TheListboxOptionDirective, TheMode, TheModeConfig, ThePluginMenu, ThePluginMenuComponent, ThePluginMenuItemType, ThePreventDefaultDirective, index$1 as TheQueries, TheToolbarComponent, TheToolbarDropdownComponent, TheToolbarGroupComponent, TheToolbarGroupToken, TheToolbarItemComponent, TheToolbarService, index as TheTransforms, TodoItemEditor, ToolbarActionTypes, ToolbarAlignment, ToolbarItemType, ToolbarMoreGroup, VOID_BLOCK_TYPES, VerticalAlignEditor, VerticalAlignment, ZERO_WIDTH_CHAR, autoFocus, base64toBlob, buildPluginMenu, buildPluginMenuItemMap, coercePixelsFromCssValue, combinePlugins, copyNode, copyNodeForSafari, createEmptyParagraph, createMentionPlugin, createPluginFactory, createToolbar, createVerticalAlignPlugin, dataDeserialize, dataSerializing, deleteElementKey, extractFragment, filterTextFormat, flattenDeepPlugins, getColsTotalWidth, getEditorUUID, getElementClassByPrefix, getElementHeight, getElementWidth, getEndBlock, getMode, getPlugin, getPluginOptions, getPlugins, getRowsTotalHeight, getStartBlock, getToolbarClass, headingOptions, htmlToTheia, idCreator, inValidTypes, initializeDefaultMenuIcons, insertDataByInvalidType, internalPlugins, isCleanEmptyParagraph, isColorIndicator, isColorInput, isColorPanel, isDirectionKeydown, isMobileMode, isPrintMode, isPureEmptyParagraph, mergeArray, mergeDeepPlugins, mergeElementOptions, mergeOptions, nestedStructureByKey, plainToTheia, pluginsByKey, reSelection, recursionNodes, refocus, scrollIntoView, setEditorUUID, useElementStyle, withMention, withTestPlugin, withTheia };
16964
+ export { ALIGN_BLOCK_TYPES, A_TAG_REL_ATTR, AlignEditor, Alignment, BLOCK_DELETE_BACKWARD_TYPES, BlockquoteEditor, CLIPBOARD_FORMAT_KEY, CODEMIRROR_PADDING_TOP, CODE_MODES, COMPONENTS, CONTAINER_BLOCKS, CONTROL_KEY, CodeEditor, ColorEditor, ColumnResizeNotifierSource, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DISABLED_OPERATE_TYPES, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DefaultPluginMenu, DropdownMode, ELEMENT_UNIQUE_ID, ElementKinds, ErrorCodes, FontSizeTypes, FontSizes, HEADING_TYPES, HeadingEditor, HoveredCellInfo, HrEditor, IS_MAC, ImageEditor, IndentEditor, Indents, InlineCodeEditor, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LayoutTypes, LinkEditor, ListEditor, MarkEditor, MarkProps, MarkTypes, MentionEditor, PICTURE_ACCEPTED_UPLOAD_MIME, PICTURE_ACCEPTED_UPLOAD_SIZE, PLUGIN_COMPONENTS, PluginKeys, PluginMenuIcons, PluginMenuSvgs, Position, QuickInsertEditor, STANDARD_HEADING_TYPES, ScrollDirection, SpecialBackgroundColor, TAB_SPACE, THE_EDITOR_CONVERSION_HINT_REF, THE_EDITOR_ORIGIN_ANCHOR, THE_EDITOR_POPOVER_REF, THE_EDITOR_PREVIOUS_SELECTION, THE_EDITOR_UUID, THE_INLINE_TOOLBAR_TYPES, THE_LISTBOX_PARENT_GROUP_TOKEN, THE_LISTBOX_PARENT_OPTION_TOKEN, THE_LISTBOX_TOKEN, THE_MODE_PROVIDER, THE_MODE_TOKEN, THE_PLUGIN_MENU_REF, THE_UPLOAD_SERVICE_TOKEN, TableCellEventDispatcher, TableEditor, TableHeaderBackgroundColor, TablePosition, TheBaseElementComponent, TheBaseSuggestion, TheBaseToolbarDropdown, TheBaseToolbarItem, TheContextService, TheDataMode, TheDefaultElementComponent, TheEditor, TheEditorComponent, TheEditorModule, TheImageComponent, TheListboxDirective, TheListboxGroupDirective, TheListboxOptionDirective, TheMode, TheModeConfig, ThePluginMenu, ThePluginMenuComponent, ThePluginMenuItemType, ThePreventDefaultDirective, index$1 as TheQueries, TheToolbarComponent, TheToolbarDropdownComponent, TheToolbarGroupComponent, TheToolbarGroupToken, TheToolbarItemComponent, TheToolbarService, index as TheTransforms, TodoItemEditor, ToolbarActionTypes, ToolbarAlignment, ToolbarItemType, ToolbarMoreGroup, VOID_BLOCK_TYPES, VerticalAlignEditor, VerticalAlignment, ZERO_WIDTH_CHAR, autoFocus, base64toBlob, buildPluginMenu, buildPluginMenuItemMap, calcColumnGroups, calcColumnWidth, calcPrintColumnWidth, calcSpanForColumn, calcSpanForRow, calculateRowControls, coercePixelsFromCssValue, combinePlugins, copyNode, copyNodeForSafari, createCell, createEmptyContent, createEmptyParagraph, createMentionPlugin, createPluginFactory, createRow, createTable, createTablePosition, createToolbar, createVerticalAlignPlugin, dataDeserialize, dataSerializing, deleteElementKey, extractFragment, filterTextFormat, flattenDeepPlugins, focusCell, getCellPositionsFromRange, getColsTotalWidth, getColumnsWidth, getEditorUUID, getElementClassByPrefix, getElementHeight, getElementWidth, getEndBlock, getGridColumns, getMode, getNextCell, getOriginCell, getPlugin, getPluginOptions, getPlugins, getRowsTotalHeight, getSelectCellNode, getSelectedCellPositions, getStartBlock, getToolbarClass, headingOptions, htmlToTheia, idCreator, inValidTypes, initializeDefaultMenuIcons, insertDataByInvalidType, internalPlugins, isCleanEmptyParagraph, isColorIndicator, isColorInput, isColorPanel, isDirectionKeydown, isHeaderRow, isInside, isMobileMode, isPrintMode, isPureEmptyParagraph, isRangeInTable, isRectangularInTableCells, isSelectedAllCell, isSelectionInTable, isVirtualKey, mergeArray, mergeDeepPlugins, mergeElementOptions, mergeOptions, nestedStructureByKey, plainToTheia, pluginsByKey, reSelection, recursionNodes, refocus, scrollIntoView, setEditorUUID, uniqueCellPosition, useElementStyle, withMention, withTestPlugin, withTheia };
16893
16965
  //# sourceMappingURL=worktile-theia.mjs.map