@underverse-ui/underverse 2.0.31 → 2.0.33
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/CHANGELOG.md +10 -0
- package/api-reference.json +9 -2
- package/dist/{EmojiPicker-ISJ6RXYG.js → EmojiPicker-6H52Q4YE.js} +4 -4
- package/dist/{chunk-ZP7F4ZD7.js → chunk-6FAHXNDQ.js} +5 -1
- package/dist/chunk-6FAHXNDQ.js.map +1 -0
- package/dist/{chunk-57BKIC6J.js → chunk-FQVWYDKP.js} +40 -21
- package/dist/chunk-FQVWYDKP.js.map +1 -0
- package/dist/{chunk-S4UHFRL3.js → chunk-L73HBI6E.js} +3 -3
- package/dist/{chunk-37MHVJMV.js → chunk-OTPC2OTQ.js} +20 -10
- package/dist/chunk-OTPC2OTQ.js.map +1 -0
- package/dist/{chunk-2P7TSXEE.js → chunk-UHUKUI5S.js} +3 -3
- package/dist/{chunk-5W63IHIN.js → chunk-W3QTP2DM.js} +2 -2
- package/dist/index.cjs +53 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/{menu-bar-DPCNNUX5.js → menu-bar-HZBBRX42.js} +4 -4
- package/dist/ueditor.cjs +53 -23
- package/dist/ueditor.cjs.map +1 -1
- package/dist/ueditor.d.cts +4 -1
- package/dist/ueditor.d.ts +4 -1
- package/dist/ueditor.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-37MHVJMV.js.map +0 -1
- package/dist/chunk-57BKIC6J.js.map +0 -1
- package/dist/chunk-ZP7F4ZD7.js.map +0 -1
- /package/dist/{EmojiPicker-ISJ6RXYG.js.map → EmojiPicker-6H52Q4YE.js.map} +0 -0
- /package/dist/{chunk-S4UHFRL3.js.map → chunk-L73HBI6E.js.map} +0 -0
- /package/dist/{chunk-2P7TSXEE.js.map → chunk-UHUKUI5S.js.map} +0 -0
- /package/dist/{chunk-5W63IHIN.js.map → chunk-W3QTP2DM.js.map} +0 -0
- /package/dist/{menu-bar-DPCNNUX5.js.map → menu-bar-HZBBRX42.js.map} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getPanelBorderRadiusClass,
|
|
3
3
|
useUnderverseUIConfig
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-OTPC2OTQ.js";
|
|
5
5
|
import {
|
|
6
6
|
cn,
|
|
7
7
|
useGlobalI18n
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-6FAHXNDQ.js";
|
|
9
9
|
|
|
10
10
|
// src/components/Modal.tsx
|
|
11
11
|
import * as React from "react";
|
|
@@ -253,4 +253,4 @@ var Modal_default = Modal;
|
|
|
253
253
|
export {
|
|
254
254
|
Modal_default
|
|
255
255
|
};
|
|
256
|
-
//# sourceMappingURL=chunk-
|
|
256
|
+
//# sourceMappingURL=chunk-UHUKUI5S.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
cn
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6FAHXNDQ.js";
|
|
4
4
|
|
|
5
5
|
// src/components/emoji-ui.tsx
|
|
6
6
|
import React from "react";
|
|
@@ -79,4 +79,4 @@ export {
|
|
|
79
79
|
getEmojiImageUrl,
|
|
80
80
|
EmojiGridButton
|
|
81
81
|
};
|
|
82
|
-
//# sourceMappingURL=chunk-
|
|
82
|
+
//# sourceMappingURL=chunk-W3QTP2DM.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -484,6 +484,7 @@ var init_en = __esm({
|
|
|
484
484
|
dragColumn: "Drag Column",
|
|
485
485
|
resizeBoth: "Resize Table",
|
|
486
486
|
resizeCtrlHint: "Drag freely. Hold Ctrl to lock to one axis; hold Ctrl+Shift to preserve proportions",
|
|
487
|
+
fitToEditorWidth: "Fit to Editor Width",
|
|
487
488
|
alignLeft: "Align Table Left",
|
|
488
489
|
alignCenter: "Align Table Center",
|
|
489
490
|
alignRight: "Align Table Right",
|
|
@@ -950,6 +951,7 @@ var init_vi = __esm({
|
|
|
950
951
|
dragColumn: "K\xE9o c\u1ED9t",
|
|
951
952
|
resizeBoth: "\u0110\u1ED5i k\xEDch th\u01B0\u1EDBc b\u1EA3ng",
|
|
952
953
|
resizeCtrlHint: "K\xE9o t\u1EF1 do; gi\u1EEF Ctrl \u0111\u1EC3 kh\xF3a m\u1ED9t chi\u1EC1u, ho\u1EB7c Ctrl+Shift \u0111\u1EC3 gi\u1EEF nguy\xEAn t\u1EF7 l\u1EC7",
|
|
954
|
+
fitToEditorWidth: "V\u1EEBa chi\u1EC1u r\u1ED9ng tr\xECnh so\u1EA1n th\u1EA3o",
|
|
953
955
|
alignLeft: "C\u0103n b\u1EA3ng tr\xE1i",
|
|
954
956
|
alignCenter: "C\u0103n b\u1EA3ng gi\u1EEFa",
|
|
955
957
|
alignRight: "C\u0103n b\u1EA3ng ph\u1EA3i",
|
|
@@ -1416,6 +1418,7 @@ var init_ko = __esm({
|
|
|
1416
1418
|
dragColumn: "\uC5F4 \uB4DC\uB798\uADF8",
|
|
1417
1419
|
resizeBoth: "\uD45C \uD06C\uAE30 \uC870\uC808",
|
|
1418
1420
|
resizeCtrlHint: "\uC790\uC720\uB86D\uAC8C \uB4DC\uB798\uADF8\uD569\uB2C8\uB2E4. Ctrl \uD0A4\uB97C \uB204\uB974\uBA74 \uD55C \uCD95\uC73C\uB85C \uACE0\uC815\uB418\uACE0, Ctrl+Shift \uD0A4\uB97C \uB204\uB974\uBA74 \uBE44\uC728\uC774 \uC720\uC9C0\uB429\uB2C8\uB2E4",
|
|
1421
|
+
fitToEditorWidth: "\uD3B8\uC9D1\uAE30 \uB108\uBE44\uC5D0 \uB9DE\uCD94\uAE30",
|
|
1419
1422
|
alignLeft: "\uD45C \uC67C\uCABD \uC815\uB82C",
|
|
1420
1423
|
alignCenter: "\uD45C \uAC00\uC6B4\uB370 \uC815\uB82C",
|
|
1421
1424
|
alignRight: "\uD45C \uC624\uB978\uCABD \uC815\uB82C",
|
|
@@ -1882,6 +1885,7 @@ var init_ja = __esm({
|
|
|
1882
1885
|
dragColumn: "\u5217\u3092\u30C9\u30E9\u30C3\u30B0",
|
|
1883
1886
|
resizeBoth: "\u8868\u306E\u30B5\u30A4\u30BA\u3092\u5909\u66F4",
|
|
1884
1887
|
resizeCtrlHint: "\u81EA\u7531\u306B\u30C9\u30E9\u30C3\u30B0\u3067\u304D\u307E\u3059\u3002Ctrl\u30AD\u30FC\u30671\u65B9\u5411\u306B\u56FA\u5B9A\u3057\u3001Ctrl+Shift\u30AD\u30FC\u3067\u7E26\u6A2A\u6BD4\u3092\u7DAD\u6301\u3057\u307E\u3059",
|
|
1888
|
+
fitToEditorWidth: "\u30A8\u30C7\u30A3\u30BF\u30FC\u306E\u5E45\u306B\u5408\u308F\u305B\u308B",
|
|
1885
1889
|
alignLeft: "\u8868\u3092\u5DE6\u5BC4\u305B",
|
|
1886
1890
|
alignCenter: "\u8868\u3092\u4E2D\u592E\u63C3\u3048",
|
|
1887
1891
|
alignRight: "\u8868\u3092\u53F3\u5BC4\u305B",
|
|
@@ -6393,10 +6397,15 @@ function isCrossRealmTableRow(value) {
|
|
|
6393
6397
|
function isCrossRealmTableCell(value) {
|
|
6394
6398
|
return isCrossRealmElement(value) && ["TD", "TH"].includes(String(value.tagName).toUpperCase()) && "cellIndex" in value;
|
|
6395
6399
|
}
|
|
6400
|
+
function isValidProseMirrorPosition(doc, pos) {
|
|
6401
|
+
return Number.isInteger(pos) && pos >= 0 && pos <= doc.content.size;
|
|
6402
|
+
}
|
|
6396
6403
|
function findTableRowNodeInfo(view, rowElement) {
|
|
6404
|
+
if (!view.dom.contains(rowElement)) return null;
|
|
6397
6405
|
const firstCell = rowElement.querySelector("th,td");
|
|
6398
|
-
if (!firstCell) return null;
|
|
6406
|
+
if (!isCrossRealmTableCell(firstCell) || !view.dom.contains(firstCell)) return null;
|
|
6399
6407
|
const cellPos = view.posAtDOM(firstCell, 0);
|
|
6408
|
+
if (!isValidProseMirrorPosition(view.state.doc, cellPos)) return null;
|
|
6400
6409
|
const $pos = view.state.doc.resolve(cellPos);
|
|
6401
6410
|
for (let depth = $pos.depth; depth > 0; depth -= 1) {
|
|
6402
6411
|
const node = $pos.node(depth);
|
|
@@ -6438,14 +6447,14 @@ function getSelectionTableCell(view) {
|
|
|
6438
6447
|
const browserSelection = realm?.getSelection();
|
|
6439
6448
|
const anchorElement = resolveEventElement(browserSelection?.anchorNode ?? null);
|
|
6440
6449
|
const anchorCell = anchorElement?.closest?.("th,td");
|
|
6441
|
-
if (
|
|
6450
|
+
if (isCrossRealmTableCell(anchorCell) && view.dom.contains(anchorCell)) {
|
|
6442
6451
|
return anchorCell;
|
|
6443
6452
|
}
|
|
6444
6453
|
const { from } = view.state.selection;
|
|
6445
6454
|
const domAtPos = view.domAtPos(from);
|
|
6446
6455
|
const element = resolveEventElement(domAtPos.node);
|
|
6447
6456
|
const cell = element?.closest?.("th,td");
|
|
6448
|
-
return
|
|
6457
|
+
return isCrossRealmTableCell(cell) && view.dom.contains(cell) ? cell : null;
|
|
6449
6458
|
}
|
|
6450
6459
|
function resolveRowResizeTarget(cell, clientX, clientY) {
|
|
6451
6460
|
const rect = cell.getBoundingClientRect();
|
|
@@ -8448,18 +8457,22 @@ function getTableAnchorPos(editor) {
|
|
|
8448
8457
|
const editorWindow = editorDocument.defaultView;
|
|
8449
8458
|
const selectionAnchor = resolveEventElement(editorWindow?.getSelection()?.anchorNode ?? null);
|
|
8450
8459
|
const selectionCell2 = selectionAnchor?.closest?.("th,td");
|
|
8451
|
-
if (
|
|
8452
|
-
|
|
8460
|
+
if (isCrossRealmTableCell(selectionCell2) && editor.view.dom.contains(selectionCell2)) {
|
|
8461
|
+
const cellPos2 = editor.view.posAtDOM(selectionCell2, 0);
|
|
8462
|
+
return isValidProseMirrorPosition(editor.state.doc, cellPos2) && isValidProseMirrorPosition(editor.state.doc, cellPos2 + 1) ? cellPos2 + 1 : null;
|
|
8453
8463
|
}
|
|
8454
8464
|
const activeElement = editorWindow && editorDocument.activeElement instanceof editorWindow.Element ? editorDocument.activeElement : null;
|
|
8455
8465
|
const activeCell = activeElement?.closest?.("th,td");
|
|
8456
|
-
if (
|
|
8457
|
-
|
|
8466
|
+
if (isCrossRealmTableCell(activeCell) && editor.view.dom.contains(activeCell)) {
|
|
8467
|
+
const cellPos2 = editor.view.posAtDOM(activeCell, 0);
|
|
8468
|
+
return isValidProseMirrorPosition(editor.state.doc, cellPos2) && isValidProseMirrorPosition(editor.state.doc, cellPos2 + 1) ? cellPos2 + 1 : null;
|
|
8458
8469
|
}
|
|
8459
8470
|
const tables = editor.view.dom.querySelectorAll("table");
|
|
8460
8471
|
if (tables.length !== 1) return null;
|
|
8461
8472
|
const firstCell = tables[0]?.querySelector("th,td");
|
|
8462
|
-
|
|
8473
|
+
if (!isCrossRealmTableCell(firstCell) || !editor.view.dom.contains(firstCell)) return null;
|
|
8474
|
+
const cellPos = editor.view.posAtDOM(firstCell, 0);
|
|
8475
|
+
return isValidProseMirrorPosition(editor.state.doc, cellPos) && isValidProseMirrorPosition(editor.state.doc, cellPos + 1) ? cellPos + 1 : null;
|
|
8463
8476
|
}
|
|
8464
8477
|
function computeEditorUiRenderState(editor) {
|
|
8465
8478
|
const textStyle = editor.getAttributes("textStyle");
|
|
@@ -40861,6 +40874,7 @@ function getBubbleMenuPosition({
|
|
|
40861
40874
|
end,
|
|
40862
40875
|
menuSize,
|
|
40863
40876
|
viewport,
|
|
40877
|
+
preferredPlacement = "auto",
|
|
40864
40878
|
offset = 16,
|
|
40865
40879
|
padding = 8
|
|
40866
40880
|
}) {
|
|
@@ -40868,7 +40882,7 @@ function getBubbleMenuPosition({
|
|
|
40868
40882
|
const selectionBottom = Math.max(start.bottom, end.bottom);
|
|
40869
40883
|
const spaceAbove = selectionTop - offset - padding;
|
|
40870
40884
|
const spaceBelow = viewport.height - padding - selectionBottom - offset;
|
|
40871
|
-
const placement = menuSize.height <= spaceAbove || spaceAbove >= spaceBelow ? "top" : "bottom";
|
|
40885
|
+
const placement = preferredPlacement === "auto" ? menuSize.height <= spaceAbove || spaceAbove >= spaceBelow ? "top" : "bottom" : preferredPlacement;
|
|
40872
40886
|
const halfWidth = menuSize.width / 2;
|
|
40873
40887
|
const minLeft = padding + halfWidth;
|
|
40874
40888
|
const maxLeft = viewport.width - padding - halfWidth;
|
|
@@ -41772,6 +41786,7 @@ var LinkPreviewContent = ({ editor, onEdit }) => {
|
|
|
41772
41786
|
};
|
|
41773
41787
|
var CustomBubbleMenu = ({
|
|
41774
41788
|
editor,
|
|
41789
|
+
placement = "auto",
|
|
41775
41790
|
fontSizes,
|
|
41776
41791
|
lineHeights
|
|
41777
41792
|
}) => {
|
|
@@ -41865,6 +41880,7 @@ var CustomBubbleMenu = ({
|
|
|
41865
41880
|
width: editorWindow?.innerWidth ?? window.innerWidth,
|
|
41866
41881
|
height: editorWindow?.innerHeight ?? window.innerHeight
|
|
41867
41882
|
},
|
|
41883
|
+
preferredPlacement: placement,
|
|
41868
41884
|
offset: BUBBLE_MENU_OFFSET
|
|
41869
41885
|
}));
|
|
41870
41886
|
if (keepOpenRef.current) {
|
|
@@ -41911,7 +41927,7 @@ var CustomBubbleMenu = ({
|
|
|
41911
41927
|
editorWindow?.removeEventListener("resize", schedulePositionUpdate);
|
|
41912
41928
|
editorWindow?.removeEventListener("scroll", schedulePositionUpdate, true);
|
|
41913
41929
|
};
|
|
41914
|
-
}, [editor, editorDocument, editorWindow]);
|
|
41930
|
+
}, [editor, editorDocument, editorWindow, placement]);
|
|
41915
41931
|
(0, import_react76.useEffect)(() => {
|
|
41916
41932
|
if (!isVisible || !portalWindow?.ResizeObserver) return;
|
|
41917
41933
|
const menu = menuRef.current;
|
|
@@ -41965,6 +41981,7 @@ var CustomBubbleMenu = ({
|
|
|
41965
41981
|
{
|
|
41966
41982
|
ref: menuRef,
|
|
41967
41983
|
"data-popover": true,
|
|
41984
|
+
"data-placement": position.placement,
|
|
41968
41985
|
className: "fixed z-[99999] flex rounded-xl border border-border/40 bg-card text-card-foreground shadow-lg backdrop-blur-sm overflow-hidden animate-in fade-in-0 zoom-in-95",
|
|
41969
41986
|
style: {
|
|
41970
41987
|
top: `${position.top}px`,
|
|
@@ -46780,6 +46797,7 @@ function getCellFromTarget(target) {
|
|
|
46780
46797
|
return null;
|
|
46781
46798
|
}
|
|
46782
46799
|
function findTableInfo(editor, pos) {
|
|
46800
|
+
if (!isValidProseMirrorPosition(editor.state.doc, pos)) return null;
|
|
46783
46801
|
const $pos = editor.state.doc.resolve(pos);
|
|
46784
46802
|
for (let depth = $pos.depth; depth > 0; depth -= 1) {
|
|
46785
46803
|
const node = $pos.node(depth);
|
|
@@ -46822,6 +46840,7 @@ function buildLogicalColumnMetrics({
|
|
|
46822
46840
|
for (const tableCell of Array.from(firstRow.cells)) {
|
|
46823
46841
|
if (!isTableCellElement(tableCell)) continue;
|
|
46824
46842
|
const cellPos = editor.view.posAtDOM(tableCell, 0);
|
|
46843
|
+
if (!isValidProseMirrorPosition(editor.state.doc, cellPos)) continue;
|
|
46825
46844
|
const relativeCellPos = getCellRelativePosFromDomPos(map, tableInfo.start, cellPos);
|
|
46826
46845
|
if (relativeCellPos == null) continue;
|
|
46827
46846
|
const cellMapRect = map.findCell(relativeCellPos);
|
|
@@ -46895,18 +46914,20 @@ function buildLogicalRowMetrics({
|
|
|
46895
46914
|
if (visualRows.length > 0) {
|
|
46896
46915
|
return visualRows.sort((a, b) => a.index - b.index);
|
|
46897
46916
|
}
|
|
46898
|
-
return rows.
|
|
46917
|
+
return rows.flatMap((tableRow, index) => {
|
|
46899
46918
|
const rowRect = tableRow.getBoundingClientRect();
|
|
46900
46919
|
const anchorCell = tableRow.cells.item(0) ?? cornerCell;
|
|
46901
46920
|
const start = rowRect.height > 0 ? rowRect.top - surfaceRect.top - surface.clientTop + surface.scrollTop : tableTop + index * fallbackHeight;
|
|
46902
46921
|
const size = metricOrFallback(rowRect.height, fallbackHeight);
|
|
46903
|
-
|
|
46922
|
+
const cellPos = editor.view.posAtDOM(anchorCell, 0);
|
|
46923
|
+
if (!isValidProseMirrorPosition(editor.state.doc, cellPos)) return [];
|
|
46924
|
+
return [{
|
|
46904
46925
|
index,
|
|
46905
|
-
cellPos
|
|
46926
|
+
cellPos,
|
|
46906
46927
|
start,
|
|
46907
46928
|
size,
|
|
46908
46929
|
center: start + size / 2
|
|
46909
|
-
};
|
|
46930
|
+
}];
|
|
46910
46931
|
});
|
|
46911
46932
|
}
|
|
46912
46933
|
function getTableCellTextSelectionRange(editor, cellPos) {
|
|
@@ -46926,6 +46947,7 @@ function getTableCellTextSelectionRange(editor, cellPos) {
|
|
|
46926
46947
|
return from !== null && to !== null && from < to ? { from, to } : null;
|
|
46927
46948
|
}
|
|
46928
46949
|
function buildTableControlLayout(editor, surface, cell) {
|
|
46950
|
+
if (!editor.view.dom.contains(cell)) return null;
|
|
46929
46951
|
const row = cell.closest("tr");
|
|
46930
46952
|
const table = cell.closest("table");
|
|
46931
46953
|
if (!isTableRowElement(row) || !isTableElement(table)) {
|
|
@@ -46934,6 +46956,7 @@ function buildTableControlLayout(editor, surface, cell) {
|
|
|
46934
46956
|
const rows = Array.from(table.rows).filter(isTableRowElement);
|
|
46935
46957
|
const cornerCell = getLastCell(table);
|
|
46936
46958
|
const cellPos = editor.view.posAtDOM(cell, 0);
|
|
46959
|
+
if (!isValidProseMirrorPosition(editor.state.doc, cellPos)) return null;
|
|
46937
46960
|
const tableInfo = findTableInfo(editor, cellPos);
|
|
46938
46961
|
if (rows.length === 0 || !tableInfo || !isTableCellElement(cornerCell)) {
|
|
46939
46962
|
return null;
|
|
@@ -47891,7 +47914,7 @@ function getSelectedCell(editor) {
|
|
|
47891
47914
|
const browserSelection = editorWindow?.getSelection();
|
|
47892
47915
|
const anchorElement = resolveEventElement(browserSelection?.anchorNode ?? null);
|
|
47893
47916
|
const anchorCell = anchorElement?.closest?.("th,td");
|
|
47894
|
-
if (isCrossRealmTableCell(anchorCell)) {
|
|
47917
|
+
if (isCrossRealmTableCell(anchorCell) && editor.view.dom.contains(anchorCell)) {
|
|
47895
47918
|
return anchorCell;
|
|
47896
47919
|
}
|
|
47897
47920
|
const domAtPos = editor.view.domAtPos(editor.state.selection.from);
|
|
@@ -48201,8 +48224,8 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
48201
48224
|
updateTableResizePreview(pendingDimensions);
|
|
48202
48225
|
setDocumentCursor(editorDocument, edge === "both" ? "nwse-resize" : "ew-resize");
|
|
48203
48226
|
}, [editor, editorDocument, updateTableResizePreview]);
|
|
48204
|
-
const fitTableToEditorWidth = import_react78.default.useCallback((
|
|
48205
|
-
if (
|
|
48227
|
+
const fitTableToEditorWidth = import_react78.default.useCallback(() => {
|
|
48228
|
+
if (dragStateRef.current) return;
|
|
48206
48229
|
const activeLayout = layoutRef.current;
|
|
48207
48230
|
if (!activeLayout) return;
|
|
48208
48231
|
const snapshot = createTableSizeSnapshot(
|
|
@@ -48213,8 +48236,6 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
48213
48236
|
activeLayout.viewportWidth
|
|
48214
48237
|
);
|
|
48215
48238
|
if (!snapshot) return;
|
|
48216
|
-
event.preventDefault();
|
|
48217
|
-
event.stopPropagation();
|
|
48218
48239
|
const didResize = applyTableSize(editor, snapshot, {
|
|
48219
48240
|
width: Math.round(activeLayout.viewportWidth),
|
|
48220
48241
|
height: snapshot.startHeight,
|
|
@@ -48602,6 +48623,11 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
48602
48623
|
icon: import_lucide_react57.Paintbrush,
|
|
48603
48624
|
onClick: openCellInspector
|
|
48604
48625
|
}] : [],
|
|
48626
|
+
{
|
|
48627
|
+
label: t("tableMenu.fitToEditorWidth"),
|
|
48628
|
+
icon: import_lucide_react57.Minimize2,
|
|
48629
|
+
onClick: fitTableToEditorWidth
|
|
48630
|
+
},
|
|
48605
48631
|
{
|
|
48606
48632
|
label: t("tableMenu.alignLeft"),
|
|
48607
48633
|
icon: import_lucide_react57.AlignLeft,
|
|
@@ -48666,7 +48692,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
48666
48692
|
destructive: true
|
|
48667
48693
|
}
|
|
48668
48694
|
];
|
|
48669
|
-
}, [editor, layout, openCellInspector, runAtActiveCell, showCellInspector, t]);
|
|
48695
|
+
}, [editor, fitTableToEditorWidth, layout, openCellInspector, runAtActiveCell, showCellInspector, t]);
|
|
48670
48696
|
const getRowHandleMenuItems = import_react78.default.useCallback((rowHandle) => [
|
|
48671
48697
|
{
|
|
48672
48698
|
label: t("tableMenu.addRowBefore"),
|
|
@@ -49368,12 +49394,12 @@ function getFormulaEditingTableContext(view) {
|
|
|
49368
49394
|
if (!getCellText2(node).startsWith("=")) return null;
|
|
49369
49395
|
const cellPos = $from.before(depth);
|
|
49370
49396
|
const cellDom = view.nodeDOM(cellPos);
|
|
49371
|
-
if (!(cellDom
|
|
49397
|
+
if (!isCrossRealmTableCell(cellDom) || !view.dom.contains(cellDom)) return null;
|
|
49372
49398
|
const tableDepth = depth - 2;
|
|
49373
49399
|
const tableNode = tableDepth > 0 ? $from.node(tableDepth) : null;
|
|
49374
49400
|
if (!tableNode || tableNode.type.name !== "table") return null;
|
|
49375
49401
|
const tableDom = cellDom.closest("table");
|
|
49376
|
-
if (!(tableDom
|
|
49402
|
+
if (!isCrossRealmTable(tableDom) || !view.dom.contains(tableDom)) return null;
|
|
49377
49403
|
const tableMap = import_tables9.TableMap.get(tableNode);
|
|
49378
49404
|
const tableStart = $from.start(tableDepth);
|
|
49379
49405
|
const formulaCellRect = tableMap.findCell(cellPos - tableStart);
|
|
@@ -49445,6 +49471,7 @@ function getReferenceInsertionPrefix(view, cellContentStart, insertionPos) {
|
|
|
49445
49471
|
return isInsideFunctionArguments && followsReference ? "," : "";
|
|
49446
49472
|
}
|
|
49447
49473
|
function findTableForPos(view, pos) {
|
|
49474
|
+
if (!isValidProseMirrorPosition(view.state.doc, pos)) return null;
|
|
49448
49475
|
const $pos = view.state.doc.resolve(pos);
|
|
49449
49476
|
for (let depth = $pos.depth; depth > 0; depth -= 1) {
|
|
49450
49477
|
const node = $pos.node(depth);
|
|
@@ -49473,8 +49500,9 @@ function getCellRelativePosFromDomPos2(map, tableStart, domPos) {
|
|
|
49473
49500
|
function getFormulaTableCellInfo(view, target, tablePos) {
|
|
49474
49501
|
const element = resolveEventElement(target);
|
|
49475
49502
|
const cell = element?.closest?.("th,td");
|
|
49476
|
-
if (!(cell
|
|
49503
|
+
if (!isCrossRealmTableCell(cell) || !view.dom.contains(cell)) return null;
|
|
49477
49504
|
const domPos = view.posAtDOM(cell, 0);
|
|
49505
|
+
if (!isValidProseMirrorPosition(view.state.doc, domPos)) return null;
|
|
49478
49506
|
const tableInfo = findTableForPos(view, domPos);
|
|
49479
49507
|
if (!tableInfo || tableInfo.pos !== tablePos) return null;
|
|
49480
49508
|
const map = import_tables9.TableMap.get(tableInfo.node);
|
|
@@ -50172,6 +50200,7 @@ var UEditor = import_react86.default.forwardRef(({
|
|
|
50172
50200
|
autofocus = false,
|
|
50173
50201
|
showToolbar = true,
|
|
50174
50202
|
showBubbleMenu = true,
|
|
50203
|
+
bubbleMenuPlacement = "auto",
|
|
50175
50204
|
showFloatingMenu = false,
|
|
50176
50205
|
showCharacterCount = true,
|
|
50177
50206
|
showFooter = true,
|
|
@@ -50531,6 +50560,7 @@ var UEditor = import_react86.default.forwardRef(({
|
|
|
50531
50560
|
CustomBubbleMenu,
|
|
50532
50561
|
{
|
|
50533
50562
|
editor,
|
|
50563
|
+
placement: bubbleMenuPlacement,
|
|
50534
50564
|
fontSizes,
|
|
50535
50565
|
lineHeights
|
|
50536
50566
|
}
|