@underverse-ui/underverse 2.0.12 → 2.0.13
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-EVS5YWTO.js → chunk-MMMCBJ2L.js} +148 -77
- package/dist/{chunk-EVS5YWTO.js.map → chunk-MMMCBJ2L.js.map} +1 -1
- package/dist/{chunk-Q6BQUWKB.js → chunk-R7ZKNCWR.js} +2 -2
- package/dist/{chunk-P2RLTURA.js → chunk-WDY3QWOW.js} +192 -52
- package/dist/chunk-WDY3QWOW.js.map +1 -0
- package/dist/index.cjs +329 -121
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/{menu-bar-JSXW6AXW.js → menu-bar-SVX36W4S.js} +3 -3
- package/dist/ueditor.cjs +329 -121
- package/dist/ueditor.cjs.map +1 -1
- package/dist/ueditor.d.cts +3 -0
- package/dist/ueditor.d.ts +3 -0
- package/dist/ueditor.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-P2RLTURA.js.map +0 -1
- /package/dist/{chunk-Q6BQUWKB.js.map → chunk-R7ZKNCWR.js.map} +0 -0
- /package/dist/{menu-bar-JSXW6AXW.js.map → menu-bar-SVX36W4S.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getPanelBorderRadiusClass,
|
|
3
3
|
useUnderverseUIConfig
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MMMCBJ2L.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-R7ZKNCWR.js.map
|
|
@@ -41,19 +41,21 @@ import {
|
|
|
41
41
|
getRelativeCellMetrics,
|
|
42
42
|
getRelativeSelectedCellsMetrics,
|
|
43
43
|
getSelectionTableCell,
|
|
44
|
-
isColumnResizeHotspot,
|
|
45
44
|
isPointOverRenderedText,
|
|
46
45
|
isRowResizeHotspot,
|
|
46
|
+
isRowResizingGlobal,
|
|
47
47
|
isSafeUEditorUrl,
|
|
48
48
|
mergeTableCellsPreservingColumnWidths,
|
|
49
49
|
normalizeStyleValue,
|
|
50
50
|
resetImageSize,
|
|
51
|
+
resolveColumnResizeTarget,
|
|
51
52
|
resolveEventElement,
|
|
53
|
+
resolveRowResizeTarget,
|
|
52
54
|
runTableCommandAtCellPos,
|
|
53
55
|
sanitizeUEditorUrl,
|
|
54
56
|
useEditorColors,
|
|
55
57
|
useSharedEditorUiRenderState
|
|
56
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-MMMCBJ2L.js";
|
|
57
59
|
import {
|
|
58
60
|
Tooltip,
|
|
59
61
|
cn,
|
|
@@ -3315,7 +3317,7 @@ var indent_default = Indent;
|
|
|
3315
3317
|
// src/components/UEditor/table-align.ts
|
|
3316
3318
|
import { mergeAttributes as mergeAttributes7 } from "@tiptap/core";
|
|
3317
3319
|
import { Table as Table2 } from "@tiptap/extension-table";
|
|
3318
|
-
import { Plugin as Plugin4 } from "@tiptap/pm/state";
|
|
3320
|
+
import { Plugin as Plugin4, PluginKey as PluginKey5 } from "@tiptap/pm/state";
|
|
3319
3321
|
import { tableEditing } from "@tiptap/pm/tables";
|
|
3320
3322
|
|
|
3321
3323
|
// src/components/UEditor/table-column-resize.ts
|
|
@@ -3455,6 +3457,15 @@ function edgeCell(view, event, side, handleWidth) {
|
|
|
3455
3457
|
const index = map.map.indexOf($cell.pos - start);
|
|
3456
3458
|
return index % map.width === 0 ? -1 : start + map.map[index - 1];
|
|
3457
3459
|
}
|
|
3460
|
+
var handleHoverTimer = null;
|
|
3461
|
+
var pendingHandleCell = -1;
|
|
3462
|
+
function clearHandleHoverTimer() {
|
|
3463
|
+
if (handleHoverTimer !== null) {
|
|
3464
|
+
window.clearTimeout(handleHoverTimer);
|
|
3465
|
+
handleHoverTimer = null;
|
|
3466
|
+
}
|
|
3467
|
+
pendingHandleCell = -1;
|
|
3468
|
+
}
|
|
3458
3469
|
function updateHandle(view, value) {
|
|
3459
3470
|
view.dispatch(view.state.tr.setMeta(columnResizingPluginKey, { setHandle: value }));
|
|
3460
3471
|
}
|
|
@@ -3469,19 +3480,43 @@ function handleMouseMove(view, event, handleWidth, lastColumnResizable) {
|
|
|
3469
3480
|
if (event.clientX - left <= handleWidth) cell = edgeCell(view, event, "left", handleWidth);
|
|
3470
3481
|
else if (right - event.clientX <= handleWidth) cell = edgeCell(view, event, "right", handleWidth);
|
|
3471
3482
|
}
|
|
3472
|
-
if (cell === pluginState.activeHandle)
|
|
3473
|
-
|
|
3483
|
+
if (cell === pluginState.activeHandle) {
|
|
3484
|
+
clearHandleHoverTimer();
|
|
3485
|
+
return;
|
|
3486
|
+
}
|
|
3487
|
+
if (cell === -1) {
|
|
3488
|
+
clearHandleHoverTimer();
|
|
3489
|
+
if (pluginState.activeHandle !== -1) {
|
|
3490
|
+
updateHandle(view, -1);
|
|
3491
|
+
}
|
|
3492
|
+
return;
|
|
3493
|
+
}
|
|
3494
|
+
if (!lastColumnResizable) {
|
|
3474
3495
|
const $cell = view.state.doc.resolve(cell);
|
|
3475
3496
|
const table = $cell.node(-1);
|
|
3476
3497
|
const map = TableMap.get(table);
|
|
3477
3498
|
const tableStart = $cell.start(-1);
|
|
3478
3499
|
const nodeAfter = $cell.nodeAfter;
|
|
3479
3500
|
if (!nodeAfter) return;
|
|
3480
|
-
if (map.colCount($cell.pos - tableStart) + nodeAfter.attrs.colspan - 1 === map.width - 1)
|
|
3501
|
+
if (map.colCount($cell.pos - tableStart) + nodeAfter.attrs.colspan - 1 === map.width - 1) {
|
|
3502
|
+
clearHandleHoverTimer();
|
|
3503
|
+
if (pluginState.activeHandle !== -1) {
|
|
3504
|
+
updateHandle(view, -1);
|
|
3505
|
+
}
|
|
3506
|
+
return;
|
|
3507
|
+
}
|
|
3481
3508
|
}
|
|
3482
|
-
|
|
3509
|
+
if (pendingHandleCell === cell) return;
|
|
3510
|
+
clearHandleHoverTimer();
|
|
3511
|
+
pendingHandleCell = cell;
|
|
3512
|
+
handleHoverTimer = window.setTimeout(() => {
|
|
3513
|
+
handleHoverTimer = null;
|
|
3514
|
+
pendingHandleCell = -1;
|
|
3515
|
+
updateHandle(view, cell);
|
|
3516
|
+
}, 100);
|
|
3483
3517
|
}
|
|
3484
3518
|
function handleMouseLeave(view) {
|
|
3519
|
+
clearHandleHoverTimer();
|
|
3485
3520
|
if (!view.editable) return;
|
|
3486
3521
|
const pluginState = columnResizingPluginKey.getState(view.state);
|
|
3487
3522
|
if (pluginState && pluginState.activeHandle > -1 && !pluginState.dragging) {
|
|
@@ -3530,7 +3565,7 @@ function getColumnResizeGhost(view) {
|
|
|
3530
3565
|
ghost.style.pointerEvents = "none";
|
|
3531
3566
|
ghost.style.width = "2px";
|
|
3532
3567
|
ghost.style.backgroundColor = "var(--primary, #2563eb)";
|
|
3533
|
-
ghost.style.opacity = "
|
|
3568
|
+
ghost.style.opacity = "0.5";
|
|
3534
3569
|
ghost.style.borderRadius = "9999px";
|
|
3535
3570
|
ghost.style.boxShadow = "0 0 0 1px color-mix(in oklch, var(--background, #fff) 80%, transparent)";
|
|
3536
3571
|
ghost.style.transform = "translateX(-1px)";
|
|
@@ -3559,6 +3594,7 @@ function showColumnResizeGhost(view, cell, dragging, width) {
|
|
|
3559
3594
|
ghost.style.height = `${rect.height}px`;
|
|
3560
3595
|
}
|
|
3561
3596
|
function handleMouseDown(view, event, cellMinWidth) {
|
|
3597
|
+
clearHandleHoverTimer();
|
|
3562
3598
|
if (!view.editable) return false;
|
|
3563
3599
|
const win = view.dom.ownerDocument.defaultView ?? window;
|
|
3564
3600
|
const pluginState = columnResizingPluginKey.getState(view.state);
|
|
@@ -3805,6 +3841,38 @@ var UEditorTable = Table2.extend({
|
|
|
3805
3841
|
lastColumnResizable: this.options.lastColumnResizable
|
|
3806
3842
|
})
|
|
3807
3843
|
] : [],
|
|
3844
|
+
new Plugin4({
|
|
3845
|
+
key: new PluginKey5("tableRowResizeInterceptor"),
|
|
3846
|
+
props: {
|
|
3847
|
+
handleDOMEvents: {
|
|
3848
|
+
mousedown(view, event) {
|
|
3849
|
+
if (event.button !== 0) return false;
|
|
3850
|
+
const target = resolveEventElement(event.target);
|
|
3851
|
+
const cell = target?.closest("th,td");
|
|
3852
|
+
if (cell instanceof HTMLElement && isRowResizeHotspot(cell, event.clientX, event.clientY)) {
|
|
3853
|
+
isRowResizingGlobal.active = true;
|
|
3854
|
+
return true;
|
|
3855
|
+
}
|
|
3856
|
+
return false;
|
|
3857
|
+
},
|
|
3858
|
+
mousemove(_view, event) {
|
|
3859
|
+
if (isRowResizingGlobal.active) {
|
|
3860
|
+
if (event.buttons === 0) {
|
|
3861
|
+
isRowResizingGlobal.active = false;
|
|
3862
|
+
return false;
|
|
3863
|
+
}
|
|
3864
|
+
event.preventDefault();
|
|
3865
|
+
return true;
|
|
3866
|
+
}
|
|
3867
|
+
return false;
|
|
3868
|
+
},
|
|
3869
|
+
mouseup() {
|
|
3870
|
+
isRowResizingGlobal.active = false;
|
|
3871
|
+
return false;
|
|
3872
|
+
}
|
|
3873
|
+
}
|
|
3874
|
+
}
|
|
3875
|
+
}),
|
|
3808
3876
|
tableEditing({
|
|
3809
3877
|
allowTableNodeSelection: this.options.allowTableNodeSelection
|
|
3810
3878
|
}),
|
|
@@ -3944,7 +4012,7 @@ var CodeBlockView = ({
|
|
|
3944
4012
|
|
|
3945
4013
|
// src/components/UEditor/optimized-lowlight.ts
|
|
3946
4014
|
import { findChildren } from "@tiptap/core";
|
|
3947
|
-
import { Plugin as Plugin5, PluginKey as
|
|
4015
|
+
import { Plugin as Plugin5, PluginKey as PluginKey6 } from "@tiptap/pm/state";
|
|
3948
4016
|
import { Decoration as Decoration3, DecorationSet as DecorationSet3 } from "@tiptap/pm/view";
|
|
3949
4017
|
function parseHighlightNodes(nodes, inheritedClasses = []) {
|
|
3950
4018
|
return nodes.flatMap((value) => {
|
|
@@ -4066,7 +4134,7 @@ function createOptimizedLowlightPlugin({
|
|
|
4066
4134
|
lowlight,
|
|
4067
4135
|
nodeName
|
|
4068
4136
|
}) {
|
|
4069
|
-
const pluginKey = new
|
|
4137
|
+
const pluginKey = new PluginKey6("ueditorLowlight");
|
|
4070
4138
|
const createDecorations = (doc) => buildLowlightDecorations({
|
|
4071
4139
|
defaultLanguage,
|
|
4072
4140
|
doc,
|
|
@@ -6971,7 +7039,11 @@ var CustomBubbleMenu = ({
|
|
|
6971
7039
|
setIsVisible(false);
|
|
6972
7040
|
return;
|
|
6973
7041
|
}
|
|
6974
|
-
|
|
7042
|
+
const isInputFocused = () => {
|
|
7043
|
+
const active = document.activeElement;
|
|
7044
|
+
return Boolean(active && (menuRef.current?.contains(active) || active.closest?.("[data-ueditor-keep-open]")));
|
|
7045
|
+
};
|
|
7046
|
+
if (!keepOpenRef.current && !isInputFocused() && (context2 === "none" || !view.hasFocus())) {
|
|
6975
7047
|
clearShowTimeout();
|
|
6976
7048
|
setIsVisible(false);
|
|
6977
7049
|
return;
|
|
@@ -7012,7 +7084,8 @@ var CustomBubbleMenu = ({
|
|
|
7012
7084
|
}, SHOW_DELAY_MS);
|
|
7013
7085
|
};
|
|
7014
7086
|
const handleBlur = () => {
|
|
7015
|
-
|
|
7087
|
+
const isInputFocused = Boolean(document.activeElement && (menuRef.current?.contains(document.activeElement) || document.activeElement.closest?.("[data-ueditor-keep-open]")));
|
|
7088
|
+
if (!keepOpenRef.current && !isInputFocused) {
|
|
7016
7089
|
clearShowTimeout();
|
|
7017
7090
|
setIsVisible(false);
|
|
7018
7091
|
}
|
|
@@ -7106,6 +7179,9 @@ var CustomBubbleMenu = ({
|
|
|
7106
7179
|
} else if (target?.closest?.("[data-ueditor-keep-open]")) {
|
|
7107
7180
|
setKeepOpen(true);
|
|
7108
7181
|
}
|
|
7182
|
+
if (target && target.closest("input, textarea, select")) {
|
|
7183
|
+
return;
|
|
7184
|
+
}
|
|
7109
7185
|
e.preventDefault();
|
|
7110
7186
|
},
|
|
7111
7187
|
children: context === "link" && !keepOpen && !linkInputOpen ? /* @__PURE__ */ jsx12(
|
|
@@ -10264,7 +10340,7 @@ function createKey(name) {
|
|
|
10264
10340
|
keys[name] = 0;
|
|
10265
10341
|
return name + "$";
|
|
10266
10342
|
}
|
|
10267
|
-
var
|
|
10343
|
+
var PluginKey7 = class {
|
|
10268
10344
|
/**
|
|
10269
10345
|
Create a plugin key.
|
|
10270
10346
|
*/
|
|
@@ -10696,7 +10772,7 @@ function tableNodeTypes2(schema) {
|
|
|
10696
10772
|
}
|
|
10697
10773
|
return result;
|
|
10698
10774
|
}
|
|
10699
|
-
var tableEditingKey = new
|
|
10775
|
+
var tableEditingKey = new PluginKey7("selectingCells");
|
|
10700
10776
|
function cellAround2($pos) {
|
|
10701
10777
|
for (let d = $pos.depth - 1; d > 0; d--) if ($pos.node(d).type.spec.tableRole == "row") return $pos.node(0).resolve($pos.before(d + 1));
|
|
10702
10778
|
return null;
|
|
@@ -10927,7 +11003,7 @@ var CellBookmark = class CellBookmark2 {
|
|
|
10927
11003
|
else return Selection.near($headCell, 1);
|
|
10928
11004
|
}
|
|
10929
11005
|
};
|
|
10930
|
-
var fixTablesKey = new
|
|
11006
|
+
var fixTablesKey = new PluginKey7("fix-tables");
|
|
10931
11007
|
function convertTableNodeToArrayOfRows(tableNode) {
|
|
10932
11008
|
const map = TableMap3.get(tableNode);
|
|
10933
11009
|
const rows = [];
|
|
@@ -11405,7 +11481,7 @@ function atEndOfCell(view, axis, dir) {
|
|
|
11405
11481
|
}
|
|
11406
11482
|
return null;
|
|
11407
11483
|
}
|
|
11408
|
-
var columnResizingPluginKey2 = new
|
|
11484
|
+
var columnResizingPluginKey2 = new PluginKey7("tableColumnResizing");
|
|
11409
11485
|
|
|
11410
11486
|
// src/components/UEditor/table-controls.tsx
|
|
11411
11487
|
import {
|
|
@@ -11856,6 +11932,8 @@ function TableDragPreview({
|
|
|
11856
11932
|
import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
11857
11933
|
var ADD_COLUMN_RAIL_GAP = 4;
|
|
11858
11934
|
var ADD_ROW_RAIL_GAP = 4;
|
|
11935
|
+
var BUTTON_LONG_SIZE = 36;
|
|
11936
|
+
var BUTTON_SHORT_SIZE = 14;
|
|
11859
11937
|
function TableAddRails({
|
|
11860
11938
|
addColumnVisible,
|
|
11861
11939
|
addRowVisible,
|
|
@@ -11868,10 +11946,10 @@ function TableAddRails({
|
|
|
11868
11946
|
quickAddRowLabel
|
|
11869
11947
|
}) {
|
|
11870
11948
|
const visibleBounds = getVisibleTableBounds(layout);
|
|
11871
|
-
const columnRailTop = visibleBounds.top;
|
|
11949
|
+
const columnRailTop = visibleBounds.top + Math.max(0, (visibleBounds.height - BUTTON_LONG_SIZE) / 2);
|
|
11872
11950
|
const columnRailLeft = visibleBounds.right + ADD_COLUMN_RAIL_GAP;
|
|
11873
11951
|
const rowRailTop = layout.wrapperTop + layout.wrapperHeight + ADD_ROW_RAIL_GAP;
|
|
11874
|
-
const rowRailLeft = visibleBounds.left;
|
|
11952
|
+
const rowRailLeft = visibleBounds.left + Math.max(0, (visibleBounds.width - BUTTON_LONG_SIZE) / 2);
|
|
11875
11953
|
const showColumnRail = controlsVisible || addColumnVisible;
|
|
11876
11954
|
const showRowRail = controlsVisible || addRowVisible;
|
|
11877
11955
|
return /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
@@ -11896,15 +11974,15 @@ function TableAddRails({
|
|
|
11896
11974
|
className: cn(
|
|
11897
11975
|
"absolute z-30 inline-flex items-center justify-center rounded-md",
|
|
11898
11976
|
"border border-border/70 bg-muted/40 text-muted-foreground shadow-sm backdrop-blur",
|
|
11899
|
-
"transition-[opacity,transform,colors] duration-
|
|
11977
|
+
"transition-[opacity,transform,colors] duration-200 delay-100 ease-out cursor-pointer hover:bg-accent hover:text-foreground disabled:opacity-50 disabled:cursor-not-allowed"
|
|
11900
11978
|
),
|
|
11901
11979
|
style: {
|
|
11902
|
-
top:
|
|
11980
|
+
top: columnRailTop,
|
|
11903
11981
|
left: columnRailLeft,
|
|
11904
|
-
width:
|
|
11905
|
-
height:
|
|
11982
|
+
width: BUTTON_SHORT_SIZE,
|
|
11983
|
+
height: BUTTON_LONG_SIZE,
|
|
11906
11984
|
opacity: showColumnRail ? 1 : 0,
|
|
11907
|
-
transform: showColumnRail ? "scale(1)" : "scale(0.
|
|
11985
|
+
transform: showColumnRail ? "scale(1)" : "scale(0.85)",
|
|
11908
11986
|
pointerEvents: showColumnRail ? "auto" : "none"
|
|
11909
11987
|
},
|
|
11910
11988
|
children: /* @__PURE__ */ jsx14("span", { className: "text-sm font-medium leading-none", children: "+" })
|
|
@@ -11933,15 +12011,15 @@ function TableAddRails({
|
|
|
11933
12011
|
className: cn(
|
|
11934
12012
|
"absolute z-30 inline-flex items-center justify-center rounded-md",
|
|
11935
12013
|
"border border-border/70 bg-muted/40 text-muted-foreground shadow-sm backdrop-blur",
|
|
11936
|
-
"transition-[opacity,transform,colors] duration-
|
|
12014
|
+
"transition-[opacity,transform,colors] duration-200 delay-100 ease-out cursor-pointer hover:bg-accent hover:text-foreground disabled:opacity-50 disabled:cursor-not-allowed"
|
|
11937
12015
|
),
|
|
11938
12016
|
style: {
|
|
11939
12017
|
top: rowRailTop,
|
|
11940
|
-
left:
|
|
11941
|
-
width:
|
|
11942
|
-
height:
|
|
12018
|
+
left: rowRailLeft,
|
|
12019
|
+
width: BUTTON_LONG_SIZE,
|
|
12020
|
+
height: BUTTON_SHORT_SIZE,
|
|
11943
12021
|
opacity: showRowRail ? 1 : 0,
|
|
11944
|
-
transform: showRowRail ? "scale(1)" : "scale(0.
|
|
12022
|
+
transform: showRowRail ? "scale(1)" : "scale(0.85)",
|
|
11945
12023
|
pointerEvents: showRowRail ? "auto" : "none"
|
|
11946
12024
|
},
|
|
11947
12025
|
children: /* @__PURE__ */ jsx14("span", { className: "text-sm font-medium leading-none", children: "+" })
|
|
@@ -12072,7 +12150,7 @@ function TableRowHandles({
|
|
|
12072
12150
|
onStartDrag(rowHandle);
|
|
12073
12151
|
},
|
|
12074
12152
|
className: cn(
|
|
12075
|
-
"inline-flex h-6 w-6 items-center justify-center rounded-full transition-[opacity,transform,colors,border,background-color] duration-
|
|
12153
|
+
"inline-flex h-6 w-6 items-center justify-center rounded-full transition-[opacity,transform,colors,border,background-color] duration-200 delay-100 ease-out",
|
|
12076
12154
|
visible ? "border border-border/70 bg-background/95 text-muted-foreground shadow-sm backdrop-blur hover:bg-accent hover:text-foreground cursor-grab active:cursor-grabbing" : "border-transparent bg-transparent cursor-pointer"
|
|
12077
12155
|
),
|
|
12078
12156
|
style: {
|
|
@@ -12147,7 +12225,7 @@ function TableColumnHandles({
|
|
|
12147
12225
|
onStartDrag(columnHandle);
|
|
12148
12226
|
},
|
|
12149
12227
|
className: cn(
|
|
12150
|
-
"inline-flex h-6 w-6 items-center justify-center rounded-full transition-[opacity,transform,colors,border,background-color] duration-
|
|
12228
|
+
"inline-flex h-6 w-6 items-center justify-center rounded-full transition-[opacity,transform,colors,border,background-color] duration-200 delay-100 ease-out",
|
|
12151
12229
|
visible ? "border border-border/70 bg-background/95 text-muted-foreground shadow-sm backdrop-blur hover:bg-accent hover:text-foreground cursor-grab active:cursor-grabbing" : "border-transparent bg-transparent cursor-pointer"
|
|
12152
12230
|
),
|
|
12153
12231
|
style: {
|
|
@@ -12534,7 +12612,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
12534
12612
|
const updateHoverState = React10.useCallback((event) => {
|
|
12535
12613
|
const activeLayout = layoutRef.current;
|
|
12536
12614
|
const surface = containerRef.current;
|
|
12537
|
-
if (!activeLayout || !surface || dragStateRef.current) {
|
|
12615
|
+
if (!activeLayout || !surface || dragStateRef.current || event.buttons !== 0) {
|
|
12538
12616
|
setHoverState(DEFAULT_TABLE_HOVER_STATE);
|
|
12539
12617
|
return;
|
|
12540
12618
|
}
|
|
@@ -12668,7 +12746,7 @@ function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
|
12668
12746
|
return result;
|
|
12669
12747
|
}, [editor, scheduleSyncFromSelection]);
|
|
12670
12748
|
const canExpandTable = Boolean(layout);
|
|
12671
|
-
const controlsVisible =
|
|
12749
|
+
const controlsVisible = false;
|
|
12672
12750
|
const tableMenuOpen = openMenuKey === "table";
|
|
12673
12751
|
const startTableResize = React10.useCallback((event) => {
|
|
12674
12752
|
if (event.button !== 0 || dragStateRef.current) return;
|
|
@@ -13189,6 +13267,9 @@ function useTableRowResize({
|
|
|
13189
13267
|
pendingHeight: startHeight
|
|
13190
13268
|
};
|
|
13191
13269
|
showRowGuide(table, row, cell, startHeight);
|
|
13270
|
+
isRowResizingGlobal.active = true;
|
|
13271
|
+
window.getSelection()?.removeAllRanges();
|
|
13272
|
+
document.body.style.userSelect = "none";
|
|
13192
13273
|
document.body.style.cursor = "row-resize";
|
|
13193
13274
|
event.preventDefault();
|
|
13194
13275
|
event.stopPropagation();
|
|
@@ -13230,6 +13311,8 @@ function useTableRowResize({
|
|
|
13230
13311
|
editor.view.dispatch(tr);
|
|
13231
13312
|
}
|
|
13232
13313
|
stateRef.current = null;
|
|
13314
|
+
isRowResizingGlobal.active = false;
|
|
13315
|
+
document.body.style.userSelect = "";
|
|
13233
13316
|
document.body.style.cursor = "";
|
|
13234
13317
|
clearHoveredTableCell();
|
|
13235
13318
|
clearAllTableResizeHover();
|
|
@@ -13238,6 +13321,8 @@ function useTableRowResize({
|
|
|
13238
13321
|
const cancelResize = React11.useCallback(() => {
|
|
13239
13322
|
if (!stateRef.current) return;
|
|
13240
13323
|
stateRef.current = null;
|
|
13324
|
+
isRowResizingGlobal.active = false;
|
|
13325
|
+
document.body.style.userSelect = "";
|
|
13241
13326
|
document.body.style.cursor = "";
|
|
13242
13327
|
clearHoveredTableCell();
|
|
13243
13328
|
clearAllTableResizeHover();
|
|
@@ -13245,6 +13330,8 @@ function useTableRowResize({
|
|
|
13245
13330
|
}, [clearAllTableResizeHover, clearHoveredTableCell, scheduleTableLayoutSync]);
|
|
13246
13331
|
const cleanup = React11.useCallback(() => {
|
|
13247
13332
|
stateRef.current = null;
|
|
13333
|
+
isRowResizingGlobal.active = false;
|
|
13334
|
+
document.body.style.userSelect = "";
|
|
13248
13335
|
document.body.style.cursor = "";
|
|
13249
13336
|
}, []);
|
|
13250
13337
|
return {
|
|
@@ -13293,11 +13380,21 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
13293
13380
|
guide.style.opacity = "0";
|
|
13294
13381
|
}
|
|
13295
13382
|
}, [getProseMirrorElement]);
|
|
13383
|
+
const hotspotTimerRef = useRef6(null);
|
|
13384
|
+
const activeHotspotKeyRef = useRef6(null);
|
|
13385
|
+
const clearHotspotTimer = React12.useCallback(() => {
|
|
13386
|
+
if (hotspotTimerRef.current !== null) {
|
|
13387
|
+
window.clearTimeout(hotspotTimerRef.current);
|
|
13388
|
+
hotspotTimerRef.current = null;
|
|
13389
|
+
}
|
|
13390
|
+
}, []);
|
|
13296
13391
|
const clearAllTableResizeHover = React12.useCallback(() => {
|
|
13392
|
+
clearHotspotTimer();
|
|
13393
|
+
activeHotspotKeyRef.current = null;
|
|
13297
13394
|
setEditorResizeCursor("");
|
|
13298
13395
|
hideColumnGuide();
|
|
13299
13396
|
hideRowGuide();
|
|
13300
|
-
}, [hideColumnGuide, hideRowGuide, setEditorResizeCursor]);
|
|
13397
|
+
}, [clearHotspotTimer, hideColumnGuide, hideRowGuide, setEditorResizeCursor]);
|
|
13301
13398
|
const updateActiveCellHighlight = React12.useCallback((cell) => {
|
|
13302
13399
|
const surface = editorContentRef.current;
|
|
13303
13400
|
const highlight = activeTableCellHighlightRef.current;
|
|
@@ -13436,6 +13533,10 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
13436
13533
|
if (syncActiveRowResizeGuide()) {
|
|
13437
13534
|
return;
|
|
13438
13535
|
}
|
|
13536
|
+
if (event.buttons !== 0) {
|
|
13537
|
+
clearAllTableResizeHover();
|
|
13538
|
+
return;
|
|
13539
|
+
}
|
|
13439
13540
|
const target = resolveEventElement(event.target);
|
|
13440
13541
|
if (!(target instanceof Element)) {
|
|
13441
13542
|
clearAllTableResizeHover();
|
|
@@ -13455,18 +13556,46 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
13455
13556
|
clearAllTableResizeHover();
|
|
13456
13557
|
return;
|
|
13457
13558
|
}
|
|
13458
|
-
const
|
|
13459
|
-
const
|
|
13460
|
-
if (
|
|
13461
|
-
|
|
13462
|
-
|
|
13559
|
+
const rowTarget = resolveRowResizeTarget(cell, event.clientX, event.clientY);
|
|
13560
|
+
const colTarget = resolveColumnResizeTarget(cell, event.clientX, event.clientY);
|
|
13561
|
+
if (rowTarget) {
|
|
13562
|
+
const hotspotKey = `row:${rowTarget.row.rowIndex}-${rowTarget.cell.cellIndex}`;
|
|
13563
|
+
if (activeHotspotKeyRef.current === hotspotKey) {
|
|
13564
|
+
hideColumnGuide();
|
|
13565
|
+
showRowGuide(table, rowTarget.row, rowTarget.cell);
|
|
13566
|
+
return;
|
|
13567
|
+
}
|
|
13568
|
+
if (activeHotspotKeyRef.current !== hotspotKey) {
|
|
13569
|
+
clearHotspotTimer();
|
|
13570
|
+
activeHotspotKeyRef.current = hotspotKey;
|
|
13571
|
+
hotspotTimerRef.current = window.setTimeout(() => {
|
|
13572
|
+
hotspotTimerRef.current = null;
|
|
13573
|
+
hideColumnGuide();
|
|
13574
|
+
showRowGuide(table, rowTarget.row, rowTarget.cell);
|
|
13575
|
+
}, 100);
|
|
13576
|
+
}
|
|
13463
13577
|
return;
|
|
13464
13578
|
}
|
|
13465
|
-
if (
|
|
13466
|
-
|
|
13467
|
-
|
|
13579
|
+
if (colTarget) {
|
|
13580
|
+
const hotspotKey = `col:${colTarget.row.rowIndex}-${colTarget.cell.cellIndex}`;
|
|
13581
|
+
if (activeHotspotKeyRef.current === hotspotKey) {
|
|
13582
|
+
hideRowGuide();
|
|
13583
|
+
showColumnGuide(table, colTarget.row, colTarget.cell);
|
|
13584
|
+
return;
|
|
13585
|
+
}
|
|
13586
|
+
if (activeHotspotKeyRef.current !== hotspotKey) {
|
|
13587
|
+
clearHotspotTimer();
|
|
13588
|
+
activeHotspotKeyRef.current = hotspotKey;
|
|
13589
|
+
hotspotTimerRef.current = window.setTimeout(() => {
|
|
13590
|
+
hotspotTimerRef.current = null;
|
|
13591
|
+
hideRowGuide();
|
|
13592
|
+
showColumnGuide(table, colTarget.row, colTarget.cell);
|
|
13593
|
+
}, 100);
|
|
13594
|
+
}
|
|
13468
13595
|
return;
|
|
13469
13596
|
}
|
|
13597
|
+
clearHotspotTimer();
|
|
13598
|
+
activeHotspotKeyRef.current = null;
|
|
13470
13599
|
clearAllTableResizeHover();
|
|
13471
13600
|
};
|
|
13472
13601
|
const handleEditorMouseLeave = () => {
|
|
@@ -13487,15 +13616,22 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
13487
13616
|
clearActiveTableCell();
|
|
13488
13617
|
return;
|
|
13489
13618
|
}
|
|
13490
|
-
setActiveTableCell(cell);
|
|
13491
|
-
scheduleActiveCellSync(cell);
|
|
13492
13619
|
const row = cell.closest("tr");
|
|
13493
13620
|
const table = cell.closest("table");
|
|
13494
13621
|
if (!(row instanceof HTMLTableRowElement) || !(table instanceof HTMLTableElement)) return;
|
|
13495
|
-
|
|
13496
|
-
|
|
13497
|
-
|
|
13622
|
+
const rowTarget = resolveRowResizeTarget(cell, event.clientX, event.clientY);
|
|
13623
|
+
if (rowTarget) {
|
|
13624
|
+
event.preventDefault();
|
|
13625
|
+
event.stopPropagation();
|
|
13626
|
+
window.getSelection()?.removeAllRanges();
|
|
13627
|
+
if (beginResize(event, table, rowTarget.row, rowTarget.cell)) {
|
|
13628
|
+
suppressActiveCellHighlightRef.current = true;
|
|
13629
|
+
updateActiveCellHighlight(null);
|
|
13630
|
+
return;
|
|
13631
|
+
}
|
|
13498
13632
|
}
|
|
13633
|
+
setActiveTableCell(cell);
|
|
13634
|
+
scheduleActiveCellSync(cell);
|
|
13499
13635
|
};
|
|
13500
13636
|
const handlePointerMove = (event) => {
|
|
13501
13637
|
handleRowResizePointerMove(event);
|
|
@@ -13584,8 +13720,9 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
13584
13720
|
clearActiveTableCell();
|
|
13585
13721
|
clearHoveredTableCell();
|
|
13586
13722
|
clearAllTableResizeHover();
|
|
13723
|
+
clearHotspotTimer();
|
|
13587
13724
|
};
|
|
13588
|
-
}, [beginResize, cancelResize, cleanupRowResize, clearActiveTableCell, clearAllTableResizeHover, clearHoveredTableCell, editable, editor, handleRowResizePointerMove, handleRowResizePointerUp, hideColumnGuide, hideRowGuide, isRowResizing, scheduleTableLayoutSync, setActiveTableCell, setHoveredTableCell, showColumnGuide, showRowGuide, syncActiveRowResizeGuide, syncActiveTableCellFromSelection, updateActiveCellHighlight]);
|
|
13725
|
+
}, [beginResize, cancelResize, cleanupRowResize, clearActiveTableCell, clearAllTableResizeHover, clearHotspotTimer, clearHoveredTableCell, editable, editor, handleRowResizePointerMove, handleRowResizePointerUp, hideColumnGuide, hideRowGuide, isRowResizing, scheduleTableLayoutSync, setActiveTableCell, setHoveredTableCell, showColumnGuide, showRowGuide, syncActiveRowResizeGuide, syncActiveTableCellFromSelection, updateActiveCellHighlight]);
|
|
13589
13726
|
return {
|
|
13590
13727
|
editorContentRef,
|
|
13591
13728
|
tableColumnGuideRef,
|
|
@@ -14308,7 +14445,7 @@ function useUEditorOutput({
|
|
|
14308
14445
|
// src/components/UEditor/UEditor.tsx
|
|
14309
14446
|
import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
14310
14447
|
var LazyMenuBar = React15.lazy(async () => {
|
|
14311
|
-
const { MenuBar } = await import("./menu-bar-
|
|
14448
|
+
const { MenuBar } = await import("./menu-bar-SVX36W4S.js");
|
|
14312
14449
|
return { default: MenuBar };
|
|
14313
14450
|
});
|
|
14314
14451
|
var UEditor = React15.forwardRef(({
|
|
@@ -14339,6 +14476,7 @@ var UEditor = React15.forwardRef(({
|
|
|
14339
14476
|
variant = "default",
|
|
14340
14477
|
rounded = true,
|
|
14341
14478
|
fontFamilies,
|
|
14479
|
+
defaultFontFamily = "Inter",
|
|
14342
14480
|
fontSizes,
|
|
14343
14481
|
lineHeights,
|
|
14344
14482
|
letterSpacings,
|
|
@@ -14647,6 +14785,7 @@ var UEditor = React15.forwardRef(({
|
|
|
14647
14785
|
maxImageFileSize,
|
|
14648
14786
|
allowedImageMimeTypes,
|
|
14649
14787
|
fontFamilies,
|
|
14788
|
+
defaultFontFamily,
|
|
14650
14789
|
fontSizes,
|
|
14651
14790
|
lineHeights,
|
|
14652
14791
|
letterSpacings
|
|
@@ -14672,6 +14811,7 @@ var UEditor = React15.forwardRef(({
|
|
|
14672
14811
|
},
|
|
14673
14812
|
className: "relative flex-1 overflow-y-auto",
|
|
14674
14813
|
style: {
|
|
14814
|
+
fontFamily: defaultFontFamily,
|
|
14675
14815
|
minHeight: editable ? minHeight : void 0,
|
|
14676
14816
|
maxHeight
|
|
14677
14817
|
},
|
|
@@ -14681,7 +14821,7 @@ var UEditor = React15.forwardRef(({
|
|
|
14681
14821
|
{
|
|
14682
14822
|
ref: tableColumnGuideRef,
|
|
14683
14823
|
"aria-hidden": "true",
|
|
14684
|
-
className: "pointer-events-none absolute z-20 bg-primary opacity-0 transition-opacity duration-100"
|
|
14824
|
+
className: "pointer-events-none absolute z-20 bg-primary/50 opacity-0 transition-opacity duration-200 delay-100 ease-out"
|
|
14685
14825
|
}
|
|
14686
14826
|
),
|
|
14687
14827
|
/* @__PURE__ */ jsx20(
|
|
@@ -14689,7 +14829,7 @@ var UEditor = React15.forwardRef(({
|
|
|
14689
14829
|
{
|
|
14690
14830
|
ref: tableRowGuideRef,
|
|
14691
14831
|
"aria-hidden": "true",
|
|
14692
|
-
className: "pointer-events-none absolute z-20 bg-primary opacity-0 transition-opacity duration-100"
|
|
14832
|
+
className: "pointer-events-none absolute z-20 bg-primary/50 opacity-0 transition-opacity duration-200 delay-100 ease-out"
|
|
14693
14833
|
}
|
|
14694
14834
|
),
|
|
14695
14835
|
/* @__PURE__ */ jsx20(
|
|
@@ -14698,7 +14838,7 @@ var UEditor = React15.forwardRef(({
|
|
|
14698
14838
|
ref: activeTableCellHighlightRef,
|
|
14699
14839
|
"aria-hidden": "true",
|
|
14700
14840
|
"data-ueditor-active-cell-highlight": "",
|
|
14701
|
-
className: "pointer-events-none hidden absolute z-20 rounded-[2px] border
|
|
14841
|
+
className: "pointer-events-none hidden absolute z-20 rounded-[2px] border border-primary/50 bg-primary/5"
|
|
14702
14842
|
}
|
|
14703
14843
|
),
|
|
14704
14844
|
/* @__PURE__ */ jsx20(
|
|
@@ -14760,4 +14900,4 @@ export {
|
|
|
14760
14900
|
prepareUEditorContentForSave,
|
|
14761
14901
|
UEditor_default
|
|
14762
14902
|
};
|
|
14763
|
-
//# sourceMappingURL=chunk-
|
|
14903
|
+
//# sourceMappingURL=chunk-WDY3QWOW.js.map
|