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

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
@@ -46636,14 +46636,106 @@ ${codeText}
46636
46636
  };
46637
46637
  editor.updateBlockData(block, newData, void 0, { noScroll: true });
46638
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));
46639
+ const logger$2q = getLogger("column-width");
46640
+ function setColumnWidth(table, colIndex, width) {
46641
+ const col = getTableCol(table, colIndex);
46642
+ col.style.width = `${width}px`;
46643
+ col.style.minWidth = `${width}px`;
46644
+ }
46645
+ function getTableColumnWidthsFromDom(table) {
46646
+ const tableCols = Array.from(table.querySelector("colgroup").children);
46647
+ const widths = tableCols.map((col) => col.getBoundingClientRect().width);
46648
+ if (widths[0] !== 0) {
46649
+ return widths;
46650
+ }
46651
+ const grid = TableGrid.fromTable(table);
46652
+ const cellRightOffsets = Array(grid.colCount).fill(-1);
46653
+ const left = table.getBoundingClientRect().left;
46654
+ grid.toRealCells(grid.cells).forEach((cell) => {
46655
+ const colIndex = cell.col + cell.colSpan - 1;
46656
+ if (cellRightOffsets[colIndex] === -1) {
46657
+ cellRightOffsets[colIndex] = cell.cell.getBoundingClientRect().right - left;
46658
+ }
46659
+ });
46660
+ logger$2q.debug(`cellRightOffsets1: ${cellRightOffsets.join()}`);
46661
+ for (let col = 0; col < cellRightOffsets.length; col++) {
46662
+ const offset = cellRightOffsets[col];
46663
+ if (offset === -1 || col === 0) {
46664
+ continue;
46665
+ }
46666
+ let prevCol = col - 1;
46667
+ while (cellRightOffsets[prevCol] === -1) {
46668
+ prevCol--;
46669
+ if (prevCol === -1) {
46670
+ break;
46671
+ }
46672
+ }
46673
+ const prevOffset = prevCol === -1 ? 0 : cellRightOffsets[prevCol];
46674
+ const totalWidth = offset - prevOffset;
46675
+ const averageWidth = totalWidth / (col - prevCol);
46676
+ for (let i = prevCol + 1; i < col; i++) {
46677
+ cellRightOffsets[i] = prevOffset + averageWidth * (i - prevCol);
46678
+ }
46679
+ }
46680
+ logger$2q.debug(`cellRightOffsets2: ${cellRightOffsets.join()}`);
46681
+ const result = [];
46682
+ let prev = 0;
46683
+ for (let col = 0; col < cellRightOffsets.length; col++) {
46684
+ const offset = cellRightOffsets[col];
46685
+ result.push(offset - prev);
46686
+ prev = offset;
46687
+ }
46688
+ logger$2q.debug(`widths: ${result.join()}`);
46689
+ return result;
46690
+ }
46691
+ function getTableColumnWidths(table) {
46692
+ const tableCols = Array.from(table.querySelector("colgroup").children);
46693
+ const widths = tableCols.map((col) => col.getBoundingClientRect().width || Number.parseInt(col.style.width, 10));
46694
+ return widths;
46695
+ }
46696
+ function adjustColumnWidthsEvenly(editor, block, range) {
46697
+ const table = getBlockTable(block);
46698
+ const { start, end } = range;
46699
+ if (start.blockId !== end.blockId) {
46700
+ return false;
46701
+ }
46702
+ if (range.isSimple()) {
46703
+ return false;
46704
+ }
46705
+ const testBlock = editor.getBlockById(start.blockId);
46706
+ if (testBlock !== block)
46707
+ return false;
46708
+ if (getBlockType(block) !== "table")
46709
+ return false;
46710
+ const { fromCol, toCol } = getTableSelectionRange(block, range.start, range.end);
46711
+ if (fromCol === toCol)
46712
+ return false;
46713
+ const colWidths = getTableColumnWidthsFromDom(table);
46714
+ let totalWidth = 0;
46715
+ for (let i = fromCol; i <= toCol; i++) {
46716
+ totalWidth += colWidths[i];
46717
+ }
46718
+ for (let i = fromCol; i <= toCol; i++) {
46719
+ colWidths[i] = totalWidth / (toCol - fromCol + 1);
46720
+ }
46721
+ setTableColumnWidths(editor, block, colWidths);
46722
+ return true;
46723
+ }
46724
+ function canAdjustColumnWidthsEvenly(editor, block, range) {
46725
+ const { start, end } = range;
46726
+ if (start.blockId !== end.blockId) {
46727
+ return false;
46728
+ }
46729
+ if (range.isSimple()) {
46730
+ return false;
46731
+ }
46732
+ const testBlock = editor.getBlockById(start.blockId);
46733
+ if (testBlock !== block)
46734
+ return false;
46735
+ if (getBlockType(block) !== "table")
46736
+ return false;
46737
+ const { fromCol, toCol } = getTableSelectionRange(block, range.start, range.end);
46738
+ return fromCol !== toCol;
46647
46739
  }
46648
46740
  const TABLE_COMMAND_GROUP_INDEX = 10;
46649
46741
  const TableCommands = [
@@ -46689,8 +46781,8 @@ ${codeText}
46689
46781
  icon: DeleteTableIcon
46690
46782
  });
46691
46783
  }
46692
- const allColumnsSelected = deleteRows2;
46693
- if (allColumnsSelected) {
46784
+ const adjustWidths = canAdjustColumnWidthsEvenly(editor, block, range);
46785
+ if (adjustWidths) {
46694
46786
  commands.push({
46695
46787
  id: "table/adjust-column-widths-evenly",
46696
46788
  name: i18n$1.t("table.adjustColumnWidthsEvenly"),
@@ -46727,7 +46819,7 @@ ${codeText}
46727
46819
  return true;
46728
46820
  }
46729
46821
  if (command.id === "table/adjust-column-widths-evenly") {
46730
- adjustColumnWidthsEvenly(editor, block);
46822
+ adjustColumnWidthsEvenly(editor, block, range);
46731
46823
  return true;
46732
46824
  }
46733
46825
  return false;
@@ -46810,26 +46902,26 @@ ${codeText}
46810
46902
  };
46811
46903
  editor.updateBlockData(tableBlock, newBlockData);
46812
46904
  }
46813
- const logger$2q = getLogger("table-cell-dom");
46905
+ const logger$2p = getLogger("table-cell-dom");
46814
46906
  function getCellElementByChildBlockId(editor, tableBlock, blockId) {
46815
46907
  let blockElement = editor.getBlockById(blockId);
46816
46908
  while (blockElement) {
46817
46909
  const cell = blockElement.closest("td");
46818
- assert(logger$2q, cell, "no parent cell");
46910
+ assert(logger$2p, cell, "no parent cell");
46819
46911
  const cellParentBlock = getParentBlock(cell);
46820
- assert(logger$2q, cellParentBlock, "no parent block");
46912
+ assert(logger$2p, cellParentBlock, "no parent block");
46821
46913
  if (cellParentBlock === tableBlock) {
46822
46914
  return cell;
46823
46915
  }
46824
46916
  blockElement = cellParentBlock;
46825
46917
  }
46826
- assert(logger$2q, false, "filed to get cell by child block id");
46918
+ assert(logger$2p, false, "filed to get cell by child block id");
46827
46919
  return null;
46828
46920
  }
46829
46921
  function createComplexPosFromBlockPos(editor, tableBlock, blockPosition) {
46830
46922
  const blockElement = editor.getBlockById(blockPosition.blockId);
46831
46923
  if (blockElement === tableBlock && !blockPosition.isSimple()) {
46832
- assert(logger$2q, blockPosition.childContainerId, "block position must have childContainerId attribute");
46924
+ assert(logger$2p, blockPosition.childContainerId, "block position must have childContainerId attribute");
46833
46925
  return blockPosition;
46834
46926
  }
46835
46927
  const cellElement = getCellElementByChildBlockId(editor, tableBlock, blockPosition.blockId);
@@ -46843,12 +46935,12 @@ ${codeText}
46843
46935
  return getTableSelectionRange(tableBlock, start, end);
46844
46936
  }
46845
46937
  function updateBarsDangerStatus(editor, tableBlock, selectedRows, selectedColumns) {
46846
- assert(logger$2q, isTableBlock(tableBlock), "invalid table block");
46938
+ assert(logger$2p, isTableBlock(tableBlock), "invalid table block");
46847
46939
  const tools = getTableTools(editor, tableBlock);
46848
46940
  const blockTools = getBlockTools(tableBlock);
46849
46941
  const updateTop = () => {
46850
46942
  const exists = tools.querySelector(".table-border-bar-container.top");
46851
- assert(logger$2q, exists, "no top border bar container");
46943
+ assert(logger$2p, exists, "no top border bar container");
46852
46944
  const cells = exists.querySelectorAll(".table-border-bar-cell.top");
46853
46945
  cells.forEach((cell) => {
46854
46946
  const colIndex = parseInt(cell.getAttribute("data-top-index") || "0", 10);
@@ -46861,7 +46953,7 @@ ${codeText}
46861
46953
  };
46862
46954
  const updateLeft = () => {
46863
46955
  const left = blockTools.querySelector(".table-border-bar-container.left");
46864
- assert(logger$2q, left, "no left border bar container");
46956
+ assert(logger$2p, left, "no left border bar container");
46865
46957
  const cells = left.querySelectorAll(".table-border-bar-cell.left");
46866
46958
  cells.forEach((cell) => {
46867
46959
  const rowIndex = parseInt(cell.getAttribute("data-left-index") || "0", 10);
@@ -46897,7 +46989,7 @@ ${codeText}
46897
46989
  }
46898
46990
  }
46899
46991
  } catch (error2) {
46900
- logger$2q.error("update cells danger status failed: ", error2.message);
46992
+ logger$2p.error("update cells danger status failed: ", error2.message);
46901
46993
  }
46902
46994
  }
46903
46995
  function updateCellBarsDangerStatus(editor, tableBlock, isDanger = true, isCol) {
@@ -46920,7 +47012,7 @@ ${codeText}
46920
47012
  }
46921
47013
  updateBarsDangerStatus(editor, tableBlock, Array.from(selectedRows), Array.from(selectedColumns));
46922
47014
  } catch (error2) {
46923
- logger$2q.error("update cell bars danger status failed: ", error2.message);
47015
+ logger$2p.error("update cell bars danger status failed: ", error2.message);
46924
47016
  }
46925
47017
  }
46926
47018
  function createEntireRowAndColumnRange(editor, tableBlock, isCol) {
@@ -47039,14 +47131,14 @@ ${codeText}
47039
47131
  }
47040
47132
  const DEFAULT_COLUMN_WIDTH$1 = 200;
47041
47133
  const MIN_COLUMN_WIDTH = 40;
47042
- const logger$2p = getLogger("table-insert-column");
47134
+ const logger$2o = getLogger("table-insert-column");
47043
47135
  function insertColumn(editor, tableBlock, insertIndex) {
47044
47136
  editor.undoManager.runInGroup(() => {
47045
47137
  var _a;
47046
47138
  const table = getBlockTable(tableBlock);
47047
47139
  const grid = TableGrid.fromTable(table);
47048
47140
  const colCount = grid.colCount;
47049
- assert(logger$2p, insertIndex >= 0 && insertIndex <= colCount, `insert index ${insertIndex} is out of range [0, ${colCount}]`);
47141
+ assert(logger$2o, insertIndex >= 0 && insertIndex <= colCount, `insert index ${insertIndex} is out of range [0, ${colCount}]`);
47050
47142
  const cells = grid.map((cell) => cell.containerId);
47051
47143
  const spannedContainerIds = /* @__PURE__ */ new Set();
47052
47144
  editor.doc.beginBatchUpdate();
@@ -47067,7 +47159,7 @@ ${codeText}
47067
47159
  spannedContainerIds.forEach((containerId) => {
47068
47160
  const key = `${containerId}_colSpan`;
47069
47161
  const oldSpan = oldBlockData[key];
47070
- assert(logger$2p, typeof oldSpan === "number" && oldSpan > 1, `no colSpan for containerId ${containerId}, ${oldSpan}`);
47162
+ assert(logger$2o, typeof oldSpan === "number" && oldSpan > 1, `no colSpan for containerId ${containerId}, ${oldSpan}`);
47071
47163
  oldBlockData[key] = oldSpan + 1;
47072
47164
  });
47073
47165
  const colsWidth = ((_a = oldBlockData.colsWidth) == null ? void 0 : _a.concat()) || new Array(oldBlockData.cols).fill(0);
@@ -47083,13 +47175,13 @@ ${codeText}
47083
47175
  editor.updateBlockData(tableBlock, newBlockData);
47084
47176
  });
47085
47177
  }
47086
- const logger$2o = getLogger("table-insert-row");
47178
+ const logger$2n = getLogger("table-insert-row");
47087
47179
  function insertRow(editor, tableBlock, insertIndex) {
47088
47180
  editor.undoManager.runInGroup(() => {
47089
47181
  const table = getBlockTable(tableBlock);
47090
47182
  const grid = TableGrid.fromTable(table);
47091
47183
  const rowCount = grid.rowCount;
47092
- assert(logger$2o, insertIndex >= 0 && insertIndex <= rowCount, `insert index ${insertIndex} is out of range [0, ${rowCount}]`);
47184
+ assert(logger$2n, insertIndex >= 0 && insertIndex <= rowCount, `insert index ${insertIndex} is out of range [0, ${rowCount}]`);
47093
47185
  const cells = grid.map((cell) => cell.containerId);
47094
47186
  const spannedContainerIds = /* @__PURE__ */ new Set();
47095
47187
  editor.doc.beginBatchUpdate();
@@ -47097,12 +47189,12 @@ ${codeText}
47097
47189
  for (let col = 0; col < grid.colCount; col++) {
47098
47190
  const top = insertIndex > 0 && cells[insertIndex - 1][col];
47099
47191
  const bottom = insertIndex < grid.rowCount && cells[insertIndex][col];
47100
- assert(logger$2o, top || bottom, "no top and bottom cell");
47192
+ assert(logger$2n, top || bottom, "no top and bottom cell");
47101
47193
  if (insertIndex === 0 || insertIndex === grid.rowCount || top !== bottom) {
47102
47194
  const newContainerId = createEmptyContainer(editor.doc);
47103
47195
  rowData.push(newContainerId);
47104
47196
  } else {
47105
- assert(logger$2o, top, "no top cell");
47197
+ assert(logger$2n, top, "no top cell");
47106
47198
  rowData.push(top);
47107
47199
  spannedContainerIds.add(top);
47108
47200
  }
@@ -47113,7 +47205,7 @@ ${codeText}
47113
47205
  spannedContainerIds.forEach((containerId) => {
47114
47206
  const key = `${containerId}_rowSpan`;
47115
47207
  const oldSpan = oldBlockData[key];
47116
- assert(logger$2o, typeof oldSpan === "number" && oldSpan > 1, `no rowSpan for containerId ${containerId}, ${oldSpan}`);
47208
+ assert(logger$2n, typeof oldSpan === "number" && oldSpan > 1, `no rowSpan for containerId ${containerId}, ${oldSpan}`);
47117
47209
  oldBlockData[key] = oldSpan + 1;
47118
47210
  });
47119
47211
  const newChildren = TableGrid.virtualCellContainersGridToChildren(cells);
@@ -47126,7 +47218,7 @@ ${codeText}
47126
47218
  editor.updateBlockData(tableBlock, newBlockData);
47127
47219
  });
47128
47220
  }
47129
- const logger$2n = getLogger("table-chart");
47221
+ const logger$2m = getLogger("table-chart");
47130
47222
  function removeChart(editor, block) {
47131
47223
  const tableTools = findExistsTableTools(editor, block);
47132
47224
  if (tableTools) {
@@ -47211,7 +47303,7 @@ ${codeText}
47211
47303
  chartContainer = createElement("div", ["editor-table-chart"], tableTools);
47212
47304
  }
47213
47305
  const parent = chartContainer;
47214
- assert(logger$2n, parent, "no chart container");
47306
+ assert(logger$2m, parent, "no chart container");
47215
47307
  const options = editor.getComponentOptions("table");
47216
47308
  const cdn = (options == null ? void 0 : options.chartCdn) || "https://cdn.jsdelivr.net/npm/chart.js@2.9.4/dist/Chart.min.js";
47217
47309
  try {
@@ -47255,7 +47347,7 @@ ${codeText}
47255
47347
  chartContainer.chartObject = chartObject;
47256
47348
  }
47257
47349
  } catch (err) {
47258
- logger$2n.error(`failed to resolve chart cdn: ${JSON.stringify(err)}`);
47350
+ logger$2m.error(`failed to resolve chart cdn: ${JSON.stringify(err)}`);
47259
47351
  }
47260
47352
  }
47261
47353
  async function updateChartCore(editor, block) {
@@ -47412,7 +47504,7 @@ ${codeText}
47412
47504
  const height = document.documentElement.clientHeight;
47413
47505
  return new DOMRect(left, top, width, height);
47414
47506
  }
47415
- const logger$2m = getLogger("scroll-bar-handle");
47507
+ const logger$2l = getLogger("scroll-bar-handle");
47416
47508
  const BOTTOM_FLOAT_HEIGHT = 2;
47417
47509
  function getScrollbarContainer(scrollContainer) {
47418
47510
  const tools = getTools(scrollContainer);
@@ -47423,7 +47515,7 @@ ${codeText}
47423
47515
  scrollbarContainer.style.minHeight = "10px";
47424
47516
  }
47425
47517
  }
47426
- assert(logger$2m, scrollbarContainer instanceof HTMLDivElement, "invalid child for container tools");
47518
+ assert(logger$2l, scrollbarContainer instanceof HTMLDivElement, "invalid child for container tools");
47427
47519
  if (!scrollbarContainer.firstElementChild) {
47428
47520
  createElement("div", [], scrollbarContainer);
47429
47521
  }
@@ -47439,7 +47531,7 @@ ${codeText}
47439
47531
  fixScrollWrapRightBoundary(scrollCore, scrollContainer);
47440
47532
  fixScrollWrapLeftBoundary(scrollCore, scrollContainer);
47441
47533
  const overflowWidth = scrollWidth - clientWidth;
47442
- assert(logger$2m, scrollbarContainer.firstElementChild instanceof HTMLDivElement, "invalid child for scroll bar");
47534
+ assert(logger$2l, scrollbarContainer.firstElementChild instanceof HTMLDivElement, "invalid child for scroll bar");
47443
47535
  scrollbarContainer.style.width = `${getSizeAsScale(scrollContainer, originWidth + maxRight - paddingLeft - paddingRight)}px`;
47444
47536
  scrollbarContainer.firstElementChild.style.width = `${getSizeAsScale(scrollContainer, originWidth + maxRight + overflowWidth - paddingLeft - paddingRight)}px`;
47445
47537
  }
@@ -47526,7 +47618,7 @@ ${codeText}
47526
47618
  this.intersectionObserver.disconnect();
47527
47619
  }
47528
47620
  }
47529
- const logger$2l = getLogger("container-scroll-shadow");
47621
+ const logger$2k = getLogger("container-scroll-shadow");
47530
47622
  function setShadowBottom(shadow, scrollContainer, scrollWrap) {
47531
47623
  const elem = shadow;
47532
47624
  const contentRect = scrollContainer.getBoundingClientRect();
@@ -47545,22 +47637,22 @@ ${codeText}
47545
47637
  }
47546
47638
  function showLeftShadow(scrollContainer) {
47547
47639
  const targetTools = getTools(scrollContainer);
47548
- assert(logger$2l, targetTools, "no container tools");
47640
+ assert(logger$2k, targetTools, "no container tools");
47549
47641
  let shadow = targetTools.querySelector(`.${SHADOW_CLASS.LEFT}`);
47550
47642
  if (!shadow) {
47551
47643
  const scrollWrap = getContainerScrollArea(scrollContainer);
47552
47644
  const classes = [SHADOW_CLASS.COMMON, SHADOW_CLASS.LEFT];
47553
47645
  shadow = createElement("div", classes, targetTools);
47554
- assert(logger$2l, shadow instanceof HTMLDivElement, "invalid child for container tools");
47646
+ assert(logger$2k, shadow instanceof HTMLDivElement, "invalid child for container tools");
47555
47647
  setShadowBottom(shadow, scrollContainer, scrollWrap);
47556
47648
  }
47557
- assert(logger$2l, shadow instanceof HTMLElement, "invalid child for container tools");
47649
+ assert(logger$2k, shadow instanceof HTMLElement, "invalid child for container tools");
47558
47650
  const container = getContainer(scrollContainer);
47559
47651
  const containerRect = container.getBoundingClientRect();
47560
47652
  const scrollContainerRect = scrollContainer.getBoundingClientRect();
47561
47653
  shadow.style.left = `${getSizeAsScale(scrollContainer, scrollContainerRect.left - containerRect.left)}px`;
47562
47654
  const leftRest = getElementScrollSize(scrollContainer).scrollLeft;
47563
- assert(logger$2l, shadow instanceof HTMLDivElement, "invalid child for container tools");
47655
+ assert(logger$2k, shadow instanceof HTMLDivElement, "invalid child for container tools");
47564
47656
  setShadowWidth(shadow, leftRest);
47565
47657
  addClass(shadow, SHADOW_CLASS.ACTIVE);
47566
47658
  }
@@ -47571,17 +47663,17 @@ ${codeText}
47571
47663
  const scrollWrap = getContainerScrollArea(scrollContainer);
47572
47664
  const classes = [SHADOW_CLASS.COMMON, SHADOW_CLASS.RIGHT];
47573
47665
  shadow = createElement("div", classes, tools);
47574
- assert(logger$2l, shadow instanceof HTMLDivElement, "no div, create shadow failed");
47666
+ assert(logger$2k, shadow instanceof HTMLDivElement, "no div, create shadow failed");
47575
47667
  setShadowBottom(shadow, scrollContainer, scrollWrap);
47576
47668
  }
47577
- assert(logger$2l, shadow instanceof HTMLElement, "");
47669
+ assert(logger$2k, shadow instanceof HTMLElement, "");
47578
47670
  const container = getContainer(scrollContainer);
47579
47671
  const containerRect = container.getBoundingClientRect();
47580
47672
  const scrollContainerRect = scrollContainer.getBoundingClientRect();
47581
47673
  shadow.style.right = `${getSizeAsScale(scrollContainer, containerRect.right - scrollContainerRect.right)}px`;
47582
47674
  const { scrollWidth, scrollLeft, clientWidth } = getElementScrollSize(scrollContainer);
47583
47675
  const rightRest = scrollWidth - scrollLeft - clientWidth;
47584
- assert(logger$2l, shadow instanceof HTMLDivElement, "no shadow element");
47676
+ assert(logger$2k, shadow instanceof HTMLDivElement, "no shadow element");
47585
47677
  setShadowWidth(shadow, rightRest);
47586
47678
  addClass(shadow, SHADOW_CLASS.ACTIVE);
47587
47679
  }
@@ -47654,12 +47746,12 @@ ${codeText}
47654
47746
  this.resizeObserver.disconnect();
47655
47747
  }
47656
47748
  }
47657
- const logger$2k = getLogger("container-scroll-observer");
47749
+ const logger$2j = getLogger("container-scroll-observer");
47658
47750
  class ContainerScrollObserver {
47659
47751
  constructor(scrollCore, callback) {
47660
47752
  __publicField(this, "handleContentScroll", (e2) => {
47661
47753
  const scrollContainer = e2.target;
47662
- assert(logger$2k, scrollContainer instanceof Element, "invalid target for scroll event");
47754
+ assert(logger$2j, scrollContainer instanceof Element, "invalid target for scroll event");
47663
47755
  const scrollbarContainer = getScrollbarContainer(scrollContainer);
47664
47756
  scrollbarContainer.removeEventListener("scroll", this.handleScroll);
47665
47757
  const needFixScrollbarContainer = true;
@@ -47670,7 +47762,7 @@ ${codeText}
47670
47762
  });
47671
47763
  __publicField(this, "handleScroll", (e2) => {
47672
47764
  const scrollbarContainer = e2.target;
47673
- assert(logger$2k, scrollbarContainer instanceof HTMLElement, "");
47765
+ assert(logger$2j, scrollbarContainer instanceof HTMLElement, "");
47674
47766
  const scrollLeft = scrollbarContainer.scrollLeft;
47675
47767
  const needFixScrollbarContainer = false;
47676
47768
  const scrollContainer = getScrollContainerByScrollBar(scrollbarContainer);
@@ -47750,7 +47842,7 @@ ${codeText}
47750
47842
  this.scrollContainers.clear();
47751
47843
  }
47752
47844
  }
47753
- const logger$2j = getLogger("scroll-wrap-resize-observer");
47845
+ const logger$2i = getLogger("scroll-wrap-resize-observer");
47754
47846
  class ScrollWrapResizeObserve {
47755
47847
  constructor(scrollCore) {
47756
47848
  __publicField(this, "resizeObserver");
@@ -47766,7 +47858,7 @@ ${codeText}
47766
47858
  });
47767
47859
  __publicField(this, "handleScrollWrapResizeEntry", (entry) => {
47768
47860
  const scrollWrap = entry.target;
47769
- assert(logger$2j, scrollWrap instanceof HTMLElement, "invalid target for observer entry");
47861
+ assert(logger$2i, scrollWrap instanceof HTMLElement, "invalid target for observer entry");
47770
47862
  const scrollContainer = getScrollContainer(scrollWrap);
47771
47863
  resetScrollbar(this.scrollCore, scrollWrap);
47772
47864
  resetScrollWrapShadow(scrollContainer);
@@ -47971,7 +48063,7 @@ ${codeText}
47971
48063
  window.removeEventListener("scroll", this.handleWindowEffect);
47972
48064
  }
47973
48065
  }
47974
- const logger$2i = getLogger("scroll-container");
48066
+ const logger$2h = getLogger("scroll-container");
47975
48067
  const rootScrollMap = /* @__PURE__ */ new Map();
47976
48068
  class ScrollContainer extends tinyTypedEmitter.TypedEmitter {
47977
48069
  constructor() {
@@ -48019,11 +48111,11 @@ ${codeText}
48019
48111
  return this.scrollContainerElement;
48020
48112
  }
48021
48113
  get contentElement() {
48022
- assert(logger$2i, this.scrollContainerElement, "scrollContainerElement cannot be undefined");
48114
+ assert(logger$2h, this.scrollContainerElement, "scrollContainerElement cannot be undefined");
48023
48115
  return getContainerScrollArea(this.scrollContainerElement);
48024
48116
  }
48025
48117
  get scrollOptions() {
48026
- assert(logger$2i, this.options, "options cannot be undefined");
48118
+ assert(logger$2h, this.options, "options cannot be undefined");
48027
48119
  return { ...this.options };
48028
48120
  }
48029
48121
  handleBaseListenerDestroy(baseListener) {
@@ -48047,63 +48139,6 @@ ${codeText}
48047
48139
  function createScrollContainer() {
48048
48140
  return new ScrollContainer();
48049
48141
  }
48050
- const logger$2h = getLogger("column-width");
48051
- function setColumnWidth(table, colIndex, width) {
48052
- const col = getTableCol(table, colIndex);
48053
- col.style.width = `${width}px`;
48054
- col.style.minWidth = `${width}px`;
48055
- }
48056
- function getTableColumnWidthsFromDom(table) {
48057
- const tableCols = Array.from(table.querySelector("colgroup").children);
48058
- const widths = tableCols.map((col) => col.getBoundingClientRect().width);
48059
- if (widths[0] !== 0) {
48060
- return widths;
48061
- }
48062
- const grid = TableGrid.fromTable(table);
48063
- const cellRightOffsets = Array(grid.colCount).fill(-1);
48064
- const left = table.getBoundingClientRect().left;
48065
- grid.toRealCells(grid.cells).forEach((cell) => {
48066
- const colIndex = cell.col + cell.colSpan - 1;
48067
- if (cellRightOffsets[colIndex] === -1) {
48068
- cellRightOffsets[colIndex] = cell.cell.getBoundingClientRect().right - left;
48069
- }
48070
- });
48071
- logger$2h.debug(`cellRightOffsets1: ${cellRightOffsets.join()}`);
48072
- for (let col = 0; col < cellRightOffsets.length; col++) {
48073
- const offset = cellRightOffsets[col];
48074
- if (offset === -1 || col === 0) {
48075
- continue;
48076
- }
48077
- let prevCol = col - 1;
48078
- while (cellRightOffsets[prevCol] === -1) {
48079
- prevCol--;
48080
- if (prevCol === -1) {
48081
- break;
48082
- }
48083
- }
48084
- const prevOffset = prevCol === -1 ? 0 : cellRightOffsets[prevCol];
48085
- const totalWidth = offset - prevOffset;
48086
- const averageWidth = totalWidth / (col - prevCol);
48087
- for (let i = prevCol + 1; i < col; i++) {
48088
- cellRightOffsets[i] = prevOffset + averageWidth * (i - prevCol);
48089
- }
48090
- }
48091
- logger$2h.debug(`cellRightOffsets2: ${cellRightOffsets.join()}`);
48092
- const result = [];
48093
- let prev = 0;
48094
- for (let col = 0; col < cellRightOffsets.length; col++) {
48095
- const offset = cellRightOffsets[col];
48096
- result.push(offset - prev);
48097
- prev = offset;
48098
- }
48099
- logger$2h.debug(`widths: ${result.join()}`);
48100
- return result;
48101
- }
48102
- function getTableColumnWidths(table) {
48103
- const tableCols = Array.from(table.querySelector("colgroup").children);
48104
- const widths = tableCols.map((col) => col.getBoundingClientRect().width || Number.parseInt(col.style.width, 10));
48105
- return widths;
48106
- }
48107
48142
  function getTableResizeMinX(editor, draggingRefCell, table, x) {
48108
48143
  const cell = draggingRefCell;
48109
48144
  const grid = TableGrid.fromTable(table);
@@ -92741,7 +92776,7 @@ ${data2.plantumlText}
92741
92776
  }
92742
92777
  }
92743
92778
  });
92744
- editor.version = "2.8.14-beta.5";
92779
+ editor.version = "2.8.14-beta.6";
92745
92780
  return editor;
92746
92781
  }
92747
92782
  function isDoc(doc2) {
@@ -92854,7 +92889,7 @@ ${data2.plantumlText}
92854
92889
  }
92855
92890
  });
92856
92891
  OnesEditorToolbar.register(editor);
92857
- editor.version = "2.8.14-beta.5";
92892
+ editor.version = "2.8.14-beta.6";
92858
92893
  return editor;
92859
92894
  }
92860
92895
  async function showDocVersions(editor, options, serverUrl) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "2.8.14-beta.5",
3
+ "version": "2.8.14-beta.6",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "dependencies": {