@ones-editor/editor 2.8.15 → 2.8.16-beta.2

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.
package/dist/index.js CHANGED
@@ -12978,7 +12978,7 @@ var __publicField = (obj, key, value) => {
12978
12978
  }
12979
12979
  return {};
12980
12980
  }
12981
- function getOptions$9(editor) {
12981
+ function getOptions$a(editor) {
12982
12982
  const commandMap = /* @__PURE__ */ new Map();
12983
12983
  const insertBlockCommandItems = [];
12984
12984
  editor.editorEmbeds.forEach((embedClass) => {
@@ -13071,7 +13071,7 @@ var __publicField = (obj, key, value) => {
13071
13071
  convertFrom: convertFrom$9,
13072
13072
  convertTo: convertTo$l,
13073
13073
  getBlockProperties: getBlockProperties$c,
13074
- getOptions: getOptions$9,
13074
+ getOptions: getOptions$a,
13075
13075
  handleDeleteBlock: handleDeleteBlock$9,
13076
13076
  handleUpdateBlock: handleUpdateBlock$6,
13077
13077
  handleDropOver: handleDropOver$2,
@@ -26196,7 +26196,7 @@ var __publicField = (obj, key, value) => {
26196
26196
  const y1 = rect.y < 0 ? 0 : rect.y;
26197
26197
  const x2 = rect.right > window.innerWidth ? window.innerWidth : rect.right;
26198
26198
  const mobileClient = editor.options.componentsOptions.mobile;
26199
- const innerHeight = clientType.isMobile ? mobileClient.getViewPortHeight() : window.innerHeight;
26199
+ const innerHeight = mobileClient && clientType.isMobile ? mobileClient.getViewPortHeight() : window.innerHeight;
26200
26200
  const y2 = rect.bottom > innerHeight ? innerHeight : rect.bottom;
26201
26201
  return new DOMRect(x1, y1, x2 - x1, y2 - y1);
26202
26202
  }
@@ -40628,6 +40628,8 @@ ${codeText}
40628
40628
  const TabIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M14 2L2 2" stroke="#2D2D2E" stroke-linejoin="round"/>\n<path d="M14 6H7" stroke="#2D2D2E" stroke-linejoin="round"/>\n<path d="M2 10.5V5.5L5.5 8L2 10.5Z" fill="#2D2D2E"/>\n<path d="M14 10H7" stroke="#2D2D2E" stroke-linejoin="round"/>\n<path d="M14 14H2" stroke="#2D2D2E" stroke-linejoin="round"/>\n</svg>\n';
40629
40629
  const ShiftTabIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M2 2H14" stroke="#2D2D2E" stroke-linejoin="round"/>\n<path d="M7 6H14" stroke="#2D2D2E" stroke-linejoin="round"/>\n<path d="M5.5 10.5V5.5L2 8L5.5 10.5Z" fill="#2D2D2E"/>\n<path d="M7 10H14" stroke="#2D2D2E" stroke-linejoin="round"/>\n<path d="M2 14H14" stroke="#2D2D2E" stroke-linejoin="round"/>\n</svg>\n';
40630
40630
  const TableEditIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M8 14.5H2.5C1.94772 14.5 1.5 14.0523 1.5 13.5V2.5C1.5 1.94772 1.94772 1.5 2.5 1.5H13.5C14.0523 1.5 14.5 1.94772 14.5 2.5V8" stroke="#2D2D2E"/>\n<path d="M1.6 4.8H14.4" stroke="#2D2D2E"/>\n<path d="M1.6 9.6H8.00078" stroke="#2D2D2E"/>\n<path d="M5.6 1.6L5.6 14.4" stroke="#2D2D2E"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M11.5043 8.98727L11.6789 8.22924C11.7097 8.09564 11.8387 8 11.9881 8H12.8119C12.9613 8 13.0903 8.09564 13.1211 8.22924L13.2957 8.98727C13.3177 9.08256 13.3912 9.16027 13.488 9.20102C13.569 9.23514 13.648 9.2726 13.7248 9.31318C13.8018 9.35372 13.877 9.3976 13.95 9.44477C14.037 9.50098 14.1474 9.52034 14.2487 9.49008L15.0543 9.24927C15.1963 9.20683 15.3514 9.26108 15.4261 9.37933L15.9576 10.2206C16.0323 10.3389 16.0062 10.4888 15.895 10.5799L15.2639 11.0972C15.1846 11.1622 15.1477 11.2593 15.1575 11.3562C15.1657 11.4375 15.1698 11.5189 15.1697 11.6C15.1698 11.6811 15.1658 11.7625 15.1576 11.8438C15.1478 11.9407 15.1847 12.0378 15.264 12.1028L15.895 12.62C16.0062 12.7112 16.0324 12.8611 15.9577 12.9793L15.4262 13.8206C15.3515 13.9389 15.1963 13.9931 15.0544 13.9507L14.2487 13.7099C14.1474 13.6796 14.037 13.699 13.95 13.7552C13.877 13.8024 13.8018 13.8463 13.7248 13.8868C13.648 13.9274 13.569 13.9649 13.488 13.999C13.3912 14.0397 13.3177 14.1174 13.2957 14.2127L13.1211 14.9708C13.0903 15.1044 12.9613 15.2 12.8119 15.2H11.9881C11.8387 15.2 11.7097 15.1044 11.6789 14.9708L11.5043 14.2127C11.4823 14.1174 11.4088 14.0397 11.312 13.999C11.231 13.9649 11.152 13.9274 11.0752 13.8868C10.9982 13.8463 10.923 13.8024 10.85 13.7552C10.763 13.699 10.6526 13.6796 10.5513 13.7099L9.74565 13.9507C9.60366 13.9931 9.44854 13.9389 9.37384 13.8206L8.84234 12.9793C8.76764 12.8611 8.79378 12.7112 8.905 12.62L9.53602 12.1028C9.61534 12.0378 9.6522 11.9407 9.64243 11.8438C9.63424 11.7625 9.63023 11.6811 9.63031 11.6C9.63023 11.5189 9.63426 11.4375 9.64247 11.3562C9.65226 11.2593 9.61539 11.1622 9.53607 11.0972L8.90506 10.5799C8.79384 10.4888 8.7677 10.3389 8.8424 10.2206L9.3739 9.37933C9.4486 9.26108 9.60371 9.20683 9.74571 9.24927L10.5514 9.49008C10.6526 9.52034 10.7631 9.50098 10.8501 9.44477C10.923 9.3976 10.9982 9.35372 11.0752 9.31318C11.152 9.2726 11.231 9.23514 11.312 9.20102C11.4088 9.16027 11.4823 9.08256 11.5043 8.98727ZM12.3278 12.5136C12.8866 12.5136 13.3396 12.0996 13.3396 11.5889C13.3396 11.0783 12.8866 10.6643 12.3278 10.6643C11.769 10.6643 11.316 11.0783 11.316 11.5889C11.316 12.0996 11.769 12.5136 12.3278 12.5136Z" fill="#2D2D2E"/>\n</svg>\n';
40631
+ const AdjustWidthIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M8 6H2.5C1.94772 6 1.5 6.44772 1.5 7V13.5C1.5 14.0523 1.94772 14.5 2.5 14.5H8M8 6H13.5C14.0523 6 14.5 6.44772 14.5 7V13.5C14.5 14.0523 14.0523 14.5 13.5 14.5H8M8 6V14.5" stroke="#2D2D2E"/>\n<path d="M1.5 2.5H14.5M1.5 1V4M8 1V4M14.5 1V4" stroke="#2D2D2E"/>\n</svg>\n';
40632
+ const TocIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M2 3.5L14 3.5" stroke="#2D2D2E"/>\n<path d="M2 6.50397H10" stroke="#2D2D2E"/>\n<path d="M2 12.5L14 12.5" stroke="#2D2D2E"/>\n<path d="M6 9.5H14" stroke="#2D2D2E"/>\n</svg>\n';
40631
40633
  const index$f = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
40632
40634
  __proto__: null,
40633
40635
  TableEditIcon,
@@ -40755,7 +40757,9 @@ ${codeText}
40755
40757
  SearchIcon,
40756
40758
  CalloutIcon: CalloutIcon$1,
40757
40759
  LoadingCircleIcon,
40758
- TextGroupIcon
40760
+ TextGroupIcon,
40761
+ AdjustWidthIcon,
40762
+ TocIcon
40759
40763
  }, Symbol.toStringTag, { value: "Module" }));
40760
40764
  function createLoading() {
40761
40765
  const loading2 = createElement("span", ["editor-loading-icon"], null);
@@ -44009,6 +44013,9 @@ ${codeText}
44009
44013
  "insert-emoji": {
44010
44014
  shortcut: "/emoji"
44011
44015
  },
44016
+ "insert-toc": {
44017
+ shortcut: "/toc"
44018
+ },
44012
44019
  ...fontShortCuts()
44013
44020
  };
44014
44021
  function getShortcutById(id) {
@@ -46558,6 +46565,183 @@ ${codeText}
46558
46565
  editor.deleteChildContainers(deletedContainers);
46559
46566
  });
46560
46567
  }
46568
+ var TABLE_CLASS = /* @__PURE__ */ ((TABLE_CLASS2) => {
46569
+ TABLE_CLASS2["COL_TITLE_TABLE"] = "col-title-table";
46570
+ TABLE_CLASS2["COL_TITLE_ITEM"] = "col-title-item";
46571
+ TABLE_CLASS2["STRIPE_STYLE_TABLE"] = "stripe-style-table";
46572
+ TABLE_CLASS2["NO_BORDER"] = "table-no-border";
46573
+ return TABLE_CLASS2;
46574
+ })(TABLE_CLASS || {});
46575
+ const TABLE_BAR_WIDTH = 6;
46576
+ const INSERT_BUTTON_SIZE = 20;
46577
+ const TABLE_CELL_MENU_BUTTON_CLASS = "table-cell-menu-btn";
46578
+ const logger$2r = getLogger("table-resize-gripper");
46579
+ const GRIPPER_SIZE = 7;
46580
+ const GRIPPER_SIZE_HALF = (GRIPPER_SIZE - 1) / 2;
46581
+ const CONTAINER_CELL_DELTA = 3;
46582
+ function getCellFromRightBorder(table, x, y) {
46583
+ const { rows } = table;
46584
+ for (let i = 0; i < rows.length; i++) {
46585
+ const row = rows[i];
46586
+ const cells = Array.from(row.cells);
46587
+ for (let j = 0; j < cells.length; j++) {
46588
+ const cell = cells[j];
46589
+ const rect = cell.getBoundingClientRect();
46590
+ const pos = Math.round(rect.right);
46591
+ if (Math.abs(x - pos) <= GRIPPER_SIZE_HALF && rect.top <= y && y <= rect.bottom) {
46592
+ return cell;
46593
+ }
46594
+ }
46595
+ }
46596
+ return null;
46597
+ }
46598
+ function editorHasExistsResizeGripper(editor) {
46599
+ return !!editor.rootContainer.querySelector(".table-resize-gripper");
46600
+ }
46601
+ function getExistsResizeGripper$1(editor, block) {
46602
+ const tools = getTableTools(editor, block);
46603
+ const gripper = tools.querySelector(".table-resize-gripper");
46604
+ return gripper;
46605
+ }
46606
+ function createResizeGripper$2(editor, block) {
46607
+ const exists = getExistsResizeGripper$1(editor, block);
46608
+ assert(logger$2r, !exists, "resize gripper has already exists");
46609
+ const tools = getTableTools(editor, block);
46610
+ const gripper = createElement("div", ["table-resize-gripper", "table-indicator"], tools);
46611
+ createElement("div", ["table-resize-gripper-indicator"], gripper);
46612
+ return gripper;
46613
+ }
46614
+ function updateResizeGripper$1(editor, block, cell) {
46615
+ let gripper = getExistsResizeGripper$1(editor, block);
46616
+ if (!gripper) {
46617
+ gripper = createResizeGripper$2(editor, block);
46618
+ }
46619
+ const table = getBlockTable(block);
46620
+ const tableRect = table.getBoundingClientRect();
46621
+ const cellRect = cell.getBoundingClientRect();
46622
+ const top = 0;
46623
+ const height = tableRect.height;
46624
+ const scrollContentRect = editor.getCustom(getTableScrollKey(block)).contentElement.getBoundingClientRect();
46625
+ const left = cellRect.right - scrollContentRect.left;
46626
+ gripper.style.left = `${left - GRIPPER_SIZE_HALF - TABLE_BAR_WIDTH - INSERT_BUTTON_SIZE}px`;
46627
+ gripper.style.top = `${top}px`;
46628
+ gripper.style.height = `${height}px`;
46629
+ gripper.style.width = `${GRIPPER_SIZE}px`;
46630
+ }
46631
+ function removeAllResizeGripper(editor) {
46632
+ editor.rootContainer.querySelectorAll(".table-resize-gripper").forEach((gripper) => {
46633
+ gripper.remove();
46634
+ });
46635
+ }
46636
+ function setTableColumnWidths(editor, block, colsWidth) {
46637
+ const oldData = editor.getBlockData(block);
46638
+ const newData = {
46639
+ ...oldData,
46640
+ colsWidth
46641
+ };
46642
+ editor.updateBlockData(block, newData, void 0, { noScroll: true });
46643
+ }
46644
+ const logger$2q = getLogger("column-width");
46645
+ function setColumnWidth(table, colIndex, width) {
46646
+ const col = getTableCol(table, colIndex);
46647
+ col.style.width = `${width}px`;
46648
+ col.style.minWidth = `${width}px`;
46649
+ }
46650
+ function getTableColumnWidthsFromDom(table) {
46651
+ const tableCols = Array.from(table.querySelector("colgroup").children);
46652
+ const widths = tableCols.map((col) => col.getBoundingClientRect().width);
46653
+ if (widths[0] !== 0) {
46654
+ return widths;
46655
+ }
46656
+ const grid = TableGrid.fromTable(table);
46657
+ const cellRightOffsets = Array(grid.colCount).fill(-1);
46658
+ const left = table.getBoundingClientRect().left;
46659
+ grid.toRealCells(grid.cells).forEach((cell) => {
46660
+ const colIndex = cell.col + cell.colSpan - 1;
46661
+ if (cellRightOffsets[colIndex] === -1) {
46662
+ cellRightOffsets[colIndex] = cell.cell.getBoundingClientRect().right - left;
46663
+ }
46664
+ });
46665
+ logger$2q.debug(`cellRightOffsets1: ${cellRightOffsets.join()}`);
46666
+ for (let col = 0; col < cellRightOffsets.length; col++) {
46667
+ const offset = cellRightOffsets[col];
46668
+ if (offset === -1 || col === 0) {
46669
+ continue;
46670
+ }
46671
+ let prevCol = col - 1;
46672
+ while (cellRightOffsets[prevCol] === -1) {
46673
+ prevCol--;
46674
+ if (prevCol === -1) {
46675
+ break;
46676
+ }
46677
+ }
46678
+ const prevOffset = prevCol === -1 ? 0 : cellRightOffsets[prevCol];
46679
+ const totalWidth = offset - prevOffset;
46680
+ const averageWidth = totalWidth / (col - prevCol);
46681
+ for (let i = prevCol + 1; i < col; i++) {
46682
+ cellRightOffsets[i] = prevOffset + averageWidth * (i - prevCol);
46683
+ }
46684
+ }
46685
+ logger$2q.debug(`cellRightOffsets2: ${cellRightOffsets.join()}`);
46686
+ const result = [];
46687
+ let prev = 0;
46688
+ for (let col = 0; col < cellRightOffsets.length; col++) {
46689
+ const offset = cellRightOffsets[col];
46690
+ result.push(offset - prev);
46691
+ prev = offset;
46692
+ }
46693
+ logger$2q.debug(`widths: ${result.join()}`);
46694
+ return result;
46695
+ }
46696
+ function getTableColumnWidths(table) {
46697
+ const tableCols = Array.from(table.querySelector("colgroup").children);
46698
+ const widths = tableCols.map((col) => col.getBoundingClientRect().width || Number.parseInt(col.style.width, 10));
46699
+ return widths;
46700
+ }
46701
+ function adjustColumnWidthsEvenly(editor, block, range) {
46702
+ const table = getBlockTable(block);
46703
+ const { start, end } = range;
46704
+ if (start.blockId !== end.blockId) {
46705
+ return false;
46706
+ }
46707
+ if (range.isSimple()) {
46708
+ return false;
46709
+ }
46710
+ const testBlock = editor.getBlockById(start.blockId);
46711
+ if (testBlock !== block)
46712
+ return false;
46713
+ if (getBlockType(block) !== "table")
46714
+ return false;
46715
+ const { fromCol, toCol } = getTableSelectionRange(block, range.start, range.end);
46716
+ if (fromCol === toCol)
46717
+ return false;
46718
+ const colWidths = getTableColumnWidthsFromDom(table);
46719
+ let totalWidth = 0;
46720
+ for (let i = fromCol; i <= toCol; i++) {
46721
+ totalWidth += colWidths[i];
46722
+ }
46723
+ for (let i = fromCol; i <= toCol; i++) {
46724
+ colWidths[i] = totalWidth / (toCol - fromCol + 1);
46725
+ }
46726
+ setTableColumnWidths(editor, block, colWidths);
46727
+ return true;
46728
+ }
46729
+ function canAdjustColumnWidthsEvenly(editor, block, range) {
46730
+ const { start, end } = range;
46731
+ if (start.blockId !== end.blockId) {
46732
+ return false;
46733
+ }
46734
+ if (range.isSimple()) {
46735
+ return false;
46736
+ }
46737
+ const testBlock = editor.getBlockById(start.blockId);
46738
+ if (testBlock !== block)
46739
+ return false;
46740
+ if (getBlockType(block) !== "table")
46741
+ return false;
46742
+ const { fromCol, toCol } = getTableSelectionRange(block, range.start, range.end);
46743
+ return fromCol !== toCol;
46744
+ }
46561
46745
  const TABLE_COMMAND_GROUP_INDEX = 10;
46562
46746
  const TableCommands = [
46563
46747
  "table/merge-cells",
@@ -46566,7 +46750,8 @@ ${codeText}
46566
46750
  "table/insert-row",
46567
46751
  "table/delete-rows",
46568
46752
  "table/delete-columns",
46569
- "table/delete"
46753
+ "table/delete",
46754
+ "table/adjust-column-widths-evenly"
46570
46755
  ];
46571
46756
  class TableBlockCommandProvider {
46572
46757
  constructor() {
@@ -46578,6 +46763,8 @@ ${codeText}
46578
46763
  return [];
46579
46764
  }
46580
46765
  const commands = [];
46766
+ const deleteColumns2 = canDeleteColumns(editor, block, range);
46767
+ const deleteRows2 = canDeleteRows(editor, block, range);
46581
46768
  if (canMergeCells(editor, block, range)) {
46582
46769
  commands.push({
46583
46770
  id: "table/merge-cells",
@@ -46592,8 +46779,6 @@ ${codeText}
46592
46779
  icon: SplitCellIcon
46593
46780
  });
46594
46781
  }
46595
- const deleteColumns2 = canDeleteColumns(editor, block, range);
46596
- const deleteRows2 = canDeleteRows(editor, block, range);
46597
46782
  if (deleteColumns2 && deleteRows2) {
46598
46783
  commands.push({
46599
46784
  id: "table/delete",
@@ -46601,6 +46786,14 @@ ${codeText}
46601
46786
  icon: DeleteTableIcon
46602
46787
  });
46603
46788
  }
46789
+ const adjustWidths = canAdjustColumnWidthsEvenly(editor, block, range);
46790
+ if (adjustWidths) {
46791
+ commands.push({
46792
+ id: "table/adjust-column-widths-evenly",
46793
+ name: i18n$1.t("table.adjustColumnWidthsEvenly"),
46794
+ icon: AdjustWidthIcon
46795
+ });
46796
+ }
46604
46797
  return commands;
46605
46798
  }
46606
46799
  executeCommand(editor, block, range, command, params, result) {
@@ -46630,19 +46823,13 @@ ${codeText}
46630
46823
  editor.deleteBlock(block);
46631
46824
  return true;
46632
46825
  }
46826
+ if (command.id === "table/adjust-column-widths-evenly") {
46827
+ adjustColumnWidthsEvenly(editor, block, range);
46828
+ return true;
46829
+ }
46633
46830
  return false;
46634
46831
  }
46635
46832
  }
46636
- var TABLE_CLASS = /* @__PURE__ */ ((TABLE_CLASS2) => {
46637
- TABLE_CLASS2["COL_TITLE_TABLE"] = "col-title-table";
46638
- TABLE_CLASS2["COL_TITLE_ITEM"] = "col-title-item";
46639
- TABLE_CLASS2["STRIPE_STYLE_TABLE"] = "stripe-style-table";
46640
- TABLE_CLASS2["NO_BORDER"] = "table-no-border";
46641
- return TABLE_CLASS2;
46642
- })(TABLE_CLASS || {});
46643
- const TABLE_BAR_WIDTH = 6;
46644
- const INSERT_BUTTON_SIZE = 20;
46645
- const TABLE_CELL_MENU_BUTTON_CLASS = "table-cell-menu-btn";
46646
46833
  function setColTitle(editor, tableBlock) {
46647
46834
  if (!editor.isBlockWritable(tableBlock)) {
46648
46835
  return;
@@ -46720,26 +46907,26 @@ ${codeText}
46720
46907
  };
46721
46908
  editor.updateBlockData(tableBlock, newBlockData);
46722
46909
  }
46723
- const logger$2r = getLogger("table-cell-dom");
46910
+ const logger$2p = getLogger("table-cell-dom");
46724
46911
  function getCellElementByChildBlockId(editor, tableBlock, blockId) {
46725
46912
  let blockElement = editor.getBlockById(blockId);
46726
46913
  while (blockElement) {
46727
46914
  const cell = blockElement.closest("td");
46728
- assert(logger$2r, cell, "no parent cell");
46915
+ assert(logger$2p, cell, "no parent cell");
46729
46916
  const cellParentBlock = getParentBlock(cell);
46730
- assert(logger$2r, cellParentBlock, "no parent block");
46917
+ assert(logger$2p, cellParentBlock, "no parent block");
46731
46918
  if (cellParentBlock === tableBlock) {
46732
46919
  return cell;
46733
46920
  }
46734
46921
  blockElement = cellParentBlock;
46735
46922
  }
46736
- assert(logger$2r, false, "filed to get cell by child block id");
46923
+ assert(logger$2p, false, "filed to get cell by child block id");
46737
46924
  return null;
46738
46925
  }
46739
46926
  function createComplexPosFromBlockPos(editor, tableBlock, blockPosition) {
46740
46927
  const blockElement = editor.getBlockById(blockPosition.blockId);
46741
46928
  if (blockElement === tableBlock && !blockPosition.isSimple()) {
46742
- assert(logger$2r, blockPosition.childContainerId, "block position must have childContainerId attribute");
46929
+ assert(logger$2p, blockPosition.childContainerId, "block position must have childContainerId attribute");
46743
46930
  return blockPosition;
46744
46931
  }
46745
46932
  const cellElement = getCellElementByChildBlockId(editor, tableBlock, blockPosition.blockId);
@@ -46753,12 +46940,12 @@ ${codeText}
46753
46940
  return getTableSelectionRange(tableBlock, start, end);
46754
46941
  }
46755
46942
  function updateBarsDangerStatus(editor, tableBlock, selectedRows, selectedColumns) {
46756
- assert(logger$2r, isTableBlock(tableBlock), "invalid table block");
46943
+ assert(logger$2p, isTableBlock(tableBlock), "invalid table block");
46757
46944
  const tools = getTableTools(editor, tableBlock);
46758
46945
  const blockTools = getBlockTools(tableBlock);
46759
46946
  const updateTop = () => {
46760
46947
  const exists = tools.querySelector(".table-border-bar-container.top");
46761
- assert(logger$2r, exists, "no top border bar container");
46948
+ assert(logger$2p, exists, "no top border bar container");
46762
46949
  const cells = exists.querySelectorAll(".table-border-bar-cell.top");
46763
46950
  cells.forEach((cell) => {
46764
46951
  const colIndex = parseInt(cell.getAttribute("data-top-index") || "0", 10);
@@ -46771,7 +46958,7 @@ ${codeText}
46771
46958
  };
46772
46959
  const updateLeft = () => {
46773
46960
  const left = blockTools.querySelector(".table-border-bar-container.left");
46774
- assert(logger$2r, left, "no left border bar container");
46961
+ assert(logger$2p, left, "no left border bar container");
46775
46962
  const cells = left.querySelectorAll(".table-border-bar-cell.left");
46776
46963
  cells.forEach((cell) => {
46777
46964
  const rowIndex = parseInt(cell.getAttribute("data-left-index") || "0", 10);
@@ -46807,7 +46994,7 @@ ${codeText}
46807
46994
  }
46808
46995
  }
46809
46996
  } catch (error2) {
46810
- logger$2r.error("update cells danger status failed: ", error2.message);
46997
+ logger$2p.error("update cells danger status failed: ", error2.message);
46811
46998
  }
46812
46999
  }
46813
47000
  function updateCellBarsDangerStatus(editor, tableBlock, isDanger = true, isCol) {
@@ -46830,7 +47017,7 @@ ${codeText}
46830
47017
  }
46831
47018
  updateBarsDangerStatus(editor, tableBlock, Array.from(selectedRows), Array.from(selectedColumns));
46832
47019
  } catch (error2) {
46833
- logger$2r.error("update cell bars danger status failed: ", error2.message);
47020
+ logger$2p.error("update cell bars danger status failed: ", error2.message);
46834
47021
  }
46835
47022
  }
46836
47023
  function createEntireRowAndColumnRange(editor, tableBlock, isCol) {
@@ -46949,14 +47136,14 @@ ${codeText}
46949
47136
  }
46950
47137
  const DEFAULT_COLUMN_WIDTH$1 = 200;
46951
47138
  const MIN_COLUMN_WIDTH = 40;
46952
- const logger$2q = getLogger("table-insert-column");
47139
+ const logger$2o = getLogger("table-insert-column");
46953
47140
  function insertColumn(editor, tableBlock, insertIndex) {
46954
47141
  editor.undoManager.runInGroup(() => {
46955
47142
  var _a;
46956
47143
  const table = getBlockTable(tableBlock);
46957
47144
  const grid = TableGrid.fromTable(table);
46958
47145
  const colCount = grid.colCount;
46959
- assert(logger$2q, insertIndex >= 0 && insertIndex <= colCount, `insert index ${insertIndex} is out of range [0, ${colCount}]`);
47146
+ assert(logger$2o, insertIndex >= 0 && insertIndex <= colCount, `insert index ${insertIndex} is out of range [0, ${colCount}]`);
46960
47147
  const cells = grid.map((cell) => cell.containerId);
46961
47148
  const spannedContainerIds = /* @__PURE__ */ new Set();
46962
47149
  editor.doc.beginBatchUpdate();
@@ -46977,7 +47164,7 @@ ${codeText}
46977
47164
  spannedContainerIds.forEach((containerId) => {
46978
47165
  const key = `${containerId}_colSpan`;
46979
47166
  const oldSpan = oldBlockData[key];
46980
- assert(logger$2q, typeof oldSpan === "number" && oldSpan > 1, `no colSpan for containerId ${containerId}, ${oldSpan}`);
47167
+ assert(logger$2o, typeof oldSpan === "number" && oldSpan > 1, `no colSpan for containerId ${containerId}, ${oldSpan}`);
46981
47168
  oldBlockData[key] = oldSpan + 1;
46982
47169
  });
46983
47170
  const colsWidth = ((_a = oldBlockData.colsWidth) == null ? void 0 : _a.concat()) || new Array(oldBlockData.cols).fill(0);
@@ -46993,13 +47180,13 @@ ${codeText}
46993
47180
  editor.updateBlockData(tableBlock, newBlockData);
46994
47181
  });
46995
47182
  }
46996
- const logger$2p = getLogger("table-insert-row");
47183
+ const logger$2n = getLogger("table-insert-row");
46997
47184
  function insertRow(editor, tableBlock, insertIndex) {
46998
47185
  editor.undoManager.runInGroup(() => {
46999
47186
  const table = getBlockTable(tableBlock);
47000
47187
  const grid = TableGrid.fromTable(table);
47001
47188
  const rowCount = grid.rowCount;
47002
- assert(logger$2p, insertIndex >= 0 && insertIndex <= rowCount, `insert index ${insertIndex} is out of range [0, ${rowCount}]`);
47189
+ assert(logger$2n, insertIndex >= 0 && insertIndex <= rowCount, `insert index ${insertIndex} is out of range [0, ${rowCount}]`);
47003
47190
  const cells = grid.map((cell) => cell.containerId);
47004
47191
  const spannedContainerIds = /* @__PURE__ */ new Set();
47005
47192
  editor.doc.beginBatchUpdate();
@@ -47007,12 +47194,12 @@ ${codeText}
47007
47194
  for (let col = 0; col < grid.colCount; col++) {
47008
47195
  const top = insertIndex > 0 && cells[insertIndex - 1][col];
47009
47196
  const bottom = insertIndex < grid.rowCount && cells[insertIndex][col];
47010
- assert(logger$2p, top || bottom, "no top and bottom cell");
47197
+ assert(logger$2n, top || bottom, "no top and bottom cell");
47011
47198
  if (insertIndex === 0 || insertIndex === grid.rowCount || top !== bottom) {
47012
47199
  const newContainerId = createEmptyContainer(editor.doc);
47013
47200
  rowData.push(newContainerId);
47014
47201
  } else {
47015
- assert(logger$2p, top, "no top cell");
47202
+ assert(logger$2n, top, "no top cell");
47016
47203
  rowData.push(top);
47017
47204
  spannedContainerIds.add(top);
47018
47205
  }
@@ -47023,7 +47210,7 @@ ${codeText}
47023
47210
  spannedContainerIds.forEach((containerId) => {
47024
47211
  const key = `${containerId}_rowSpan`;
47025
47212
  const oldSpan = oldBlockData[key];
47026
- assert(logger$2p, typeof oldSpan === "number" && oldSpan > 1, `no rowSpan for containerId ${containerId}, ${oldSpan}`);
47213
+ assert(logger$2n, typeof oldSpan === "number" && oldSpan > 1, `no rowSpan for containerId ${containerId}, ${oldSpan}`);
47027
47214
  oldBlockData[key] = oldSpan + 1;
47028
47215
  });
47029
47216
  const newChildren = TableGrid.virtualCellContainersGridToChildren(cells);
@@ -47036,7 +47223,7 @@ ${codeText}
47036
47223
  editor.updateBlockData(tableBlock, newBlockData);
47037
47224
  });
47038
47225
  }
47039
- const logger$2o = getLogger("table-chart");
47226
+ const logger$2m = getLogger("table-chart");
47040
47227
  function removeChart(editor, block) {
47041
47228
  const tableTools = findExistsTableTools(editor, block);
47042
47229
  if (tableTools) {
@@ -47121,7 +47308,7 @@ ${codeText}
47121
47308
  chartContainer = createElement("div", ["editor-table-chart"], tableTools);
47122
47309
  }
47123
47310
  const parent = chartContainer;
47124
- assert(logger$2o, parent, "no chart container");
47311
+ assert(logger$2m, parent, "no chart container");
47125
47312
  const options = editor.getComponentOptions("table");
47126
47313
  const cdn = (options == null ? void 0 : options.chartCdn) || "https://cdn.jsdelivr.net/npm/chart.js@2.9.4/dist/Chart.min.js";
47127
47314
  try {
@@ -47165,7 +47352,7 @@ ${codeText}
47165
47352
  chartContainer.chartObject = chartObject;
47166
47353
  }
47167
47354
  } catch (err) {
47168
- logger$2o.error(`failed to resolve chart cdn: ${JSON.stringify(err)}`);
47355
+ logger$2m.error(`failed to resolve chart cdn: ${JSON.stringify(err)}`);
47169
47356
  }
47170
47357
  }
47171
47358
  async function updateChartCore(editor, block) {
@@ -47322,7 +47509,7 @@ ${codeText}
47322
47509
  const height = document.documentElement.clientHeight;
47323
47510
  return new DOMRect(left, top, width, height);
47324
47511
  }
47325
- const logger$2n = getLogger("scroll-bar-handle");
47512
+ const logger$2l = getLogger("scroll-bar-handle");
47326
47513
  const BOTTOM_FLOAT_HEIGHT = 2;
47327
47514
  function getScrollbarContainer(scrollContainer) {
47328
47515
  const tools = getTools(scrollContainer);
@@ -47333,7 +47520,7 @@ ${codeText}
47333
47520
  scrollbarContainer.style.minHeight = "10px";
47334
47521
  }
47335
47522
  }
47336
- assert(logger$2n, scrollbarContainer instanceof HTMLDivElement, "invalid child for container tools");
47523
+ assert(logger$2l, scrollbarContainer instanceof HTMLDivElement, "invalid child for container tools");
47337
47524
  if (!scrollbarContainer.firstElementChild) {
47338
47525
  createElement("div", [], scrollbarContainer);
47339
47526
  }
@@ -47349,7 +47536,7 @@ ${codeText}
47349
47536
  fixScrollWrapRightBoundary(scrollCore, scrollContainer);
47350
47537
  fixScrollWrapLeftBoundary(scrollCore, scrollContainer);
47351
47538
  const overflowWidth = scrollWidth - clientWidth;
47352
- assert(logger$2n, scrollbarContainer.firstElementChild instanceof HTMLDivElement, "invalid child for scroll bar");
47539
+ assert(logger$2l, scrollbarContainer.firstElementChild instanceof HTMLDivElement, "invalid child for scroll bar");
47353
47540
  scrollbarContainer.style.width = `${getSizeAsScale(scrollContainer, originWidth + maxRight - paddingLeft - paddingRight)}px`;
47354
47541
  scrollbarContainer.firstElementChild.style.width = `${getSizeAsScale(scrollContainer, originWidth + maxRight + overflowWidth - paddingLeft - paddingRight)}px`;
47355
47542
  }
@@ -47436,7 +47623,7 @@ ${codeText}
47436
47623
  this.intersectionObserver.disconnect();
47437
47624
  }
47438
47625
  }
47439
- const logger$2m = getLogger("container-scroll-shadow");
47626
+ const logger$2k = getLogger("container-scroll-shadow");
47440
47627
  function setShadowBottom(shadow, scrollContainer, scrollWrap) {
47441
47628
  const elem = shadow;
47442
47629
  const contentRect = scrollContainer.getBoundingClientRect();
@@ -47455,22 +47642,22 @@ ${codeText}
47455
47642
  }
47456
47643
  function showLeftShadow(scrollContainer) {
47457
47644
  const targetTools = getTools(scrollContainer);
47458
- assert(logger$2m, targetTools, "no container tools");
47645
+ assert(logger$2k, targetTools, "no container tools");
47459
47646
  let shadow = targetTools.querySelector(`.${SHADOW_CLASS.LEFT}`);
47460
47647
  if (!shadow) {
47461
47648
  const scrollWrap = getContainerScrollArea(scrollContainer);
47462
47649
  const classes = [SHADOW_CLASS.COMMON, SHADOW_CLASS.LEFT];
47463
47650
  shadow = createElement("div", classes, targetTools);
47464
- assert(logger$2m, shadow instanceof HTMLDivElement, "invalid child for container tools");
47651
+ assert(logger$2k, shadow instanceof HTMLDivElement, "invalid child for container tools");
47465
47652
  setShadowBottom(shadow, scrollContainer, scrollWrap);
47466
47653
  }
47467
- assert(logger$2m, shadow instanceof HTMLElement, "invalid child for container tools");
47654
+ assert(logger$2k, shadow instanceof HTMLElement, "invalid child for container tools");
47468
47655
  const container = getContainer(scrollContainer);
47469
47656
  const containerRect = container.getBoundingClientRect();
47470
47657
  const scrollContainerRect = scrollContainer.getBoundingClientRect();
47471
47658
  shadow.style.left = `${getSizeAsScale(scrollContainer, scrollContainerRect.left - containerRect.left)}px`;
47472
47659
  const leftRest = getElementScrollSize(scrollContainer).scrollLeft;
47473
- assert(logger$2m, shadow instanceof HTMLDivElement, "invalid child for container tools");
47660
+ assert(logger$2k, shadow instanceof HTMLDivElement, "invalid child for container tools");
47474
47661
  setShadowWidth(shadow, leftRest);
47475
47662
  addClass(shadow, SHADOW_CLASS.ACTIVE);
47476
47663
  }
@@ -47481,17 +47668,17 @@ ${codeText}
47481
47668
  const scrollWrap = getContainerScrollArea(scrollContainer);
47482
47669
  const classes = [SHADOW_CLASS.COMMON, SHADOW_CLASS.RIGHT];
47483
47670
  shadow = createElement("div", classes, tools);
47484
- assert(logger$2m, shadow instanceof HTMLDivElement, "no div, create shadow failed");
47671
+ assert(logger$2k, shadow instanceof HTMLDivElement, "no div, create shadow failed");
47485
47672
  setShadowBottom(shadow, scrollContainer, scrollWrap);
47486
47673
  }
47487
- assert(logger$2m, shadow instanceof HTMLElement, "");
47674
+ assert(logger$2k, shadow instanceof HTMLElement, "");
47488
47675
  const container = getContainer(scrollContainer);
47489
47676
  const containerRect = container.getBoundingClientRect();
47490
47677
  const scrollContainerRect = scrollContainer.getBoundingClientRect();
47491
47678
  shadow.style.right = `${getSizeAsScale(scrollContainer, containerRect.right - scrollContainerRect.right)}px`;
47492
47679
  const { scrollWidth, scrollLeft, clientWidth } = getElementScrollSize(scrollContainer);
47493
47680
  const rightRest = scrollWidth - scrollLeft - clientWidth;
47494
- assert(logger$2m, shadow instanceof HTMLDivElement, "no shadow element");
47681
+ assert(logger$2k, shadow instanceof HTMLDivElement, "no shadow element");
47495
47682
  setShadowWidth(shadow, rightRest);
47496
47683
  addClass(shadow, SHADOW_CLASS.ACTIVE);
47497
47684
  }
@@ -47564,12 +47751,12 @@ ${codeText}
47564
47751
  this.resizeObserver.disconnect();
47565
47752
  }
47566
47753
  }
47567
- const logger$2l = getLogger("container-scroll-observer");
47754
+ const logger$2j = getLogger("container-scroll-observer");
47568
47755
  class ContainerScrollObserver {
47569
47756
  constructor(scrollCore, callback) {
47570
47757
  __publicField(this, "handleContentScroll", (e2) => {
47571
47758
  const scrollContainer = e2.target;
47572
- assert(logger$2l, scrollContainer instanceof Element, "invalid target for scroll event");
47759
+ assert(logger$2j, scrollContainer instanceof Element, "invalid target for scroll event");
47573
47760
  const scrollbarContainer = getScrollbarContainer(scrollContainer);
47574
47761
  scrollbarContainer.removeEventListener("scroll", this.handleScroll);
47575
47762
  const needFixScrollbarContainer = true;
@@ -47580,7 +47767,7 @@ ${codeText}
47580
47767
  });
47581
47768
  __publicField(this, "handleScroll", (e2) => {
47582
47769
  const scrollbarContainer = e2.target;
47583
- assert(logger$2l, scrollbarContainer instanceof HTMLElement, "");
47770
+ assert(logger$2j, scrollbarContainer instanceof HTMLElement, "");
47584
47771
  const scrollLeft = scrollbarContainer.scrollLeft;
47585
47772
  const needFixScrollbarContainer = false;
47586
47773
  const scrollContainer = getScrollContainerByScrollBar(scrollbarContainer);
@@ -47660,7 +47847,7 @@ ${codeText}
47660
47847
  this.scrollContainers.clear();
47661
47848
  }
47662
47849
  }
47663
- const logger$2k = getLogger("scroll-wrap-resize-observer");
47850
+ const logger$2i = getLogger("scroll-wrap-resize-observer");
47664
47851
  class ScrollWrapResizeObserve {
47665
47852
  constructor(scrollCore) {
47666
47853
  __publicField(this, "resizeObserver");
@@ -47676,7 +47863,7 @@ ${codeText}
47676
47863
  });
47677
47864
  __publicField(this, "handleScrollWrapResizeEntry", (entry) => {
47678
47865
  const scrollWrap = entry.target;
47679
- assert(logger$2k, scrollWrap instanceof HTMLElement, "invalid target for observer entry");
47866
+ assert(logger$2i, scrollWrap instanceof HTMLElement, "invalid target for observer entry");
47680
47867
  const scrollContainer = getScrollContainer(scrollWrap);
47681
47868
  resetScrollbar(this.scrollCore, scrollWrap);
47682
47869
  resetScrollWrapShadow(scrollContainer);
@@ -47881,7 +48068,7 @@ ${codeText}
47881
48068
  window.removeEventListener("scroll", this.handleWindowEffect);
47882
48069
  }
47883
48070
  }
47884
- const logger$2j = getLogger("scroll-container");
48071
+ const logger$2h = getLogger("scroll-container");
47885
48072
  const rootScrollMap = /* @__PURE__ */ new Map();
47886
48073
  class ScrollContainer extends tinyTypedEmitter.TypedEmitter {
47887
48074
  constructor() {
@@ -47929,11 +48116,11 @@ ${codeText}
47929
48116
  return this.scrollContainerElement;
47930
48117
  }
47931
48118
  get contentElement() {
47932
- assert(logger$2j, this.scrollContainerElement, "scrollContainerElement cannot be undefined");
48119
+ assert(logger$2h, this.scrollContainerElement, "scrollContainerElement cannot be undefined");
47933
48120
  return getContainerScrollArea(this.scrollContainerElement);
47934
48121
  }
47935
48122
  get scrollOptions() {
47936
- assert(logger$2j, this.options, "options cannot be undefined");
48123
+ assert(logger$2h, this.options, "options cannot be undefined");
47937
48124
  return { ...this.options };
47938
48125
  }
47939
48126
  handleBaseListenerDestroy(baseListener) {
@@ -47957,129 +48144,6 @@ ${codeText}
47957
48144
  function createScrollContainer() {
47958
48145
  return new ScrollContainer();
47959
48146
  }
47960
- const logger$2i = getLogger("column-width");
47961
- function setColumnWidth(table, colIndex, width) {
47962
- const col = getTableCol(table, colIndex);
47963
- col.style.width = `${width}px`;
47964
- col.style.minWidth = `${width}px`;
47965
- }
47966
- function getTableColumnWidthsFromDom(table) {
47967
- const tableCols = Array.from(table.querySelector("colgroup").children);
47968
- const widths = tableCols.map((col) => col.getBoundingClientRect().width);
47969
- if (widths[0] !== 0) {
47970
- return widths;
47971
- }
47972
- const grid = TableGrid.fromTable(table);
47973
- const cellRightOffsets = Array(grid.colCount).fill(-1);
47974
- const left = table.getBoundingClientRect().left;
47975
- grid.toRealCells(grid.cells).forEach((cell) => {
47976
- const colIndex = cell.col + cell.colSpan - 1;
47977
- if (cellRightOffsets[colIndex] === -1) {
47978
- cellRightOffsets[colIndex] = cell.cell.getBoundingClientRect().right - left;
47979
- }
47980
- });
47981
- logger$2i.debug(`cellRightOffsets1: ${cellRightOffsets.join()}`);
47982
- for (let col = 0; col < cellRightOffsets.length; col++) {
47983
- const offset = cellRightOffsets[col];
47984
- if (offset === -1 || col === 0) {
47985
- continue;
47986
- }
47987
- let prevCol = col - 1;
47988
- while (cellRightOffsets[prevCol] === -1) {
47989
- prevCol--;
47990
- if (prevCol === -1) {
47991
- break;
47992
- }
47993
- }
47994
- const prevOffset = prevCol === -1 ? 0 : cellRightOffsets[prevCol];
47995
- const totalWidth = offset - prevOffset;
47996
- const averageWidth = totalWidth / (col - prevCol);
47997
- for (let i = prevCol + 1; i < col; i++) {
47998
- cellRightOffsets[i] = prevOffset + averageWidth * (i - prevCol);
47999
- }
48000
- }
48001
- logger$2i.debug(`cellRightOffsets2: ${cellRightOffsets.join()}`);
48002
- const result = [];
48003
- let prev = 0;
48004
- for (let col = 0; col < cellRightOffsets.length; col++) {
48005
- const offset = cellRightOffsets[col];
48006
- result.push(offset - prev);
48007
- prev = offset;
48008
- }
48009
- logger$2i.debug(`widths: ${result.join()}`);
48010
- return result;
48011
- }
48012
- function getTableColumnWidths(table) {
48013
- const tableCols = Array.from(table.querySelector("colgroup").children);
48014
- const widths = tableCols.map((col) => col.getBoundingClientRect().width || Number.parseInt(col.style.width, 10));
48015
- return widths;
48016
- }
48017
- const logger$2h = getLogger("table-resize-gripper");
48018
- const GRIPPER_SIZE = 7;
48019
- const GRIPPER_SIZE_HALF = (GRIPPER_SIZE - 1) / 2;
48020
- const CONTAINER_CELL_DELTA = 3;
48021
- function getCellFromRightBorder(table, x, y) {
48022
- const { rows } = table;
48023
- for (let i = 0; i < rows.length; i++) {
48024
- const row = rows[i];
48025
- const cells = Array.from(row.cells);
48026
- for (let j = 0; j < cells.length; j++) {
48027
- const cell = cells[j];
48028
- const rect = cell.getBoundingClientRect();
48029
- const pos = Math.round(rect.right);
48030
- if (Math.abs(x - pos) <= GRIPPER_SIZE_HALF && rect.top <= y && y <= rect.bottom) {
48031
- return cell;
48032
- }
48033
- }
48034
- }
48035
- return null;
48036
- }
48037
- function editorHasExistsResizeGripper(editor) {
48038
- return !!editor.rootContainer.querySelector(".table-resize-gripper");
48039
- }
48040
- function getExistsResizeGripper$1(editor, block) {
48041
- const tools = getTableTools(editor, block);
48042
- const gripper = tools.querySelector(".table-resize-gripper");
48043
- return gripper;
48044
- }
48045
- function createResizeGripper$2(editor, block) {
48046
- const exists = getExistsResizeGripper$1(editor, block);
48047
- assert(logger$2h, !exists, "resize gripper has already exists");
48048
- const tools = getTableTools(editor, block);
48049
- const gripper = createElement("div", ["table-resize-gripper", "table-indicator"], tools);
48050
- createElement("div", ["table-resize-gripper-indicator"], gripper);
48051
- return gripper;
48052
- }
48053
- function updateResizeGripper$1(editor, block, cell) {
48054
- let gripper = getExistsResizeGripper$1(editor, block);
48055
- if (!gripper) {
48056
- gripper = createResizeGripper$2(editor, block);
48057
- }
48058
- const table = getBlockTable(block);
48059
- const tableRect = table.getBoundingClientRect();
48060
- const cellRect = cell.getBoundingClientRect();
48061
- const top = 0;
48062
- const height = tableRect.height;
48063
- const scrollContentRect = editor.getCustom(getTableScrollKey(block)).contentElement.getBoundingClientRect();
48064
- const left = cellRect.right - scrollContentRect.left;
48065
- gripper.style.left = `${left - GRIPPER_SIZE_HALF - TABLE_BAR_WIDTH - INSERT_BUTTON_SIZE}px`;
48066
- gripper.style.top = `${top}px`;
48067
- gripper.style.height = `${height}px`;
48068
- gripper.style.width = `${GRIPPER_SIZE}px`;
48069
- }
48070
- function removeAllResizeGripper(editor) {
48071
- editor.rootContainer.querySelectorAll(".table-resize-gripper").forEach((gripper) => {
48072
- gripper.remove();
48073
- });
48074
- }
48075
- function setTableColumnWidths(editor, block, colsWidth) {
48076
- const oldData = editor.getBlockData(block);
48077
- const newData = {
48078
- ...oldData,
48079
- colsWidth
48080
- };
48081
- editor.updateBlockData(block, newData, void 0, { noScroll: true });
48082
- }
48083
48147
  function getTableResizeMinX(editor, draggingRefCell, table, x) {
48084
48148
  const cell = draggingRefCell;
48085
48149
  const grid = TableGrid.fromTable(table);
@@ -54764,7 +54828,7 @@ ${codeText}
54764
54828
  };
54765
54829
  return { blockData };
54766
54830
  }
54767
- function getOptions$8(editor) {
54831
+ function getOptions$9(editor) {
54768
54832
  return {
54769
54833
  name: "Mathjax"
54770
54834
  };
@@ -54796,7 +54860,7 @@ $$${mathData.mathjaxText}$$
54796
54860
  const MathjaxEmbed = {
54797
54861
  embedType: "math",
54798
54862
  createEmbedContent: createEmbedContent$9,
54799
- getOptions: getOptions$8,
54863
+ getOptions: getOptions$9,
54800
54864
  convertFrom: convertFrom$7,
54801
54865
  handleDeleteBlock: handleDeleteBlock$7,
54802
54866
  convertTo: convertTo$g,
@@ -65266,7 +65330,7 @@ $$${mathData.mathjaxText}$$
65266
65330
  editor.focus();
65267
65331
  return editor.insertBlock(options.containerId, options.blockIndex, blockData, createBlockSimpleRange(editor, focusBlockId, 0));
65268
65332
  }
65269
- function getOptions$7(editor) {
65333
+ function getOptions$8(editor) {
65270
65334
  return {
65271
65335
  name: "CodeBlock",
65272
65336
  insertBlockCommandItems: [
@@ -65331,7 +65395,7 @@ ${codeText}
65331
65395
  getSelectedContainers: getSelectedContainers$2,
65332
65396
  convertFrom: convertToCode,
65333
65397
  handleBlockElementUpdated,
65334
- getOptions: getOptions$7,
65398
+ getOptions: getOptions$8,
65335
65399
  getBlockProperties: getBlockProperties$a,
65336
65400
  convertTo: convertTo$e,
65337
65401
  handleDeleteBlock: handleDeleteBlock$6
@@ -68308,7 +68372,7 @@ ${codeText}
68308
68372
  abstract: `${i18n$1.t("image.abstract")}`
68309
68373
  };
68310
68374
  };
68311
- function getOptions$6() {
68375
+ function getOptions$7() {
68312
68376
  return {
68313
68377
  name: "Image",
68314
68378
  insertEmbedCommandItems: [{
@@ -68408,7 +68472,7 @@ ${codeText}
68408
68472
  convertTo: convertTo$d,
68409
68473
  convertFrom: convertFrom$6,
68410
68474
  getBlockProperties: getBlockProperties$9,
68411
- getOptions: getOptions$6,
68475
+ getOptions: getOptions$7,
68412
68476
  handleDrop: handleDrop$1,
68413
68477
  handleDropOver: handleDropOver$1,
68414
68478
  handleDeleteBlock: handleDeleteBlock$5
@@ -73225,7 +73289,7 @@ ${codeText}
73225
73289
  }
73226
73290
  return createEmptyTableDataByFirstRowText(editor, editor.getBlockString(srcBlock).trim());
73227
73291
  }
73228
- function getOptions$5(editor) {
73292
+ function getOptions$6(editor) {
73229
73293
  return {
73230
73294
  name: "TableBlock",
73231
73295
  insertBlockCommandItems: [{
@@ -73302,7 +73366,7 @@ ${codeText}
73302
73366
  adjustSelectionPos,
73303
73367
  getClientRects,
73304
73368
  selectionToDoc,
73305
- getOptions: getOptions$5,
73369
+ getOptions: getOptions$6,
73306
73370
  getTextToolbarReferenceClient: getTextToolbarReferenceClient$1,
73307
73371
  handleUpdateBlock: handleUpdateBlock$5,
73308
73372
  handleDeleteBlock: handleDeleteBlock$4,
@@ -73338,6 +73402,7 @@ ${codeText}
73338
73402
  splitCell: "\u62C6\u5206\u5355\u5143\u683C",
73339
73403
  tableConfigKey: "\u8868\u683C\u8BBE\u7F6E",
73340
73404
  deleteTable: "\u5220\u9664\u8868\u683C",
73405
+ adjustColumnWidthsEvenly: "\u5E73\u5747\u5206\u914D\u5217\u5BBD",
73341
73406
  insertCol: "\u63D2\u5165\u5217",
73342
73407
  insertRow: "\u63D2\u5165\u884C",
73343
73408
  deleteCol: "\u5220\u9664\u5217",
@@ -73369,6 +73434,7 @@ ${codeText}
73369
73434
  splitCell: "Split cell",
73370
73435
  tableConfigKey: "Table settings",
73371
73436
  deleteTable: "Delete table",
73437
+ adjustColumnWidthsEvenly: "Adjust column widths evenly",
73372
73438
  insertCol: "Insert column",
73373
73439
  insertRow: "Insert row",
73374
73440
  deleteCol: "Delete column",
@@ -73400,6 +73466,7 @@ ${codeText}
73400
73466
  splitCell: "\u30BB\u30EB\u306E\u7D50\u5408\u3092\u89E3\u9664",
73401
73467
  tableConfigKey: "\u30C6\u30FC\u30D6\u30EB\u8A2D\u5B9A",
73402
73468
  deleteTable: "\u30C6\u30FC\u30D6\u30EB\u3092\u524A\u9664",
73469
+ adjustColumnWidthsEvenly: "\u5217\u5E45\u3092\u5747\u7B49\u306B\u8ABF\u6574",
73403
73470
  insertCol: "\u5217\u3092\u633F\u5165",
73404
73471
  insertRow: "\u884C\u3092\u633F\u5165",
73405
73472
  deleteCol: "\u5217\u3092\u524A\u9664",
@@ -76795,25 +76862,8 @@ ${docStr}
76795
76862
  };
76796
76863
  }
76797
76864
  }
76798
- function isContainHyperlink(text2) {
76799
- const pattern = /^([\d\w\u4e00-\u9fa5\s]*[\u4e00-\u9fa5\s]{1}|)((https|http|ftp)?:\/\/)[^\s]+/;
76800
- return pattern.test(text2);
76801
- }
76802
- function transText2TextOp(text2) {
76803
- const ret = [];
76804
- const prefix = text2.split(/https|http|ftp/)[0];
76805
- const link2 = text2.substring(prefix.length).trim();
76806
- if (prefix && prefix.length) {
76807
- const textOp = createTextOp(prefix, null);
76808
- ret.push(textOp, createTextOp(" ", null));
76809
- }
76810
- const linkOp = createTextOp(link2, { link: link2 });
76811
- ret.push(linkOp, createTextOp(" ", null));
76812
- return ret;
76813
- }
76814
76865
  class TextDataConverter {
76815
- async fromData(editor, data2, options) {
76816
- const { toPlainText: toPlainText2 = false } = options || {};
76866
+ async fromData(editor, data2) {
76817
76867
  const result = {};
76818
76868
  const text2 = data2.getData("text/plain");
76819
76869
  if (text2) {
@@ -76823,10 +76873,6 @@ ${docStr}
76823
76873
  id: genId(),
76824
76874
  type: "text"
76825
76875
  };
76826
- if (isContainHyperlink(line) && !toPlainText2) {
76827
- block.text = transText2TextOp(line);
76828
- return block;
76829
- }
76830
76876
  const text22 = line ? [createTextOp(line, null)] : [];
76831
76877
  block.text = text22;
76832
76878
  return block;
@@ -76843,6 +76889,103 @@ ${docStr}
76843
76889
  return result;
76844
76890
  }
76845
76891
  }
76892
+ function findLinks(text2) {
76893
+ const pattern = /https?:\/\/[^\s/$.?#].[^\s]*/g;
76894
+ const results = [];
76895
+ let match;
76896
+ while ((match = pattern.exec(text2)) !== null) {
76897
+ const url = match[0];
76898
+ const startIndex = match.index;
76899
+ const endIndex = pattern.lastIndex;
76900
+ results.push({ url, startIndex, endIndex });
76901
+ }
76902
+ return results;
76903
+ }
76904
+ function urlToLinkOp(result) {
76905
+ const attributes = {
76906
+ link: result.url
76907
+ };
76908
+ return {
76909
+ insert: result.url,
76910
+ attributes
76911
+ };
76912
+ }
76913
+ function opToLinks(op) {
76914
+ var _a, _b;
76915
+ if ((_a = op.attributes) == null ? void 0 : _a.box) {
76916
+ return [op];
76917
+ }
76918
+ if ((_b = op.attributes) == null ? void 0 : _b.link) {
76919
+ return [op];
76920
+ }
76921
+ const text2 = op.insert;
76922
+ const attributes = op.attributes;
76923
+ const results = findLinks(text2);
76924
+ if (results.length === 0) {
76925
+ return [op];
76926
+ }
76927
+ let current = text2;
76928
+ const ops = [];
76929
+ for (let i = results.length - 1; i >= 0; i--) {
76930
+ const result = results[i];
76931
+ const right = current.substring(result.endIndex);
76932
+ if (right) {
76933
+ const rightOp = {
76934
+ insert: right
76935
+ };
76936
+ if (attributes) {
76937
+ rightOp.attributes = JSON.parse(JSON.stringify(attributes));
76938
+ }
76939
+ ops.unshift(rightOp);
76940
+ }
76941
+ const boxOp = urlToLinkOp(result);
76942
+ if (boxOp) {
76943
+ ops.unshift(boxOp);
76944
+ } else {
76945
+ const keepText = current.substring(result.startIndex, result.endIndex);
76946
+ const keepOp = {
76947
+ insert: keepText
76948
+ };
76949
+ if (attributes) {
76950
+ keepOp.attributes = attributes;
76951
+ }
76952
+ ops.unshift(keepOp);
76953
+ }
76954
+ current = current.substring(0, result.startIndex);
76955
+ }
76956
+ if (current) {
76957
+ const lastOp = {
76958
+ insert: current
76959
+ };
76960
+ if (attributes) {
76961
+ lastOp.attributes = attributes;
76962
+ }
76963
+ ops.unshift(lastOp);
76964
+ }
76965
+ return ops;
76966
+ }
76967
+ class ConvertLinkPasteHandler {
76968
+ constructor() {
76969
+ __publicField(this, "order");
76970
+ this.order = 200;
76971
+ }
76972
+ async handleBeforePasteDoc(editor, doc2) {
76973
+ for (const blocks of Object.values(doc2.blocks)) {
76974
+ for (const block of blocks) {
76975
+ if (block.type === "text") {
76976
+ const ops = block.text || [];
76977
+ const newOps = [];
76978
+ for (const op of ops) {
76979
+ const subOps = opToLinks(op);
76980
+ newOps.push(...subOps);
76981
+ }
76982
+ block.text = newOps;
76983
+ }
76984
+ }
76985
+ }
76986
+ return false;
76987
+ }
76988
+ }
76846
76989
  function getImages(files) {
76847
76990
  const images = [];
76848
76991
  for (let i = 0; i < files.length; i++) {
@@ -76856,6 +76999,7 @@ ${docStr}
76856
76999
  }
76857
77000
  class OnesEditorPasteHandler {
76858
77001
  constructor(editor) {
77002
+ editor.input.addHandler(new ConvertLinkPasteHandler());
76859
77003
  editor.dataConverter.addConverter(new HtmlDataConverter());
76860
77004
  editor.dataConverter.addConverter(new TextDataConverter());
76861
77005
  editor.dataConverter.addConverter(new MarkdownDataConverter());
@@ -82058,24 +82202,45 @@ ${docStr}
82058
82202
  };
82059
82203
  return { blockData };
82060
82204
  }
82205
+ function getOptions$5() {
82206
+ return {
82207
+ name: "toc",
82208
+ insertEmbedCommandItems: [{
82209
+ id: "insert-toc",
82210
+ name: i18n$1.t("toc.name"),
82211
+ icon: TocIcon,
82212
+ order: 510,
82213
+ group: "common",
82214
+ subText: getShortcutById("insert-toc")
82215
+ }],
82216
+ handleInsertEmptyEmbed: async (editor, options) => {
82217
+ const { containerId, blockIndex } = options;
82218
+ return editor.insertEmbed(containerId, blockIndex, "toc", {});
82219
+ }
82220
+ };
82221
+ }
82061
82222
  const TocEmbed = {
82062
82223
  embedType: "toc",
82063
82224
  createEmbedContent: createEmbedContent$6,
82064
82225
  convertTo: convertTo$8,
82065
- convertFrom: convertFrom$4
82226
+ convertFrom: convertFrom$4,
82227
+ getOptions: getOptions$5
82066
82228
  };
82067
82229
  const zhCN$c = {
82068
82230
  toc: {
82231
+ name: "\u6807\u9898\u76EE\u5F55",
82069
82232
  empty: "No Toc"
82070
82233
  }
82071
82234
  };
82072
82235
  const enUS$c = {
82073
82236
  toc: {
82237
+ name: "Toc",
82074
82238
  empty: "No Toc"
82075
82239
  }
82076
82240
  };
82077
82241
  const jaJP$c = {
82078
82242
  toc: {
82243
+ name: "Toc",
82079
82244
  empty: "No Toc"
82080
82245
  }
82081
82246
  };
@@ -86613,7 +86778,7 @@ ${data2.plantumlText}
86613
86778
  this.editor.removeListener("selectionChanged", this.handleSelectionChange);
86614
86779
  this.editor.removeListener("docChanged", this.handleSelectionChange);
86615
86780
  document.removeEventListener("touchstart", this.handleTouchStart);
86616
- document.removeEventListener("touchend", this.handleTouchEnd);
86781
+ document.removeEventListener("touchend", this.handleTouchEnd, { capture: true });
86617
86782
  document.removeEventListener("touchmove", this.handleTouchMove);
86618
86783
  this.mobileEmbedMask.destroy();
86619
86784
  this.cursorToolbar.destroy();
@@ -90536,7 +90701,7 @@ ${data2.plantumlText}
90536
90701
  break;
90537
90702
  }
90538
90703
  return {
90539
- level: v,
90704
+ level: v % 8,
90540
90705
  format: format2,
90541
90706
  text: `%${v + 1}. `,
90542
90707
  alignment: docx.AlignmentType.START,
@@ -92797,7 +92962,7 @@ ${data2.plantumlText}
92797
92962
  }
92798
92963
  }
92799
92964
  });
92800
- editor.version = "2.8.15";
92965
+ editor.version = "2.8.16-beta.2";
92801
92966
  return editor;
92802
92967
  }
92803
92968
  function isDoc(doc2) {
@@ -92910,7 +93075,7 @@ ${data2.plantumlText}
92910
93075
  }
92911
93076
  });
92912
93077
  OnesEditorToolbar.register(editor);
92913
- editor.version = "2.8.15";
93078
+ editor.version = "2.8.16-beta.2";
92914
93079
  return editor;
92915
93080
  }
92916
93081
  async function showDocVersions(editor, options, serverUrl) {
@@ -138687,6 +138852,7 @@ ${data2.plantumlText}
138687
138852
  exports2.AddCommentToOldDocCommandProvider = AddCommentToOldDocCommandProvider;
138688
138853
  exports2.AddEmojiIcon = AddEmojiIcon;
138689
138854
  exports2.AddIcon = AddIcon;
138855
+ exports2.AdjustWidthIcon = AdjustWidthIcon;
138690
138856
  exports2.AlertDialog = AlertDialog;
138691
138857
  exports2.AlertEmojiIcon = alterEmoji;
138692
138858
  exports2.AlignCenterIcon = AlignCenterIcon;
@@ -138962,6 +139128,7 @@ ${data2.plantumlText}
138962
139128
  exports2.TimeIcon = TimeIcon;
138963
139129
  exports2.ToMindMapIcon = ToMindMapIcon;
138964
139130
  exports2.TocEmbed = TocEmbed;
139131
+ exports2.TocIcon = TocIcon;
138965
139132
  exports2.TreeIcon = TreeIcon;
138966
139133
  exports2.UmlBrandIcon = UmlBrandIcon;
138967
139134
  exports2.UmlIcon = UmlIcon;