@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,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
Modal_default
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UHUKUI5S.js";
|
|
5
5
|
import {
|
|
6
6
|
DEFAULT_TABLE_ROW_HEIGHT,
|
|
7
7
|
DEFAULT_UEDITOR_IMAGE_MAX_FILE_SIZE,
|
|
@@ -29,13 +29,13 @@ import {
|
|
|
29
29
|
trackEditorInsertionPosition,
|
|
30
30
|
useDropdownMenuClose,
|
|
31
31
|
useSharedEditorUiRenderState
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-OTPC2OTQ.js";
|
|
33
33
|
import {
|
|
34
34
|
cn,
|
|
35
35
|
resolveUEditorPortalContainer,
|
|
36
36
|
useSmartTranslations,
|
|
37
37
|
useUEditorPortalContainerGetter
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-6FAHXNDQ.js";
|
|
39
39
|
import "./chunk-NSBPE2FW.js";
|
|
40
40
|
|
|
41
41
|
// src/components/UEditor/menu-bar.tsx
|
|
@@ -1118,4 +1118,4 @@ var MenuBar = ({
|
|
|
1118
1118
|
export {
|
|
1119
1119
|
MenuBar
|
|
1120
1120
|
};
|
|
1121
|
-
//# sourceMappingURL=menu-bar-
|
|
1121
|
+
//# sourceMappingURL=menu-bar-HZBBRX42.js.map
|
package/dist/ueditor.cjs
CHANGED
|
@@ -343,6 +343,7 @@ var init_en = __esm({
|
|
|
343
343
|
dragColumn: "Drag Column",
|
|
344
344
|
resizeBoth: "Resize Table",
|
|
345
345
|
resizeCtrlHint: "Drag freely. Hold Ctrl to lock to one axis; hold Ctrl+Shift to preserve proportions",
|
|
346
|
+
fitToEditorWidth: "Fit to Editor Width",
|
|
346
347
|
alignLeft: "Align Table Left",
|
|
347
348
|
alignCenter: "Align Table Center",
|
|
348
349
|
alignRight: "Align Table Right",
|
|
@@ -809,6 +810,7 @@ var init_vi = __esm({
|
|
|
809
810
|
dragColumn: "K\xE9o c\u1ED9t",
|
|
810
811
|
resizeBoth: "\u0110\u1ED5i k\xEDch th\u01B0\u1EDBc b\u1EA3ng",
|
|
811
812
|
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",
|
|
813
|
+
fitToEditorWidth: "V\u1EEBa chi\u1EC1u r\u1ED9ng tr\xECnh so\u1EA1n th\u1EA3o",
|
|
812
814
|
alignLeft: "C\u0103n b\u1EA3ng tr\xE1i",
|
|
813
815
|
alignCenter: "C\u0103n b\u1EA3ng gi\u1EEFa",
|
|
814
816
|
alignRight: "C\u0103n b\u1EA3ng ph\u1EA3i",
|
|
@@ -1275,6 +1277,7 @@ var init_ko = __esm({
|
|
|
1275
1277
|
dragColumn: "\uC5F4 \uB4DC\uB798\uADF8",
|
|
1276
1278
|
resizeBoth: "\uD45C \uD06C\uAE30 \uC870\uC808",
|
|
1277
1279
|
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",
|
|
1280
|
+
fitToEditorWidth: "\uD3B8\uC9D1\uAE30 \uB108\uBE44\uC5D0 \uB9DE\uCD94\uAE30",
|
|
1278
1281
|
alignLeft: "\uD45C \uC67C\uCABD \uC815\uB82C",
|
|
1279
1282
|
alignCenter: "\uD45C \uAC00\uC6B4\uB370 \uC815\uB82C",
|
|
1280
1283
|
alignRight: "\uD45C \uC624\uB978\uCABD \uC815\uB82C",
|
|
@@ -1741,6 +1744,7 @@ var init_ja = __esm({
|
|
|
1741
1744
|
dragColumn: "\u5217\u3092\u30C9\u30E9\u30C3\u30B0",
|
|
1742
1745
|
resizeBoth: "\u8868\u306E\u30B5\u30A4\u30BA\u3092\u5909\u66F4",
|
|
1743
1746
|
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",
|
|
1747
|
+
fitToEditorWidth: "\u30A8\u30C7\u30A3\u30BF\u30FC\u306E\u5E45\u306B\u5408\u308F\u305B\u308B",
|
|
1744
1748
|
alignLeft: "\u8868\u3092\u5DE6\u5BC4\u305B",
|
|
1745
1749
|
alignCenter: "\u8868\u3092\u4E2D\u592E\u63C3\u3048",
|
|
1746
1750
|
alignRight: "\u8868\u3092\u53F3\u5BC4\u305B",
|
|
@@ -5524,10 +5528,15 @@ function isCrossRealmTableRow(value) {
|
|
|
5524
5528
|
function isCrossRealmTableCell(value) {
|
|
5525
5529
|
return isCrossRealmElement(value) && ["TD", "TH"].includes(String(value.tagName).toUpperCase()) && "cellIndex" in value;
|
|
5526
5530
|
}
|
|
5531
|
+
function isValidProseMirrorPosition(doc, pos) {
|
|
5532
|
+
return Number.isInteger(pos) && pos >= 0 && pos <= doc.content.size;
|
|
5533
|
+
}
|
|
5527
5534
|
function findTableRowNodeInfo(view, rowElement) {
|
|
5535
|
+
if (!view.dom.contains(rowElement)) return null;
|
|
5528
5536
|
const firstCell = rowElement.querySelector("th,td");
|
|
5529
|
-
if (!firstCell) return null;
|
|
5537
|
+
if (!isCrossRealmTableCell(firstCell) || !view.dom.contains(firstCell)) return null;
|
|
5530
5538
|
const cellPos = view.posAtDOM(firstCell, 0);
|
|
5539
|
+
if (!isValidProseMirrorPosition(view.state.doc, cellPos)) return null;
|
|
5531
5540
|
const $pos = view.state.doc.resolve(cellPos);
|
|
5532
5541
|
for (let depth = $pos.depth; depth > 0; depth -= 1) {
|
|
5533
5542
|
const node = $pos.node(depth);
|
|
@@ -5569,14 +5578,14 @@ function getSelectionTableCell(view) {
|
|
|
5569
5578
|
const browserSelection = realm?.getSelection();
|
|
5570
5579
|
const anchorElement = resolveEventElement(browserSelection?.anchorNode ?? null);
|
|
5571
5580
|
const anchorCell = anchorElement?.closest?.("th,td");
|
|
5572
|
-
if (
|
|
5581
|
+
if (isCrossRealmTableCell(anchorCell) && view.dom.contains(anchorCell)) {
|
|
5573
5582
|
return anchorCell;
|
|
5574
5583
|
}
|
|
5575
5584
|
const { from } = view.state.selection;
|
|
5576
5585
|
const domAtPos = view.domAtPos(from);
|
|
5577
5586
|
const element = resolveEventElement(domAtPos.node);
|
|
5578
5587
|
const cell = element?.closest?.("th,td");
|
|
5579
|
-
return
|
|
5588
|
+
return isCrossRealmTableCell(cell) && view.dom.contains(cell) ? cell : null;
|
|
5580
5589
|
}
|
|
5581
5590
|
function resolveRowResizeTarget(cell, clientX, clientY) {
|
|
5582
5591
|
const rect = cell.getBoundingClientRect();
|
|
@@ -7963,18 +7972,22 @@ function getTableAnchorPos(editor) {
|
|
|
7963
7972
|
const editorWindow = editorDocument.defaultView;
|
|
7964
7973
|
const selectionAnchor = resolveEventElement(editorWindow?.getSelection()?.anchorNode ?? null);
|
|
7965
7974
|
const selectionCell2 = selectionAnchor?.closest?.("th,td");
|
|
7966
|
-
if (
|
|
7967
|
-
|
|
7975
|
+
if (isCrossRealmTableCell(selectionCell2) && editor.view.dom.contains(selectionCell2)) {
|
|
7976
|
+
const cellPos2 = editor.view.posAtDOM(selectionCell2, 0);
|
|
7977
|
+
return isValidProseMirrorPosition(editor.state.doc, cellPos2) && isValidProseMirrorPosition(editor.state.doc, cellPos2 + 1) ? cellPos2 + 1 : null;
|
|
7968
7978
|
}
|
|
7969
7979
|
const activeElement = editorWindow && editorDocument.activeElement instanceof editorWindow.Element ? editorDocument.activeElement : null;
|
|
7970
7980
|
const activeCell = activeElement?.closest?.("th,td");
|
|
7971
|
-
if (
|
|
7972
|
-
|
|
7981
|
+
if (isCrossRealmTableCell(activeCell) && editor.view.dom.contains(activeCell)) {
|
|
7982
|
+
const cellPos2 = editor.view.posAtDOM(activeCell, 0);
|
|
7983
|
+
return isValidProseMirrorPosition(editor.state.doc, cellPos2) && isValidProseMirrorPosition(editor.state.doc, cellPos2 + 1) ? cellPos2 + 1 : null;
|
|
7973
7984
|
}
|
|
7974
7985
|
const tables = editor.view.dom.querySelectorAll("table");
|
|
7975
7986
|
if (tables.length !== 1) return null;
|
|
7976
7987
|
const firstCell = tables[0]?.querySelector("th,td");
|
|
7977
|
-
|
|
7988
|
+
if (!isCrossRealmTableCell(firstCell) || !editor.view.dom.contains(firstCell)) return null;
|
|
7989
|
+
const cellPos = editor.view.posAtDOM(firstCell, 0);
|
|
7990
|
+
return isValidProseMirrorPosition(editor.state.doc, cellPos) && isValidProseMirrorPosition(editor.state.doc, cellPos + 1) ? cellPos + 1 : null;
|
|
7978
7991
|
}
|
|
7979
7992
|
function computeEditorUiRenderState(editor) {
|
|
7980
7993
|
const textStyle = editor.getAttributes("textStyle");
|
|
@@ -16297,6 +16310,7 @@ function getBubbleMenuPosition({
|
|
|
16297
16310
|
end,
|
|
16298
16311
|
menuSize,
|
|
16299
16312
|
viewport,
|
|
16313
|
+
preferredPlacement = "auto",
|
|
16300
16314
|
offset = 16,
|
|
16301
16315
|
padding = 8
|
|
16302
16316
|
}) {
|
|
@@ -16304,7 +16318,7 @@ function getBubbleMenuPosition({
|
|
|
16304
16318
|
const selectionBottom = Math.max(start.bottom, end.bottom);
|
|
16305
16319
|
const spaceAbove = selectionTop - offset - padding;
|
|
16306
16320
|
const spaceBelow = viewport.height - padding - selectionBottom - offset;
|
|
16307
|
-
const placement = menuSize.height <= spaceAbove || spaceAbove >= spaceBelow ? "top" : "bottom";
|
|
16321
|
+
const placement = preferredPlacement === "auto" ? menuSize.height <= spaceAbove || spaceAbove >= spaceBelow ? "top" : "bottom" : preferredPlacement;
|
|
16308
16322
|
const halfWidth = menuSize.width / 2;
|
|
16309
16323
|
const minLeft = padding + halfWidth;
|
|
16310
16324
|
const maxLeft = viewport.width - padding - halfWidth;
|
|
@@ -17208,6 +17222,7 @@ var LinkPreviewContent = ({ editor, onEdit }) => {
|
|
|
17208
17222
|
};
|
|
17209
17223
|
var CustomBubbleMenu = ({
|
|
17210
17224
|
editor,
|
|
17225
|
+
placement = "auto",
|
|
17211
17226
|
fontSizes,
|
|
17212
17227
|
lineHeights
|
|
17213
17228
|
}) => {
|
|
@@ -17301,6 +17316,7 @@ var CustomBubbleMenu = ({
|
|
|
17301
17316
|
width: editorWindow?.innerWidth ?? window.innerWidth,
|
|
17302
17317
|
height: editorWindow?.innerHeight ?? window.innerHeight
|
|
17303
17318
|
},
|
|
17319
|
+
preferredPlacement: placement,
|
|
17304
17320
|
offset: BUBBLE_MENU_OFFSET
|
|
17305
17321
|
}));
|
|
17306
17322
|
if (keepOpenRef.current) {
|
|
@@ -17347,7 +17363,7 @@ var CustomBubbleMenu = ({
|
|
|
17347
17363
|
editorWindow?.removeEventListener("resize", schedulePositionUpdate);
|
|
17348
17364
|
editorWindow?.removeEventListener("scroll", schedulePositionUpdate, true);
|
|
17349
17365
|
};
|
|
17350
|
-
}, [editor, editorDocument, editorWindow]);
|
|
17366
|
+
}, [editor, editorDocument, editorWindow, placement]);
|
|
17351
17367
|
(0, import_react36.useEffect)(() => {
|
|
17352
17368
|
if (!isVisible || !portalWindow?.ResizeObserver) return;
|
|
17353
17369
|
const menu = menuRef.current;
|
|
@@ -17401,6 +17417,7 @@ var CustomBubbleMenu = ({
|
|
|
17401
17417
|
{
|
|
17402
17418
|
ref: menuRef,
|
|
17403
17419
|
"data-popover": true,
|
|
17420
|
+
"data-placement": position.placement,
|
|
17404
17421
|
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",
|
|
17405
17422
|
style: {
|
|
17406
17423
|
top: `${position.top}px`,
|
|
@@ -22216,6 +22233,7 @@ function getCellFromTarget(target) {
|
|
|
22216
22233
|
return null;
|
|
22217
22234
|
}
|
|
22218
22235
|
function findTableInfo(editor, pos) {
|
|
22236
|
+
if (!isValidProseMirrorPosition(editor.state.doc, pos)) return null;
|
|
22219
22237
|
const $pos = editor.state.doc.resolve(pos);
|
|
22220
22238
|
for (let depth = $pos.depth; depth > 0; depth -= 1) {
|
|
22221
22239
|
const node = $pos.node(depth);
|
|
@@ -22258,6 +22276,7 @@ function buildLogicalColumnMetrics({
|
|
|
22258
22276
|
for (const tableCell of Array.from(firstRow.cells)) {
|
|
22259
22277
|
if (!isTableCellElement(tableCell)) continue;
|
|
22260
22278
|
const cellPos = editor.view.posAtDOM(tableCell, 0);
|
|
22279
|
+
if (!isValidProseMirrorPosition(editor.state.doc, cellPos)) continue;
|
|
22261
22280
|
const relativeCellPos = getCellRelativePosFromDomPos(map, tableInfo.start, cellPos);
|
|
22262
22281
|
if (relativeCellPos == null) continue;
|
|
22263
22282
|
const cellMapRect = map.findCell(relativeCellPos);
|
|
@@ -22331,18 +22350,20 @@ function buildLogicalRowMetrics({
|
|
|
22331
22350
|
if (visualRows.length > 0) {
|
|
22332
22351
|
return visualRows.sort((a, b) => a.index - b.index);
|
|
22333
22352
|
}
|
|
22334
|
-
return rows.
|
|
22353
|
+
return rows.flatMap((tableRow, index) => {
|
|
22335
22354
|
const rowRect = tableRow.getBoundingClientRect();
|
|
22336
22355
|
const anchorCell = tableRow.cells.item(0) ?? cornerCell;
|
|
22337
22356
|
const start = rowRect.height > 0 ? rowRect.top - surfaceRect.top - surface.clientTop + surface.scrollTop : tableTop + index * fallbackHeight;
|
|
22338
22357
|
const size = metricOrFallback(rowRect.height, fallbackHeight);
|
|
22339
|
-
|
|
22358
|
+
const cellPos = editor.view.posAtDOM(anchorCell, 0);
|
|
22359
|
+
if (!isValidProseMirrorPosition(editor.state.doc, cellPos)) return [];
|
|
22360
|
+
return [{
|
|
22340
22361
|
index,
|
|
22341
|
-
cellPos
|
|
22362
|
+
cellPos,
|
|
22342
22363
|
start,
|
|
22343
22364
|
size,
|
|
22344
22365
|
center: start + size / 2
|
|
22345
|
-
};
|
|
22366
|
+
}];
|
|
22346
22367
|
});
|
|
22347
22368
|
}
|
|
22348
22369
|
function getTableCellTextSelectionRange(editor, cellPos) {
|
|
@@ -22362,6 +22383,7 @@ function getTableCellTextSelectionRange(editor, cellPos) {
|
|
|
22362
22383
|
return from !== null && to !== null && from < to ? { from, to } : null;
|
|
22363
22384
|
}
|
|
22364
22385
|
function buildTableControlLayout(editor, surface, cell) {
|
|
22386
|
+
if (!editor.view.dom.contains(cell)) return null;
|
|
22365
22387
|
const row = cell.closest("tr");
|
|
22366
22388
|
const table = cell.closest("table");
|
|
22367
22389
|
if (!isTableRowElement(row) || !isTableElement(table)) {
|
|
@@ -22370,6 +22392,7 @@ function buildTableControlLayout(editor, surface, cell) {
|
|
|
22370
22392
|
const rows = Array.from(table.rows).filter(isTableRowElement);
|
|
22371
22393
|
const cornerCell = getLastCell(table);
|
|
22372
22394
|
const cellPos = editor.view.posAtDOM(cell, 0);
|
|
22395
|
+
if (!isValidProseMirrorPosition(editor.state.doc, cellPos)) return null;
|
|
22373
22396
|
const tableInfo = findTableInfo(editor, cellPos);
|
|
22374
22397
|
if (rows.length === 0 || !tableInfo || !isTableCellElement(cornerCell)) {
|
|
22375
22398
|
return null;
|
|
@@ -23327,7 +23350,7 @@ function getSelectedCell(editor) {
|
|
|
23327
23350
|
const browserSelection = editorWindow?.getSelection();
|
|
23328
23351
|
const anchorElement = resolveEventElement(browserSelection?.anchorNode ?? null);
|
|
23329
23352
|
const anchorCell = anchorElement?.closest?.("th,td");
|
|
23330
|
-
if (isCrossRealmTableCell(anchorCell)) {
|
|
23353
|
+
if (isCrossRealmTableCell(anchorCell) && editor.view.dom.contains(anchorCell)) {
|
|
23331
23354
|
return anchorCell;
|
|
23332
23355
|
}
|
|
23333
23356
|
const domAtPos = editor.view.domAtPos(editor.state.selection.from);
|
|
@@ -23637,8 +23660,8 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
23637
23660
|
updateTableResizePreview(pendingDimensions);
|
|
23638
23661
|
setDocumentCursor(editorDocument, edge === "both" ? "nwse-resize" : "ew-resize");
|
|
23639
23662
|
}, [editor, editorDocument, updateTableResizePreview]);
|
|
23640
|
-
const fitTableToEditorWidth = import_react38.default.useCallback((
|
|
23641
|
-
if (
|
|
23663
|
+
const fitTableToEditorWidth = import_react38.default.useCallback(() => {
|
|
23664
|
+
if (dragStateRef.current) return;
|
|
23642
23665
|
const activeLayout = layoutRef.current;
|
|
23643
23666
|
if (!activeLayout) return;
|
|
23644
23667
|
const snapshot = createTableSizeSnapshot(
|
|
@@ -23649,8 +23672,6 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
23649
23672
|
activeLayout.viewportWidth
|
|
23650
23673
|
);
|
|
23651
23674
|
if (!snapshot) return;
|
|
23652
|
-
event.preventDefault();
|
|
23653
|
-
event.stopPropagation();
|
|
23654
23675
|
const didResize = applyTableSize(editor, snapshot, {
|
|
23655
23676
|
width: Math.round(activeLayout.viewportWidth),
|
|
23656
23677
|
height: snapshot.startHeight,
|
|
@@ -24038,6 +24059,11 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
24038
24059
|
icon: import_lucide_react18.Paintbrush,
|
|
24039
24060
|
onClick: openCellInspector
|
|
24040
24061
|
}] : [],
|
|
24062
|
+
{
|
|
24063
|
+
label: t("tableMenu.fitToEditorWidth"),
|
|
24064
|
+
icon: import_lucide_react18.Minimize2,
|
|
24065
|
+
onClick: fitTableToEditorWidth
|
|
24066
|
+
},
|
|
24041
24067
|
{
|
|
24042
24068
|
label: t("tableMenu.alignLeft"),
|
|
24043
24069
|
icon: import_lucide_react18.AlignLeft,
|
|
@@ -24102,7 +24128,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
24102
24128
|
destructive: true
|
|
24103
24129
|
}
|
|
24104
24130
|
];
|
|
24105
|
-
}, [editor, layout, openCellInspector, runAtActiveCell, showCellInspector, t]);
|
|
24131
|
+
}, [editor, fitTableToEditorWidth, layout, openCellInspector, runAtActiveCell, showCellInspector, t]);
|
|
24106
24132
|
const getRowHandleMenuItems = import_react38.default.useCallback((rowHandle) => [
|
|
24107
24133
|
{
|
|
24108
24134
|
label: t("tableMenu.addRowBefore"),
|
|
@@ -24804,12 +24830,12 @@ function getFormulaEditingTableContext(view) {
|
|
|
24804
24830
|
if (!getCellText2(node).startsWith("=")) return null;
|
|
24805
24831
|
const cellPos = $from.before(depth);
|
|
24806
24832
|
const cellDom = view.nodeDOM(cellPos);
|
|
24807
|
-
if (!(cellDom
|
|
24833
|
+
if (!isCrossRealmTableCell(cellDom) || !view.dom.contains(cellDom)) return null;
|
|
24808
24834
|
const tableDepth = depth - 2;
|
|
24809
24835
|
const tableNode = tableDepth > 0 ? $from.node(tableDepth) : null;
|
|
24810
24836
|
if (!tableNode || tableNode.type.name !== "table") return null;
|
|
24811
24837
|
const tableDom = cellDom.closest("table");
|
|
24812
|
-
if (!(tableDom
|
|
24838
|
+
if (!isCrossRealmTable(tableDom) || !view.dom.contains(tableDom)) return null;
|
|
24813
24839
|
const tableMap = import_tables9.TableMap.get(tableNode);
|
|
24814
24840
|
const tableStart = $from.start(tableDepth);
|
|
24815
24841
|
const formulaCellRect = tableMap.findCell(cellPos - tableStart);
|
|
@@ -24881,6 +24907,7 @@ function getReferenceInsertionPrefix(view, cellContentStart, insertionPos) {
|
|
|
24881
24907
|
return isInsideFunctionArguments && followsReference ? "," : "";
|
|
24882
24908
|
}
|
|
24883
24909
|
function findTableForPos(view, pos) {
|
|
24910
|
+
if (!isValidProseMirrorPosition(view.state.doc, pos)) return null;
|
|
24884
24911
|
const $pos = view.state.doc.resolve(pos);
|
|
24885
24912
|
for (let depth = $pos.depth; depth > 0; depth -= 1) {
|
|
24886
24913
|
const node = $pos.node(depth);
|
|
@@ -24909,8 +24936,9 @@ function getCellRelativePosFromDomPos2(map, tableStart, domPos) {
|
|
|
24909
24936
|
function getFormulaTableCellInfo(view, target, tablePos) {
|
|
24910
24937
|
const element = resolveEventElement(target);
|
|
24911
24938
|
const cell = element?.closest?.("th,td");
|
|
24912
|
-
if (!(cell
|
|
24939
|
+
if (!isCrossRealmTableCell(cell) || !view.dom.contains(cell)) return null;
|
|
24913
24940
|
const domPos = view.posAtDOM(cell, 0);
|
|
24941
|
+
if (!isValidProseMirrorPosition(view.state.doc, domPos)) return null;
|
|
24914
24942
|
const tableInfo = findTableForPos(view, domPos);
|
|
24915
24943
|
if (!tableInfo || tableInfo.pos !== tablePos) return null;
|
|
24916
24944
|
const map = import_tables9.TableMap.get(tableInfo.node);
|
|
@@ -25608,6 +25636,7 @@ var UEditor = import_react46.default.forwardRef(({
|
|
|
25608
25636
|
autofocus = false,
|
|
25609
25637
|
showToolbar = true,
|
|
25610
25638
|
showBubbleMenu = true,
|
|
25639
|
+
bubbleMenuPlacement = "auto",
|
|
25611
25640
|
showFloatingMenu = false,
|
|
25612
25641
|
showCharacterCount = true,
|
|
25613
25642
|
showFooter = true,
|
|
@@ -25967,6 +25996,7 @@ var UEditor = import_react46.default.forwardRef(({
|
|
|
25967
25996
|
CustomBubbleMenu,
|
|
25968
25997
|
{
|
|
25969
25998
|
editor,
|
|
25999
|
+
placement: bubbleMenuPlacement,
|
|
25970
26000
|
fontSizes,
|
|
25971
26001
|
lineHeights
|
|
25972
26002
|
}
|