@underverse-ui/underverse 2.0.27 → 2.0.28

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.
@@ -61,7 +61,7 @@ import {
61
61
  sanitizeUEditorUrl,
62
62
  useEditorColors,
63
63
  useSharedEditorUiRenderState
64
- } from "./chunk-BDRCOIYR.js";
64
+ } from "./chunk-KTOXCD6J.js";
65
65
  import {
66
66
  Tooltip,
67
67
  UEditorPortalProvider,
@@ -11656,7 +11656,7 @@ function buildLogicalColumnMetrics({
11656
11656
  if (relativeCellPos == null) continue;
11657
11657
  const cellMapRect = map.findCell(relativeCellPos);
11658
11658
  const cellRect = tableCell.getBoundingClientRect();
11659
- const cellStart = cellRect.width > 0 ? cellRect.left - surfaceRect.left + surface.scrollLeft : tableLeft + cellMapRect.left * fallbackWidth;
11659
+ const cellStart = cellRect.width > 0 ? cellRect.left - surfaceRect.left - surface.clientLeft + surface.scrollLeft : tableLeft + cellMapRect.left * fallbackWidth;
11660
11660
  const size = metricOrFallback(cellRect.width, fallbackWidth * Math.max(1, cellMapRect.right - cellMapRect.left));
11661
11661
  visualColumns.push({
11662
11662
  index: cellMapRect.left,
@@ -11711,7 +11711,7 @@ function buildLogicalRowMetrics({
11711
11711
  const tableCell = isTableCellElement(cellCandidate) ? cellCandidate : null;
11712
11712
  if (tableCell) {
11713
11713
  const cellRect = tableCell.getBoundingClientRect();
11714
- const start = cellRect.height > 0 ? cellRect.top - surfaceRect.top + surface.scrollTop : tableTop + cellMapRect.top * fallbackHeight;
11714
+ const start = cellRect.height > 0 ? cellRect.top - surfaceRect.top - surface.clientTop + surface.scrollTop : tableTop + cellMapRect.top * fallbackHeight;
11715
11715
  const size = metricOrFallback(cellRect.height, fallbackHeight * Math.max(1, cellMapRect.bottom - cellMapRect.top));
11716
11716
  visualRows.push({
11717
11717
  index: cellMapRect.top,
@@ -11728,7 +11728,7 @@ function buildLogicalRowMetrics({
11728
11728
  return rows.map((tableRow, index) => {
11729
11729
  const rowRect = tableRow.getBoundingClientRect();
11730
11730
  const anchorCell = tableRow.cells.item(0) ?? cornerCell;
11731
- const start = rowRect.height > 0 ? rowRect.top - surfaceRect.top + surface.scrollTop : tableTop + index * fallbackHeight;
11731
+ const start = rowRect.height > 0 ? rowRect.top - surfaceRect.top - surface.clientTop + surface.scrollTop : tableTop + index * fallbackHeight;
11732
11732
  const size = metricOrFallback(rowRect.height, fallbackHeight);
11733
11733
  return {
11734
11734
  index,
@@ -11770,6 +11770,8 @@ function buildTableControlLayout(editor, surface, cell) {
11770
11770
  }
11771
11771
  const map = TableMap3.get(tableInfo.node);
11772
11772
  const surfaceRect = surface.getBoundingClientRect();
11773
+ const surfaceOriginLeft = surfaceRect.left + surface.clientLeft;
11774
+ const surfaceOriginTop = surfaceRect.top + surface.clientTop;
11773
11775
  const tableRect = table.getBoundingClientRect();
11774
11776
  const explicitColumnWidths = Array.from(table.querySelectorAll("colgroup > col")).slice(0, map.width).map((column) => parsePixelMetric(column.style.width));
11775
11777
  const explicitTableWidth = parsePixelMetric(table.style.width) ?? (explicitColumnWidths.length === map.width && explicitColumnWidths.every((width) => width !== null) ? explicitColumnWidths.reduce((sum, width) => sum + width, 0) : null);
@@ -11778,14 +11780,14 @@ function buildTableControlLayout(editor, surface, cell) {
11778
11780
  const wrapperElement = table.closest(".tableWrapper");
11779
11781
  const wrapper = isHTMLElement(wrapperElement) ? wrapperElement : null;
11780
11782
  const wrapperRect = wrapper?.getBoundingClientRect() ?? tableRect;
11781
- const tableLeft = tableRect.left - surfaceRect.left + surface.scrollLeft;
11782
- const tableTop = tableRect.top - surfaceRect.top + surface.scrollTop;
11783
+ const tableLeft = tableRect.left - surfaceOriginLeft + surface.scrollLeft;
11784
+ const tableTop = tableRect.top - surfaceOriginTop + surface.scrollTop;
11783
11785
  const tableWidth = metricOrFallback(tableRect.width, explicitTableWidth ?? FALLBACK_TABLE_COLUMN_WIDTH * map.width);
11784
11786
  const tableHeight = metricOrFallback(tableRect.height, explicitTableHeight ?? FALLBACK_TABLE_ROW_HEIGHT * rows.length);
11785
11787
  const avgRowHeight = metricOrFallback(tableHeight / rows.length, FALLBACK_TABLE_ROW_HEIGHT);
11786
11788
  const avgColumnWidth = metricOrFallback(tableWidth / map.width, FALLBACK_TABLE_COLUMN_WIDTH);
11787
- const wrapperLeft = wrapperRect.left - surfaceRect.left + surface.scrollLeft;
11788
- const wrapperTop = wrapperRect.top - surfaceRect.top + surface.scrollTop;
11789
+ const wrapperLeft = wrapperRect.left - surfaceOriginLeft + surface.scrollLeft;
11790
+ const wrapperTop = wrapperRect.top - surfaceOriginTop + surface.scrollTop;
11789
11791
  const wrapperWidth = metricOrFallback(wrapperRect.width, tableWidth);
11790
11792
  const wrapperHeight = metricOrFallback(wrapperRect.height, tableHeight);
11791
11793
  const viewportWidth = metricOrFallback(wrapper?.clientWidth ?? wrapperRect.width, tableWidth);
@@ -11867,8 +11869,8 @@ function buildTableHoverState({
11867
11869
  return DEFAULT_TABLE_HOVER_STATE;
11868
11870
  }
11869
11871
  const surfaceRect = surface.getBoundingClientRect();
11870
- const relativeX = event.clientX - surfaceRect.left + surface.scrollLeft;
11871
- const relativeY = event.clientY - surfaceRect.top + surface.scrollTop;
11872
+ const relativeX = event.clientX - surfaceRect.left - surface.clientLeft + surface.scrollLeft;
11873
+ const relativeY = event.clientY - surfaceRect.top - surface.clientTop + surface.scrollTop;
11872
11874
  const targetElement = resolveEventElement(event.target);
11873
11875
  const directRowHandle = targetElement?.closest?.("[data-row-handle-index]");
11874
11876
  const directColumnHandle = targetElement?.closest?.("[data-column-handle-index]");
@@ -12766,6 +12768,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
12766
12768
  surface.addEventListener(UEDITOR_TABLE_LAYOUT_CHANGE_EVENT, scheduleCurrentLayoutRefresh);
12767
12769
  if (!editorWindow) return void 0;
12768
12770
  const unsubscribeResize = subscribeSharedGlobalEvent(editorWindow, "resize", scheduleCurrentLayoutRefresh);
12771
+ const unsubscribeWindowScroll = subscribeSharedGlobalEvent(editorWindow, "scroll", scheduleCurrentLayoutRefresh, { passive: true });
12769
12772
  editor.on("selectionUpdate", scheduleSyncFromSelection);
12770
12773
  editor.on("update", scheduleCurrentLayoutRefresh);
12771
12774
  syncFromSelection();
@@ -12781,6 +12784,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
12781
12784
  surface.removeEventListener("scroll", scheduleCurrentLayoutRefresh, scrollListenerOptions);
12782
12785
  surface.removeEventListener(UEDITOR_TABLE_LAYOUT_CHANGE_EVENT, scheduleCurrentLayoutRefresh);
12783
12786
  unsubscribeResize();
12787
+ unsubscribeWindowScroll();
12784
12788
  editor.off("selectionUpdate", scheduleSyncFromSelection);
12785
12789
  editor.off("update", scheduleCurrentLayoutRefresh);
12786
12790
  };
@@ -14538,7 +14542,7 @@ function useUEditorOutput({
14538
14542
  // src/components/UEditor/UEditor.tsx
14539
14543
  import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
14540
14544
  var LazyMenuBar = React15.lazy(async () => {
14541
- const { MenuBar } = await import("./menu-bar-GKJEVLQU.js");
14545
+ const { MenuBar } = await import("./menu-bar-CFIWMBAA.js");
14542
14546
  return { default: MenuBar };
14543
14547
  });
14544
14548
  var UEditor = React15.forwardRef(({
@@ -15007,4 +15011,4 @@ export {
15007
15011
  prepareUEditorContentForSave,
15008
15012
  UEditor_default
15009
15013
  };
15010
- //# sourceMappingURL=chunk-5ODK33CL.js.map
15014
+ //# sourceMappingURL=chunk-QYFXYDBK.js.map