@underverse-ui/underverse 2.0.26 → 2.0.27
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-GS24SZVS.js → chunk-5ODK33CL.js} +27 -30
- package/dist/chunk-5ODK33CL.js.map +1 -0
- package/dist/{chunk-OJF3XRN7.js → chunk-BDRCOIYR.js} +29 -7
- package/dist/{chunk-OJF3XRN7.js.map → chunk-BDRCOIYR.js.map} +1 -1
- package/dist/{chunk-FFVBGTHU.js → chunk-HVJ3R6LP.js} +2 -2
- package/dist/index.cjs +41 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/{menu-bar-4FM4Y273.js → menu-bar-GKJEVLQU.js} +3 -3
- package/dist/ueditor.cjs +41 -33
- 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-HVJ3R6LP.js.map} +0 -0
- /package/dist/{menu-bar-4FM4Y273.js.map → menu-bar-GKJEVLQU.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-5ODK33CL.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-HVJ3R6LP.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-BDRCOIYR.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-HVJ3R6LP.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-BDRCOIYR.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-GKJEVLQU.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) {
|
|
@@ -5405,8 +5421,8 @@ function applyTableAlignment(editor, tableAlign, anchorPos) {
|
|
|
5405
5421
|
const domAtTable = editor.view.domAtPos(Math.min(tableInfo.pos + 1, editor.state.doc.content.size)).node;
|
|
5406
5422
|
const domAtTableElement = resolveEventElement(domAtTable);
|
|
5407
5423
|
const tableDom = editor.view.nodeDOM(tableInfo.pos);
|
|
5408
|
-
const tableElement = domAtTableElement?.closest?.("table") ?? (tableDom
|
|
5409
|
-
if (tableElement
|
|
5424
|
+
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);
|
|
5425
|
+
if (isCrossRealmTable(tableElement)) {
|
|
5410
5426
|
tableElement.style.tableLayout = "fixed";
|
|
5411
5427
|
if (tableElement.style.width === "max-content") {
|
|
5412
5428
|
tableElement.style.removeProperty("width");
|
|
@@ -12329,6 +12345,7 @@ var import_tables3 = require("@tiptap/pm/tables");
|
|
|
12329
12345
|
var import_state6 = require("@tiptap/pm/state");
|
|
12330
12346
|
var import_view2 = require("@tiptap/pm/view");
|
|
12331
12347
|
var import_tables2 = require("@tiptap/pm/tables");
|
|
12348
|
+
init_table_dom_utils();
|
|
12332
12349
|
var DEFAULT_TABLE_COLUMN_WIDTH = 100;
|
|
12333
12350
|
var MIN_RESIZED_TABLE_COLUMN_WIDTH = 25;
|
|
12334
12351
|
function getColumnResizeMinWidth(configuredMinWidth) {
|
|
@@ -12345,8 +12362,7 @@ function setColumnStyle(column, width) {
|
|
|
12345
12362
|
column.style.minWidth = "";
|
|
12346
12363
|
}
|
|
12347
12364
|
function isTableColumnElement(node) {
|
|
12348
|
-
|
|
12349
|
-
return Boolean(realm && node instanceof realm.HTMLTableColElement && node.tagName.toLowerCase() === "col");
|
|
12365
|
+
return isCrossRealmElement(node) && String(node.tagName).toUpperCase() === "COL";
|
|
12350
12366
|
}
|
|
12351
12367
|
function updateDynamicColumns(node, colgroup, table, ownerDocument, overrideCol, overrideValue) {
|
|
12352
12368
|
let totalWidth = 0;
|
|
@@ -12419,8 +12435,7 @@ function getCurrentColWidth(view, cellPos, { colspan, colwidth }) {
|
|
|
12419
12435
|
if (width) return width;
|
|
12420
12436
|
const dom = view.domAtPos(cellPos);
|
|
12421
12437
|
const cellElement = dom.node.childNodes[dom.offset];
|
|
12422
|
-
|
|
12423
|
-
let domWidth = realm && cellElement instanceof realm.HTMLElement ? cellElement.offsetWidth : 0;
|
|
12438
|
+
let domWidth = isCrossRealmHTMLElement(cellElement) ? cellElement.offsetWidth : 0;
|
|
12424
12439
|
let parts = Math.max(1, colspan);
|
|
12425
12440
|
if (colwidth) {
|
|
12426
12441
|
for (let index = 0; index < colspan; index += 1) {
|
|
@@ -12434,14 +12449,13 @@ function getCurrentColWidth(view, cellPos, { colspan, colwidth }) {
|
|
|
12434
12449
|
return domWidth / Math.max(1, parts);
|
|
12435
12450
|
}
|
|
12436
12451
|
function domCellAround(view, target) {
|
|
12437
|
-
|
|
12438
|
-
let node = realm && target instanceof realm.Node ? target : null;
|
|
12452
|
+
let node = isCrossRealmNode(target) ? target : null;
|
|
12439
12453
|
while (node && node.nodeName !== "TD" && node.nodeName !== "TH") {
|
|
12440
|
-
const element =
|
|
12454
|
+
const element = isCrossRealmElement(node) ? node : null;
|
|
12441
12455
|
if (element?.classList.contains("ProseMirror")) return null;
|
|
12442
12456
|
node = node.parentNode;
|
|
12443
12457
|
}
|
|
12444
|
-
return
|
|
12458
|
+
return isCrossRealmHTMLElement(node) ? node : null;
|
|
12445
12459
|
}
|
|
12446
12460
|
function edgeCell(view, event, side, handleWidth) {
|
|
12447
12461
|
const offset = side === "right" ? -handleWidth : handleWidth;
|
|
@@ -12587,8 +12601,7 @@ function getTableElementAtCell(view, cell) {
|
|
|
12587
12601
|
const $cell = view.state.doc.resolve(cell);
|
|
12588
12602
|
let dom = view.domAtPos($cell.start(-1)).node;
|
|
12589
12603
|
while (dom && dom.nodeName !== "TABLE") dom = dom.parentNode;
|
|
12590
|
-
|
|
12591
|
-
return realm && dom instanceof realm.HTMLTableElement ? dom : null;
|
|
12604
|
+
return isCrossRealmTable(dom) ? dom : null;
|
|
12592
12605
|
}
|
|
12593
12606
|
function showColumnResizeGhost(view, cell, dragging, width) {
|
|
12594
12607
|
const table = getTableElementAtCell(view, cell);
|
|
@@ -20938,20 +20951,16 @@ init_table_dom_utils();
|
|
|
20938
20951
|
var FALLBACK_TABLE_ROW_HEIGHT = DEFAULT_TABLE_ROW_HEIGHT;
|
|
20939
20952
|
var FALLBACK_TABLE_COLUMN_WIDTH = 160;
|
|
20940
20953
|
function isTableCellElement(element) {
|
|
20941
|
-
|
|
20942
|
-
return Boolean(realm && element instanceof realm.HTMLTableCellElement);
|
|
20954
|
+
return isCrossRealmTableCell(element);
|
|
20943
20955
|
}
|
|
20944
20956
|
function isTableRowElement(element) {
|
|
20945
|
-
|
|
20946
|
-
return Boolean(realm && element instanceof realm.HTMLTableRowElement);
|
|
20957
|
+
return isCrossRealmTableRow(element);
|
|
20947
20958
|
}
|
|
20948
20959
|
function isTableElement(element) {
|
|
20949
|
-
|
|
20950
|
-
return Boolean(realm && element instanceof realm.HTMLTableElement);
|
|
20960
|
+
return isCrossRealmTable(element);
|
|
20951
20961
|
}
|
|
20952
20962
|
function isHTMLElement(element) {
|
|
20953
|
-
|
|
20954
|
-
return Boolean(realm && element instanceof realm.HTMLElement);
|
|
20963
|
+
return isCrossRealmHTMLElement(element);
|
|
20955
20964
|
}
|
|
20956
20965
|
function getVisibleTableBounds(layout) {
|
|
20957
20966
|
const left = Math.max(layout.tableLeft, layout.wrapperLeft);
|
|
@@ -21235,8 +21244,7 @@ var ADD_COLUMN_HOVER_WIDTH = 24;
|
|
|
21235
21244
|
var ADD_ROW_HOVER_HEIGHT = 24;
|
|
21236
21245
|
var HANDLE_HOVER_RADIUS = 14;
|
|
21237
21246
|
function isHTMLElement2(element) {
|
|
21238
|
-
|
|
21239
|
-
return Boolean(realm && element instanceof realm.HTMLElement);
|
|
21247
|
+
return isCrossRealmHTMLElement(element);
|
|
21240
21248
|
}
|
|
21241
21249
|
var DEFAULT_TABLE_HOVER_STATE = {
|
|
21242
21250
|
menuVisible: false,
|
|
@@ -21965,7 +21973,7 @@ function getSelectedCell(editor) {
|
|
|
21965
21973
|
const browserSelection = editorWindow?.getSelection();
|
|
21966
21974
|
const anchorElement = resolveEventElement(browserSelection?.anchorNode ?? null);
|
|
21967
21975
|
const anchorCell = anchorElement?.closest?.("th,td");
|
|
21968
|
-
if (
|
|
21976
|
+
if (isCrossRealmTableCell(anchorCell)) {
|
|
21969
21977
|
return anchorCell;
|
|
21970
21978
|
}
|
|
21971
21979
|
const domAtPos = editor.view.domAtPos(editor.state.selection.from);
|
|
@@ -23034,12 +23042,12 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
23034
23042
|
return;
|
|
23035
23043
|
}
|
|
23036
23044
|
const target = resolveEventElement(event.target);
|
|
23037
|
-
if (!(target
|
|
23045
|
+
if (!isCrossRealmElement(target)) {
|
|
23038
23046
|
clearAllTableResizeHover();
|
|
23039
23047
|
return;
|
|
23040
23048
|
}
|
|
23041
23049
|
const cell = target.closest("th,td");
|
|
23042
|
-
if (!(cell
|
|
23050
|
+
if (!isCrossRealmHTMLElement(cell)) {
|
|
23043
23051
|
clearHoveredTableCell();
|
|
23044
23052
|
clearAllTableResizeHover();
|
|
23045
23053
|
return;
|
|
@@ -23047,7 +23055,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
23047
23055
|
setHoveredTableCell(cell);
|
|
23048
23056
|
const row = cell.closest("tr");
|
|
23049
23057
|
const table = cell.closest("table");
|
|
23050
|
-
if (!(row
|
|
23058
|
+
if (!isCrossRealmTableRow(row) || !isCrossRealmTable(table)) {
|
|
23051
23059
|
clearHoveredTableCell();
|
|
23052
23060
|
clearAllTableResizeHover();
|
|
23053
23061
|
return;
|
|
@@ -23103,18 +23111,18 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
23103
23111
|
const handleEditorMouseDown = (event) => {
|
|
23104
23112
|
if (event.button !== 0) return;
|
|
23105
23113
|
const target = resolveEventElement(event.target);
|
|
23106
|
-
if (!(target
|
|
23114
|
+
if (!isCrossRealmElement(target)) {
|
|
23107
23115
|
clearActiveTableCell();
|
|
23108
23116
|
return;
|
|
23109
23117
|
}
|
|
23110
23118
|
const cell = target.closest("th,td");
|
|
23111
|
-
if (!(cell
|
|
23119
|
+
if (!isCrossRealmTableCell(cell)) {
|
|
23112
23120
|
clearActiveTableCell();
|
|
23113
23121
|
return;
|
|
23114
23122
|
}
|
|
23115
23123
|
const row = cell.closest("tr");
|
|
23116
23124
|
const table = cell.closest("table");
|
|
23117
|
-
if (!(row
|
|
23125
|
+
if (!isCrossRealmTableRow(row) || !isCrossRealmTable(table)) return;
|
|
23118
23126
|
const rowTarget = resolveRowResizeTarget(cell, event.clientX, event.clientY);
|
|
23119
23127
|
if (rowTarget) {
|
|
23120
23128
|
event.preventDefault();
|