@underverse-ui/underverse 2.0.24 → 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 +23 -2
- package/dist/{chunk-ZQWVWDGS.js → chunk-FFVBGTHU.js} +2 -2
- package/dist/{chunk-HGOTCQXL.js → chunk-GS24SZVS.js} +55 -39
- package/dist/chunk-GS24SZVS.js.map +1 -0
- package/dist/{chunk-O7AAN6W6.js → chunk-OJF3XRN7.js} +18 -5
- package/dist/chunk-OJF3XRN7.js.map +1 -0
- package/dist/index.cjs +200 -109
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +46 -10
- package/dist/index.d.ts +46 -10
- package/dist/index.js +146 -86
- package/dist/index.js.map +1 -1
- package/dist/{menu-bar-E7MNW6UC.js → menu-bar-4FM4Y273.js} +3 -3
- package/dist/ueditor.cjs +45 -26
- package/dist/ueditor.cjs.map +1 -1
- package/dist/ueditor.js +2 -2
- package/package.json +2 -1
- package/dist/chunk-HGOTCQXL.js.map +0 -1
- package/dist/chunk-O7AAN6W6.js.map +0 -1
- /package/dist/{chunk-ZQWVWDGS.js.map → chunk-FFVBGTHU.js.map} +0 -0
- /package/dist/{menu-bar-E7MNW6UC.js.map → menu-bar-4FM4Y273.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
Modal_default
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-FFVBGTHU.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-OJF3XRN7.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-4FM4Y273.js.map
|
package/dist/ueditor.cjs
CHANGED
|
@@ -5787,7 +5787,8 @@ var init_DropdownMenu = __esm({
|
|
|
5787
5787
|
openOnHover = false,
|
|
5788
5788
|
hoverCloseDelay = 120,
|
|
5789
5789
|
items,
|
|
5790
|
-
borderMode
|
|
5790
|
+
borderMode,
|
|
5791
|
+
getPortalContainer
|
|
5791
5792
|
}) => {
|
|
5792
5793
|
const [internalOpen, setInternalOpen] = (0, import_react29.useState)(false);
|
|
5793
5794
|
const open = isOpen !== void 0 ? isOpen : internalOpen;
|
|
@@ -6020,6 +6021,7 @@ var init_DropdownMenu = __esm({
|
|
|
6020
6021
|
placement,
|
|
6021
6022
|
disabled,
|
|
6022
6023
|
borderMode: resolvedBorderMode,
|
|
6024
|
+
getPortalContainer,
|
|
6023
6025
|
contentClassName: cn("p-1", contentClassName),
|
|
6024
6026
|
children: menuBody
|
|
6025
6027
|
}
|
|
@@ -6080,7 +6082,7 @@ var init_DropdownMenu = __esm({
|
|
|
6080
6082
|
);
|
|
6081
6083
|
};
|
|
6082
6084
|
DropdownMenuSeparator = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: cn("h-px bg-border my-1", className) });
|
|
6083
|
-
DropdownMenuSub = ({ label, icon: Icon, disabled, borderMode, children }) => {
|
|
6085
|
+
DropdownMenuSub = ({ label, icon: Icon, disabled, borderMode, getPortalContainer, children }) => {
|
|
6084
6086
|
const globalConfig = useUnderverseUIConfig();
|
|
6085
6087
|
const resolvedBorderMode = borderMode ?? globalConfig.dropdownMenu?.borderMode ?? globalConfig.borderMode;
|
|
6086
6088
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
@@ -6108,6 +6110,7 @@ var init_DropdownMenu = __esm({
|
|
|
6108
6110
|
),
|
|
6109
6111
|
placement: "right",
|
|
6110
6112
|
openOnHover: true,
|
|
6113
|
+
getPortalContainer,
|
|
6111
6114
|
children
|
|
6112
6115
|
}
|
|
6113
6116
|
);
|
|
@@ -12342,9 +12345,10 @@ function setColumnStyle(column, width) {
|
|
|
12342
12345
|
column.style.minWidth = "";
|
|
12343
12346
|
}
|
|
12344
12347
|
function isTableColumnElement(node) {
|
|
12345
|
-
|
|
12348
|
+
const realm = node?.ownerDocument?.defaultView;
|
|
12349
|
+
return Boolean(realm && node instanceof realm.HTMLTableColElement && node.tagName.toLowerCase() === "col");
|
|
12346
12350
|
}
|
|
12347
|
-
function updateDynamicColumns(node, colgroup, table, overrideCol, overrideValue) {
|
|
12351
|
+
function updateDynamicColumns(node, colgroup, table, ownerDocument, overrideCol, overrideValue) {
|
|
12348
12352
|
let totalWidth = 0;
|
|
12349
12353
|
let nextDOM = colgroup.firstChild;
|
|
12350
12354
|
const row = node.firstChild;
|
|
@@ -12355,7 +12359,7 @@ function updateDynamicColumns(node, colgroup, table, overrideCol, overrideValue)
|
|
|
12355
12359
|
const rawWidth = overrideCol === col ? overrideValue : colwidth?.[spanIndex];
|
|
12356
12360
|
const width = rawWidth ? Math.max(rawWidth, MIN_RESIZED_TABLE_COLUMN_WIDTH) : null;
|
|
12357
12361
|
totalWidth += width ?? DEFAULT_TABLE_COLUMN_WIDTH;
|
|
12358
|
-
const colElement = isTableColumnElement(nextDOM) ? nextDOM : colgroup.appendChild(
|
|
12362
|
+
const colElement = isTableColumnElement(nextDOM) ? nextDOM : colgroup.appendChild(ownerDocument.createElement("col"));
|
|
12359
12363
|
setColumnStyle(colElement, width);
|
|
12360
12364
|
nextDOM = colElement.nextSibling;
|
|
12361
12365
|
}
|
|
@@ -12375,23 +12379,25 @@ function updateDynamicColumns(node, colgroup, table, overrideCol, overrideValue)
|
|
|
12375
12379
|
}
|
|
12376
12380
|
}
|
|
12377
12381
|
var UEditorTableView = class {
|
|
12378
|
-
constructor(node) {
|
|
12382
|
+
constructor(node, _defaultColumnWidth, maybeView) {
|
|
12379
12383
|
this.node = node;
|
|
12380
|
-
|
|
12384
|
+
const view = maybeView ?? _defaultColumnWidth;
|
|
12385
|
+
const ownerDocument = view.dom.ownerDocument;
|
|
12386
|
+
this.dom = ownerDocument.createElement("div");
|
|
12381
12387
|
this.dom.className = "tableWrapper";
|
|
12382
|
-
this.table = this.dom.appendChild(
|
|
12388
|
+
this.table = this.dom.appendChild(ownerDocument.createElement("table"));
|
|
12383
12389
|
if (node.attrs.style) {
|
|
12384
12390
|
this.table.style.cssText = node.attrs.style;
|
|
12385
12391
|
}
|
|
12386
12392
|
this.table.style.tableLayout = "fixed";
|
|
12387
|
-
this.colgroup = this.table.appendChild(
|
|
12388
|
-
updateDynamicColumns(node, this.colgroup, this.table);
|
|
12389
|
-
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"));
|
|
12390
12396
|
}
|
|
12391
12397
|
update(node) {
|
|
12392
12398
|
if (node.type !== this.node.type) return false;
|
|
12393
12399
|
this.node = node;
|
|
12394
|
-
updateDynamicColumns(node, this.colgroup, this.table);
|
|
12400
|
+
updateDynamicColumns(node, this.colgroup, this.table, this.dom.ownerDocument);
|
|
12395
12401
|
return true;
|
|
12396
12402
|
}
|
|
12397
12403
|
ignoreMutation(mutation) {
|
|
@@ -12413,7 +12419,8 @@ function getCurrentColWidth(view, cellPos, { colspan, colwidth }) {
|
|
|
12413
12419
|
if (width) return width;
|
|
12414
12420
|
const dom = view.domAtPos(cellPos);
|
|
12415
12421
|
const cellElement = dom.node.childNodes[dom.offset];
|
|
12416
|
-
|
|
12422
|
+
const realm = view.dom.ownerDocument.defaultView;
|
|
12423
|
+
let domWidth = realm && cellElement instanceof realm.HTMLElement ? cellElement.offsetWidth : 0;
|
|
12417
12424
|
let parts = Math.max(1, colspan);
|
|
12418
12425
|
if (colwidth) {
|
|
12419
12426
|
for (let index = 0; index < colspan; index += 1) {
|
|
@@ -12426,14 +12433,15 @@ function getCurrentColWidth(view, cellPos, { colspan, colwidth }) {
|
|
|
12426
12433
|
}
|
|
12427
12434
|
return domWidth / Math.max(1, parts);
|
|
12428
12435
|
}
|
|
12429
|
-
function domCellAround(target) {
|
|
12430
|
-
|
|
12436
|
+
function domCellAround(view, target) {
|
|
12437
|
+
const realm = view.dom.ownerDocument.defaultView;
|
|
12438
|
+
let node = realm && target instanceof realm.Node ? target : null;
|
|
12431
12439
|
while (node && node.nodeName !== "TD" && node.nodeName !== "TH") {
|
|
12432
|
-
const element = node instanceof Element ? node : null;
|
|
12440
|
+
const element = realm && node instanceof realm.Element ? node : null;
|
|
12433
12441
|
if (element?.classList.contains("ProseMirror")) return null;
|
|
12434
12442
|
node = node.parentNode;
|
|
12435
12443
|
}
|
|
12436
|
-
return node instanceof HTMLElement ? node : null;
|
|
12444
|
+
return realm && node instanceof realm.HTMLElement ? node : null;
|
|
12437
12445
|
}
|
|
12438
12446
|
function edgeCell(view, event, side, handleWidth) {
|
|
12439
12447
|
const offset = side === "right" ? -handleWidth : handleWidth;
|
|
@@ -12451,12 +12459,14 @@ function edgeCell(view, event, side, handleWidth) {
|
|
|
12451
12459
|
return index % map.width === 0 ? -1 : start + map.map[index - 1];
|
|
12452
12460
|
}
|
|
12453
12461
|
var handleHoverTimer = null;
|
|
12462
|
+
var handleHoverWindow = null;
|
|
12454
12463
|
var pendingHandleCell = -1;
|
|
12455
12464
|
function clearHandleHoverTimer() {
|
|
12456
12465
|
if (handleHoverTimer !== null) {
|
|
12457
|
-
|
|
12466
|
+
handleHoverWindow?.clearTimeout(handleHoverTimer);
|
|
12458
12467
|
handleHoverTimer = null;
|
|
12459
12468
|
}
|
|
12469
|
+
handleHoverWindow = null;
|
|
12460
12470
|
pendingHandleCell = -1;
|
|
12461
12471
|
}
|
|
12462
12472
|
function updateHandle(view, value) {
|
|
@@ -12466,7 +12476,7 @@ function handleMouseMove(view, event, handleWidth, lastColumnResizable) {
|
|
|
12466
12476
|
if (!view.editable) return;
|
|
12467
12477
|
const pluginState = import_tables2.columnResizingPluginKey.getState(view.state);
|
|
12468
12478
|
if (!pluginState || pluginState.dragging) return;
|
|
12469
|
-
const target = domCellAround(event.target);
|
|
12479
|
+
const target = domCellAround(view, event.target);
|
|
12470
12480
|
let cell = -1;
|
|
12471
12481
|
if (target) {
|
|
12472
12482
|
const { left, right } = target.getBoundingClientRect();
|
|
@@ -12502,7 +12512,10 @@ function handleMouseMove(view, event, handleWidth, lastColumnResizable) {
|
|
|
12502
12512
|
if (pendingHandleCell === cell) return;
|
|
12503
12513
|
clearHandleHoverTimer();
|
|
12504
12514
|
pendingHandleCell = cell;
|
|
12505
|
-
|
|
12515
|
+
const ownerWindow = view.dom.ownerDocument.defaultView;
|
|
12516
|
+
if (!ownerWindow) return;
|
|
12517
|
+
handleHoverWindow = ownerWindow;
|
|
12518
|
+
handleHoverTimer = ownerWindow.setTimeout(() => {
|
|
12506
12519
|
handleHoverTimer = null;
|
|
12507
12520
|
pendingHandleCell = -1;
|
|
12508
12521
|
updateHandle(view, cell);
|
|
@@ -12574,7 +12587,8 @@ function getTableElementAtCell(view, cell) {
|
|
|
12574
12587
|
const $cell = view.state.doc.resolve(cell);
|
|
12575
12588
|
let dom = view.domAtPos($cell.start(-1)).node;
|
|
12576
12589
|
while (dom && dom.nodeName !== "TABLE") dom = dom.parentNode;
|
|
12577
|
-
|
|
12590
|
+
const realm = view.dom.ownerDocument.defaultView;
|
|
12591
|
+
return realm && dom instanceof realm.HTMLTableElement ? dom : null;
|
|
12578
12592
|
}
|
|
12579
12593
|
function showColumnResizeGhost(view, cell, dragging, width) {
|
|
12580
12594
|
const table = getTableElementAtCell(view, cell);
|
|
@@ -12631,7 +12645,8 @@ function handleMouseDown(view, event, cellMinWidth) {
|
|
|
12631
12645
|
event.preventDefault();
|
|
12632
12646
|
return true;
|
|
12633
12647
|
}
|
|
12634
|
-
function handleDecorations(state, cell) {
|
|
12648
|
+
function handleDecorations(state, cell, ownerDocument) {
|
|
12649
|
+
if (!ownerDocument) return import_view2.DecorationSet.empty;
|
|
12635
12650
|
const decorations = [];
|
|
12636
12651
|
const $cell = state.doc.resolve(cell);
|
|
12637
12652
|
const table = $cell.node(-1);
|
|
@@ -12648,7 +12663,7 @@ function handleDecorations(state, cell) {
|
|
|
12648
12663
|
const cellNode = table.nodeAt(cellPos);
|
|
12649
12664
|
if (!cellNode) continue;
|
|
12650
12665
|
const pos = start + cellPos + cellNode.nodeSize - 1;
|
|
12651
|
-
const dom =
|
|
12666
|
+
const dom = ownerDocument.createElement("div");
|
|
12652
12667
|
dom.className = "column-resize-handle";
|
|
12653
12668
|
if (import_tables2.columnResizingPluginKey.getState(state)?.dragging) {
|
|
12654
12669
|
decorations.push(import_view2.Decoration.node(start + cellPos, start + cellPos + cellNode.nodeSize, { class: "column-resize-dragging" }));
|
|
@@ -12665,6 +12680,7 @@ function dynamicColumnResizing({
|
|
|
12665
12680
|
View = UEditorTableView,
|
|
12666
12681
|
lastColumnResizable = true
|
|
12667
12682
|
} = {}) {
|
|
12683
|
+
let ownerDocument = null;
|
|
12668
12684
|
const plugin = new import_state6.Plugin({
|
|
12669
12685
|
key: import_tables2.columnResizingPluginKey,
|
|
12670
12686
|
state: {
|
|
@@ -12672,7 +12688,10 @@ function dynamicColumnResizing({
|
|
|
12672
12688
|
const nodeViews = plugin.spec.props?.nodeViews;
|
|
12673
12689
|
const tableName = (0, import_tables2.tableNodeTypes)(state.schema).table.name;
|
|
12674
12690
|
if (View && nodeViews) {
|
|
12675
|
-
nodeViews[tableName] = (node, view) =>
|
|
12691
|
+
nodeViews[tableName] = (node, view) => {
|
|
12692
|
+
ownerDocument = view.dom.ownerDocument;
|
|
12693
|
+
return new View(node, defaultCellMinWidth, view);
|
|
12694
|
+
};
|
|
12676
12695
|
}
|
|
12677
12696
|
return new import_tables2.ResizeState(-1, false);
|
|
12678
12697
|
},
|
|
@@ -12697,7 +12716,7 @@ function dynamicColumnResizing({
|
|
|
12697
12716
|
decorations: (state) => {
|
|
12698
12717
|
const pluginState = import_tables2.columnResizingPluginKey.getState(state);
|
|
12699
12718
|
if (pluginState && pluginState.activeHandle > -1) {
|
|
12700
|
-
return handleDecorations(state, pluginState.activeHandle);
|
|
12719
|
+
return handleDecorations(state, pluginState.activeHandle, ownerDocument);
|
|
12701
12720
|
}
|
|
12702
12721
|
return void 0;
|
|
12703
12722
|
},
|
|
@@ -21718,7 +21737,7 @@ function TableResizeHandles({
|
|
|
21718
21737
|
"data-table-resize-frame": "",
|
|
21719
21738
|
"data-resizing": active ? "true" : "false",
|
|
21720
21739
|
className: cn(
|
|
21721
|
-
"pointer-events-none absolute z-[38] box-border border border-
|
|
21740
|
+
"pointer-events-none absolute z-[38] box-border border border-transparent",
|
|
21722
21741
|
active && "border-primary bg-primary/3"
|
|
21723
21742
|
),
|
|
21724
21743
|
style: {
|