@underverse-ui/underverse 1.0.200 → 1.0.202
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/index.cjs +857 -573
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +824 -541
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1135,11 +1135,14 @@ var en_default = {
|
|
|
1135
1135
|
mergeCells: "Merge Cells",
|
|
1136
1136
|
splitCell: "Split Cell",
|
|
1137
1137
|
openControls: "Open Table Controls",
|
|
1138
|
+
cellFormatting: "Cell Formatting",
|
|
1138
1139
|
quickAddColumnAfter: "Quick Add Column After",
|
|
1139
1140
|
quickAddRowAfter: "Quick Add Row After",
|
|
1140
1141
|
expandTable: "Expand Table",
|
|
1141
1142
|
dragRow: "Drag Row",
|
|
1142
1143
|
dragColumn: "Drag Column",
|
|
1144
|
+
resizeBoth: "Resize Table",
|
|
1145
|
+
resizeCtrlHint: "Drag freely. Hold Ctrl to lock to one axis; hold Ctrl+Shift to preserve proportions",
|
|
1143
1146
|
alignLeft: "Align Table Left",
|
|
1144
1147
|
alignCenter: "Align Table Center",
|
|
1145
1148
|
alignRight: "Align Table Right",
|
|
@@ -1581,11 +1584,14 @@ var vi_default = {
|
|
|
1581
1584
|
mergeCells: "G\u1ED9p \xF4",
|
|
1582
1585
|
splitCell: "T\xE1ch \xF4",
|
|
1583
1586
|
openControls: "M\u1EDF \u0111i\u1EC1u khi\u1EC3n b\u1EA3ng",
|
|
1587
|
+
cellFormatting: "\u0110\u1ECBnh d\u1EA1ng \xF4",
|
|
1584
1588
|
quickAddColumnAfter: "Th\xEAm nhanh c\u1ED9t sau",
|
|
1585
1589
|
quickAddRowAfter: "Th\xEAm nhanh h\xE0ng sau",
|
|
1586
1590
|
expandTable: "M\u1EDF r\u1ED9ng b\u1EA3ng",
|
|
1587
1591
|
dragRow: "K\xE9o h\xE0ng",
|
|
1588
1592
|
dragColumn: "K\xE9o c\u1ED9t",
|
|
1593
|
+
resizeBoth: "\u0110\u1ED5i k\xEDch th\u01B0\u1EDBc b\u1EA3ng",
|
|
1594
|
+
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",
|
|
1589
1595
|
alignLeft: "C\u0103n b\u1EA3ng tr\xE1i",
|
|
1590
1596
|
alignCenter: "C\u0103n b\u1EA3ng gi\u1EEFa",
|
|
1591
1597
|
alignRight: "C\u0103n b\u1EA3ng ph\u1EA3i",
|
|
@@ -2027,11 +2033,14 @@ var ko_default = {
|
|
|
2027
2033
|
mergeCells: "\uC140 \uBCD1\uD569",
|
|
2028
2034
|
splitCell: "\uC140 \uBD84\uD560",
|
|
2029
2035
|
openControls: "\uD45C \uCEE8\uD2B8\uB864 \uC5F4\uAE30",
|
|
2036
|
+
cellFormatting: "\uC140 \uC11C\uC2DD",
|
|
2030
2037
|
quickAddColumnAfter: "\uC624\uB978\uCABD \uC5F4 \uBE60\uB974\uAC8C \uCD94\uAC00",
|
|
2031
2038
|
quickAddRowAfter: "\uC544\uB798 \uD589 \uBE60\uB974\uAC8C \uCD94\uAC00",
|
|
2032
2039
|
expandTable: "\uD45C \uD655\uC7A5",
|
|
2033
2040
|
dragRow: "\uD589 \uB4DC\uB798\uADF8",
|
|
2034
2041
|
dragColumn: "\uC5F4 \uB4DC\uB798\uADF8",
|
|
2042
|
+
resizeBoth: "\uD45C \uD06C\uAE30 \uC870\uC808",
|
|
2043
|
+
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",
|
|
2035
2044
|
alignLeft: "\uD45C \uC67C\uCABD \uC815\uB82C",
|
|
2036
2045
|
alignCenter: "\uD45C \uAC00\uC6B4\uB370 \uC815\uB82C",
|
|
2037
2046
|
alignRight: "\uD45C \uC624\uB978\uCABD \uC815\uB82C",
|
|
@@ -2473,11 +2482,14 @@ var ja_default = {
|
|
|
2473
2482
|
mergeCells: "\u30BB\u30EB\u3092\u7D50\u5408",
|
|
2474
2483
|
splitCell: "\u30BB\u30EB\u3092\u5206\u5272",
|
|
2475
2484
|
openControls: "\u8868\u30B3\u30F3\u30C8\u30ED\u30FC\u30EB\u3092\u958B\u304F",
|
|
2485
|
+
cellFormatting: "\u30BB\u30EB\u306E\u66F8\u5F0F\u8A2D\u5B9A",
|
|
2476
2486
|
quickAddColumnAfter: "\u53F3\u5074\u306B\u5217\u3092\u3059\u3070\u3084\u304F\u8FFD\u52A0",
|
|
2477
2487
|
quickAddRowAfter: "\u4E0B\u306B\u884C\u3092\u3059\u3070\u3084\u304F\u8FFD\u52A0",
|
|
2478
2488
|
expandTable: "\u8868\u3092\u62E1\u5F35",
|
|
2479
2489
|
dragRow: "\u884C\u3092\u30C9\u30E9\u30C3\u30B0",
|
|
2480
2490
|
dragColumn: "\u5217\u3092\u30C9\u30E9\u30C3\u30B0",
|
|
2491
|
+
resizeBoth: "\u8868\u306E\u30B5\u30A4\u30BA\u3092\u5909\u66F4",
|
|
2492
|
+
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",
|
|
2481
2493
|
alignLeft: "\u8868\u3092\u5DE6\u5BC4\u305B",
|
|
2482
2494
|
alignCenter: "\u8868\u3092\u4E2D\u592E\u63C3\u3048",
|
|
2483
2495
|
alignRight: "\u8868\u3092\u53F3\u5BC4\u305B",
|
|
@@ -8876,6 +8888,8 @@ var DropdownMenu = ({
|
|
|
8876
8888
|
disabled = false,
|
|
8877
8889
|
isOpen,
|
|
8878
8890
|
onOpenChange,
|
|
8891
|
+
openOnHover = false,
|
|
8892
|
+
hoverCloseDelay = 120,
|
|
8879
8893
|
items,
|
|
8880
8894
|
borderMode
|
|
8881
8895
|
}) => {
|
|
@@ -8895,10 +8909,26 @@ var DropdownMenu = ({
|
|
|
8895
8909
|
const itemsRef = import_react17.default.useRef([]);
|
|
8896
8910
|
const [activeIndex, setActiveIndex] = useResettingIndex(open);
|
|
8897
8911
|
const parentMenu = import_react17.default.useContext(DropdownMenuContext);
|
|
8912
|
+
const hoverCloseTimeoutRef = import_react17.default.useRef(null);
|
|
8913
|
+
const cancelHoverClose = import_react17.default.useCallback(() => {
|
|
8914
|
+
if (hoverCloseTimeoutRef.current === null) return;
|
|
8915
|
+
clearTimeout(hoverCloseTimeoutRef.current);
|
|
8916
|
+
hoverCloseTimeoutRef.current = null;
|
|
8917
|
+
}, []);
|
|
8918
|
+
const scheduleHoverClose = import_react17.default.useCallback(() => {
|
|
8919
|
+
if (!openOnHover) return;
|
|
8920
|
+
cancelHoverClose();
|
|
8921
|
+
hoverCloseTimeoutRef.current = setTimeout(() => {
|
|
8922
|
+
hoverCloseTimeoutRef.current = null;
|
|
8923
|
+
setOpen(false);
|
|
8924
|
+
}, hoverCloseDelay);
|
|
8925
|
+
}, [cancelHoverClose, hoverCloseDelay, openOnHover, setOpen]);
|
|
8926
|
+
import_react17.default.useEffect(() => () => cancelHoverClose(), [cancelHoverClose]);
|
|
8898
8927
|
const closeMenu = import_react17.default.useCallback(() => {
|
|
8928
|
+
cancelHoverClose();
|
|
8899
8929
|
setOpen(false);
|
|
8900
8930
|
parentMenu?.closeMenu();
|
|
8901
|
-
}, [parentMenu, setOpen]);
|
|
8931
|
+
}, [cancelHoverClose, parentMenu, setOpen]);
|
|
8902
8932
|
const getEnabledMenuItems = import_react17.default.useCallback(() => {
|
|
8903
8933
|
const menuEl = menuRef.current;
|
|
8904
8934
|
if (!menuEl) return [];
|
|
@@ -8955,9 +8985,11 @@ var DropdownMenu = ({
|
|
|
8955
8985
|
const menuContext = import_react17.default.useMemo(
|
|
8956
8986
|
() => ({
|
|
8957
8987
|
closeMenu,
|
|
8958
|
-
closeOnSelect
|
|
8988
|
+
closeOnSelect,
|
|
8989
|
+
cancelHoverClose,
|
|
8990
|
+
scheduleHoverClose
|
|
8959
8991
|
}),
|
|
8960
|
-
[closeMenu, closeOnSelect]
|
|
8992
|
+
[cancelHoverClose, closeMenu, closeOnSelect, scheduleHoverClose]
|
|
8961
8993
|
);
|
|
8962
8994
|
const handleItemClick = (itemOnClick) => {
|
|
8963
8995
|
itemOnClick();
|
|
@@ -8965,71 +8997,117 @@ var DropdownMenu = ({
|
|
|
8965
8997
|
closeMenu();
|
|
8966
8998
|
}
|
|
8967
8999
|
};
|
|
8968
|
-
const menuBody = /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DropdownMenuContext.Provider, { value: menuContext, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
8969
|
-
|
|
8970
|
-
|
|
8971
|
-
|
|
8972
|
-
|
|
8973
|
-
|
|
8974
|
-
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
|
|
8979
|
-
|
|
8980
|
-
|
|
8981
|
-
|
|
8982
|
-
|
|
8983
|
-
|
|
8984
|
-
|
|
8985
|
-
|
|
8986
|
-
|
|
8987
|
-
"
|
|
8988
|
-
|
|
8989
|
-
|
|
8990
|
-
|
|
8991
|
-
|
|
8992
|
-
|
|
8993
|
-
|
|
8994
|
-
|
|
8995
|
-
|
|
8996
|
-
|
|
8997
|
-
|
|
8998
|
-
|
|
8999
|
-
|
|
9000
|
-
|
|
9000
|
+
const menuBody = /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DropdownMenuContext.Provider, { value: menuContext, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
9001
|
+
"div",
|
|
9002
|
+
{
|
|
9003
|
+
ref: menuRef,
|
|
9004
|
+
"data-dropdown-menu": true,
|
|
9005
|
+
"data-state": open ? "open" : "closed",
|
|
9006
|
+
role: "menu",
|
|
9007
|
+
className: cn("min-w-40", className),
|
|
9008
|
+
onMouseEnter: openOnHover ? () => {
|
|
9009
|
+
cancelHoverClose();
|
|
9010
|
+
parentMenu?.cancelHoverClose();
|
|
9011
|
+
} : void 0,
|
|
9012
|
+
onMouseLeave: openOnHover ? () => {
|
|
9013
|
+
scheduleHoverClose();
|
|
9014
|
+
parentMenu?.scheduleHoverClose();
|
|
9015
|
+
} : void 0,
|
|
9016
|
+
children: items ? items.map((item, index) => {
|
|
9017
|
+
const IconComponent = item.icon;
|
|
9018
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
9019
|
+
"button",
|
|
9020
|
+
{
|
|
9021
|
+
ref: (el) => {
|
|
9022
|
+
if (el) itemsRef.current[index] = el;
|
|
9023
|
+
},
|
|
9024
|
+
onClick: () => handleItemClick(item.onClick),
|
|
9025
|
+
disabled: item.disabled,
|
|
9026
|
+
role: "menuitem",
|
|
9027
|
+
"data-dropdown-menu-item": "",
|
|
9028
|
+
tabIndex: -1,
|
|
9029
|
+
style: {
|
|
9030
|
+
animationDelay: open ? `${Math.min(index * 20, 200)}ms` : "0ms"
|
|
9031
|
+
},
|
|
9032
|
+
className: cn(
|
|
9033
|
+
"dropdown-item flex w-full items-center gap-2 px-2.5 py-1.5 text-sm",
|
|
9034
|
+
resolvedBorderMode ? getBorderRadiusClass(resolvedBorderMode) : "rounded-lg",
|
|
9035
|
+
"outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
9036
|
+
"hover:bg-accent hover:text-accent-foreground",
|
|
9037
|
+
"focus:bg-accent focus:text-accent-foreground",
|
|
9038
|
+
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
9039
|
+
item.destructive && "text-destructive hover:bg-destructive/10 focus:bg-destructive/10"
|
|
9040
|
+
),
|
|
9041
|
+
children: [
|
|
9042
|
+
IconComponent && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(IconComponent, { className: "h-4 w-4" }),
|
|
9043
|
+
item.label
|
|
9044
|
+
]
|
|
9045
|
+
},
|
|
9046
|
+
index
|
|
9047
|
+
);
|
|
9048
|
+
}) : children
|
|
9049
|
+
}
|
|
9050
|
+
) });
|
|
9001
9051
|
const triggerProps = trigger.props;
|
|
9002
|
-
const
|
|
9052
|
+
const {
|
|
9053
|
+
ref: childRef,
|
|
9054
|
+
onKeyDown: triggerOnKeyDown,
|
|
9055
|
+
onClick: triggerOnClick,
|
|
9056
|
+
onMouseEnter: triggerOnMouseEnter,
|
|
9057
|
+
onMouseLeave: triggerOnMouseLeave
|
|
9058
|
+
} = triggerProps;
|
|
9059
|
+
const setTriggerNode = import_react17.default.useCallback((node) => {
|
|
9060
|
+
setRefValue(childRef, node);
|
|
9061
|
+
triggerRef.current = node;
|
|
9062
|
+
}, [childRef]);
|
|
9063
|
+
const handleTriggerKeyDown = import_react17.default.useCallback((event) => {
|
|
9064
|
+
if (!disabled) {
|
|
9065
|
+
if (event.key === "ArrowDown") {
|
|
9066
|
+
event.preventDefault();
|
|
9067
|
+
setOpen(true);
|
|
9068
|
+
requestAnimationFrame(() => focusMenuItem(0));
|
|
9069
|
+
} else if (event.key === "ArrowUp") {
|
|
9070
|
+
event.preventDefault();
|
|
9071
|
+
setOpen(true);
|
|
9072
|
+
requestAnimationFrame(() => {
|
|
9073
|
+
const enabled = getEnabledMenuItems();
|
|
9074
|
+
focusMenuItem(enabled.length - 1);
|
|
9075
|
+
});
|
|
9076
|
+
} else if (event.key === "Escape") {
|
|
9077
|
+
event.preventDefault();
|
|
9078
|
+
setOpen(false);
|
|
9079
|
+
}
|
|
9080
|
+
}
|
|
9081
|
+
triggerOnKeyDown?.(event);
|
|
9082
|
+
}, [disabled, focusMenuItem, getEnabledMenuItems, setOpen, triggerOnKeyDown]);
|
|
9083
|
+
const handleTriggerClick = import_react17.default.useCallback((event) => {
|
|
9084
|
+
if (openOnHover && !disabled) {
|
|
9085
|
+
cancelHoverClose();
|
|
9086
|
+
setOpen(true);
|
|
9087
|
+
}
|
|
9088
|
+
triggerOnClick?.(event);
|
|
9089
|
+
}, [cancelHoverClose, disabled, openOnHover, setOpen, triggerOnClick]);
|
|
9090
|
+
const handleTriggerMouseEnter = import_react17.default.useCallback((event) => {
|
|
9091
|
+
if (openOnHover && !disabled) {
|
|
9092
|
+
cancelHoverClose();
|
|
9093
|
+
parentMenu?.cancelHoverClose();
|
|
9094
|
+
setOpen(true);
|
|
9095
|
+
}
|
|
9096
|
+
triggerOnMouseEnter?.(event);
|
|
9097
|
+
}, [cancelHoverClose, disabled, openOnHover, parentMenu, setOpen, triggerOnMouseEnter]);
|
|
9098
|
+
const handleTriggerMouseLeave = import_react17.default.useCallback((event) => {
|
|
9099
|
+
scheduleHoverClose();
|
|
9100
|
+
triggerOnMouseLeave?.(event);
|
|
9101
|
+
}, [scheduleHoverClose, triggerOnMouseLeave]);
|
|
9003
9102
|
const enhancedTrigger = import_react17.default.cloneElement(trigger, {
|
|
9004
9103
|
...triggerProps,
|
|
9005
|
-
ref:
|
|
9006
|
-
triggerRef.current = node;
|
|
9007
|
-
}),
|
|
9104
|
+
ref: setTriggerNode,
|
|
9008
9105
|
"aria-haspopup": "menu",
|
|
9009
9106
|
"aria-expanded": open,
|
|
9010
|
-
onKeyDown:
|
|
9011
|
-
|
|
9012
|
-
|
|
9013
|
-
|
|
9014
|
-
e.preventDefault();
|
|
9015
|
-
setOpen(true);
|
|
9016
|
-
requestAnimationFrame(() => focusMenuItem(0));
|
|
9017
|
-
} else if (e.key === "ArrowUp") {
|
|
9018
|
-
e.preventDefault();
|
|
9019
|
-
setOpen(true);
|
|
9020
|
-
requestAnimationFrame(() => {
|
|
9021
|
-
const enabled = getEnabledMenuItems();
|
|
9022
|
-
focusMenuItem(enabled.length - 1);
|
|
9023
|
-
});
|
|
9024
|
-
} else if (e.key === "Escape") {
|
|
9025
|
-
e.preventDefault();
|
|
9026
|
-
setOpen(false);
|
|
9027
|
-
}
|
|
9028
|
-
}
|
|
9029
|
-
}, triggerProps.onKeyDown),
|
|
9030
|
-
onFocus: chainEventHandlers((e) => {
|
|
9031
|
-
triggerRef.current = e.currentTarget;
|
|
9032
|
-
}, triggerProps.onFocus)
|
|
9107
|
+
onKeyDown: handleTriggerKeyDown,
|
|
9108
|
+
onClick: handleTriggerClick,
|
|
9109
|
+
onMouseEnter: handleTriggerMouseEnter,
|
|
9110
|
+
onMouseLeave: handleTriggerMouseLeave
|
|
9033
9111
|
});
|
|
9034
9112
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
9035
9113
|
Popover,
|
|
@@ -9127,6 +9205,7 @@ var DropdownMenuSub = ({ label, icon: Icon, disabled, borderMode, children }) =>
|
|
|
9127
9205
|
}
|
|
9128
9206
|
),
|
|
9129
9207
|
placement: "right",
|
|
9208
|
+
openOnHover: true,
|
|
9130
9209
|
children
|
|
9131
9210
|
}
|
|
9132
9211
|
);
|
|
@@ -33721,10 +33800,10 @@ var ToolbarButton = import_react72.default.forwardRef(({ onClick, onMouseDown, a
|
|
|
33721
33800
|
onClick,
|
|
33722
33801
|
disabled,
|
|
33723
33802
|
className: cn(
|
|
33724
|
-
"flex h-
|
|
33725
|
-
"gap-0.5 [
|
|
33803
|
+
"flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-md transition-colors duration-150",
|
|
33804
|
+
"gap-0.5 [&>svg]:h-3.5 [&>svg]:w-3.5 [&>svg]:shrink-0",
|
|
33726
33805
|
"hover:bg-accent",
|
|
33727
|
-
"focus:outline-none focus:ring-2 focus:ring-primary/20",
|
|
33806
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/20",
|
|
33728
33807
|
"disabled:opacity-40 disabled:cursor-not-allowed",
|
|
33729
33808
|
active ? "bg-primary/10 text-primary shadow-sm" : "text-[#7B8184] hover:text-foreground dark:text-muted-foreground",
|
|
33730
33809
|
className
|
|
@@ -33738,7 +33817,7 @@ var ToolbarButton = import_react72.default.forwardRef(({ onClick, onMouseDown, a
|
|
|
33738
33817
|
return button;
|
|
33739
33818
|
});
|
|
33740
33819
|
ToolbarButton.displayName = "ToolbarButton";
|
|
33741
|
-
var ToolbarDivider = () => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { "aria-hidden": "true", className: "mx-
|
|
33820
|
+
var ToolbarDivider = () => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { "aria-hidden": "true", className: "mx-1.5 h-7 w-px shrink-0 bg-[rgba(123,129,132,0.24)]" });
|
|
33742
33821
|
var TableInsertGrid = ({
|
|
33743
33822
|
insertLabel,
|
|
33744
33823
|
previewTemplate,
|
|
@@ -33805,7 +33884,6 @@ var EditorToolbar = ({
|
|
|
33805
33884
|
const [showImageInput, setShowImageInput] = (0, import_react72.useState)(false);
|
|
33806
33885
|
const [showLinkInput, setShowLinkInput] = (0, import_react72.useState)(false);
|
|
33807
33886
|
const [isTableMenuOpen, setIsTableMenuOpen] = (0, import_react72.useState)(false);
|
|
33808
|
-
const [preservedTableAnchorPos, setPreservedTableAnchorPos] = (0, import_react72.useState)(null);
|
|
33809
33887
|
const fileInputRef = (0, import_react72.useRef)(null);
|
|
33810
33888
|
const [isUploadingImage, setIsUploadingImage] = (0, import_react72.useState)(false);
|
|
33811
33889
|
const [imageUploadError, setImageUploadError] = (0, import_react72.useState)(null);
|
|
@@ -33813,14 +33891,11 @@ var EditorToolbar = ({
|
|
|
33813
33891
|
const imageAttrs = editor.getAttributes("image");
|
|
33814
33892
|
const tableAnchorPos = getTableAnchorPos(editor);
|
|
33815
33893
|
const tableInfo = tableAnchorPos == null ? null : findTableNodeInfoFromState(editor.state, tableAnchorPos);
|
|
33816
|
-
const tableAttrs = tableInfo?.node.attrs ?? editor.getAttributes("table");
|
|
33817
33894
|
const textStyleAttrs = editor.getAttributes("textStyle");
|
|
33818
33895
|
const imageLayout = imageAttrs.imageLayout === "left" || imageAttrs.imageLayout === "right" ? imageAttrs.imageLayout : "block";
|
|
33819
33896
|
const imageWidthPreset = imageAttrs.imageWidthPreset === "sm" || imageAttrs.imageWidthPreset === "md" || imageAttrs.imageWidthPreset === "lg" ? imageAttrs.imageWidthPreset : null;
|
|
33820
|
-
const tableAlignAttr = tableAttrs.tableAlign ?? tableAttrs.textAlign;
|
|
33821
|
-
const currentTableAlign = tableAlignAttr === "center" || tableAlignAttr === "right" ? tableAlignAttr : "left";
|
|
33822
33897
|
const isTableSelected = tableInfo !== null;
|
|
33823
|
-
const hasTableContext = isTableSelected
|
|
33898
|
+
const hasTableContext = isTableSelected;
|
|
33824
33899
|
const canMergeCells = hasTableContext && editor.can().mergeCells();
|
|
33825
33900
|
const canSplitCell = hasTableContext && editor.can().splitCell();
|
|
33826
33901
|
const currentCellVerticalAlign = normalizeStyleValue(editor.getAttributes("tableCell").verticalAlign || editor.getAttributes("tableHeader").verticalAlign) || "";
|
|
@@ -33846,7 +33921,6 @@ var EditorToolbar = ({
|
|
|
33846
33921
|
const displayedFontFamilyValue = currentFontFamily || defaultFontFamilyValue;
|
|
33847
33922
|
const displayedFontSizeLabel = currentFontSize ? currentFontSizeLabel : "13";
|
|
33848
33923
|
const activeFontSize = currentFontSize || "13px";
|
|
33849
|
-
const tableCommandAnchorPos = preservedTableAnchorPos ?? tableAnchorPos ?? void 0;
|
|
33850
33924
|
const isMedium = variant === "medium";
|
|
33851
33925
|
const isMediumFull = variant === "medium-full";
|
|
33852
33926
|
const isFull = variant === "default" || variant === "full" || variant === "notion" || !variant;
|
|
@@ -33889,11 +33963,8 @@ var EditorToolbar = ({
|
|
|
33889
33963
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
33890
33964
|
DropdownMenu,
|
|
33891
33965
|
{
|
|
33892
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.
|
|
33893
|
-
}, active: editor.isActive("formCheckbox"), title: t("slashCommand.formCheckbox"), children:
|
|
33894
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.SquareCheckBig, { className: "w-4 h-4" }),
|
|
33895
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.ChevronDown, { className: "w-3 h-3" })
|
|
33896
|
-
] }),
|
|
33966
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => {
|
|
33967
|
+
}, active: editor.isActive("formCheckbox"), title: t("slashCommand.formCheckbox"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.SquareCheckBig, { className: "w-4 h-4" }) }),
|
|
33897
33968
|
children: [
|
|
33898
33969
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
33899
33970
|
DropdownMenuItem,
|
|
@@ -33960,7 +34031,7 @@ var EditorToolbar = ({
|
|
|
33960
34031
|
"div",
|
|
33961
34032
|
{
|
|
33962
34033
|
role: "toolbar",
|
|
33963
|
-
className: "flex min-h-
|
|
34034
|
+
className: "flex min-h-12 flex-nowrap items-center gap-0.5 overflow-x-auto border-b border-[rgba(196,197,213,0.6)] bg-[#F4F4F4] px-2 py-2 dark:bg-muted/60",
|
|
33964
34035
|
children: [
|
|
33965
34036
|
isFull && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
33966
34037
|
DropdownMenu,
|
|
@@ -33971,7 +34042,7 @@ var EditorToolbar = ({
|
|
|
33971
34042
|
onClick: () => {
|
|
33972
34043
|
},
|
|
33973
34044
|
title: t("toolbar.fontFamily"),
|
|
33974
|
-
className: "h-
|
|
34045
|
+
className: "h-8 w-44 max-w-44 justify-between gap-2 border border-[rgba(196,197,213,0.6)] bg-white px-2.5 text-[#404040] shadow-[0_1px_2px_rgba(0,0,0,0.07)] hover:bg-white hover:text-[#404040] dark:bg-background dark:text-foreground",
|
|
33975
34046
|
children: [
|
|
33976
34047
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "min-w-0 flex-1 truncate text-left text-sm font-normal", style: { fontFamily: displayedFontFamilyValue || void 0 }, children: displayedFontFamilyLabel }),
|
|
33977
34048
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaChevronDownIcon, { className: "h-3 w-3 shrink-0 text-[#7B8184]" })
|
|
@@ -34000,7 +34071,7 @@ var EditorToolbar = ({
|
|
|
34000
34071
|
onClick: () => {
|
|
34001
34072
|
},
|
|
34002
34073
|
title: t("toolbar.fontSize"),
|
|
34003
|
-
className: "h-
|
|
34074
|
+
className: "h-8 w-16 justify-between gap-2 border border-[rgba(196,197,213,0.6)] bg-white px-2.5 text-[#404040] shadow-[0_1px_2px_rgba(0,0,0,0.07)] hover:bg-white hover:text-[#404040] dark:bg-background dark:text-foreground",
|
|
34004
34075
|
children: [
|
|
34005
34076
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "text-sm font-normal leading-none", children: displayedFontSizeLabel }),
|
|
34006
34077
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaChevronDownIcon, { className: "h-3 w-3 shrink-0 text-[#7B8184]" })
|
|
@@ -34023,11 +34094,8 @@ var EditorToolbar = ({
|
|
|
34023
34094
|
DropdownMenu,
|
|
34024
34095
|
{
|
|
34025
34096
|
contentClassName: "p-1",
|
|
34026
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.
|
|
34027
|
-
}, title: t("toolbar.textStyle"), className: "px-1.5 w-auto gap-0.5", children:
|
|
34028
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaTextStyleIcon, { className: "h-4 w-4" }),
|
|
34029
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaChevronDownIcon, { className: "h-2.5 w-2.5" })
|
|
34030
|
-
] }),
|
|
34097
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => {
|
|
34098
|
+
}, title: t("toolbar.textStyle"), className: "px-1.5 w-auto gap-0.5", children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaTextStyleIcon, { className: "h-4 w-4" }) }),
|
|
34031
34099
|
children: [
|
|
34032
34100
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34033
34101
|
DropdownMenuItem,
|
|
@@ -34206,11 +34274,8 @@ var EditorToolbar = ({
|
|
|
34206
34274
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34207
34275
|
DropdownMenu,
|
|
34208
34276
|
{
|
|
34209
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.
|
|
34210
|
-
}, title: t("colors.textColor"), children:
|
|
34211
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(TextColorIcon, { color: currentTextColor }),
|
|
34212
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaChevronDownIcon, { className: "h-2.5 w-2.5" })
|
|
34213
|
-
] }),
|
|
34277
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => {
|
|
34278
|
+
}, title: t("colors.textColor"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(TextColorIcon, { color: currentTextColor }) }),
|
|
34214
34279
|
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34215
34280
|
EditorColorPalette,
|
|
34216
34281
|
{
|
|
@@ -34231,11 +34296,8 @@ var EditorToolbar = ({
|
|
|
34231
34296
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34232
34297
|
DropdownMenu,
|
|
34233
34298
|
{
|
|
34234
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.
|
|
34235
|
-
}, active: editor.isActive("highlight"), title: t("colors.highlight"), children:
|
|
34236
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(HighlightColorIcon, { color: currentHighlightColor }),
|
|
34237
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaChevronDownIcon, { className: "h-2.5 w-2.5" })
|
|
34238
|
-
] }),
|
|
34299
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => {
|
|
34300
|
+
}, active: editor.isActive("highlight"), title: t("colors.highlight"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(HighlightColorIcon, { color: currentHighlightColor }) }),
|
|
34239
34301
|
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34240
34302
|
EditorColorPalette,
|
|
34241
34303
|
{
|
|
@@ -34253,35 +34315,13 @@ var EditorToolbar = ({
|
|
|
34253
34315
|
)
|
|
34254
34316
|
}
|
|
34255
34317
|
),
|
|
34256
|
-
(isMediumFull || isFull) && /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
|
|
34257
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarDivider, {}),
|
|
34258
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34259
|
-
DropdownMenu,
|
|
34260
|
-
{
|
|
34261
|
-
contentClassName: "p-0 overflow-hidden",
|
|
34262
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => {
|
|
34263
|
-
}, title: t("toolbar.emoji"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaSmileIcon, { className: "h-4 w-4" }) }),
|
|
34264
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34265
|
-
EmojiPicker2,
|
|
34266
|
-
{
|
|
34267
|
-
onSelect: (emoji) => {
|
|
34268
|
-
editor.chain().focus().insertContent(emoji).run();
|
|
34269
|
-
}
|
|
34270
|
-
}
|
|
34271
|
-
)
|
|
34272
|
-
}
|
|
34273
|
-
)
|
|
34274
|
-
] }),
|
|
34275
34318
|
(isMediumFull || isFull) && /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
|
|
34276
34319
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarDivider, {}),
|
|
34277
34320
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
34278
34321
|
DropdownMenu,
|
|
34279
34322
|
{
|
|
34280
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.
|
|
34281
|
-
}, title: t("toolbar.alignment"), children:
|
|
34282
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaAlignLeftIcon, { className: "h-4 w-4" }),
|
|
34283
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaChevronDownIcon, { className: "h-2.5 w-2.5" })
|
|
34284
|
-
] }),
|
|
34323
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => {
|
|
34324
|
+
}, title: t("toolbar.alignment"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaAlignLeftIcon, { className: "h-4 w-4" }) }),
|
|
34285
34325
|
children: [
|
|
34286
34326
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34287
34327
|
DropdownMenuItem,
|
|
@@ -34355,11 +34395,8 @@ var EditorToolbar = ({
|
|
|
34355
34395
|
hasTableContext && /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
34356
34396
|
DropdownMenu,
|
|
34357
34397
|
{
|
|
34358
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.
|
|
34359
|
-
}, title: t("tableMenu.textDirection"), children:
|
|
34360
|
-
currentCellTextDirection === "vertical" ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.ArrowDown, { className: "w-4 h-4" }) : /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.ArrowRight, { className: "w-4 h-4" }),
|
|
34361
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.ChevronDown, { className: "w-3 h-3" })
|
|
34362
|
-
] }),
|
|
34398
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => {
|
|
34399
|
+
}, title: t("tableMenu.textDirection"), children: currentCellTextDirection === "vertical" ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.ArrowDown, { className: "w-4 h-4" }) : /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.ArrowRight, { className: "w-4 h-4" }) }),
|
|
34363
34400
|
children: [
|
|
34364
34401
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34365
34402
|
DropdownMenuItem,
|
|
@@ -34387,11 +34424,8 @@ var EditorToolbar = ({
|
|
|
34387
34424
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
34388
34425
|
DropdownMenu,
|
|
34389
34426
|
{
|
|
34390
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.
|
|
34391
|
-
}, title: t("toolbar.bulletList"), children:
|
|
34392
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaListIcon, { className: "h-4 w-4" }),
|
|
34393
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaChevronDownIcon, { className: "h-2.5 w-2.5" })
|
|
34394
|
-
] }),
|
|
34427
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => {
|
|
34428
|
+
}, title: t("toolbar.bulletList"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaListIcon, { className: "h-4 w-4" }) }),
|
|
34395
34429
|
children: [
|
|
34396
34430
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34397
34431
|
DropdownMenuItem,
|
|
@@ -34429,11 +34463,8 @@ var EditorToolbar = ({
|
|
|
34429
34463
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
34430
34464
|
DropdownMenu,
|
|
34431
34465
|
{
|
|
34432
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.
|
|
34433
|
-
}, active: editor.isActive("formCheckbox"), title: t("slashCommand.formCheckbox"), children:
|
|
34434
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.SquareCheckBig, { className: "w-4 h-4" }),
|
|
34435
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.ChevronDown, { className: "w-3 h-3" })
|
|
34436
|
-
] }),
|
|
34466
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => {
|
|
34467
|
+
}, active: editor.isActive("formCheckbox"), title: t("slashCommand.formCheckbox"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.SquareCheckBig, { className: "w-4 h-4" }) }),
|
|
34437
34468
|
children: [
|
|
34438
34469
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34439
34470
|
DropdownMenuItem,
|
|
@@ -34458,11 +34489,8 @@ var EditorToolbar = ({
|
|
|
34458
34489
|
isFull && /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
34459
34490
|
DropdownMenu,
|
|
34460
34491
|
{
|
|
34461
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.
|
|
34462
|
-
}, title: t("toolbar.quote"), children:
|
|
34463
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaQuoteIcon, { className: "h-4 w-4" }),
|
|
34464
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaChevronDownIcon, { className: "h-2.5 w-2.5" })
|
|
34465
|
-
] }),
|
|
34492
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => {
|
|
34493
|
+
}, title: t("toolbar.quote"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaQuoteIcon, { className: "h-4 w-4" }) }),
|
|
34466
34494
|
children: [
|
|
34467
34495
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34468
34496
|
DropdownMenuItem,
|
|
@@ -34490,11 +34518,8 @@ var EditorToolbar = ({
|
|
|
34490
34518
|
(isMediumFull || isFull) && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34491
34519
|
DropdownMenu,
|
|
34492
34520
|
{
|
|
34493
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.
|
|
34494
|
-
}, title: t("toolbar.image"), children:
|
|
34495
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaImageIcon, { className: "h-4 w-4" }),
|
|
34496
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaChevronDownIcon, { className: "h-2.5 w-2.5" })
|
|
34497
|
-
] }),
|
|
34521
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => {
|
|
34522
|
+
}, title: t("toolbar.image"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaImageIcon, { className: "h-4 w-4" }) }),
|
|
34498
34523
|
children: showImageInput ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34499
34524
|
ImageInput,
|
|
34500
34525
|
{
|
|
@@ -34614,149 +34639,25 @@ var EditorToolbar = ({
|
|
|
34614
34639
|
] })
|
|
34615
34640
|
}
|
|
34616
34641
|
),
|
|
34617
|
-
(isMediumFull || isFull) && /* @__PURE__ */ (0, import_jsx_runtime93.
|
|
34642
|
+
(isMediumFull || isFull) && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34618
34643
|
DropdownMenu,
|
|
34619
34644
|
{
|
|
34620
34645
|
isOpen: isTableMenuOpen,
|
|
34621
|
-
onOpenChange:
|
|
34622
|
-
|
|
34623
|
-
|
|
34624
|
-
},
|
|
34625
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(ToolbarButton, { onClick: () => {
|
|
34626
|
-
}, title: t("toolbar.table"), children: [
|
|
34627
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaTableIcon, { className: "h-4 w-4" }),
|
|
34628
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaChevronDownIcon, { className: "h-2.5 w-2.5" })
|
|
34629
|
-
] }),
|
|
34646
|
+
onOpenChange: setIsTableMenuOpen,
|
|
34647
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => {
|
|
34648
|
+
}, title: t("toolbar.table"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaTableIcon, { className: "h-4 w-4" }) }),
|
|
34630
34649
|
contentClassName: "p-2 min-w-56",
|
|
34631
|
-
children:
|
|
34632
|
-
|
|
34633
|
-
|
|
34634
|
-
|
|
34635
|
-
|
|
34636
|
-
|
|
34637
|
-
|
|
34638
|
-
|
|
34639
|
-
setIsTableMenuOpen(false);
|
|
34640
|
-
setPreservedTableAnchorPos(null);
|
|
34641
|
-
}
|
|
34642
|
-
}
|
|
34643
|
-
),
|
|
34644
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "my-1 border-t" }),
|
|
34645
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34646
|
-
DropdownMenuItem,
|
|
34647
|
-
{
|
|
34648
|
-
icon: import_lucide_react52.AlignLeft,
|
|
34649
|
-
label: t("tableMenu.alignLeft"),
|
|
34650
|
-
onClick: () => applyTableAlignment(editor, "left", tableCommandAnchorPos),
|
|
34651
|
-
active: hasTableContext && currentTableAlign === "left",
|
|
34652
|
-
disabled: !hasTableContext
|
|
34653
|
-
}
|
|
34654
|
-
),
|
|
34655
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34656
|
-
DropdownMenuItem,
|
|
34657
|
-
{
|
|
34658
|
-
icon: import_lucide_react52.AlignCenter,
|
|
34659
|
-
label: t("tableMenu.alignCenter"),
|
|
34660
|
-
onClick: () => applyTableAlignment(editor, "center", tableCommandAnchorPos),
|
|
34661
|
-
active: hasTableContext && currentTableAlign === "center",
|
|
34662
|
-
disabled: !hasTableContext
|
|
34663
|
-
}
|
|
34664
|
-
),
|
|
34665
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34666
|
-
DropdownMenuItem,
|
|
34667
|
-
{
|
|
34668
|
-
icon: import_lucide_react52.AlignRight,
|
|
34669
|
-
label: t("tableMenu.alignRight"),
|
|
34670
|
-
onClick: () => applyTableAlignment(editor, "right", tableCommandAnchorPos),
|
|
34671
|
-
active: hasTableContext && currentTableAlign === "right",
|
|
34672
|
-
disabled: !hasTableContext
|
|
34673
|
-
}
|
|
34674
|
-
),
|
|
34675
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "my-1 border-t" }),
|
|
34676
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34677
|
-
DropdownMenuItem,
|
|
34678
|
-
{
|
|
34679
|
-
icon: import_lucide_react52.ArrowLeft,
|
|
34680
|
-
label: t("tableMenu.addColumnBefore"),
|
|
34681
|
-
onClick: () => editor.chain().focus().addColumnBefore().run(),
|
|
34682
|
-
disabled: !hasTableContext || !editor.can().addColumnBefore()
|
|
34683
|
-
}
|
|
34684
|
-
),
|
|
34685
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34686
|
-
DropdownMenuItem,
|
|
34687
|
-
{
|
|
34688
|
-
icon: import_lucide_react52.ArrowDown,
|
|
34689
|
-
label: t("tableMenu.addColumnAfter"),
|
|
34690
|
-
onClick: () => editor.chain().focus().addColumnAfter().run(),
|
|
34691
|
-
disabled: !hasTableContext || !editor.can().addColumnAfter()
|
|
34692
|
-
}
|
|
34693
|
-
),
|
|
34694
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34695
|
-
DropdownMenuItem,
|
|
34696
|
-
{
|
|
34697
|
-
icon: import_lucide_react52.ArrowUp,
|
|
34698
|
-
label: t("tableMenu.addRowBefore"),
|
|
34699
|
-
onClick: () => editor.chain().focus().addRowBefore().run(),
|
|
34700
|
-
disabled: !hasTableContext || !editor.can().addRowBefore()
|
|
34701
|
-
}
|
|
34702
|
-
),
|
|
34703
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34704
|
-
DropdownMenuItem,
|
|
34705
|
-
{
|
|
34706
|
-
icon: import_lucide_react52.ArrowRight,
|
|
34707
|
-
label: t("tableMenu.addRowAfter"),
|
|
34708
|
-
onClick: () => editor.chain().focus().addRowAfter().run(),
|
|
34709
|
-
disabled: !hasTableContext || !editor.can().addRowAfter()
|
|
34710
|
-
}
|
|
34711
|
-
),
|
|
34712
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "my-1 border-t" }),
|
|
34713
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34714
|
-
DropdownMenuItem,
|
|
34715
|
-
{
|
|
34716
|
-
icon: import_lucide_react52.Table,
|
|
34717
|
-
label: t("tableMenu.toggleHeaderRow"),
|
|
34718
|
-
onClick: () => editor.chain().focus().toggleHeaderRow().run(),
|
|
34719
|
-
disabled: !hasTableContext || !editor.can().toggleHeaderRow()
|
|
34720
|
-
}
|
|
34721
|
-
),
|
|
34722
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34723
|
-
DropdownMenuItem,
|
|
34724
|
-
{
|
|
34725
|
-
icon: import_lucide_react52.Table,
|
|
34726
|
-
label: t("tableMenu.toggleHeaderColumn"),
|
|
34727
|
-
onClick: () => editor.chain().focus().toggleHeaderColumn().run(),
|
|
34728
|
-
disabled: !hasTableContext || !editor.can().toggleHeaderColumn()
|
|
34729
|
-
}
|
|
34730
|
-
),
|
|
34731
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "my-1 border-t" }),
|
|
34732
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34733
|
-
DropdownMenuItem,
|
|
34734
|
-
{
|
|
34735
|
-
icon: import_lucide_react52.Trash2,
|
|
34736
|
-
label: t("tableMenu.deleteColumn"),
|
|
34737
|
-
onClick: () => editor.chain().focus().deleteColumn().run(),
|
|
34738
|
-
disabled: !hasTableContext || !editor.can().deleteColumn()
|
|
34739
|
-
}
|
|
34740
|
-
),
|
|
34741
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34742
|
-
DropdownMenuItem,
|
|
34743
|
-
{
|
|
34744
|
-
icon: import_lucide_react52.Trash2,
|
|
34745
|
-
label: t("tableMenu.deleteRow"),
|
|
34746
|
-
onClick: () => editor.chain().focus().deleteRow().run(),
|
|
34747
|
-
disabled: !hasTableContext || !editor.can().deleteRow()
|
|
34748
|
-
}
|
|
34749
|
-
),
|
|
34750
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34751
|
-
DropdownMenuItem,
|
|
34752
|
-
{
|
|
34753
|
-
icon: import_lucide_react52.Trash2,
|
|
34754
|
-
label: t("tableMenu.deleteTable"),
|
|
34755
|
-
onClick: () => editor.chain().focus().deleteTable().run(),
|
|
34756
|
-
disabled: !hasTableContext || !editor.can().deleteTable()
|
|
34650
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34651
|
+
TableInsertGrid,
|
|
34652
|
+
{
|
|
34653
|
+
insertLabel: t("tableMenu.insertTable"),
|
|
34654
|
+
previewTemplate: t("tableMenu.gridPreview"),
|
|
34655
|
+
onInsert: (rows, cols) => {
|
|
34656
|
+
editor.chain().focus().insertTable({ rows, cols, withHeaderRow: true }).run();
|
|
34657
|
+
setIsTableMenuOpen(false);
|
|
34757
34658
|
}
|
|
34758
|
-
|
|
34759
|
-
|
|
34659
|
+
}
|
|
34660
|
+
)
|
|
34760
34661
|
}
|
|
34761
34662
|
),
|
|
34762
34663
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarDivider, {}),
|
|
@@ -35944,7 +35845,7 @@ var FloatingMenuContent = ({ editor }) => {
|
|
|
35944
35845
|
{
|
|
35945
35846
|
type: "button",
|
|
35946
35847
|
onClick: () => setShowCommands(true),
|
|
35947
|
-
className: "flex items-center gap-1 px-2 py-1.5
|
|
35848
|
+
className: "group flex items-center gap-1 rounded-lg px-2 py-1.5 transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",
|
|
35948
35849
|
children: [
|
|
35949
35850
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.Plus, { className: "w-4 h-4 text-muted-foreground group-hover:text-foreground" }),
|
|
35950
35851
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "text-sm text-muted-foreground group-hover:text-foreground", children: t("floatingMenu.addBlock") })
|
|
@@ -36018,15 +35919,23 @@ function BorderPositionPreviewIcon({ position }) {
|
|
|
36018
35919
|
showVertical && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("path", { d: "M10 2V18", strokeWidth: "2" })
|
|
36019
35920
|
] });
|
|
36020
35921
|
}
|
|
35922
|
+
function getBubbleMenuContext(editor) {
|
|
35923
|
+
const { selection } = editor.state;
|
|
35924
|
+
if (editor.isActive("image")) return "image";
|
|
35925
|
+
if (selection instanceof import_tables7.CellSelection) return "table-cell";
|
|
35926
|
+
if (editor.isActive("link")) return "link";
|
|
35927
|
+
if (!selection.empty) return "text";
|
|
35928
|
+
return "none";
|
|
35929
|
+
}
|
|
36021
35930
|
var BubbleMenuContent = ({
|
|
36022
35931
|
editor,
|
|
35932
|
+
context,
|
|
36023
35933
|
onKeepOpenChange,
|
|
36024
35934
|
onLinkInputOpenChange,
|
|
36025
35935
|
onRequestClose,
|
|
36026
35936
|
fontSizes,
|
|
36027
35937
|
lineHeights,
|
|
36028
|
-
initialShowLinkInput = false
|
|
36029
|
-
cellBorderOpenRequest = 0
|
|
35938
|
+
initialShowLinkInput = false
|
|
36030
35939
|
}) => {
|
|
36031
35940
|
const t = useSmartTranslations("UEditor");
|
|
36032
35941
|
(0, import_react75.useEditorState)({
|
|
@@ -36039,17 +35948,13 @@ var BubbleMenuContent = ({
|
|
|
36039
35948
|
(0, import_react74.useEffect)(() => {
|
|
36040
35949
|
setShowLinkInput(initialShowLinkInput);
|
|
36041
35950
|
}, [initialShowLinkInput]);
|
|
36042
|
-
(0, import_react74.useEffect)(() => {
|
|
36043
|
-
if (!cellBorderOpenRequest) return;
|
|
36044
|
-
setActiveColorPalette("cell-border");
|
|
36045
|
-
onKeepOpenChange?.(true);
|
|
36046
|
-
}, [cellBorderOpenRequest, onKeepOpenChange]);
|
|
36047
35951
|
const [showTypographyPanel, setShowTypographyPanel] = (0, import_react74.useState)(false);
|
|
36048
35952
|
const [showFormulaPanel, setShowFormulaPanel] = (0, import_react74.useState)(false);
|
|
36049
35953
|
const [formulaDraft, setFormulaDraft] = (0, import_react74.useState)("");
|
|
36050
35954
|
const [showFontSizeOptions, setShowFontSizeOptions] = (0, import_react74.useState)(false);
|
|
36051
35955
|
const [fontSizeDraft, setFontSizeDraft] = (0, import_react74.useState)("");
|
|
36052
|
-
const isImageSelected =
|
|
35956
|
+
const isImageSelected = context === "image";
|
|
35957
|
+
const isTableCellSelection = context === "table-cell";
|
|
36053
35958
|
const imageAttrs = editor.getAttributes("image");
|
|
36054
35959
|
const imageLayout = imageAttrs.imageLayout === "left" || imageAttrs.imageLayout === "right" ? imageAttrs.imageLayout : "block";
|
|
36055
35960
|
const imageWidthPreset = imageAttrs.imageWidthPreset === "sm" || imageAttrs.imageWidthPreset === "md" || imageAttrs.imageWidthPreset === "lg" ? imageAttrs.imageWidthPreset : null;
|
|
@@ -36112,12 +36017,10 @@ var BubbleMenuContent = ({
|
|
|
36112
36017
|
setFontSizeDraft(String(clamped));
|
|
36113
36018
|
};
|
|
36114
36019
|
(0, import_react74.useEffect)(() => {
|
|
36115
|
-
|
|
36020
|
+
const shouldKeepOpen = showLinkInput || Boolean(activeColorPalette) || showFormulaPanel || showTypographyPanel;
|
|
36021
|
+
onKeepOpenChange?.(shouldKeepOpen);
|
|
36116
36022
|
onLinkInputOpenChange?.(showLinkInput);
|
|
36117
|
-
}, [onKeepOpenChange, onLinkInputOpenChange, showLinkInput]);
|
|
36118
|
-
(0, import_react74.useEffect)(() => {
|
|
36119
|
-
onKeepOpenChange?.(Boolean(activeColorPalette));
|
|
36120
|
-
}, [activeColorPalette, onKeepOpenChange]);
|
|
36023
|
+
}, [activeColorPalette, onKeepOpenChange, onLinkInputOpenChange, showFormulaPanel, showLinkInput, showTypographyPanel]);
|
|
36121
36024
|
const closeTransientPanels = (0, import_react74.useCallback)(() => {
|
|
36122
36025
|
setActiveColorPalette(null);
|
|
36123
36026
|
setShowLinkInput(false);
|
|
@@ -36676,38 +36579,8 @@ var BubbleMenuContent = ({
|
|
|
36676
36579
|
] });
|
|
36677
36580
|
}
|
|
36678
36581
|
const VerticalAlignActiveIcon = currentCellVerticalAlign === "middle" ? import_lucide_react53.AlignCenterVertical : currentCellVerticalAlign === "bottom" ? import_lucide_react53.AlignEndVertical : import_lucide_react53.AlignStartVertical;
|
|
36679
|
-
|
|
36680
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.
|
|
36681
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.Italic, { className: "w-4 h-4" }) }),
|
|
36682
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36683
|
-
ToolbarButton,
|
|
36684
|
-
{
|
|
36685
|
-
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
36686
|
-
active: editor.isActive("underline"),
|
|
36687
|
-
title: t("toolbar.underline"),
|
|
36688
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.Underline, { className: "w-4 h-4" })
|
|
36689
|
-
}
|
|
36690
|
-
),
|
|
36691
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleStrike().run(), active: editor.isActive("strike"), title: t("toolbar.strike"), children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.Strikethrough, { className: "w-4 h-4" }) }),
|
|
36692
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleCode().run(), active: editor.isActive("code"), title: t("toolbar.code"), children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.Code, { className: "w-4 h-4" }) }),
|
|
36693
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
36694
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36695
|
-
ToolbarButton,
|
|
36696
|
-
{
|
|
36697
|
-
onMouseDown: () => {
|
|
36698
|
-
onKeepOpenChange?.(true);
|
|
36699
|
-
},
|
|
36700
|
-
onClick: () => {
|
|
36701
|
-
setShowLinkInput(true);
|
|
36702
|
-
},
|
|
36703
|
-
active: editor.isActive("link"),
|
|
36704
|
-
title: t("toolbar.link"),
|
|
36705
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.Link, { className: "w-4 h-4" })
|
|
36706
|
-
}
|
|
36707
|
-
),
|
|
36708
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ToolbarButton, { onClick: () => setActiveColorPalette("text"), title: t("colors.textColor"), children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(TextColorIcon, { color: currentTextColor }) }),
|
|
36709
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ToolbarButton, { onClick: () => setActiveColorPalette("highlight"), active: editor.isActive("highlight"), title: t("colors.highlight"), children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(HighlightColorIcon, { color: currentHighlightColor }) }),
|
|
36710
|
-
isInTable2 && /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(import_jsx_runtime94.Fragment, { children: [
|
|
36582
|
+
if (isTableCellSelection) {
|
|
36583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "flex items-center gap-0.5 p-1", "data-ueditor-cell-inspector": "", children: [
|
|
36711
36584
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36712
36585
|
ToolbarButton,
|
|
36713
36586
|
{
|
|
@@ -36720,9 +36593,7 @@ var BubbleMenuContent = ({
|
|
|
36720
36593
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36721
36594
|
ToolbarButton,
|
|
36722
36595
|
{
|
|
36723
|
-
onMouseDown: () =>
|
|
36724
|
-
onKeepOpenChange?.(true);
|
|
36725
|
-
},
|
|
36596
|
+
onMouseDown: () => onKeepOpenChange?.(true),
|
|
36726
36597
|
onClick: () => setActiveColorPalette("cell-border"),
|
|
36727
36598
|
active: Boolean(
|
|
36728
36599
|
editor.getAttributes("tableCell").borderColor || editor.getAttributes("tableHeader").borderColor || editor.getAttributes("tableCell").borderStyle || editor.getAttributes("tableHeader").borderStyle || editor.getAttributes("tableCell").borderWidth || editor.getAttributes("tableHeader").borderWidth
|
|
@@ -36739,9 +36610,7 @@ var BubbleMenuContent = ({
|
|
|
36739
36610
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36740
36611
|
ToolbarButton,
|
|
36741
36612
|
{
|
|
36742
|
-
onMouseDown: () =>
|
|
36743
|
-
onKeepOpenChange?.(true);
|
|
36744
|
-
},
|
|
36613
|
+
onMouseDown: () => onKeepOpenChange?.(true),
|
|
36745
36614
|
onClick: () => {
|
|
36746
36615
|
setFormulaDraft(currentCellFormula);
|
|
36747
36616
|
setShowFormulaPanel(true);
|
|
@@ -36770,15 +36639,11 @@ var BubbleMenuContent = ({
|
|
|
36770
36639
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
|
|
36771
36640
|
DropdownMenu,
|
|
36772
36641
|
{
|
|
36773
|
-
onOpenChange:
|
|
36774
|
-
onKeepOpenChange?.(open);
|
|
36775
|
-
},
|
|
36642
|
+
onOpenChange: onKeepOpenChange,
|
|
36776
36643
|
trigger: /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
|
|
36777
36644
|
ToolbarButton,
|
|
36778
36645
|
{
|
|
36779
|
-
onMouseDown: () =>
|
|
36780
|
-
onKeepOpenChange?.(true);
|
|
36781
|
-
},
|
|
36646
|
+
onMouseDown: () => onKeepOpenChange?.(true),
|
|
36782
36647
|
onClick: () => {
|
|
36783
36648
|
},
|
|
36784
36649
|
title: t("tableMenu.alignVertical") || "Vertical alignment",
|
|
@@ -36822,15 +36687,11 @@ var BubbleMenuContent = ({
|
|
|
36822
36687
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
|
|
36823
36688
|
DropdownMenu,
|
|
36824
36689
|
{
|
|
36825
|
-
onOpenChange:
|
|
36826
|
-
onKeepOpenChange?.(open);
|
|
36827
|
-
},
|
|
36690
|
+
onOpenChange: onKeepOpenChange,
|
|
36828
36691
|
trigger: /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
|
|
36829
36692
|
ToolbarButton,
|
|
36830
36693
|
{
|
|
36831
|
-
onMouseDown: () =>
|
|
36832
|
-
onKeepOpenChange?.(true);
|
|
36833
|
-
},
|
|
36694
|
+
onMouseDown: () => onKeepOpenChange?.(true),
|
|
36834
36695
|
onClick: () => {
|
|
36835
36696
|
},
|
|
36836
36697
|
title: t("tableMenu.textDirection"),
|
|
@@ -36862,7 +36723,39 @@ var BubbleMenuContent = ({
|
|
|
36862
36723
|
]
|
|
36863
36724
|
}
|
|
36864
36725
|
)
|
|
36865
|
-
] })
|
|
36726
|
+
] });
|
|
36727
|
+
}
|
|
36728
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "flex items-center gap-0.5 p-1", children: [
|
|
36729
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.Bold, { className: "w-4 h-4" }) }),
|
|
36730
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.Italic, { className: "w-4 h-4" }) }),
|
|
36731
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36732
|
+
ToolbarButton,
|
|
36733
|
+
{
|
|
36734
|
+
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
36735
|
+
active: editor.isActive("underline"),
|
|
36736
|
+
title: t("toolbar.underline"),
|
|
36737
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.Underline, { className: "w-4 h-4" })
|
|
36738
|
+
}
|
|
36739
|
+
),
|
|
36740
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleStrike().run(), active: editor.isActive("strike"), title: t("toolbar.strike"), children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.Strikethrough, { className: "w-4 h-4" }) }),
|
|
36741
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleCode().run(), active: editor.isActive("code"), title: t("toolbar.code"), children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.Code, { className: "w-4 h-4" }) }),
|
|
36742
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
36743
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36744
|
+
ToolbarButton,
|
|
36745
|
+
{
|
|
36746
|
+
onMouseDown: () => {
|
|
36747
|
+
onKeepOpenChange?.(true);
|
|
36748
|
+
},
|
|
36749
|
+
onClick: () => {
|
|
36750
|
+
setShowLinkInput(true);
|
|
36751
|
+
},
|
|
36752
|
+
active: editor.isActive("link"),
|
|
36753
|
+
title: t("toolbar.link"),
|
|
36754
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.Link, { className: "w-4 h-4" })
|
|
36755
|
+
}
|
|
36756
|
+
),
|
|
36757
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ToolbarButton, { onClick: () => setActiveColorPalette("text"), title: t("colors.textColor"), children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(TextColorIcon, { color: currentTextColor }) }),
|
|
36758
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ToolbarButton, { onClick: () => setActiveColorPalette("highlight"), active: editor.isActive("highlight"), title: t("colors.highlight"), children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(HighlightColorIcon, { color: currentHighlightColor }) }),
|
|
36866
36759
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36867
36760
|
ToolbarButton,
|
|
36868
36761
|
{
|
|
@@ -36902,7 +36795,6 @@ var CustomBubbleMenu = ({
|
|
|
36902
36795
|
const BUBBLE_MENU_ESTIMATED_HEIGHT = 44;
|
|
36903
36796
|
const [isVisible, setIsVisible] = (0, import_react74.useState)(false);
|
|
36904
36797
|
const [linkInputOpen, setLinkInputOpen] = (0, import_react74.useState)(false);
|
|
36905
|
-
const [cellBorderOpenRequest, setCellBorderOpenRequest] = (0, import_react74.useState)(0);
|
|
36906
36798
|
const [position, setPosition2] = (0, import_react74.useState)({
|
|
36907
36799
|
top: 0,
|
|
36908
36800
|
left: 0,
|
|
@@ -36939,14 +36831,14 @@ var CustomBubbleMenu = ({
|
|
|
36939
36831
|
};
|
|
36940
36832
|
const updatePosition = () => {
|
|
36941
36833
|
const { state, view } = editor;
|
|
36942
|
-
const { from, to
|
|
36943
|
-
const
|
|
36834
|
+
const { from, to } = state.selection;
|
|
36835
|
+
const context2 = getBubbleMenuContext(editor);
|
|
36944
36836
|
if (Date.now() < suppressShowUntilRef.current) {
|
|
36945
36837
|
clearShowTimeout();
|
|
36946
36838
|
setIsVisible(false);
|
|
36947
36839
|
return;
|
|
36948
36840
|
}
|
|
36949
|
-
if (!keepOpenRef.current && (
|
|
36841
|
+
if (!keepOpenRef.current && (context2 === "none" || !view.hasFocus())) {
|
|
36950
36842
|
clearShowTimeout();
|
|
36951
36843
|
setIsVisible(false);
|
|
36952
36844
|
return;
|
|
@@ -37017,8 +36909,6 @@ var CustomBubbleMenu = ({
|
|
|
37017
36909
|
const handlePointerDown = (event) => {
|
|
37018
36910
|
const target = event.target;
|
|
37019
36911
|
if (target && (menuRef.current?.contains(target) || target.closest("[data-ueditor-keep-open]"))) return;
|
|
37020
|
-
const table = target?.closest("table");
|
|
37021
|
-
if (table && editor.view.dom.contains(table)) return;
|
|
37022
36912
|
closeBubbleMenu(false);
|
|
37023
36913
|
};
|
|
37024
36914
|
const handleKeyDown2 = (event) => {
|
|
@@ -37031,23 +36921,9 @@ var CustomBubbleMenu = ({
|
|
|
37031
36921
|
document.removeEventListener("keydown", handleKeyDown2);
|
|
37032
36922
|
};
|
|
37033
36923
|
}, [closeBubbleMenu, editor, isVisible]);
|
|
37034
|
-
(0, import_react74.useEffect)(() => {
|
|
37035
|
-
const handleTableDoubleClick = (event) => {
|
|
37036
|
-
const target = event.target;
|
|
37037
|
-
const cell = target?.closest("td,th");
|
|
37038
|
-
if (!cell || !editor.view.dom.contains(cell)) return;
|
|
37039
|
-
suppressShowUntilRef.current = 0;
|
|
37040
|
-
keepOpenRef.current = true;
|
|
37041
|
-
setKeepOpenState(true);
|
|
37042
|
-
setLinkInputOpen(false);
|
|
37043
|
-
setCellBorderOpenRequest((request) => request + 1);
|
|
37044
|
-
setIsVisible(true);
|
|
37045
|
-
requestAnimationFrame(() => editor.view.focus());
|
|
37046
|
-
};
|
|
37047
|
-
editor.view.dom.addEventListener("dblclick", handleTableDoubleClick);
|
|
37048
|
-
return () => editor.view.dom.removeEventListener("dblclick", handleTableDoubleClick);
|
|
37049
|
-
}, [editor]);
|
|
37050
36924
|
if (!isVisible) return null;
|
|
36925
|
+
const context = getBubbleMenuContext(editor);
|
|
36926
|
+
if (context === "none") return null;
|
|
37051
36927
|
return (0, import_react_dom8.createPortal)(
|
|
37052
36928
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
37053
36929
|
"div",
|
|
@@ -37069,7 +36945,7 @@ var CustomBubbleMenu = ({
|
|
|
37069
36945
|
}
|
|
37070
36946
|
e.preventDefault();
|
|
37071
36947
|
},
|
|
37072
|
-
children:
|
|
36948
|
+
children: context === "link" && !keepOpen && !linkInputOpen ? /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
37073
36949
|
LinkPreviewContent,
|
|
37074
36950
|
{
|
|
37075
36951
|
editor,
|
|
@@ -37082,14 +36958,15 @@ var CustomBubbleMenu = ({
|
|
|
37082
36958
|
BubbleMenuContent,
|
|
37083
36959
|
{
|
|
37084
36960
|
editor,
|
|
36961
|
+
context,
|
|
37085
36962
|
onKeepOpenChange: setKeepOpen,
|
|
37086
36963
|
onLinkInputOpenChange: setLinkInputOpen,
|
|
37087
36964
|
onRequestClose: closeBubbleMenu,
|
|
37088
36965
|
fontSizes,
|
|
37089
36966
|
lineHeights,
|
|
37090
|
-
initialShowLinkInput: linkInputOpen
|
|
37091
|
-
|
|
37092
|
-
|
|
36967
|
+
initialShowLinkInput: linkInputOpen
|
|
36968
|
+
},
|
|
36969
|
+
context
|
|
37093
36970
|
)
|
|
37094
36971
|
}
|
|
37095
36972
|
),
|
|
@@ -37642,7 +37519,7 @@ function findDiffEnd(a, b, posA, posB) {
|
|
|
37642
37519
|
posB -= size;
|
|
37643
37520
|
}
|
|
37644
37521
|
}
|
|
37645
|
-
var
|
|
37522
|
+
var Fragment30 = class _Fragment {
|
|
37646
37523
|
/**
|
|
37647
37524
|
@internal
|
|
37648
37525
|
*/
|
|
@@ -37934,7 +37811,7 @@ var Fragment31 = class _Fragment {
|
|
|
37934
37811
|
throw new RangeError("Can not convert " + nodes + " to a Fragment" + (nodes.nodesBetween ? " (looks like multiple versions of prosemirror-model were loaded)" : ""));
|
|
37935
37812
|
}
|
|
37936
37813
|
};
|
|
37937
|
-
|
|
37814
|
+
Fragment30.empty = new Fragment30([], 0);
|
|
37938
37815
|
var found = { index: 0, offset: 0 };
|
|
37939
37816
|
function retIndex(index, offset) {
|
|
37940
37817
|
found.index = index;
|
|
@@ -38159,7 +38036,7 @@ var Slice = class _Slice {
|
|
|
38159
38036
|
let openStart = json.openStart || 0, openEnd = json.openEnd || 0;
|
|
38160
38037
|
if (typeof openStart != "number" || typeof openEnd != "number")
|
|
38161
38038
|
throw new RangeError("Invalid input for Slice.fromJSON");
|
|
38162
|
-
return new _Slice(
|
|
38039
|
+
return new _Slice(Fragment30.fromJSON(schema, json.content), openStart, openEnd);
|
|
38163
38040
|
}
|
|
38164
38041
|
/**
|
|
38165
38042
|
Create a slice from a fragment by taking the maximum possible
|
|
@@ -38174,7 +38051,7 @@ var Slice = class _Slice {
|
|
|
38174
38051
|
return new _Slice(fragment, openStart, openEnd);
|
|
38175
38052
|
}
|
|
38176
38053
|
};
|
|
38177
|
-
Slice.empty = new Slice(
|
|
38054
|
+
Slice.empty = new Slice(Fragment30.empty, 0, 0);
|
|
38178
38055
|
function removeRange(content, from, to) {
|
|
38179
38056
|
let { index, offset } = content.findIndex(from), child = content.maybeChild(index);
|
|
38180
38057
|
let { index: indexTo, offset: offsetTo } = content.findIndex(to);
|
|
@@ -38272,7 +38149,7 @@ function replaceThreeWay($from, $start, $end, $to, depth) {
|
|
|
38272
38149
|
addNode(close(openEnd, replaceTwoWay($end, $to, depth + 1)), content);
|
|
38273
38150
|
}
|
|
38274
38151
|
addRange($to, null, depth, content);
|
|
38275
|
-
return new
|
|
38152
|
+
return new Fragment30(content);
|
|
38276
38153
|
}
|
|
38277
38154
|
function replaceTwoWay($from, $to, depth) {
|
|
38278
38155
|
let content = [];
|
|
@@ -38282,13 +38159,13 @@ function replaceTwoWay($from, $to, depth) {
|
|
|
38282
38159
|
addNode(close(type, replaceTwoWay($from, $to, depth + 1)), content);
|
|
38283
38160
|
}
|
|
38284
38161
|
addRange($to, null, depth, content);
|
|
38285
|
-
return new
|
|
38162
|
+
return new Fragment30(content);
|
|
38286
38163
|
}
|
|
38287
38164
|
function prepareSliceForReplace(slice, $along) {
|
|
38288
38165
|
let extra = $along.depth - slice.openStart, parent = $along.node(extra);
|
|
38289
38166
|
let node = parent.copy(slice.content);
|
|
38290
38167
|
for (let i = extra - 1; i >= 0; i--)
|
|
38291
|
-
node = $along.node(i).copy(
|
|
38168
|
+
node = $along.node(i).copy(Fragment30.from(node));
|
|
38292
38169
|
return {
|
|
38293
38170
|
start: node.resolveNoCache(slice.openStart + extra),
|
|
38294
38171
|
end: node.resolveNoCache(node.content.size - slice.openEnd - extra)
|
|
@@ -38627,7 +38504,7 @@ var Node7 = class _Node {
|
|
|
38627
38504
|
this.type = type;
|
|
38628
38505
|
this.attrs = attrs;
|
|
38629
38506
|
this.marks = marks;
|
|
38630
|
-
this.content = content ||
|
|
38507
|
+
this.content = content || Fragment30.empty;
|
|
38631
38508
|
}
|
|
38632
38509
|
/**
|
|
38633
38510
|
The array of this node's child nodes.
|
|
@@ -38932,7 +38809,7 @@ var Node7 = class _Node {
|
|
|
38932
38809
|
can optionally pass `start` and `end` indices into the
|
|
38933
38810
|
replacement fragment.
|
|
38934
38811
|
*/
|
|
38935
|
-
canReplace(from, to, replacement =
|
|
38812
|
+
canReplace(from, to, replacement = Fragment30.empty, start = 0, end = replacement.childCount) {
|
|
38936
38813
|
let one = this.contentMatchAt(from).matchFragment(replacement, start, end);
|
|
38937
38814
|
let two = one && one.matchFragment(this.content, to);
|
|
38938
38815
|
if (!two || !two.validEnd)
|
|
@@ -39014,7 +38891,7 @@ var Node7 = class _Node {
|
|
|
39014
38891
|
throw new RangeError("Invalid text node in JSON");
|
|
39015
38892
|
return schema.text(json.text, marks);
|
|
39016
38893
|
}
|
|
39017
|
-
let content =
|
|
38894
|
+
let content = Fragment30.fromJSON(schema, json.content);
|
|
39018
38895
|
let node = schema.nodeType(json.type).create(json.attrs, content, marks);
|
|
39019
38896
|
node.type.checkAttrs(node.attrs);
|
|
39020
38897
|
return node;
|
|
@@ -39110,7 +38987,7 @@ var ContentMatch = class _ContentMatch {
|
|
|
39110
38987
|
function search(match, types) {
|
|
39111
38988
|
let finished = match.matchFragment(after, startIndex);
|
|
39112
38989
|
if (finished && (!toEnd || finished.validEnd))
|
|
39113
|
-
return
|
|
38990
|
+
return Fragment30.from(types.map((tp) => tp.createAndFill()));
|
|
39114
38991
|
for (let i = 0; i < match.next.length; i++) {
|
|
39115
38992
|
let { type, next } = match.next[i];
|
|
39116
38993
|
if (!(type.isText || type.hasRequiredAttrs()) && seen.indexOf(next) == -1) {
|
|
@@ -39678,7 +39555,7 @@ function mapFragment(fragment, f, parent) {
|
|
|
39678
39555
|
child = f(child, parent, i);
|
|
39679
39556
|
mapped.push(child);
|
|
39680
39557
|
}
|
|
39681
|
-
return
|
|
39558
|
+
return Fragment30.fromArray(mapped);
|
|
39682
39559
|
}
|
|
39683
39560
|
var AddMarkStep = class _AddMarkStep extends Step {
|
|
39684
39561
|
/**
|
|
@@ -39795,7 +39672,7 @@ var AddNodeMarkStep = class _AddNodeMarkStep extends Step {
|
|
|
39795
39672
|
if (!node)
|
|
39796
39673
|
return StepResult.fail("No node at mark step's position");
|
|
39797
39674
|
let updated = node.type.create(node.attrs, null, this.mark.addToSet(node.marks));
|
|
39798
|
-
return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(
|
|
39675
|
+
return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(Fragment30.from(updated), 0, node.isLeaf ? 0 : 1));
|
|
39799
39676
|
}
|
|
39800
39677
|
invert(doc) {
|
|
39801
39678
|
let node = doc.nodeAt(this.pos);
|
|
@@ -39841,7 +39718,7 @@ var RemoveNodeMarkStep = class _RemoveNodeMarkStep extends Step {
|
|
|
39841
39718
|
if (!node)
|
|
39842
39719
|
return StepResult.fail("No node at mark step's position");
|
|
39843
39720
|
let updated = node.type.create(node.attrs, null, this.mark.removeFromSet(node.marks));
|
|
39844
|
-
return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(
|
|
39721
|
+
return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(Fragment30.from(updated), 0, node.isLeaf ? 0 : 1));
|
|
39845
39722
|
}
|
|
39846
39723
|
invert(doc) {
|
|
39847
39724
|
let node = doc.nodeAt(this.pos);
|
|
@@ -40042,7 +39919,7 @@ var AttrStep = class _AttrStep extends Step {
|
|
|
40042
39919
|
attrs[name] = node.attrs[name];
|
|
40043
39920
|
attrs[this.attr] = this.value;
|
|
40044
39921
|
let updated = node.type.create(attrs, null, node.marks);
|
|
40045
|
-
return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(
|
|
39922
|
+
return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(Fragment30.from(updated), 0, node.isLeaf ? 0 : 1));
|
|
40046
39923
|
}
|
|
40047
39924
|
getMap() {
|
|
40048
39925
|
return StepMap.empty;
|
|
@@ -40426,7 +40303,7 @@ var NodeSelection2 = class _NodeSelection extends Selection {
|
|
|
40426
40303
|
return new _NodeSelection($pos);
|
|
40427
40304
|
}
|
|
40428
40305
|
content() {
|
|
40429
|
-
return new Slice(
|
|
40306
|
+
return new Slice(Fragment30.from(this.node), 0, 0);
|
|
40430
40307
|
}
|
|
40431
40308
|
eq(other) {
|
|
40432
40309
|
return other instanceof _NodeSelection && other.anchor == this.anchor;
|
|
@@ -41087,7 +40964,7 @@ function removeColSpan(attrs, pos, n = 1) {
|
|
|
41087
40964
|
}
|
|
41088
40965
|
return result;
|
|
41089
40966
|
}
|
|
41090
|
-
var
|
|
40967
|
+
var CellSelection2 = class CellSelection3 extends Selection {
|
|
41091
40968
|
constructor($anchorCell, $headCell = $anchorCell) {
|
|
41092
40969
|
const table = $anchorCell.node(-1);
|
|
41093
40970
|
const map = TableMap4.get(table);
|
|
@@ -41111,9 +40988,9 @@ var CellSelection = class CellSelection2 extends Selection {
|
|
|
41111
40988
|
const $headCell = doc.resolve(mapping.map(this.$headCell.pos));
|
|
41112
40989
|
if (pointsAtCell2($anchorCell) && pointsAtCell2($headCell) && inSameTable($anchorCell, $headCell)) {
|
|
41113
40990
|
const tableChanged = this.$anchorCell.node(-1) != $anchorCell.node(-1);
|
|
41114
|
-
if (tableChanged && this.isRowSelection()) return
|
|
41115
|
-
else if (tableChanged && this.isColSelection()) return
|
|
41116
|
-
else return new
|
|
40991
|
+
if (tableChanged && this.isRowSelection()) return CellSelection3.rowSelection($anchorCell, $headCell);
|
|
40992
|
+
else if (tableChanged && this.isColSelection()) return CellSelection3.colSelection($anchorCell, $headCell);
|
|
40993
|
+
else return new CellSelection3($anchorCell, $headCell);
|
|
41117
40994
|
}
|
|
41118
40995
|
return TextSelection5.between($anchorCell, $headCell);
|
|
41119
40996
|
}
|
|
@@ -41154,10 +41031,10 @@ var CellSelection = class CellSelection2 extends Selection {
|
|
|
41154
41031
|
}
|
|
41155
41032
|
rowContent.push(cell);
|
|
41156
41033
|
}
|
|
41157
|
-
rows.push(table.child(row).copy(
|
|
41034
|
+
rows.push(table.child(row).copy(Fragment30.from(rowContent)));
|
|
41158
41035
|
}
|
|
41159
41036
|
const fragment = this.isColSelection() && this.isRowSelection() ? table : rows;
|
|
41160
|
-
return new Slice(
|
|
41037
|
+
return new Slice(Fragment30.from(fragment), 1, 1);
|
|
41161
41038
|
}
|
|
41162
41039
|
replace(tr, content = Slice.empty) {
|
|
41163
41040
|
const mapFrom = tr.steps.length, ranges = this.ranges;
|
|
@@ -41169,7 +41046,7 @@ var CellSelection = class CellSelection2 extends Selection {
|
|
|
41169
41046
|
if (sel) tr.setSelection(sel);
|
|
41170
41047
|
}
|
|
41171
41048
|
replaceWith(tr, node) {
|
|
41172
|
-
this.replace(tr, new Slice(
|
|
41049
|
+
this.replace(tr, new Slice(Fragment30.from(node), 0, 0));
|
|
41173
41050
|
}
|
|
41174
41051
|
forEachCell(f) {
|
|
41175
41052
|
const table = this.$anchorCell.node(-1);
|
|
@@ -41200,7 +41077,7 @@ var CellSelection = class CellSelection2 extends Selection {
|
|
|
41200
41077
|
if (headRect.top > 0) $headCell = doc.resolve(tableStart + map.map[headRect.left]);
|
|
41201
41078
|
if (anchorRect.bottom < map.height) $anchorCell = doc.resolve(tableStart + map.map[map.width * (map.height - 1) + anchorRect.right - 1]);
|
|
41202
41079
|
}
|
|
41203
|
-
return new
|
|
41080
|
+
return new CellSelection3($anchorCell, $headCell);
|
|
41204
41081
|
}
|
|
41205
41082
|
isRowSelection() {
|
|
41206
41083
|
const table = this.$anchorCell.node(-1);
|
|
@@ -41214,7 +41091,7 @@ var CellSelection = class CellSelection2 extends Selection {
|
|
|
41214
41091
|
return Math.max(anchorRight, headRight) == map.width;
|
|
41215
41092
|
}
|
|
41216
41093
|
eq(other) {
|
|
41217
|
-
return other instanceof
|
|
41094
|
+
return other instanceof CellSelection3 && other.$anchorCell.pos == this.$anchorCell.pos && other.$headCell.pos == this.$headCell.pos;
|
|
41218
41095
|
}
|
|
41219
41096
|
static rowSelection($anchorCell, $headCell = $anchorCell) {
|
|
41220
41097
|
const table = $anchorCell.node(-1);
|
|
@@ -41230,7 +41107,7 @@ var CellSelection = class CellSelection2 extends Selection {
|
|
|
41230
41107
|
if (headRect.left > 0) $headCell = doc.resolve(tableStart + map.map[headRect.top * map.width]);
|
|
41231
41108
|
if (anchorRect.right < map.width) $anchorCell = doc.resolve(tableStart + map.map[map.width * (anchorRect.top + 1) - 1]);
|
|
41232
41109
|
}
|
|
41233
|
-
return new
|
|
41110
|
+
return new CellSelection3($anchorCell, $headCell);
|
|
41234
41111
|
}
|
|
41235
41112
|
toJSON() {
|
|
41236
41113
|
return {
|
|
@@ -41240,17 +41117,17 @@ var CellSelection = class CellSelection2 extends Selection {
|
|
|
41240
41117
|
};
|
|
41241
41118
|
}
|
|
41242
41119
|
static fromJSON(doc, json) {
|
|
41243
|
-
return new
|
|
41120
|
+
return new CellSelection3(doc.resolve(json.anchor), doc.resolve(json.head));
|
|
41244
41121
|
}
|
|
41245
41122
|
static create(doc, anchorCell, headCell = anchorCell) {
|
|
41246
|
-
return new
|
|
41123
|
+
return new CellSelection3(doc.resolve(anchorCell), doc.resolve(headCell));
|
|
41247
41124
|
}
|
|
41248
41125
|
getBookmark() {
|
|
41249
41126
|
return new CellBookmark(this.$anchorCell.pos, this.$headCell.pos);
|
|
41250
41127
|
}
|
|
41251
41128
|
};
|
|
41252
|
-
|
|
41253
|
-
Selection.jsonID("cell",
|
|
41129
|
+
CellSelection2.prototype.visible = false;
|
|
41130
|
+
Selection.jsonID("cell", CellSelection2);
|
|
41254
41131
|
var CellBookmark = class CellBookmark2 {
|
|
41255
41132
|
constructor(anchor, head) {
|
|
41256
41133
|
this.anchor = anchor;
|
|
@@ -41261,7 +41138,7 @@ var CellBookmark = class CellBookmark2 {
|
|
|
41261
41138
|
}
|
|
41262
41139
|
resolve(doc) {
|
|
41263
41140
|
const $anchorCell = doc.resolve(this.anchor), $headCell = doc.resolve(this.head);
|
|
41264
|
-
if ($anchorCell.parent.type.spec.tableRole == "row" && $headCell.parent.type.spec.tableRole == "row" && $anchorCell.index() < $anchorCell.parent.childCount && $headCell.index() < $headCell.parent.childCount && inSameTable($anchorCell, $headCell)) return new
|
|
41141
|
+
if ($anchorCell.parent.type.spec.tableRole == "row" && $headCell.parent.type.spec.tableRole == "row" && $anchorCell.index() < $anchorCell.parent.childCount && $headCell.index() < $headCell.parent.childCount && inSameTable($anchorCell, $headCell)) return new CellSelection2($anchorCell, $headCell);
|
|
41265
41142
|
else return Selection.near($headCell, 1);
|
|
41266
41143
|
}
|
|
41267
41144
|
};
|
|
@@ -41504,7 +41381,7 @@ function moveColumn(moveColParams) {
|
|
|
41504
41381
|
const $lastCell = tr.doc.resolve(start + lastCell);
|
|
41505
41382
|
const firstCell = map.positionAt(0, index, newTable);
|
|
41506
41383
|
const $firstCell = tr.doc.resolve(start + firstCell);
|
|
41507
|
-
tr.setSelection(
|
|
41384
|
+
tr.setSelection(CellSelection2.colSelection($lastCell, $firstCell));
|
|
41508
41385
|
return true;
|
|
41509
41386
|
}
|
|
41510
41387
|
function moveTableColumn$1(table, indexesOrigin, indexesTarget, direction) {
|
|
@@ -41532,7 +41409,7 @@ function moveRow(moveRowParams) {
|
|
|
41532
41409
|
const $lastCell = tr.doc.resolve(start + lastCell);
|
|
41533
41410
|
const firstCell = map.positionAt(index, 0, newTable);
|
|
41534
41411
|
const $firstCell = tr.doc.resolve(start + firstCell);
|
|
41535
|
-
tr.setSelection(
|
|
41412
|
+
tr.setSelection(CellSelection2.rowSelection($lastCell, $firstCell));
|
|
41536
41413
|
return true;
|
|
41537
41414
|
}
|
|
41538
41415
|
function moveTableRow$1(table, indexesOrigin, indexesTarget, direction) {
|
|
@@ -41547,7 +41424,7 @@ function selectedRect4(state) {
|
|
|
41547
41424
|
const tableStart = $pos.start(-1);
|
|
41548
41425
|
const map = TableMap4.get(table);
|
|
41549
41426
|
return {
|
|
41550
|
-
...sel instanceof
|
|
41427
|
+
...sel instanceof CellSelection2 ? map.rectBetween(sel.$anchorCell.pos - tableStart, sel.$headCell.pos - tableStart) : map.findCell($pos.pos - tableStart),
|
|
41551
41428
|
tableStart,
|
|
41552
41429
|
map,
|
|
41553
41430
|
table
|
|
@@ -41629,7 +41506,7 @@ var toggleHeaderColumn = toggleHeader("column", { useDeprecatedLogic: true });
|
|
|
41629
41506
|
var toggleHeaderCell = toggleHeader("cell", { useDeprecatedLogic: true });
|
|
41630
41507
|
function deleteCellSelection(state, dispatch) {
|
|
41631
41508
|
const sel = state.selection;
|
|
41632
|
-
if (!(sel instanceof
|
|
41509
|
+
if (!(sel instanceof CellSelection2)) return false;
|
|
41633
41510
|
if (dispatch) {
|
|
41634
41511
|
const tr = state.tr;
|
|
41635
41512
|
const baseContent = tableNodeTypes2(state.schema).cell.createAndFill().content;
|
|
@@ -41697,7 +41574,7 @@ function arrow(axis, dir) {
|
|
|
41697
41574
|
return (state, dispatch, view) => {
|
|
41698
41575
|
if (!view) return false;
|
|
41699
41576
|
const sel = state.selection;
|
|
41700
|
-
if (sel instanceof
|
|
41577
|
+
if (sel instanceof CellSelection2) return maybeSetSelection(state, dispatch, Selection.near(sel.$headCell, dir));
|
|
41701
41578
|
if (axis != "horiz" && !sel.empty) return false;
|
|
41702
41579
|
const end = atEndOfCell(view, axis, dir);
|
|
41703
41580
|
if (end == null) return false;
|
|
@@ -41718,15 +41595,15 @@ function shiftArrow(axis, dir) {
|
|
|
41718
41595
|
if (!view) return false;
|
|
41719
41596
|
const sel = state.selection;
|
|
41720
41597
|
let cellSel;
|
|
41721
|
-
if (sel instanceof
|
|
41598
|
+
if (sel instanceof CellSelection2) cellSel = sel;
|
|
41722
41599
|
else {
|
|
41723
41600
|
const end = atEndOfCell(view, axis, dir);
|
|
41724
41601
|
if (end == null) return false;
|
|
41725
|
-
cellSel = new
|
|
41602
|
+
cellSel = new CellSelection2(state.doc.resolve(end));
|
|
41726
41603
|
}
|
|
41727
41604
|
const $head = nextCell(cellSel.$headCell, axis, dir);
|
|
41728
41605
|
if (!$head) return false;
|
|
41729
|
-
return maybeSetSelection(state, dispatch, new
|
|
41606
|
+
return maybeSetSelection(state, dispatch, new CellSelection2(cellSel.$anchorCell, $head));
|
|
41730
41607
|
};
|
|
41731
41608
|
}
|
|
41732
41609
|
function atEndOfCell(view, axis, dir) {
|
|
@@ -41746,7 +41623,7 @@ function atEndOfCell(view, axis, dir) {
|
|
|
41746
41623
|
var columnResizingPluginKey2 = new PluginKey5("tableColumnResizing");
|
|
41747
41624
|
|
|
41748
41625
|
// src/components/UEditor/table-controls.tsx
|
|
41749
|
-
var
|
|
41626
|
+
var import_lucide_react57 = require("lucide-react");
|
|
41750
41627
|
|
|
41751
41628
|
// src/components/UEditor/table-layout-model.ts
|
|
41752
41629
|
var FALLBACK_TABLE_ROW_HEIGHT = DEFAULT_TABLE_ROW_HEIGHT;
|
|
@@ -41941,15 +41818,19 @@ function buildTableControlLayout(editor, surface, cell) {
|
|
|
41941
41818
|
const map = TableMap4.get(tableInfo.node);
|
|
41942
41819
|
const surfaceRect = surface.getBoundingClientRect();
|
|
41943
41820
|
const tableRect = table.getBoundingClientRect();
|
|
41821
|
+
const explicitColumnWidths = Array.from(table.querySelectorAll("colgroup > col")).slice(0, map.width).map((column) => parsePixelMetric(column.style.width));
|
|
41822
|
+
const explicitTableWidth = parsePixelMetric(table.style.width) ?? (explicitColumnWidths.length === map.width && explicitColumnWidths.every((width) => width !== null) ? explicitColumnWidths.reduce((sum, width) => sum + width, 0) : null);
|
|
41823
|
+
const explicitRowHeights = rows.map((tableRow) => parsePixelMetric(tableRow.getAttribute("data-row-height")) ?? parsePixelMetric(tableRow.style.height));
|
|
41824
|
+
const explicitTableHeight = explicitRowHeights.every((height) => height !== null) ? explicitRowHeights.reduce((sum, height) => sum + height, 0) : null;
|
|
41944
41825
|
const wrapperElement = table.closest(".tableWrapper");
|
|
41945
41826
|
const wrapper = wrapperElement instanceof HTMLElement ? wrapperElement : null;
|
|
41946
41827
|
const wrapperRect = wrapper?.getBoundingClientRect() ?? tableRect;
|
|
41947
41828
|
const tableLeft = tableRect.left - surfaceRect.left + surface.scrollLeft;
|
|
41948
41829
|
const tableTop = tableRect.top - surfaceRect.top + surface.scrollTop;
|
|
41949
|
-
const
|
|
41950
|
-
const
|
|
41951
|
-
const
|
|
41952
|
-
const
|
|
41830
|
+
const tableWidth = metricOrFallback(tableRect.width, explicitTableWidth ?? FALLBACK_TABLE_COLUMN_WIDTH * map.width);
|
|
41831
|
+
const tableHeight = metricOrFallback(tableRect.height, explicitTableHeight ?? FALLBACK_TABLE_ROW_HEIGHT * rows.length);
|
|
41832
|
+
const avgRowHeight = metricOrFallback(tableHeight / rows.length, FALLBACK_TABLE_ROW_HEIGHT);
|
|
41833
|
+
const avgColumnWidth = metricOrFallback(tableWidth / map.width, FALLBACK_TABLE_COLUMN_WIDTH);
|
|
41953
41834
|
const wrapperLeft = wrapperRect.left - surfaceRect.left + surface.scrollLeft;
|
|
41954
41835
|
const wrapperTop = wrapperRect.top - surfaceRect.top + surface.scrollTop;
|
|
41955
41836
|
const wrapperWidth = metricOrFallback(wrapperRect.width, tableWidth);
|
|
@@ -42308,7 +42189,7 @@ function TableControlMenu({
|
|
|
42308
42189
|
transform: shown ? "scale(1)" : "scale(0.82)",
|
|
42309
42190
|
pointerEvents: shown ? "auto" : "none"
|
|
42310
42191
|
},
|
|
42311
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_lucide_react54.MoreHorizontal, { className: "h-4 w-4" })
|
|
42192
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_lucide_react54.MoreHorizontal, { "aria-hidden": "true", className: "h-4 w-4" })
|
|
42312
42193
|
}
|
|
42313
42194
|
)
|
|
42314
42195
|
}
|
|
@@ -42466,8 +42347,236 @@ function TableColumnHandles({
|
|
|
42466
42347
|
}) });
|
|
42467
42348
|
}
|
|
42468
42349
|
|
|
42469
|
-
// src/components/UEditor/table-
|
|
42350
|
+
// src/components/UEditor/table-resize-handles.tsx
|
|
42351
|
+
var import_lucide_react56 = require("lucide-react");
|
|
42470
42352
|
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
42353
|
+
var HANDLE_BASE_CLASS = cn(
|
|
42354
|
+
"pointer-events-auto absolute z-10 inline-flex touch-none items-center justify-center rounded-md",
|
|
42355
|
+
"bg-background/95 text-primary shadow-sm backdrop-blur-sm",
|
|
42356
|
+
"transition-[color,background-color,box-shadow,transform] duration-150",
|
|
42357
|
+
"hover:bg-primary hover:text-primary-foreground hover:shadow-md active:scale-95",
|
|
42358
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
|
|
42359
|
+
);
|
|
42360
|
+
function TableResizeHandles({
|
|
42361
|
+
active,
|
|
42362
|
+
ctrlHint,
|
|
42363
|
+
frameRef,
|
|
42364
|
+
layout,
|
|
42365
|
+
onStartResize,
|
|
42366
|
+
resizeBothLabel
|
|
42367
|
+
}) {
|
|
42368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(
|
|
42369
|
+
"div",
|
|
42370
|
+
{
|
|
42371
|
+
ref: frameRef,
|
|
42372
|
+
"data-table-resize-frame": "",
|
|
42373
|
+
"data-resizing": active ? "true" : "false",
|
|
42374
|
+
className: cn(
|
|
42375
|
+
"pointer-events-none absolute z-[38] box-border border border-primary/55",
|
|
42376
|
+
active && "border-primary bg-primary/[0.03]"
|
|
42377
|
+
),
|
|
42378
|
+
style: {
|
|
42379
|
+
left: layout.tableLeft,
|
|
42380
|
+
top: layout.tableTop,
|
|
42381
|
+
width: layout.tableWidth,
|
|
42382
|
+
height: layout.tableHeight
|
|
42383
|
+
},
|
|
42384
|
+
children: [
|
|
42385
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
42386
|
+
"button",
|
|
42387
|
+
{
|
|
42388
|
+
type: "button",
|
|
42389
|
+
"aria-label": resizeBothLabel,
|
|
42390
|
+
title: `${resizeBothLabel}. ${ctrlHint}`,
|
|
42391
|
+
"data-table-resize-handle": "both",
|
|
42392
|
+
className: cn(
|
|
42393
|
+
HANDLE_BASE_CLASS,
|
|
42394
|
+
"bottom-[-28px] right-[-30px] h-6 w-6 cursor-nwse-resize",
|
|
42395
|
+
active && "bg-primary text-primary-foreground shadow-md"
|
|
42396
|
+
),
|
|
42397
|
+
onPointerDown: onStartResize,
|
|
42398
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_lucide_react56.MoveDiagonal2, { "aria-hidden": "true", className: "h-3.5 w-3.5", strokeWidth: 2.25 })
|
|
42399
|
+
}
|
|
42400
|
+
),
|
|
42401
|
+
active ? /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
42402
|
+
"span",
|
|
42403
|
+
{
|
|
42404
|
+
role: "status",
|
|
42405
|
+
"aria-live": "polite",
|
|
42406
|
+
"data-table-resize-dimensions": "",
|
|
42407
|
+
className: "absolute bottom-2 right-2 rounded bg-foreground/85 px-1.5 py-0.5 text-[10px] font-medium text-background shadow-sm",
|
|
42408
|
+
children: `${Math.round(layout.tableWidth)} \xD7 ${Math.round(layout.tableHeight)}`
|
|
42409
|
+
}
|
|
42410
|
+
) : null
|
|
42411
|
+
]
|
|
42412
|
+
}
|
|
42413
|
+
);
|
|
42414
|
+
}
|
|
42415
|
+
|
|
42416
|
+
// src/components/UEditor/table-size-utils.ts
|
|
42417
|
+
var MAX_TABLE_DIMENSION = 8192;
|
|
42418
|
+
function positiveMetric(value, fallback) {
|
|
42419
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : fallback;
|
|
42420
|
+
}
|
|
42421
|
+
function normalizeWeightsToTotal(values, total, minimum) {
|
|
42422
|
+
if (values.length === 0) return [];
|
|
42423
|
+
const safeTotal = Math.max(values.length * minimum, Math.round(total));
|
|
42424
|
+
const positiveValues = values.map((value) => positiveMetric(value, 1));
|
|
42425
|
+
const weightSum = positiveValues.reduce((sum, value) => sum + value, 0);
|
|
42426
|
+
const raw = positiveValues.map((value) => value / weightSum * safeTotal);
|
|
42427
|
+
const normalized = raw.map((value) => Math.max(minimum, Math.round(value)));
|
|
42428
|
+
let difference = safeTotal - normalized.reduce((sum, value) => sum + value, 0);
|
|
42429
|
+
while (difference !== 0) {
|
|
42430
|
+
let changed = false;
|
|
42431
|
+
for (let index = normalized.length - 1; index >= 0 && difference !== 0; index -= 1) {
|
|
42432
|
+
if (difference < 0 && normalized[index] <= minimum) continue;
|
|
42433
|
+
normalized[index] += difference > 0 ? 1 : -1;
|
|
42434
|
+
difference += difference > 0 ? -1 : 1;
|
|
42435
|
+
changed = true;
|
|
42436
|
+
}
|
|
42437
|
+
if (!changed) break;
|
|
42438
|
+
}
|
|
42439
|
+
return normalized;
|
|
42440
|
+
}
|
|
42441
|
+
function getLogicalColumnWidths(table, tableMap, fallback) {
|
|
42442
|
+
return Array.from({ length: tableMap.width }, (_, columnIndex) => {
|
|
42443
|
+
const relativeCellPos = tableMap.positionAt(0, columnIndex, table);
|
|
42444
|
+
const cell = table.nodeAt(relativeCellPos);
|
|
42445
|
+
if (!cell) return fallback;
|
|
42446
|
+
const cellStartColumn = tableMap.colCount(relativeCellPos);
|
|
42447
|
+
const widthIndex = columnIndex - cellStartColumn;
|
|
42448
|
+
const colwidth = cell.attrs.colwidth;
|
|
42449
|
+
return positiveMetric(colwidth?.[widthIndex], fallback);
|
|
42450
|
+
});
|
|
42451
|
+
}
|
|
42452
|
+
function getLogicalRowHeights(table, fallback) {
|
|
42453
|
+
const heights = [];
|
|
42454
|
+
table.forEach((row) => {
|
|
42455
|
+
heights.push(positiveMetric(row.attrs.rowHeight, fallback));
|
|
42456
|
+
});
|
|
42457
|
+
return heights;
|
|
42458
|
+
}
|
|
42459
|
+
function createTableSizeSnapshot(editor, anchorPos, startWidth, startHeight) {
|
|
42460
|
+
const tableInfo = findTableInfo(editor, anchorPos);
|
|
42461
|
+
if (!tableInfo) return null;
|
|
42462
|
+
const tableMap = TableMap4.get(tableInfo.node);
|
|
42463
|
+
if (tableMap.width === 0 || tableMap.height === 0) return null;
|
|
42464
|
+
const safeWidth = Math.max(tableMap.width * MIN_RESIZED_TABLE_COLUMN_WIDTH, Math.round(startWidth));
|
|
42465
|
+
const safeHeight = Math.max(tableMap.height * MIN_TABLE_ROW_HEIGHT, Math.round(startHeight));
|
|
42466
|
+
const fallbackColumnWidth = safeWidth / tableMap.width;
|
|
42467
|
+
const fallbackRowHeight = safeHeight / tableMap.height;
|
|
42468
|
+
return {
|
|
42469
|
+
anchorPos,
|
|
42470
|
+
tablePos: tableInfo.pos,
|
|
42471
|
+
startWidth: safeWidth,
|
|
42472
|
+
startHeight: safeHeight,
|
|
42473
|
+
columnWidths: normalizeWeightsToTotal(
|
|
42474
|
+
getLogicalColumnWidths(tableInfo.node, tableMap, fallbackColumnWidth),
|
|
42475
|
+
safeWidth,
|
|
42476
|
+
MIN_RESIZED_TABLE_COLUMN_WIDTH
|
|
42477
|
+
),
|
|
42478
|
+
rowHeights: normalizeWeightsToTotal(
|
|
42479
|
+
getLogicalRowHeights(tableInfo.node, fallbackRowHeight),
|
|
42480
|
+
safeHeight,
|
|
42481
|
+
MIN_TABLE_ROW_HEIGHT
|
|
42482
|
+
),
|
|
42483
|
+
minWidth: tableMap.width * MIN_RESIZED_TABLE_COLUMN_WIDTH,
|
|
42484
|
+
minHeight: tableMap.height * MIN_TABLE_ROW_HEIGHT
|
|
42485
|
+
};
|
|
42486
|
+
}
|
|
42487
|
+
function resolveTableResizeDimensions({
|
|
42488
|
+
deltaX,
|
|
42489
|
+
deltaY,
|
|
42490
|
+
lockAxis,
|
|
42491
|
+
preserveRatio,
|
|
42492
|
+
snapshot
|
|
42493
|
+
}) {
|
|
42494
|
+
let width = snapshot.startWidth + deltaX;
|
|
42495
|
+
let height = snapshot.startHeight + deltaY;
|
|
42496
|
+
if (preserveRatio) {
|
|
42497
|
+
const horizontalDrag = Math.abs(deltaX) >= Math.abs(deltaY);
|
|
42498
|
+
const scale = horizontalDrag ? width / snapshot.startWidth : height / snapshot.startHeight;
|
|
42499
|
+
const minScale = Math.max(
|
|
42500
|
+
snapshot.minWidth / snapshot.startWidth,
|
|
42501
|
+
snapshot.minHeight / snapshot.startHeight
|
|
42502
|
+
);
|
|
42503
|
+
const maxScale = Math.min(
|
|
42504
|
+
MAX_TABLE_DIMENSION / snapshot.startWidth,
|
|
42505
|
+
MAX_TABLE_DIMENSION / snapshot.startHeight
|
|
42506
|
+
);
|
|
42507
|
+
const safeScale = Math.min(Math.max(scale, minScale), maxScale);
|
|
42508
|
+
width = snapshot.startWidth * safeScale;
|
|
42509
|
+
height = snapshot.startHeight * safeScale;
|
|
42510
|
+
} else if (lockAxis) {
|
|
42511
|
+
if (Math.abs(deltaX) >= Math.abs(deltaY)) {
|
|
42512
|
+
height = snapshot.startHeight;
|
|
42513
|
+
} else {
|
|
42514
|
+
width = snapshot.startWidth;
|
|
42515
|
+
}
|
|
42516
|
+
}
|
|
42517
|
+
return {
|
|
42518
|
+
width: Math.min(MAX_TABLE_DIMENSION, Math.max(snapshot.minWidth, Math.round(width))),
|
|
42519
|
+
height: Math.min(MAX_TABLE_DIMENSION, Math.max(snapshot.minHeight, Math.round(height)))
|
|
42520
|
+
};
|
|
42521
|
+
}
|
|
42522
|
+
function arraysEqual(left, right) {
|
|
42523
|
+
return Array.isArray(left) && left.length === right.length && left.every((value, index) => value === right[index]);
|
|
42524
|
+
}
|
|
42525
|
+
function applyTableSize(editor, snapshot, dimensions) {
|
|
42526
|
+
const table = editor.state.doc.nodeAt(snapshot.tablePos);
|
|
42527
|
+
if (!table || table.type.name !== "table") return false;
|
|
42528
|
+
const tableMap = TableMap4.get(table);
|
|
42529
|
+
if (tableMap.width !== snapshot.columnWidths.length || tableMap.height !== snapshot.rowHeights.length) {
|
|
42530
|
+
return false;
|
|
42531
|
+
}
|
|
42532
|
+
const resizeWidth = dimensions.width !== snapshot.startWidth;
|
|
42533
|
+
const resizeHeight = dimensions.height !== snapshot.startHeight;
|
|
42534
|
+
if (!resizeWidth && !resizeHeight) return false;
|
|
42535
|
+
const tableStart = snapshot.tablePos + 1;
|
|
42536
|
+
const transaction = editor.state.tr;
|
|
42537
|
+
if (resizeWidth) {
|
|
42538
|
+
const nextColumnWidths = normalizeWeightsToTotal(
|
|
42539
|
+
snapshot.columnWidths,
|
|
42540
|
+
dimensions.width,
|
|
42541
|
+
MIN_RESIZED_TABLE_COLUMN_WIDTH
|
|
42542
|
+
);
|
|
42543
|
+
const seenCellPositions = /* @__PURE__ */ new Set();
|
|
42544
|
+
for (const relativeCellPos of tableMap.map) {
|
|
42545
|
+
if (seenCellPositions.has(relativeCellPos)) continue;
|
|
42546
|
+
seenCellPositions.add(relativeCellPos);
|
|
42547
|
+
const cell = table.nodeAt(relativeCellPos);
|
|
42548
|
+
if (!cell) continue;
|
|
42549
|
+
const cellRect = tableMap.findCell(relativeCellPos);
|
|
42550
|
+
const colwidth = nextColumnWidths.slice(cellRect.left, cellRect.right);
|
|
42551
|
+
if (arraysEqual(cell.attrs.colwidth, colwidth)) continue;
|
|
42552
|
+
transaction.setNodeMarkup(tableStart + relativeCellPos, void 0, {
|
|
42553
|
+
...cell.attrs,
|
|
42554
|
+
colwidth
|
|
42555
|
+
});
|
|
42556
|
+
}
|
|
42557
|
+
}
|
|
42558
|
+
if (resizeHeight) {
|
|
42559
|
+
const nextRowHeights = normalizeWeightsToTotal(
|
|
42560
|
+
snapshot.rowHeights,
|
|
42561
|
+
dimensions.height,
|
|
42562
|
+
MIN_TABLE_ROW_HEIGHT
|
|
42563
|
+
);
|
|
42564
|
+
table.forEach((row, offset, rowIndex) => {
|
|
42565
|
+
const rowHeight = nextRowHeights[rowIndex];
|
|
42566
|
+
if (row.attrs.rowHeight === rowHeight) return;
|
|
42567
|
+
transaction.setNodeMarkup(tableStart + offset, void 0, {
|
|
42568
|
+
...row.attrs,
|
|
42569
|
+
rowHeight
|
|
42570
|
+
});
|
|
42571
|
+
});
|
|
42572
|
+
}
|
|
42573
|
+
if (!transaction.docChanged) return false;
|
|
42574
|
+
editor.view.dispatch(transaction);
|
|
42575
|
+
return true;
|
|
42576
|
+
}
|
|
42577
|
+
|
|
42578
|
+
// src/components/UEditor/table-controls.tsx
|
|
42579
|
+
var import_jsx_runtime101 = require("react/jsx-runtime");
|
|
42471
42580
|
var TABLE_MENU_TOP_OFFSET = 10;
|
|
42472
42581
|
function nearestIndex(centers, position) {
|
|
42473
42582
|
let bestIndex = 0;
|
|
@@ -42491,15 +42600,18 @@ function getSelectedCell(editor) {
|
|
|
42491
42600
|
const domAtPos = editor.view.domAtPos(editor.state.selection.from);
|
|
42492
42601
|
return getCellFromTarget(domAtPos.node);
|
|
42493
42602
|
}
|
|
42494
|
-
function TableControls({ editor, containerRef }) {
|
|
42603
|
+
function TableControls({ editor, containerRef, showCellInspector = true }) {
|
|
42495
42604
|
const t = useSmartTranslations("UEditor");
|
|
42496
42605
|
const [layout, setLayout] = import_react76.default.useState(null);
|
|
42497
42606
|
const [dragPreview, setDragPreview] = import_react76.default.useState(null);
|
|
42607
|
+
const [tableResizeActive, setTableResizeActive] = import_react76.default.useState(false);
|
|
42498
42608
|
const [hoverState, setHoverState] = import_react76.default.useState(DEFAULT_TABLE_HOVER_STATE);
|
|
42499
42609
|
const [openMenuKey, setOpenMenuKey] = import_react76.default.useState(null);
|
|
42500
42610
|
const layoutRef = import_react76.default.useRef(null);
|
|
42501
42611
|
const dragStateRef = import_react76.default.useRef(null);
|
|
42502
42612
|
const syncFrameRef = import_react76.default.useRef(null);
|
|
42613
|
+
const tableResizeFrameRef = import_react76.default.useRef(null);
|
|
42614
|
+
const tableResizePreviewFrameRef = import_react76.default.useRef(null);
|
|
42503
42615
|
import_react76.default.useEffect(() => {
|
|
42504
42616
|
layoutRef.current = layout;
|
|
42505
42617
|
}, [layout]);
|
|
@@ -42537,11 +42649,44 @@ function TableControls({ editor, containerRef }) {
|
|
|
42537
42649
|
return cell ? buildTableControlLayout(editor, surface, cell) : null;
|
|
42538
42650
|
});
|
|
42539
42651
|
}, [containerRef, editor]);
|
|
42652
|
+
const updateTableResizePreview = import_react76.default.useCallback((dimensions) => {
|
|
42653
|
+
const frame = tableResizeFrameRef.current;
|
|
42654
|
+
if (!frame) return;
|
|
42655
|
+
frame.style.width = `${dimensions.width}px`;
|
|
42656
|
+
frame.style.height = `${dimensions.height}px`;
|
|
42657
|
+
const dimensionsLabel = frame.querySelector("[data-table-resize-dimensions]");
|
|
42658
|
+
if (dimensionsLabel) {
|
|
42659
|
+
dimensionsLabel.textContent = `${dimensions.width} \xD7 ${dimensions.height}`;
|
|
42660
|
+
}
|
|
42661
|
+
}, []);
|
|
42662
|
+
const resetTableResizePreview = import_react76.default.useCallback(() => {
|
|
42663
|
+
const activeLayout = layoutRef.current;
|
|
42664
|
+
if (!activeLayout) return;
|
|
42665
|
+
updateTableResizePreview({
|
|
42666
|
+
width: Math.round(activeLayout.tableWidth),
|
|
42667
|
+
height: Math.round(activeLayout.tableHeight)
|
|
42668
|
+
});
|
|
42669
|
+
}, [updateTableResizePreview]);
|
|
42540
42670
|
const clearDrag = import_react76.default.useCallback(() => {
|
|
42671
|
+
const dragState = dragStateRef.current;
|
|
42672
|
+
if (dragState?.kind === "resize-table") {
|
|
42673
|
+
try {
|
|
42674
|
+
if (dragState.pointerTarget.hasPointerCapture?.(dragState.pointerId)) {
|
|
42675
|
+
dragState.pointerTarget.releasePointerCapture(dragState.pointerId);
|
|
42676
|
+
}
|
|
42677
|
+
} catch {
|
|
42678
|
+
}
|
|
42679
|
+
}
|
|
42680
|
+
if (tableResizePreviewFrameRef.current !== null) {
|
|
42681
|
+
window.cancelAnimationFrame(tableResizePreviewFrameRef.current);
|
|
42682
|
+
tableResizePreviewFrameRef.current = null;
|
|
42683
|
+
}
|
|
42541
42684
|
dragStateRef.current = null;
|
|
42542
42685
|
setDragPreview(null);
|
|
42686
|
+
setTableResizeActive(false);
|
|
42687
|
+
resetTableResizePreview();
|
|
42543
42688
|
document.body.style.cursor = "";
|
|
42544
|
-
}, []);
|
|
42689
|
+
}, [resetTableResizePreview]);
|
|
42545
42690
|
const updateHoverState = import_react76.default.useCallback((event) => {
|
|
42546
42691
|
const activeLayout = layoutRef.current;
|
|
42547
42692
|
const surface = containerRef.current;
|
|
@@ -42581,9 +42726,26 @@ function TableControls({ editor, containerRef }) {
|
|
|
42581
42726
|
const cell = event ? getCellFromTarget(event.target) : null;
|
|
42582
42727
|
syncFromCell(cell ?? getSelectedCell(editor));
|
|
42583
42728
|
};
|
|
42729
|
+
const handleDoubleClick = (event) => {
|
|
42730
|
+
if (event.button !== 0) return;
|
|
42731
|
+
const cell = getCellFromTarget(event.target);
|
|
42732
|
+
if (!cell || cell.hasAttribute("data-formula")) return;
|
|
42733
|
+
const surface2 = containerRef.current;
|
|
42734
|
+
const nextLayout = surface2 ? buildTableControlLayout(editor, surface2, cell) : null;
|
|
42735
|
+
if (!nextLayout) return;
|
|
42736
|
+
const didSelect = editor.commands.setCellSelection({
|
|
42737
|
+
anchorCell: nextLayout.cellPos,
|
|
42738
|
+
headCell: nextLayout.cellPos
|
|
42739
|
+
});
|
|
42740
|
+
if (!didSelect) return;
|
|
42741
|
+
event.preventDefault();
|
|
42742
|
+
editor.view.focus();
|
|
42743
|
+
setLayout(nextLayout);
|
|
42744
|
+
};
|
|
42584
42745
|
proseMirror.addEventListener("mouseover", handleMouseOver);
|
|
42585
42746
|
proseMirror.addEventListener("mouseleave", handleMouseLeave2);
|
|
42586
42747
|
proseMirror.addEventListener("click", handleFocusIn);
|
|
42748
|
+
proseMirror.addEventListener("dblclick", handleDoubleClick);
|
|
42587
42749
|
proseMirror.addEventListener("mouseup", handleFocusIn);
|
|
42588
42750
|
proseMirror.addEventListener("focusin", handleFocusIn);
|
|
42589
42751
|
surface.addEventListener("mouseover", handleSurfaceMouseMove);
|
|
@@ -42598,6 +42760,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42598
42760
|
proseMirror.removeEventListener("mouseover", handleMouseOver);
|
|
42599
42761
|
proseMirror.removeEventListener("mouseleave", handleMouseLeave2);
|
|
42600
42762
|
proseMirror.removeEventListener("click", handleFocusIn);
|
|
42763
|
+
proseMirror.removeEventListener("dblclick", handleDoubleClick);
|
|
42601
42764
|
proseMirror.removeEventListener("mouseup", handleFocusIn);
|
|
42602
42765
|
proseMirror.removeEventListener("focusin", handleFocusIn);
|
|
42603
42766
|
surface.removeEventListener("mouseover", handleSurfaceMouseMove);
|
|
@@ -42648,6 +42811,42 @@ function TableControls({ editor, containerRef }) {
|
|
|
42648
42811
|
const canExpandTable = Boolean(layout);
|
|
42649
42812
|
const controlsVisible = dragPreview !== null;
|
|
42650
42813
|
const tableMenuOpen = openMenuKey === "table";
|
|
42814
|
+
const startTableResize = import_react76.default.useCallback((event) => {
|
|
42815
|
+
if (event.button !== 0 || dragStateRef.current) return;
|
|
42816
|
+
const activeLayout = layoutRef.current;
|
|
42817
|
+
if (!activeLayout) return;
|
|
42818
|
+
const snapshot = createTableSizeSnapshot(
|
|
42819
|
+
editor,
|
|
42820
|
+
activeLayout.cellPos,
|
|
42821
|
+
activeLayout.tableWidth,
|
|
42822
|
+
activeLayout.tableHeight
|
|
42823
|
+
);
|
|
42824
|
+
if (!snapshot) return;
|
|
42825
|
+
event.preventDefault();
|
|
42826
|
+
event.stopPropagation();
|
|
42827
|
+
try {
|
|
42828
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
42829
|
+
} catch {
|
|
42830
|
+
}
|
|
42831
|
+
setOpenMenuKey(null);
|
|
42832
|
+
setHoverState(DEFAULT_TABLE_HOVER_STATE);
|
|
42833
|
+
setTableResizeActive(true);
|
|
42834
|
+
const pendingDimensions = {
|
|
42835
|
+
width: snapshot.startWidth,
|
|
42836
|
+
height: snapshot.startHeight
|
|
42837
|
+
};
|
|
42838
|
+
dragStateRef.current = {
|
|
42839
|
+
kind: "resize-table",
|
|
42840
|
+
pointerId: event.pointerId,
|
|
42841
|
+
pointerTarget: event.currentTarget,
|
|
42842
|
+
startX: event.clientX,
|
|
42843
|
+
startY: event.clientY,
|
|
42844
|
+
snapshot,
|
|
42845
|
+
pendingDimensions
|
|
42846
|
+
};
|
|
42847
|
+
updateTableResizePreview(pendingDimensions);
|
|
42848
|
+
document.body.style.cursor = "nwse-resize";
|
|
42849
|
+
}, [editor, updateTableResizePreview]);
|
|
42651
42850
|
const startAddColumnDrag = import_react76.default.useCallback(() => {
|
|
42652
42851
|
setOpenMenuKey(null);
|
|
42653
42852
|
dragStateRef.current = { kind: "add-column", previewCols: 1 };
|
|
@@ -42703,6 +42902,9 @@ function TableControls({ editor, containerRef }) {
|
|
|
42703
42902
|
const surfaceRect = surface.getBoundingClientRect();
|
|
42704
42903
|
const relativeX = event.clientX - surfaceRect.left + surface.scrollLeft;
|
|
42705
42904
|
const relativeY = event.clientY - surfaceRect.top + surface.scrollTop;
|
|
42905
|
+
if (dragState.kind === "resize-table") {
|
|
42906
|
+
return;
|
|
42907
|
+
}
|
|
42706
42908
|
if (dragState.kind === "row") {
|
|
42707
42909
|
const targetHandleIndex = nearestIndex(activeLayout.rowHandles.map((item) => item.center), relativeY);
|
|
42708
42910
|
const targetRow = activeLayout.rowHandles[targetHandleIndex];
|
|
@@ -42747,7 +42949,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42747
42949
|
};
|
|
42748
42950
|
const handleMouseUp = () => {
|
|
42749
42951
|
const dragState = dragStateRef.current;
|
|
42750
|
-
if (!dragState) return;
|
|
42952
|
+
if (!dragState || dragState.kind === "resize-table") return;
|
|
42751
42953
|
if (dragState.kind === "row" && dragState.originIndex !== dragState.targetIndex) {
|
|
42752
42954
|
moveTableRow({
|
|
42753
42955
|
from: dragState.originIndex,
|
|
@@ -42783,98 +42985,165 @@ function TableControls({ editor, containerRef }) {
|
|
|
42783
42985
|
window.removeEventListener("blur", clearDrag);
|
|
42784
42986
|
};
|
|
42785
42987
|
}, [clearDrag, containerRef, editor, expandTableBy, scheduleSyncFromSelection]);
|
|
42988
|
+
import_react76.default.useEffect(() => {
|
|
42989
|
+
const handlePointerMove = (event) => {
|
|
42990
|
+
const dragState = dragStateRef.current;
|
|
42991
|
+
if (!dragState || dragState.kind !== "resize-table" || event.pointerId !== dragState.pointerId) return;
|
|
42992
|
+
dragState.pendingDimensions = resolveTableResizeDimensions({
|
|
42993
|
+
deltaX: event.clientX - dragState.startX,
|
|
42994
|
+
deltaY: event.clientY - dragState.startY,
|
|
42995
|
+
lockAxis: event.ctrlKey && !event.shiftKey,
|
|
42996
|
+
preserveRatio: event.ctrlKey && event.shiftKey,
|
|
42997
|
+
snapshot: dragState.snapshot
|
|
42998
|
+
});
|
|
42999
|
+
if (tableResizePreviewFrameRef.current === null) {
|
|
43000
|
+
tableResizePreviewFrameRef.current = window.requestAnimationFrame(() => {
|
|
43001
|
+
tableResizePreviewFrameRef.current = null;
|
|
43002
|
+
const currentDragState = dragStateRef.current;
|
|
43003
|
+
if (!currentDragState || currentDragState.kind !== "resize-table") return;
|
|
43004
|
+
updateTableResizePreview(currentDragState.pendingDimensions);
|
|
43005
|
+
});
|
|
43006
|
+
}
|
|
43007
|
+
document.body.style.cursor = "nwse-resize";
|
|
43008
|
+
if (event.cancelable) event.preventDefault();
|
|
43009
|
+
};
|
|
43010
|
+
const finishTableResize = (event, commit) => {
|
|
43011
|
+
const dragState = dragStateRef.current;
|
|
43012
|
+
if (!dragState || dragState.kind !== "resize-table" || event.pointerId !== dragState.pointerId) return;
|
|
43013
|
+
if (tableResizePreviewFrameRef.current !== null) {
|
|
43014
|
+
window.cancelAnimationFrame(tableResizePreviewFrameRef.current);
|
|
43015
|
+
tableResizePreviewFrameRef.current = null;
|
|
43016
|
+
}
|
|
43017
|
+
updateTableResizePreview(dragState.pendingDimensions);
|
|
43018
|
+
if (commit && applyTableSize(editor, dragState.snapshot, dragState.pendingDimensions)) {
|
|
43019
|
+
scheduleSyncFromSelection();
|
|
43020
|
+
}
|
|
43021
|
+
clearDrag();
|
|
43022
|
+
};
|
|
43023
|
+
const handlePointerUp = (event) => finishTableResize(event, true);
|
|
43024
|
+
const handlePointerCancel = (event) => finishTableResize(event, false);
|
|
43025
|
+
window.addEventListener("pointermove", handlePointerMove, { passive: false });
|
|
43026
|
+
window.addEventListener("pointerup", handlePointerUp);
|
|
43027
|
+
window.addEventListener("pointercancel", handlePointerCancel);
|
|
43028
|
+
return () => {
|
|
43029
|
+
window.removeEventListener("pointermove", handlePointerMove);
|
|
43030
|
+
window.removeEventListener("pointerup", handlePointerUp);
|
|
43031
|
+
window.removeEventListener("pointercancel", handlePointerCancel);
|
|
43032
|
+
if (tableResizePreviewFrameRef.current !== null) {
|
|
43033
|
+
window.cancelAnimationFrame(tableResizePreviewFrameRef.current);
|
|
43034
|
+
tableResizePreviewFrameRef.current = null;
|
|
43035
|
+
}
|
|
43036
|
+
};
|
|
43037
|
+
}, [clearDrag, editor, scheduleSyncFromSelection, updateTableResizePreview]);
|
|
43038
|
+
const openCellInspector = import_react76.default.useCallback(() => {
|
|
43039
|
+
const cellPos = layoutRef.current?.cellPos;
|
|
43040
|
+
if (!showCellInspector || cellPos == null) return;
|
|
43041
|
+
const didSelect = editor.commands.setCellSelection({
|
|
43042
|
+
anchorCell: cellPos,
|
|
43043
|
+
headCell: cellPos
|
|
43044
|
+
});
|
|
43045
|
+
if (!didSelect) return;
|
|
43046
|
+
window.requestAnimationFrame(() => {
|
|
43047
|
+
if (!editor.isDestroyed) editor.view.focus();
|
|
43048
|
+
});
|
|
43049
|
+
}, [editor, showCellInspector]);
|
|
42786
43050
|
const menuItems = import_react76.default.useMemo(() => {
|
|
42787
43051
|
if (!layout) return [];
|
|
42788
43052
|
return [
|
|
43053
|
+
...showCellInspector ? [{
|
|
43054
|
+
label: t("tableMenu.cellFormatting"),
|
|
43055
|
+
icon: import_lucide_react57.Paintbrush,
|
|
43056
|
+
onClick: openCellInspector
|
|
43057
|
+
}] : [],
|
|
42789
43058
|
{
|
|
42790
43059
|
label: t("tableMenu.alignLeft"),
|
|
42791
|
-
icon:
|
|
43060
|
+
icon: import_lucide_react57.AlignLeft,
|
|
42792
43061
|
onClick: () => applyTableAlignment(editor, "left", layout.cellPos)
|
|
42793
43062
|
},
|
|
42794
43063
|
{
|
|
42795
43064
|
label: t("tableMenu.alignCenter"),
|
|
42796
|
-
icon:
|
|
43065
|
+
icon: import_lucide_react57.AlignCenter,
|
|
42797
43066
|
onClick: () => applyTableAlignment(editor, "center", layout.cellPos)
|
|
42798
43067
|
},
|
|
42799
43068
|
{
|
|
42800
43069
|
label: t("tableMenu.alignRight"),
|
|
42801
|
-
icon:
|
|
43070
|
+
icon: import_lucide_react57.AlignRight,
|
|
42802
43071
|
onClick: () => applyTableAlignment(editor, "right", layout.cellPos)
|
|
42803
43072
|
},
|
|
42804
43073
|
{
|
|
42805
43074
|
label: t("tableMenu.addColumnBefore"),
|
|
42806
|
-
icon:
|
|
43075
|
+
icon: import_lucide_react57.ArrowLeft,
|
|
42807
43076
|
onClick: () => runAtActiveCell((chain) => chain.addColumnBefore())
|
|
42808
43077
|
},
|
|
42809
43078
|
{
|
|
42810
43079
|
label: t("tableMenu.addColumnAfter"),
|
|
42811
|
-
icon:
|
|
43080
|
+
icon: import_lucide_react57.ArrowRight,
|
|
42812
43081
|
onClick: () => runAtActiveCell((chain) => chain.addColumnAfter())
|
|
42813
43082
|
},
|
|
42814
43083
|
{
|
|
42815
43084
|
label: t("tableMenu.addRowBefore"),
|
|
42816
|
-
icon:
|
|
43085
|
+
icon: import_lucide_react57.ArrowUp,
|
|
42817
43086
|
onClick: () => runAtActiveCell((chain) => chain.addRowBefore())
|
|
42818
43087
|
},
|
|
42819
43088
|
{
|
|
42820
43089
|
label: t("tableMenu.addRowAfter"),
|
|
42821
|
-
icon:
|
|
43090
|
+
icon: import_lucide_react57.ArrowDown,
|
|
42822
43091
|
onClick: () => runAtActiveCell((chain) => chain.addRowAfter())
|
|
42823
43092
|
},
|
|
42824
43093
|
{
|
|
42825
43094
|
label: t("tableMenu.toggleHeaderRow"),
|
|
42826
|
-
icon:
|
|
43095
|
+
icon: import_lucide_react57.Table,
|
|
42827
43096
|
onClick: () => runAtActiveCell((chain) => chain.toggleHeaderRow())
|
|
42828
43097
|
},
|
|
42829
43098
|
{
|
|
42830
43099
|
label: t("tableMenu.toggleHeaderColumn"),
|
|
42831
|
-
icon:
|
|
43100
|
+
icon: import_lucide_react57.Table,
|
|
42832
43101
|
onClick: () => runAtActiveCell((chain) => chain.toggleHeaderColumn())
|
|
42833
43102
|
},
|
|
42834
43103
|
{
|
|
42835
43104
|
label: t("tableMenu.deleteColumn"),
|
|
42836
|
-
icon:
|
|
43105
|
+
icon: import_lucide_react57.Trash2,
|
|
42837
43106
|
onClick: () => runAtActiveCell((chain) => chain.deleteColumn()),
|
|
42838
43107
|
destructive: true
|
|
42839
43108
|
},
|
|
42840
43109
|
{
|
|
42841
43110
|
label: t("tableMenu.deleteRow"),
|
|
42842
|
-
icon:
|
|
43111
|
+
icon: import_lucide_react57.Trash2,
|
|
42843
43112
|
onClick: () => runAtActiveCell((chain) => chain.deleteRow()),
|
|
42844
43113
|
destructive: true
|
|
42845
43114
|
},
|
|
42846
43115
|
{
|
|
42847
43116
|
label: t("tableMenu.deleteTable"),
|
|
42848
|
-
icon:
|
|
43117
|
+
icon: import_lucide_react57.Trash2,
|
|
42849
43118
|
onClick: () => runAtActiveCell((chain) => chain.deleteTable()),
|
|
42850
43119
|
destructive: true
|
|
42851
43120
|
}
|
|
42852
43121
|
];
|
|
42853
|
-
}, [editor, layout, runAtActiveCell, t]);
|
|
43122
|
+
}, [editor, layout, openCellInspector, runAtActiveCell, showCellInspector, t]);
|
|
42854
43123
|
const getRowHandleMenuItems = import_react76.default.useCallback((rowHandle) => [
|
|
42855
43124
|
{
|
|
42856
43125
|
label: t("tableMenu.addRowBefore"),
|
|
42857
|
-
icon:
|
|
43126
|
+
icon: import_lucide_react57.ArrowUp,
|
|
42858
43127
|
onClick: () => runAtCellPos(rowHandle.cellPos, (chain) => chain.addRowBefore())
|
|
42859
43128
|
},
|
|
42860
43129
|
{
|
|
42861
43130
|
label: t("tableMenu.addRowAfter"),
|
|
42862
|
-
icon:
|
|
43131
|
+
icon: import_lucide_react57.ArrowDown,
|
|
42863
43132
|
onClick: () => runAtCellPos(rowHandle.cellPos, (chain) => chain.addRowAfter())
|
|
42864
43133
|
},
|
|
42865
43134
|
{
|
|
42866
43135
|
label: t("tableMenu.duplicateRow"),
|
|
42867
|
-
icon:
|
|
43136
|
+
icon: import_lucide_react57.Copy,
|
|
42868
43137
|
onClick: () => duplicateRowAt(rowHandle.index, rowHandle.cellPos)
|
|
42869
43138
|
},
|
|
42870
43139
|
{
|
|
42871
43140
|
label: t("tableMenu.clearRowContents"),
|
|
42872
|
-
icon:
|
|
43141
|
+
icon: import_lucide_react57.Table,
|
|
42873
43142
|
onClick: () => clearRowAt(rowHandle.index, rowHandle.cellPos)
|
|
42874
43143
|
},
|
|
42875
43144
|
{
|
|
42876
43145
|
label: t("tableMenu.deleteRow"),
|
|
42877
|
-
icon:
|
|
43146
|
+
icon: import_lucide_react57.Trash2,
|
|
42878
43147
|
onClick: () => runAtCellPos(rowHandle.cellPos, (chain) => chain.deleteRow()),
|
|
42879
43148
|
destructive: true
|
|
42880
43149
|
}
|
|
@@ -42882,27 +43151,27 @@ function TableControls({ editor, containerRef }) {
|
|
|
42882
43151
|
const getColumnHandleMenuItems = import_react76.default.useCallback((columnHandle) => [
|
|
42883
43152
|
{
|
|
42884
43153
|
label: t("tableMenu.addColumnBefore"),
|
|
42885
|
-
icon:
|
|
43154
|
+
icon: import_lucide_react57.ArrowLeft,
|
|
42886
43155
|
onClick: () => runAtCellPos(columnHandle.cellPos, (chain) => chain.addColumnBefore())
|
|
42887
43156
|
},
|
|
42888
43157
|
{
|
|
42889
43158
|
label: t("tableMenu.addColumnAfter"),
|
|
42890
|
-
icon:
|
|
43159
|
+
icon: import_lucide_react57.ArrowRight,
|
|
42891
43160
|
onClick: () => runAtCellPos(columnHandle.cellPos, (chain) => chain.addColumnAfter())
|
|
42892
43161
|
},
|
|
42893
43162
|
{
|
|
42894
43163
|
label: t("tableMenu.duplicateColumn"),
|
|
42895
|
-
icon:
|
|
43164
|
+
icon: import_lucide_react57.Copy,
|
|
42896
43165
|
onClick: () => duplicateColumnAt(columnHandle.index, columnHandle.cellPos)
|
|
42897
43166
|
},
|
|
42898
43167
|
{
|
|
42899
43168
|
label: t("tableMenu.clearColumnContents"),
|
|
42900
|
-
icon:
|
|
43169
|
+
icon: import_lucide_react57.Table,
|
|
42901
43170
|
onClick: () => clearColumnAt(columnHandle.index, columnHandle.cellPos)
|
|
42902
43171
|
},
|
|
42903
43172
|
{
|
|
42904
43173
|
label: t("tableMenu.deleteColumn"),
|
|
42905
|
-
icon:
|
|
43174
|
+
icon: import_lucide_react57.Trash2,
|
|
42906
43175
|
onClick: () => runAtCellPos(columnHandle.cellPos, (chain) => chain.deleteColumn()),
|
|
42907
43176
|
destructive: true
|
|
42908
43177
|
}
|
|
@@ -42914,8 +43183,8 @@ function TableControls({ editor, containerRef }) {
|
|
|
42914
43183
|
const menuLeft = Math.max(8, layout.tableLeft);
|
|
42915
43184
|
const rowHandleLeft = layout.tableLeft - 12;
|
|
42916
43185
|
const columnHandleTop = layout.tableTop - 12;
|
|
42917
|
-
return /* @__PURE__ */ (0,
|
|
42918
|
-
/* @__PURE__ */ (0,
|
|
43186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(import_jsx_runtime101.Fragment, { children: [
|
|
43187
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
42919
43188
|
TableRowHandles,
|
|
42920
43189
|
{
|
|
42921
43190
|
activeRowIndex: layout.activeRowIndex,
|
|
@@ -42932,7 +43201,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42932
43201
|
rowHandles: layout.rowHandles
|
|
42933
43202
|
}
|
|
42934
43203
|
),
|
|
42935
|
-
/* @__PURE__ */ (0,
|
|
43204
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
42936
43205
|
TableColumnHandles,
|
|
42937
43206
|
{
|
|
42938
43207
|
activeColumnIndex: layout.activeColumnIndex,
|
|
@@ -42949,7 +43218,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42949
43218
|
openMenuKey
|
|
42950
43219
|
}
|
|
42951
43220
|
),
|
|
42952
|
-
/* @__PURE__ */ (0,
|
|
43221
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
42953
43222
|
TableControlMenu,
|
|
42954
43223
|
{
|
|
42955
43224
|
controlsVisible,
|
|
@@ -42964,7 +43233,18 @@ function TableControls({ editor, containerRef }) {
|
|
|
42964
43233
|
top: menuTop
|
|
42965
43234
|
}
|
|
42966
43235
|
),
|
|
42967
|
-
/* @__PURE__ */ (0,
|
|
43236
|
+
dragPreview === null && /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
43237
|
+
TableResizeHandles,
|
|
43238
|
+
{
|
|
43239
|
+
active: tableResizeActive,
|
|
43240
|
+
ctrlHint: t("tableMenu.resizeCtrlHint"),
|
|
43241
|
+
frameRef: tableResizeFrameRef,
|
|
43242
|
+
layout,
|
|
43243
|
+
onStartResize: startTableResize,
|
|
43244
|
+
resizeBothLabel: t("tableMenu.resizeBoth")
|
|
43245
|
+
}
|
|
43246
|
+
),
|
|
43247
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
42968
43248
|
TableAddRails,
|
|
42969
43249
|
{
|
|
42970
43250
|
addColumnVisible: hoverState.addColumnVisible,
|
|
@@ -42978,7 +43258,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42978
43258
|
quickAddRowLabel: t("tableMenu.quickAddRowAfter")
|
|
42979
43259
|
}
|
|
42980
43260
|
),
|
|
42981
|
-
/* @__PURE__ */ (0,
|
|
43261
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
42982
43262
|
TableDragPreview,
|
|
42983
43263
|
{
|
|
42984
43264
|
columnDragLabel: t("tableMenu.dragColumn"),
|
|
@@ -44097,7 +44377,7 @@ function useFormulaCoordinateOverlay(editor, containerRef, labels) {
|
|
|
44097
44377
|
// src/components/UEditor/menu-bar.tsx
|
|
44098
44378
|
var import_react80 = __toESM(require("react"), 1);
|
|
44099
44379
|
var import_react81 = require("@tiptap/react");
|
|
44100
|
-
var
|
|
44380
|
+
var import_lucide_react58 = require("lucide-react");
|
|
44101
44381
|
|
|
44102
44382
|
// src/components/UEditor/preview-html.ts
|
|
44103
44383
|
var DEFAULT_TABLE_COLUMN_WIDTH2 = 100;
|
|
@@ -44236,14 +44516,14 @@ function prepareUEditorPreviewHtml(html) {
|
|
|
44236
44516
|
}
|
|
44237
44517
|
|
|
44238
44518
|
// src/components/UEditor/menu-bar.tsx
|
|
44239
|
-
var
|
|
44519
|
+
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
44240
44520
|
function MenuTableInsertGrid({
|
|
44241
44521
|
insertLabel,
|
|
44242
44522
|
previewTemplate,
|
|
44243
44523
|
onInsert
|
|
44244
44524
|
}) {
|
|
44245
44525
|
const closeMenu = useDropdownMenuClose();
|
|
44246
|
-
return /* @__PURE__ */ (0,
|
|
44526
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
44247
44527
|
TableInsertGrid,
|
|
44248
44528
|
{
|
|
44249
44529
|
insertLabel,
|
|
@@ -44259,9 +44539,9 @@ function renderMenuItems(items) {
|
|
|
44259
44539
|
return items.map((item, i) => {
|
|
44260
44540
|
switch (item.type) {
|
|
44261
44541
|
case "separator":
|
|
44262
|
-
return /* @__PURE__ */ (0,
|
|
44542
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(DropdownMenuSeparator, {}, i);
|
|
44263
44543
|
case "action":
|
|
44264
|
-
return /* @__PURE__ */ (0,
|
|
44544
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
44265
44545
|
DropdownMenuItem,
|
|
44266
44546
|
{
|
|
44267
44547
|
label: item.label,
|
|
@@ -44275,9 +44555,9 @@ function renderMenuItems(items) {
|
|
|
44275
44555
|
i
|
|
44276
44556
|
);
|
|
44277
44557
|
case "sub":
|
|
44278
|
-
return /* @__PURE__ */ (0,
|
|
44558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(DropdownMenuSub, { label: item.label, icon: item.icon, disabled: item.disabled, children: renderMenuItems(item.items) }, i);
|
|
44279
44559
|
case "custom":
|
|
44280
|
-
return /* @__PURE__ */ (0,
|
|
44560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_react80.default.Fragment, { children: item.render() }, item.key);
|
|
44281
44561
|
}
|
|
44282
44562
|
});
|
|
44283
44563
|
}
|
|
@@ -44315,7 +44595,7 @@ function buildEditMenuItems(t, editor) {
|
|
|
44315
44595
|
{
|
|
44316
44596
|
type: "action",
|
|
44317
44597
|
label: t("menubar.undo"),
|
|
44318
|
-
icon:
|
|
44598
|
+
icon: import_lucide_react58.Undo,
|
|
44319
44599
|
shortcut: t("menubar.undoShortcut"),
|
|
44320
44600
|
onClick: () => editor.chain().focus().undo().run(),
|
|
44321
44601
|
disabled: !editor.can().undo()
|
|
@@ -44323,7 +44603,7 @@ function buildEditMenuItems(t, editor) {
|
|
|
44323
44603
|
{
|
|
44324
44604
|
type: "action",
|
|
44325
44605
|
label: t("menubar.redo"),
|
|
44326
|
-
icon:
|
|
44606
|
+
icon: import_lucide_react58.Redo,
|
|
44327
44607
|
shortcut: t("menubar.redoShortcut"),
|
|
44328
44608
|
onClick: () => editor.chain().focus().redo().run(),
|
|
44329
44609
|
disabled: !editor.can().redo()
|
|
@@ -44332,7 +44612,7 @@ function buildEditMenuItems(t, editor) {
|
|
|
44332
44612
|
{
|
|
44333
44613
|
type: "action",
|
|
44334
44614
|
label: t("menubar.cut"),
|
|
44335
|
-
icon:
|
|
44615
|
+
icon: import_lucide_react58.Scissors,
|
|
44336
44616
|
shortcut: t("menubar.cutShortcut"),
|
|
44337
44617
|
onClick: () => document.execCommand("cut")
|
|
44338
44618
|
},
|
|
@@ -44380,7 +44660,7 @@ function buildViewMenuItems(t, {
|
|
|
44380
44660
|
{
|
|
44381
44661
|
type: "action",
|
|
44382
44662
|
label: t("menubar.sourceCode"),
|
|
44383
|
-
icon:
|
|
44663
|
+
icon: import_lucide_react58.FileCode,
|
|
44384
44664
|
onClick: () => onSourceCode ? onSourceCode() : openSourceDialog()
|
|
44385
44665
|
},
|
|
44386
44666
|
{
|
|
@@ -44392,7 +44672,7 @@ function buildViewMenuItems(t, {
|
|
|
44392
44672
|
{
|
|
44393
44673
|
type: "action",
|
|
44394
44674
|
label: t("menubar.fullscreen"),
|
|
44395
|
-
icon:
|
|
44675
|
+
icon: import_lucide_react58.Maximize2,
|
|
44396
44676
|
shortcut: t("menubar.fullscreenShortcut"),
|
|
44397
44677
|
onClick: () => {
|
|
44398
44678
|
const el = containerRef.current;
|
|
@@ -44411,7 +44691,7 @@ function buildFormatMenuItems(t, editor) {
|
|
|
44411
44691
|
{
|
|
44412
44692
|
type: "action",
|
|
44413
44693
|
label: t("menubar.bold"),
|
|
44414
|
-
icon:
|
|
44694
|
+
icon: import_lucide_react58.Bold,
|
|
44415
44695
|
shortcut: t("menubar.boldShortcut"),
|
|
44416
44696
|
active: editor.isActive("bold"),
|
|
44417
44697
|
onClick: () => editor.chain().focus().toggleBold().run()
|
|
@@ -44419,7 +44699,7 @@ function buildFormatMenuItems(t, editor) {
|
|
|
44419
44699
|
{
|
|
44420
44700
|
type: "action",
|
|
44421
44701
|
label: t("menubar.italic"),
|
|
44422
|
-
icon:
|
|
44702
|
+
icon: import_lucide_react58.Italic,
|
|
44423
44703
|
shortcut: t("menubar.italicShortcut"),
|
|
44424
44704
|
active: editor.isActive("italic"),
|
|
44425
44705
|
onClick: () => editor.chain().focus().toggleItalic().run()
|
|
@@ -44427,7 +44707,7 @@ function buildFormatMenuItems(t, editor) {
|
|
|
44427
44707
|
{
|
|
44428
44708
|
type: "action",
|
|
44429
44709
|
label: t("menubar.underline"),
|
|
44430
|
-
icon:
|
|
44710
|
+
icon: import_lucide_react58.Underline,
|
|
44431
44711
|
shortcut: t("menubar.underlineShortcut"),
|
|
44432
44712
|
active: editor.isActive("underline"),
|
|
44433
44713
|
onClick: () => editor.chain().focus().toggleUnderline().run()
|
|
@@ -44435,28 +44715,28 @@ function buildFormatMenuItems(t, editor) {
|
|
|
44435
44715
|
{
|
|
44436
44716
|
type: "action",
|
|
44437
44717
|
label: t("menubar.strike"),
|
|
44438
|
-
icon:
|
|
44718
|
+
icon: import_lucide_react58.Strikethrough,
|
|
44439
44719
|
active: editor.isActive("strike"),
|
|
44440
44720
|
onClick: () => editor.chain().focus().toggleStrike().run()
|
|
44441
44721
|
},
|
|
44442
44722
|
{
|
|
44443
44723
|
type: "action",
|
|
44444
44724
|
label: t("menubar.superscript"),
|
|
44445
|
-
icon:
|
|
44725
|
+
icon: import_lucide_react58.Superscript,
|
|
44446
44726
|
active: editor.isActive("superscript"),
|
|
44447
44727
|
onClick: () => editor.chain().focus().toggleSuperscript().run()
|
|
44448
44728
|
},
|
|
44449
44729
|
{
|
|
44450
44730
|
type: "action",
|
|
44451
44731
|
label: t("menubar.subscript"),
|
|
44452
|
-
icon:
|
|
44732
|
+
icon: import_lucide_react58.Subscript,
|
|
44453
44733
|
active: editor.isActive("subscript"),
|
|
44454
44734
|
onClick: () => editor.chain().focus().toggleSubscript().run()
|
|
44455
44735
|
},
|
|
44456
44736
|
{
|
|
44457
44737
|
type: "action",
|
|
44458
44738
|
label: t("menubar.code"),
|
|
44459
|
-
icon:
|
|
44739
|
+
icon: import_lucide_react58.Code,
|
|
44460
44740
|
active: editor.isActive("code"),
|
|
44461
44741
|
onClick: () => editor.chain().focus().toggleCode().run()
|
|
44462
44742
|
},
|
|
@@ -44474,21 +44754,21 @@ function buildFormatMenuItems(t, editor) {
|
|
|
44474
44754
|
{
|
|
44475
44755
|
type: "action",
|
|
44476
44756
|
label: t("menubar.heading1"),
|
|
44477
|
-
icon:
|
|
44757
|
+
icon: import_lucide_react58.Heading1,
|
|
44478
44758
|
active: editor.isActive("heading", { level: 1 }),
|
|
44479
44759
|
onClick: () => editor.chain().focus().toggleHeading({ level: 1 }).run()
|
|
44480
44760
|
},
|
|
44481
44761
|
{
|
|
44482
44762
|
type: "action",
|
|
44483
44763
|
label: t("menubar.heading2"),
|
|
44484
|
-
icon:
|
|
44764
|
+
icon: import_lucide_react58.Heading2,
|
|
44485
44765
|
active: editor.isActive("heading", { level: 2 }),
|
|
44486
44766
|
onClick: () => editor.chain().focus().toggleHeading({ level: 2 }).run()
|
|
44487
44767
|
},
|
|
44488
44768
|
{
|
|
44489
44769
|
type: "action",
|
|
44490
44770
|
label: t("menubar.heading3"),
|
|
44491
|
-
icon:
|
|
44771
|
+
icon: import_lucide_react58.Heading3,
|
|
44492
44772
|
active: editor.isActive("heading", { level: 3 }),
|
|
44493
44773
|
onClick: () => editor.chain().focus().toggleHeading({ level: 3 }).run()
|
|
44494
44774
|
},
|
|
@@ -44496,21 +44776,21 @@ function buildFormatMenuItems(t, editor) {
|
|
|
44496
44776
|
{
|
|
44497
44777
|
type: "action",
|
|
44498
44778
|
label: t("menubar.blockquote"),
|
|
44499
|
-
icon:
|
|
44779
|
+
icon: import_lucide_react58.Quote,
|
|
44500
44780
|
active: editor.isActive("blockquote"),
|
|
44501
44781
|
onClick: () => editor.chain().focus().toggleBlockquote().run()
|
|
44502
44782
|
},
|
|
44503
44783
|
{
|
|
44504
44784
|
type: "action",
|
|
44505
44785
|
label: t("menubar.codeBlock"),
|
|
44506
|
-
icon:
|
|
44786
|
+
icon: import_lucide_react58.FileCode,
|
|
44507
44787
|
active: editor.isActive("codeBlock"),
|
|
44508
44788
|
onClick: () => editor.chain().focus().toggleCodeBlock().run()
|
|
44509
44789
|
},
|
|
44510
44790
|
{
|
|
44511
44791
|
type: "action",
|
|
44512
44792
|
label: t("menubar.taskList"),
|
|
44513
|
-
icon:
|
|
44793
|
+
icon: import_lucide_react58.ListTodo,
|
|
44514
44794
|
active: editor.isActive("taskList"),
|
|
44515
44795
|
onClick: () => editor.chain().focus().toggleTaskList().run()
|
|
44516
44796
|
}
|
|
@@ -44523,28 +44803,28 @@ function buildFormatMenuItems(t, editor) {
|
|
|
44523
44803
|
{
|
|
44524
44804
|
type: "action",
|
|
44525
44805
|
label: t("menubar.alignLeft"),
|
|
44526
|
-
icon:
|
|
44806
|
+
icon: import_lucide_react58.AlignLeft,
|
|
44527
44807
|
active: editor.isActive({ textAlign: "left" }),
|
|
44528
44808
|
onClick: () => editor.chain().focus().setTextAlign("left").run()
|
|
44529
44809
|
},
|
|
44530
44810
|
{
|
|
44531
44811
|
type: "action",
|
|
44532
44812
|
label: t("menubar.alignCenter"),
|
|
44533
|
-
icon:
|
|
44813
|
+
icon: import_lucide_react58.AlignCenter,
|
|
44534
44814
|
active: editor.isActive({ textAlign: "center" }),
|
|
44535
44815
|
onClick: () => editor.chain().focus().setTextAlign("center").run()
|
|
44536
44816
|
},
|
|
44537
44817
|
{
|
|
44538
44818
|
type: "action",
|
|
44539
44819
|
label: t("menubar.alignRight"),
|
|
44540
|
-
icon:
|
|
44820
|
+
icon: import_lucide_react58.AlignRight,
|
|
44541
44821
|
active: editor.isActive({ textAlign: "right" }),
|
|
44542
44822
|
onClick: () => editor.chain().focus().setTextAlign("right").run()
|
|
44543
44823
|
},
|
|
44544
44824
|
{
|
|
44545
44825
|
type: "action",
|
|
44546
44826
|
label: t("menubar.alignJustify"),
|
|
44547
|
-
icon:
|
|
44827
|
+
icon: import_lucide_react58.AlignJustify,
|
|
44548
44828
|
active: editor.isActive({ textAlign: "justify" }),
|
|
44549
44829
|
onClick: () => editor.chain().focus().setTextAlign("justify").run()
|
|
44550
44830
|
}
|
|
@@ -44563,7 +44843,7 @@ function buildToolsMenuItems(t, { onSourceCode, openSourceDialog }) {
|
|
|
44563
44843
|
{
|
|
44564
44844
|
type: "action",
|
|
44565
44845
|
label: t("menubar.sourceCode"),
|
|
44566
|
-
icon:
|
|
44846
|
+
icon: import_lucide_react58.FileCode,
|
|
44567
44847
|
onClick: () => onSourceCode ? onSourceCode() : openSourceDialog()
|
|
44568
44848
|
}
|
|
44569
44849
|
];
|
|
@@ -44574,12 +44854,12 @@ function buildTableMenuItems(t, editor, onInsertTable) {
|
|
|
44574
44854
|
{
|
|
44575
44855
|
type: "sub",
|
|
44576
44856
|
label: t("menubar.insertTable"),
|
|
44577
|
-
icon:
|
|
44857
|
+
icon: import_lucide_react58.Table,
|
|
44578
44858
|
items: [
|
|
44579
44859
|
{
|
|
44580
44860
|
type: "custom",
|
|
44581
44861
|
key: "table-insert-grid",
|
|
44582
|
-
render: () => /* @__PURE__ */ (0,
|
|
44862
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
44583
44863
|
MenuTableInsertGrid,
|
|
44584
44864
|
{
|
|
44585
44865
|
insertLabel: t("tableMenu.insertTable"),
|
|
@@ -44600,7 +44880,7 @@ function buildTableMenuItems(t, editor, onInsertTable) {
|
|
|
44600
44880
|
{
|
|
44601
44881
|
type: "action",
|
|
44602
44882
|
label: t("menubar.deleteTable"),
|
|
44603
|
-
icon:
|
|
44883
|
+
icon: import_lucide_react58.Trash2,
|
|
44604
44884
|
destructive: true,
|
|
44605
44885
|
disabled: !inTable,
|
|
44606
44886
|
onClick: () => editor.chain().focus().deleteTable().run()
|
|
@@ -44654,7 +44934,7 @@ function buildTableMenuItems(t, editor, onInsertTable) {
|
|
|
44654
44934
|
];
|
|
44655
44935
|
}
|
|
44656
44936
|
var MenuBarTrigger = import_react80.default.forwardRef(
|
|
44657
|
-
({ children, className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
44937
|
+
({ children, className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
44658
44938
|
"button",
|
|
44659
44939
|
{
|
|
44660
44940
|
ref,
|
|
@@ -44692,7 +44972,7 @@ var MenuBar = ({
|
|
|
44692
44972
|
const fileInputRef = (0, import_react80.useRef)(null);
|
|
44693
44973
|
const [showImageInput, setShowImageInput] = (0, import_react80.useState)(false);
|
|
44694
44974
|
const [showLinkInput, setShowLinkInput] = (0, import_react80.useState)(false);
|
|
44695
|
-
const [
|
|
44975
|
+
const [openMenuKey, setOpenMenuKey] = (0, import_react80.useState)(null);
|
|
44696
44976
|
const [showSourceDialog, setShowSourceDialog] = (0, import_react80.useState)(false);
|
|
44697
44977
|
const [sourceHtml, setSourceHtml] = (0, import_react80.useState)("");
|
|
44698
44978
|
const [showPreviewDialog, setShowPreviewDialog] = (0, import_react80.useState)(false);
|
|
@@ -44716,7 +44996,7 @@ var MenuBar = ({
|
|
|
44716
44996
|
setShowSourceDialog(false);
|
|
44717
44997
|
};
|
|
44718
44998
|
const closeInsertMenu = () => {
|
|
44719
|
-
|
|
44999
|
+
setOpenMenuKey(null);
|
|
44720
45000
|
setShowImageInput(false);
|
|
44721
45001
|
setShowLinkInput(false);
|
|
44722
45002
|
};
|
|
@@ -44743,7 +45023,7 @@ var MenuBar = ({
|
|
|
44743
45023
|
} catch {
|
|
44744
45024
|
}
|
|
44745
45025
|
}
|
|
44746
|
-
|
|
45026
|
+
closeInsertMenu();
|
|
44747
45027
|
};
|
|
44748
45028
|
const handleInsertTable = (rows, cols) => {
|
|
44749
45029
|
editor.chain().focus().insertTable({ rows, cols, withHeaderRow: true }).run();
|
|
@@ -44757,13 +45037,13 @@ var MenuBar = ({
|
|
|
44757
45037
|
{
|
|
44758
45038
|
type: "custom",
|
|
44759
45039
|
key: "image",
|
|
44760
|
-
render: () => showImageInput ? /* @__PURE__ */ (0,
|
|
44761
|
-
/* @__PURE__ */ (0,
|
|
44762
|
-
/* @__PURE__ */ (0,
|
|
45040
|
+
render: () => showImageInput ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(ImageInput, { onSubmit: handleImageUrl, onCancel: () => setShowImageInput(false) }) : /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)(import_jsx_runtime102.Fragment, { children: [
|
|
45041
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(DropdownMenuItem, { label: t("menubar.image"), icon: import_lucide_react58.Image, onClick: () => setShowImageInput(true), closeOnSelect: false }),
|
|
45042
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
44763
45043
|
DropdownMenuItem,
|
|
44764
45044
|
{
|
|
44765
45045
|
label: t("menubar.imageUpload"),
|
|
44766
|
-
icon:
|
|
45046
|
+
icon: import_lucide_react58.Upload,
|
|
44767
45047
|
onClick: () => fileInputRef.current?.click(),
|
|
44768
45048
|
closeOnSelect: false
|
|
44769
45049
|
}
|
|
@@ -44774,11 +45054,11 @@ var MenuBar = ({
|
|
|
44774
45054
|
{
|
|
44775
45055
|
type: "custom",
|
|
44776
45056
|
key: "link",
|
|
44777
|
-
render: () => showLinkInput ? /* @__PURE__ */ (0,
|
|
45057
|
+
render: () => showLinkInput ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(LinkInput, { onSubmit: handleLinkSubmit, onCancel: () => setShowLinkInput(false), initialUrl: editor.getAttributes("link").href ?? "" }) : /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
44778
45058
|
DropdownMenuItem,
|
|
44779
45059
|
{
|
|
44780
45060
|
label: t("menubar.link"),
|
|
44781
|
-
icon:
|
|
45061
|
+
icon: import_lucide_react58.Link,
|
|
44782
45062
|
shortcut: t("menubar.linkShortcut"),
|
|
44783
45063
|
onClick: () => setShowLinkInput(true),
|
|
44784
45064
|
closeOnSelect: false
|
|
@@ -44789,12 +45069,12 @@ var MenuBar = ({
|
|
|
44789
45069
|
{
|
|
44790
45070
|
type: "sub",
|
|
44791
45071
|
label: t("menubar.insertTable"),
|
|
44792
|
-
icon:
|
|
45072
|
+
icon: import_lucide_react58.Table,
|
|
44793
45073
|
items: [
|
|
44794
45074
|
{
|
|
44795
45075
|
type: "custom",
|
|
44796
45076
|
key: "table-grid",
|
|
44797
|
-
render: () => /* @__PURE__ */ (0,
|
|
45077
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
44798
45078
|
MenuTableInsertGrid,
|
|
44799
45079
|
{
|
|
44800
45080
|
insertLabel: t("tableMenu.insertTable"),
|
|
@@ -44809,24 +45089,24 @@ var MenuBar = ({
|
|
|
44809
45089
|
{
|
|
44810
45090
|
type: "sub",
|
|
44811
45091
|
label: t("menubar.formFields") || "Form Fields",
|
|
44812
|
-
icon:
|
|
45092
|
+
icon: import_lucide_react58.ListTodo,
|
|
44813
45093
|
items: [
|
|
44814
45094
|
{
|
|
44815
45095
|
type: "action",
|
|
44816
45096
|
label: t("menubar.formCheckbox") || "Form Checkbox",
|
|
44817
|
-
icon:
|
|
45097
|
+
icon: import_lucide_react58.Square,
|
|
44818
45098
|
onClick: () => editor.chain().focus().setFormCheckbox().run()
|
|
44819
45099
|
},
|
|
44820
45100
|
{
|
|
44821
45101
|
type: "action",
|
|
44822
45102
|
label: t("slashCommand.roundCheckbox") || "Round Checkbox",
|
|
44823
|
-
icon:
|
|
45103
|
+
icon: import_lucide_react58.CircleCheckBig,
|
|
44824
45104
|
onClick: () => editor.chain().focus().setFormCheckbox({ variant: "circle" }).run()
|
|
44825
45105
|
},
|
|
44826
45106
|
{
|
|
44827
45107
|
type: "action",
|
|
44828
45108
|
label: t("menubar.formRadio") || "Form Radio Button",
|
|
44829
|
-
icon:
|
|
45109
|
+
icon: import_lucide_react58.CircleDot,
|
|
44830
45110
|
onClick: () => editor.chain().focus().setFormRadio().run()
|
|
44831
45111
|
}
|
|
44832
45112
|
]
|
|
@@ -44840,41 +45120,31 @@ var MenuBar = ({
|
|
|
44840
45120
|
];
|
|
44841
45121
|
const menus = [
|
|
44842
45122
|
{
|
|
45123
|
+
key: "file",
|
|
44843
45124
|
label: t("menubar.file"),
|
|
44844
|
-
items: buildFileMenuItems(t, editor, { onSave, onExport })
|
|
44845
|
-
open: void 0,
|
|
44846
|
-
onOpenChange: void 0
|
|
45125
|
+
items: buildFileMenuItems(t, editor, { onSave, onExport })
|
|
44847
45126
|
},
|
|
44848
|
-
{ label: t("menubar.edit"), items: buildEditMenuItems(t, editor)
|
|
45127
|
+
{ key: "edit", label: t("menubar.edit"), items: buildEditMenuItems(t, editor) },
|
|
44849
45128
|
{
|
|
45129
|
+
key: "view",
|
|
44850
45130
|
label: t("menubar.view"),
|
|
44851
|
-
items: buildViewMenuItems(t, { containerRef, onSourceCode, openSourceDialog, onPreview: handlePreview, openPreviewDialog })
|
|
44852
|
-
open: void 0,
|
|
44853
|
-
onOpenChange: void 0
|
|
45131
|
+
items: buildViewMenuItems(t, { containerRef, onSourceCode, openSourceDialog, onPreview: handlePreview, openPreviewDialog })
|
|
44854
45132
|
},
|
|
44855
45133
|
{
|
|
45134
|
+
key: "insert",
|
|
44856
45135
|
label: t("menubar.insert"),
|
|
44857
|
-
items: insertMenuItems
|
|
44858
|
-
open: isInsertMenuOpen,
|
|
44859
|
-
onOpenChange: (open) => {
|
|
44860
|
-
setIsInsertMenuOpen(open);
|
|
44861
|
-
if (!open) {
|
|
44862
|
-
setShowImageInput(false);
|
|
44863
|
-
setShowLinkInput(false);
|
|
44864
|
-
}
|
|
44865
|
-
}
|
|
45136
|
+
items: insertMenuItems
|
|
44866
45137
|
},
|
|
44867
|
-
{ label: t("menubar.format"), items: buildFormatMenuItems(t, editor)
|
|
45138
|
+
{ key: "format", label: t("menubar.format"), items: buildFormatMenuItems(t, editor) },
|
|
44868
45139
|
{
|
|
45140
|
+
key: "tools",
|
|
44869
45141
|
label: t("menubar.tools"),
|
|
44870
|
-
items: buildToolsMenuItems(t, { onSourceCode, openSourceDialog })
|
|
44871
|
-
open: void 0,
|
|
44872
|
-
onOpenChange: void 0
|
|
45142
|
+
items: buildToolsMenuItems(t, { onSourceCode, openSourceDialog })
|
|
44873
45143
|
},
|
|
44874
|
-
{ label: t("menubar.table"), items: buildTableMenuItems(t, editor, handleInsertTable)
|
|
45144
|
+
{ key: "table", label: t("menubar.table"), items: buildTableMenuItems(t, editor, handleInsertTable) }
|
|
44875
45145
|
];
|
|
44876
|
-
return /* @__PURE__ */ (0,
|
|
44877
|
-
/* @__PURE__ */ (0,
|
|
45146
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)(import_jsx_runtime102.Fragment, { children: [
|
|
45147
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
44878
45148
|
"input",
|
|
44879
45149
|
{
|
|
44880
45150
|
ref: fileInputRef,
|
|
@@ -44885,19 +45155,26 @@ var MenuBar = ({
|
|
|
44885
45155
|
onChange: (e) => handleImageFiles(e.target.files)
|
|
44886
45156
|
}
|
|
44887
45157
|
),
|
|
44888
|
-
/* @__PURE__ */ (0,
|
|
44889
|
-
menus.map(({ label, items
|
|
45158
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "flex items-center gap-0.5 border-b border-border/35 bg-muted/20 px-1.5 py-0.5", children: [
|
|
45159
|
+
menus.map(({ key, label, items }) => /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
44890
45160
|
DropdownMenu,
|
|
44891
45161
|
{
|
|
44892
|
-
trigger: /* @__PURE__ */ (0,
|
|
45162
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(MenuBarTrigger, { children: label }),
|
|
44893
45163
|
placement: "bottom-start",
|
|
44894
|
-
isOpen:
|
|
44895
|
-
onOpenChange
|
|
45164
|
+
isOpen: openMenuKey === key,
|
|
45165
|
+
onOpenChange: (open) => {
|
|
45166
|
+
setOpenMenuKey((current) => open ? key : current === key ? null : current);
|
|
45167
|
+
if (key === "insert" && !open) {
|
|
45168
|
+
setShowImageInput(false);
|
|
45169
|
+
setShowLinkInput(false);
|
|
45170
|
+
}
|
|
45171
|
+
},
|
|
45172
|
+
openOnHover: true,
|
|
44896
45173
|
children: renderMenuItems(items)
|
|
44897
45174
|
},
|
|
44898
|
-
|
|
45175
|
+
key
|
|
44899
45176
|
)),
|
|
44900
|
-
/* @__PURE__ */ (0,
|
|
45177
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
44901
45178
|
"button",
|
|
44902
45179
|
{
|
|
44903
45180
|
type: "button",
|
|
@@ -44908,20 +45185,20 @@ var MenuBar = ({
|
|
|
44908
45185
|
"ml-auto inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors",
|
|
44909
45186
|
"hover:bg-accent hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1"
|
|
44910
45187
|
),
|
|
44911
|
-
children: /* @__PURE__ */ (0,
|
|
45188
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_lucide_react58.Eye, { className: "h-4 w-4", "aria-hidden": "true" })
|
|
44912
45189
|
}
|
|
44913
45190
|
)
|
|
44914
45191
|
] }),
|
|
44915
|
-
/* @__PURE__ */ (0,
|
|
45192
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
44916
45193
|
Modal_default,
|
|
44917
45194
|
{
|
|
44918
45195
|
isOpen: showSourceDialog,
|
|
44919
45196
|
onClose: () => setShowSourceDialog(false),
|
|
44920
45197
|
title: t("menubar.sourceCode"),
|
|
44921
45198
|
size: "lg",
|
|
44922
|
-
children: /* @__PURE__ */ (0,
|
|
44923
|
-
/* @__PURE__ */ (0,
|
|
44924
|
-
/* @__PURE__ */ (0,
|
|
45199
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "space-y-3", children: [
|
|
45200
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)("p", { className: "text-xs text-muted-foreground", children: t("menubar.sourceCodeHint") }),
|
|
45201
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
44925
45202
|
"textarea",
|
|
44926
45203
|
{
|
|
44927
45204
|
"data-testid": "source-code-textarea",
|
|
@@ -44931,8 +45208,8 @@ var MenuBar = ({
|
|
|
44931
45208
|
spellCheck: false
|
|
44932
45209
|
}
|
|
44933
45210
|
),
|
|
44934
|
-
/* @__PURE__ */ (0,
|
|
44935
|
-
/* @__PURE__ */ (0,
|
|
45211
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "flex gap-2 justify-end", children: [
|
|
45212
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
44936
45213
|
"button",
|
|
44937
45214
|
{
|
|
44938
45215
|
type: "button",
|
|
@@ -44941,7 +45218,7 @@ var MenuBar = ({
|
|
|
44941
45218
|
children: t("menubar.applySource")
|
|
44942
45219
|
}
|
|
44943
45220
|
),
|
|
44944
|
-
/* @__PURE__ */ (0,
|
|
45221
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
44945
45222
|
"button",
|
|
44946
45223
|
{
|
|
44947
45224
|
type: "button",
|
|
@@ -44954,7 +45231,7 @@ var MenuBar = ({
|
|
|
44954
45231
|
] })
|
|
44955
45232
|
}
|
|
44956
45233
|
),
|
|
44957
|
-
/* @__PURE__ */ (0,
|
|
45234
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
44958
45235
|
Modal_default,
|
|
44959
45236
|
{
|
|
44960
45237
|
isOpen: showPreviewDialog,
|
|
@@ -44965,12 +45242,12 @@ var MenuBar = ({
|
|
|
44965
45242
|
height: "min(860px, calc(100vh - 2rem))",
|
|
44966
45243
|
className: "flex flex-col overflow-hidden rounded-xl md:rounded-2xl",
|
|
44967
45244
|
contentClassName: "flex min-h-0 flex-1 overflow-hidden p-0",
|
|
44968
|
-
children: /* @__PURE__ */ (0,
|
|
45245
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
44969
45246
|
"div",
|
|
44970
45247
|
{
|
|
44971
45248
|
"data-testid": "preview-content",
|
|
44972
45249
|
className: "min-h-0 flex-1 overflow-y-auto overscroll-contain",
|
|
44973
|
-
children: editor.isEmpty ? /* @__PURE__ */ (0,
|
|
45250
|
+
children: editor.isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("p", { className: "text-muted-foreground text-sm", children: t("menubar.previewEmpty") }) : /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
44974
45251
|
"div",
|
|
44975
45252
|
{
|
|
44976
45253
|
className: UEDITOR_PROSEMIRROR_CLASS_NAME,
|
|
@@ -44987,8 +45264,8 @@ var MenuBar = ({
|
|
|
44987
45264
|
// src/components/UEditor/table-formula-bar.tsx
|
|
44988
45265
|
var import_react82 = require("react");
|
|
44989
45266
|
var import_react83 = require("@tiptap/react");
|
|
44990
|
-
var
|
|
44991
|
-
var
|
|
45267
|
+
var import_lucide_react59 = require("lucide-react");
|
|
45268
|
+
var import_jsx_runtime103 = require("react/jsx-runtime");
|
|
44992
45269
|
function TableFormulaBar({ editor }) {
|
|
44993
45270
|
const t = useSmartTranslations("UEditor");
|
|
44994
45271
|
const inputRef = (0, import_react82.useRef)(null);
|
|
@@ -45038,7 +45315,7 @@ function TableFormulaBar({ editor }) {
|
|
|
45038
45315
|
if (!editor.isDestroyed) editor.commands.focus();
|
|
45039
45316
|
}, 0);
|
|
45040
45317
|
};
|
|
45041
|
-
return /* @__PURE__ */ (0,
|
|
45318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(
|
|
45042
45319
|
"div",
|
|
45043
45320
|
{
|
|
45044
45321
|
"data-ueditor-formula-bar": "",
|
|
@@ -45046,7 +45323,7 @@ function TableFormulaBar({ editor }) {
|
|
|
45046
45323
|
"aria-label": t("tableMenu.formulaBar"),
|
|
45047
45324
|
className: "flex min-h-10 items-center gap-2 border-b border-border/60 bg-muted/25 px-2 py-1.5",
|
|
45048
45325
|
children: [
|
|
45049
|
-
/* @__PURE__ */ (0,
|
|
45326
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
45050
45327
|
"span",
|
|
45051
45328
|
{
|
|
45052
45329
|
"data-ueditor-formula-cell-label": "",
|
|
@@ -45054,8 +45331,8 @@ function TableFormulaBar({ editor }) {
|
|
|
45054
45331
|
children: selectedCell.label
|
|
45055
45332
|
}
|
|
45056
45333
|
),
|
|
45057
|
-
/* @__PURE__ */ (0,
|
|
45058
|
-
/* @__PURE__ */ (0,
|
|
45334
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(import_lucide_react59.Sigma, { "aria-hidden": "true", className: "h-4 w-4 shrink-0 text-primary" }),
|
|
45335
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
45059
45336
|
"input",
|
|
45060
45337
|
{
|
|
45061
45338
|
ref: inputRef,
|
|
@@ -45076,18 +45353,18 @@ function TableFormulaBar({ editor }) {
|
|
|
45076
45353
|
className: "h-7 min-w-0 flex-1 rounded-md border border-border/60 bg-background px-2 font-mono text-sm text-foreground outline-none focus:border-primary/40 focus:ring-2 focus:ring-primary/15"
|
|
45077
45354
|
}
|
|
45078
45355
|
),
|
|
45079
|
-
selectedCell.formulaState === "error" && /* @__PURE__ */ (0,
|
|
45356
|
+
selectedCell.formulaState === "error" && /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(
|
|
45080
45357
|
"span",
|
|
45081
45358
|
{
|
|
45082
45359
|
role: "status",
|
|
45083
45360
|
className: "hidden shrink-0 items-center gap-1 text-xs font-medium text-destructive sm:inline-flex",
|
|
45084
45361
|
children: [
|
|
45085
|
-
/* @__PURE__ */ (0,
|
|
45362
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(import_lucide_react59.AlertCircle, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
|
|
45086
45363
|
t("tableMenu.formulaError")
|
|
45087
45364
|
]
|
|
45088
45365
|
}
|
|
45089
45366
|
),
|
|
45090
|
-
/* @__PURE__ */ (0,
|
|
45367
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
45091
45368
|
"button",
|
|
45092
45369
|
{
|
|
45093
45370
|
type: "button",
|
|
@@ -45095,10 +45372,10 @@ function TableFormulaBar({ editor }) {
|
|
|
45095
45372
|
"aria-label": t("tableMenu.apply"),
|
|
45096
45373
|
title: t("tableMenu.apply"),
|
|
45097
45374
|
className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-primary text-primary-foreground transition-colors hover:bg-primary/90",
|
|
45098
|
-
children: /* @__PURE__ */ (0,
|
|
45375
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(import_lucide_react59.Check, { "aria-hidden": "true", className: "h-4 w-4" })
|
|
45099
45376
|
}
|
|
45100
45377
|
),
|
|
45101
|
-
/* @__PURE__ */ (0,
|
|
45378
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
45102
45379
|
"button",
|
|
45103
45380
|
{
|
|
45104
45381
|
type: "button",
|
|
@@ -45109,10 +45386,10 @@ function TableFormulaBar({ editor }) {
|
|
|
45109
45386
|
"aria-label": t("tableMenu.convertToValue"),
|
|
45110
45387
|
title: t("tableMenu.convertToValue"),
|
|
45111
45388
|
className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-border/60 bg-background text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",
|
|
45112
|
-
children: /* @__PURE__ */ (0,
|
|
45389
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(import_lucide_react59.Hash, { "aria-hidden": "true", className: "h-4 w-4" })
|
|
45113
45390
|
}
|
|
45114
45391
|
),
|
|
45115
|
-
/* @__PURE__ */ (0,
|
|
45392
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
45116
45393
|
"button",
|
|
45117
45394
|
{
|
|
45118
45395
|
type: "button",
|
|
@@ -45123,7 +45400,7 @@ function TableFormulaBar({ editor }) {
|
|
|
45123
45400
|
"aria-label": t("tableMenu.clearCell"),
|
|
45124
45401
|
title: t("tableMenu.clearCell"),
|
|
45125
45402
|
className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-destructive/30 bg-background text-destructive transition-colors hover:bg-destructive/10",
|
|
45126
|
-
children: /* @__PURE__ */ (0,
|
|
45403
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(import_lucide_react59.Trash2, { "aria-hidden": "true", className: "h-4 w-4" })
|
|
45127
45404
|
}
|
|
45128
45405
|
)
|
|
45129
45406
|
]
|
|
@@ -45132,7 +45409,7 @@ function TableFormulaBar({ editor }) {
|
|
|
45132
45409
|
}
|
|
45133
45410
|
|
|
45134
45411
|
// src/components/UEditor/UEditor.tsx
|
|
45135
|
-
var
|
|
45412
|
+
var import_jsx_runtime104 = require("react/jsx-runtime");
|
|
45136
45413
|
var UEditor = import_react84.default.forwardRef(({
|
|
45137
45414
|
content = "",
|
|
45138
45415
|
onChange,
|
|
@@ -45400,7 +45677,7 @@ var UEditor = import_react84.default.forwardRef(({
|
|
|
45400
45677
|
}
|
|
45401
45678
|
}, [content, editor]);
|
|
45402
45679
|
if (!editor) {
|
|
45403
|
-
return /* @__PURE__ */ (0,
|
|
45680
|
+
return /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
45404
45681
|
"div",
|
|
45405
45682
|
{
|
|
45406
45683
|
className: cn("w-full border bg-background flex items-center justify-center text-muted-foreground", className),
|
|
@@ -45409,7 +45686,7 @@ var UEditor = import_react84.default.forwardRef(({
|
|
|
45409
45686
|
}
|
|
45410
45687
|
);
|
|
45411
45688
|
}
|
|
45412
|
-
return /* @__PURE__ */ (0,
|
|
45689
|
+
return /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)(
|
|
45413
45690
|
"div",
|
|
45414
45691
|
{
|
|
45415
45692
|
className: cn(
|
|
@@ -45425,7 +45702,7 @@ var UEditor = import_react84.default.forwardRef(({
|
|
|
45425
45702
|
className
|
|
45426
45703
|
),
|
|
45427
45704
|
children: [
|
|
45428
|
-
editable && showMenuBar && /* @__PURE__ */ (0,
|
|
45705
|
+
editable && showMenuBar && /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
45429
45706
|
MenuBar,
|
|
45430
45707
|
{
|
|
45431
45708
|
editor,
|
|
@@ -45440,7 +45717,7 @@ var UEditor = import_react84.default.forwardRef(({
|
|
|
45440
45717
|
onPreview
|
|
45441
45718
|
}
|
|
45442
45719
|
),
|
|
45443
|
-
editable && showToolbar && /* @__PURE__ */ (0,
|
|
45720
|
+
editable && showToolbar && /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
45444
45721
|
EditorToolbar,
|
|
45445
45722
|
{
|
|
45446
45723
|
editor,
|
|
@@ -45455,8 +45732,8 @@ var UEditor = import_react84.default.forwardRef(({
|
|
|
45455
45732
|
letterSpacings
|
|
45456
45733
|
}
|
|
45457
45734
|
),
|
|
45458
|
-
editable && /* @__PURE__ */ (0,
|
|
45459
|
-
editable && showBubbleMenu && /* @__PURE__ */ (0,
|
|
45735
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(TableFormulaBar, { editor }),
|
|
45736
|
+
editable && showBubbleMenu && /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
45460
45737
|
CustomBubbleMenu,
|
|
45461
45738
|
{
|
|
45462
45739
|
editor,
|
|
@@ -45464,8 +45741,8 @@ var UEditor = import_react84.default.forwardRef(({
|
|
|
45464
45741
|
lineHeights
|
|
45465
45742
|
}
|
|
45466
45743
|
),
|
|
45467
|
-
editable && showFloatingMenu && /* @__PURE__ */ (0,
|
|
45468
|
-
/* @__PURE__ */ (0,
|
|
45744
|
+
editable && showFloatingMenu && /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(CustomFloatingMenu, { editor }),
|
|
45745
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsxs)(
|
|
45469
45746
|
"div",
|
|
45470
45747
|
{
|
|
45471
45748
|
ref: (node) => {
|
|
@@ -45478,7 +45755,7 @@ var UEditor = import_react84.default.forwardRef(({
|
|
|
45478
45755
|
maxHeight
|
|
45479
45756
|
},
|
|
45480
45757
|
children: [
|
|
45481
|
-
/* @__PURE__ */ (0,
|
|
45758
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
45482
45759
|
"span",
|
|
45483
45760
|
{
|
|
45484
45761
|
ref: tableColumnGuideRef,
|
|
@@ -45486,7 +45763,7 @@ var UEditor = import_react84.default.forwardRef(({
|
|
|
45486
45763
|
className: "pointer-events-none absolute z-20 bg-primary opacity-0 transition-opacity duration-100"
|
|
45487
45764
|
}
|
|
45488
45765
|
),
|
|
45489
|
-
/* @__PURE__ */ (0,
|
|
45766
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
45490
45767
|
"span",
|
|
45491
45768
|
{
|
|
45492
45769
|
ref: tableRowGuideRef,
|
|
@@ -45494,7 +45771,7 @@ var UEditor = import_react84.default.forwardRef(({
|
|
|
45494
45771
|
className: "pointer-events-none absolute z-20 bg-primary opacity-0 transition-opacity duration-100"
|
|
45495
45772
|
}
|
|
45496
45773
|
),
|
|
45497
|
-
/* @__PURE__ */ (0,
|
|
45774
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
45498
45775
|
"span",
|
|
45499
45776
|
{
|
|
45500
45777
|
ref: activeTableCellHighlightRef,
|
|
@@ -45503,7 +45780,7 @@ var UEditor = import_react84.default.forwardRef(({
|
|
|
45503
45780
|
className: "pointer-events-none hidden absolute z-20 rounded-[2px] border-2 border-primary bg-primary/10"
|
|
45504
45781
|
}
|
|
45505
45782
|
),
|
|
45506
|
-
/* @__PURE__ */ (0,
|
|
45783
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
45507
45784
|
"div",
|
|
45508
45785
|
{
|
|
45509
45786
|
ref: formulaCoordinateOverlayRef,
|
|
@@ -45511,7 +45788,7 @@ var UEditor = import_react84.default.forwardRef(({
|
|
|
45511
45788
|
className: "pointer-events-none absolute inset-0 z-[35] hidden overflow-visible"
|
|
45512
45789
|
}
|
|
45513
45790
|
),
|
|
45514
|
-
formulaRangeHighlight && /* @__PURE__ */ (0,
|
|
45791
|
+
formulaRangeHighlight && /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
45515
45792
|
"span",
|
|
45516
45793
|
{
|
|
45517
45794
|
"aria-hidden": "true",
|
|
@@ -45529,8 +45806,15 @@ var UEditor = import_react84.default.forwardRef(({
|
|
|
45529
45806
|
}
|
|
45530
45807
|
}
|
|
45531
45808
|
),
|
|
45532
|
-
editable && /* @__PURE__ */ (0,
|
|
45533
|
-
|
|
45809
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
45810
|
+
TableControls,
|
|
45811
|
+
{
|
|
45812
|
+
editor,
|
|
45813
|
+
containerRef: editorContentRef,
|
|
45814
|
+
showCellInspector: showBubbleMenu
|
|
45815
|
+
}
|
|
45816
|
+
),
|
|
45817
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
45534
45818
|
import_react85.EditorContent,
|
|
45535
45819
|
{
|
|
45536
45820
|
editor,
|
|
@@ -45540,7 +45824,7 @@ var UEditor = import_react84.default.forwardRef(({
|
|
|
45540
45824
|
]
|
|
45541
45825
|
}
|
|
45542
45826
|
),
|
|
45543
|
-
showFooter && showCharacterCount && /* @__PURE__ */ (0,
|
|
45827
|
+
showFooter && showCharacterCount && /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(CharacterCountDisplay, { editor, maxCharacters })
|
|
45544
45828
|
]
|
|
45545
45829
|
}
|
|
45546
45830
|
);
|