@underverse-ui/underverse 2.0.25 → 2.0.26
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-XMAOZQJO.js → chunk-GS24SZVS.js} +53 -37
- package/dist/chunk-GS24SZVS.js.map +1 -0
- package/dist/index.cjs +40 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/ueditor.cjs +40 -24
- package/dist/ueditor.cjs.map +1 -1
- package/dist/ueditor.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-XMAOZQJO.js.map +0 -1
package/dist/index.js
CHANGED
package/dist/ueditor.cjs
CHANGED
|
@@ -12345,9 +12345,10 @@ function setColumnStyle(column, width) {
|
|
|
12345
12345
|
column.style.minWidth = "";
|
|
12346
12346
|
}
|
|
12347
12347
|
function isTableColumnElement(node) {
|
|
12348
|
-
|
|
12348
|
+
const realm = node?.ownerDocument?.defaultView;
|
|
12349
|
+
return Boolean(realm && node instanceof realm.HTMLTableColElement && node.tagName.toLowerCase() === "col");
|
|
12349
12350
|
}
|
|
12350
|
-
function updateDynamicColumns(node, colgroup, table, overrideCol, overrideValue) {
|
|
12351
|
+
function updateDynamicColumns(node, colgroup, table, ownerDocument, overrideCol, overrideValue) {
|
|
12351
12352
|
let totalWidth = 0;
|
|
12352
12353
|
let nextDOM = colgroup.firstChild;
|
|
12353
12354
|
const row = node.firstChild;
|
|
@@ -12358,7 +12359,7 @@ function updateDynamicColumns(node, colgroup, table, overrideCol, overrideValue)
|
|
|
12358
12359
|
const rawWidth = overrideCol === col ? overrideValue : colwidth?.[spanIndex];
|
|
12359
12360
|
const width = rawWidth ? Math.max(rawWidth, MIN_RESIZED_TABLE_COLUMN_WIDTH) : null;
|
|
12360
12361
|
totalWidth += width ?? DEFAULT_TABLE_COLUMN_WIDTH;
|
|
12361
|
-
const colElement = isTableColumnElement(nextDOM) ? nextDOM : colgroup.appendChild(
|
|
12362
|
+
const colElement = isTableColumnElement(nextDOM) ? nextDOM : colgroup.appendChild(ownerDocument.createElement("col"));
|
|
12362
12363
|
setColumnStyle(colElement, width);
|
|
12363
12364
|
nextDOM = colElement.nextSibling;
|
|
12364
12365
|
}
|
|
@@ -12378,23 +12379,25 @@ function updateDynamicColumns(node, colgroup, table, overrideCol, overrideValue)
|
|
|
12378
12379
|
}
|
|
12379
12380
|
}
|
|
12380
12381
|
var UEditorTableView = class {
|
|
12381
|
-
constructor(node) {
|
|
12382
|
+
constructor(node, _defaultColumnWidth, maybeView) {
|
|
12382
12383
|
this.node = node;
|
|
12383
|
-
|
|
12384
|
+
const view = maybeView ?? _defaultColumnWidth;
|
|
12385
|
+
const ownerDocument = view.dom.ownerDocument;
|
|
12386
|
+
this.dom = ownerDocument.createElement("div");
|
|
12384
12387
|
this.dom.className = "tableWrapper";
|
|
12385
|
-
this.table = this.dom.appendChild(
|
|
12388
|
+
this.table = this.dom.appendChild(ownerDocument.createElement("table"));
|
|
12386
12389
|
if (node.attrs.style) {
|
|
12387
12390
|
this.table.style.cssText = node.attrs.style;
|
|
12388
12391
|
}
|
|
12389
12392
|
this.table.style.tableLayout = "fixed";
|
|
12390
|
-
this.colgroup = this.table.appendChild(
|
|
12391
|
-
updateDynamicColumns(node, this.colgroup, this.table);
|
|
12392
|
-
this.contentDOM = this.table.appendChild(
|
|
12393
|
+
this.colgroup = this.table.appendChild(ownerDocument.createElement("colgroup"));
|
|
12394
|
+
updateDynamicColumns(node, this.colgroup, this.table, ownerDocument);
|
|
12395
|
+
this.contentDOM = this.table.appendChild(ownerDocument.createElement("tbody"));
|
|
12393
12396
|
}
|
|
12394
12397
|
update(node) {
|
|
12395
12398
|
if (node.type !== this.node.type) return false;
|
|
12396
12399
|
this.node = node;
|
|
12397
|
-
updateDynamicColumns(node, this.colgroup, this.table);
|
|
12400
|
+
updateDynamicColumns(node, this.colgroup, this.table, this.dom.ownerDocument);
|
|
12398
12401
|
return true;
|
|
12399
12402
|
}
|
|
12400
12403
|
ignoreMutation(mutation) {
|
|
@@ -12416,7 +12419,8 @@ function getCurrentColWidth(view, cellPos, { colspan, colwidth }) {
|
|
|
12416
12419
|
if (width) return width;
|
|
12417
12420
|
const dom = view.domAtPos(cellPos);
|
|
12418
12421
|
const cellElement = dom.node.childNodes[dom.offset];
|
|
12419
|
-
|
|
12422
|
+
const realm = view.dom.ownerDocument.defaultView;
|
|
12423
|
+
let domWidth = realm && cellElement instanceof realm.HTMLElement ? cellElement.offsetWidth : 0;
|
|
12420
12424
|
let parts = Math.max(1, colspan);
|
|
12421
12425
|
if (colwidth) {
|
|
12422
12426
|
for (let index = 0; index < colspan; index += 1) {
|
|
@@ -12429,14 +12433,15 @@ function getCurrentColWidth(view, cellPos, { colspan, colwidth }) {
|
|
|
12429
12433
|
}
|
|
12430
12434
|
return domWidth / Math.max(1, parts);
|
|
12431
12435
|
}
|
|
12432
|
-
function domCellAround(target) {
|
|
12433
|
-
|
|
12436
|
+
function domCellAround(view, target) {
|
|
12437
|
+
const realm = view.dom.ownerDocument.defaultView;
|
|
12438
|
+
let node = realm && target instanceof realm.Node ? target : null;
|
|
12434
12439
|
while (node && node.nodeName !== "TD" && node.nodeName !== "TH") {
|
|
12435
|
-
const element = node instanceof Element ? node : null;
|
|
12440
|
+
const element = realm && node instanceof realm.Element ? node : null;
|
|
12436
12441
|
if (element?.classList.contains("ProseMirror")) return null;
|
|
12437
12442
|
node = node.parentNode;
|
|
12438
12443
|
}
|
|
12439
|
-
return node instanceof HTMLElement ? node : null;
|
|
12444
|
+
return realm && node instanceof realm.HTMLElement ? node : null;
|
|
12440
12445
|
}
|
|
12441
12446
|
function edgeCell(view, event, side, handleWidth) {
|
|
12442
12447
|
const offset = side === "right" ? -handleWidth : handleWidth;
|
|
@@ -12454,12 +12459,14 @@ function edgeCell(view, event, side, handleWidth) {
|
|
|
12454
12459
|
return index % map.width === 0 ? -1 : start + map.map[index - 1];
|
|
12455
12460
|
}
|
|
12456
12461
|
var handleHoverTimer = null;
|
|
12462
|
+
var handleHoverWindow = null;
|
|
12457
12463
|
var pendingHandleCell = -1;
|
|
12458
12464
|
function clearHandleHoverTimer() {
|
|
12459
12465
|
if (handleHoverTimer !== null) {
|
|
12460
|
-
|
|
12466
|
+
handleHoverWindow?.clearTimeout(handleHoverTimer);
|
|
12461
12467
|
handleHoverTimer = null;
|
|
12462
12468
|
}
|
|
12469
|
+
handleHoverWindow = null;
|
|
12463
12470
|
pendingHandleCell = -1;
|
|
12464
12471
|
}
|
|
12465
12472
|
function updateHandle(view, value) {
|
|
@@ -12469,7 +12476,7 @@ function handleMouseMove(view, event, handleWidth, lastColumnResizable) {
|
|
|
12469
12476
|
if (!view.editable) return;
|
|
12470
12477
|
const pluginState = import_tables2.columnResizingPluginKey.getState(view.state);
|
|
12471
12478
|
if (!pluginState || pluginState.dragging) return;
|
|
12472
|
-
const target = domCellAround(event.target);
|
|
12479
|
+
const target = domCellAround(view, event.target);
|
|
12473
12480
|
let cell = -1;
|
|
12474
12481
|
if (target) {
|
|
12475
12482
|
const { left, right } = target.getBoundingClientRect();
|
|
@@ -12505,7 +12512,10 @@ function handleMouseMove(view, event, handleWidth, lastColumnResizable) {
|
|
|
12505
12512
|
if (pendingHandleCell === cell) return;
|
|
12506
12513
|
clearHandleHoverTimer();
|
|
12507
12514
|
pendingHandleCell = cell;
|
|
12508
|
-
|
|
12515
|
+
const ownerWindow = view.dom.ownerDocument.defaultView;
|
|
12516
|
+
if (!ownerWindow) return;
|
|
12517
|
+
handleHoverWindow = ownerWindow;
|
|
12518
|
+
handleHoverTimer = ownerWindow.setTimeout(() => {
|
|
12509
12519
|
handleHoverTimer = null;
|
|
12510
12520
|
pendingHandleCell = -1;
|
|
12511
12521
|
updateHandle(view, cell);
|
|
@@ -12577,7 +12587,8 @@ function getTableElementAtCell(view, cell) {
|
|
|
12577
12587
|
const $cell = view.state.doc.resolve(cell);
|
|
12578
12588
|
let dom = view.domAtPos($cell.start(-1)).node;
|
|
12579
12589
|
while (dom && dom.nodeName !== "TABLE") dom = dom.parentNode;
|
|
12580
|
-
|
|
12590
|
+
const realm = view.dom.ownerDocument.defaultView;
|
|
12591
|
+
return realm && dom instanceof realm.HTMLTableElement ? dom : null;
|
|
12581
12592
|
}
|
|
12582
12593
|
function showColumnResizeGhost(view, cell, dragging, width) {
|
|
12583
12594
|
const table = getTableElementAtCell(view, cell);
|
|
@@ -12634,7 +12645,8 @@ function handleMouseDown(view, event, cellMinWidth) {
|
|
|
12634
12645
|
event.preventDefault();
|
|
12635
12646
|
return true;
|
|
12636
12647
|
}
|
|
12637
|
-
function handleDecorations(state, cell) {
|
|
12648
|
+
function handleDecorations(state, cell, ownerDocument) {
|
|
12649
|
+
if (!ownerDocument) return import_view2.DecorationSet.empty;
|
|
12638
12650
|
const decorations = [];
|
|
12639
12651
|
const $cell = state.doc.resolve(cell);
|
|
12640
12652
|
const table = $cell.node(-1);
|
|
@@ -12651,7 +12663,7 @@ function handleDecorations(state, cell) {
|
|
|
12651
12663
|
const cellNode = table.nodeAt(cellPos);
|
|
12652
12664
|
if (!cellNode) continue;
|
|
12653
12665
|
const pos = start + cellPos + cellNode.nodeSize - 1;
|
|
12654
|
-
const dom =
|
|
12666
|
+
const dom = ownerDocument.createElement("div");
|
|
12655
12667
|
dom.className = "column-resize-handle";
|
|
12656
12668
|
if (import_tables2.columnResizingPluginKey.getState(state)?.dragging) {
|
|
12657
12669
|
decorations.push(import_view2.Decoration.node(start + cellPos, start + cellPos + cellNode.nodeSize, { class: "column-resize-dragging" }));
|
|
@@ -12668,6 +12680,7 @@ function dynamicColumnResizing({
|
|
|
12668
12680
|
View = UEditorTableView,
|
|
12669
12681
|
lastColumnResizable = true
|
|
12670
12682
|
} = {}) {
|
|
12683
|
+
let ownerDocument = null;
|
|
12671
12684
|
const plugin = new import_state6.Plugin({
|
|
12672
12685
|
key: import_tables2.columnResizingPluginKey,
|
|
12673
12686
|
state: {
|
|
@@ -12675,7 +12688,10 @@ function dynamicColumnResizing({
|
|
|
12675
12688
|
const nodeViews = plugin.spec.props?.nodeViews;
|
|
12676
12689
|
const tableName = (0, import_tables2.tableNodeTypes)(state.schema).table.name;
|
|
12677
12690
|
if (View && nodeViews) {
|
|
12678
|
-
nodeViews[tableName] = (node, view) =>
|
|
12691
|
+
nodeViews[tableName] = (node, view) => {
|
|
12692
|
+
ownerDocument = view.dom.ownerDocument;
|
|
12693
|
+
return new View(node, defaultCellMinWidth, view);
|
|
12694
|
+
};
|
|
12679
12695
|
}
|
|
12680
12696
|
return new import_tables2.ResizeState(-1, false);
|
|
12681
12697
|
},
|
|
@@ -12700,7 +12716,7 @@ function dynamicColumnResizing({
|
|
|
12700
12716
|
decorations: (state) => {
|
|
12701
12717
|
const pluginState = import_tables2.columnResizingPluginKey.getState(state);
|
|
12702
12718
|
if (pluginState && pluginState.activeHandle > -1) {
|
|
12703
|
-
return handleDecorations(state, pluginState.activeHandle);
|
|
12719
|
+
return handleDecorations(state, pluginState.activeHandle, ownerDocument);
|
|
12704
12720
|
}
|
|
12705
12721
|
return void 0;
|
|
12706
12722
|
},
|
|
@@ -21721,7 +21737,7 @@ function TableResizeHandles({
|
|
|
21721
21737
|
"data-table-resize-frame": "",
|
|
21722
21738
|
"data-resizing": active ? "true" : "false",
|
|
21723
21739
|
className: cn(
|
|
21724
|
-
"pointer-events-none absolute z-[38] box-border border border-
|
|
21740
|
+
"pointer-events-none absolute z-[38] box-border border border-transparent",
|
|
21725
21741
|
active && "border-primary bg-primary/3"
|
|
21726
21742
|
),
|
|
21727
21743
|
style: {
|