@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.cjs
CHANGED
|
@@ -36856,9 +36856,10 @@ function setColumnStyle(column, width) {
|
|
|
36856
36856
|
column.style.minWidth = "";
|
|
36857
36857
|
}
|
|
36858
36858
|
function isTableColumnElement(node) {
|
|
36859
|
-
|
|
36859
|
+
const realm = node?.ownerDocument?.defaultView;
|
|
36860
|
+
return Boolean(realm && node instanceof realm.HTMLTableColElement && node.tagName.toLowerCase() === "col");
|
|
36860
36861
|
}
|
|
36861
|
-
function updateDynamicColumns(node, colgroup, table, overrideCol, overrideValue) {
|
|
36862
|
+
function updateDynamicColumns(node, colgroup, table, ownerDocument, overrideCol, overrideValue) {
|
|
36862
36863
|
let totalWidth = 0;
|
|
36863
36864
|
let nextDOM = colgroup.firstChild;
|
|
36864
36865
|
const row = node.firstChild;
|
|
@@ -36869,7 +36870,7 @@ function updateDynamicColumns(node, colgroup, table, overrideCol, overrideValue)
|
|
|
36869
36870
|
const rawWidth = overrideCol === col ? overrideValue : colwidth?.[spanIndex];
|
|
36870
36871
|
const width = rawWidth ? Math.max(rawWidth, MIN_RESIZED_TABLE_COLUMN_WIDTH) : null;
|
|
36871
36872
|
totalWidth += width ?? DEFAULT_TABLE_COLUMN_WIDTH;
|
|
36872
|
-
const colElement = isTableColumnElement(nextDOM) ? nextDOM : colgroup.appendChild(
|
|
36873
|
+
const colElement = isTableColumnElement(nextDOM) ? nextDOM : colgroup.appendChild(ownerDocument.createElement("col"));
|
|
36873
36874
|
setColumnStyle(colElement, width);
|
|
36874
36875
|
nextDOM = colElement.nextSibling;
|
|
36875
36876
|
}
|
|
@@ -36889,23 +36890,25 @@ function updateDynamicColumns(node, colgroup, table, overrideCol, overrideValue)
|
|
|
36889
36890
|
}
|
|
36890
36891
|
}
|
|
36891
36892
|
var UEditorTableView = class {
|
|
36892
|
-
constructor(node) {
|
|
36893
|
+
constructor(node, _defaultColumnWidth, maybeView) {
|
|
36893
36894
|
this.node = node;
|
|
36894
|
-
|
|
36895
|
+
const view = maybeView ?? _defaultColumnWidth;
|
|
36896
|
+
const ownerDocument = view.dom.ownerDocument;
|
|
36897
|
+
this.dom = ownerDocument.createElement("div");
|
|
36895
36898
|
this.dom.className = "tableWrapper";
|
|
36896
|
-
this.table = this.dom.appendChild(
|
|
36899
|
+
this.table = this.dom.appendChild(ownerDocument.createElement("table"));
|
|
36897
36900
|
if (node.attrs.style) {
|
|
36898
36901
|
this.table.style.cssText = node.attrs.style;
|
|
36899
36902
|
}
|
|
36900
36903
|
this.table.style.tableLayout = "fixed";
|
|
36901
|
-
this.colgroup = this.table.appendChild(
|
|
36902
|
-
updateDynamicColumns(node, this.colgroup, this.table);
|
|
36903
|
-
this.contentDOM = this.table.appendChild(
|
|
36904
|
+
this.colgroup = this.table.appendChild(ownerDocument.createElement("colgroup"));
|
|
36905
|
+
updateDynamicColumns(node, this.colgroup, this.table, ownerDocument);
|
|
36906
|
+
this.contentDOM = this.table.appendChild(ownerDocument.createElement("tbody"));
|
|
36904
36907
|
}
|
|
36905
36908
|
update(node) {
|
|
36906
36909
|
if (node.type !== this.node.type) return false;
|
|
36907
36910
|
this.node = node;
|
|
36908
|
-
updateDynamicColumns(node, this.colgroup, this.table);
|
|
36911
|
+
updateDynamicColumns(node, this.colgroup, this.table, this.dom.ownerDocument);
|
|
36909
36912
|
return true;
|
|
36910
36913
|
}
|
|
36911
36914
|
ignoreMutation(mutation) {
|
|
@@ -36927,7 +36930,8 @@ function getCurrentColWidth(view, cellPos, { colspan, colwidth }) {
|
|
|
36927
36930
|
if (width) return width;
|
|
36928
36931
|
const dom = view.domAtPos(cellPos);
|
|
36929
36932
|
const cellElement = dom.node.childNodes[dom.offset];
|
|
36930
|
-
|
|
36933
|
+
const realm = view.dom.ownerDocument.defaultView;
|
|
36934
|
+
let domWidth = realm && cellElement instanceof realm.HTMLElement ? cellElement.offsetWidth : 0;
|
|
36931
36935
|
let parts = Math.max(1, colspan);
|
|
36932
36936
|
if (colwidth) {
|
|
36933
36937
|
for (let index = 0; index < colspan; index += 1) {
|
|
@@ -36940,14 +36944,15 @@ function getCurrentColWidth(view, cellPos, { colspan, colwidth }) {
|
|
|
36940
36944
|
}
|
|
36941
36945
|
return domWidth / Math.max(1, parts);
|
|
36942
36946
|
}
|
|
36943
|
-
function domCellAround(target) {
|
|
36944
|
-
|
|
36947
|
+
function domCellAround(view, target) {
|
|
36948
|
+
const realm = view.dom.ownerDocument.defaultView;
|
|
36949
|
+
let node = realm && target instanceof realm.Node ? target : null;
|
|
36945
36950
|
while (node && node.nodeName !== "TD" && node.nodeName !== "TH") {
|
|
36946
|
-
const element = node instanceof Element ? node : null;
|
|
36951
|
+
const element = realm && node instanceof realm.Element ? node : null;
|
|
36947
36952
|
if (element?.classList.contains("ProseMirror")) return null;
|
|
36948
36953
|
node = node.parentNode;
|
|
36949
36954
|
}
|
|
36950
|
-
return node instanceof HTMLElement ? node : null;
|
|
36955
|
+
return realm && node instanceof realm.HTMLElement ? node : null;
|
|
36951
36956
|
}
|
|
36952
36957
|
function edgeCell(view, event, side, handleWidth) {
|
|
36953
36958
|
const offset = side === "right" ? -handleWidth : handleWidth;
|
|
@@ -36965,12 +36970,14 @@ function edgeCell(view, event, side, handleWidth) {
|
|
|
36965
36970
|
return index % map.width === 0 ? -1 : start + map.map[index - 1];
|
|
36966
36971
|
}
|
|
36967
36972
|
var handleHoverTimer = null;
|
|
36973
|
+
var handleHoverWindow = null;
|
|
36968
36974
|
var pendingHandleCell = -1;
|
|
36969
36975
|
function clearHandleHoverTimer() {
|
|
36970
36976
|
if (handleHoverTimer !== null) {
|
|
36971
|
-
|
|
36977
|
+
handleHoverWindow?.clearTimeout(handleHoverTimer);
|
|
36972
36978
|
handleHoverTimer = null;
|
|
36973
36979
|
}
|
|
36980
|
+
handleHoverWindow = null;
|
|
36974
36981
|
pendingHandleCell = -1;
|
|
36975
36982
|
}
|
|
36976
36983
|
function updateHandle(view, value) {
|
|
@@ -36980,7 +36987,7 @@ function handleMouseMove(view, event, handleWidth, lastColumnResizable) {
|
|
|
36980
36987
|
if (!view.editable) return;
|
|
36981
36988
|
const pluginState = import_tables2.columnResizingPluginKey.getState(view.state);
|
|
36982
36989
|
if (!pluginState || pluginState.dragging) return;
|
|
36983
|
-
const target = domCellAround(event.target);
|
|
36990
|
+
const target = domCellAround(view, event.target);
|
|
36984
36991
|
let cell = -1;
|
|
36985
36992
|
if (target) {
|
|
36986
36993
|
const { left, right } = target.getBoundingClientRect();
|
|
@@ -37016,7 +37023,10 @@ function handleMouseMove(view, event, handleWidth, lastColumnResizable) {
|
|
|
37016
37023
|
if (pendingHandleCell === cell) return;
|
|
37017
37024
|
clearHandleHoverTimer();
|
|
37018
37025
|
pendingHandleCell = cell;
|
|
37019
|
-
|
|
37026
|
+
const ownerWindow = view.dom.ownerDocument.defaultView;
|
|
37027
|
+
if (!ownerWindow) return;
|
|
37028
|
+
handleHoverWindow = ownerWindow;
|
|
37029
|
+
handleHoverTimer = ownerWindow.setTimeout(() => {
|
|
37020
37030
|
handleHoverTimer = null;
|
|
37021
37031
|
pendingHandleCell = -1;
|
|
37022
37032
|
updateHandle(view, cell);
|
|
@@ -37088,7 +37098,8 @@ function getTableElementAtCell(view, cell) {
|
|
|
37088
37098
|
const $cell = view.state.doc.resolve(cell);
|
|
37089
37099
|
let dom = view.domAtPos($cell.start(-1)).node;
|
|
37090
37100
|
while (dom && dom.nodeName !== "TABLE") dom = dom.parentNode;
|
|
37091
|
-
|
|
37101
|
+
const realm = view.dom.ownerDocument.defaultView;
|
|
37102
|
+
return realm && dom instanceof realm.HTMLTableElement ? dom : null;
|
|
37092
37103
|
}
|
|
37093
37104
|
function showColumnResizeGhost(view, cell, dragging, width) {
|
|
37094
37105
|
const table = getTableElementAtCell(view, cell);
|
|
@@ -37145,7 +37156,8 @@ function handleMouseDown(view, event, cellMinWidth) {
|
|
|
37145
37156
|
event.preventDefault();
|
|
37146
37157
|
return true;
|
|
37147
37158
|
}
|
|
37148
|
-
function handleDecorations(state, cell) {
|
|
37159
|
+
function handleDecorations(state, cell, ownerDocument) {
|
|
37160
|
+
if (!ownerDocument) return import_view2.DecorationSet.empty;
|
|
37149
37161
|
const decorations = [];
|
|
37150
37162
|
const $cell = state.doc.resolve(cell);
|
|
37151
37163
|
const table = $cell.node(-1);
|
|
@@ -37162,7 +37174,7 @@ function handleDecorations(state, cell) {
|
|
|
37162
37174
|
const cellNode = table.nodeAt(cellPos);
|
|
37163
37175
|
if (!cellNode) continue;
|
|
37164
37176
|
const pos = start + cellPos + cellNode.nodeSize - 1;
|
|
37165
|
-
const dom =
|
|
37177
|
+
const dom = ownerDocument.createElement("div");
|
|
37166
37178
|
dom.className = "column-resize-handle";
|
|
37167
37179
|
if (import_tables2.columnResizingPluginKey.getState(state)?.dragging) {
|
|
37168
37180
|
decorations.push(import_view2.Decoration.node(start + cellPos, start + cellPos + cellNode.nodeSize, { class: "column-resize-dragging" }));
|
|
@@ -37179,6 +37191,7 @@ function dynamicColumnResizing({
|
|
|
37179
37191
|
View = UEditorTableView,
|
|
37180
37192
|
lastColumnResizable = true
|
|
37181
37193
|
} = {}) {
|
|
37194
|
+
let ownerDocument = null;
|
|
37182
37195
|
const plugin = new import_state6.Plugin({
|
|
37183
37196
|
key: import_tables2.columnResizingPluginKey,
|
|
37184
37197
|
state: {
|
|
@@ -37186,7 +37199,10 @@ function dynamicColumnResizing({
|
|
|
37186
37199
|
const nodeViews = plugin.spec.props?.nodeViews;
|
|
37187
37200
|
const tableName = (0, import_tables2.tableNodeTypes)(state.schema).table.name;
|
|
37188
37201
|
if (View && nodeViews) {
|
|
37189
|
-
nodeViews[tableName] = (node, view) =>
|
|
37202
|
+
nodeViews[tableName] = (node, view) => {
|
|
37203
|
+
ownerDocument = view.dom.ownerDocument;
|
|
37204
|
+
return new View(node, defaultCellMinWidth, view);
|
|
37205
|
+
};
|
|
37190
37206
|
}
|
|
37191
37207
|
return new import_tables2.ResizeState(-1, false);
|
|
37192
37208
|
},
|
|
@@ -37211,7 +37227,7 @@ function dynamicColumnResizing({
|
|
|
37211
37227
|
decorations: (state) => {
|
|
37212
37228
|
const pluginState = import_tables2.columnResizingPluginKey.getState(state);
|
|
37213
37229
|
if (pluginState && pluginState.activeHandle > -1) {
|
|
37214
|
-
return handleDecorations(state, pluginState.activeHandle);
|
|
37230
|
+
return handleDecorations(state, pluginState.activeHandle, ownerDocument);
|
|
37215
37231
|
}
|
|
37216
37232
|
return void 0;
|
|
37217
37233
|
},
|
|
@@ -46232,7 +46248,7 @@ function TableResizeHandles({
|
|
|
46232
46248
|
"data-table-resize-frame": "",
|
|
46233
46249
|
"data-resizing": active ? "true" : "false",
|
|
46234
46250
|
className: cn(
|
|
46235
|
-
"pointer-events-none absolute z-[38] box-border border border-
|
|
46251
|
+
"pointer-events-none absolute z-[38] box-border border border-transparent",
|
|
46236
46252
|
active && "border-primary bg-primary/3"
|
|
46237
46253
|
),
|
|
46238
46254
|
style: {
|