@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getPanelBorderRadiusClass,
|
|
3
3
|
useUnderverseUIConfig
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-BDRCOIYR.js";
|
|
5
5
|
import {
|
|
6
6
|
cn,
|
|
7
7
|
useGlobalI18n
|
|
@@ -196,4 +196,4 @@ var Modal_default = Modal;
|
|
|
196
196
|
export {
|
|
197
197
|
Modal_default
|
|
198
198
|
};
|
|
199
|
-
//# sourceMappingURL=chunk-
|
|
199
|
+
//# sourceMappingURL=chunk-HVJ3R6LP.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -6000,6 +6000,24 @@ var init_clipboard_images = __esm({
|
|
|
6000
6000
|
});
|
|
6001
6001
|
|
|
6002
6002
|
// src/components/UEditor/table-dom-utils.ts
|
|
6003
|
+
function isCrossRealmNode(value) {
|
|
6004
|
+
return Boolean(value && typeof value === "object" && value.nodeType != null);
|
|
6005
|
+
}
|
|
6006
|
+
function isCrossRealmElement(value) {
|
|
6007
|
+
return isCrossRealmNode(value) && value.nodeType === 1 && typeof value.closest === "function";
|
|
6008
|
+
}
|
|
6009
|
+
function isCrossRealmHTMLElement(value) {
|
|
6010
|
+
return isCrossRealmElement(value) && typeof value.style === "object";
|
|
6011
|
+
}
|
|
6012
|
+
function isCrossRealmTable(value) {
|
|
6013
|
+
return isCrossRealmElement(value) && String(value.tagName).toUpperCase() === "TABLE" && "rows" in value;
|
|
6014
|
+
}
|
|
6015
|
+
function isCrossRealmTableRow(value) {
|
|
6016
|
+
return isCrossRealmElement(value) && String(value.tagName).toUpperCase() === "TR" && "cells" in value;
|
|
6017
|
+
}
|
|
6018
|
+
function isCrossRealmTableCell(value) {
|
|
6019
|
+
return isCrossRealmElement(value) && ["TD", "TH"].includes(String(value.tagName).toUpperCase()) && "cellIndex" in value;
|
|
6020
|
+
}
|
|
6003
6021
|
function findTableRowNodeInfo(view, rowElement) {
|
|
6004
6022
|
const firstCell = rowElement.querySelector("th,td");
|
|
6005
6023
|
if (!firstCell) return null;
|
|
@@ -6017,10 +6035,8 @@ function findTableRowNodeInfo(view, rowElement) {
|
|
|
6017
6035
|
return null;
|
|
6018
6036
|
}
|
|
6019
6037
|
function resolveEventElement(target) {
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
if (realm && target instanceof realm.Element) return target;
|
|
6023
|
-
if (realm && target instanceof realm.Node) return target.parentElement;
|
|
6038
|
+
if (isCrossRealmElement(target)) return target;
|
|
6039
|
+
if (isCrossRealmNode(target)) return target.parentElement;
|
|
6024
6040
|
return null;
|
|
6025
6041
|
}
|
|
6026
6042
|
function isPointOverRenderedText(root, clientX, clientY) {
|
|
@@ -6210,8 +6226,8 @@ function applyTableAlignment(editor, tableAlign, anchorPos) {
|
|
|
6210
6226
|
const domAtTable = editor.view.domAtPos(Math.min(tableInfo.pos + 1, editor.state.doc.content.size)).node;
|
|
6211
6227
|
const domAtTableElement = resolveEventElement(domAtTable);
|
|
6212
6228
|
const tableDom = editor.view.nodeDOM(tableInfo.pos);
|
|
6213
|
-
const tableElement = domAtTableElement?.closest?.("table") ?? (tableDom
|
|
6214
|
-
if (tableElement
|
|
6229
|
+
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);
|
|
6230
|
+
if (isCrossRealmTable(tableElement)) {
|
|
6215
6231
|
tableElement.style.tableLayout = "fixed";
|
|
6216
6232
|
if (tableElement.style.width === "max-content") {
|
|
6217
6233
|
tableElement.style.removeProperty("width");
|
|
@@ -36840,6 +36856,7 @@ var import_tables3 = require("@tiptap/pm/tables");
|
|
|
36840
36856
|
var import_state6 = require("@tiptap/pm/state");
|
|
36841
36857
|
var import_view2 = require("@tiptap/pm/view");
|
|
36842
36858
|
var import_tables2 = require("@tiptap/pm/tables");
|
|
36859
|
+
init_table_dom_utils();
|
|
36843
36860
|
var DEFAULT_TABLE_COLUMN_WIDTH = 100;
|
|
36844
36861
|
var MIN_RESIZED_TABLE_COLUMN_WIDTH = 25;
|
|
36845
36862
|
function getColumnResizeMinWidth(configuredMinWidth) {
|
|
@@ -36856,8 +36873,7 @@ function setColumnStyle(column, width) {
|
|
|
36856
36873
|
column.style.minWidth = "";
|
|
36857
36874
|
}
|
|
36858
36875
|
function isTableColumnElement(node) {
|
|
36859
|
-
|
|
36860
|
-
return Boolean(realm && node instanceof realm.HTMLTableColElement && node.tagName.toLowerCase() === "col");
|
|
36876
|
+
return isCrossRealmElement(node) && String(node.tagName).toUpperCase() === "COL";
|
|
36861
36877
|
}
|
|
36862
36878
|
function updateDynamicColumns(node, colgroup, table, ownerDocument, overrideCol, overrideValue) {
|
|
36863
36879
|
let totalWidth = 0;
|
|
@@ -36930,8 +36946,7 @@ function getCurrentColWidth(view, cellPos, { colspan, colwidth }) {
|
|
|
36930
36946
|
if (width) return width;
|
|
36931
36947
|
const dom = view.domAtPos(cellPos);
|
|
36932
36948
|
const cellElement = dom.node.childNodes[dom.offset];
|
|
36933
|
-
|
|
36934
|
-
let domWidth = realm && cellElement instanceof realm.HTMLElement ? cellElement.offsetWidth : 0;
|
|
36949
|
+
let domWidth = isCrossRealmHTMLElement(cellElement) ? cellElement.offsetWidth : 0;
|
|
36935
36950
|
let parts = Math.max(1, colspan);
|
|
36936
36951
|
if (colwidth) {
|
|
36937
36952
|
for (let index = 0; index < colspan; index += 1) {
|
|
@@ -36945,14 +36960,13 @@ function getCurrentColWidth(view, cellPos, { colspan, colwidth }) {
|
|
|
36945
36960
|
return domWidth / Math.max(1, parts);
|
|
36946
36961
|
}
|
|
36947
36962
|
function domCellAround(view, target) {
|
|
36948
|
-
|
|
36949
|
-
let node = realm && target instanceof realm.Node ? target : null;
|
|
36963
|
+
let node = isCrossRealmNode(target) ? target : null;
|
|
36950
36964
|
while (node && node.nodeName !== "TD" && node.nodeName !== "TH") {
|
|
36951
|
-
const element =
|
|
36965
|
+
const element = isCrossRealmElement(node) ? node : null;
|
|
36952
36966
|
if (element?.classList.contains("ProseMirror")) return null;
|
|
36953
36967
|
node = node.parentNode;
|
|
36954
36968
|
}
|
|
36955
|
-
return
|
|
36969
|
+
return isCrossRealmHTMLElement(node) ? node : null;
|
|
36956
36970
|
}
|
|
36957
36971
|
function edgeCell(view, event, side, handleWidth) {
|
|
36958
36972
|
const offset = side === "right" ? -handleWidth : handleWidth;
|
|
@@ -37098,8 +37112,7 @@ function getTableElementAtCell(view, cell) {
|
|
|
37098
37112
|
const $cell = view.state.doc.resolve(cell);
|
|
37099
37113
|
let dom = view.domAtPos($cell.start(-1)).node;
|
|
37100
37114
|
while (dom && dom.nodeName !== "TABLE") dom = dom.parentNode;
|
|
37101
|
-
|
|
37102
|
-
return realm && dom instanceof realm.HTMLTableElement ? dom : null;
|
|
37115
|
+
return isCrossRealmTable(dom) ? dom : null;
|
|
37103
37116
|
}
|
|
37104
37117
|
function showColumnResizeGhost(view, cell, dragging, width) {
|
|
37105
37118
|
const table = getTableElementAtCell(view, cell);
|
|
@@ -45449,20 +45462,16 @@ init_table_dom_utils();
|
|
|
45449
45462
|
var FALLBACK_TABLE_ROW_HEIGHT = DEFAULT_TABLE_ROW_HEIGHT;
|
|
45450
45463
|
var FALLBACK_TABLE_COLUMN_WIDTH = 160;
|
|
45451
45464
|
function isTableCellElement(element) {
|
|
45452
|
-
|
|
45453
|
-
return Boolean(realm && element instanceof realm.HTMLTableCellElement);
|
|
45465
|
+
return isCrossRealmTableCell(element);
|
|
45454
45466
|
}
|
|
45455
45467
|
function isTableRowElement(element) {
|
|
45456
|
-
|
|
45457
|
-
return Boolean(realm && element instanceof realm.HTMLTableRowElement);
|
|
45468
|
+
return isCrossRealmTableRow(element);
|
|
45458
45469
|
}
|
|
45459
45470
|
function isTableElement(element) {
|
|
45460
|
-
|
|
45461
|
-
return Boolean(realm && element instanceof realm.HTMLTableElement);
|
|
45471
|
+
return isCrossRealmTable(element);
|
|
45462
45472
|
}
|
|
45463
45473
|
function isHTMLElement(element) {
|
|
45464
|
-
|
|
45465
|
-
return Boolean(realm && element instanceof realm.HTMLElement);
|
|
45474
|
+
return isCrossRealmHTMLElement(element);
|
|
45466
45475
|
}
|
|
45467
45476
|
function getVisibleTableBounds(layout) {
|
|
45468
45477
|
const left = Math.max(layout.tableLeft, layout.wrapperLeft);
|
|
@@ -45746,8 +45755,7 @@ var ADD_COLUMN_HOVER_WIDTH = 24;
|
|
|
45746
45755
|
var ADD_ROW_HOVER_HEIGHT = 24;
|
|
45747
45756
|
var HANDLE_HOVER_RADIUS = 14;
|
|
45748
45757
|
function isHTMLElement2(element) {
|
|
45749
|
-
|
|
45750
|
-
return Boolean(realm && element instanceof realm.HTMLElement);
|
|
45758
|
+
return isCrossRealmHTMLElement(element);
|
|
45751
45759
|
}
|
|
45752
45760
|
var DEFAULT_TABLE_HOVER_STATE = {
|
|
45753
45761
|
menuVisible: false,
|
|
@@ -46476,7 +46484,7 @@ function getSelectedCell(editor) {
|
|
|
46476
46484
|
const browserSelection = editorWindow?.getSelection();
|
|
46477
46485
|
const anchorElement = resolveEventElement(browserSelection?.anchorNode ?? null);
|
|
46478
46486
|
const anchorCell = anchorElement?.closest?.("th,td");
|
|
46479
|
-
if (
|
|
46487
|
+
if (isCrossRealmTableCell(anchorCell)) {
|
|
46480
46488
|
return anchorCell;
|
|
46481
46489
|
}
|
|
46482
46490
|
const domAtPos = editor.view.domAtPos(editor.state.selection.from);
|
|
@@ -47545,12 +47553,12 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
47545
47553
|
return;
|
|
47546
47554
|
}
|
|
47547
47555
|
const target = resolveEventElement(event.target);
|
|
47548
|
-
if (!(target
|
|
47556
|
+
if (!isCrossRealmElement(target)) {
|
|
47549
47557
|
clearAllTableResizeHover();
|
|
47550
47558
|
return;
|
|
47551
47559
|
}
|
|
47552
47560
|
const cell = target.closest("th,td");
|
|
47553
|
-
if (!(cell
|
|
47561
|
+
if (!isCrossRealmHTMLElement(cell)) {
|
|
47554
47562
|
clearHoveredTableCell();
|
|
47555
47563
|
clearAllTableResizeHover();
|
|
47556
47564
|
return;
|
|
@@ -47558,7 +47566,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
47558
47566
|
setHoveredTableCell(cell);
|
|
47559
47567
|
const row = cell.closest("tr");
|
|
47560
47568
|
const table = cell.closest("table");
|
|
47561
|
-
if (!(row
|
|
47569
|
+
if (!isCrossRealmTableRow(row) || !isCrossRealmTable(table)) {
|
|
47562
47570
|
clearHoveredTableCell();
|
|
47563
47571
|
clearAllTableResizeHover();
|
|
47564
47572
|
return;
|
|
@@ -47614,18 +47622,18 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
47614
47622
|
const handleEditorMouseDown = (event) => {
|
|
47615
47623
|
if (event.button !== 0) return;
|
|
47616
47624
|
const target = resolveEventElement(event.target);
|
|
47617
|
-
if (!(target
|
|
47625
|
+
if (!isCrossRealmElement(target)) {
|
|
47618
47626
|
clearActiveTableCell();
|
|
47619
47627
|
return;
|
|
47620
47628
|
}
|
|
47621
47629
|
const cell = target.closest("th,td");
|
|
47622
|
-
if (!(cell
|
|
47630
|
+
if (!isCrossRealmTableCell(cell)) {
|
|
47623
47631
|
clearActiveTableCell();
|
|
47624
47632
|
return;
|
|
47625
47633
|
}
|
|
47626
47634
|
const row = cell.closest("tr");
|
|
47627
47635
|
const table = cell.closest("table");
|
|
47628
|
-
if (!(row
|
|
47636
|
+
if (!isCrossRealmTableRow(row) || !isCrossRealmTable(table)) return;
|
|
47629
47637
|
const rowTarget = resolveRowResizeTarget(cell, event.clientX, event.clientY);
|
|
47630
47638
|
if (rowTarget) {
|
|
47631
47639
|
event.preventDefault();
|