@underverse-ui/underverse 2.0.26 → 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/api-reference.json +1 -1
- package/dist/{chunk-OJF3XRN7.js → chunk-KTOXCD6J.js} +43 -15
- package/dist/{chunk-OJF3XRN7.js.map → chunk-KTOXCD6J.js.map} +1 -1
- package/dist/{chunk-GS24SZVS.js → chunk-QYFXYDBK.js} +40 -39
- package/dist/chunk-QYFXYDBK.js.map +1 -0
- package/dist/{chunk-FFVBGTHU.js → chunk-Y4X6CAZY.js} +2 -2
- package/dist/index.cjs +68 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/{menu-bar-4FM4Y273.js → menu-bar-CFIWMBAA.js} +3 -3
- package/dist/ueditor.cjs +68 -50
- package/dist/ueditor.cjs.map +1 -1
- package/dist/ueditor.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-GS24SZVS.js.map +0 -1
- /package/dist/{chunk-FFVBGTHU.js.map → chunk-Y4X6CAZY.js.map} +0 -0
- /package/dist/{menu-bar-4FM4Y273.js.map → menu-bar-CFIWMBAA.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
extractImageSrcsFromHtml,
|
|
5
5
|
normalizeImageUrl,
|
|
6
6
|
prepareUEditorContentForSave
|
|
7
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
948
|
+
//# sourceMappingURL=menu-bar-CFIWMBAA.js.map
|
package/dist/ueditor.cjs
CHANGED
|
@@ -5195,6 +5195,24 @@ var init_clipboard_images = __esm({
|
|
|
5195
5195
|
});
|
|
5196
5196
|
|
|
5197
5197
|
// src/components/UEditor/table-dom-utils.ts
|
|
5198
|
+
function isCrossRealmNode(value) {
|
|
5199
|
+
return Boolean(value && typeof value === "object" && value.nodeType != null);
|
|
5200
|
+
}
|
|
5201
|
+
function isCrossRealmElement(value) {
|
|
5202
|
+
return isCrossRealmNode(value) && value.nodeType === 1 && typeof value.closest === "function";
|
|
5203
|
+
}
|
|
5204
|
+
function isCrossRealmHTMLElement(value) {
|
|
5205
|
+
return isCrossRealmElement(value) && typeof value.style === "object";
|
|
5206
|
+
}
|
|
5207
|
+
function isCrossRealmTable(value) {
|
|
5208
|
+
return isCrossRealmElement(value) && String(value.tagName).toUpperCase() === "TABLE" && "rows" in value;
|
|
5209
|
+
}
|
|
5210
|
+
function isCrossRealmTableRow(value) {
|
|
5211
|
+
return isCrossRealmElement(value) && String(value.tagName).toUpperCase() === "TR" && "cells" in value;
|
|
5212
|
+
}
|
|
5213
|
+
function isCrossRealmTableCell(value) {
|
|
5214
|
+
return isCrossRealmElement(value) && ["TD", "TH"].includes(String(value.tagName).toUpperCase()) && "cellIndex" in value;
|
|
5215
|
+
}
|
|
5198
5216
|
function findTableRowNodeInfo(view, rowElement) {
|
|
5199
5217
|
const firstCell = rowElement.querySelector("th,td");
|
|
5200
5218
|
if (!firstCell) return null;
|
|
@@ -5212,10 +5230,8 @@ function findTableRowNodeInfo(view, rowElement) {
|
|
|
5212
5230
|
return null;
|
|
5213
5231
|
}
|
|
5214
5232
|
function resolveEventElement(target) {
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
if (realm && target instanceof realm.Element) return target;
|
|
5218
|
-
if (realm && target instanceof realm.Node) return target.parentElement;
|
|
5233
|
+
if (isCrossRealmElement(target)) return target;
|
|
5234
|
+
if (isCrossRealmNode(target)) return target.parentElement;
|
|
5219
5235
|
return null;
|
|
5220
5236
|
}
|
|
5221
5237
|
function isPointOverRenderedText(root, clientX, clientY) {
|
|
@@ -5310,24 +5326,28 @@ function isRowResizeHotspot(cell, clientX, clientY) {
|
|
|
5310
5326
|
}
|
|
5311
5327
|
function getRelativeBoundaryMetrics(surface, table, row, cell) {
|
|
5312
5328
|
const surfaceRect = surface.getBoundingClientRect();
|
|
5329
|
+
const originLeft = surfaceRect.left + surface.clientLeft;
|
|
5330
|
+
const originTop = surfaceRect.top + surface.clientTop;
|
|
5313
5331
|
const tableRect = table.getBoundingClientRect();
|
|
5314
5332
|
const rowRect = row.getBoundingClientRect();
|
|
5315
5333
|
const cellRect = cell.getBoundingClientRect();
|
|
5316
5334
|
return {
|
|
5317
|
-
left: tableRect.left -
|
|
5318
|
-
top: tableRect.top -
|
|
5335
|
+
left: tableRect.left - originLeft + surface.scrollLeft,
|
|
5336
|
+
top: tableRect.top - originTop + surface.scrollTop,
|
|
5319
5337
|
width: tableRect.width,
|
|
5320
5338
|
height: tableRect.height,
|
|
5321
|
-
rowBottom: rowRect.bottom -
|
|
5322
|
-
columnRight: cellRect.right -
|
|
5339
|
+
rowBottom: rowRect.bottom - originTop + surface.scrollTop,
|
|
5340
|
+
columnRight: cellRect.right - originLeft + surface.scrollLeft
|
|
5323
5341
|
};
|
|
5324
5342
|
}
|
|
5325
5343
|
function getRelativeCellMetrics(surface, cell) {
|
|
5326
5344
|
const surfaceRect = surface.getBoundingClientRect();
|
|
5345
|
+
const originLeft = surfaceRect.left + surface.clientLeft;
|
|
5346
|
+
const originTop = surfaceRect.top + surface.clientTop;
|
|
5327
5347
|
const cellRect = cell.getBoundingClientRect();
|
|
5328
5348
|
return {
|
|
5329
|
-
left: cellRect.left -
|
|
5330
|
-
top: cellRect.top -
|
|
5349
|
+
left: cellRect.left - originLeft + surface.scrollLeft,
|
|
5350
|
+
top: cellRect.top - originTop + surface.scrollTop,
|
|
5331
5351
|
width: cellRect.width,
|
|
5332
5352
|
height: cellRect.height
|
|
5333
5353
|
};
|
|
@@ -5340,6 +5360,8 @@ function getRelativeSelectedCellsMetrics(surface) {
|
|
|
5340
5360
|
return null;
|
|
5341
5361
|
}
|
|
5342
5362
|
const surfaceRect = surface.getBoundingClientRect();
|
|
5363
|
+
const originLeft = surfaceRect.left + surface.clientLeft;
|
|
5364
|
+
const originTop = surfaceRect.top + surface.clientTop;
|
|
5343
5365
|
let left = Number.POSITIVE_INFINITY;
|
|
5344
5366
|
let top = Number.POSITIVE_INFINITY;
|
|
5345
5367
|
let right = Number.NEGATIVE_INFINITY;
|
|
@@ -5352,8 +5374,8 @@ function getRelativeSelectedCellsMetrics(surface) {
|
|
|
5352
5374
|
bottom = Math.max(bottom, rect.bottom);
|
|
5353
5375
|
});
|
|
5354
5376
|
return {
|
|
5355
|
-
left: left -
|
|
5356
|
-
top: top -
|
|
5377
|
+
left: left - originLeft + surface.scrollLeft,
|
|
5378
|
+
top: top - originTop + surface.scrollTop,
|
|
5357
5379
|
width: right - left,
|
|
5358
5380
|
height: bottom - top
|
|
5359
5381
|
};
|
|
@@ -5405,8 +5427,8 @@ function applyTableAlignment(editor, tableAlign, anchorPos) {
|
|
|
5405
5427
|
const domAtTable = editor.view.domAtPos(Math.min(tableInfo.pos + 1, editor.state.doc.content.size)).node;
|
|
5406
5428
|
const domAtTableElement = resolveEventElement(domAtTable);
|
|
5407
5429
|
const tableDom = editor.view.nodeDOM(tableInfo.pos);
|
|
5408
|
-
const tableElement = domAtTableElement?.closest?.("table") ?? (tableDom
|
|
5409
|
-
if (tableElement
|
|
5430
|
+
const tableElement = domAtTableElement?.closest?.("table") ?? (isCrossRealmTable(tableDom) ? tableDom : isCrossRealmHTMLElement(tableDom) ? tableDom.querySelector("table") : null) ?? (editor.view.dom.querySelectorAll("table").length === 1 ? editor.view.dom.querySelector("table") : null);
|
|
5431
|
+
if (isCrossRealmTable(tableElement)) {
|
|
5410
5432
|
tableElement.style.tableLayout = "fixed";
|
|
5411
5433
|
if (tableElement.style.width === "max-content") {
|
|
5412
5434
|
tableElement.style.removeProperty("width");
|
|
@@ -12329,6 +12351,7 @@ var import_tables3 = require("@tiptap/pm/tables");
|
|
|
12329
12351
|
var import_state6 = require("@tiptap/pm/state");
|
|
12330
12352
|
var import_view2 = require("@tiptap/pm/view");
|
|
12331
12353
|
var import_tables2 = require("@tiptap/pm/tables");
|
|
12354
|
+
init_table_dom_utils();
|
|
12332
12355
|
var DEFAULT_TABLE_COLUMN_WIDTH = 100;
|
|
12333
12356
|
var MIN_RESIZED_TABLE_COLUMN_WIDTH = 25;
|
|
12334
12357
|
function getColumnResizeMinWidth(configuredMinWidth) {
|
|
@@ -12345,8 +12368,7 @@ function setColumnStyle(column, width) {
|
|
|
12345
12368
|
column.style.minWidth = "";
|
|
12346
12369
|
}
|
|
12347
12370
|
function isTableColumnElement(node) {
|
|
12348
|
-
|
|
12349
|
-
return Boolean(realm && node instanceof realm.HTMLTableColElement && node.tagName.toLowerCase() === "col");
|
|
12371
|
+
return isCrossRealmElement(node) && String(node.tagName).toUpperCase() === "COL";
|
|
12350
12372
|
}
|
|
12351
12373
|
function updateDynamicColumns(node, colgroup, table, ownerDocument, overrideCol, overrideValue) {
|
|
12352
12374
|
let totalWidth = 0;
|
|
@@ -12419,8 +12441,7 @@ function getCurrentColWidth(view, cellPos, { colspan, colwidth }) {
|
|
|
12419
12441
|
if (width) return width;
|
|
12420
12442
|
const dom = view.domAtPos(cellPos);
|
|
12421
12443
|
const cellElement = dom.node.childNodes[dom.offset];
|
|
12422
|
-
|
|
12423
|
-
let domWidth = realm && cellElement instanceof realm.HTMLElement ? cellElement.offsetWidth : 0;
|
|
12444
|
+
let domWidth = isCrossRealmHTMLElement(cellElement) ? cellElement.offsetWidth : 0;
|
|
12424
12445
|
let parts = Math.max(1, colspan);
|
|
12425
12446
|
if (colwidth) {
|
|
12426
12447
|
for (let index = 0; index < colspan; index += 1) {
|
|
@@ -12434,14 +12455,13 @@ function getCurrentColWidth(view, cellPos, { colspan, colwidth }) {
|
|
|
12434
12455
|
return domWidth / Math.max(1, parts);
|
|
12435
12456
|
}
|
|
12436
12457
|
function domCellAround(view, target) {
|
|
12437
|
-
|
|
12438
|
-
let node = realm && target instanceof realm.Node ? target : null;
|
|
12458
|
+
let node = isCrossRealmNode(target) ? target : null;
|
|
12439
12459
|
while (node && node.nodeName !== "TD" && node.nodeName !== "TH") {
|
|
12440
|
-
const element =
|
|
12460
|
+
const element = isCrossRealmElement(node) ? node : null;
|
|
12441
12461
|
if (element?.classList.contains("ProseMirror")) return null;
|
|
12442
12462
|
node = node.parentNode;
|
|
12443
12463
|
}
|
|
12444
|
-
return
|
|
12464
|
+
return isCrossRealmHTMLElement(node) ? node : null;
|
|
12445
12465
|
}
|
|
12446
12466
|
function edgeCell(view, event, side, handleWidth) {
|
|
12447
12467
|
const offset = side === "right" ? -handleWidth : handleWidth;
|
|
@@ -12587,8 +12607,7 @@ function getTableElementAtCell(view, cell) {
|
|
|
12587
12607
|
const $cell = view.state.doc.resolve(cell);
|
|
12588
12608
|
let dom = view.domAtPos($cell.start(-1)).node;
|
|
12589
12609
|
while (dom && dom.nodeName !== "TABLE") dom = dom.parentNode;
|
|
12590
|
-
|
|
12591
|
-
return realm && dom instanceof realm.HTMLTableElement ? dom : null;
|
|
12610
|
+
return isCrossRealmTable(dom) ? dom : null;
|
|
12592
12611
|
}
|
|
12593
12612
|
function showColumnResizeGhost(view, cell, dragging, width) {
|
|
12594
12613
|
const table = getTableElementAtCell(view, cell);
|
|
@@ -20938,20 +20957,16 @@ init_table_dom_utils();
|
|
|
20938
20957
|
var FALLBACK_TABLE_ROW_HEIGHT = DEFAULT_TABLE_ROW_HEIGHT;
|
|
20939
20958
|
var FALLBACK_TABLE_COLUMN_WIDTH = 160;
|
|
20940
20959
|
function isTableCellElement(element) {
|
|
20941
|
-
|
|
20942
|
-
return Boolean(realm && element instanceof realm.HTMLTableCellElement);
|
|
20960
|
+
return isCrossRealmTableCell(element);
|
|
20943
20961
|
}
|
|
20944
20962
|
function isTableRowElement(element) {
|
|
20945
|
-
|
|
20946
|
-
return Boolean(realm && element instanceof realm.HTMLTableRowElement);
|
|
20963
|
+
return isCrossRealmTableRow(element);
|
|
20947
20964
|
}
|
|
20948
20965
|
function isTableElement(element) {
|
|
20949
|
-
|
|
20950
|
-
return Boolean(realm && element instanceof realm.HTMLTableElement);
|
|
20966
|
+
return isCrossRealmTable(element);
|
|
20951
20967
|
}
|
|
20952
20968
|
function isHTMLElement(element) {
|
|
20953
|
-
|
|
20954
|
-
return Boolean(realm && element instanceof realm.HTMLElement);
|
|
20969
|
+
return isCrossRealmHTMLElement(element);
|
|
20955
20970
|
}
|
|
20956
20971
|
function getVisibleTableBounds(layout) {
|
|
20957
20972
|
const left = Math.max(layout.tableLeft, layout.wrapperLeft);
|
|
@@ -21045,7 +21060,7 @@ function buildLogicalColumnMetrics({
|
|
|
21045
21060
|
if (relativeCellPos == null) continue;
|
|
21046
21061
|
const cellMapRect = map.findCell(relativeCellPos);
|
|
21047
21062
|
const cellRect = tableCell.getBoundingClientRect();
|
|
21048
|
-
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;
|
|
21049
21064
|
const size = metricOrFallback(cellRect.width, fallbackWidth * Math.max(1, cellMapRect.right - cellMapRect.left));
|
|
21050
21065
|
visualColumns.push({
|
|
21051
21066
|
index: cellMapRect.left,
|
|
@@ -21100,7 +21115,7 @@ function buildLogicalRowMetrics({
|
|
|
21100
21115
|
const tableCell = isTableCellElement(cellCandidate) ? cellCandidate : null;
|
|
21101
21116
|
if (tableCell) {
|
|
21102
21117
|
const cellRect = tableCell.getBoundingClientRect();
|
|
21103
|
-
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;
|
|
21104
21119
|
const size = metricOrFallback(cellRect.height, fallbackHeight * Math.max(1, cellMapRect.bottom - cellMapRect.top));
|
|
21105
21120
|
visualRows.push({
|
|
21106
21121
|
index: cellMapRect.top,
|
|
@@ -21117,7 +21132,7 @@ function buildLogicalRowMetrics({
|
|
|
21117
21132
|
return rows.map((tableRow, index) => {
|
|
21118
21133
|
const rowRect = tableRow.getBoundingClientRect();
|
|
21119
21134
|
const anchorCell = tableRow.cells.item(0) ?? cornerCell;
|
|
21120
|
-
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;
|
|
21121
21136
|
const size = metricOrFallback(rowRect.height, fallbackHeight);
|
|
21122
21137
|
return {
|
|
21123
21138
|
index,
|
|
@@ -21159,6 +21174,8 @@ function buildTableControlLayout(editor, surface, cell) {
|
|
|
21159
21174
|
}
|
|
21160
21175
|
const map = TableMap4.get(tableInfo.node);
|
|
21161
21176
|
const surfaceRect = surface.getBoundingClientRect();
|
|
21177
|
+
const surfaceOriginLeft = surfaceRect.left + surface.clientLeft;
|
|
21178
|
+
const surfaceOriginTop = surfaceRect.top + surface.clientTop;
|
|
21162
21179
|
const tableRect = table.getBoundingClientRect();
|
|
21163
21180
|
const explicitColumnWidths = Array.from(table.querySelectorAll("colgroup > col")).slice(0, map.width).map((column) => parsePixelMetric(column.style.width));
|
|
21164
21181
|
const explicitTableWidth = parsePixelMetric(table.style.width) ?? (explicitColumnWidths.length === map.width && explicitColumnWidths.every((width) => width !== null) ? explicitColumnWidths.reduce((sum, width) => sum + width, 0) : null);
|
|
@@ -21167,14 +21184,14 @@ function buildTableControlLayout(editor, surface, cell) {
|
|
|
21167
21184
|
const wrapperElement = table.closest(".tableWrapper");
|
|
21168
21185
|
const wrapper = isHTMLElement(wrapperElement) ? wrapperElement : null;
|
|
21169
21186
|
const wrapperRect = wrapper?.getBoundingClientRect() ?? tableRect;
|
|
21170
|
-
const tableLeft = tableRect.left -
|
|
21171
|
-
const tableTop = tableRect.top -
|
|
21187
|
+
const tableLeft = tableRect.left - surfaceOriginLeft + surface.scrollLeft;
|
|
21188
|
+
const tableTop = tableRect.top - surfaceOriginTop + surface.scrollTop;
|
|
21172
21189
|
const tableWidth = metricOrFallback(tableRect.width, explicitTableWidth ?? FALLBACK_TABLE_COLUMN_WIDTH * map.width);
|
|
21173
21190
|
const tableHeight = metricOrFallback(tableRect.height, explicitTableHeight ?? FALLBACK_TABLE_ROW_HEIGHT * rows.length);
|
|
21174
21191
|
const avgRowHeight = metricOrFallback(tableHeight / rows.length, FALLBACK_TABLE_ROW_HEIGHT);
|
|
21175
21192
|
const avgColumnWidth = metricOrFallback(tableWidth / map.width, FALLBACK_TABLE_COLUMN_WIDTH);
|
|
21176
|
-
const wrapperLeft = wrapperRect.left -
|
|
21177
|
-
const wrapperTop = wrapperRect.top -
|
|
21193
|
+
const wrapperLeft = wrapperRect.left - surfaceOriginLeft + surface.scrollLeft;
|
|
21194
|
+
const wrapperTop = wrapperRect.top - surfaceOriginTop + surface.scrollTop;
|
|
21178
21195
|
const wrapperWidth = metricOrFallback(wrapperRect.width, tableWidth);
|
|
21179
21196
|
const wrapperHeight = metricOrFallback(wrapperRect.height, tableHeight);
|
|
21180
21197
|
const viewportWidth = metricOrFallback(wrapper?.clientWidth ?? wrapperRect.width, tableWidth);
|
|
@@ -21235,8 +21252,7 @@ var ADD_COLUMN_HOVER_WIDTH = 24;
|
|
|
21235
21252
|
var ADD_ROW_HOVER_HEIGHT = 24;
|
|
21236
21253
|
var HANDLE_HOVER_RADIUS = 14;
|
|
21237
21254
|
function isHTMLElement2(element) {
|
|
21238
|
-
|
|
21239
|
-
return Boolean(realm && element instanceof realm.HTMLElement);
|
|
21255
|
+
return isCrossRealmHTMLElement(element);
|
|
21240
21256
|
}
|
|
21241
21257
|
var DEFAULT_TABLE_HOVER_STATE = {
|
|
21242
21258
|
menuVisible: false,
|
|
@@ -21257,8 +21273,8 @@ function buildTableHoverState({
|
|
|
21257
21273
|
return DEFAULT_TABLE_HOVER_STATE;
|
|
21258
21274
|
}
|
|
21259
21275
|
const surfaceRect = surface.getBoundingClientRect();
|
|
21260
|
-
const relativeX = event.clientX - surfaceRect.left + surface.scrollLeft;
|
|
21261
|
-
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;
|
|
21262
21278
|
const targetElement = resolveEventElement(event.target);
|
|
21263
21279
|
const directRowHandle = targetElement?.closest?.("[data-row-handle-index]");
|
|
21264
21280
|
const directColumnHandle = targetElement?.closest?.("[data-column-handle-index]");
|
|
@@ -21965,7 +21981,7 @@ function getSelectedCell(editor) {
|
|
|
21965
21981
|
const browserSelection = editorWindow?.getSelection();
|
|
21966
21982
|
const anchorElement = resolveEventElement(browserSelection?.anchorNode ?? null);
|
|
21967
21983
|
const anchorCell = anchorElement?.closest?.("th,td");
|
|
21968
|
-
if (
|
|
21984
|
+
if (isCrossRealmTableCell(anchorCell)) {
|
|
21969
21985
|
return anchorCell;
|
|
21970
21986
|
}
|
|
21971
21987
|
const domAtPos = editor.view.domAtPos(editor.state.selection.from);
|
|
@@ -22166,6 +22182,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
22166
22182
|
surface.addEventListener(UEDITOR_TABLE_LAYOUT_CHANGE_EVENT, scheduleCurrentLayoutRefresh);
|
|
22167
22183
|
if (!editorWindow) return void 0;
|
|
22168
22184
|
const unsubscribeResize = subscribeSharedGlobalEvent(editorWindow, "resize", scheduleCurrentLayoutRefresh);
|
|
22185
|
+
const unsubscribeWindowScroll = subscribeSharedGlobalEvent(editorWindow, "scroll", scheduleCurrentLayoutRefresh, { passive: true });
|
|
22169
22186
|
editor.on("selectionUpdate", scheduleSyncFromSelection);
|
|
22170
22187
|
editor.on("update", scheduleCurrentLayoutRefresh);
|
|
22171
22188
|
syncFromSelection();
|
|
@@ -22181,6 +22198,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
22181
22198
|
surface.removeEventListener("scroll", scheduleCurrentLayoutRefresh, scrollListenerOptions);
|
|
22182
22199
|
surface.removeEventListener(UEDITOR_TABLE_LAYOUT_CHANGE_EVENT, scheduleCurrentLayoutRefresh);
|
|
22183
22200
|
unsubscribeResize();
|
|
22201
|
+
unsubscribeWindowScroll();
|
|
22184
22202
|
editor.off("selectionUpdate", scheduleSyncFromSelection);
|
|
22185
22203
|
editor.off("update", scheduleCurrentLayoutRefresh);
|
|
22186
22204
|
};
|
|
@@ -23034,12 +23052,12 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
23034
23052
|
return;
|
|
23035
23053
|
}
|
|
23036
23054
|
const target = resolveEventElement(event.target);
|
|
23037
|
-
if (!(target
|
|
23055
|
+
if (!isCrossRealmElement(target)) {
|
|
23038
23056
|
clearAllTableResizeHover();
|
|
23039
23057
|
return;
|
|
23040
23058
|
}
|
|
23041
23059
|
const cell = target.closest("th,td");
|
|
23042
|
-
if (!(cell
|
|
23060
|
+
if (!isCrossRealmHTMLElement(cell)) {
|
|
23043
23061
|
clearHoveredTableCell();
|
|
23044
23062
|
clearAllTableResizeHover();
|
|
23045
23063
|
return;
|
|
@@ -23047,7 +23065,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
23047
23065
|
setHoveredTableCell(cell);
|
|
23048
23066
|
const row = cell.closest("tr");
|
|
23049
23067
|
const table = cell.closest("table");
|
|
23050
|
-
if (!(row
|
|
23068
|
+
if (!isCrossRealmTableRow(row) || !isCrossRealmTable(table)) {
|
|
23051
23069
|
clearHoveredTableCell();
|
|
23052
23070
|
clearAllTableResizeHover();
|
|
23053
23071
|
return;
|
|
@@ -23103,18 +23121,18 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
23103
23121
|
const handleEditorMouseDown = (event) => {
|
|
23104
23122
|
if (event.button !== 0) return;
|
|
23105
23123
|
const target = resolveEventElement(event.target);
|
|
23106
|
-
if (!(target
|
|
23124
|
+
if (!isCrossRealmElement(target)) {
|
|
23107
23125
|
clearActiveTableCell();
|
|
23108
23126
|
return;
|
|
23109
23127
|
}
|
|
23110
23128
|
const cell = target.closest("th,td");
|
|
23111
|
-
if (!(cell
|
|
23129
|
+
if (!isCrossRealmTableCell(cell)) {
|
|
23112
23130
|
clearActiveTableCell();
|
|
23113
23131
|
return;
|
|
23114
23132
|
}
|
|
23115
23133
|
const row = cell.closest("tr");
|
|
23116
23134
|
const table = cell.closest("table");
|
|
23117
|
-
if (!(row
|
|
23135
|
+
if (!isCrossRealmTableRow(row) || !isCrossRealmTable(table)) return;
|
|
23118
23136
|
const rowTarget = resolveRowResizeTarget(cell, event.clientX, event.clientY);
|
|
23119
23137
|
if (rowTarget) {
|
|
23120
23138
|
event.preventDefault();
|