@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.
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  extractImageSrcsFromHtml,
5
5
  normalizeImageUrl,
6
6
  prepareUEditorContentForSave
7
- } from "./chunk-5ODK33CL.js";
7
+ } from "./chunk-QYFXYDBK.js";
8
8
  import {
9
9
  EmojiPicker_default
10
10
  } from "./chunk-F7MX3XXK.js";
@@ -16,7 +16,7 @@ import {
16
16
  import "./chunk-4TYW5K4J.js";
17
17
  import {
18
18
  Modal_default
19
- } from "./chunk-HVJ3R6LP.js";
19
+ } from "./chunk-Y4X6CAZY.js";
20
20
  import {
21
21
  DropdownMenuItem,
22
22
  DropdownMenuSeparator,
@@ -31,7 +31,7 @@ import {
31
31
  shadcnAnimationStyles,
32
32
  useShadCNAnimations,
33
33
  useUnderverseUIConfig
34
- } from "./chunk-BDRCOIYR.js";
34
+ } from "./chunk-KTOXCD6J.js";
35
35
  import {
36
36
  ForceInternalTranslationsProvider,
37
37
  NextIntlAdapter,
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  Modal_default
4
- } from "./chunk-HVJ3R6LP.js";
4
+ } from "./chunk-Y4X6CAZY.js";
5
5
  import {
6
6
  DEFAULT_TABLE_ROW_HEIGHT,
7
7
  DEFAULT_UEDITOR_IMAGE_MAX_FILE_SIZE,
@@ -21,7 +21,7 @@ import {
21
21
  sanitizeUEditorUrl,
22
22
  useDropdownMenuClose,
23
23
  useSharedEditorUiRenderState
24
- } from "./chunk-BDRCOIYR.js";
24
+ } from "./chunk-KTOXCD6J.js";
25
25
  import {
26
26
  cn,
27
27
  useSmartTranslations
@@ -945,4 +945,4 @@ var MenuBar = ({
945
945
  export {
946
946
  MenuBar
947
947
  };
948
- //# sourceMappingURL=menu-bar-GKJEVLQU.js.map
948
+ //# sourceMappingURL=menu-bar-CFIWMBAA.js.map
package/dist/ueditor.cjs CHANGED
@@ -5326,24 +5326,28 @@ function isRowResizeHotspot(cell, clientX, clientY) {
5326
5326
  }
5327
5327
  function getRelativeBoundaryMetrics(surface, table, row, cell) {
5328
5328
  const surfaceRect = surface.getBoundingClientRect();
5329
+ const originLeft = surfaceRect.left + surface.clientLeft;
5330
+ const originTop = surfaceRect.top + surface.clientTop;
5329
5331
  const tableRect = table.getBoundingClientRect();
5330
5332
  const rowRect = row.getBoundingClientRect();
5331
5333
  const cellRect = cell.getBoundingClientRect();
5332
5334
  return {
5333
- left: tableRect.left - surfaceRect.left + surface.scrollLeft,
5334
- top: tableRect.top - surfaceRect.top + surface.scrollTop,
5335
+ left: tableRect.left - originLeft + surface.scrollLeft,
5336
+ top: tableRect.top - originTop + surface.scrollTop,
5335
5337
  width: tableRect.width,
5336
5338
  height: tableRect.height,
5337
- rowBottom: rowRect.bottom - surfaceRect.top + surface.scrollTop,
5338
- columnRight: cellRect.right - surfaceRect.left + surface.scrollLeft
5339
+ rowBottom: rowRect.bottom - originTop + surface.scrollTop,
5340
+ columnRight: cellRect.right - originLeft + surface.scrollLeft
5339
5341
  };
5340
5342
  }
5341
5343
  function getRelativeCellMetrics(surface, cell) {
5342
5344
  const surfaceRect = surface.getBoundingClientRect();
5345
+ const originLeft = surfaceRect.left + surface.clientLeft;
5346
+ const originTop = surfaceRect.top + surface.clientTop;
5343
5347
  const cellRect = cell.getBoundingClientRect();
5344
5348
  return {
5345
- left: cellRect.left - surfaceRect.left + surface.scrollLeft,
5346
- top: cellRect.top - surfaceRect.top + surface.scrollTop,
5349
+ left: cellRect.left - originLeft + surface.scrollLeft,
5350
+ top: cellRect.top - originTop + surface.scrollTop,
5347
5351
  width: cellRect.width,
5348
5352
  height: cellRect.height
5349
5353
  };
@@ -5356,6 +5360,8 @@ function getRelativeSelectedCellsMetrics(surface) {
5356
5360
  return null;
5357
5361
  }
5358
5362
  const surfaceRect = surface.getBoundingClientRect();
5363
+ const originLeft = surfaceRect.left + surface.clientLeft;
5364
+ const originTop = surfaceRect.top + surface.clientTop;
5359
5365
  let left = Number.POSITIVE_INFINITY;
5360
5366
  let top = Number.POSITIVE_INFINITY;
5361
5367
  let right = Number.NEGATIVE_INFINITY;
@@ -5368,8 +5374,8 @@ function getRelativeSelectedCellsMetrics(surface) {
5368
5374
  bottom = Math.max(bottom, rect.bottom);
5369
5375
  });
5370
5376
  return {
5371
- left: left - surfaceRect.left + surface.scrollLeft,
5372
- top: top - surfaceRect.top + surface.scrollTop,
5377
+ left: left - originLeft + surface.scrollLeft,
5378
+ top: top - originTop + surface.scrollTop,
5373
5379
  width: right - left,
5374
5380
  height: bottom - top
5375
5381
  };
@@ -21054,7 +21060,7 @@ function buildLogicalColumnMetrics({
21054
21060
  if (relativeCellPos == null) continue;
21055
21061
  const cellMapRect = map.findCell(relativeCellPos);
21056
21062
  const cellRect = tableCell.getBoundingClientRect();
21057
- const cellStart = cellRect.width > 0 ? cellRect.left - surfaceRect.left + surface.scrollLeft : tableLeft + cellMapRect.left * fallbackWidth;
21063
+ const cellStart = cellRect.width > 0 ? cellRect.left - surfaceRect.left - surface.clientLeft + surface.scrollLeft : tableLeft + cellMapRect.left * fallbackWidth;
21058
21064
  const size = metricOrFallback(cellRect.width, fallbackWidth * Math.max(1, cellMapRect.right - cellMapRect.left));
21059
21065
  visualColumns.push({
21060
21066
  index: cellMapRect.left,
@@ -21109,7 +21115,7 @@ function buildLogicalRowMetrics({
21109
21115
  const tableCell = isTableCellElement(cellCandidate) ? cellCandidate : null;
21110
21116
  if (tableCell) {
21111
21117
  const cellRect = tableCell.getBoundingClientRect();
21112
- const start = cellRect.height > 0 ? cellRect.top - surfaceRect.top + surface.scrollTop : tableTop + cellMapRect.top * fallbackHeight;
21118
+ const start = cellRect.height > 0 ? cellRect.top - surfaceRect.top - surface.clientTop + surface.scrollTop : tableTop + cellMapRect.top * fallbackHeight;
21113
21119
  const size = metricOrFallback(cellRect.height, fallbackHeight * Math.max(1, cellMapRect.bottom - cellMapRect.top));
21114
21120
  visualRows.push({
21115
21121
  index: cellMapRect.top,
@@ -21126,7 +21132,7 @@ function buildLogicalRowMetrics({
21126
21132
  return rows.map((tableRow, index) => {
21127
21133
  const rowRect = tableRow.getBoundingClientRect();
21128
21134
  const anchorCell = tableRow.cells.item(0) ?? cornerCell;
21129
- const start = rowRect.height > 0 ? rowRect.top - surfaceRect.top + surface.scrollTop : tableTop + index * fallbackHeight;
21135
+ const start = rowRect.height > 0 ? rowRect.top - surfaceRect.top - surface.clientTop + surface.scrollTop : tableTop + index * fallbackHeight;
21130
21136
  const size = metricOrFallback(rowRect.height, fallbackHeight);
21131
21137
  return {
21132
21138
  index,
@@ -21168,6 +21174,8 @@ function buildTableControlLayout(editor, surface, cell) {
21168
21174
  }
21169
21175
  const map = TableMap4.get(tableInfo.node);
21170
21176
  const surfaceRect = surface.getBoundingClientRect();
21177
+ const surfaceOriginLeft = surfaceRect.left + surface.clientLeft;
21178
+ const surfaceOriginTop = surfaceRect.top + surface.clientTop;
21171
21179
  const tableRect = table.getBoundingClientRect();
21172
21180
  const explicitColumnWidths = Array.from(table.querySelectorAll("colgroup > col")).slice(0, map.width).map((column) => parsePixelMetric(column.style.width));
21173
21181
  const explicitTableWidth = parsePixelMetric(table.style.width) ?? (explicitColumnWidths.length === map.width && explicitColumnWidths.every((width) => width !== null) ? explicitColumnWidths.reduce((sum, width) => sum + width, 0) : null);
@@ -21176,14 +21184,14 @@ function buildTableControlLayout(editor, surface, cell) {
21176
21184
  const wrapperElement = table.closest(".tableWrapper");
21177
21185
  const wrapper = isHTMLElement(wrapperElement) ? wrapperElement : null;
21178
21186
  const wrapperRect = wrapper?.getBoundingClientRect() ?? tableRect;
21179
- const tableLeft = tableRect.left - surfaceRect.left + surface.scrollLeft;
21180
- const tableTop = tableRect.top - surfaceRect.top + surface.scrollTop;
21187
+ const tableLeft = tableRect.left - surfaceOriginLeft + surface.scrollLeft;
21188
+ const tableTop = tableRect.top - surfaceOriginTop + surface.scrollTop;
21181
21189
  const tableWidth = metricOrFallback(tableRect.width, explicitTableWidth ?? FALLBACK_TABLE_COLUMN_WIDTH * map.width);
21182
21190
  const tableHeight = metricOrFallback(tableRect.height, explicitTableHeight ?? FALLBACK_TABLE_ROW_HEIGHT * rows.length);
21183
21191
  const avgRowHeight = metricOrFallback(tableHeight / rows.length, FALLBACK_TABLE_ROW_HEIGHT);
21184
21192
  const avgColumnWidth = metricOrFallback(tableWidth / map.width, FALLBACK_TABLE_COLUMN_WIDTH);
21185
- const wrapperLeft = wrapperRect.left - surfaceRect.left + surface.scrollLeft;
21186
- const wrapperTop = wrapperRect.top - surfaceRect.top + surface.scrollTop;
21193
+ const wrapperLeft = wrapperRect.left - surfaceOriginLeft + surface.scrollLeft;
21194
+ const wrapperTop = wrapperRect.top - surfaceOriginTop + surface.scrollTop;
21187
21195
  const wrapperWidth = metricOrFallback(wrapperRect.width, tableWidth);
21188
21196
  const wrapperHeight = metricOrFallback(wrapperRect.height, tableHeight);
21189
21197
  const viewportWidth = metricOrFallback(wrapper?.clientWidth ?? wrapperRect.width, tableWidth);
@@ -21265,8 +21273,8 @@ function buildTableHoverState({
21265
21273
  return DEFAULT_TABLE_HOVER_STATE;
21266
21274
  }
21267
21275
  const surfaceRect = surface.getBoundingClientRect();
21268
- const relativeX = event.clientX - surfaceRect.left + surface.scrollLeft;
21269
- const relativeY = event.clientY - surfaceRect.top + surface.scrollTop;
21276
+ const relativeX = event.clientX - surfaceRect.left - surface.clientLeft + surface.scrollLeft;
21277
+ const relativeY = event.clientY - surfaceRect.top - surface.clientTop + surface.scrollTop;
21270
21278
  const targetElement = resolveEventElement(event.target);
21271
21279
  const directRowHandle = targetElement?.closest?.("[data-row-handle-index]");
21272
21280
  const directColumnHandle = targetElement?.closest?.("[data-column-handle-index]");
@@ -22174,6 +22182,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
22174
22182
  surface.addEventListener(UEDITOR_TABLE_LAYOUT_CHANGE_EVENT, scheduleCurrentLayoutRefresh);
22175
22183
  if (!editorWindow) return void 0;
22176
22184
  const unsubscribeResize = subscribeSharedGlobalEvent(editorWindow, "resize", scheduleCurrentLayoutRefresh);
22185
+ const unsubscribeWindowScroll = subscribeSharedGlobalEvent(editorWindow, "scroll", scheduleCurrentLayoutRefresh, { passive: true });
22177
22186
  editor.on("selectionUpdate", scheduleSyncFromSelection);
22178
22187
  editor.on("update", scheduleCurrentLayoutRefresh);
22179
22188
  syncFromSelection();
@@ -22189,6 +22198,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
22189
22198
  surface.removeEventListener("scroll", scheduleCurrentLayoutRefresh, scrollListenerOptions);
22190
22199
  surface.removeEventListener(UEDITOR_TABLE_LAYOUT_CHANGE_EVENT, scheduleCurrentLayoutRefresh);
22191
22200
  unsubscribeResize();
22201
+ unsubscribeWindowScroll();
22192
22202
  editor.off("selectionUpdate", scheduleSyncFromSelection);
22193
22203
  editor.off("update", scheduleCurrentLayoutRefresh);
22194
22204
  };