@ones-editor/editor 2.8.14-beta.5 → 2.8.14-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -12978,7 +12978,7 @@ var __publicField = (obj, key, value) => {
12978
12978
  }
12979
12979
  return {};
12980
12980
  }
12981
- function getOptions$a(editor) {
12981
+ function getOptions$9(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$a,
13074
+ getOptions: getOptions$9,
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 = mobileClient && clientType.isMobile ? mobileClient.getViewPortHeight() : window.innerHeight;
26199
+ const innerHeight = 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
  }
@@ -26677,15 +26677,20 @@ var __publicField = (obj, key, value) => {
26677
26677
  return deleteCount;
26678
26678
  }
26679
26679
  const logger$3I = getLogger("break-text-block");
26680
- function copyBlockAttributes(editor, block) {
26680
+ function copyBlockAttributes(editor, block, options) {
26681
26681
  const blockData = editor.getBlockData(block);
26682
26682
  const quoted = blockData.quoted;
26683
+ const ret = {};
26683
26684
  if (quoted) {
26684
- return {
26685
- quoted
26686
- };
26685
+ ret.quoted = quoted;
26687
26686
  }
26688
- return {};
26687
+ if (options == null ? void 0 : options.copyHeading) {
26688
+ const heading = blockData.heading;
26689
+ if (heading) {
26690
+ ret.heading = heading;
26691
+ }
26692
+ }
26693
+ return ret;
26689
26694
  }
26690
26695
  function editorBreakTextBlock(editor, block, offset, options) {
26691
26696
  assert(logger$3I, isTextKindBlock(editor, block), `block is not a text kind block: ${getBlockType(block)}`);
@@ -40623,8 +40628,6 @@ ${codeText}
40623
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';
40624
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';
40625
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';
40626
- 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';
40627
- 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';
40628
40631
  const index$f = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
40629
40632
  __proto__: null,
40630
40633
  TableEditIcon,
@@ -40752,9 +40755,7 @@ ${codeText}
40752
40755
  SearchIcon,
40753
40756
  CalloutIcon: CalloutIcon$1,
40754
40757
  LoadingCircleIcon,
40755
- TextGroupIcon,
40756
- AdjustWidthIcon,
40757
- TocIcon
40758
+ TextGroupIcon
40758
40759
  }, Symbol.toStringTag, { value: "Module" }));
40759
40760
  function createLoading() {
40760
40761
  const loading2 = createElement("span", ["editor-loading-icon"], null);
@@ -44008,9 +44009,6 @@ ${codeText}
44008
44009
  "insert-emoji": {
44009
44010
  shortcut: "/emoji"
44010
44011
  },
44011
- "insert-toc": {
44012
- shortcut: "/toc"
44013
- },
44014
44012
  ...fontShortCuts()
44015
44013
  };
44016
44014
  function getShortcutById(id) {
@@ -46560,91 +46558,6 @@ ${codeText}
46560
46558
  editor.deleteChildContainers(deletedContainers);
46561
46559
  });
46562
46560
  }
46563
- var TABLE_CLASS = /* @__PURE__ */ ((TABLE_CLASS2) => {
46564
- TABLE_CLASS2["COL_TITLE_TABLE"] = "col-title-table";
46565
- TABLE_CLASS2["COL_TITLE_ITEM"] = "col-title-item";
46566
- TABLE_CLASS2["STRIPE_STYLE_TABLE"] = "stripe-style-table";
46567
- TABLE_CLASS2["NO_BORDER"] = "table-no-border";
46568
- return TABLE_CLASS2;
46569
- })(TABLE_CLASS || {});
46570
- const TABLE_BAR_WIDTH = 6;
46571
- const INSERT_BUTTON_SIZE = 20;
46572
- const TABLE_CELL_MENU_BUTTON_CLASS = "table-cell-menu-btn";
46573
- const logger$2r = getLogger("table-resize-gripper");
46574
- const GRIPPER_SIZE = 7;
46575
- const GRIPPER_SIZE_HALF = (GRIPPER_SIZE - 1) / 2;
46576
- const CONTAINER_CELL_DELTA = 3;
46577
- function getCellFromRightBorder(table, x, y) {
46578
- const { rows } = table;
46579
- for (let i = 0; i < rows.length; i++) {
46580
- const row = rows[i];
46581
- const cells = Array.from(row.cells);
46582
- for (let j = 0; j < cells.length; j++) {
46583
- const cell = cells[j];
46584
- const rect = cell.getBoundingClientRect();
46585
- const pos = Math.round(rect.right);
46586
- if (Math.abs(x - pos) <= GRIPPER_SIZE_HALF && rect.top <= y && y <= rect.bottom) {
46587
- return cell;
46588
- }
46589
- }
46590
- }
46591
- return null;
46592
- }
46593
- function editorHasExistsResizeGripper(editor) {
46594
- return !!editor.rootContainer.querySelector(".table-resize-gripper");
46595
- }
46596
- function getExistsResizeGripper$1(editor, block) {
46597
- const tools = getTableTools(editor, block);
46598
- const gripper = tools.querySelector(".table-resize-gripper");
46599
- return gripper;
46600
- }
46601
- function createResizeGripper$2(editor, block) {
46602
- const exists = getExistsResizeGripper$1(editor, block);
46603
- assert(logger$2r, !exists, "resize gripper has already exists");
46604
- const tools = getTableTools(editor, block);
46605
- const gripper = createElement("div", ["table-resize-gripper", "table-indicator"], tools);
46606
- createElement("div", ["table-resize-gripper-indicator"], gripper);
46607
- return gripper;
46608
- }
46609
- function updateResizeGripper$1(editor, block, cell) {
46610
- let gripper = getExistsResizeGripper$1(editor, block);
46611
- if (!gripper) {
46612
- gripper = createResizeGripper$2(editor, block);
46613
- }
46614
- const table = getBlockTable(block);
46615
- const tableRect = table.getBoundingClientRect();
46616
- const cellRect = cell.getBoundingClientRect();
46617
- const top = 0;
46618
- const height = tableRect.height;
46619
- const scrollContentRect = editor.getCustom(getTableScrollKey(block)).contentElement.getBoundingClientRect();
46620
- const left = cellRect.right - scrollContentRect.left;
46621
- gripper.style.left = `${left - GRIPPER_SIZE_HALF - TABLE_BAR_WIDTH - INSERT_BUTTON_SIZE}px`;
46622
- gripper.style.top = `${top}px`;
46623
- gripper.style.height = `${height}px`;
46624
- gripper.style.width = `${GRIPPER_SIZE}px`;
46625
- }
46626
- function removeAllResizeGripper(editor) {
46627
- editor.rootContainer.querySelectorAll(".table-resize-gripper").forEach((gripper) => {
46628
- gripper.remove();
46629
- });
46630
- }
46631
- function setTableColumnWidths(editor, block, colsWidth) {
46632
- const oldData = editor.getBlockData(block);
46633
- const newData = {
46634
- ...oldData,
46635
- colsWidth
46636
- };
46637
- editor.updateBlockData(block, newData, void 0, { noScroll: true });
46638
- }
46639
- function adjustColumnWidthsEvenly(editor, tableBlock) {
46640
- const tableData = editor.getBlockData(tableBlock);
46641
- const grid = tableData2Grid(tableData);
46642
- const colCount = grid.colCount;
46643
- const table = getBlockTable(tableBlock);
46644
- const tableWidth = table.getBoundingClientRect().width;
46645
- const colWidth = tableWidth / colCount;
46646
- setTableColumnWidths(editor, tableBlock, Array(colCount).fill(colWidth));
46647
- }
46648
46561
  const TABLE_COMMAND_GROUP_INDEX = 10;
46649
46562
  const TableCommands = [
46650
46563
  "table/merge-cells",
@@ -46653,8 +46566,7 @@ ${codeText}
46653
46566
  "table/insert-row",
46654
46567
  "table/delete-rows",
46655
46568
  "table/delete-columns",
46656
- "table/delete",
46657
- "table/adjust-column-widths-evenly"
46569
+ "table/delete"
46658
46570
  ];
46659
46571
  class TableBlockCommandProvider {
46660
46572
  constructor() {
@@ -46666,8 +46578,6 @@ ${codeText}
46666
46578
  return [];
46667
46579
  }
46668
46580
  const commands = [];
46669
- const deleteColumns2 = canDeleteColumns(editor, block, range);
46670
- const deleteRows2 = canDeleteRows(editor, block, range);
46671
46581
  if (canMergeCells(editor, block, range)) {
46672
46582
  commands.push({
46673
46583
  id: "table/merge-cells",
@@ -46682,6 +46592,8 @@ ${codeText}
46682
46592
  icon: SplitCellIcon
46683
46593
  });
46684
46594
  }
46595
+ const deleteColumns2 = canDeleteColumns(editor, block, range);
46596
+ const deleteRows2 = canDeleteRows(editor, block, range);
46685
46597
  if (deleteColumns2 && deleteRows2) {
46686
46598
  commands.push({
46687
46599
  id: "table/delete",
@@ -46689,14 +46601,6 @@ ${codeText}
46689
46601
  icon: DeleteTableIcon
46690
46602
  });
46691
46603
  }
46692
- const allColumnsSelected = deleteRows2;
46693
- if (allColumnsSelected) {
46694
- commands.push({
46695
- id: "table/adjust-column-widths-evenly",
46696
- name: i18n$1.t("table.adjustColumnWidthsEvenly"),
46697
- icon: AdjustWidthIcon
46698
- });
46699
- }
46700
46604
  return commands;
46701
46605
  }
46702
46606
  executeCommand(editor, block, range, command, params, result) {
@@ -46726,13 +46630,19 @@ ${codeText}
46726
46630
  editor.deleteBlock(block);
46727
46631
  return true;
46728
46632
  }
46729
- if (command.id === "table/adjust-column-widths-evenly") {
46730
- adjustColumnWidthsEvenly(editor, block);
46731
- return true;
46732
- }
46733
46633
  return false;
46734
46634
  }
46735
46635
  }
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";
46736
46646
  function setColTitle(editor, tableBlock) {
46737
46647
  if (!editor.isBlockWritable(tableBlock)) {
46738
46648
  return;
@@ -46810,26 +46720,26 @@ ${codeText}
46810
46720
  };
46811
46721
  editor.updateBlockData(tableBlock, newBlockData);
46812
46722
  }
46813
- const logger$2q = getLogger("table-cell-dom");
46723
+ const logger$2r = getLogger("table-cell-dom");
46814
46724
  function getCellElementByChildBlockId(editor, tableBlock, blockId) {
46815
46725
  let blockElement = editor.getBlockById(blockId);
46816
46726
  while (blockElement) {
46817
46727
  const cell = blockElement.closest("td");
46818
- assert(logger$2q, cell, "no parent cell");
46728
+ assert(logger$2r, cell, "no parent cell");
46819
46729
  const cellParentBlock = getParentBlock(cell);
46820
- assert(logger$2q, cellParentBlock, "no parent block");
46730
+ assert(logger$2r, cellParentBlock, "no parent block");
46821
46731
  if (cellParentBlock === tableBlock) {
46822
46732
  return cell;
46823
46733
  }
46824
46734
  blockElement = cellParentBlock;
46825
46735
  }
46826
- assert(logger$2q, false, "filed to get cell by child block id");
46736
+ assert(logger$2r, false, "filed to get cell by child block id");
46827
46737
  return null;
46828
46738
  }
46829
46739
  function createComplexPosFromBlockPos(editor, tableBlock, blockPosition) {
46830
46740
  const blockElement = editor.getBlockById(blockPosition.blockId);
46831
46741
  if (blockElement === tableBlock && !blockPosition.isSimple()) {
46832
- assert(logger$2q, blockPosition.childContainerId, "block position must have childContainerId attribute");
46742
+ assert(logger$2r, blockPosition.childContainerId, "block position must have childContainerId attribute");
46833
46743
  return blockPosition;
46834
46744
  }
46835
46745
  const cellElement = getCellElementByChildBlockId(editor, tableBlock, blockPosition.blockId);
@@ -46843,12 +46753,12 @@ ${codeText}
46843
46753
  return getTableSelectionRange(tableBlock, start, end);
46844
46754
  }
46845
46755
  function updateBarsDangerStatus(editor, tableBlock, selectedRows, selectedColumns) {
46846
- assert(logger$2q, isTableBlock(tableBlock), "invalid table block");
46756
+ assert(logger$2r, isTableBlock(tableBlock), "invalid table block");
46847
46757
  const tools = getTableTools(editor, tableBlock);
46848
46758
  const blockTools = getBlockTools(tableBlock);
46849
46759
  const updateTop = () => {
46850
46760
  const exists = tools.querySelector(".table-border-bar-container.top");
46851
- assert(logger$2q, exists, "no top border bar container");
46761
+ assert(logger$2r, exists, "no top border bar container");
46852
46762
  const cells = exists.querySelectorAll(".table-border-bar-cell.top");
46853
46763
  cells.forEach((cell) => {
46854
46764
  const colIndex = parseInt(cell.getAttribute("data-top-index") || "0", 10);
@@ -46861,7 +46771,7 @@ ${codeText}
46861
46771
  };
46862
46772
  const updateLeft = () => {
46863
46773
  const left = blockTools.querySelector(".table-border-bar-container.left");
46864
- assert(logger$2q, left, "no left border bar container");
46774
+ assert(logger$2r, left, "no left border bar container");
46865
46775
  const cells = left.querySelectorAll(".table-border-bar-cell.left");
46866
46776
  cells.forEach((cell) => {
46867
46777
  const rowIndex = parseInt(cell.getAttribute("data-left-index") || "0", 10);
@@ -46897,7 +46807,7 @@ ${codeText}
46897
46807
  }
46898
46808
  }
46899
46809
  } catch (error2) {
46900
- logger$2q.error("update cells danger status failed: ", error2.message);
46810
+ logger$2r.error("update cells danger status failed: ", error2.message);
46901
46811
  }
46902
46812
  }
46903
46813
  function updateCellBarsDangerStatus(editor, tableBlock, isDanger = true, isCol) {
@@ -46920,7 +46830,7 @@ ${codeText}
46920
46830
  }
46921
46831
  updateBarsDangerStatus(editor, tableBlock, Array.from(selectedRows), Array.from(selectedColumns));
46922
46832
  } catch (error2) {
46923
- logger$2q.error("update cell bars danger status failed: ", error2.message);
46833
+ logger$2r.error("update cell bars danger status failed: ", error2.message);
46924
46834
  }
46925
46835
  }
46926
46836
  function createEntireRowAndColumnRange(editor, tableBlock, isCol) {
@@ -47039,14 +46949,14 @@ ${codeText}
47039
46949
  }
47040
46950
  const DEFAULT_COLUMN_WIDTH$1 = 200;
47041
46951
  const MIN_COLUMN_WIDTH = 40;
47042
- const logger$2p = getLogger("table-insert-column");
46952
+ const logger$2q = getLogger("table-insert-column");
47043
46953
  function insertColumn(editor, tableBlock, insertIndex) {
47044
46954
  editor.undoManager.runInGroup(() => {
47045
46955
  var _a;
47046
46956
  const table = getBlockTable(tableBlock);
47047
46957
  const grid = TableGrid.fromTable(table);
47048
46958
  const colCount = grid.colCount;
47049
- assert(logger$2p, insertIndex >= 0 && insertIndex <= colCount, `insert index ${insertIndex} is out of range [0, ${colCount}]`);
46959
+ assert(logger$2q, insertIndex >= 0 && insertIndex <= colCount, `insert index ${insertIndex} is out of range [0, ${colCount}]`);
47050
46960
  const cells = grid.map((cell) => cell.containerId);
47051
46961
  const spannedContainerIds = /* @__PURE__ */ new Set();
47052
46962
  editor.doc.beginBatchUpdate();
@@ -47067,7 +46977,7 @@ ${codeText}
47067
46977
  spannedContainerIds.forEach((containerId) => {
47068
46978
  const key = `${containerId}_colSpan`;
47069
46979
  const oldSpan = oldBlockData[key];
47070
- assert(logger$2p, typeof oldSpan === "number" && oldSpan > 1, `no colSpan for containerId ${containerId}, ${oldSpan}`);
46980
+ assert(logger$2q, typeof oldSpan === "number" && oldSpan > 1, `no colSpan for containerId ${containerId}, ${oldSpan}`);
47071
46981
  oldBlockData[key] = oldSpan + 1;
47072
46982
  });
47073
46983
  const colsWidth = ((_a = oldBlockData.colsWidth) == null ? void 0 : _a.concat()) || new Array(oldBlockData.cols).fill(0);
@@ -47083,13 +46993,13 @@ ${codeText}
47083
46993
  editor.updateBlockData(tableBlock, newBlockData);
47084
46994
  });
47085
46995
  }
47086
- const logger$2o = getLogger("table-insert-row");
46996
+ const logger$2p = getLogger("table-insert-row");
47087
46997
  function insertRow(editor, tableBlock, insertIndex) {
47088
46998
  editor.undoManager.runInGroup(() => {
47089
46999
  const table = getBlockTable(tableBlock);
47090
47000
  const grid = TableGrid.fromTable(table);
47091
47001
  const rowCount = grid.rowCount;
47092
- assert(logger$2o, insertIndex >= 0 && insertIndex <= rowCount, `insert index ${insertIndex} is out of range [0, ${rowCount}]`);
47002
+ assert(logger$2p, insertIndex >= 0 && insertIndex <= rowCount, `insert index ${insertIndex} is out of range [0, ${rowCount}]`);
47093
47003
  const cells = grid.map((cell) => cell.containerId);
47094
47004
  const spannedContainerIds = /* @__PURE__ */ new Set();
47095
47005
  editor.doc.beginBatchUpdate();
@@ -47097,12 +47007,12 @@ ${codeText}
47097
47007
  for (let col = 0; col < grid.colCount; col++) {
47098
47008
  const top = insertIndex > 0 && cells[insertIndex - 1][col];
47099
47009
  const bottom = insertIndex < grid.rowCount && cells[insertIndex][col];
47100
- assert(logger$2o, top || bottom, "no top and bottom cell");
47010
+ assert(logger$2p, top || bottom, "no top and bottom cell");
47101
47011
  if (insertIndex === 0 || insertIndex === grid.rowCount || top !== bottom) {
47102
47012
  const newContainerId = createEmptyContainer(editor.doc);
47103
47013
  rowData.push(newContainerId);
47104
47014
  } else {
47105
- assert(logger$2o, top, "no top cell");
47015
+ assert(logger$2p, top, "no top cell");
47106
47016
  rowData.push(top);
47107
47017
  spannedContainerIds.add(top);
47108
47018
  }
@@ -47113,7 +47023,7 @@ ${codeText}
47113
47023
  spannedContainerIds.forEach((containerId) => {
47114
47024
  const key = `${containerId}_rowSpan`;
47115
47025
  const oldSpan = oldBlockData[key];
47116
- assert(logger$2o, typeof oldSpan === "number" && oldSpan > 1, `no rowSpan for containerId ${containerId}, ${oldSpan}`);
47026
+ assert(logger$2p, typeof oldSpan === "number" && oldSpan > 1, `no rowSpan for containerId ${containerId}, ${oldSpan}`);
47117
47027
  oldBlockData[key] = oldSpan + 1;
47118
47028
  });
47119
47029
  const newChildren = TableGrid.virtualCellContainersGridToChildren(cells);
@@ -47126,7 +47036,7 @@ ${codeText}
47126
47036
  editor.updateBlockData(tableBlock, newBlockData);
47127
47037
  });
47128
47038
  }
47129
- const logger$2n = getLogger("table-chart");
47039
+ const logger$2o = getLogger("table-chart");
47130
47040
  function removeChart(editor, block) {
47131
47041
  const tableTools = findExistsTableTools(editor, block);
47132
47042
  if (tableTools) {
@@ -47211,7 +47121,7 @@ ${codeText}
47211
47121
  chartContainer = createElement("div", ["editor-table-chart"], tableTools);
47212
47122
  }
47213
47123
  const parent = chartContainer;
47214
- assert(logger$2n, parent, "no chart container");
47124
+ assert(logger$2o, parent, "no chart container");
47215
47125
  const options = editor.getComponentOptions("table");
47216
47126
  const cdn = (options == null ? void 0 : options.chartCdn) || "https://cdn.jsdelivr.net/npm/chart.js@2.9.4/dist/Chart.min.js";
47217
47127
  try {
@@ -47255,7 +47165,7 @@ ${codeText}
47255
47165
  chartContainer.chartObject = chartObject;
47256
47166
  }
47257
47167
  } catch (err) {
47258
- logger$2n.error(`failed to resolve chart cdn: ${JSON.stringify(err)}`);
47168
+ logger$2o.error(`failed to resolve chart cdn: ${JSON.stringify(err)}`);
47259
47169
  }
47260
47170
  }
47261
47171
  async function updateChartCore(editor, block) {
@@ -47412,7 +47322,7 @@ ${codeText}
47412
47322
  const height = document.documentElement.clientHeight;
47413
47323
  return new DOMRect(left, top, width, height);
47414
47324
  }
47415
- const logger$2m = getLogger("scroll-bar-handle");
47325
+ const logger$2n = getLogger("scroll-bar-handle");
47416
47326
  const BOTTOM_FLOAT_HEIGHT = 2;
47417
47327
  function getScrollbarContainer(scrollContainer) {
47418
47328
  const tools = getTools(scrollContainer);
@@ -47423,7 +47333,7 @@ ${codeText}
47423
47333
  scrollbarContainer.style.minHeight = "10px";
47424
47334
  }
47425
47335
  }
47426
- assert(logger$2m, scrollbarContainer instanceof HTMLDivElement, "invalid child for container tools");
47336
+ assert(logger$2n, scrollbarContainer instanceof HTMLDivElement, "invalid child for container tools");
47427
47337
  if (!scrollbarContainer.firstElementChild) {
47428
47338
  createElement("div", [], scrollbarContainer);
47429
47339
  }
@@ -47439,7 +47349,7 @@ ${codeText}
47439
47349
  fixScrollWrapRightBoundary(scrollCore, scrollContainer);
47440
47350
  fixScrollWrapLeftBoundary(scrollCore, scrollContainer);
47441
47351
  const overflowWidth = scrollWidth - clientWidth;
47442
- assert(logger$2m, scrollbarContainer.firstElementChild instanceof HTMLDivElement, "invalid child for scroll bar");
47352
+ assert(logger$2n, scrollbarContainer.firstElementChild instanceof HTMLDivElement, "invalid child for scroll bar");
47443
47353
  scrollbarContainer.style.width = `${getSizeAsScale(scrollContainer, originWidth + maxRight - paddingLeft - paddingRight)}px`;
47444
47354
  scrollbarContainer.firstElementChild.style.width = `${getSizeAsScale(scrollContainer, originWidth + maxRight + overflowWidth - paddingLeft - paddingRight)}px`;
47445
47355
  }
@@ -47526,7 +47436,7 @@ ${codeText}
47526
47436
  this.intersectionObserver.disconnect();
47527
47437
  }
47528
47438
  }
47529
- const logger$2l = getLogger("container-scroll-shadow");
47439
+ const logger$2m = getLogger("container-scroll-shadow");
47530
47440
  function setShadowBottom(shadow, scrollContainer, scrollWrap) {
47531
47441
  const elem = shadow;
47532
47442
  const contentRect = scrollContainer.getBoundingClientRect();
@@ -47545,22 +47455,22 @@ ${codeText}
47545
47455
  }
47546
47456
  function showLeftShadow(scrollContainer) {
47547
47457
  const targetTools = getTools(scrollContainer);
47548
- assert(logger$2l, targetTools, "no container tools");
47458
+ assert(logger$2m, targetTools, "no container tools");
47549
47459
  let shadow = targetTools.querySelector(`.${SHADOW_CLASS.LEFT}`);
47550
47460
  if (!shadow) {
47551
47461
  const scrollWrap = getContainerScrollArea(scrollContainer);
47552
47462
  const classes = [SHADOW_CLASS.COMMON, SHADOW_CLASS.LEFT];
47553
47463
  shadow = createElement("div", classes, targetTools);
47554
- assert(logger$2l, shadow instanceof HTMLDivElement, "invalid child for container tools");
47464
+ assert(logger$2m, shadow instanceof HTMLDivElement, "invalid child for container tools");
47555
47465
  setShadowBottom(shadow, scrollContainer, scrollWrap);
47556
47466
  }
47557
- assert(logger$2l, shadow instanceof HTMLElement, "invalid child for container tools");
47467
+ assert(logger$2m, shadow instanceof HTMLElement, "invalid child for container tools");
47558
47468
  const container = getContainer(scrollContainer);
47559
47469
  const containerRect = container.getBoundingClientRect();
47560
47470
  const scrollContainerRect = scrollContainer.getBoundingClientRect();
47561
47471
  shadow.style.left = `${getSizeAsScale(scrollContainer, scrollContainerRect.left - containerRect.left)}px`;
47562
47472
  const leftRest = getElementScrollSize(scrollContainer).scrollLeft;
47563
- assert(logger$2l, shadow instanceof HTMLDivElement, "invalid child for container tools");
47473
+ assert(logger$2m, shadow instanceof HTMLDivElement, "invalid child for container tools");
47564
47474
  setShadowWidth(shadow, leftRest);
47565
47475
  addClass(shadow, SHADOW_CLASS.ACTIVE);
47566
47476
  }
@@ -47571,17 +47481,17 @@ ${codeText}
47571
47481
  const scrollWrap = getContainerScrollArea(scrollContainer);
47572
47482
  const classes = [SHADOW_CLASS.COMMON, SHADOW_CLASS.RIGHT];
47573
47483
  shadow = createElement("div", classes, tools);
47574
- assert(logger$2l, shadow instanceof HTMLDivElement, "no div, create shadow failed");
47484
+ assert(logger$2m, shadow instanceof HTMLDivElement, "no div, create shadow failed");
47575
47485
  setShadowBottom(shadow, scrollContainer, scrollWrap);
47576
47486
  }
47577
- assert(logger$2l, shadow instanceof HTMLElement, "");
47487
+ assert(logger$2m, shadow instanceof HTMLElement, "");
47578
47488
  const container = getContainer(scrollContainer);
47579
47489
  const containerRect = container.getBoundingClientRect();
47580
47490
  const scrollContainerRect = scrollContainer.getBoundingClientRect();
47581
47491
  shadow.style.right = `${getSizeAsScale(scrollContainer, containerRect.right - scrollContainerRect.right)}px`;
47582
47492
  const { scrollWidth, scrollLeft, clientWidth } = getElementScrollSize(scrollContainer);
47583
47493
  const rightRest = scrollWidth - scrollLeft - clientWidth;
47584
- assert(logger$2l, shadow instanceof HTMLDivElement, "no shadow element");
47494
+ assert(logger$2m, shadow instanceof HTMLDivElement, "no shadow element");
47585
47495
  setShadowWidth(shadow, rightRest);
47586
47496
  addClass(shadow, SHADOW_CLASS.ACTIVE);
47587
47497
  }
@@ -47654,12 +47564,12 @@ ${codeText}
47654
47564
  this.resizeObserver.disconnect();
47655
47565
  }
47656
47566
  }
47657
- const logger$2k = getLogger("container-scroll-observer");
47567
+ const logger$2l = getLogger("container-scroll-observer");
47658
47568
  class ContainerScrollObserver {
47659
47569
  constructor(scrollCore, callback) {
47660
47570
  __publicField(this, "handleContentScroll", (e2) => {
47661
47571
  const scrollContainer = e2.target;
47662
- assert(logger$2k, scrollContainer instanceof Element, "invalid target for scroll event");
47572
+ assert(logger$2l, scrollContainer instanceof Element, "invalid target for scroll event");
47663
47573
  const scrollbarContainer = getScrollbarContainer(scrollContainer);
47664
47574
  scrollbarContainer.removeEventListener("scroll", this.handleScroll);
47665
47575
  const needFixScrollbarContainer = true;
@@ -47670,7 +47580,7 @@ ${codeText}
47670
47580
  });
47671
47581
  __publicField(this, "handleScroll", (e2) => {
47672
47582
  const scrollbarContainer = e2.target;
47673
- assert(logger$2k, scrollbarContainer instanceof HTMLElement, "");
47583
+ assert(logger$2l, scrollbarContainer instanceof HTMLElement, "");
47674
47584
  const scrollLeft = scrollbarContainer.scrollLeft;
47675
47585
  const needFixScrollbarContainer = false;
47676
47586
  const scrollContainer = getScrollContainerByScrollBar(scrollbarContainer);
@@ -47750,7 +47660,7 @@ ${codeText}
47750
47660
  this.scrollContainers.clear();
47751
47661
  }
47752
47662
  }
47753
- const logger$2j = getLogger("scroll-wrap-resize-observer");
47663
+ const logger$2k = getLogger("scroll-wrap-resize-observer");
47754
47664
  class ScrollWrapResizeObserve {
47755
47665
  constructor(scrollCore) {
47756
47666
  __publicField(this, "resizeObserver");
@@ -47766,7 +47676,7 @@ ${codeText}
47766
47676
  });
47767
47677
  __publicField(this, "handleScrollWrapResizeEntry", (entry) => {
47768
47678
  const scrollWrap = entry.target;
47769
- assert(logger$2j, scrollWrap instanceof HTMLElement, "invalid target for observer entry");
47679
+ assert(logger$2k, scrollWrap instanceof HTMLElement, "invalid target for observer entry");
47770
47680
  const scrollContainer = getScrollContainer(scrollWrap);
47771
47681
  resetScrollbar(this.scrollCore, scrollWrap);
47772
47682
  resetScrollWrapShadow(scrollContainer);
@@ -47971,7 +47881,7 @@ ${codeText}
47971
47881
  window.removeEventListener("scroll", this.handleWindowEffect);
47972
47882
  }
47973
47883
  }
47974
- const logger$2i = getLogger("scroll-container");
47884
+ const logger$2j = getLogger("scroll-container");
47975
47885
  const rootScrollMap = /* @__PURE__ */ new Map();
47976
47886
  class ScrollContainer extends tinyTypedEmitter.TypedEmitter {
47977
47887
  constructor() {
@@ -48019,11 +47929,11 @@ ${codeText}
48019
47929
  return this.scrollContainerElement;
48020
47930
  }
48021
47931
  get contentElement() {
48022
- assert(logger$2i, this.scrollContainerElement, "scrollContainerElement cannot be undefined");
47932
+ assert(logger$2j, this.scrollContainerElement, "scrollContainerElement cannot be undefined");
48023
47933
  return getContainerScrollArea(this.scrollContainerElement);
48024
47934
  }
48025
47935
  get scrollOptions() {
48026
- assert(logger$2i, this.options, "options cannot be undefined");
47936
+ assert(logger$2j, this.options, "options cannot be undefined");
48027
47937
  return { ...this.options };
48028
47938
  }
48029
47939
  handleBaseListenerDestroy(baseListener) {
@@ -48047,7 +47957,7 @@ ${codeText}
48047
47957
  function createScrollContainer() {
48048
47958
  return new ScrollContainer();
48049
47959
  }
48050
- const logger$2h = getLogger("column-width");
47960
+ const logger$2i = getLogger("column-width");
48051
47961
  function setColumnWidth(table, colIndex, width) {
48052
47962
  const col = getTableCol(table, colIndex);
48053
47963
  col.style.width = `${width}px`;
@@ -48068,7 +47978,7 @@ ${codeText}
48068
47978
  cellRightOffsets[colIndex] = cell.cell.getBoundingClientRect().right - left;
48069
47979
  }
48070
47980
  });
48071
- logger$2h.debug(`cellRightOffsets1: ${cellRightOffsets.join()}`);
47981
+ logger$2i.debug(`cellRightOffsets1: ${cellRightOffsets.join()}`);
48072
47982
  for (let col = 0; col < cellRightOffsets.length; col++) {
48073
47983
  const offset = cellRightOffsets[col];
48074
47984
  if (offset === -1 || col === 0) {
@@ -48088,7 +47998,7 @@ ${codeText}
48088
47998
  cellRightOffsets[i] = prevOffset + averageWidth * (i - prevCol);
48089
47999
  }
48090
48000
  }
48091
- logger$2h.debug(`cellRightOffsets2: ${cellRightOffsets.join()}`);
48001
+ logger$2i.debug(`cellRightOffsets2: ${cellRightOffsets.join()}`);
48092
48002
  const result = [];
48093
48003
  let prev = 0;
48094
48004
  for (let col = 0; col < cellRightOffsets.length; col++) {
@@ -48096,7 +48006,7 @@ ${codeText}
48096
48006
  result.push(offset - prev);
48097
48007
  prev = offset;
48098
48008
  }
48099
- logger$2h.debug(`widths: ${result.join()}`);
48009
+ logger$2i.debug(`widths: ${result.join()}`);
48100
48010
  return result;
48101
48011
  }
48102
48012
  function getTableColumnWidths(table) {
@@ -48104,6 +48014,72 @@ ${codeText}
48104
48014
  const widths = tableCols.map((col) => col.getBoundingClientRect().width || Number.parseInt(col.style.width, 10));
48105
48015
  return widths;
48106
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
+ }
48107
48083
  function getTableResizeMinX(editor, draggingRefCell, table, x) {
48108
48084
  const cell = draggingRefCell;
48109
48085
  const grid = TableGrid.fromTable(table);
@@ -51688,16 +51664,22 @@ ${codeText}
51688
51664
  function breakListBlock(editor, block, offset, attributesBlock) {
51689
51665
  const fixStart = new FixStartByList(editor, attributesBlock);
51690
51666
  const start = getListBlockStart(attributesBlock) + 1;
51691
- editorBreakTextBlock(editor, block, offset, {
51667
+ const result = editorBreakTextBlock(editor, block, offset, {
51692
51668
  forceInsertAfter: true,
51693
51669
  newBlockData: cloneListData(editor, attributesBlock, {
51694
51670
  start
51695
51671
  })
51696
51672
  });
51697
51673
  fixStart.fix();
51674
+ return result;
51698
51675
  }
51699
- function handleEnter$1(editor) {
51676
+ function autoBreakListBlock(editor, block, offset) {
51700
51677
  var _a;
51678
+ const atBlockEnd = offset === getBlockTextLength$6(editor, block);
51679
+ const attributesBlock = (_a = atBlockEnd ? findCloneableList(block) : block) != null ? _a : block;
51680
+ return breakListBlock(editor, block, offset, attributesBlock);
51681
+ }
51682
+ function handleEnter$1(editor) {
51701
51683
  if (editor.selection.range.isCollapsed()) {
51702
51684
  const block2 = editor.selection.focusedBlock;
51703
51685
  if (isListBlock(block2)) {
@@ -51721,9 +51703,7 @@ ${codeText}
51721
51703
  return false;
51722
51704
  }
51723
51705
  const offset = focus.offset;
51724
- const atBlockEnd = offset === getBlockTextLength$6(editor, block);
51725
- const attributesBlock = (_a = atBlockEnd ? findCloneableList(block) : block) != null ? _a : block;
51726
- breakListBlock(editor, block, offset, attributesBlock);
51706
+ autoBreakListBlock(editor, block, offset);
51727
51707
  return true;
51728
51708
  }
51729
51709
  function findPrevBrotherAsParent(block) {
@@ -54782,7 +54762,7 @@ ${codeText}
54782
54762
  };
54783
54763
  return { blockData };
54784
54764
  }
54785
- function getOptions$9(editor) {
54765
+ function getOptions$8(editor) {
54786
54766
  return {
54787
54767
  name: "Mathjax"
54788
54768
  };
@@ -54814,7 +54794,7 @@ $$${mathData.mathjaxText}$$
54814
54794
  const MathjaxEmbed = {
54815
54795
  embedType: "math",
54816
54796
  createEmbedContent: createEmbedContent$9,
54817
- getOptions: getOptions$9,
54797
+ getOptions: getOptions$8,
54818
54798
  convertFrom: convertFrom$7,
54819
54799
  handleDeleteBlock: handleDeleteBlock$7,
54820
54800
  convertTo: convertTo$g,
@@ -65284,7 +65264,7 @@ $$${mathData.mathjaxText}$$
65284
65264
  editor.focus();
65285
65265
  return editor.insertBlock(options.containerId, options.blockIndex, blockData, createBlockSimpleRange(editor, focusBlockId, 0));
65286
65266
  }
65287
- function getOptions$8(editor) {
65267
+ function getOptions$7(editor) {
65288
65268
  return {
65289
65269
  name: "CodeBlock",
65290
65270
  insertBlockCommandItems: [
@@ -65349,7 +65329,7 @@ ${codeText}
65349
65329
  getSelectedContainers: getSelectedContainers$2,
65350
65330
  convertFrom: convertToCode,
65351
65331
  handleBlockElementUpdated,
65352
- getOptions: getOptions$8,
65332
+ getOptions: getOptions$7,
65353
65333
  getBlockProperties: getBlockProperties$a,
65354
65334
  convertTo: convertTo$e,
65355
65335
  handleDeleteBlock: handleDeleteBlock$6
@@ -68326,7 +68306,7 @@ ${codeText}
68326
68306
  abstract: `${i18n$1.t("image.abstract")}`
68327
68307
  };
68328
68308
  };
68329
- function getOptions$7() {
68309
+ function getOptions$6() {
68330
68310
  return {
68331
68311
  name: "Image",
68332
68312
  insertEmbedCommandItems: [{
@@ -68426,7 +68406,7 @@ ${codeText}
68426
68406
  convertTo: convertTo$d,
68427
68407
  convertFrom: convertFrom$6,
68428
68408
  getBlockProperties: getBlockProperties$9,
68429
- getOptions: getOptions$7,
68409
+ getOptions: getOptions$6,
68430
68410
  handleDrop: handleDrop$1,
68431
68411
  handleDropOver: handleDropOver$1,
68432
68412
  handleDeleteBlock: handleDeleteBlock$5
@@ -73243,7 +73223,7 @@ ${codeText}
73243
73223
  }
73244
73224
  return createEmptyTableDataByFirstRowText(editor, editor.getBlockString(srcBlock).trim());
73245
73225
  }
73246
- function getOptions$6(editor) {
73226
+ function getOptions$5(editor) {
73247
73227
  return {
73248
73228
  name: "TableBlock",
73249
73229
  insertBlockCommandItems: [{
@@ -73320,7 +73300,7 @@ ${codeText}
73320
73300
  adjustSelectionPos,
73321
73301
  getClientRects,
73322
73302
  selectionToDoc,
73323
- getOptions: getOptions$6,
73303
+ getOptions: getOptions$5,
73324
73304
  getTextToolbarReferenceClient: getTextToolbarReferenceClient$1,
73325
73305
  handleUpdateBlock: handleUpdateBlock$5,
73326
73306
  handleDeleteBlock: handleDeleteBlock$4,
@@ -73356,7 +73336,6 @@ ${codeText}
73356
73336
  splitCell: "\u62C6\u5206\u5355\u5143\u683C",
73357
73337
  tableConfigKey: "\u8868\u683C\u8BBE\u7F6E",
73358
73338
  deleteTable: "\u5220\u9664\u8868\u683C",
73359
- adjustColumnWidthsEvenly: "\u5E73\u5747\u5206\u914D\u5217\u5BBD",
73360
73339
  insertCol: "\u63D2\u5165\u5217",
73361
73340
  insertRow: "\u63D2\u5165\u884C",
73362
73341
  deleteCol: "\u5220\u9664\u5217",
@@ -73388,7 +73367,6 @@ ${codeText}
73388
73367
  splitCell: "Split cell",
73389
73368
  tableConfigKey: "Table settings",
73390
73369
  deleteTable: "Delete table",
73391
- adjustColumnWidthsEvenly: "Adjust column widths evenly",
73392
73370
  insertCol: "Insert column",
73393
73371
  insertRow: "Insert row",
73394
73372
  deleteCol: "Delete column",
@@ -73420,7 +73398,6 @@ ${codeText}
73420
73398
  splitCell: "\u30BB\u30EB\u306E\u7D50\u5408\u3092\u89E3\u9664",
73421
73399
  tableConfigKey: "\u30C6\u30FC\u30D6\u30EB\u8A2D\u5B9A",
73422
73400
  deleteTable: "\u30C6\u30FC\u30D6\u30EB\u3092\u524A\u9664",
73423
- adjustColumnWidthsEvenly: "\u5217\u5E45\u3092\u5747\u7B49\u306B\u8ABF\u6574",
73424
73401
  insertCol: "\u5217\u3092\u633F\u5165",
73425
73402
  insertRow: "\u884C\u3092\u633F\u5165",
73426
73403
  deleteCol: "\u5217\u3092\u524A\u9664",
@@ -76816,8 +76793,25 @@ ${docStr}
76816
76793
  };
76817
76794
  }
76818
76795
  }
76796
+ function isContainHyperlink(text2) {
76797
+ const pattern = /^([\d\w\u4e00-\u9fa5\s]*[\u4e00-\u9fa5\s]{1}|)((https|http|ftp)?:\/\/)[^\s]+/;
76798
+ return pattern.test(text2);
76799
+ }
76800
+ function transText2TextOp(text2) {
76801
+ const ret = [];
76802
+ const prefix = text2.split(/https|http|ftp/)[0];
76803
+ const link2 = text2.substring(prefix.length).trim();
76804
+ if (prefix && prefix.length) {
76805
+ const textOp = createTextOp(prefix, null);
76806
+ ret.push(textOp, createTextOp(" ", null));
76807
+ }
76808
+ const linkOp = createTextOp(link2, { link: link2 });
76809
+ ret.push(linkOp, createTextOp(" ", null));
76810
+ return ret;
76811
+ }
76819
76812
  class TextDataConverter {
76820
- async fromData(editor, data2) {
76813
+ async fromData(editor, data2, options) {
76814
+ const { toPlainText: toPlainText2 = false } = options || {};
76821
76815
  const result = {};
76822
76816
  const text2 = data2.getData("text/plain");
76823
76817
  if (text2) {
@@ -76827,6 +76821,10 @@ ${docStr}
76827
76821
  id: genId(),
76828
76822
  type: "text"
76829
76823
  };
76824
+ if (isContainHyperlink(line) && !toPlainText2) {
76825
+ block.text = transText2TextOp(line);
76826
+ return block;
76827
+ }
76830
76828
  const text22 = line ? [createTextOp(line, null)] : [];
76831
76829
  block.text = text22;
76832
76830
  return block;
@@ -76843,103 +76841,6 @@ ${docStr}
76843
76841
  return result;
76844
76842
  }
76845
76843
  }
76846
- function findLinks(text2) {
76847
- const pattern = /https?:\/\/[^\s/$.?#].[^\s]*/g;
76848
- const results = [];
76849
- let match;
76850
- while ((match = pattern.exec(text2)) !== null) {
76851
- const url = match[0];
76852
- const startIndex = match.index;
76853
- const endIndex = pattern.lastIndex;
76854
- results.push({ url, startIndex, endIndex });
76855
- }
76856
- return results;
76857
- }
76858
- function urlToLinkOp(result) {
76859
- const attributes = {
76860
- link: result.url
76861
- };
76862
- return {
76863
- insert: result.url,
76864
- attributes
76865
- };
76866
- }
76867
- function opToLinks(op) {
76868
- var _a, _b;
76869
- if ((_a = op.attributes) == null ? void 0 : _a.box) {
76870
- return [op];
76871
- }
76872
- if ((_b = op.attributes) == null ? void 0 : _b.link) {
76873
- return [op];
76874
- }
76875
- const text2 = op.insert;
76876
- const attributes = op.attributes;
76877
- const results = findLinks(text2);
76878
- if (results.length === 0) {
76879
- return [op];
76880
- }
76881
- let current = text2;
76882
- const ops = [];
76883
- for (let i = results.length - 1; i >= 0; i--) {
76884
- const result = results[i];
76885
- const right = current.substring(result.endIndex);
76886
- if (right) {
76887
- const rightOp = {
76888
- insert: right
76889
- };
76890
- if (attributes) {
76891
- rightOp.attributes = JSON.parse(JSON.stringify(attributes));
76892
- }
76893
- ops.unshift(rightOp);
76894
- }
76895
- const boxOp = urlToLinkOp(result);
76896
- if (boxOp) {
76897
- ops.unshift(boxOp);
76898
- } else {
76899
- const keepText = current.substring(result.startIndex, result.endIndex);
76900
- const keepOp = {
76901
- insert: keepText
76902
- };
76903
- if (attributes) {
76904
- keepOp.attributes = attributes;
76905
- }
76906
- ops.unshift(keepOp);
76907
- }
76908
- current = current.substring(0, result.startIndex);
76909
- }
76910
- if (current) {
76911
- const lastOp = {
76912
- insert: current
76913
- };
76914
- if (attributes) {
76915
- lastOp.attributes = attributes;
76916
- }
76917
- ops.unshift(lastOp);
76918
- }
76919
- return ops;
76920
- }
76921
- class ConvertLinkPasteHandler {
76922
- constructor() {
76923
- __publicField(this, "order");
76924
- this.order = 200;
76925
- }
76926
- async handleBeforePasteDoc(editor, doc2) {
76927
- for (const blocks of Object.values(doc2.blocks)) {
76928
- for (const block of blocks) {
76929
- if (block.type === "text") {
76930
- const ops = block.text || [];
76931
- const newOps = [];
76932
- for (const op of ops) {
76933
- const subOps = opToLinks(op);
76934
- newOps.push(...subOps);
76935
- }
76936
- block.text = newOps;
76937
- }
76938
- }
76939
- }
76940
- return false;
76941
- }
76942
- }
76943
76844
  function getImages(files) {
76944
76845
  const images = [];
76945
76846
  for (let i = 0; i < files.length; i++) {
@@ -76953,7 +76854,6 @@ ${docStr}
76953
76854
  }
76954
76855
  class OnesEditorPasteHandler {
76955
76856
  constructor(editor) {
76956
- editor.input.addHandler(new ConvertLinkPasteHandler());
76957
76857
  editor.dataConverter.addConverter(new HtmlDataConverter());
76958
76858
  editor.dataConverter.addConverter(new TextDataConverter());
76959
76859
  editor.dataConverter.addConverter(new MarkdownDataConverter());
@@ -82156,45 +82056,24 @@ ${docStr}
82156
82056
  };
82157
82057
  return { blockData };
82158
82058
  }
82159
- function getOptions$5() {
82160
- return {
82161
- name: "toc",
82162
- insertEmbedCommandItems: [{
82163
- id: "insert-toc",
82164
- name: i18n$1.t("toc.name"),
82165
- icon: TocIcon,
82166
- order: 510,
82167
- group: "common",
82168
- subText: getShortcutById("insert-toc")
82169
- }],
82170
- handleInsertEmptyEmbed: async (editor, options) => {
82171
- const { containerId, blockIndex } = options;
82172
- return editor.insertEmbed(containerId, blockIndex, "toc", {});
82173
- }
82174
- };
82175
- }
82176
82059
  const TocEmbed = {
82177
82060
  embedType: "toc",
82178
82061
  createEmbedContent: createEmbedContent$6,
82179
82062
  convertTo: convertTo$8,
82180
- convertFrom: convertFrom$4,
82181
- getOptions: getOptions$5
82063
+ convertFrom: convertFrom$4
82182
82064
  };
82183
82065
  const zhCN$c = {
82184
82066
  toc: {
82185
- name: "\u6807\u9898\u76EE\u5F55",
82186
82067
  empty: "No Toc"
82187
82068
  }
82188
82069
  };
82189
82070
  const enUS$c = {
82190
82071
  toc: {
82191
- name: "Toc",
82192
82072
  empty: "No Toc"
82193
82073
  }
82194
82074
  };
82195
82075
  const jaJP$c = {
82196
82076
  toc: {
82197
- name: "Toc",
82198
82077
  empty: "No Toc"
82199
82078
  }
82200
82079
  };
@@ -86732,7 +86611,7 @@ ${data2.plantumlText}
86732
86611
  this.editor.removeListener("selectionChanged", this.handleSelectionChange);
86733
86612
  this.editor.removeListener("docChanged", this.handleSelectionChange);
86734
86613
  document.removeEventListener("touchstart", this.handleTouchStart);
86735
- document.removeEventListener("touchend", this.handleTouchEnd, { capture: true });
86614
+ document.removeEventListener("touchend", this.handleTouchEnd);
86736
86615
  document.removeEventListener("touchmove", this.handleTouchMove);
86737
86616
  this.mobileEmbedMask.destroy();
86738
86617
  this.cursorToolbar.destroy();
@@ -92494,6 +92373,12 @@ ${data2.plantumlText}
92494
92373
  this.toolbar.updateItems(items);
92495
92374
  }
92496
92375
  }
92376
+ function editorAutoBreakTextBlock(editor, block, offset, options) {
92377
+ if (isListBlock(block)) {
92378
+ return autoBreakListBlock(editor, block, offset);
92379
+ }
92380
+ return editorBreakTextBlock(editor, block, offset, options);
92381
+ }
92497
92382
  const logger = getLogger("create-editor");
92498
92383
  function getDefaultOnesEditorOptions(options) {
92499
92384
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
@@ -92741,7 +92626,7 @@ ${data2.plantumlText}
92741
92626
  }
92742
92627
  }
92743
92628
  });
92744
- editor.version = "2.8.14-beta.5";
92629
+ editor.version = "2.8.14-beta.7";
92745
92630
  return editor;
92746
92631
  }
92747
92632
  function isDoc(doc2) {
@@ -92854,7 +92739,7 @@ ${data2.plantumlText}
92854
92739
  }
92855
92740
  });
92856
92741
  OnesEditorToolbar.register(editor);
92857
- editor.version = "2.8.14-beta.5";
92742
+ editor.version = "2.8.14-beta.7";
92858
92743
  return editor;
92859
92744
  }
92860
92745
  async function showDocVersions(editor, options, serverUrl) {
@@ -138631,7 +138516,6 @@ ${data2.plantumlText}
138631
138516
  exports2.AddCommentToOldDocCommandProvider = AddCommentToOldDocCommandProvider;
138632
138517
  exports2.AddEmojiIcon = AddEmojiIcon;
138633
138518
  exports2.AddIcon = AddIcon;
138634
- exports2.AdjustWidthIcon = AdjustWidthIcon;
138635
138519
  exports2.AlertDialog = AlertDialog;
138636
138520
  exports2.AlertEmojiIcon = alterEmoji;
138637
138521
  exports2.AlignCenterIcon = AlignCenterIcon;
@@ -138907,7 +138791,6 @@ ${data2.plantumlText}
138907
138791
  exports2.TimeIcon = TimeIcon;
138908
138792
  exports2.ToMindMapIcon = ToMindMapIcon;
138909
138793
  exports2.TocEmbed = TocEmbed;
138910
- exports2.TocIcon = TocIcon;
138911
138794
  exports2.TreeIcon = TreeIcon;
138912
138795
  exports2.UmlBrandIcon = UmlBrandIcon;
138913
138796
  exports2.UmlIcon = UmlIcon;
@@ -139041,6 +138924,7 @@ ${data2.plantumlText}
139041
138924
  exports2.editLink = editLink;
139042
138925
  exports2.editorAddComment = editorAddComment;
139043
138926
  exports2.editorAddTextAttribute = editorAddTextAttribute;
138927
+ exports2.editorAutoBreakTextBlock = editorAutoBreakTextBlock;
139044
138928
  exports2.editorAutoInsertBlock = editorAutoInsertBlock;
139045
138929
  exports2.editorBreakTextBlock = editorBreakTextBlock;
139046
138930
  exports2.editorClearCompositionText = editorClearCompositionText;