@underverse-ui/underverse 1.0.153 → 1.0.155
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 +1042 -736
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +104 -0
- package/dist/index.d.ts +104 -0
- package/dist/index.js +838 -532
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -809,6 +809,15 @@ var en_default = {
|
|
|
809
809
|
noResults: "No emoji found",
|
|
810
810
|
showingCount: "Showing first {shown} of {total} emojis"
|
|
811
811
|
},
|
|
812
|
+
formulaSuggestion: {
|
|
813
|
+
title: "Functions",
|
|
814
|
+
noResults: "No function found",
|
|
815
|
+
sum: "Add values in a range",
|
|
816
|
+
avg: "Average values in a range",
|
|
817
|
+
min: "Smallest value in a range",
|
|
818
|
+
max: "Largest value in a range",
|
|
819
|
+
count: "Count numeric cells in a range"
|
|
820
|
+
},
|
|
812
821
|
tableMenu: {
|
|
813
822
|
insert3x3: "Insert 3\xD73 Table",
|
|
814
823
|
insertTable: "Insert Table",
|
|
@@ -1192,6 +1201,15 @@ var vi_default = {
|
|
|
1192
1201
|
noResults: "Kh\xF4ng t\xECm th\u1EA5y emoji",
|
|
1193
1202
|
showingCount: "Hi\u1EC3n th\u1ECB {shown} trong t\u1ED5ng s\u1ED1 {total} emoji"
|
|
1194
1203
|
},
|
|
1204
|
+
formulaSuggestion: {
|
|
1205
|
+
title: "H\xE0m",
|
|
1206
|
+
noResults: "Kh\xF4ng t\xECm th\u1EA5y h\xE0m",
|
|
1207
|
+
sum: "C\u1ED9ng c\xE1c gi\xE1 tr\u1ECB trong v\xF9ng",
|
|
1208
|
+
avg: "T\xEDnh trung b\xECnh c\xE1c gi\xE1 tr\u1ECB trong v\xF9ng",
|
|
1209
|
+
min: "Gi\xE1 tr\u1ECB nh\u1ECF nh\u1EA5t trong v\xF9ng",
|
|
1210
|
+
max: "Gi\xE1 tr\u1ECB l\u1EDBn nh\u1EA5t trong v\xF9ng",
|
|
1211
|
+
count: "\u0110\u1EBFm c\xE1c \xF4 d\u1EA1ng s\u1ED1 trong v\xF9ng"
|
|
1212
|
+
},
|
|
1195
1213
|
tableMenu: {
|
|
1196
1214
|
insert3x3: "Ch\xE8n b\u1EA3ng 3\xD73",
|
|
1197
1215
|
insertTable: "Ch\xE8n b\u1EA3ng",
|
|
@@ -1536,6 +1554,7 @@ var ko_default = {
|
|
|
1536
1554
|
dividerDesc: "\uC2DC\uAC01\uC801 \uAD6C\uBD84\uC120",
|
|
1537
1555
|
table: "\uD45C",
|
|
1538
1556
|
tableDesc: "\uD45C \uCD94\uAC00",
|
|
1557
|
+
noResults: "\uC77C\uCE58\uD558\uB294 \uBE14\uB85D\uC774 \uC5C6\uC2B5\uB2C8\uB2E4",
|
|
1539
1558
|
callout: "\uCF5C\uC544\uC6C3",
|
|
1540
1559
|
calloutDesc: "\uC911\uC694\uD55C \uC815\uBCF4\uB97C \uCF5C\uC544\uC6C3 \uBE14\uB85D\uC73C\uB85C \uAC15\uC870\uD569\uB2C8\uB2E4",
|
|
1541
1560
|
bookmark: "\uBD81\uB9C8\uD06C \uCE74\uB4DC",
|
|
@@ -1574,6 +1593,15 @@ var ko_default = {
|
|
|
1574
1593
|
noResults: "\uC774\uBAA8\uC9C0\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4",
|
|
1575
1594
|
showingCount: "\uCD1D {total}\uAC1C \uC911 \uCC98\uC74C {shown}\uAC1C\uC758 \uC774\uBAA8\uC9C0\uB97C \uD45C\uC2DC \uC911"
|
|
1576
1595
|
},
|
|
1596
|
+
formulaSuggestion: {
|
|
1597
|
+
title: "\uD568\uC218",
|
|
1598
|
+
noResults: "\uD568\uC218\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4",
|
|
1599
|
+
sum: "\uBC94\uC704\uC758 \uAC12\uC744 \uD569\uC0B0",
|
|
1600
|
+
avg: "\uBC94\uC704\uC758 \uAC12 \uD3C9\uADE0",
|
|
1601
|
+
min: "\uBC94\uC704\uC758 \uCD5C\uC19F\uAC12",
|
|
1602
|
+
max: "\uBC94\uC704\uC758 \uCD5C\uB313\uAC12",
|
|
1603
|
+
count: "\uBC94\uC704\uC758 \uC22B\uC790 \uC140 \uAC1C\uC218"
|
|
1604
|
+
},
|
|
1577
1605
|
tableMenu: {
|
|
1578
1606
|
insert3x3: "3x3 \uD45C \uC0BD\uC785",
|
|
1579
1607
|
insertTable: "\uD45C \uC0BD\uC785",
|
|
@@ -1608,6 +1636,13 @@ var ko_default = {
|
|
|
1608
1636
|
borderWidth: "\uD14C\uB450\uB9AC \uB450\uAED8",
|
|
1609
1637
|
borderColor: "\uD14C\uB450\uB9AC \uC0C9\uC0C1",
|
|
1610
1638
|
clearBorder: "\uD14C\uB450\uB9AC \uC9C0\uC6B0\uAE30",
|
|
1639
|
+
formula: "\uC218\uC2DD",
|
|
1640
|
+
numberFormat: "\uD45C\uC2DC \uD615\uC2DD",
|
|
1641
|
+
formatText: "\uD14D\uC2A4\uD2B8",
|
|
1642
|
+
formatDate: "\uB0A0\uC9DC",
|
|
1643
|
+
apply: "\uC801\uC6A9",
|
|
1644
|
+
clear: "\uC9C0\uC6B0\uAE30",
|
|
1645
|
+
recalculate: "\uB2E4\uC2DC \uACC4\uC0B0",
|
|
1611
1646
|
done: "\uC644\uB8CC"
|
|
1612
1647
|
},
|
|
1613
1648
|
callout: {
|
|
@@ -1911,6 +1946,7 @@ var ja_default = {
|
|
|
1911
1946
|
dividerDesc: "\u8996\u899A\u7684\u306A\u533A\u5207\u308A\u7DDA",
|
|
1912
1947
|
table: "\u8868",
|
|
1913
1948
|
tableDesc: "\u8868\u3092\u8FFD\u52A0",
|
|
1949
|
+
noResults: "\u4E00\u81F4\u3059\u308B\u30D6\u30ED\u30C3\u30AF\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093",
|
|
1914
1950
|
callout: "\u30B3\u30FC\u30EB\u30A2\u30A6\u30C8",
|
|
1915
1951
|
calloutDesc: "\u91CD\u8981\u306A\u60C5\u5831\u3092\u30B3\u30FC\u30EB\u30A2\u30A6\u30C8\u30D6\u30ED\u30C3\u30AF\u3067\u5F37\u8ABF\u3057\u307E\u3059",
|
|
1916
1952
|
bookmark: "\u30D6\u30C3\u30AF\u30DE\u30FC\u30AF\u30AB\u30FC\u30C9",
|
|
@@ -1949,6 +1985,15 @@ var ja_default = {
|
|
|
1949
1985
|
noResults: "\u7D75\u6587\u5B57\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093",
|
|
1950
1986
|
showingCount: "{total} \u4EF6\u4E2D {shown} \u4EF6\u306E\u7D75\u6587\u5B57\u3092\u8868\u793A\u4E2D"
|
|
1951
1987
|
},
|
|
1988
|
+
formulaSuggestion: {
|
|
1989
|
+
title: "\u95A2\u6570",
|
|
1990
|
+
noResults: "\u95A2\u6570\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093",
|
|
1991
|
+
sum: "\u7BC4\u56F2\u5185\u306E\u5024\u3092\u5408\u8A08",
|
|
1992
|
+
avg: "\u7BC4\u56F2\u5185\u306E\u5024\u306E\u5E73\u5747",
|
|
1993
|
+
min: "\u7BC4\u56F2\u5185\u306E\u6700\u5C0F\u5024",
|
|
1994
|
+
max: "\u7BC4\u56F2\u5185\u306E\u6700\u5927\u5024",
|
|
1995
|
+
count: "\u7BC4\u56F2\u5185\u306E\u6570\u5024\u30BB\u30EB\u3092\u30AB\u30A6\u30F3\u30C8"
|
|
1996
|
+
},
|
|
1952
1997
|
tableMenu: {
|
|
1953
1998
|
insert3x3: "3x3 \u8868\u3092\u633F\u5165",
|
|
1954
1999
|
insertTable: "\u8868\u3092\u633F\u5165",
|
|
@@ -1983,6 +2028,13 @@ var ja_default = {
|
|
|
1983
2028
|
borderWidth: "\u67A0\u7DDA\u306E\u592A\u3055",
|
|
1984
2029
|
borderColor: "\u67A0\u7DDA\u306E\u8272",
|
|
1985
2030
|
clearBorder: "\u67A0\u7DDA\u3092\u30AF\u30EA\u30A2",
|
|
2031
|
+
formula: "\u6570\u5F0F",
|
|
2032
|
+
numberFormat: "\u8868\u793A\u5F62\u5F0F",
|
|
2033
|
+
formatText: "\u30C6\u30AD\u30B9\u30C8",
|
|
2034
|
+
formatDate: "\u65E5\u4ED8",
|
|
2035
|
+
apply: "\u9069\u7528",
|
|
2036
|
+
clear: "\u30AF\u30EA\u30A2",
|
|
2037
|
+
recalculate: "\u518D\u8A08\u7B97",
|
|
1986
2038
|
done: "\u5B8C\u4E86"
|
|
1987
2039
|
},
|
|
1988
2040
|
callout: {
|
|
@@ -24643,7 +24695,7 @@ function useLocale2() {
|
|
|
24643
24695
|
}
|
|
24644
24696
|
|
|
24645
24697
|
// src/components/UEditor/UEditor.tsx
|
|
24646
|
-
import
|
|
24698
|
+
import React83, { useEffect as useEffect38, useImperativeHandle as useImperativeHandle4, useMemo as useMemo24, useRef as useRef37 } from "react";
|
|
24647
24699
|
import { useEditor, EditorContent } from "@tiptap/react";
|
|
24648
24700
|
|
|
24649
24701
|
// src/components/UEditor/extensions.ts
|
|
@@ -26709,11 +26761,189 @@ var EmojiSuggestion = Extension3.create({
|
|
|
26709
26761
|
}
|
|
26710
26762
|
});
|
|
26711
26763
|
|
|
26764
|
+
// src/components/UEditor/formula-suggestion.tsx
|
|
26765
|
+
import { Extension as Extension4 } from "@tiptap/core";
|
|
26766
|
+
import Suggestion3 from "@tiptap/suggestion";
|
|
26767
|
+
import { ReactRenderer as ReactRenderer3 } from "@tiptap/react";
|
|
26768
|
+
import { PluginKey as PluginKey3 } from "@tiptap/pm/state";
|
|
26769
|
+
import React72, { forwardRef as forwardRef16, useImperativeHandle as useImperativeHandle3 } from "react";
|
|
26770
|
+
import { Sigma } from "lucide-react";
|
|
26771
|
+
import { jsx as jsx81, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
26772
|
+
var FORMULA_FUNCTIONS = [
|
|
26773
|
+
{
|
|
26774
|
+
name: "SUM",
|
|
26775
|
+
signature: "SUM(range)",
|
|
26776
|
+
descriptionKey: "formulaSuggestion.sum"
|
|
26777
|
+
},
|
|
26778
|
+
{
|
|
26779
|
+
name: "AVG",
|
|
26780
|
+
signature: "AVG(range)",
|
|
26781
|
+
descriptionKey: "formulaSuggestion.avg"
|
|
26782
|
+
},
|
|
26783
|
+
{
|
|
26784
|
+
name: "MIN",
|
|
26785
|
+
signature: "MIN(range)",
|
|
26786
|
+
descriptionKey: "formulaSuggestion.min"
|
|
26787
|
+
},
|
|
26788
|
+
{
|
|
26789
|
+
name: "MAX",
|
|
26790
|
+
signature: "MAX(range)",
|
|
26791
|
+
descriptionKey: "formulaSuggestion.max"
|
|
26792
|
+
},
|
|
26793
|
+
{
|
|
26794
|
+
name: "COUNT",
|
|
26795
|
+
signature: "COUNT(range)",
|
|
26796
|
+
descriptionKey: "formulaSuggestion.count"
|
|
26797
|
+
}
|
|
26798
|
+
];
|
|
26799
|
+
function isInTableCell(editor) {
|
|
26800
|
+
const { $from } = editor.state.selection;
|
|
26801
|
+
for (let depth = $from.depth; depth > 0; depth -= 1) {
|
|
26802
|
+
const nodeName = $from.node(depth).type.name;
|
|
26803
|
+
if (nodeName === "tableCell" || nodeName === "tableHeader") {
|
|
26804
|
+
return true;
|
|
26805
|
+
}
|
|
26806
|
+
}
|
|
26807
|
+
return false;
|
|
26808
|
+
}
|
|
26809
|
+
function buildFormulaSuggestionItems({ query }) {
|
|
26810
|
+
const normalizedQuery = query.trim().toUpperCase();
|
|
26811
|
+
if (!normalizedQuery) {
|
|
26812
|
+
return FORMULA_FUNCTIONS;
|
|
26813
|
+
}
|
|
26814
|
+
return FORMULA_FUNCTIONS.filter((item) => item.name.startsWith(normalizedQuery));
|
|
26815
|
+
}
|
|
26816
|
+
var FormulaSuggestionList = forwardRef16((props, ref) => {
|
|
26817
|
+
const t = useSmartTranslations("UEditor");
|
|
26818
|
+
const [selectedIndex, setSelectedIndex] = React72.useState(0);
|
|
26819
|
+
React72.useEffect(() => {
|
|
26820
|
+
setSelectedIndex(0);
|
|
26821
|
+
}, [props.items]);
|
|
26822
|
+
useImperativeHandle3(ref, () => ({
|
|
26823
|
+
onKeyDown: ({ event }) => {
|
|
26824
|
+
if (props.items.length === 0) return false;
|
|
26825
|
+
if (event.key === "ArrowUp") {
|
|
26826
|
+
setSelectedIndex((prev) => (prev + props.items.length - 1) % props.items.length);
|
|
26827
|
+
return true;
|
|
26828
|
+
}
|
|
26829
|
+
if (event.key === "ArrowDown") {
|
|
26830
|
+
setSelectedIndex((prev) => (prev + 1) % props.items.length);
|
|
26831
|
+
return true;
|
|
26832
|
+
}
|
|
26833
|
+
if (event.key === "Enter" || event.key === "Tab") {
|
|
26834
|
+
const item = props.items[selectedIndex];
|
|
26835
|
+
if (item) {
|
|
26836
|
+
props.command(item);
|
|
26837
|
+
}
|
|
26838
|
+
return true;
|
|
26839
|
+
}
|
|
26840
|
+
return false;
|
|
26841
|
+
}
|
|
26842
|
+
}));
|
|
26843
|
+
if (props.items.length === 0) {
|
|
26844
|
+
return /* @__PURE__ */ jsx81("div", { className: "w-72 p-3 text-sm text-muted-foreground bg-card border border-border/50 rounded-lg shadow-lg", children: t("formulaSuggestion.noResults") });
|
|
26845
|
+
}
|
|
26846
|
+
return /* @__PURE__ */ jsxs67("div", { className: "w-72 max-h-80 overflow-y-auto bg-card border border-border/50 rounded-lg shadow-lg", children: [
|
|
26847
|
+
/* @__PURE__ */ jsx81("div", { className: "px-3 py-2 border-b bg-muted/30", children: /* @__PURE__ */ jsxs67("div", { className: "flex items-center gap-2", children: [
|
|
26848
|
+
/* @__PURE__ */ jsx81(Sigma, { className: "w-4 h-4 text-primary" }),
|
|
26849
|
+
/* @__PURE__ */ jsx81("span", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: t("formulaSuggestion.title") })
|
|
26850
|
+
] }) }),
|
|
26851
|
+
/* @__PURE__ */ jsx81("div", { className: "p-1.5", children: props.items.map((item, index) => /* @__PURE__ */ jsxs67(
|
|
26852
|
+
"button",
|
|
26853
|
+
{
|
|
26854
|
+
type: "button",
|
|
26855
|
+
className: `w-full rounded-md px-2.5 py-2 text-left transition-colors ${selectedIndex === index ? "bg-primary/10 text-primary" : "text-foreground hover:bg-muted"}`,
|
|
26856
|
+
onMouseEnter: () => setSelectedIndex(index),
|
|
26857
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
26858
|
+
onClick: () => props.command(item),
|
|
26859
|
+
children: [
|
|
26860
|
+
/* @__PURE__ */ jsxs67("div", { className: "flex items-center justify-between gap-3", children: [
|
|
26861
|
+
/* @__PURE__ */ jsx81("span", { className: "font-mono text-sm font-semibold", children: item.name }),
|
|
26862
|
+
/* @__PURE__ */ jsx81("span", { className: "font-mono text-xs text-muted-foreground", children: item.signature })
|
|
26863
|
+
] }),
|
|
26864
|
+
/* @__PURE__ */ jsx81("div", { className: "mt-0.5 text-xs text-muted-foreground", children: t(item.descriptionKey) })
|
|
26865
|
+
]
|
|
26866
|
+
},
|
|
26867
|
+
item.name
|
|
26868
|
+
)) })
|
|
26869
|
+
] });
|
|
26870
|
+
});
|
|
26871
|
+
FormulaSuggestionList.displayName = "FormulaSuggestionList";
|
|
26872
|
+
function insertFormulaFunction(editor, range, item) {
|
|
26873
|
+
const insertedText = `=${item.name}()`;
|
|
26874
|
+
const cursorPosition = range.from + item.name.length + 2;
|
|
26875
|
+
editor.chain().focus().deleteRange(range).insertContent(insertedText).run();
|
|
26876
|
+
editor.commands.setTextSelection(cursorPosition);
|
|
26877
|
+
}
|
|
26878
|
+
var FormulaSuggestion = Extension4.create({
|
|
26879
|
+
name: "formulaSuggestion",
|
|
26880
|
+
addProseMirrorPlugins() {
|
|
26881
|
+
return [
|
|
26882
|
+
Suggestion3({
|
|
26883
|
+
editor: this.editor,
|
|
26884
|
+
char: "=",
|
|
26885
|
+
pluginKey: new PluginKey3("formulaSuggestion"),
|
|
26886
|
+
allow: ({ editor }) => isInTableCell(editor),
|
|
26887
|
+
command: ({ editor, range, props }) => {
|
|
26888
|
+
insertFormulaFunction(editor, range, props);
|
|
26889
|
+
},
|
|
26890
|
+
items: buildFormulaSuggestionItems,
|
|
26891
|
+
render: () => {
|
|
26892
|
+
let component;
|
|
26893
|
+
let popup;
|
|
26894
|
+
return {
|
|
26895
|
+
onStart: (props) => {
|
|
26896
|
+
component = new ReactRenderer3(FormulaSuggestionList, {
|
|
26897
|
+
props,
|
|
26898
|
+
editor: props.editor
|
|
26899
|
+
});
|
|
26900
|
+
if (!props.clientRect) {
|
|
26901
|
+
return;
|
|
26902
|
+
}
|
|
26903
|
+
popup = tippy("body", {
|
|
26904
|
+
getReferenceClientRect: props.clientRect,
|
|
26905
|
+
appendTo: () => document.body,
|
|
26906
|
+
content: component.element,
|
|
26907
|
+
showOnCreate: true,
|
|
26908
|
+
interactive: true,
|
|
26909
|
+
trigger: "manual",
|
|
26910
|
+
placement: "bottom-start",
|
|
26911
|
+
zIndex: 99999
|
|
26912
|
+
});
|
|
26913
|
+
},
|
|
26914
|
+
onUpdate(props) {
|
|
26915
|
+
component?.updateProps(props);
|
|
26916
|
+
if (!props.clientRect) {
|
|
26917
|
+
return;
|
|
26918
|
+
}
|
|
26919
|
+
popup?.[0]?.setProps({
|
|
26920
|
+
getReferenceClientRect: props.clientRect
|
|
26921
|
+
});
|
|
26922
|
+
},
|
|
26923
|
+
onKeyDown(props) {
|
|
26924
|
+
const popupInstance = getFirstTippyInstance(popup);
|
|
26925
|
+
if (props.event.key === "Escape") {
|
|
26926
|
+
hideTippyInstance(popupInstance);
|
|
26927
|
+
return true;
|
|
26928
|
+
}
|
|
26929
|
+
return component?.ref?.onKeyDown(props) ?? false;
|
|
26930
|
+
},
|
|
26931
|
+
onExit() {
|
|
26932
|
+
destroyTippyInstance(getFirstTippyInstance(popup));
|
|
26933
|
+
component?.destroy();
|
|
26934
|
+
}
|
|
26935
|
+
};
|
|
26936
|
+
}
|
|
26937
|
+
})
|
|
26938
|
+
];
|
|
26939
|
+
}
|
|
26940
|
+
});
|
|
26941
|
+
|
|
26712
26942
|
// src/components/UEditor/placeholder.ts
|
|
26713
|
-
import { Extension as
|
|
26714
|
-
import { Plugin as Plugin3, PluginKey as
|
|
26943
|
+
import { Extension as Extension5, isNodeEmpty } from "@tiptap/core";
|
|
26944
|
+
import { Plugin as Plugin3, PluginKey as PluginKey4 } from "@tiptap/pm/state";
|
|
26715
26945
|
import { Decoration, DecorationSet } from "@tiptap/pm/view";
|
|
26716
|
-
var UEditorPlaceholder =
|
|
26946
|
+
var UEditorPlaceholder = Extension5.create({
|
|
26717
26947
|
name: "placeholder",
|
|
26718
26948
|
addOptions() {
|
|
26719
26949
|
return {
|
|
@@ -26731,7 +26961,7 @@ var UEditorPlaceholder = Extension4.create({
|
|
|
26731
26961
|
const dataAttribute = `data-${this.options.dataAttribute}`;
|
|
26732
26962
|
return [
|
|
26733
26963
|
new Plugin3({
|
|
26734
|
-
key: new
|
|
26964
|
+
key: new PluginKey4("placeholder"),
|
|
26735
26965
|
props: {
|
|
26736
26966
|
decorations: ({ doc, selection }) => {
|
|
26737
26967
|
const active = this.editor.isEditable || !this.options.showOnlyWhenEditable;
|
|
@@ -26787,7 +27017,7 @@ import { useEffect as useEffect34, useRef as useRef29, useState as useState44 }
|
|
|
26787
27017
|
import Image4 from "@tiptap/extension-image";
|
|
26788
27018
|
import { mergeAttributes as mergeAttributes4 } from "@tiptap/core";
|
|
26789
27019
|
import { NodeViewWrapper as NodeViewWrapper4, ReactNodeViewRenderer as ReactNodeViewRenderer4 } from "@tiptap/react";
|
|
26790
|
-
import { jsx as
|
|
27020
|
+
import { jsx as jsx82, jsxs as jsxs68 } from "react/jsx-runtime";
|
|
26791
27021
|
var MIN_IMAGE_SIZE_PX = 40;
|
|
26792
27022
|
var IMAGE_LAYOUTS = /* @__PURE__ */ new Set(["block", "left", "right"]);
|
|
26793
27023
|
var IMAGE_WIDTH_PRESETS = /* @__PURE__ */ new Set(["sm", "md", "lg"]);
|
|
@@ -26961,7 +27191,7 @@ function ResizableImageNodeView(props) {
|
|
|
26961
27191
|
const showHandle = selected || isHovered || isResizing;
|
|
26962
27192
|
const wrapperAlignClass = imageLayout === "block" ? textAlign === "center" ? "mx-auto" : textAlign === "right" ? "ml-auto" : textAlign === "justify" ? "mx-auto" : "" : "";
|
|
26963
27193
|
const wrapperLayoutClass = imageLayout === "left" ? "float-left mr-4 mb-3 mt-1 clear-none max-w-[min(45%,20rem)]" : imageLayout === "right" ? "float-right ml-4 mb-3 mt-1 clear-none max-w-[min(45%,20rem)]" : "w-fit";
|
|
26964
|
-
return /* @__PURE__ */
|
|
27194
|
+
return /* @__PURE__ */ jsxs68(
|
|
26965
27195
|
NodeViewWrapper4,
|
|
26966
27196
|
{
|
|
26967
27197
|
as: "div",
|
|
@@ -26976,7 +27206,7 @@ function ResizableImageNodeView(props) {
|
|
|
26976
27206
|
},
|
|
26977
27207
|
contentEditable: false,
|
|
26978
27208
|
children: [
|
|
26979
|
-
/* @__PURE__ */
|
|
27209
|
+
/* @__PURE__ */ jsx82(
|
|
26980
27210
|
"img",
|
|
26981
27211
|
{
|
|
26982
27212
|
ref: imgRef,
|
|
@@ -26995,7 +27225,7 @@ function ResizableImageNodeView(props) {
|
|
|
26995
27225
|
}
|
|
26996
27226
|
}
|
|
26997
27227
|
),
|
|
26998
|
-
showHandle && /* @__PURE__ */
|
|
27228
|
+
showHandle && /* @__PURE__ */ jsx82(
|
|
26999
27229
|
"div",
|
|
27000
27230
|
{
|
|
27001
27231
|
"aria-hidden": "true",
|
|
@@ -27108,8 +27338,8 @@ var UEditorTableRow = TableRow2.extend({
|
|
|
27108
27338
|
var table_row_default = UEditorTableRow;
|
|
27109
27339
|
|
|
27110
27340
|
// src/components/UEditor/font-family.ts
|
|
27111
|
-
import { Extension as
|
|
27112
|
-
var FontFamily =
|
|
27341
|
+
import { Extension as Extension6 } from "@tiptap/core";
|
|
27342
|
+
var FontFamily = Extension6.create({
|
|
27113
27343
|
name: "fontFamily",
|
|
27114
27344
|
addOptions() {
|
|
27115
27345
|
return {
|
|
@@ -27144,8 +27374,8 @@ var FontFamily = Extension5.create({
|
|
|
27144
27374
|
var font_family_default = FontFamily;
|
|
27145
27375
|
|
|
27146
27376
|
// src/components/UEditor/font-size.ts
|
|
27147
|
-
import { Extension as
|
|
27148
|
-
var FontSize =
|
|
27377
|
+
import { Extension as Extension7 } from "@tiptap/core";
|
|
27378
|
+
var FontSize = Extension7.create({
|
|
27149
27379
|
name: "fontSize",
|
|
27150
27380
|
addOptions() {
|
|
27151
27381
|
return {
|
|
@@ -27180,8 +27410,8 @@ var FontSize = Extension6.create({
|
|
|
27180
27410
|
var font_size_default = FontSize;
|
|
27181
27411
|
|
|
27182
27412
|
// src/components/UEditor/line-height.ts
|
|
27183
|
-
import { Extension as
|
|
27184
|
-
var LineHeight =
|
|
27413
|
+
import { Extension as Extension8 } from "@tiptap/core";
|
|
27414
|
+
var LineHeight = Extension8.create({
|
|
27185
27415
|
name: "lineHeight",
|
|
27186
27416
|
addOptions() {
|
|
27187
27417
|
return {
|
|
@@ -27216,8 +27446,8 @@ var LineHeight = Extension7.create({
|
|
|
27216
27446
|
var line_height_default = LineHeight;
|
|
27217
27447
|
|
|
27218
27448
|
// src/components/UEditor/letter-spacing.ts
|
|
27219
|
-
import { Extension as
|
|
27220
|
-
var LetterSpacing =
|
|
27449
|
+
import { Extension as Extension9 } from "@tiptap/core";
|
|
27450
|
+
var LetterSpacing = Extension9.create({
|
|
27221
27451
|
name: "letterSpacing",
|
|
27222
27452
|
addOptions() {
|
|
27223
27453
|
return {
|
|
@@ -27515,10 +27745,10 @@ var UEditorTable = Table3.extend({
|
|
|
27515
27745
|
var table_align_default = UEditorTable;
|
|
27516
27746
|
|
|
27517
27747
|
// src/components/UEditor/CodeBlockView.tsx
|
|
27518
|
-
import
|
|
27748
|
+
import React74, { useState as useState45 } from "react";
|
|
27519
27749
|
import { NodeViewWrapper as NodeViewWrapper5, NodeViewContent as NodeViewContent2 } from "@tiptap/react";
|
|
27520
27750
|
import { Check as Check10, Copy as Copy2, ChevronDown as ChevronDown7 } from "lucide-react";
|
|
27521
|
-
import { Fragment as Fragment27, jsx as
|
|
27751
|
+
import { Fragment as Fragment27, jsx as jsx83, jsxs as jsxs69 } from "react/jsx-runtime";
|
|
27522
27752
|
var LANGUAGES = [
|
|
27523
27753
|
{ label: "Plain Text", value: "text" },
|
|
27524
27754
|
{ label: "JavaScript", value: "javascript" },
|
|
@@ -27542,10 +27772,10 @@ var CodeBlockView = ({
|
|
|
27542
27772
|
}) => {
|
|
27543
27773
|
const [copied, setCopied] = useState45(false);
|
|
27544
27774
|
const [isDropdownOpen, setIsDropdownOpen] = useState45(false);
|
|
27545
|
-
const timeoutRef =
|
|
27775
|
+
const timeoutRef = React74.useRef(null);
|
|
27546
27776
|
const currentLangValue = node.attrs.language || "text";
|
|
27547
27777
|
const currentLangLabel = LANGUAGES.find((lang) => lang.value === currentLangValue)?.label || "Plain Text";
|
|
27548
|
-
|
|
27778
|
+
React74.useEffect(() => {
|
|
27549
27779
|
return () => {
|
|
27550
27780
|
if (timeoutRef.current) {
|
|
27551
27781
|
clearTimeout(timeoutRef.current);
|
|
@@ -27566,15 +27796,15 @@ var CodeBlockView = ({
|
|
|
27566
27796
|
console.error("Failed to copy code text: ", err);
|
|
27567
27797
|
}
|
|
27568
27798
|
};
|
|
27569
|
-
return /* @__PURE__ */
|
|
27570
|
-
/* @__PURE__ */
|
|
27799
|
+
return /* @__PURE__ */ jsxs69(NodeViewWrapper5, { className: "group/code relative my-4 rounded-xl border border-border/60 bg-muted/40 p-4 font-mono text-sm shadow-sm overflow-visible", children: [
|
|
27800
|
+
/* @__PURE__ */ jsxs69(
|
|
27571
27801
|
"div",
|
|
27572
27802
|
{
|
|
27573
27803
|
className: "absolute right-3 top-3 z-10 flex items-center gap-1.5 opacity-0 group-hover/code:opacity-100 focus-within:opacity-100 transition-opacity duration-200 select-none",
|
|
27574
27804
|
contentEditable: false,
|
|
27575
27805
|
children: [
|
|
27576
|
-
/* @__PURE__ */
|
|
27577
|
-
/* @__PURE__ */
|
|
27806
|
+
/* @__PURE__ */ jsxs69("div", { className: "relative", children: [
|
|
27807
|
+
/* @__PURE__ */ jsxs69(
|
|
27578
27808
|
"button",
|
|
27579
27809
|
{
|
|
27580
27810
|
type: "button",
|
|
@@ -27582,19 +27812,19 @@ var CodeBlockView = ({
|
|
|
27582
27812
|
className: "flex items-center gap-1.5 rounded-lg border border-border bg-background px-2.5 py-1 text-xs text-muted-foreground hover:text-foreground hover:bg-muted active:scale-95 transition-all focus:outline-none",
|
|
27583
27813
|
children: [
|
|
27584
27814
|
currentLangLabel,
|
|
27585
|
-
/* @__PURE__ */
|
|
27815
|
+
/* @__PURE__ */ jsx83(ChevronDown7, { className: "h-3 w-3" })
|
|
27586
27816
|
]
|
|
27587
27817
|
}
|
|
27588
27818
|
),
|
|
27589
|
-
isDropdownOpen && /* @__PURE__ */
|
|
27590
|
-
/* @__PURE__ */
|
|
27819
|
+
isDropdownOpen && /* @__PURE__ */ jsxs69(Fragment27, { children: [
|
|
27820
|
+
/* @__PURE__ */ jsx83(
|
|
27591
27821
|
"div",
|
|
27592
27822
|
{
|
|
27593
27823
|
className: "fixed inset-0 z-20",
|
|
27594
27824
|
onClick: () => setIsDropdownOpen(false)
|
|
27595
27825
|
}
|
|
27596
27826
|
),
|
|
27597
|
-
/* @__PURE__ */
|
|
27827
|
+
/* @__PURE__ */ jsx83("div", { className: "absolute right-0 mt-1 max-h-56 w-36 overflow-y-auto rounded-lg border border-border/50 bg-popover p-1 shadow-lg z-30 [scrollbar-width:thin] animate-in fade-in-0 zoom-in-95", children: LANGUAGES.map((lang) => /* @__PURE__ */ jsx83(
|
|
27598
27828
|
"button",
|
|
27599
27829
|
{
|
|
27600
27830
|
type: "button",
|
|
@@ -27612,20 +27842,20 @@ var CodeBlockView = ({
|
|
|
27612
27842
|
)) })
|
|
27613
27843
|
] })
|
|
27614
27844
|
] }),
|
|
27615
|
-
/* @__PURE__ */
|
|
27845
|
+
/* @__PURE__ */ jsx83(
|
|
27616
27846
|
"button",
|
|
27617
27847
|
{
|
|
27618
27848
|
type: "button",
|
|
27619
27849
|
onClick: handleCopy,
|
|
27620
27850
|
className: "flex h-7 w-7 items-center justify-center rounded-lg border border-border bg-background text-muted-foreground hover:text-foreground hover:bg-muted active:scale-95 transition-all focus:outline-none",
|
|
27621
27851
|
title: "Copy code",
|
|
27622
|
-
children: copied ? /* @__PURE__ */
|
|
27852
|
+
children: copied ? /* @__PURE__ */ jsx83(Check10, { className: "h-3.5 w-3.5 text-success animate-in fade-in-0 zoom-in-75" }) : /* @__PURE__ */ jsx83(Copy2, { className: "h-3.5 w-3.5" })
|
|
27623
27853
|
}
|
|
27624
27854
|
)
|
|
27625
27855
|
]
|
|
27626
27856
|
}
|
|
27627
27857
|
),
|
|
27628
|
-
/* @__PURE__ */
|
|
27858
|
+
/* @__PURE__ */ jsx83("pre", { className: "m-0 overflow-x-auto [scrollbar-width:thin] pt-4 sm:pt-0", children: /* @__PURE__ */ jsx83("code", { className: "bg-transparent! text-foreground!", children: /* @__PURE__ */ jsx83(NodeViewContent2, {}) }) })
|
|
27629
27859
|
] });
|
|
27630
27860
|
};
|
|
27631
27861
|
|
|
@@ -28011,6 +28241,7 @@ function buildUEditorExtensions({
|
|
|
28011
28241
|
SlashCommand.configure({
|
|
28012
28242
|
messages: buildSlashCommandMessages(translate)
|
|
28013
28243
|
}),
|
|
28244
|
+
FormulaSuggestion,
|
|
28014
28245
|
EmojiSuggestion,
|
|
28015
28246
|
Callout,
|
|
28016
28247
|
Bookmark.configure({
|
|
@@ -28023,7 +28254,7 @@ function buildUEditorExtensions({
|
|
|
28023
28254
|
}
|
|
28024
28255
|
|
|
28025
28256
|
// src/components/UEditor/toolbar.tsx
|
|
28026
|
-
import
|
|
28257
|
+
import React77, { useRef as useRef32, useState as useState47 } from "react";
|
|
28027
28258
|
import { useEditorState } from "@tiptap/react";
|
|
28028
28259
|
import {
|
|
28029
28260
|
AlignCenter,
|
|
@@ -28068,12 +28299,12 @@ import {
|
|
|
28068
28299
|
// src/components/UEditor/colors.tsx
|
|
28069
28300
|
import { useMemo as useMemo22, useRef as useRef30 } from "react";
|
|
28070
28301
|
import { Check as Check11, Highlighter, Palette as Palette2, Paintbrush, Grid as Grid2 } from "lucide-react";
|
|
28071
|
-
import { jsx as
|
|
28302
|
+
import { jsx as jsx84, jsxs as jsxs70 } from "react/jsx-runtime";
|
|
28072
28303
|
var TextColorIcon = ({ color }) => {
|
|
28073
28304
|
const underlineColor = color && color !== "inherit" ? color : "currentColor";
|
|
28074
|
-
return /* @__PURE__ */
|
|
28075
|
-
/* @__PURE__ */
|
|
28076
|
-
/* @__PURE__ */
|
|
28305
|
+
return /* @__PURE__ */ jsxs70("span", { className: "relative flex h-5 w-5 items-center justify-center leading-none", children: [
|
|
28306
|
+
/* @__PURE__ */ jsx84("span", { className: "text-[15px] font-semibold leading-none", children: "A" }),
|
|
28307
|
+
/* @__PURE__ */ jsx84(
|
|
28077
28308
|
"span",
|
|
28078
28309
|
{
|
|
28079
28310
|
"aria-hidden": "true",
|
|
@@ -28085,9 +28316,9 @@ var TextColorIcon = ({ color }) => {
|
|
|
28085
28316
|
};
|
|
28086
28317
|
var HighlightColorIcon = ({ color }) => {
|
|
28087
28318
|
const underlineColor = color || "currentColor";
|
|
28088
|
-
return /* @__PURE__ */
|
|
28089
|
-
/* @__PURE__ */
|
|
28090
|
-
/* @__PURE__ */
|
|
28319
|
+
return /* @__PURE__ */ jsxs70("span", { className: "relative flex h-5 w-5 items-center justify-center leading-none", children: [
|
|
28320
|
+
/* @__PURE__ */ jsx84(Highlighter, { className: "h-4 w-4" }),
|
|
28321
|
+
/* @__PURE__ */ jsx84(
|
|
28091
28322
|
"span",
|
|
28092
28323
|
{
|
|
28093
28324
|
"aria-hidden": "true",
|
|
@@ -28099,9 +28330,9 @@ var HighlightColorIcon = ({ color }) => {
|
|
|
28099
28330
|
};
|
|
28100
28331
|
var CellBgColorIcon = ({ color }) => {
|
|
28101
28332
|
const underlineColor = color && color !== "inherit" ? color : "currentColor";
|
|
28102
|
-
return /* @__PURE__ */
|
|
28103
|
-
/* @__PURE__ */
|
|
28104
|
-
/* @__PURE__ */
|
|
28333
|
+
return /* @__PURE__ */ jsxs70("span", { className: "relative flex h-5 w-5 items-center justify-center leading-none", children: [
|
|
28334
|
+
/* @__PURE__ */ jsx84(Paintbrush, { className: "h-4 w-4" }),
|
|
28335
|
+
/* @__PURE__ */ jsx84(
|
|
28105
28336
|
"span",
|
|
28106
28337
|
{
|
|
28107
28338
|
"aria-hidden": "true",
|
|
@@ -28113,9 +28344,9 @@ var CellBgColorIcon = ({ color }) => {
|
|
|
28113
28344
|
};
|
|
28114
28345
|
var CellBorderIcon = ({ color }) => {
|
|
28115
28346
|
const underlineColor = color && color !== "inherit" ? color : "currentColor";
|
|
28116
|
-
return /* @__PURE__ */
|
|
28117
|
-
/* @__PURE__ */
|
|
28118
|
-
/* @__PURE__ */
|
|
28347
|
+
return /* @__PURE__ */ jsxs70("span", { className: "relative flex h-5 w-5 items-center justify-center leading-none", children: [
|
|
28348
|
+
/* @__PURE__ */ jsx84(Grid2, { className: "h-4 w-4" }),
|
|
28349
|
+
/* @__PURE__ */ jsx84(
|
|
28119
28350
|
"span",
|
|
28120
28351
|
{
|
|
28121
28352
|
"aria-hidden": "true",
|
|
@@ -28239,9 +28470,9 @@ var EditorColorPalette = ({
|
|
|
28239
28470
|
const colorInputRef = useRef30(null);
|
|
28240
28471
|
const automaticColor = colors[0]?.color ?? "";
|
|
28241
28472
|
const paletteColors = colors.slice(1);
|
|
28242
|
-
return /* @__PURE__ */
|
|
28243
|
-
/* @__PURE__ */
|
|
28244
|
-
/* @__PURE__ */
|
|
28473
|
+
return /* @__PURE__ */ jsxs70("div", { className: "w-56 p-2", children: [
|
|
28474
|
+
/* @__PURE__ */ jsx84("span", { className: "px-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: label }),
|
|
28475
|
+
/* @__PURE__ */ jsxs70(
|
|
28245
28476
|
"button",
|
|
28246
28477
|
{
|
|
28247
28478
|
type: "button",
|
|
@@ -28253,12 +28484,12 @@ var EditorColorPalette = ({
|
|
|
28253
28484
|
currentColor === automaticColor ? "border-primary text-primary" : "border-transparent text-foreground"
|
|
28254
28485
|
),
|
|
28255
28486
|
children: [
|
|
28256
|
-
/* @__PURE__ */
|
|
28257
|
-
/* @__PURE__ */
|
|
28487
|
+
/* @__PURE__ */ jsx84("span", { className: "flex h-5 w-5 items-center justify-center rounded border border-border bg-background", children: currentColor === automaticColor && /* @__PURE__ */ jsx84(Check11, { className: "h-3.5 w-3.5" }) }),
|
|
28488
|
+
/* @__PURE__ */ jsx84("span", { className: "flex-1 text-center", children: t("colors.automatic") })
|
|
28258
28489
|
]
|
|
28259
28490
|
}
|
|
28260
28491
|
),
|
|
28261
|
-
/* @__PURE__ */
|
|
28492
|
+
/* @__PURE__ */ jsx84("div", { className: "mt-2 grid grid-cols-8 gap-1", children: paletteColors.map((c) => /* @__PURE__ */ jsx84(Tooltip, { placement: "top", content: /* @__PURE__ */ jsx84("span", { className: "text-xs font-medium", children: c.name }), children: /* @__PURE__ */ jsx84(
|
|
28262
28493
|
"button",
|
|
28263
28494
|
{
|
|
28264
28495
|
type: "button",
|
|
@@ -28270,10 +28501,10 @@ var EditorColorPalette = ({
|
|
|
28270
28501
|
currentColor === c.color ? "border-primary ring-2 ring-primary/25" : "border-border/70"
|
|
28271
28502
|
),
|
|
28272
28503
|
style: { backgroundColor: c.color || "transparent" },
|
|
28273
|
-
children: currentColor === c.color && /* @__PURE__ */
|
|
28504
|
+
children: currentColor === c.color && /* @__PURE__ */ jsx84("span", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx84(Check11, { className: "h-3.5 w-3.5 text-white drop-shadow-[0_1px_1px_rgba(0,0,0,0.8)]" }) })
|
|
28274
28505
|
}
|
|
28275
28506
|
) }, `${c.name}-${c.color}`)) }),
|
|
28276
|
-
/* @__PURE__ */
|
|
28507
|
+
/* @__PURE__ */ jsxs70(
|
|
28277
28508
|
"button",
|
|
28278
28509
|
{
|
|
28279
28510
|
type: "button",
|
|
@@ -28281,7 +28512,7 @@ var EditorColorPalette = ({
|
|
|
28281
28512
|
onClick: () => colorInputRef.current?.click(),
|
|
28282
28513
|
className: "mt-3 flex h-9 w-full items-center gap-3 rounded-md px-2 text-sm text-foreground transition-colors hover:bg-muted",
|
|
28283
28514
|
children: [
|
|
28284
|
-
/* @__PURE__ */
|
|
28515
|
+
/* @__PURE__ */ jsx84(
|
|
28285
28516
|
"span",
|
|
28286
28517
|
{
|
|
28287
28518
|
"aria-hidden": "true",
|
|
@@ -28291,9 +28522,9 @@ var EditorColorPalette = ({
|
|
|
28291
28522
|
}
|
|
28292
28523
|
}
|
|
28293
28524
|
),
|
|
28294
|
-
/* @__PURE__ */
|
|
28295
|
-
/* @__PURE__ */
|
|
28296
|
-
/* @__PURE__ */
|
|
28525
|
+
/* @__PURE__ */ jsx84("span", { className: "flex-1 text-center", children: t("colors.moreColors") }),
|
|
28526
|
+
/* @__PURE__ */ jsx84(Palette2, { className: "h-4 w-4 text-muted-foreground" }),
|
|
28527
|
+
/* @__PURE__ */ jsx84(
|
|
28297
28528
|
"input",
|
|
28298
28529
|
{
|
|
28299
28530
|
ref: colorInputRef,
|
|
@@ -28440,7 +28671,7 @@ function deleteSelectedImage(editor) {
|
|
|
28440
28671
|
// src/components/UEditor/inputs.tsx
|
|
28441
28672
|
import { useEffect as useEffect35, useRef as useRef31, useState as useState46 } from "react";
|
|
28442
28673
|
import { Check as Check12, X as X18 } from "lucide-react";
|
|
28443
|
-
import { jsx as
|
|
28674
|
+
import { jsx as jsx85, jsxs as jsxs71 } from "react/jsx-runtime";
|
|
28444
28675
|
function normalizeUrl(raw) {
|
|
28445
28676
|
return sanitizeUEditorUrl(raw, "link");
|
|
28446
28677
|
}
|
|
@@ -28461,8 +28692,8 @@ var LinkInput = ({
|
|
|
28461
28692
|
const normalized = normalizeUrl(url);
|
|
28462
28693
|
if (normalized) onSubmit(normalized);
|
|
28463
28694
|
};
|
|
28464
|
-
return /* @__PURE__ */
|
|
28465
|
-
/* @__PURE__ */
|
|
28695
|
+
return /* @__PURE__ */ jsxs71("form", { onSubmit: handleSubmit, className: "flex items-center gap-2 p-2", children: [
|
|
28696
|
+
/* @__PURE__ */ jsx85(
|
|
28466
28697
|
"input",
|
|
28467
28698
|
{
|
|
28468
28699
|
ref: inputRef,
|
|
@@ -28473,8 +28704,8 @@ var LinkInput = ({
|
|
|
28473
28704
|
className: "flex-1 px-3 py-2 text-sm bg-muted/50 border-0 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary/20"
|
|
28474
28705
|
}
|
|
28475
28706
|
),
|
|
28476
|
-
/* @__PURE__ */
|
|
28477
|
-
/* @__PURE__ */
|
|
28707
|
+
/* @__PURE__ */ jsx85("button", { type: "submit", className: "p-2 rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors", children: /* @__PURE__ */ jsx85(Check12, { className: "w-4 h-4" }) }),
|
|
28708
|
+
/* @__PURE__ */ jsx85("button", { type: "button", onClick: onCancel, className: "p-2 rounded-lg hover:bg-muted transition-colors text-muted-foreground", children: /* @__PURE__ */ jsx85(X18, { className: "w-4 h-4" }) })
|
|
28478
28709
|
] });
|
|
28479
28710
|
};
|
|
28480
28711
|
var ImageInput = ({ onSubmit, onCancel }) => {
|
|
@@ -28492,10 +28723,10 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
28492
28723
|
onSubmit(safeUrl, alt);
|
|
28493
28724
|
}
|
|
28494
28725
|
};
|
|
28495
|
-
return /* @__PURE__ */
|
|
28496
|
-
/* @__PURE__ */
|
|
28497
|
-
/* @__PURE__ */
|
|
28498
|
-
/* @__PURE__ */
|
|
28726
|
+
return /* @__PURE__ */ jsxs71("form", { onSubmit: handleSubmit, className: "p-3 space-y-3", children: [
|
|
28727
|
+
/* @__PURE__ */ jsxs71("div", { children: [
|
|
28728
|
+
/* @__PURE__ */ jsx85("label", { className: "text-xs font-medium text-muted-foreground", children: t("imageInput.urlLabel") }),
|
|
28729
|
+
/* @__PURE__ */ jsx85(
|
|
28499
28730
|
"input",
|
|
28500
28731
|
{
|
|
28501
28732
|
ref: inputRef,
|
|
@@ -28507,9 +28738,9 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
28507
28738
|
}
|
|
28508
28739
|
)
|
|
28509
28740
|
] }),
|
|
28510
|
-
/* @__PURE__ */
|
|
28511
|
-
/* @__PURE__ */
|
|
28512
|
-
/* @__PURE__ */
|
|
28741
|
+
/* @__PURE__ */ jsxs71("div", { children: [
|
|
28742
|
+
/* @__PURE__ */ jsx85("label", { className: "text-xs font-medium text-muted-foreground", children: t("imageInput.altLabel") }),
|
|
28743
|
+
/* @__PURE__ */ jsx85(
|
|
28513
28744
|
"input",
|
|
28514
28745
|
{
|
|
28515
28746
|
type: "text",
|
|
@@ -28520,8 +28751,8 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
28520
28751
|
}
|
|
28521
28752
|
)
|
|
28522
28753
|
] }),
|
|
28523
|
-
/* @__PURE__ */
|
|
28524
|
-
/* @__PURE__ */
|
|
28754
|
+
/* @__PURE__ */ jsxs71("div", { className: "flex gap-2", children: [
|
|
28755
|
+
/* @__PURE__ */ jsx85(
|
|
28525
28756
|
"button",
|
|
28526
28757
|
{
|
|
28527
28758
|
type: "submit",
|
|
@@ -28530,7 +28761,7 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
28530
28761
|
children: t("imageInput.addBtn")
|
|
28531
28762
|
}
|
|
28532
28763
|
),
|
|
28533
|
-
/* @__PURE__ */
|
|
28764
|
+
/* @__PURE__ */ jsx85("button", { type: "button", onClick: onCancel, className: "px-4 py-2 rounded-lg hover:bg-muted transition-colors text-muted-foreground", children: t("imageInput.cancelBtn") })
|
|
28534
28765
|
] })
|
|
28535
28766
|
] });
|
|
28536
28767
|
};
|
|
@@ -28861,7 +29092,7 @@ function getDefaultLetterSpacings() {
|
|
|
28861
29092
|
}
|
|
28862
29093
|
|
|
28863
29094
|
// src/components/UEditor/toolbar.tsx
|
|
28864
|
-
import { Fragment as Fragment28, jsx as
|
|
29095
|
+
import { Fragment as Fragment28, jsx as jsx86, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
28865
29096
|
function getTableAnchorPos(editor) {
|
|
28866
29097
|
const tableInfo = findTableNodeInfoFromState(editor.state);
|
|
28867
29098
|
if (tableInfo) return editor.state.selection.from;
|
|
@@ -28891,8 +29122,8 @@ function fileToDataUrl2(file) {
|
|
|
28891
29122
|
function formatTableInsertLabel(template, rows, cols) {
|
|
28892
29123
|
return template.replace("{rows}", String(rows)).replace("{cols}", String(cols));
|
|
28893
29124
|
}
|
|
28894
|
-
var ToolbarButton =
|
|
28895
|
-
const button = /* @__PURE__ */
|
|
29125
|
+
var ToolbarButton = React77.forwardRef(({ onClick, onMouseDown, active, disabled, children, title, className }, ref) => {
|
|
29126
|
+
const button = /* @__PURE__ */ jsx86(
|
|
28896
29127
|
"button",
|
|
28897
29128
|
{
|
|
28898
29129
|
ref,
|
|
@@ -28917,28 +29148,28 @@ var ToolbarButton = React76.forwardRef(({ onClick, onMouseDown, active, disabled
|
|
|
28917
29148
|
}
|
|
28918
29149
|
);
|
|
28919
29150
|
if (title) {
|
|
28920
|
-
return /* @__PURE__ */
|
|
29151
|
+
return /* @__PURE__ */ jsx86(Tooltip, { content: title, placement: "top", delay: { open: 200, close: 0 }, children: button });
|
|
28921
29152
|
}
|
|
28922
29153
|
return button;
|
|
28923
29154
|
});
|
|
28924
29155
|
ToolbarButton.displayName = "ToolbarButton";
|
|
28925
|
-
var ToolbarDivider = () => /* @__PURE__ */
|
|
29156
|
+
var ToolbarDivider = () => /* @__PURE__ */ jsx86("div", { className: "mx-0.5 h-5 w-px bg-border/60" });
|
|
28926
29157
|
var TableInsertGrid = ({
|
|
28927
29158
|
insertLabel,
|
|
28928
29159
|
previewTemplate,
|
|
28929
29160
|
onInsert
|
|
28930
29161
|
}) => {
|
|
28931
|
-
const [selection, setSelection] =
|
|
29162
|
+
const [selection, setSelection] = React77.useState({ rows: 3, cols: 3 });
|
|
28932
29163
|
const maxRows = 8;
|
|
28933
29164
|
const maxCols = 8;
|
|
28934
|
-
return /* @__PURE__ */
|
|
28935
|
-
/* @__PURE__ */
|
|
28936
|
-
/* @__PURE__ */
|
|
29165
|
+
return /* @__PURE__ */ jsxs72("div", { className: "mb-2 rounded-xl border border-border/60 bg-muted/20 p-2", children: [
|
|
29166
|
+
/* @__PURE__ */ jsx86("div", { className: "mb-2 text-sm font-medium text-foreground", children: formatTableInsertLabel(previewTemplate, selection.rows, selection.cols) }),
|
|
29167
|
+
/* @__PURE__ */ jsx86("div", { className: "grid grid-cols-8 gap-1", onMouseLeave: () => setSelection((prev) => prev), children: Array.from({ length: maxRows }).map(
|
|
28937
29168
|
(_, rowIndex) => Array.from({ length: maxCols }).map((__, colIndex) => {
|
|
28938
29169
|
const rows = rowIndex + 1;
|
|
28939
29170
|
const cols = colIndex + 1;
|
|
28940
29171
|
const active = rows <= selection.rows && cols <= selection.cols;
|
|
28941
|
-
return /* @__PURE__ */
|
|
29172
|
+
return /* @__PURE__ */ jsx86(
|
|
28942
29173
|
"button",
|
|
28943
29174
|
{
|
|
28944
29175
|
type: "button",
|
|
@@ -28956,7 +29187,7 @@ var TableInsertGrid = ({
|
|
|
28956
29187
|
);
|
|
28957
29188
|
})
|
|
28958
29189
|
) }),
|
|
28959
|
-
/* @__PURE__ */
|
|
29190
|
+
/* @__PURE__ */ jsx86("div", { className: "mt-2 text-xs text-muted-foreground", children: insertLabel })
|
|
28960
29191
|
] });
|
|
28961
29192
|
};
|
|
28962
29193
|
var EditorToolbar = ({
|
|
@@ -29004,10 +29235,10 @@ var EditorToolbar = ({
|
|
|
29004
29235
|
const currentHighlightColor = normalizeStyleValue(editor.getAttributes("highlight").color) || "";
|
|
29005
29236
|
const currentLineHeight = normalizeStyleValue(textStyleAttrs.lineHeight);
|
|
29006
29237
|
const currentLetterSpacing = normalizeStyleValue(textStyleAttrs.letterSpacing);
|
|
29007
|
-
const availableFontFamilies =
|
|
29008
|
-
const availableFontSizes =
|
|
29009
|
-
const availableLineHeights =
|
|
29010
|
-
const availableLetterSpacings =
|
|
29238
|
+
const availableFontFamilies = React77.useMemo(() => fontFamilies ?? getDefaultFontFamilies(t), [fontFamilies, t]);
|
|
29239
|
+
const availableFontSizes = React77.useMemo(() => fontSizes ?? getDefaultFontSizes(), [fontSizes]);
|
|
29240
|
+
const availableLineHeights = React77.useMemo(() => lineHeights ?? getDefaultLineHeights(), [lineHeights]);
|
|
29241
|
+
const availableLetterSpacings = React77.useMemo(() => letterSpacings ?? getDefaultLetterSpacings(), [letterSpacings]);
|
|
29011
29242
|
const currentFontFamilyDisplayValue = currentFontFamily.split(",")[0]?.trim() ?? currentFontFamily;
|
|
29012
29243
|
const currentFontFamilyLabel = availableFontFamilies.find((option) => normalizeStyleValue(option.value) === currentFontFamily)?.label ?? (currentFontFamilyDisplayValue || t("toolbar.fontDefault"));
|
|
29013
29244
|
const currentFontSizeLabel = availableFontSizes.find((option) => normalizeStyleValue(option.value) === currentFontSize)?.label ?? t("toolbar.sizeDefault");
|
|
@@ -29036,32 +29267,32 @@ var EditorToolbar = ({
|
|
|
29036
29267
|
setIsUploadingImage(false);
|
|
29037
29268
|
};
|
|
29038
29269
|
if (variant === "minimal") {
|
|
29039
|
-
return /* @__PURE__ */
|
|
29040
|
-
/* @__PURE__ */
|
|
29041
|
-
/* @__PURE__ */
|
|
29042
|
-
/* @__PURE__ */
|
|
29270
|
+
return /* @__PURE__ */ jsxs72("div", { className: "flex items-center gap-1 border-b border-border/35 bg-muted/30 p-2", children: [
|
|
29271
|
+
/* @__PURE__ */ jsx86(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ jsx86(BoldIcon, { className: "w-4 h-4" }) }),
|
|
29272
|
+
/* @__PURE__ */ jsx86(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ jsx86(ItalicIcon, { className: "w-4 h-4" }) }),
|
|
29273
|
+
/* @__PURE__ */ jsx86(
|
|
29043
29274
|
ToolbarButton,
|
|
29044
29275
|
{
|
|
29045
29276
|
onClick: () => editor.chain().focus().toggleBulletList().run(),
|
|
29046
29277
|
active: editor.isActive("bulletList"),
|
|
29047
29278
|
title: t("toolbar.bulletList"),
|
|
29048
|
-
children: /* @__PURE__ */
|
|
29279
|
+
children: /* @__PURE__ */ jsx86(ListIcon, { className: "w-4 h-4" })
|
|
29049
29280
|
}
|
|
29050
29281
|
)
|
|
29051
29282
|
] });
|
|
29052
29283
|
}
|
|
29053
|
-
return /* @__PURE__ */
|
|
29054
|
-
/* @__PURE__ */
|
|
29284
|
+
return /* @__PURE__ */ jsxs72("div", { className: "flex flex-wrap items-center gap-0.5 border-b border-border/35 bg-linear-to-r from-muted/25 to-transparent p-1.5", children: [
|
|
29285
|
+
/* @__PURE__ */ jsxs72(
|
|
29055
29286
|
DropdownMenu,
|
|
29056
29287
|
{
|
|
29057
|
-
trigger: /* @__PURE__ */
|
|
29288
|
+
trigger: /* @__PURE__ */ jsxs72(ToolbarButton, { onClick: () => {
|
|
29058
29289
|
}, title: t("toolbar.fontFamily"), className: "px-1.5 w-auto gap-0.5", children: [
|
|
29059
|
-
/* @__PURE__ */
|
|
29060
|
-
/* @__PURE__ */
|
|
29290
|
+
/* @__PURE__ */ jsx86(Baseline, { className: "w-4 h-4" }),
|
|
29291
|
+
/* @__PURE__ */ jsx86(ChevronDown8, { className: "h-3 w-3 text-muted-foreground" })
|
|
29061
29292
|
] }),
|
|
29062
29293
|
contentClassName: "max-h-80 overflow-y-auto min-w-56 p-2",
|
|
29063
29294
|
children: [
|
|
29064
|
-
/* @__PURE__ */
|
|
29295
|
+
/* @__PURE__ */ jsx86(
|
|
29065
29296
|
DropdownMenuItem,
|
|
29066
29297
|
{
|
|
29067
29298
|
icon: Type2,
|
|
@@ -29070,7 +29301,7 @@ var EditorToolbar = ({
|
|
|
29070
29301
|
active: !currentFontFamily
|
|
29071
29302
|
}
|
|
29072
29303
|
),
|
|
29073
|
-
availableFontFamilies.map((option) => /* @__PURE__ */
|
|
29304
|
+
availableFontFamilies.map((option) => /* @__PURE__ */ jsx86(
|
|
29074
29305
|
DropdownMenuItem,
|
|
29075
29306
|
{
|
|
29076
29307
|
label: option.label,
|
|
@@ -29083,20 +29314,20 @@ var EditorToolbar = ({
|
|
|
29083
29314
|
]
|
|
29084
29315
|
}
|
|
29085
29316
|
),
|
|
29086
|
-
/* @__PURE__ */
|
|
29317
|
+
/* @__PURE__ */ jsxs72(
|
|
29087
29318
|
DropdownMenu,
|
|
29088
29319
|
{
|
|
29089
|
-
trigger: /* @__PURE__ */
|
|
29320
|
+
trigger: /* @__PURE__ */ jsxs72(ToolbarButton, { onClick: () => {
|
|
29090
29321
|
}, title: t("toolbar.fontSize"), className: "px-1.5 w-auto gap-0.5", children: [
|
|
29091
|
-
/* @__PURE__ */
|
|
29092
|
-
/* @__PURE__ */
|
|
29093
|
-
/* @__PURE__ */
|
|
29322
|
+
/* @__PURE__ */ jsxs72("div", { className: "flex items-center gap-0.5", children: [
|
|
29323
|
+
/* @__PURE__ */ jsx86(ChevronsUpDown, { className: "h-3 w-3 text-muted-foreground", strokeWidth: 2.5 }),
|
|
29324
|
+
/* @__PURE__ */ jsx86("span", { className: "text-xs font-bold leading-none", children: "A" })
|
|
29094
29325
|
] }),
|
|
29095
|
-
/* @__PURE__ */
|
|
29326
|
+
/* @__PURE__ */ jsx86(ChevronDown8, { className: "h-3 w-3 text-muted-foreground" })
|
|
29096
29327
|
] }),
|
|
29097
29328
|
contentClassName: "max-h-80 overflow-y-auto min-w-32 p-2",
|
|
29098
29329
|
children: [
|
|
29099
|
-
/* @__PURE__ */
|
|
29330
|
+
/* @__PURE__ */ jsx86(
|
|
29100
29331
|
DropdownMenuItem,
|
|
29101
29332
|
{
|
|
29102
29333
|
icon: Type2,
|
|
@@ -29105,7 +29336,7 @@ var EditorToolbar = ({
|
|
|
29105
29336
|
active: !currentFontSize
|
|
29106
29337
|
}
|
|
29107
29338
|
),
|
|
29108
|
-
availableFontSizes.map((option) => /* @__PURE__ */
|
|
29339
|
+
availableFontSizes.map((option) => /* @__PURE__ */ jsx86(
|
|
29109
29340
|
DropdownMenuItem,
|
|
29110
29341
|
{
|
|
29111
29342
|
label: option.label,
|
|
@@ -29117,17 +29348,17 @@ var EditorToolbar = ({
|
|
|
29117
29348
|
]
|
|
29118
29349
|
}
|
|
29119
29350
|
),
|
|
29120
|
-
/* @__PURE__ */
|
|
29351
|
+
/* @__PURE__ */ jsxs72(
|
|
29121
29352
|
DropdownMenu,
|
|
29122
29353
|
{
|
|
29123
29354
|
contentClassName: "p-1",
|
|
29124
|
-
trigger: /* @__PURE__ */
|
|
29355
|
+
trigger: /* @__PURE__ */ jsxs72(ToolbarButton, { onClick: () => {
|
|
29125
29356
|
}, title: t("toolbar.textStyle"), className: "px-1.5 w-auto gap-0.5", children: [
|
|
29126
|
-
/* @__PURE__ */
|
|
29127
|
-
/* @__PURE__ */
|
|
29357
|
+
/* @__PURE__ */ jsx86(Type2, { className: "w-4 h-4" }),
|
|
29358
|
+
/* @__PURE__ */ jsx86(ChevronDown8, { className: "h-3 w-3 text-muted-foreground" })
|
|
29128
29359
|
] }),
|
|
29129
29360
|
children: [
|
|
29130
|
-
/* @__PURE__ */
|
|
29361
|
+
/* @__PURE__ */ jsx86(
|
|
29131
29362
|
DropdownMenuItem,
|
|
29132
29363
|
{
|
|
29133
29364
|
icon: Type2,
|
|
@@ -29136,7 +29367,7 @@ var EditorToolbar = ({
|
|
|
29136
29367
|
active: editor.isActive("paragraph")
|
|
29137
29368
|
}
|
|
29138
29369
|
),
|
|
29139
|
-
/* @__PURE__ */
|
|
29370
|
+
/* @__PURE__ */ jsx86(
|
|
29140
29371
|
DropdownMenuItem,
|
|
29141
29372
|
{
|
|
29142
29373
|
icon: Heading1Icon,
|
|
@@ -29146,7 +29377,7 @@ var EditorToolbar = ({
|
|
|
29146
29377
|
shortcut: "Ctrl+Alt+1"
|
|
29147
29378
|
}
|
|
29148
29379
|
),
|
|
29149
|
-
/* @__PURE__ */
|
|
29380
|
+
/* @__PURE__ */ jsx86(
|
|
29150
29381
|
DropdownMenuItem,
|
|
29151
29382
|
{
|
|
29152
29383
|
icon: Heading2Icon,
|
|
@@ -29156,7 +29387,7 @@ var EditorToolbar = ({
|
|
|
29156
29387
|
shortcut: "Ctrl+Alt+2"
|
|
29157
29388
|
}
|
|
29158
29389
|
),
|
|
29159
|
-
/* @__PURE__ */
|
|
29390
|
+
/* @__PURE__ */ jsx86(
|
|
29160
29391
|
DropdownMenuItem,
|
|
29161
29392
|
{
|
|
29162
29393
|
icon: Heading3Icon,
|
|
@@ -29169,17 +29400,17 @@ var EditorToolbar = ({
|
|
|
29169
29400
|
]
|
|
29170
29401
|
}
|
|
29171
29402
|
),
|
|
29172
|
-
/* @__PURE__ */
|
|
29403
|
+
/* @__PURE__ */ jsxs72(
|
|
29173
29404
|
DropdownMenu,
|
|
29174
29405
|
{
|
|
29175
|
-
trigger: /* @__PURE__ */
|
|
29406
|
+
trigger: /* @__PURE__ */ jsxs72(ToolbarButton, { onClick: () => {
|
|
29176
29407
|
}, title: t("toolbar.lineHeight"), className: "gap-0.5", children: [
|
|
29177
|
-
/* @__PURE__ */
|
|
29178
|
-
/* @__PURE__ */
|
|
29408
|
+
/* @__PURE__ */ jsx86(ArrowUp, { className: "w-3 h-3" }),
|
|
29409
|
+
/* @__PURE__ */ jsx86(ArrowDown, { className: "w-3 h-3" })
|
|
29179
29410
|
] }),
|
|
29180
29411
|
contentClassName: "max-h-72 overflow-y-auto p-1",
|
|
29181
29412
|
children: [
|
|
29182
|
-
/* @__PURE__ */
|
|
29413
|
+
/* @__PURE__ */ jsx86(
|
|
29183
29414
|
DropdownMenuItem,
|
|
29184
29415
|
{
|
|
29185
29416
|
icon: Type2,
|
|
@@ -29188,7 +29419,7 @@ var EditorToolbar = ({
|
|
|
29188
29419
|
active: !currentLineHeight
|
|
29189
29420
|
}
|
|
29190
29421
|
),
|
|
29191
|
-
availableLineHeights.map((option) => /* @__PURE__ */
|
|
29422
|
+
availableLineHeights.map((option) => /* @__PURE__ */ jsx86(
|
|
29192
29423
|
DropdownMenuItem,
|
|
29193
29424
|
{
|
|
29194
29425
|
label: option.label,
|
|
@@ -29200,17 +29431,17 @@ var EditorToolbar = ({
|
|
|
29200
29431
|
]
|
|
29201
29432
|
}
|
|
29202
29433
|
),
|
|
29203
|
-
/* @__PURE__ */
|
|
29434
|
+
/* @__PURE__ */ jsxs72(
|
|
29204
29435
|
DropdownMenu,
|
|
29205
29436
|
{
|
|
29206
|
-
trigger: /* @__PURE__ */
|
|
29437
|
+
trigger: /* @__PURE__ */ jsxs72(ToolbarButton, { onClick: () => {
|
|
29207
29438
|
}, title: t("toolbar.letterSpacing"), className: "gap-0.5", children: [
|
|
29208
|
-
/* @__PURE__ */
|
|
29209
|
-
/* @__PURE__ */
|
|
29439
|
+
/* @__PURE__ */ jsx86(ArrowLeft, { className: "w-3 h-3" }),
|
|
29440
|
+
/* @__PURE__ */ jsx86(ArrowRight, { className: "w-3 h-3" })
|
|
29210
29441
|
] }),
|
|
29211
29442
|
contentClassName: "max-h-72 overflow-y-auto p-1",
|
|
29212
29443
|
children: [
|
|
29213
|
-
/* @__PURE__ */
|
|
29444
|
+
/* @__PURE__ */ jsx86(
|
|
29214
29445
|
DropdownMenuItem,
|
|
29215
29446
|
{
|
|
29216
29447
|
icon: Type2,
|
|
@@ -29219,7 +29450,7 @@ var EditorToolbar = ({
|
|
|
29219
29450
|
active: !currentLetterSpacing
|
|
29220
29451
|
}
|
|
29221
29452
|
),
|
|
29222
|
-
availableLetterSpacings.map((option) => /* @__PURE__ */
|
|
29453
|
+
availableLetterSpacings.map((option) => /* @__PURE__ */ jsx86(
|
|
29223
29454
|
DropdownMenuItem,
|
|
29224
29455
|
{
|
|
29225
29456
|
label: option.label,
|
|
@@ -29231,44 +29462,44 @@ var EditorToolbar = ({
|
|
|
29231
29462
|
]
|
|
29232
29463
|
}
|
|
29233
29464
|
),
|
|
29234
|
-
/* @__PURE__ */
|
|
29235
|
-
/* @__PURE__ */
|
|
29236
|
-
/* @__PURE__ */
|
|
29237
|
-
/* @__PURE__ */
|
|
29465
|
+
/* @__PURE__ */ jsx86(ToolbarDivider, {}),
|
|
29466
|
+
/* @__PURE__ */ jsx86(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ jsx86(BoldIcon, { className: "w-4 h-4" }) }),
|
|
29467
|
+
/* @__PURE__ */ jsx86(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ jsx86(ItalicIcon, { className: "w-4 h-4" }) }),
|
|
29468
|
+
/* @__PURE__ */ jsx86(
|
|
29238
29469
|
ToolbarButton,
|
|
29239
29470
|
{
|
|
29240
29471
|
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
29241
29472
|
active: editor.isActive("underline"),
|
|
29242
29473
|
title: t("toolbar.underline"),
|
|
29243
|
-
children: /* @__PURE__ */
|
|
29474
|
+
children: /* @__PURE__ */ jsx86(UnderlineIcon, { className: "w-4 h-4" })
|
|
29244
29475
|
}
|
|
29245
29476
|
),
|
|
29246
|
-
/* @__PURE__ */
|
|
29247
|
-
/* @__PURE__ */
|
|
29248
|
-
/* @__PURE__ */
|
|
29477
|
+
/* @__PURE__ */ jsx86(ToolbarButton, { onClick: () => editor.chain().focus().toggleStrike().run(), active: editor.isActive("strike"), title: t("toolbar.strike"), children: /* @__PURE__ */ jsx86(StrikethroughIcon, { className: "w-4 h-4" }) }),
|
|
29478
|
+
/* @__PURE__ */ jsx86(ToolbarButton, { onClick: () => editor.chain().focus().toggleCode().run(), active: editor.isActive("code"), title: t("toolbar.code"), children: /* @__PURE__ */ jsx86(CodeIcon, { className: "w-4 h-4" }) }),
|
|
29479
|
+
/* @__PURE__ */ jsx86(
|
|
29249
29480
|
ToolbarButton,
|
|
29250
29481
|
{
|
|
29251
29482
|
onClick: () => editor.chain().focus().toggleSubscript().run(),
|
|
29252
29483
|
active: editor.isActive("subscript"),
|
|
29253
29484
|
title: t("toolbar.subscript"),
|
|
29254
|
-
children: /* @__PURE__ */
|
|
29485
|
+
children: /* @__PURE__ */ jsx86(SubscriptIcon, { className: "w-4 h-4" })
|
|
29255
29486
|
}
|
|
29256
29487
|
),
|
|
29257
|
-
/* @__PURE__ */
|
|
29488
|
+
/* @__PURE__ */ jsx86(
|
|
29258
29489
|
ToolbarButton,
|
|
29259
29490
|
{
|
|
29260
29491
|
onClick: () => editor.chain().focus().toggleSuperscript().run(),
|
|
29261
29492
|
active: editor.isActive("superscript"),
|
|
29262
29493
|
title: t("toolbar.superscript"),
|
|
29263
|
-
children: /* @__PURE__ */
|
|
29494
|
+
children: /* @__PURE__ */ jsx86(SuperscriptIcon, { className: "w-4 h-4" })
|
|
29264
29495
|
}
|
|
29265
29496
|
),
|
|
29266
|
-
/* @__PURE__ */
|
|
29497
|
+
/* @__PURE__ */ jsx86(
|
|
29267
29498
|
DropdownMenu,
|
|
29268
29499
|
{
|
|
29269
29500
|
contentClassName: "min-w-72",
|
|
29270
|
-
trigger: /* @__PURE__ */
|
|
29271
|
-
children: showLinkInput ? /* @__PURE__ */
|
|
29501
|
+
trigger: /* @__PURE__ */ jsx86(ToolbarButton, { onClick: () => setShowLinkInput(!editor.isActive("link")), active: editor.isActive("link"), title: t("toolbar.link"), children: /* @__PURE__ */ jsx86(LinkIcon, { className: "w-4 h-4" }) }),
|
|
29502
|
+
children: showLinkInput ? /* @__PURE__ */ jsx86(
|
|
29272
29503
|
LinkInput,
|
|
29273
29504
|
{
|
|
29274
29505
|
initialUrl: String(editor.getAttributes("link").href ?? ""),
|
|
@@ -29278,8 +29509,8 @@ var EditorToolbar = ({
|
|
|
29278
29509
|
},
|
|
29279
29510
|
onCancel: () => setShowLinkInput(false)
|
|
29280
29511
|
}
|
|
29281
|
-
) : /* @__PURE__ */
|
|
29282
|
-
/* @__PURE__ */
|
|
29512
|
+
) : /* @__PURE__ */ jsxs72(Fragment28, { children: [
|
|
29513
|
+
/* @__PURE__ */ jsx86(
|
|
29283
29514
|
DropdownMenuItem,
|
|
29284
29515
|
{
|
|
29285
29516
|
icon: LinkIcon,
|
|
@@ -29289,7 +29520,7 @@ var EditorToolbar = ({
|
|
|
29289
29520
|
closeOnSelect: false
|
|
29290
29521
|
}
|
|
29291
29522
|
),
|
|
29292
|
-
/* @__PURE__ */
|
|
29523
|
+
/* @__PURE__ */ jsx86(
|
|
29293
29524
|
DropdownMenuItem,
|
|
29294
29525
|
{
|
|
29295
29526
|
icon: Trash22,
|
|
@@ -29302,16 +29533,16 @@ var EditorToolbar = ({
|
|
|
29302
29533
|
] })
|
|
29303
29534
|
}
|
|
29304
29535
|
),
|
|
29305
|
-
/* @__PURE__ */
|
|
29306
|
-
/* @__PURE__ */
|
|
29536
|
+
/* @__PURE__ */ jsx86(ToolbarDivider, {}),
|
|
29537
|
+
/* @__PURE__ */ jsx86(
|
|
29307
29538
|
DropdownMenu,
|
|
29308
29539
|
{
|
|
29309
|
-
trigger: /* @__PURE__ */
|
|
29540
|
+
trigger: /* @__PURE__ */ jsxs72(ToolbarButton, { onClick: () => {
|
|
29310
29541
|
}, title: t("colors.textColor"), children: [
|
|
29311
|
-
/* @__PURE__ */
|
|
29312
|
-
/* @__PURE__ */
|
|
29542
|
+
/* @__PURE__ */ jsx86(TextColorIcon, { color: currentTextColor }),
|
|
29543
|
+
/* @__PURE__ */ jsx86(ChevronDown8, { className: "w-3 h-3" })
|
|
29313
29544
|
] }),
|
|
29314
|
-
children: /* @__PURE__ */
|
|
29545
|
+
children: /* @__PURE__ */ jsx86(
|
|
29315
29546
|
EditorColorPalette,
|
|
29316
29547
|
{
|
|
29317
29548
|
colors: textColors,
|
|
@@ -29328,15 +29559,15 @@ var EditorToolbar = ({
|
|
|
29328
29559
|
)
|
|
29329
29560
|
}
|
|
29330
29561
|
),
|
|
29331
|
-
/* @__PURE__ */
|
|
29562
|
+
/* @__PURE__ */ jsx86(
|
|
29332
29563
|
DropdownMenu,
|
|
29333
29564
|
{
|
|
29334
|
-
trigger: /* @__PURE__ */
|
|
29565
|
+
trigger: /* @__PURE__ */ jsxs72(ToolbarButton, { onClick: () => {
|
|
29335
29566
|
}, active: editor.isActive("highlight"), title: t("colors.highlight"), children: [
|
|
29336
|
-
/* @__PURE__ */
|
|
29337
|
-
/* @__PURE__ */
|
|
29567
|
+
/* @__PURE__ */ jsx86(HighlightColorIcon, { color: currentHighlightColor }),
|
|
29568
|
+
/* @__PURE__ */ jsx86(ChevronDown8, { className: "w-3 h-3" })
|
|
29338
29569
|
] }),
|
|
29339
|
-
children: /* @__PURE__ */
|
|
29570
|
+
children: /* @__PURE__ */ jsx86(
|
|
29340
29571
|
EditorColorPalette,
|
|
29341
29572
|
{
|
|
29342
29573
|
colors: highlightColors,
|
|
@@ -29353,14 +29584,14 @@ var EditorToolbar = ({
|
|
|
29353
29584
|
)
|
|
29354
29585
|
}
|
|
29355
29586
|
),
|
|
29356
|
-
/* @__PURE__ */
|
|
29357
|
-
/* @__PURE__ */
|
|
29587
|
+
/* @__PURE__ */ jsx86(ToolbarDivider, {}),
|
|
29588
|
+
/* @__PURE__ */ jsx86(
|
|
29358
29589
|
DropdownMenu,
|
|
29359
29590
|
{
|
|
29360
29591
|
contentClassName: "p-0 overflow-hidden",
|
|
29361
|
-
trigger: /* @__PURE__ */
|
|
29362
|
-
}, title: t("toolbar.emoji"), children: /* @__PURE__ */
|
|
29363
|
-
children: /* @__PURE__ */
|
|
29592
|
+
trigger: /* @__PURE__ */ jsx86(ToolbarButton, { onClick: () => {
|
|
29593
|
+
}, title: t("toolbar.emoji"), children: /* @__PURE__ */ jsx86(Smile3, { className: "w-4 h-4" }) }),
|
|
29594
|
+
children: /* @__PURE__ */ jsx86(
|
|
29364
29595
|
EmojiPicker2,
|
|
29365
29596
|
{
|
|
29366
29597
|
onSelect: (emoji) => {
|
|
@@ -29370,17 +29601,17 @@ var EditorToolbar = ({
|
|
|
29370
29601
|
)
|
|
29371
29602
|
}
|
|
29372
29603
|
),
|
|
29373
|
-
/* @__PURE__ */
|
|
29374
|
-
/* @__PURE__ */
|
|
29604
|
+
/* @__PURE__ */ jsx86(ToolbarDivider, {}),
|
|
29605
|
+
/* @__PURE__ */ jsxs72(
|
|
29375
29606
|
DropdownMenu,
|
|
29376
29607
|
{
|
|
29377
|
-
trigger: /* @__PURE__ */
|
|
29608
|
+
trigger: /* @__PURE__ */ jsxs72(ToolbarButton, { onClick: () => {
|
|
29378
29609
|
}, title: t("toolbar.alignment"), children: [
|
|
29379
|
-
/* @__PURE__ */
|
|
29380
|
-
/* @__PURE__ */
|
|
29610
|
+
/* @__PURE__ */ jsx86(AlignLeft, { className: "w-4 h-4" }),
|
|
29611
|
+
/* @__PURE__ */ jsx86(ChevronDown8, { className: "w-3 h-3" })
|
|
29381
29612
|
] }),
|
|
29382
29613
|
children: [
|
|
29383
|
-
/* @__PURE__ */
|
|
29614
|
+
/* @__PURE__ */ jsx86(
|
|
29384
29615
|
DropdownMenuItem,
|
|
29385
29616
|
{
|
|
29386
29617
|
icon: AlignLeft,
|
|
@@ -29389,7 +29620,7 @@ var EditorToolbar = ({
|
|
|
29389
29620
|
active: editor.isActive({ textAlign: "left" })
|
|
29390
29621
|
}
|
|
29391
29622
|
),
|
|
29392
|
-
/* @__PURE__ */
|
|
29623
|
+
/* @__PURE__ */ jsx86(
|
|
29393
29624
|
DropdownMenuItem,
|
|
29394
29625
|
{
|
|
29395
29626
|
icon: AlignCenter,
|
|
@@ -29398,7 +29629,7 @@ var EditorToolbar = ({
|
|
|
29398
29629
|
active: editor.isActive({ textAlign: "center" })
|
|
29399
29630
|
}
|
|
29400
29631
|
),
|
|
29401
|
-
/* @__PURE__ */
|
|
29632
|
+
/* @__PURE__ */ jsx86(
|
|
29402
29633
|
DropdownMenuItem,
|
|
29403
29634
|
{
|
|
29404
29635
|
icon: AlignRight,
|
|
@@ -29407,7 +29638,7 @@ var EditorToolbar = ({
|
|
|
29407
29638
|
active: editor.isActive({ textAlign: "right" })
|
|
29408
29639
|
}
|
|
29409
29640
|
),
|
|
29410
|
-
/* @__PURE__ */
|
|
29641
|
+
/* @__PURE__ */ jsx86(
|
|
29411
29642
|
DropdownMenuItem,
|
|
29412
29643
|
{
|
|
29413
29644
|
icon: AlignJustify,
|
|
@@ -29419,17 +29650,17 @@ var EditorToolbar = ({
|
|
|
29419
29650
|
]
|
|
29420
29651
|
}
|
|
29421
29652
|
),
|
|
29422
|
-
/* @__PURE__ */
|
|
29423
|
-
/* @__PURE__ */
|
|
29653
|
+
/* @__PURE__ */ jsx86(ToolbarDivider, {}),
|
|
29654
|
+
/* @__PURE__ */ jsxs72(
|
|
29424
29655
|
DropdownMenu,
|
|
29425
29656
|
{
|
|
29426
|
-
trigger: /* @__PURE__ */
|
|
29657
|
+
trigger: /* @__PURE__ */ jsxs72(ToolbarButton, { onClick: () => {
|
|
29427
29658
|
}, title: t("toolbar.bulletList"), children: [
|
|
29428
|
-
/* @__PURE__ */
|
|
29429
|
-
/* @__PURE__ */
|
|
29659
|
+
/* @__PURE__ */ jsx86(ListIcon, { className: "w-4 h-4" }),
|
|
29660
|
+
/* @__PURE__ */ jsx86(ChevronDown8, { className: "w-3 h-3" })
|
|
29430
29661
|
] }),
|
|
29431
29662
|
children: [
|
|
29432
|
-
/* @__PURE__ */
|
|
29663
|
+
/* @__PURE__ */ jsx86(
|
|
29433
29664
|
DropdownMenuItem,
|
|
29434
29665
|
{
|
|
29435
29666
|
icon: ListIcon,
|
|
@@ -29439,7 +29670,7 @@ var EditorToolbar = ({
|
|
|
29439
29670
|
shortcut: "Ctrl+Shift+8"
|
|
29440
29671
|
}
|
|
29441
29672
|
),
|
|
29442
|
-
/* @__PURE__ */
|
|
29673
|
+
/* @__PURE__ */ jsx86(
|
|
29443
29674
|
DropdownMenuItem,
|
|
29444
29675
|
{
|
|
29445
29676
|
icon: ListOrderedIcon,
|
|
@@ -29449,7 +29680,7 @@ var EditorToolbar = ({
|
|
|
29449
29680
|
shortcut: "Ctrl+Shift+7"
|
|
29450
29681
|
}
|
|
29451
29682
|
),
|
|
29452
|
-
/* @__PURE__ */
|
|
29683
|
+
/* @__PURE__ */ jsx86(
|
|
29453
29684
|
DropdownMenuItem,
|
|
29454
29685
|
{
|
|
29455
29686
|
icon: ListTodo2,
|
|
@@ -29462,16 +29693,16 @@ var EditorToolbar = ({
|
|
|
29462
29693
|
]
|
|
29463
29694
|
}
|
|
29464
29695
|
),
|
|
29465
|
-
/* @__PURE__ */
|
|
29696
|
+
/* @__PURE__ */ jsxs72(
|
|
29466
29697
|
DropdownMenu,
|
|
29467
29698
|
{
|
|
29468
|
-
trigger: /* @__PURE__ */
|
|
29699
|
+
trigger: /* @__PURE__ */ jsxs72(ToolbarButton, { onClick: () => {
|
|
29469
29700
|
}, title: t("toolbar.quote"), children: [
|
|
29470
|
-
/* @__PURE__ */
|
|
29471
|
-
/* @__PURE__ */
|
|
29701
|
+
/* @__PURE__ */ jsx86(QuoteIcon, { className: "w-4 h-4" }),
|
|
29702
|
+
/* @__PURE__ */ jsx86(ChevronDown8, { className: "w-3 h-3" })
|
|
29472
29703
|
] }),
|
|
29473
29704
|
children: [
|
|
29474
|
-
/* @__PURE__ */
|
|
29705
|
+
/* @__PURE__ */ jsx86(
|
|
29475
29706
|
DropdownMenuItem,
|
|
29476
29707
|
{
|
|
29477
29708
|
icon: QuoteIcon,
|
|
@@ -29481,7 +29712,7 @@ var EditorToolbar = ({
|
|
|
29481
29712
|
shortcut: "Ctrl+Shift+B"
|
|
29482
29713
|
}
|
|
29483
29714
|
),
|
|
29484
|
-
/* @__PURE__ */
|
|
29715
|
+
/* @__PURE__ */ jsx86(
|
|
29485
29716
|
DropdownMenuItem,
|
|
29486
29717
|
{
|
|
29487
29718
|
icon: FileCode3,
|
|
@@ -29494,15 +29725,15 @@ var EditorToolbar = ({
|
|
|
29494
29725
|
]
|
|
29495
29726
|
}
|
|
29496
29727
|
),
|
|
29497
|
-
/* @__PURE__ */
|
|
29728
|
+
/* @__PURE__ */ jsx86(
|
|
29498
29729
|
DropdownMenu,
|
|
29499
29730
|
{
|
|
29500
|
-
trigger: /* @__PURE__ */
|
|
29731
|
+
trigger: /* @__PURE__ */ jsxs72(ToolbarButton, { onClick: () => {
|
|
29501
29732
|
}, title: t("toolbar.image"), children: [
|
|
29502
|
-
/* @__PURE__ */
|
|
29503
|
-
/* @__PURE__ */
|
|
29733
|
+
/* @__PURE__ */ jsx86(ImageIcon2, { className: "w-4 h-4" }),
|
|
29734
|
+
/* @__PURE__ */ jsx86(ChevronDown8, { className: "w-3 h-3" })
|
|
29504
29735
|
] }),
|
|
29505
|
-
children: showImageInput ? /* @__PURE__ */
|
|
29736
|
+
children: showImageInput ? /* @__PURE__ */ jsx86(
|
|
29506
29737
|
ImageInput,
|
|
29507
29738
|
{
|
|
29508
29739
|
onSubmit: (url, alt) => {
|
|
@@ -29511,9 +29742,9 @@ var EditorToolbar = ({
|
|
|
29511
29742
|
},
|
|
29512
29743
|
onCancel: () => setShowImageInput(false)
|
|
29513
29744
|
}
|
|
29514
|
-
) : /* @__PURE__ */
|
|
29515
|
-
/* @__PURE__ */
|
|
29516
|
-
/* @__PURE__ */
|
|
29745
|
+
) : /* @__PURE__ */ jsxs72(Fragment28, { children: [
|
|
29746
|
+
/* @__PURE__ */ jsx86(DropdownMenuItem, { icon: LinkIcon, label: t("imageInput.addFromUrl"), onClick: () => setShowImageInput(true), closeOnSelect: false }),
|
|
29747
|
+
/* @__PURE__ */ jsx86(
|
|
29517
29748
|
DropdownMenuItem,
|
|
29518
29749
|
{
|
|
29519
29750
|
icon: Upload3,
|
|
@@ -29523,8 +29754,8 @@ var EditorToolbar = ({
|
|
|
29523
29754
|
closeOnSelect: false
|
|
29524
29755
|
}
|
|
29525
29756
|
),
|
|
29526
|
-
imageUploadError && /* @__PURE__ */
|
|
29527
|
-
/* @__PURE__ */
|
|
29757
|
+
imageUploadError && /* @__PURE__ */ jsx86(DropdownMenuItem, { label: imageUploadError, disabled: true, destructive: true }),
|
|
29758
|
+
/* @__PURE__ */ jsx86(
|
|
29528
29759
|
"input",
|
|
29529
29760
|
{
|
|
29530
29761
|
ref: fileInputRef,
|
|
@@ -29539,8 +29770,8 @@ var EditorToolbar = ({
|
|
|
29539
29770
|
}
|
|
29540
29771
|
}
|
|
29541
29772
|
),
|
|
29542
|
-
/* @__PURE__ */
|
|
29543
|
-
/* @__PURE__ */
|
|
29773
|
+
/* @__PURE__ */ jsx86("div", { className: "my-1 border-t" }),
|
|
29774
|
+
/* @__PURE__ */ jsx86(
|
|
29544
29775
|
DropdownMenuItem,
|
|
29545
29776
|
{
|
|
29546
29777
|
icon: AlignCenter,
|
|
@@ -29550,7 +29781,7 @@ var EditorToolbar = ({
|
|
|
29550
29781
|
disabled: !isImageSelected
|
|
29551
29782
|
}
|
|
29552
29783
|
),
|
|
29553
|
-
/* @__PURE__ */
|
|
29784
|
+
/* @__PURE__ */ jsx86(
|
|
29554
29785
|
DropdownMenuItem,
|
|
29555
29786
|
{
|
|
29556
29787
|
icon: AlignLeft,
|
|
@@ -29560,7 +29791,7 @@ var EditorToolbar = ({
|
|
|
29560
29791
|
disabled: !isImageSelected
|
|
29561
29792
|
}
|
|
29562
29793
|
),
|
|
29563
|
-
/* @__PURE__ */
|
|
29794
|
+
/* @__PURE__ */ jsx86(
|
|
29564
29795
|
DropdownMenuItem,
|
|
29565
29796
|
{
|
|
29566
29797
|
icon: AlignRight,
|
|
@@ -29570,8 +29801,8 @@ var EditorToolbar = ({
|
|
|
29570
29801
|
disabled: !isImageSelected
|
|
29571
29802
|
}
|
|
29572
29803
|
),
|
|
29573
|
-
/* @__PURE__ */
|
|
29574
|
-
/* @__PURE__ */
|
|
29804
|
+
/* @__PURE__ */ jsx86("div", { className: "my-1 border-t" }),
|
|
29805
|
+
/* @__PURE__ */ jsx86(
|
|
29575
29806
|
DropdownMenuItem,
|
|
29576
29807
|
{
|
|
29577
29808
|
label: t("toolbar.imageWidthSm"),
|
|
@@ -29580,7 +29811,7 @@ var EditorToolbar = ({
|
|
|
29580
29811
|
disabled: !isImageSelected
|
|
29581
29812
|
}
|
|
29582
29813
|
),
|
|
29583
|
-
/* @__PURE__ */
|
|
29814
|
+
/* @__PURE__ */ jsx86(
|
|
29584
29815
|
DropdownMenuItem,
|
|
29585
29816
|
{
|
|
29586
29817
|
label: t("toolbar.imageWidthMd"),
|
|
@@ -29589,7 +29820,7 @@ var EditorToolbar = ({
|
|
|
29589
29820
|
disabled: !isImageSelected
|
|
29590
29821
|
}
|
|
29591
29822
|
),
|
|
29592
|
-
/* @__PURE__ */
|
|
29823
|
+
/* @__PURE__ */ jsx86(
|
|
29593
29824
|
DropdownMenuItem,
|
|
29594
29825
|
{
|
|
29595
29826
|
label: t("toolbar.imageWidthLg"),
|
|
@@ -29598,8 +29829,8 @@ var EditorToolbar = ({
|
|
|
29598
29829
|
disabled: !isImageSelected
|
|
29599
29830
|
}
|
|
29600
29831
|
),
|
|
29601
|
-
/* @__PURE__ */
|
|
29602
|
-
/* @__PURE__ */
|
|
29832
|
+
/* @__PURE__ */ jsx86("div", { className: "my-1 border-t" }),
|
|
29833
|
+
/* @__PURE__ */ jsx86(
|
|
29603
29834
|
DropdownMenuItem,
|
|
29604
29835
|
{
|
|
29605
29836
|
icon: RotateCcw2,
|
|
@@ -29608,7 +29839,7 @@ var EditorToolbar = ({
|
|
|
29608
29839
|
disabled: !isImageSelected
|
|
29609
29840
|
}
|
|
29610
29841
|
),
|
|
29611
|
-
/* @__PURE__ */
|
|
29842
|
+
/* @__PURE__ */ jsx86(
|
|
29612
29843
|
DropdownMenuItem,
|
|
29613
29844
|
{
|
|
29614
29845
|
icon: Trash22,
|
|
@@ -29621,7 +29852,7 @@ var EditorToolbar = ({
|
|
|
29621
29852
|
] })
|
|
29622
29853
|
}
|
|
29623
29854
|
),
|
|
29624
|
-
/* @__PURE__ */
|
|
29855
|
+
/* @__PURE__ */ jsxs72(
|
|
29625
29856
|
DropdownMenu,
|
|
29626
29857
|
{
|
|
29627
29858
|
isOpen: isTableMenuOpen,
|
|
@@ -29629,14 +29860,14 @@ var EditorToolbar = ({
|
|
|
29629
29860
|
setIsTableMenuOpen(open);
|
|
29630
29861
|
tableCommandAnchorPosRef.current = open ? getTableAnchorPos(editor) : null;
|
|
29631
29862
|
},
|
|
29632
|
-
trigger: /* @__PURE__ */
|
|
29863
|
+
trigger: /* @__PURE__ */ jsxs72(ToolbarButton, { onClick: () => {
|
|
29633
29864
|
}, title: t("toolbar.table"), children: [
|
|
29634
|
-
/* @__PURE__ */
|
|
29635
|
-
/* @__PURE__ */
|
|
29865
|
+
/* @__PURE__ */ jsx86(TableIcon, { className: "w-4 h-4" }),
|
|
29866
|
+
/* @__PURE__ */ jsx86(ChevronDown8, { className: "w-3 h-3" })
|
|
29636
29867
|
] }),
|
|
29637
29868
|
contentClassName: "p-2 min-w-56",
|
|
29638
29869
|
children: [
|
|
29639
|
-
/* @__PURE__ */
|
|
29870
|
+
/* @__PURE__ */ jsx86(
|
|
29640
29871
|
TableInsertGrid,
|
|
29641
29872
|
{
|
|
29642
29873
|
insertLabel: t("tableMenu.insertTable"),
|
|
@@ -29647,8 +29878,8 @@ var EditorToolbar = ({
|
|
|
29647
29878
|
}
|
|
29648
29879
|
}
|
|
29649
29880
|
),
|
|
29650
|
-
/* @__PURE__ */
|
|
29651
|
-
/* @__PURE__ */
|
|
29881
|
+
/* @__PURE__ */ jsx86("div", { className: "my-1 border-t" }),
|
|
29882
|
+
/* @__PURE__ */ jsx86(
|
|
29652
29883
|
DropdownMenuItem,
|
|
29653
29884
|
{
|
|
29654
29885
|
icon: AlignLeft,
|
|
@@ -29658,7 +29889,7 @@ var EditorToolbar = ({
|
|
|
29658
29889
|
disabled: !hasTableContext
|
|
29659
29890
|
}
|
|
29660
29891
|
),
|
|
29661
|
-
/* @__PURE__ */
|
|
29892
|
+
/* @__PURE__ */ jsx86(
|
|
29662
29893
|
DropdownMenuItem,
|
|
29663
29894
|
{
|
|
29664
29895
|
icon: AlignCenter,
|
|
@@ -29668,7 +29899,7 @@ var EditorToolbar = ({
|
|
|
29668
29899
|
disabled: !hasTableContext
|
|
29669
29900
|
}
|
|
29670
29901
|
),
|
|
29671
|
-
/* @__PURE__ */
|
|
29902
|
+
/* @__PURE__ */ jsx86(
|
|
29672
29903
|
DropdownMenuItem,
|
|
29673
29904
|
{
|
|
29674
29905
|
icon: AlignRight,
|
|
@@ -29678,8 +29909,8 @@ var EditorToolbar = ({
|
|
|
29678
29909
|
disabled: !hasTableContext
|
|
29679
29910
|
}
|
|
29680
29911
|
),
|
|
29681
|
-
/* @__PURE__ */
|
|
29682
|
-
/* @__PURE__ */
|
|
29912
|
+
/* @__PURE__ */ jsx86("div", { className: "my-1 border-t" }),
|
|
29913
|
+
/* @__PURE__ */ jsx86(
|
|
29683
29914
|
DropdownMenuItem,
|
|
29684
29915
|
{
|
|
29685
29916
|
icon: ArrowLeft,
|
|
@@ -29688,7 +29919,7 @@ var EditorToolbar = ({
|
|
|
29688
29919
|
disabled: !hasTableContext || !editor.can().addColumnBefore()
|
|
29689
29920
|
}
|
|
29690
29921
|
),
|
|
29691
|
-
/* @__PURE__ */
|
|
29922
|
+
/* @__PURE__ */ jsx86(
|
|
29692
29923
|
DropdownMenuItem,
|
|
29693
29924
|
{
|
|
29694
29925
|
icon: ArrowDown,
|
|
@@ -29697,7 +29928,7 @@ var EditorToolbar = ({
|
|
|
29697
29928
|
disabled: !hasTableContext || !editor.can().addColumnAfter()
|
|
29698
29929
|
}
|
|
29699
29930
|
),
|
|
29700
|
-
/* @__PURE__ */
|
|
29931
|
+
/* @__PURE__ */ jsx86(
|
|
29701
29932
|
DropdownMenuItem,
|
|
29702
29933
|
{
|
|
29703
29934
|
icon: ArrowUp,
|
|
@@ -29706,7 +29937,7 @@ var EditorToolbar = ({
|
|
|
29706
29937
|
disabled: !hasTableContext || !editor.can().addRowBefore()
|
|
29707
29938
|
}
|
|
29708
29939
|
),
|
|
29709
|
-
/* @__PURE__ */
|
|
29940
|
+
/* @__PURE__ */ jsx86(
|
|
29710
29941
|
DropdownMenuItem,
|
|
29711
29942
|
{
|
|
29712
29943
|
icon: ArrowRight,
|
|
@@ -29715,8 +29946,8 @@ var EditorToolbar = ({
|
|
|
29715
29946
|
disabled: !hasTableContext || !editor.can().addRowAfter()
|
|
29716
29947
|
}
|
|
29717
29948
|
),
|
|
29718
|
-
/* @__PURE__ */
|
|
29719
|
-
/* @__PURE__ */
|
|
29949
|
+
/* @__PURE__ */ jsx86("div", { className: "my-1 border-t" }),
|
|
29950
|
+
/* @__PURE__ */ jsx86(
|
|
29720
29951
|
DropdownMenuItem,
|
|
29721
29952
|
{
|
|
29722
29953
|
icon: TableIcon,
|
|
@@ -29725,7 +29956,7 @@ var EditorToolbar = ({
|
|
|
29725
29956
|
disabled: !hasTableContext || !editor.can().toggleHeaderRow()
|
|
29726
29957
|
}
|
|
29727
29958
|
),
|
|
29728
|
-
/* @__PURE__ */
|
|
29959
|
+
/* @__PURE__ */ jsx86(
|
|
29729
29960
|
DropdownMenuItem,
|
|
29730
29961
|
{
|
|
29731
29962
|
icon: TableIcon,
|
|
@@ -29734,8 +29965,8 @@ var EditorToolbar = ({
|
|
|
29734
29965
|
disabled: !hasTableContext || !editor.can().toggleHeaderColumn()
|
|
29735
29966
|
}
|
|
29736
29967
|
),
|
|
29737
|
-
/* @__PURE__ */
|
|
29738
|
-
/* @__PURE__ */
|
|
29968
|
+
/* @__PURE__ */ jsx86("div", { className: "my-1 border-t" }),
|
|
29969
|
+
/* @__PURE__ */ jsx86(
|
|
29739
29970
|
DropdownMenuItem,
|
|
29740
29971
|
{
|
|
29741
29972
|
icon: Trash22,
|
|
@@ -29744,7 +29975,7 @@ var EditorToolbar = ({
|
|
|
29744
29975
|
disabled: !hasTableContext || !editor.can().deleteColumn()
|
|
29745
29976
|
}
|
|
29746
29977
|
),
|
|
29747
|
-
/* @__PURE__ */
|
|
29978
|
+
/* @__PURE__ */ jsx86(
|
|
29748
29979
|
DropdownMenuItem,
|
|
29749
29980
|
{
|
|
29750
29981
|
icon: Trash22,
|
|
@@ -29753,7 +29984,7 @@ var EditorToolbar = ({
|
|
|
29753
29984
|
disabled: !hasTableContext || !editor.can().deleteRow()
|
|
29754
29985
|
}
|
|
29755
29986
|
),
|
|
29756
|
-
/* @__PURE__ */
|
|
29987
|
+
/* @__PURE__ */ jsx86(
|
|
29757
29988
|
DropdownMenuItem,
|
|
29758
29989
|
{
|
|
29759
29990
|
icon: Trash22,
|
|
@@ -29765,48 +29996,48 @@ var EditorToolbar = ({
|
|
|
29765
29996
|
]
|
|
29766
29997
|
}
|
|
29767
29998
|
),
|
|
29768
|
-
/* @__PURE__ */
|
|
29769
|
-
/* @__PURE__ */
|
|
29770
|
-
/* @__PURE__ */
|
|
29771
|
-
hasTableContext && /* @__PURE__ */
|
|
29772
|
-
/* @__PURE__ */
|
|
29773
|
-
/* @__PURE__ */
|
|
29999
|
+
/* @__PURE__ */ jsx86(ToolbarDivider, {}),
|
|
30000
|
+
/* @__PURE__ */ jsx86(ToolbarButton, { onClick: () => editor.chain().focus().undo().run(), disabled: !editor.can().undo(), title: t("toolbar.undo"), children: /* @__PURE__ */ jsx86(UndoIcon, { className: "w-4 h-4" }) }),
|
|
30001
|
+
/* @__PURE__ */ jsx86(ToolbarButton, { onClick: () => editor.chain().focus().redo().run(), disabled: !editor.can().redo(), title: t("toolbar.redo"), children: /* @__PURE__ */ jsx86(RedoIcon, { className: "w-4 h-4" }) }),
|
|
30002
|
+
hasTableContext && /* @__PURE__ */ jsxs72(Fragment28, { children: [
|
|
30003
|
+
/* @__PURE__ */ jsx86(ToolbarDivider, {}),
|
|
30004
|
+
/* @__PURE__ */ jsx86(
|
|
29774
30005
|
ToolbarButton,
|
|
29775
30006
|
{
|
|
29776
30007
|
onClick: () => editor.chain().focus().addColumnBefore().run(),
|
|
29777
30008
|
disabled: !editor.can().addColumnBefore(),
|
|
29778
30009
|
title: t("tableMenu.addColumnBefore"),
|
|
29779
|
-
children: /* @__PURE__ */
|
|
30010
|
+
children: /* @__PURE__ */ jsx86(ArrowLeft, { className: "w-4 h-4" })
|
|
29780
30011
|
}
|
|
29781
30012
|
),
|
|
29782
|
-
/* @__PURE__ */
|
|
30013
|
+
/* @__PURE__ */ jsx86(
|
|
29783
30014
|
ToolbarButton,
|
|
29784
30015
|
{
|
|
29785
30016
|
onClick: () => editor.chain().focus().addColumnAfter().run(),
|
|
29786
30017
|
disabled: !editor.can().addColumnAfter(),
|
|
29787
30018
|
title: t("tableMenu.addColumnAfter"),
|
|
29788
|
-
children: /* @__PURE__ */
|
|
30019
|
+
children: /* @__PURE__ */ jsx86(ArrowRight, { className: "w-4 h-4" })
|
|
29789
30020
|
}
|
|
29790
30021
|
),
|
|
29791
|
-
/* @__PURE__ */
|
|
30022
|
+
/* @__PURE__ */ jsx86(
|
|
29792
30023
|
ToolbarButton,
|
|
29793
30024
|
{
|
|
29794
30025
|
onClick: () => editor.chain().focus().addRowBefore().run(),
|
|
29795
30026
|
disabled: !editor.can().addRowBefore(),
|
|
29796
30027
|
title: t("tableMenu.addRowBefore"),
|
|
29797
|
-
children: /* @__PURE__ */
|
|
30028
|
+
children: /* @__PURE__ */ jsx86(ArrowUp, { className: "w-4 h-4" })
|
|
29798
30029
|
}
|
|
29799
30030
|
),
|
|
29800
|
-
/* @__PURE__ */
|
|
30031
|
+
/* @__PURE__ */ jsx86(
|
|
29801
30032
|
ToolbarButton,
|
|
29802
30033
|
{
|
|
29803
30034
|
onClick: () => editor.chain().focus().addRowAfter().run(),
|
|
29804
30035
|
disabled: !editor.can().addRowAfter(),
|
|
29805
30036
|
title: t("tableMenu.addRowAfter"),
|
|
29806
|
-
children: /* @__PURE__ */
|
|
30037
|
+
children: /* @__PURE__ */ jsx86(ArrowDown, { className: "w-4 h-4" })
|
|
29807
30038
|
}
|
|
29808
30039
|
),
|
|
29809
|
-
/* @__PURE__ */
|
|
30040
|
+
/* @__PURE__ */ jsx86(
|
|
29810
30041
|
ToolbarButton,
|
|
29811
30042
|
{
|
|
29812
30043
|
onClick: () => {
|
|
@@ -29819,7 +30050,7 @@ var EditorToolbar = ({
|
|
|
29819
30050
|
active: canSplitCell,
|
|
29820
30051
|
disabled: !canMergeCells && !canSplitCell,
|
|
29821
30052
|
title: canSplitCell ? t("tableMenu.splitCell") : t("tableMenu.mergeCells"),
|
|
29822
|
-
children: /* @__PURE__ */
|
|
30053
|
+
children: /* @__PURE__ */ jsx86(TableCellsMerge, { className: "w-4 h-4" })
|
|
29823
30054
|
}
|
|
29824
30055
|
)
|
|
29825
30056
|
] })
|
|
@@ -29852,7 +30083,7 @@ import {
|
|
|
29852
30083
|
Edit2,
|
|
29853
30084
|
Unlink,
|
|
29854
30085
|
ExternalLink as ExternalLink3,
|
|
29855
|
-
Sigma
|
|
30086
|
+
Sigma as Sigma2
|
|
29856
30087
|
} from "lucide-react";
|
|
29857
30088
|
|
|
29858
30089
|
// src/components/UEditor/table-formula-commands.ts
|
|
@@ -29930,6 +30161,20 @@ function getTableCellRangeLabels(range) {
|
|
|
29930
30161
|
function normalizeTableFormula(formula) {
|
|
29931
30162
|
return formula.trim().replace(/^=/, "").trim();
|
|
29932
30163
|
}
|
|
30164
|
+
function isDraftTableFormula(formula) {
|
|
30165
|
+
const normalized = normalizeTableFormula(formula);
|
|
30166
|
+
if (!normalized) return true;
|
|
30167
|
+
let depth = 0;
|
|
30168
|
+
for (const char of normalized) {
|
|
30169
|
+
if (char === "(") depth += 1;
|
|
30170
|
+
if (char === ")") depth -= 1;
|
|
30171
|
+
if (depth < 0) return false;
|
|
30172
|
+
}
|
|
30173
|
+
if (depth > 0) return true;
|
|
30174
|
+
if (/^[A-Z]+\(\s*\)$/i.test(normalized)) return true;
|
|
30175
|
+
if (/[+\-*/,(]\s*$/.test(normalized)) return true;
|
|
30176
|
+
return false;
|
|
30177
|
+
}
|
|
29933
30178
|
function formatFormulaError(error) {
|
|
29934
30179
|
return `#${error.toUpperCase()}`;
|
|
29935
30180
|
}
|
|
@@ -30302,6 +30547,20 @@ function safeFindCell2(map, relativePos) {
|
|
|
30302
30547
|
function getCellText(cellNode) {
|
|
30303
30548
|
return cellNode.textBetween(0, cellNode.content.size, "\n").trim();
|
|
30304
30549
|
}
|
|
30550
|
+
function getSelectionTableCellNode(editor) {
|
|
30551
|
+
const { $from } = editor.state.selection;
|
|
30552
|
+
for (let depth = $from.depth; depth > 0; depth -= 1) {
|
|
30553
|
+
const node = $from.node(depth);
|
|
30554
|
+
if (node.type.name === "tableCell" || node.type.name === "tableHeader") {
|
|
30555
|
+
return node;
|
|
30556
|
+
}
|
|
30557
|
+
}
|
|
30558
|
+
return null;
|
|
30559
|
+
}
|
|
30560
|
+
function isEditingTableFormulaText(editor) {
|
|
30561
|
+
const cellNode = getSelectionTableCellNode(editor);
|
|
30562
|
+
return Boolean(cellNode && getCellText(cellNode).startsWith("="));
|
|
30563
|
+
}
|
|
30305
30564
|
function createCellDisplayContent(cellNode, displayValue) {
|
|
30306
30565
|
const paragraphType = cellNode.type.schema.nodes.paragraph;
|
|
30307
30566
|
if (!paragraphType || !displayValue) {
|
|
@@ -30389,18 +30648,54 @@ function promoteFormulaTextInTableNode(tableNode) {
|
|
|
30389
30648
|
const cells = collectChildren2(rowInfo.node);
|
|
30390
30649
|
for (const entry of rowInfo.cells) {
|
|
30391
30650
|
const text = getCellText(entry.node);
|
|
30392
|
-
const
|
|
30393
|
-
|
|
30394
|
-
|
|
30395
|
-
{
|
|
30396
|
-
|
|
30397
|
-
|
|
30398
|
-
|
|
30399
|
-
|
|
30400
|
-
|
|
30401
|
-
|
|
30402
|
-
|
|
30403
|
-
|
|
30651
|
+
const existingFormula = typeof entry.node.attrs.formula === "string" ? entry.node.attrs.formula.trim() : "";
|
|
30652
|
+
const existingComputedValue = typeof entry.node.attrs.computedValue === "string" ? entry.node.attrs.computedValue.trim() : "";
|
|
30653
|
+
if (text.startsWith("=")) {
|
|
30654
|
+
if (!normalizeTableFormula(text)) {
|
|
30655
|
+
if (!existingFormula && !existingComputedValue) continue;
|
|
30656
|
+
cells[entry.index] = entry.node.type.create(
|
|
30657
|
+
{
|
|
30658
|
+
...entry.node.attrs,
|
|
30659
|
+
formula: null,
|
|
30660
|
+
computedValue: null
|
|
30661
|
+
},
|
|
30662
|
+
text === formatFormulaError("empty") ? createCellDisplayContent(entry.node, "") : entry.node.content,
|
|
30663
|
+
entry.node.marks
|
|
30664
|
+
);
|
|
30665
|
+
changed = true;
|
|
30666
|
+
continue;
|
|
30667
|
+
}
|
|
30668
|
+
if (isDraftTableFormula(text)) {
|
|
30669
|
+
continue;
|
|
30670
|
+
}
|
|
30671
|
+
const formula = normalizeFormulaInput(text);
|
|
30672
|
+
if (entry.node.attrs.formula === formula) continue;
|
|
30673
|
+
cells[entry.index] = entry.node.type.create(
|
|
30674
|
+
{
|
|
30675
|
+
...entry.node.attrs,
|
|
30676
|
+
formula,
|
|
30677
|
+
computedValue: null
|
|
30678
|
+
},
|
|
30679
|
+
entry.node.content,
|
|
30680
|
+
entry.node.marks
|
|
30681
|
+
);
|
|
30682
|
+
changed = true;
|
|
30683
|
+
continue;
|
|
30684
|
+
}
|
|
30685
|
+
if (existingFormula) {
|
|
30686
|
+
const isExistingEmptyFormula = !normalizeTableFormula(existingFormula);
|
|
30687
|
+
if (!isExistingEmptyFormula) continue;
|
|
30688
|
+
cells[entry.index] = entry.node.type.create(
|
|
30689
|
+
{
|
|
30690
|
+
...entry.node.attrs,
|
|
30691
|
+
formula: null,
|
|
30692
|
+
computedValue: null
|
|
30693
|
+
},
|
|
30694
|
+
isExistingEmptyFormula && text === formatFormulaError("empty") ? createCellDisplayContent(entry.node, "") : entry.node.content,
|
|
30695
|
+
entry.node.marks
|
|
30696
|
+
);
|
|
30697
|
+
changed = true;
|
|
30698
|
+
}
|
|
30404
30699
|
}
|
|
30405
30700
|
return rowInfo.node.type.create(rowInfo.node.attrs, cells);
|
|
30406
30701
|
});
|
|
@@ -30515,7 +30810,7 @@ function recalculateAllTableFormulas(editor) {
|
|
|
30515
30810
|
}
|
|
30516
30811
|
|
|
30517
30812
|
// src/components/UEditor/menus.tsx
|
|
30518
|
-
import { Fragment as Fragment29, jsx as
|
|
30813
|
+
import { Fragment as Fragment29, jsx as jsx87, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
30519
30814
|
function applyTableCellBackground(editor, color) {
|
|
30520
30815
|
const value = color || null;
|
|
30521
30816
|
const { state, view } = editor;
|
|
@@ -30604,7 +30899,7 @@ var BubbleMenuContent = ({
|
|
|
30604
30899
|
};
|
|
30605
30900
|
}, [editor, showLinkInput]);
|
|
30606
30901
|
if (showLinkInput) {
|
|
30607
|
-
return /* @__PURE__ */
|
|
30902
|
+
return /* @__PURE__ */ jsx87(
|
|
30608
30903
|
LinkInput,
|
|
30609
30904
|
{
|
|
30610
30905
|
initialUrl: editor.getAttributes("link").href || "",
|
|
@@ -30627,11 +30922,11 @@ var BubbleMenuContent = ({
|
|
|
30627
30922
|
const currentBorderStyle = editor.getAttributes("tableCell").borderStyle || editor.getAttributes("tableHeader").borderStyle || "solid";
|
|
30628
30923
|
const currentBorderWidth = editor.getAttributes("tableCell").borderWidth || editor.getAttributes("tableHeader").borderWidth || "1px";
|
|
30629
30924
|
const currentBorderColor = editor.getAttributes("tableCell").borderColor || editor.getAttributes("tableHeader").borderColor || "currentColor";
|
|
30630
|
-
return /* @__PURE__ */
|
|
30631
|
-
/* @__PURE__ */
|
|
30632
|
-
/* @__PURE__ */
|
|
30633
|
-
/* @__PURE__ */
|
|
30634
|
-
/* @__PURE__ */
|
|
30925
|
+
return /* @__PURE__ */ jsxs73("div", { className: "flex flex-col gap-2 p-2 w-56 text-sm", children: [
|
|
30926
|
+
/* @__PURE__ */ jsx87("div", { className: "font-semibold text-xs text-muted-foreground uppercase tracking-wider mb-1", children: t("tableMenu.cellBorder") || "Cell Borders" }),
|
|
30927
|
+
/* @__PURE__ */ jsxs73("div", { className: "flex flex-col gap-1", children: [
|
|
30928
|
+
/* @__PURE__ */ jsx87("label", { className: "text-xs text-muted-foreground", children: t("tableMenu.borderStyle") || "Border Style" }),
|
|
30929
|
+
/* @__PURE__ */ jsxs73(
|
|
30635
30930
|
"select",
|
|
30636
30931
|
{
|
|
30637
30932
|
className: "flex h-8 w-full rounded-md border border-input bg-background px-2 py-1 text-xs ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
@@ -30641,18 +30936,18 @@ var BubbleMenuContent = ({
|
|
|
30641
30936
|
editor.chain().focus().setCellAttribute("borderStyle", style).run();
|
|
30642
30937
|
},
|
|
30643
30938
|
children: [
|
|
30644
|
-
/* @__PURE__ */
|
|
30645
|
-
/* @__PURE__ */
|
|
30646
|
-
/* @__PURE__ */
|
|
30647
|
-
/* @__PURE__ */
|
|
30648
|
-
/* @__PURE__ */
|
|
30939
|
+
/* @__PURE__ */ jsx87("option", { value: "solid", children: "Solid" }),
|
|
30940
|
+
/* @__PURE__ */ jsx87("option", { value: "dashed", children: "Dashed" }),
|
|
30941
|
+
/* @__PURE__ */ jsx87("option", { value: "dotted", children: "Dotted" }),
|
|
30942
|
+
/* @__PURE__ */ jsx87("option", { value: "double", children: "Double" }),
|
|
30943
|
+
/* @__PURE__ */ jsx87("option", { value: "none", children: "None" })
|
|
30649
30944
|
]
|
|
30650
30945
|
}
|
|
30651
30946
|
)
|
|
30652
30947
|
] }),
|
|
30653
|
-
/* @__PURE__ */
|
|
30654
|
-
/* @__PURE__ */
|
|
30655
|
-
/* @__PURE__ */
|
|
30948
|
+
/* @__PURE__ */ jsxs73("div", { className: "flex flex-col gap-1", children: [
|
|
30949
|
+
/* @__PURE__ */ jsx87("label", { className: "text-xs text-muted-foreground", children: t("tableMenu.borderWidth") || "Border Width" }),
|
|
30950
|
+
/* @__PURE__ */ jsxs73(
|
|
30656
30951
|
"select",
|
|
30657
30952
|
{
|
|
30658
30953
|
className: "flex h-8 w-full rounded-md border border-input bg-background px-2 py-1 text-xs ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
@@ -30662,23 +30957,23 @@ var BubbleMenuContent = ({
|
|
|
30662
30957
|
editor.chain().focus().setCellAttribute("borderWidth", width).run();
|
|
30663
30958
|
},
|
|
30664
30959
|
children: [
|
|
30665
|
-
/* @__PURE__ */
|
|
30666
|
-
/* @__PURE__ */
|
|
30667
|
-
/* @__PURE__ */
|
|
30668
|
-
/* @__PURE__ */
|
|
30960
|
+
/* @__PURE__ */ jsx87("option", { value: "1px", children: "1px" }),
|
|
30961
|
+
/* @__PURE__ */ jsx87("option", { value: "2px", children: "2px" }),
|
|
30962
|
+
/* @__PURE__ */ jsx87("option", { value: "3px", children: "3px" }),
|
|
30963
|
+
/* @__PURE__ */ jsx87("option", { value: "4px", children: "4px" })
|
|
30669
30964
|
]
|
|
30670
30965
|
}
|
|
30671
30966
|
)
|
|
30672
30967
|
] }),
|
|
30673
|
-
/* @__PURE__ */
|
|
30968
|
+
/* @__PURE__ */ jsxs73(
|
|
30674
30969
|
"button",
|
|
30675
30970
|
{
|
|
30676
30971
|
type: "button",
|
|
30677
30972
|
onClick: () => setActiveColorPalette("cell-border-color"),
|
|
30678
30973
|
className: "flex items-center justify-between w-full h-8 px-2 rounded-md border border-input hover:bg-accent text-xs",
|
|
30679
30974
|
children: [
|
|
30680
|
-
/* @__PURE__ */
|
|
30681
|
-
/* @__PURE__ */
|
|
30975
|
+
/* @__PURE__ */ jsx87("span", { children: t("tableMenu.borderColor") || "Border Color" }),
|
|
30976
|
+
/* @__PURE__ */ jsx87(
|
|
30682
30977
|
"span",
|
|
30683
30978
|
{
|
|
30684
30979
|
className: "w-4 h-4 rounded-full border border-border",
|
|
@@ -30690,8 +30985,8 @@ var BubbleMenuContent = ({
|
|
|
30690
30985
|
]
|
|
30691
30986
|
}
|
|
30692
30987
|
),
|
|
30693
|
-
/* @__PURE__ */
|
|
30694
|
-
/* @__PURE__ */
|
|
30988
|
+
/* @__PURE__ */ jsxs73("div", { className: "flex items-center justify-between gap-2 mt-2 pt-2 border-t border-border", children: [
|
|
30989
|
+
/* @__PURE__ */ jsx87(
|
|
30695
30990
|
"button",
|
|
30696
30991
|
{
|
|
30697
30992
|
type: "button",
|
|
@@ -30703,7 +30998,7 @@ var BubbleMenuContent = ({
|
|
|
30703
30998
|
children: t("tableMenu.clearBorder") || "Clear Border"
|
|
30704
30999
|
}
|
|
30705
31000
|
),
|
|
30706
|
-
/* @__PURE__ */
|
|
31001
|
+
/* @__PURE__ */ jsx87(
|
|
30707
31002
|
"button",
|
|
30708
31003
|
{
|
|
30709
31004
|
type: "button",
|
|
@@ -30717,7 +31012,7 @@ var BubbleMenuContent = ({
|
|
|
30717
31012
|
}
|
|
30718
31013
|
if (activeColorPalette === "cell-border-color") {
|
|
30719
31014
|
const currentBorderColor = normalizeStyleValue(editor.getAttributes("tableCell").borderColor || editor.getAttributes("tableHeader").borderColor) || "";
|
|
30720
|
-
return /* @__PURE__ */
|
|
31015
|
+
return /* @__PURE__ */ jsx87("div", { className: "w-56", children: /* @__PURE__ */ jsx87(
|
|
30721
31016
|
EditorColorPalette,
|
|
30722
31017
|
{
|
|
30723
31018
|
colors: highlightColors,
|
|
@@ -30731,7 +31026,7 @@ var BubbleMenuContent = ({
|
|
|
30731
31026
|
}
|
|
30732
31027
|
) });
|
|
30733
31028
|
}
|
|
30734
|
-
return /* @__PURE__ */
|
|
31029
|
+
return /* @__PURE__ */ jsx87("div", { className: "w-56", children: /* @__PURE__ */ jsx87(
|
|
30735
31030
|
EditorColorPalette,
|
|
30736
31031
|
{
|
|
30737
31032
|
colors: isTextPalette ? textColors : highlightColors,
|
|
@@ -30759,32 +31054,32 @@ var BubbleMenuContent = ({
|
|
|
30759
31054
|
) });
|
|
30760
31055
|
}
|
|
30761
31056
|
if (isImageSelected) {
|
|
30762
|
-
return /* @__PURE__ */
|
|
30763
|
-
/* @__PURE__ */
|
|
30764
|
-
/* @__PURE__ */
|
|
30765
|
-
/* @__PURE__ */
|
|
30766
|
-
/* @__PURE__ */
|
|
30767
|
-
/* @__PURE__ */
|
|
30768
|
-
/* @__PURE__ */
|
|
30769
|
-
/* @__PURE__ */
|
|
30770
|
-
/* @__PURE__ */
|
|
30771
|
-
/* @__PURE__ */
|
|
30772
|
-
/* @__PURE__ */
|
|
31057
|
+
return /* @__PURE__ */ jsxs73("div", { className: "flex items-center gap-0.5 p-1", children: [
|
|
31058
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: () => applyImageLayout(editor, "block"), active: imageLayout === "block", title: t("toolbar.imageLayoutBlock"), children: /* @__PURE__ */ jsx87(AlignCenter2, { className: "w-4 h-4" }) }),
|
|
31059
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: () => applyImageLayout(editor, "left"), active: imageLayout === "left", title: t("toolbar.imageLayoutLeft"), children: /* @__PURE__ */ jsx87(AlignLeft2, { className: "w-4 h-4" }) }),
|
|
31060
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: () => applyImageLayout(editor, "right"), active: imageLayout === "right", title: t("toolbar.imageLayoutRight"), children: /* @__PURE__ */ jsx87(AlignRight2, { className: "w-4 h-4" }) }),
|
|
31061
|
+
/* @__PURE__ */ jsx87("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
31062
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: () => applyImageWidthPreset(editor, "sm"), active: imageWidthPreset === "sm", title: t("toolbar.imageWidthSm"), children: /* @__PURE__ */ jsx87("span", { className: "text-[10px] font-semibold", children: "S" }) }),
|
|
31063
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: () => applyImageWidthPreset(editor, "md"), active: imageWidthPreset === "md", title: t("toolbar.imageWidthMd"), children: /* @__PURE__ */ jsx87("span", { className: "text-[10px] font-semibold", children: "M" }) }),
|
|
31064
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: () => applyImageWidthPreset(editor, "lg"), active: imageWidthPreset === "lg", title: t("toolbar.imageWidthLg"), children: /* @__PURE__ */ jsx87("span", { className: "text-[10px] font-semibold", children: "L" }) }),
|
|
31065
|
+
/* @__PURE__ */ jsx87("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
31066
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: () => resetImageSize(editor), title: t("toolbar.imageResetSize"), children: /* @__PURE__ */ jsx87(RotateCcw3, { className: "w-4 h-4" }) }),
|
|
31067
|
+
/* @__PURE__ */ jsx87(
|
|
30773
31068
|
ToolbarButton,
|
|
30774
31069
|
{
|
|
30775
31070
|
onClick: () => deleteSelectedImage(editor),
|
|
30776
31071
|
title: t("toolbar.imageDelete"),
|
|
30777
31072
|
className: "text-destructive hover:text-destructive",
|
|
30778
|
-
children: /* @__PURE__ */
|
|
31073
|
+
children: /* @__PURE__ */ jsx87(Trash23, { className: "w-4 h-4" })
|
|
30779
31074
|
}
|
|
30780
31075
|
)
|
|
30781
31076
|
] });
|
|
30782
31077
|
}
|
|
30783
31078
|
if (showFormulaPanel && isInTable2) {
|
|
30784
|
-
return /* @__PURE__ */
|
|
30785
|
-
/* @__PURE__ */
|
|
30786
|
-
/* @__PURE__ */
|
|
30787
|
-
/* @__PURE__ */
|
|
31079
|
+
return /* @__PURE__ */ jsxs73("div", { className: "w-72 p-2", children: [
|
|
31080
|
+
/* @__PURE__ */ jsxs73("div", { className: "mb-2 flex items-center justify-between gap-2", children: [
|
|
31081
|
+
/* @__PURE__ */ jsx87("span", { className: "px-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: t("tableMenu.formula") || "Formula" }),
|
|
31082
|
+
/* @__PURE__ */ jsx87(
|
|
30788
31083
|
"button",
|
|
30789
31084
|
{
|
|
30790
31085
|
type: "button",
|
|
@@ -30797,7 +31092,7 @@ var BubbleMenuContent = ({
|
|
|
30797
31092
|
}
|
|
30798
31093
|
)
|
|
30799
31094
|
] }),
|
|
30800
|
-
/* @__PURE__ */
|
|
31095
|
+
/* @__PURE__ */ jsx87("div", { className: "flex h-9 items-center overflow-hidden rounded-md border border-border/60 bg-muted/40", children: /* @__PURE__ */ jsx87(
|
|
30801
31096
|
"input",
|
|
30802
31097
|
{
|
|
30803
31098
|
value: formulaDraft,
|
|
@@ -30818,15 +31113,15 @@ var BubbleMenuContent = ({
|
|
|
30818
31113
|
className: "h-full min-w-0 flex-1 bg-transparent px-2 text-sm font-medium text-foreground outline-none"
|
|
30819
31114
|
}
|
|
30820
31115
|
) }),
|
|
30821
|
-
/* @__PURE__ */
|
|
30822
|
-
/* @__PURE__ */
|
|
30823
|
-
/* @__PURE__ */
|
|
31116
|
+
/* @__PURE__ */ jsxs73("div", { className: "mt-2", children: [
|
|
31117
|
+
/* @__PURE__ */ jsx87("div", { className: "mb-1 px-1 text-[11px] font-medium text-muted-foreground", children: t("tableMenu.numberFormat") || "Number format" }),
|
|
31118
|
+
/* @__PURE__ */ jsx87("div", { className: "grid grid-cols-5 gap-1", children: [
|
|
30824
31119
|
["text", "Text"],
|
|
30825
31120
|
["number", "123"],
|
|
30826
31121
|
["currency", "$"],
|
|
30827
31122
|
["percent", "%"],
|
|
30828
31123
|
["date", "Date"]
|
|
30829
|
-
].map(([format, label]) => /* @__PURE__ */
|
|
31124
|
+
].map(([format, label]) => /* @__PURE__ */ jsx87(
|
|
30830
31125
|
"button",
|
|
30831
31126
|
{
|
|
30832
31127
|
type: "button",
|
|
@@ -30840,8 +31135,8 @@ var BubbleMenuContent = ({
|
|
|
30840
31135
|
format
|
|
30841
31136
|
)) })
|
|
30842
31137
|
] }),
|
|
30843
|
-
/* @__PURE__ */
|
|
30844
|
-
/* @__PURE__ */
|
|
31138
|
+
/* @__PURE__ */ jsxs73("div", { className: "mt-2 grid grid-cols-3 gap-1", children: [
|
|
31139
|
+
/* @__PURE__ */ jsx87(
|
|
30845
31140
|
"button",
|
|
30846
31141
|
{
|
|
30847
31142
|
type: "button",
|
|
@@ -30854,7 +31149,7 @@ var BubbleMenuContent = ({
|
|
|
30854
31149
|
children: t("tableMenu.apply") || "Apply"
|
|
30855
31150
|
}
|
|
30856
31151
|
),
|
|
30857
|
-
/* @__PURE__ */
|
|
31152
|
+
/* @__PURE__ */ jsx87(
|
|
30858
31153
|
"button",
|
|
30859
31154
|
{
|
|
30860
31155
|
type: "button",
|
|
@@ -30866,7 +31161,7 @@ var BubbleMenuContent = ({
|
|
|
30866
31161
|
children: t("tableMenu.clear") || "Clear"
|
|
30867
31162
|
}
|
|
30868
31163
|
),
|
|
30869
|
-
/* @__PURE__ */
|
|
31164
|
+
/* @__PURE__ */ jsx87(
|
|
30870
31165
|
"button",
|
|
30871
31166
|
{
|
|
30872
31167
|
type: "button",
|
|
@@ -30879,10 +31174,10 @@ var BubbleMenuContent = ({
|
|
|
30879
31174
|
] });
|
|
30880
31175
|
}
|
|
30881
31176
|
if (showTypographyPanel) {
|
|
30882
|
-
return /* @__PURE__ */
|
|
30883
|
-
/* @__PURE__ */
|
|
30884
|
-
/* @__PURE__ */
|
|
30885
|
-
/* @__PURE__ */
|
|
31177
|
+
return /* @__PURE__ */ jsxs73("div", { className: "w-72 p-2", children: [
|
|
31178
|
+
/* @__PURE__ */ jsxs73("div", { className: "mb-2 flex items-center justify-between gap-2", children: [
|
|
31179
|
+
/* @__PURE__ */ jsx87("span", { className: "px-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: t("toolbar.textStyle") }),
|
|
31180
|
+
/* @__PURE__ */ jsx87(
|
|
30886
31181
|
"button",
|
|
30887
31182
|
{
|
|
30888
31183
|
type: "button",
|
|
@@ -30892,11 +31187,11 @@ var BubbleMenuContent = ({
|
|
|
30892
31187
|
}
|
|
30893
31188
|
)
|
|
30894
31189
|
] }),
|
|
30895
|
-
/* @__PURE__ */
|
|
30896
|
-
/* @__PURE__ */
|
|
30897
|
-
/* @__PURE__ */
|
|
30898
|
-
/* @__PURE__ */
|
|
30899
|
-
/* @__PURE__ */
|
|
31190
|
+
/* @__PURE__ */ jsxs73("div", { className: "space-y-2", children: [
|
|
31191
|
+
/* @__PURE__ */ jsxs73("div", { children: [
|
|
31192
|
+
/* @__PURE__ */ jsx87("div", { className: "mb-1 px-1 text-[11px] font-medium text-muted-foreground", children: t("toolbar.fontSize") }),
|
|
31193
|
+
/* @__PURE__ */ jsxs73("div", { className: "flex h-9 items-center overflow-hidden rounded-md border border-border/60 bg-muted/40", children: [
|
|
31194
|
+
/* @__PURE__ */ jsx87(
|
|
30900
31195
|
"input",
|
|
30901
31196
|
{
|
|
30902
31197
|
type: "number",
|
|
@@ -30920,8 +31215,8 @@ var BubbleMenuContent = ({
|
|
|
30920
31215
|
className: "h-full min-w-0 flex-1 bg-transparent px-2 text-center text-sm font-semibold text-foreground outline-none [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"
|
|
30921
31216
|
}
|
|
30922
31217
|
),
|
|
30923
|
-
/* @__PURE__ */
|
|
30924
|
-
/* @__PURE__ */
|
|
31218
|
+
/* @__PURE__ */ jsx87("span", { className: "border-l border-border/50 px-2 text-[11px] text-muted-foreground", children: "px" }),
|
|
31219
|
+
/* @__PURE__ */ jsx87(
|
|
30925
31220
|
"button",
|
|
30926
31221
|
{
|
|
30927
31222
|
type: "button",
|
|
@@ -30931,12 +31226,12 @@ var BubbleMenuContent = ({
|
|
|
30931
31226
|
"flex h-full w-9 items-center justify-center border-l border-border/50 transition-colors hover:bg-muted",
|
|
30932
31227
|
showFontSizeOptions && "bg-primary/10 text-primary"
|
|
30933
31228
|
),
|
|
30934
|
-
children: /* @__PURE__ */
|
|
31229
|
+
children: /* @__PURE__ */ jsx87(ChevronDown9, { className: "h-4 w-4" })
|
|
30935
31230
|
}
|
|
30936
31231
|
)
|
|
30937
31232
|
] }),
|
|
30938
|
-
showFontSizeOptions && /* @__PURE__ */
|
|
30939
|
-
/* @__PURE__ */
|
|
31233
|
+
showFontSizeOptions && /* @__PURE__ */ jsxs73("div", { className: "mt-1 grid grid-cols-4 gap-1", children: [
|
|
31234
|
+
/* @__PURE__ */ jsx87(
|
|
30940
31235
|
"button",
|
|
30941
31236
|
{
|
|
30942
31237
|
type: "button",
|
|
@@ -30951,7 +31246,7 @@ var BubbleMenuContent = ({
|
|
|
30951
31246
|
children: "A"
|
|
30952
31247
|
}
|
|
30953
31248
|
),
|
|
30954
|
-
quickFontSizes.map((option) => /* @__PURE__ */
|
|
31249
|
+
quickFontSizes.map((option) => /* @__PURE__ */ jsx87(
|
|
30955
31250
|
"button",
|
|
30956
31251
|
{
|
|
30957
31252
|
type: "button",
|
|
@@ -30969,10 +31264,10 @@ var BubbleMenuContent = ({
|
|
|
30969
31264
|
))
|
|
30970
31265
|
] })
|
|
30971
31266
|
] }),
|
|
30972
|
-
/* @__PURE__ */
|
|
30973
|
-
/* @__PURE__ */
|
|
30974
|
-
/* @__PURE__ */
|
|
30975
|
-
/* @__PURE__ */
|
|
31267
|
+
/* @__PURE__ */ jsxs73("div", { children: [
|
|
31268
|
+
/* @__PURE__ */ jsx87("div", { className: "mb-1 px-1 text-[11px] font-medium text-muted-foreground", children: t("toolbar.lineHeight") }),
|
|
31269
|
+
/* @__PURE__ */ jsxs73("div", { className: "grid grid-cols-4 gap-1", children: [
|
|
31270
|
+
/* @__PURE__ */ jsx87(
|
|
30976
31271
|
"button",
|
|
30977
31272
|
{
|
|
30978
31273
|
type: "button",
|
|
@@ -30984,7 +31279,7 @@ var BubbleMenuContent = ({
|
|
|
30984
31279
|
children: "LH"
|
|
30985
31280
|
}
|
|
30986
31281
|
),
|
|
30987
|
-
quickLineHeights.map((option) => /* @__PURE__ */
|
|
31282
|
+
quickLineHeights.map((option) => /* @__PURE__ */ jsx87(
|
|
30988
31283
|
"button",
|
|
30989
31284
|
{
|
|
30990
31285
|
type: "button",
|
|
@@ -30999,8 +31294,8 @@ var BubbleMenuContent = ({
|
|
|
30999
31294
|
))
|
|
31000
31295
|
] })
|
|
31001
31296
|
] }),
|
|
31002
|
-
/* @__PURE__ */
|
|
31003
|
-
/* @__PURE__ */
|
|
31297
|
+
/* @__PURE__ */ jsxs73("div", { className: "grid grid-cols-2 gap-1 border-t border-border/40 pt-2", children: [
|
|
31298
|
+
/* @__PURE__ */ jsxs73(
|
|
31004
31299
|
"button",
|
|
31005
31300
|
{
|
|
31006
31301
|
type: "button",
|
|
@@ -31010,12 +31305,12 @@ var BubbleMenuContent = ({
|
|
|
31010
31305
|
editor.isActive("subscript") ? "bg-primary/10 text-primary" : "bg-muted/40 text-foreground"
|
|
31011
31306
|
),
|
|
31012
31307
|
children: [
|
|
31013
|
-
/* @__PURE__ */
|
|
31308
|
+
/* @__PURE__ */ jsx87(SubscriptIcon2, { className: "h-4 w-4" }),
|
|
31014
31309
|
t("toolbar.subscript")
|
|
31015
31310
|
]
|
|
31016
31311
|
}
|
|
31017
31312
|
),
|
|
31018
|
-
/* @__PURE__ */
|
|
31313
|
+
/* @__PURE__ */ jsxs73(
|
|
31019
31314
|
"button",
|
|
31020
31315
|
{
|
|
31021
31316
|
type: "button",
|
|
@@ -31025,7 +31320,7 @@ var BubbleMenuContent = ({
|
|
|
31025
31320
|
editor.isActive("superscript") ? "bg-primary/10 text-primary" : "bg-muted/40 text-foreground"
|
|
31026
31321
|
),
|
|
31027
31322
|
children: [
|
|
31028
|
-
/* @__PURE__ */
|
|
31323
|
+
/* @__PURE__ */ jsx87(SuperscriptIcon2, { className: "h-4 w-4" }),
|
|
31029
31324
|
t("toolbar.superscript")
|
|
31030
31325
|
]
|
|
31031
31326
|
}
|
|
@@ -31034,22 +31329,22 @@ var BubbleMenuContent = ({
|
|
|
31034
31329
|
] })
|
|
31035
31330
|
] });
|
|
31036
31331
|
}
|
|
31037
|
-
return /* @__PURE__ */
|
|
31038
|
-
/* @__PURE__ */
|
|
31039
|
-
/* @__PURE__ */
|
|
31040
|
-
/* @__PURE__ */
|
|
31332
|
+
return /* @__PURE__ */ jsxs73("div", { className: "flex items-center gap-0.5 p-1", children: [
|
|
31333
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ jsx87(BoldIcon2, { className: "w-4 h-4" }) }),
|
|
31334
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ jsx87(ItalicIcon2, { className: "w-4 h-4" }) }),
|
|
31335
|
+
/* @__PURE__ */ jsx87(
|
|
31041
31336
|
ToolbarButton,
|
|
31042
31337
|
{
|
|
31043
31338
|
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
31044
31339
|
active: editor.isActive("underline"),
|
|
31045
31340
|
title: t("toolbar.underline"),
|
|
31046
|
-
children: /* @__PURE__ */
|
|
31341
|
+
children: /* @__PURE__ */ jsx87(UnderlineIcon2, { className: "w-4 h-4" })
|
|
31047
31342
|
}
|
|
31048
31343
|
),
|
|
31049
|
-
/* @__PURE__ */
|
|
31050
|
-
/* @__PURE__ */
|
|
31051
|
-
/* @__PURE__ */
|
|
31052
|
-
/* @__PURE__ */
|
|
31344
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: () => editor.chain().focus().toggleStrike().run(), active: editor.isActive("strike"), title: t("toolbar.strike"), children: /* @__PURE__ */ jsx87(StrikethroughIcon2, { className: "w-4 h-4" }) }),
|
|
31345
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: () => editor.chain().focus().toggleCode().run(), active: editor.isActive("code"), title: t("toolbar.code"), children: /* @__PURE__ */ jsx87(CodeIcon2, { className: "w-4 h-4" }) }),
|
|
31346
|
+
/* @__PURE__ */ jsx87("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
31347
|
+
/* @__PURE__ */ jsx87(
|
|
31053
31348
|
ToolbarButton,
|
|
31054
31349
|
{
|
|
31055
31350
|
onMouseDown: () => {
|
|
@@ -31060,22 +31355,22 @@ var BubbleMenuContent = ({
|
|
|
31060
31355
|
},
|
|
31061
31356
|
active: editor.isActive("link"),
|
|
31062
31357
|
title: t("toolbar.link"),
|
|
31063
|
-
children: /* @__PURE__ */
|
|
31358
|
+
children: /* @__PURE__ */ jsx87(LinkIcon2, { className: "w-4 h-4" })
|
|
31064
31359
|
}
|
|
31065
31360
|
),
|
|
31066
|
-
/* @__PURE__ */
|
|
31067
|
-
/* @__PURE__ */
|
|
31068
|
-
isInTable2 && /* @__PURE__ */
|
|
31069
|
-
/* @__PURE__ */
|
|
31361
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: () => setActiveColorPalette("text"), title: t("colors.textColor"), children: /* @__PURE__ */ jsx87(TextColorIcon, { color: currentTextColor }) }),
|
|
31362
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: () => setActiveColorPalette("highlight"), active: editor.isActive("highlight"), title: t("colors.highlight"), children: /* @__PURE__ */ jsx87(HighlightColorIcon, { color: currentHighlightColor }) }),
|
|
31363
|
+
isInTable2 && /* @__PURE__ */ jsxs73(Fragment29, { children: [
|
|
31364
|
+
/* @__PURE__ */ jsx87(
|
|
31070
31365
|
ToolbarButton,
|
|
31071
31366
|
{
|
|
31072
31367
|
onClick: () => setActiveColorPalette("cell-bg"),
|
|
31073
31368
|
active: Boolean(currentCellBgColor),
|
|
31074
31369
|
title: t("tableMenu.cellBackground") || "Cell background",
|
|
31075
|
-
children: /* @__PURE__ */
|
|
31370
|
+
children: /* @__PURE__ */ jsx87(CellBgColorIcon, { color: currentCellBgColor })
|
|
31076
31371
|
}
|
|
31077
31372
|
),
|
|
31078
|
-
/* @__PURE__ */
|
|
31373
|
+
/* @__PURE__ */ jsx87(
|
|
31079
31374
|
ToolbarButton,
|
|
31080
31375
|
{
|
|
31081
31376
|
onClick: () => setActiveColorPalette("cell-border"),
|
|
@@ -31083,7 +31378,7 @@ var BubbleMenuContent = ({
|
|
|
31083
31378
|
editor.getAttributes("tableCell").borderColor || editor.getAttributes("tableHeader").borderColor || editor.getAttributes("tableCell").borderStyle || editor.getAttributes("tableHeader").borderStyle || editor.getAttributes("tableCell").borderWidth || editor.getAttributes("tableHeader").borderWidth
|
|
31084
31379
|
),
|
|
31085
31380
|
title: t("tableMenu.cellBorder") || "Cell border",
|
|
31086
|
-
children: /* @__PURE__ */
|
|
31381
|
+
children: /* @__PURE__ */ jsx87(
|
|
31087
31382
|
CellBorderIcon,
|
|
31088
31383
|
{
|
|
31089
31384
|
color: editor.getAttributes("tableCell").borderColor || editor.getAttributes("tableHeader").borderColor
|
|
@@ -31091,7 +31386,7 @@ var BubbleMenuContent = ({
|
|
|
31091
31386
|
)
|
|
31092
31387
|
}
|
|
31093
31388
|
),
|
|
31094
|
-
/* @__PURE__ */
|
|
31389
|
+
/* @__PURE__ */ jsx87(
|
|
31095
31390
|
ToolbarButton,
|
|
31096
31391
|
{
|
|
31097
31392
|
onMouseDown: () => {
|
|
@@ -31103,10 +31398,10 @@ var BubbleMenuContent = ({
|
|
|
31103
31398
|
},
|
|
31104
31399
|
active: Boolean(currentCellFormula),
|
|
31105
31400
|
title: t("tableMenu.formula") || "Formula",
|
|
31106
|
-
children: /* @__PURE__ */
|
|
31401
|
+
children: /* @__PURE__ */ jsx87(Sigma2, { className: "w-4 h-4" })
|
|
31107
31402
|
}
|
|
31108
31403
|
),
|
|
31109
|
-
/* @__PURE__ */
|
|
31404
|
+
/* @__PURE__ */ jsx87(
|
|
31110
31405
|
ToolbarButton,
|
|
31111
31406
|
{
|
|
31112
31407
|
onClick: () => {
|
|
@@ -31119,17 +31414,17 @@ var BubbleMenuContent = ({
|
|
|
31119
31414
|
active: canSplitCell,
|
|
31120
31415
|
disabled: !canMergeCells && !canSplitCell,
|
|
31121
31416
|
title: canSplitCell ? t("tableMenu.splitCell") || "Split cell" : t("tableMenu.mergeCells") || "Merge cells",
|
|
31122
|
-
children: /* @__PURE__ */
|
|
31417
|
+
children: /* @__PURE__ */ jsx87(TableCellsMerge2, { className: "w-4 h-4" })
|
|
31123
31418
|
}
|
|
31124
31419
|
)
|
|
31125
31420
|
] }),
|
|
31126
|
-
/* @__PURE__ */
|
|
31421
|
+
/* @__PURE__ */ jsx87(
|
|
31127
31422
|
ToolbarButton,
|
|
31128
31423
|
{
|
|
31129
31424
|
onClick: () => setShowTypographyPanel(true),
|
|
31130
31425
|
active: Boolean(currentFontSize || currentLineHeight || editor.isActive("subscript") || editor.isActive("superscript")),
|
|
31131
31426
|
title: t("toolbar.textStyle"),
|
|
31132
|
-
children: /* @__PURE__ */
|
|
31427
|
+
children: /* @__PURE__ */ jsx87(Type3, { className: "w-4 h-4" })
|
|
31133
31428
|
}
|
|
31134
31429
|
)
|
|
31135
31430
|
] });
|
|
@@ -31143,12 +31438,12 @@ var LinkPreviewContent = ({ editor, onEdit }) => {
|
|
|
31143
31438
|
const handleUnlink = () => {
|
|
31144
31439
|
editor.chain().focus().unsetLink().run();
|
|
31145
31440
|
};
|
|
31146
|
-
return /* @__PURE__ */
|
|
31147
|
-
/* @__PURE__ */
|
|
31148
|
-
/* @__PURE__ */
|
|
31149
|
-
/* @__PURE__ */
|
|
31150
|
-
/* @__PURE__ */
|
|
31151
|
-
/* @__PURE__ */
|
|
31441
|
+
return /* @__PURE__ */ jsxs73("div", { className: "flex items-center gap-1 p-1 max-w-sm", children: [
|
|
31442
|
+
/* @__PURE__ */ jsx87("span", { className: "text-xs text-muted-foreground font-mono px-2 truncate max-w-[180px]", children: url }),
|
|
31443
|
+
/* @__PURE__ */ jsx87("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
31444
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: handleOpen, title: t("linkPreview.open") || "Open link", children: /* @__PURE__ */ jsx87(ExternalLink3, { className: "w-4 h-4" }) }),
|
|
31445
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: onEdit, title: t("linkPreview.edit") || "Edit link", children: /* @__PURE__ */ jsx87(Edit2, { className: "w-4 h-4" }) }),
|
|
31446
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: handleUnlink, title: t("linkPreview.unlink") || "Remove link", className: "text-destructive hover:text-destructive", children: /* @__PURE__ */ jsx87(Unlink, { className: "w-4 h-4" }) })
|
|
31152
31447
|
] });
|
|
31153
31448
|
};
|
|
31154
31449
|
var CustomBubbleMenu = ({
|
|
@@ -31235,7 +31530,7 @@ var CustomBubbleMenu = ({
|
|
|
31235
31530
|
}, [editor]);
|
|
31236
31531
|
if (!isVisible) return null;
|
|
31237
31532
|
return createPortal8(
|
|
31238
|
-
/* @__PURE__ */
|
|
31533
|
+
/* @__PURE__ */ jsx87(
|
|
31239
31534
|
"div",
|
|
31240
31535
|
{
|
|
31241
31536
|
ref: menuRef,
|
|
@@ -31247,7 +31542,7 @@ var CustomBubbleMenu = ({
|
|
|
31247
31542
|
transform: "translate(-50%, -100%)"
|
|
31248
31543
|
},
|
|
31249
31544
|
onMouseDown: (e) => e.preventDefault(),
|
|
31250
|
-
children: editor.isActive("link") && !keepOpenRef.current ? /* @__PURE__ */
|
|
31545
|
+
children: editor.isActive("link") && !keepOpenRef.current ? /* @__PURE__ */ jsx87(LinkPreviewContent, { editor, onEdit: () => setKeepOpen(true) }) : /* @__PURE__ */ jsx87(
|
|
31251
31546
|
BubbleMenuContent,
|
|
31252
31547
|
{
|
|
31253
31548
|
editor,
|
|
@@ -31264,25 +31559,25 @@ var CustomBubbleMenu = ({
|
|
|
31264
31559
|
};
|
|
31265
31560
|
|
|
31266
31561
|
// src/components/UEditor/CharacterCount.tsx
|
|
31267
|
-
import { jsxs as
|
|
31562
|
+
import { jsxs as jsxs74 } from "react/jsx-runtime";
|
|
31268
31563
|
var CharacterCountDisplay = ({ editor, maxCharacters }) => {
|
|
31269
31564
|
const t = useSmartTranslations("UEditor");
|
|
31270
31565
|
const storage = editor.storage;
|
|
31271
31566
|
const characterCount = storage.characterCount?.characters?.() ?? 0;
|
|
31272
31567
|
const wordCount = storage.characterCount?.words?.() ?? 0;
|
|
31273
31568
|
const percentage = maxCharacters ? Math.round(characterCount / maxCharacters * 100) : 0;
|
|
31274
|
-
return /* @__PURE__ */
|
|
31275
|
-
/* @__PURE__ */
|
|
31569
|
+
return /* @__PURE__ */ jsxs74("div", { className: "flex items-center gap-3 px-3 py-2 text-xs text-muted-foreground border-t bg-muted/20", children: [
|
|
31570
|
+
/* @__PURE__ */ jsxs74("span", { children: [
|
|
31276
31571
|
wordCount,
|
|
31277
31572
|
" ",
|
|
31278
31573
|
t("words")
|
|
31279
31574
|
] }),
|
|
31280
|
-
/* @__PURE__ */
|
|
31575
|
+
/* @__PURE__ */ jsxs74("span", { children: [
|
|
31281
31576
|
characterCount,
|
|
31282
31577
|
" ",
|
|
31283
31578
|
t("characters")
|
|
31284
31579
|
] }),
|
|
31285
|
-
maxCharacters && /* @__PURE__ */
|
|
31580
|
+
maxCharacters && /* @__PURE__ */ jsxs74("span", { className: cn(percentage > 90 && "text-destructive", percentage > 100 && "font-bold"), children: [
|
|
31286
31581
|
characterCount,
|
|
31287
31582
|
"/",
|
|
31288
31583
|
maxCharacters
|
|
@@ -31703,7 +31998,7 @@ async function prepareUEditorContentForSave({
|
|
|
31703
31998
|
}
|
|
31704
31999
|
|
|
31705
32000
|
// src/components/UEditor/table-controls.tsx
|
|
31706
|
-
import
|
|
32001
|
+
import React79 from "react";
|
|
31707
32002
|
|
|
31708
32003
|
// node_modules/prosemirror-model/dist/index.js
|
|
31709
32004
|
function findDiffStart(a, b, pos) {
|
|
@@ -34720,7 +35015,7 @@ function createKey(name) {
|
|
|
34720
35015
|
keys[name] = 0;
|
|
34721
35016
|
return name + "$";
|
|
34722
35017
|
}
|
|
34723
|
-
var
|
|
35018
|
+
var PluginKey5 = class {
|
|
34724
35019
|
/**
|
|
34725
35020
|
Create a plugin key.
|
|
34726
35021
|
*/
|
|
@@ -35152,7 +35447,7 @@ function tableNodeTypes(schema) {
|
|
|
35152
35447
|
}
|
|
35153
35448
|
return result;
|
|
35154
35449
|
}
|
|
35155
|
-
var tableEditingKey = new
|
|
35450
|
+
var tableEditingKey = new PluginKey5("selectingCells");
|
|
35156
35451
|
function cellAround($pos) {
|
|
35157
35452
|
for (let d = $pos.depth - 1; d > 0; d--) if ($pos.node(d).type.spec.tableRole == "row") return $pos.node(0).resolve($pos.before(d + 1));
|
|
35158
35453
|
return null;
|
|
@@ -35383,7 +35678,7 @@ var CellBookmark = class CellBookmark2 {
|
|
|
35383
35678
|
else return Selection.near($headCell, 1);
|
|
35384
35679
|
}
|
|
35385
35680
|
};
|
|
35386
|
-
var fixTablesKey = new
|
|
35681
|
+
var fixTablesKey = new PluginKey5("fix-tables");
|
|
35387
35682
|
function convertTableNodeToArrayOfRows(tableNode) {
|
|
35388
35683
|
const map = TableMap3.get(tableNode);
|
|
35389
35684
|
const rows = [];
|
|
@@ -35861,7 +36156,7 @@ function atEndOfCell(view, axis, dir) {
|
|
|
35861
36156
|
}
|
|
35862
36157
|
return null;
|
|
35863
36158
|
}
|
|
35864
|
-
var columnResizingPluginKey = new
|
|
36159
|
+
var columnResizingPluginKey = new PluginKey5("tableColumnResizing");
|
|
35865
36160
|
|
|
35866
36161
|
// src/components/UEditor/table-controls.tsx
|
|
35867
36162
|
import {
|
|
@@ -36188,7 +36483,7 @@ function buildTableHoverState({
|
|
|
36188
36483
|
}
|
|
36189
36484
|
|
|
36190
36485
|
// src/components/UEditor/table-drag-preview.tsx
|
|
36191
|
-
import { Fragment as Fragment31, jsx as
|
|
36486
|
+
import { Fragment as Fragment31, jsx as jsx88, jsxs as jsxs75 } from "react/jsx-runtime";
|
|
36192
36487
|
function TableDragPreview({
|
|
36193
36488
|
columnDragLabel,
|
|
36194
36489
|
dragPreview,
|
|
@@ -36199,9 +36494,9 @@ function TableDragPreview({
|
|
|
36199
36494
|
const expandPreviewWidth = dragPreview.kind === "add-column" ? layout.tableWidth + dragPreview.previewCols * layout.avgColumnWidth : layout.tableWidth;
|
|
36200
36495
|
const expandPreviewHeight = dragPreview.kind === "add-row" ? layout.tableHeight + dragPreview.previewRows * layout.avgRowHeight : layout.tableHeight;
|
|
36201
36496
|
const dragStatusText = dragPreview.kind === "row" ? `${rowDragLabel} ${dragPreview.originIndex + 1} -> ${dragPreview.targetIndex + 1}` : dragPreview.kind === "column" ? `${columnDragLabel} ${dragPreview.originIndex + 1} -> ${dragPreview.targetIndex + 1}` : dragPreview.kind === "add-row" ? `+${dragPreview.previewRows}R` : `+${dragPreview.previewCols}C`;
|
|
36202
|
-
return /* @__PURE__ */
|
|
36203
|
-
dragPreview.kind === "row" && /* @__PURE__ */
|
|
36204
|
-
/* @__PURE__ */
|
|
36497
|
+
return /* @__PURE__ */ jsxs75(Fragment31, { children: [
|
|
36498
|
+
dragPreview.kind === "row" && /* @__PURE__ */ jsxs75(Fragment31, { children: [
|
|
36499
|
+
/* @__PURE__ */ jsx88(
|
|
36205
36500
|
"div",
|
|
36206
36501
|
{
|
|
36207
36502
|
"aria-hidden": "true",
|
|
@@ -36214,7 +36509,7 @@ function TableDragPreview({
|
|
|
36214
36509
|
}
|
|
36215
36510
|
}
|
|
36216
36511
|
),
|
|
36217
|
-
/* @__PURE__ */
|
|
36512
|
+
/* @__PURE__ */ jsx88(
|
|
36218
36513
|
"div",
|
|
36219
36514
|
{
|
|
36220
36515
|
"aria-hidden": "true",
|
|
@@ -36228,8 +36523,8 @@ function TableDragPreview({
|
|
|
36228
36523
|
}
|
|
36229
36524
|
)
|
|
36230
36525
|
] }),
|
|
36231
|
-
dragPreview.kind === "column" && /* @__PURE__ */
|
|
36232
|
-
/* @__PURE__ */
|
|
36526
|
+
dragPreview.kind === "column" && /* @__PURE__ */ jsxs75(Fragment31, { children: [
|
|
36527
|
+
/* @__PURE__ */ jsx88(
|
|
36233
36528
|
"div",
|
|
36234
36529
|
{
|
|
36235
36530
|
"aria-hidden": "true",
|
|
@@ -36242,7 +36537,7 @@ function TableDragPreview({
|
|
|
36242
36537
|
}
|
|
36243
36538
|
}
|
|
36244
36539
|
),
|
|
36245
|
-
/* @__PURE__ */
|
|
36540
|
+
/* @__PURE__ */ jsx88(
|
|
36246
36541
|
"div",
|
|
36247
36542
|
{
|
|
36248
36543
|
"aria-hidden": "true",
|
|
@@ -36256,7 +36551,7 @@ function TableDragPreview({
|
|
|
36256
36551
|
}
|
|
36257
36552
|
)
|
|
36258
36553
|
] }),
|
|
36259
|
-
(dragPreview.kind === "add-row" || dragPreview.kind === "add-column") && /* @__PURE__ */
|
|
36554
|
+
(dragPreview.kind === "add-row" || dragPreview.kind === "add-column") && /* @__PURE__ */ jsx88(
|
|
36260
36555
|
"div",
|
|
36261
36556
|
{
|
|
36262
36557
|
"aria-hidden": "true",
|
|
@@ -36269,7 +36564,7 @@ function TableDragPreview({
|
|
|
36269
36564
|
}
|
|
36270
36565
|
}
|
|
36271
36566
|
),
|
|
36272
|
-
/* @__PURE__ */
|
|
36567
|
+
/* @__PURE__ */ jsx88(
|
|
36273
36568
|
"div",
|
|
36274
36569
|
{
|
|
36275
36570
|
role: "status",
|
|
@@ -36285,7 +36580,7 @@ function TableDragPreview({
|
|
|
36285
36580
|
}
|
|
36286
36581
|
|
|
36287
36582
|
// src/components/UEditor/table-add-rails.tsx
|
|
36288
|
-
import { Fragment as Fragment32, jsx as
|
|
36583
|
+
import { Fragment as Fragment32, jsx as jsx89, jsxs as jsxs76 } from "react/jsx-runtime";
|
|
36289
36584
|
var ADD_COLUMN_RAIL_GAP = 4;
|
|
36290
36585
|
var ADD_ROW_RAIL_GAP = 4;
|
|
36291
36586
|
function TableAddRails({
|
|
@@ -36306,13 +36601,13 @@ function TableAddRails({
|
|
|
36306
36601
|
const rowRailLeft = visibleBounds.left;
|
|
36307
36602
|
const showColumnRail = controlsVisible || addColumnVisible;
|
|
36308
36603
|
const showRowRail = controlsVisible || addRowVisible;
|
|
36309
|
-
return /* @__PURE__ */
|
|
36310
|
-
/* @__PURE__ */
|
|
36604
|
+
return /* @__PURE__ */ jsxs76(Fragment32, { children: [
|
|
36605
|
+
/* @__PURE__ */ jsx89(
|
|
36311
36606
|
Tooltip,
|
|
36312
36607
|
{
|
|
36313
36608
|
placement: "right",
|
|
36314
|
-
content: /* @__PURE__ */
|
|
36315
|
-
children: /* @__PURE__ */
|
|
36609
|
+
content: /* @__PURE__ */ jsx89("span", { className: "text-xs font-medium", children: quickAddColumnLabel }),
|
|
36610
|
+
children: /* @__PURE__ */ jsx89(
|
|
36316
36611
|
"button",
|
|
36317
36612
|
{
|
|
36318
36613
|
type: "button",
|
|
@@ -36339,17 +36634,17 @@ function TableAddRails({
|
|
|
36339
36634
|
transform: showColumnRail ? "scale(1)" : "scale(0.92)",
|
|
36340
36635
|
pointerEvents: showColumnRail ? "auto" : "none"
|
|
36341
36636
|
},
|
|
36342
|
-
children: /* @__PURE__ */
|
|
36637
|
+
children: /* @__PURE__ */ jsx89("span", { className: "text-sm font-medium leading-none", children: "+" })
|
|
36343
36638
|
}
|
|
36344
36639
|
)
|
|
36345
36640
|
}
|
|
36346
36641
|
),
|
|
36347
|
-
/* @__PURE__ */
|
|
36642
|
+
/* @__PURE__ */ jsx89(
|
|
36348
36643
|
Tooltip,
|
|
36349
36644
|
{
|
|
36350
36645
|
placement: "bottom",
|
|
36351
|
-
content: /* @__PURE__ */
|
|
36352
|
-
children: /* @__PURE__ */
|
|
36646
|
+
content: /* @__PURE__ */ jsx89("span", { className: "text-xs font-medium", children: quickAddRowLabel }),
|
|
36647
|
+
children: /* @__PURE__ */ jsx89(
|
|
36353
36648
|
"button",
|
|
36354
36649
|
{
|
|
36355
36650
|
type: "button",
|
|
@@ -36376,7 +36671,7 @@ function TableAddRails({
|
|
|
36376
36671
|
transform: showRowRail ? "scale(1)" : "scale(0.92)",
|
|
36377
36672
|
pointerEvents: showRowRail ? "auto" : "none"
|
|
36378
36673
|
},
|
|
36379
|
-
children: /* @__PURE__ */
|
|
36674
|
+
children: /* @__PURE__ */ jsx89("span", { className: "text-sm font-medium leading-none", children: "+" })
|
|
36380
36675
|
}
|
|
36381
36676
|
)
|
|
36382
36677
|
}
|
|
@@ -36386,7 +36681,7 @@ function TableAddRails({
|
|
|
36386
36681
|
|
|
36387
36682
|
// src/components/UEditor/table-control-menu.tsx
|
|
36388
36683
|
import { MoreHorizontal as MoreHorizontal2 } from "lucide-react";
|
|
36389
|
-
import { jsx as
|
|
36684
|
+
import { jsx as jsx90 } from "react/jsx-runtime";
|
|
36390
36685
|
function TableControlMenu({
|
|
36391
36686
|
controlsVisible,
|
|
36392
36687
|
isOpen,
|
|
@@ -36398,7 +36693,7 @@ function TableControlMenu({
|
|
|
36398
36693
|
top
|
|
36399
36694
|
}) {
|
|
36400
36695
|
const shown = controlsVisible || menuVisible || isOpen;
|
|
36401
|
-
return /* @__PURE__ */
|
|
36696
|
+
return /* @__PURE__ */ jsx90(
|
|
36402
36697
|
"div",
|
|
36403
36698
|
{
|
|
36404
36699
|
className: "absolute z-30",
|
|
@@ -36407,13 +36702,13 @@ function TableControlMenu({
|
|
|
36407
36702
|
top,
|
|
36408
36703
|
left
|
|
36409
36704
|
},
|
|
36410
|
-
children: /* @__PURE__ */
|
|
36705
|
+
children: /* @__PURE__ */ jsx90(
|
|
36411
36706
|
Tooltip,
|
|
36412
36707
|
{
|
|
36413
36708
|
placement: "top",
|
|
36414
36709
|
disabled: isOpen,
|
|
36415
|
-
content: /* @__PURE__ */
|
|
36416
|
-
children: /* @__PURE__ */
|
|
36710
|
+
content: /* @__PURE__ */ jsx90("span", { className: "text-xs font-medium", children: label }),
|
|
36711
|
+
children: /* @__PURE__ */ jsx90("span", { className: "inline-flex", children: /* @__PURE__ */ jsx90(
|
|
36417
36712
|
DropdownMenu,
|
|
36418
36713
|
{
|
|
36419
36714
|
placement: "bottom-start",
|
|
@@ -36421,7 +36716,7 @@ function TableControlMenu({
|
|
|
36421
36716
|
onOpenChange,
|
|
36422
36717
|
contentClassName: "p-2",
|
|
36423
36718
|
items,
|
|
36424
|
-
trigger: /* @__PURE__ */
|
|
36719
|
+
trigger: /* @__PURE__ */ jsx90(
|
|
36425
36720
|
"button",
|
|
36426
36721
|
{
|
|
36427
36722
|
type: "button",
|
|
@@ -36437,7 +36732,7 @@ function TableControlMenu({
|
|
|
36437
36732
|
transform: shown ? "scale(1)" : "scale(0.82)",
|
|
36438
36733
|
pointerEvents: shown ? "auto" : "none"
|
|
36439
36734
|
},
|
|
36440
|
-
children: /* @__PURE__ */
|
|
36735
|
+
children: /* @__PURE__ */ jsx90(MoreHorizontal2, { className: "h-4 w-4" })
|
|
36441
36736
|
}
|
|
36442
36737
|
)
|
|
36443
36738
|
}
|
|
@@ -36450,7 +36745,7 @@ function TableControlMenu({
|
|
|
36450
36745
|
|
|
36451
36746
|
// src/components/UEditor/table-axis-handles.tsx
|
|
36452
36747
|
import { GripHorizontal, GripVertical as GripVertical3 } from "lucide-react";
|
|
36453
|
-
import { Fragment as Fragment33, jsx as
|
|
36748
|
+
import { Fragment as Fragment33, jsx as jsx91 } from "react/jsx-runtime";
|
|
36454
36749
|
var IDLE_HANDLE_SCALE = "0.78";
|
|
36455
36750
|
function TableRowHandles({
|
|
36456
36751
|
activeRowIndex,
|
|
@@ -36464,12 +36759,12 @@ function TableRowHandles({
|
|
|
36464
36759
|
rowHandleLeft,
|
|
36465
36760
|
rowHandles
|
|
36466
36761
|
}) {
|
|
36467
|
-
return /* @__PURE__ */
|
|
36762
|
+
return /* @__PURE__ */ jsx91(Fragment33, { children: rowHandles.map((rowHandle) => {
|
|
36468
36763
|
const menuKey = `row:${rowHandle.index}`;
|
|
36469
36764
|
const isActive = rowHandle.index === activeRowIndex;
|
|
36470
36765
|
const visible = controlsVisible || hoverRowHandleIndex === rowHandle.index || openMenuKey === menuKey;
|
|
36471
36766
|
const isShown = visible || isActive;
|
|
36472
|
-
return /* @__PURE__ */
|
|
36767
|
+
return /* @__PURE__ */ jsx91(
|
|
36473
36768
|
"div",
|
|
36474
36769
|
{
|
|
36475
36770
|
className: "absolute z-30",
|
|
@@ -36478,13 +36773,13 @@ function TableRowHandles({
|
|
|
36478
36773
|
top: Math.max(8, rowHandle.center - 12),
|
|
36479
36774
|
left: rowHandleLeft
|
|
36480
36775
|
},
|
|
36481
|
-
children: /* @__PURE__ */
|
|
36776
|
+
children: /* @__PURE__ */ jsx91(
|
|
36482
36777
|
Tooltip,
|
|
36483
36778
|
{
|
|
36484
36779
|
placement: "right",
|
|
36485
36780
|
disabled: openMenuKey === menuKey || !visible && isActive,
|
|
36486
|
-
content: /* @__PURE__ */
|
|
36487
|
-
children: /* @__PURE__ */
|
|
36781
|
+
content: /* @__PURE__ */ jsx91("span", { className: "text-xs font-medium", children: `${rowDragLabel} ${rowHandle.index + 1}` }),
|
|
36782
|
+
children: /* @__PURE__ */ jsx91("span", { className: "inline-flex", children: /* @__PURE__ */ jsx91(
|
|
36488
36783
|
DropdownMenu,
|
|
36489
36784
|
{
|
|
36490
36785
|
placement: "right",
|
|
@@ -36492,7 +36787,7 @@ function TableRowHandles({
|
|
|
36492
36787
|
onOpenChange: (open) => onOpenMenuChange(menuKey, open),
|
|
36493
36788
|
contentClassName: "p-2",
|
|
36494
36789
|
items: getMenuItems(rowHandle),
|
|
36495
|
-
trigger: /* @__PURE__ */
|
|
36790
|
+
trigger: /* @__PURE__ */ jsx91(
|
|
36496
36791
|
"button",
|
|
36497
36792
|
{
|
|
36498
36793
|
type: "button",
|
|
@@ -36511,7 +36806,7 @@ function TableRowHandles({
|
|
|
36511
36806
|
transform: isShown ? "scale(1)" : `scale(${IDLE_HANDLE_SCALE})`,
|
|
36512
36807
|
pointerEvents: isShown ? "auto" : "none"
|
|
36513
36808
|
},
|
|
36514
|
-
children: visible ? /* @__PURE__ */
|
|
36809
|
+
children: visible ? /* @__PURE__ */ jsx91(GripVertical3, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx91("div", { className: "h-3 w-1 rounded-full bg-muted-foreground/50 hover:bg-muted-foreground" })
|
|
36515
36810
|
}
|
|
36516
36811
|
)
|
|
36517
36812
|
}
|
|
@@ -36535,12 +36830,12 @@ function TableColumnHandles({
|
|
|
36535
36830
|
onStartDrag,
|
|
36536
36831
|
openMenuKey
|
|
36537
36832
|
}) {
|
|
36538
|
-
return /* @__PURE__ */
|
|
36833
|
+
return /* @__PURE__ */ jsx91(Fragment33, { children: columnHandles.map((columnHandle) => {
|
|
36539
36834
|
const menuKey = `column:${columnHandle.index}`;
|
|
36540
36835
|
const isActive = columnHandle.index === activeColumnIndex;
|
|
36541
36836
|
const visible = controlsVisible || hoverColumnHandleIndex === columnHandle.index || openMenuKey === menuKey;
|
|
36542
36837
|
const isShown = visible || isActive;
|
|
36543
|
-
return /* @__PURE__ */
|
|
36838
|
+
return /* @__PURE__ */ jsx91(
|
|
36544
36839
|
"div",
|
|
36545
36840
|
{
|
|
36546
36841
|
className: "absolute z-30",
|
|
@@ -36549,13 +36844,13 @@ function TableColumnHandles({
|
|
|
36549
36844
|
top: columnHandleTop,
|
|
36550
36845
|
left: Math.max(8, columnHandle.center - 12)
|
|
36551
36846
|
},
|
|
36552
|
-
children: /* @__PURE__ */
|
|
36847
|
+
children: /* @__PURE__ */ jsx91(
|
|
36553
36848
|
Tooltip,
|
|
36554
36849
|
{
|
|
36555
36850
|
placement: "top",
|
|
36556
36851
|
disabled: openMenuKey === menuKey || !visible && isActive,
|
|
36557
|
-
content: /* @__PURE__ */
|
|
36558
|
-
children: /* @__PURE__ */
|
|
36852
|
+
content: /* @__PURE__ */ jsx91("span", { className: "text-xs font-medium", children: `${columnDragLabel} ${columnHandle.index + 1}` }),
|
|
36853
|
+
children: /* @__PURE__ */ jsx91("span", { className: "inline-flex", children: /* @__PURE__ */ jsx91(
|
|
36559
36854
|
DropdownMenu,
|
|
36560
36855
|
{
|
|
36561
36856
|
placement: "bottom-start",
|
|
@@ -36563,7 +36858,7 @@ function TableColumnHandles({
|
|
|
36563
36858
|
onOpenChange: (open) => onOpenMenuChange(menuKey, open),
|
|
36564
36859
|
contentClassName: "p-2",
|
|
36565
36860
|
items: getMenuItems(columnHandle),
|
|
36566
|
-
trigger: /* @__PURE__ */
|
|
36861
|
+
trigger: /* @__PURE__ */ jsx91(
|
|
36567
36862
|
"button",
|
|
36568
36863
|
{
|
|
36569
36864
|
type: "button",
|
|
@@ -36582,7 +36877,7 @@ function TableColumnHandles({
|
|
|
36582
36877
|
transform: isShown ? "scale(1)" : `scale(${IDLE_HANDLE_SCALE})`,
|
|
36583
36878
|
pointerEvents: isShown ? "auto" : "none"
|
|
36584
36879
|
},
|
|
36585
|
-
children: visible ? /* @__PURE__ */
|
|
36880
|
+
children: visible ? /* @__PURE__ */ jsx91(GripHorizontal, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx91("div", { className: "h-1 w-3 rounded-full bg-muted-foreground/50 hover:bg-muted-foreground" })
|
|
36586
36881
|
}
|
|
36587
36882
|
)
|
|
36588
36883
|
}
|
|
@@ -36596,7 +36891,7 @@ function TableColumnHandles({
|
|
|
36596
36891
|
}
|
|
36597
36892
|
|
|
36598
36893
|
// src/components/UEditor/table-controls.tsx
|
|
36599
|
-
import { Fragment as Fragment34, jsx as
|
|
36894
|
+
import { Fragment as Fragment34, jsx as jsx92, jsxs as jsxs77 } from "react/jsx-runtime";
|
|
36600
36895
|
var TABLE_MENU_TOP_OFFSET = 10;
|
|
36601
36896
|
function nearestIndex(centers, position) {
|
|
36602
36897
|
let bestIndex = 0;
|
|
@@ -36622,17 +36917,17 @@ function getSelectedCell(editor) {
|
|
|
36622
36917
|
}
|
|
36623
36918
|
function TableControls({ editor, containerRef }) {
|
|
36624
36919
|
const t = useSmartTranslations("UEditor");
|
|
36625
|
-
const [layout, setLayout] =
|
|
36626
|
-
const [dragPreview, setDragPreview] =
|
|
36627
|
-
const [hoverState, setHoverState] =
|
|
36628
|
-
const [openMenuKey, setOpenMenuKey] =
|
|
36629
|
-
const layoutRef =
|
|
36630
|
-
const dragStateRef =
|
|
36631
|
-
const syncFrameRef =
|
|
36632
|
-
|
|
36920
|
+
const [layout, setLayout] = React79.useState(null);
|
|
36921
|
+
const [dragPreview, setDragPreview] = React79.useState(null);
|
|
36922
|
+
const [hoverState, setHoverState] = React79.useState(DEFAULT_TABLE_HOVER_STATE);
|
|
36923
|
+
const [openMenuKey, setOpenMenuKey] = React79.useState(null);
|
|
36924
|
+
const layoutRef = React79.useRef(null);
|
|
36925
|
+
const dragStateRef = React79.useRef(null);
|
|
36926
|
+
const syncFrameRef = React79.useRef(null);
|
|
36927
|
+
React79.useEffect(() => {
|
|
36633
36928
|
layoutRef.current = layout;
|
|
36634
36929
|
}, [layout]);
|
|
36635
|
-
const syncFromCell =
|
|
36930
|
+
const syncFromCell = React79.useCallback((cell) => {
|
|
36636
36931
|
const surface = containerRef.current;
|
|
36637
36932
|
if (!surface || !cell) {
|
|
36638
36933
|
setLayout(null);
|
|
@@ -36640,23 +36935,23 @@ function TableControls({ editor, containerRef }) {
|
|
|
36640
36935
|
}
|
|
36641
36936
|
setLayout(buildTableControlLayout(editor, surface, cell));
|
|
36642
36937
|
}, [containerRef, editor]);
|
|
36643
|
-
const syncFromSelection =
|
|
36938
|
+
const syncFromSelection = React79.useCallback(() => {
|
|
36644
36939
|
syncFromCell(getSelectedCell(editor));
|
|
36645
36940
|
}, [editor, syncFromCell]);
|
|
36646
|
-
const scheduleSyncFromSelection =
|
|
36941
|
+
const scheduleSyncFromSelection = React79.useCallback(() => {
|
|
36647
36942
|
if (syncFrameRef.current !== null) return;
|
|
36648
36943
|
syncFrameRef.current = window.requestAnimationFrame(() => {
|
|
36649
36944
|
syncFrameRef.current = null;
|
|
36650
36945
|
syncFromSelection();
|
|
36651
36946
|
});
|
|
36652
36947
|
}, [syncFromSelection]);
|
|
36653
|
-
|
|
36948
|
+
React79.useEffect(() => () => {
|
|
36654
36949
|
if (syncFrameRef.current !== null) {
|
|
36655
36950
|
window.cancelAnimationFrame(syncFrameRef.current);
|
|
36656
36951
|
syncFrameRef.current = null;
|
|
36657
36952
|
}
|
|
36658
36953
|
}, []);
|
|
36659
|
-
const refreshCurrentLayout =
|
|
36954
|
+
const refreshCurrentLayout = React79.useCallback(() => {
|
|
36660
36955
|
setLayout((prev) => {
|
|
36661
36956
|
if (!prev) return prev;
|
|
36662
36957
|
const surface = containerRef.current;
|
|
@@ -36666,12 +36961,12 @@ function TableControls({ editor, containerRef }) {
|
|
|
36666
36961
|
return cell ? buildTableControlLayout(editor, surface, cell) : null;
|
|
36667
36962
|
});
|
|
36668
36963
|
}, [containerRef, editor]);
|
|
36669
|
-
const clearDrag =
|
|
36964
|
+
const clearDrag = React79.useCallback(() => {
|
|
36670
36965
|
dragStateRef.current = null;
|
|
36671
36966
|
setDragPreview(null);
|
|
36672
36967
|
document.body.style.cursor = "";
|
|
36673
36968
|
}, []);
|
|
36674
|
-
const updateHoverState =
|
|
36969
|
+
const updateHoverState = React79.useCallback((event) => {
|
|
36675
36970
|
const activeLayout = layoutRef.current;
|
|
36676
36971
|
const surface = containerRef.current;
|
|
36677
36972
|
if (!activeLayout || !surface || dragStateRef.current) {
|
|
@@ -36687,7 +36982,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
36687
36982
|
return areTableHoverStatesEqual(prev, nextState) ? prev : nextState;
|
|
36688
36983
|
});
|
|
36689
36984
|
}, [containerRef]);
|
|
36690
|
-
|
|
36985
|
+
React79.useEffect(() => {
|
|
36691
36986
|
const proseMirror = editor.view.dom;
|
|
36692
36987
|
const surface = containerRef.current;
|
|
36693
36988
|
if (!surface) return void 0;
|
|
@@ -36738,37 +37033,37 @@ function TableControls({ editor, containerRef }) {
|
|
|
36738
37033
|
editor.off("update", refreshCurrentLayout);
|
|
36739
37034
|
};
|
|
36740
37035
|
}, [clearDrag, containerRef, editor, refreshCurrentLayout, syncFromCell, syncFromSelection, updateHoverState]);
|
|
36741
|
-
const runAtCellPos =
|
|
37036
|
+
const runAtCellPos = React79.useCallback((cellPos, command, options) => {
|
|
36742
37037
|
const result = runTableCommandAtCellPos(editor, cellPos, command);
|
|
36743
37038
|
if (options?.sync !== false) {
|
|
36744
37039
|
scheduleSyncFromSelection();
|
|
36745
37040
|
}
|
|
36746
37041
|
return result;
|
|
36747
37042
|
}, [editor, scheduleSyncFromSelection]);
|
|
36748
|
-
const runAtActiveCell =
|
|
37043
|
+
const runAtActiveCell = React79.useCallback((command, options) => {
|
|
36749
37044
|
return runAtCellPos(layoutRef.current?.cellPos ?? null, command, options);
|
|
36750
37045
|
}, [runAtCellPos]);
|
|
36751
|
-
const duplicateRowAt =
|
|
37046
|
+
const duplicateRowAt = React79.useCallback((rowIndex, cellPos) => {
|
|
36752
37047
|
const result = duplicateTableRowAt(editor, rowIndex, cellPos);
|
|
36753
37048
|
scheduleSyncFromSelection();
|
|
36754
37049
|
return result;
|
|
36755
37050
|
}, [editor, scheduleSyncFromSelection]);
|
|
36756
|
-
const clearRowAt =
|
|
37051
|
+
const clearRowAt = React79.useCallback((rowIndex, cellPos) => {
|
|
36757
37052
|
const result = clearTableRowAt(editor, rowIndex, cellPos);
|
|
36758
37053
|
scheduleSyncFromSelection();
|
|
36759
37054
|
return result;
|
|
36760
37055
|
}, [editor, scheduleSyncFromSelection]);
|
|
36761
|
-
const duplicateColumnAt =
|
|
37056
|
+
const duplicateColumnAt = React79.useCallback((columnIndex, cellPos) => {
|
|
36762
37057
|
const result = duplicateTableColumnAt(editor, columnIndex, cellPos);
|
|
36763
37058
|
scheduleSyncFromSelection();
|
|
36764
37059
|
return result;
|
|
36765
37060
|
}, [editor, scheduleSyncFromSelection]);
|
|
36766
|
-
const clearColumnAt =
|
|
37061
|
+
const clearColumnAt = React79.useCallback((columnIndex, cellPos) => {
|
|
36767
37062
|
const result = clearTableColumnAt(editor, columnIndex, cellPos);
|
|
36768
37063
|
scheduleSyncFromSelection();
|
|
36769
37064
|
return result;
|
|
36770
37065
|
}, [editor, scheduleSyncFromSelection]);
|
|
36771
|
-
const expandTableBy =
|
|
37066
|
+
const expandTableBy = React79.useCallback((rows, cols) => {
|
|
36772
37067
|
const activeCellPos = layoutRef.current?.cellPos ?? editor.state.selection.from;
|
|
36773
37068
|
const result = expandTableFromCell(editor, activeCellPos, rows, cols);
|
|
36774
37069
|
scheduleSyncFromSelection();
|
|
@@ -36777,19 +37072,19 @@ function TableControls({ editor, containerRef }) {
|
|
|
36777
37072
|
const canExpandTable = Boolean(layout);
|
|
36778
37073
|
const controlsVisible = dragPreview !== null;
|
|
36779
37074
|
const tableMenuOpen = openMenuKey === "table";
|
|
36780
|
-
const startAddColumnDrag =
|
|
37075
|
+
const startAddColumnDrag = React79.useCallback(() => {
|
|
36781
37076
|
setOpenMenuKey(null);
|
|
36782
37077
|
dragStateRef.current = { kind: "add-column", previewCols: 1 };
|
|
36783
37078
|
setDragPreview({ kind: "add-column", previewCols: 1 });
|
|
36784
37079
|
document.body.style.cursor = "ew-resize";
|
|
36785
37080
|
}, []);
|
|
36786
|
-
const startAddRowDrag =
|
|
37081
|
+
const startAddRowDrag = React79.useCallback(() => {
|
|
36787
37082
|
setOpenMenuKey(null);
|
|
36788
37083
|
dragStateRef.current = { kind: "add-row", previewRows: 1 };
|
|
36789
37084
|
setDragPreview({ kind: "add-row", previewRows: 1 });
|
|
36790
37085
|
document.body.style.cursor = "ns-resize";
|
|
36791
37086
|
}, []);
|
|
36792
|
-
const startRowDrag =
|
|
37087
|
+
const startRowDrag = React79.useCallback((rowHandle) => {
|
|
36793
37088
|
setOpenMenuKey(null);
|
|
36794
37089
|
dragStateRef.current = {
|
|
36795
37090
|
kind: "row",
|
|
@@ -36806,7 +37101,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
36806
37101
|
});
|
|
36807
37102
|
document.body.style.cursor = "grabbing";
|
|
36808
37103
|
}, []);
|
|
36809
|
-
const startColumnDrag =
|
|
37104
|
+
const startColumnDrag = React79.useCallback((columnHandle) => {
|
|
36810
37105
|
setOpenMenuKey(null);
|
|
36811
37106
|
dragStateRef.current = {
|
|
36812
37107
|
kind: "column",
|
|
@@ -36823,7 +37118,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
36823
37118
|
});
|
|
36824
37119
|
document.body.style.cursor = "grabbing";
|
|
36825
37120
|
}, []);
|
|
36826
|
-
|
|
37121
|
+
React79.useEffect(() => {
|
|
36827
37122
|
const handleMouseMove = (event) => {
|
|
36828
37123
|
const dragState = dragStateRef.current;
|
|
36829
37124
|
const activeLayout = layoutRef.current;
|
|
@@ -36912,7 +37207,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
36912
37207
|
window.removeEventListener("blur", clearDrag);
|
|
36913
37208
|
};
|
|
36914
37209
|
}, [clearDrag, containerRef, editor, expandTableBy, scheduleSyncFromSelection]);
|
|
36915
|
-
const menuItems =
|
|
37210
|
+
const menuItems = React79.useMemo(() => {
|
|
36916
37211
|
if (!layout) return [];
|
|
36917
37212
|
return [
|
|
36918
37213
|
{
|
|
@@ -36980,7 +37275,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
36980
37275
|
}
|
|
36981
37276
|
];
|
|
36982
37277
|
}, [layout, runAtActiveCell, t]);
|
|
36983
|
-
const getRowHandleMenuItems =
|
|
37278
|
+
const getRowHandleMenuItems = React79.useCallback((rowHandle) => [
|
|
36984
37279
|
{
|
|
36985
37280
|
label: t("tableMenu.addRowBefore"),
|
|
36986
37281
|
icon: ArrowUp2,
|
|
@@ -37008,7 +37303,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
37008
37303
|
destructive: true
|
|
37009
37304
|
}
|
|
37010
37305
|
], [clearRowAt, duplicateRowAt, runAtCellPos, t]);
|
|
37011
|
-
const getColumnHandleMenuItems =
|
|
37306
|
+
const getColumnHandleMenuItems = React79.useCallback((columnHandle) => [
|
|
37012
37307
|
{
|
|
37013
37308
|
label: t("tableMenu.addColumnBefore"),
|
|
37014
37309
|
icon: ArrowLeft2,
|
|
@@ -37043,8 +37338,8 @@ function TableControls({ editor, containerRef }) {
|
|
|
37043
37338
|
const menuLeft = Math.max(8, layout.tableLeft);
|
|
37044
37339
|
const rowHandleLeft = layout.tableLeft - 12;
|
|
37045
37340
|
const columnHandleTop = layout.tableTop - 12;
|
|
37046
|
-
return /* @__PURE__ */
|
|
37047
|
-
/* @__PURE__ */
|
|
37341
|
+
return /* @__PURE__ */ jsxs77(Fragment34, { children: [
|
|
37342
|
+
/* @__PURE__ */ jsx92(
|
|
37048
37343
|
TableRowHandles,
|
|
37049
37344
|
{
|
|
37050
37345
|
activeRowIndex: layout.activeRowIndex,
|
|
@@ -37061,7 +37356,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
37061
37356
|
rowHandles: layout.rowHandles
|
|
37062
37357
|
}
|
|
37063
37358
|
),
|
|
37064
|
-
/* @__PURE__ */
|
|
37359
|
+
/* @__PURE__ */ jsx92(
|
|
37065
37360
|
TableColumnHandles,
|
|
37066
37361
|
{
|
|
37067
37362
|
activeColumnIndex: layout.activeColumnIndex,
|
|
@@ -37078,7 +37373,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
37078
37373
|
openMenuKey
|
|
37079
37374
|
}
|
|
37080
37375
|
),
|
|
37081
|
-
/* @__PURE__ */
|
|
37376
|
+
/* @__PURE__ */ jsx92(
|
|
37082
37377
|
TableControlMenu,
|
|
37083
37378
|
{
|
|
37084
37379
|
controlsVisible,
|
|
@@ -37093,7 +37388,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
37093
37388
|
top: menuTop
|
|
37094
37389
|
}
|
|
37095
37390
|
),
|
|
37096
|
-
/* @__PURE__ */
|
|
37391
|
+
/* @__PURE__ */ jsx92(
|
|
37097
37392
|
TableAddRails,
|
|
37098
37393
|
{
|
|
37099
37394
|
addColumnVisible: hoverState.addColumnVisible,
|
|
@@ -37107,7 +37402,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
37107
37402
|
quickAddRowLabel: t("tableMenu.quickAddRowAfter")
|
|
37108
37403
|
}
|
|
37109
37404
|
),
|
|
37110
|
-
/* @__PURE__ */
|
|
37405
|
+
/* @__PURE__ */ jsx92(
|
|
37111
37406
|
TableDragPreview,
|
|
37112
37407
|
{
|
|
37113
37408
|
columnDragLabel: t("tableMenu.dragColumn"),
|
|
@@ -37278,10 +37573,10 @@ var UEDITOR_PROSEMIRROR_CLASS_NAME = cn(
|
|
|
37278
37573
|
);
|
|
37279
37574
|
|
|
37280
37575
|
// src/components/UEditor/use-table-interactions.ts
|
|
37281
|
-
import
|
|
37576
|
+
import React81, { useEffect as useEffect37, useRef as useRef35 } from "react";
|
|
37282
37577
|
|
|
37283
37578
|
// src/components/UEditor/use-table-row-resize.ts
|
|
37284
|
-
import
|
|
37579
|
+
import React80, { useRef as useRef34 } from "react";
|
|
37285
37580
|
function useTableRowResize({
|
|
37286
37581
|
editor,
|
|
37287
37582
|
setHoveredTableCell,
|
|
@@ -37292,7 +37587,7 @@ function useTableRowResize({
|
|
|
37292
37587
|
}) {
|
|
37293
37588
|
const commitFrameRef = useRef34(null);
|
|
37294
37589
|
const stateRef = useRef34(null);
|
|
37295
|
-
const commitPreview =
|
|
37590
|
+
const commitPreview = React80.useCallback(() => {
|
|
37296
37591
|
if (!editor) return;
|
|
37297
37592
|
const state = stateRef.current;
|
|
37298
37593
|
if (!state) return;
|
|
@@ -37327,22 +37622,22 @@ function useTableRowResize({
|
|
|
37327
37622
|
showRowGuide(state.tableElement, state.rowElement, state.cellElement);
|
|
37328
37623
|
scheduleTableLayoutSync();
|
|
37329
37624
|
}, [editor, scheduleTableLayoutSync, showRowGuide]);
|
|
37330
|
-
const scheduleCommit =
|
|
37625
|
+
const scheduleCommit = React80.useCallback(() => {
|
|
37331
37626
|
if (commitFrameRef.current !== null) return;
|
|
37332
37627
|
commitFrameRef.current = window.requestAnimationFrame(() => {
|
|
37333
37628
|
commitFrameRef.current = null;
|
|
37334
37629
|
commitPreview();
|
|
37335
37630
|
});
|
|
37336
37631
|
}, [commitPreview]);
|
|
37337
|
-
const syncActiveGuide =
|
|
37632
|
+
const syncActiveGuide = React80.useCallback(() => {
|
|
37338
37633
|
const state = stateRef.current;
|
|
37339
37634
|
if (!state) return false;
|
|
37340
37635
|
setHoveredTableCell(state.cellElement);
|
|
37341
37636
|
showRowGuide(state.tableElement, state.rowElement, state.cellElement);
|
|
37342
37637
|
return true;
|
|
37343
37638
|
}, [setHoveredTableCell, showRowGuide]);
|
|
37344
|
-
const isResizing =
|
|
37345
|
-
const beginResize =
|
|
37639
|
+
const isResizing = React80.useCallback(() => stateRef.current !== null, []);
|
|
37640
|
+
const beginResize = React80.useCallback((event, table, row, cell) => {
|
|
37346
37641
|
if (!editor || !isRowResizeHotspot(cell, event.clientX, event.clientY)) {
|
|
37347
37642
|
return false;
|
|
37348
37643
|
}
|
|
@@ -37368,7 +37663,7 @@ function useTableRowResize({
|
|
|
37368
37663
|
event.stopPropagation();
|
|
37369
37664
|
return true;
|
|
37370
37665
|
}, [editor, setHoveredTableCell, showRowGuide]);
|
|
37371
|
-
const handlePointerMove =
|
|
37666
|
+
const handlePointerMove = React80.useCallback((event) => {
|
|
37372
37667
|
const state = stateRef.current;
|
|
37373
37668
|
if (!state) return;
|
|
37374
37669
|
const nextHeight = Math.max(
|
|
@@ -37384,7 +37679,7 @@ function useTableRowResize({
|
|
|
37384
37679
|
document.body.style.cursor = "row-resize";
|
|
37385
37680
|
scheduleCommit();
|
|
37386
37681
|
}, [scheduleCommit, showRowGuide]);
|
|
37387
|
-
const handlePointerUp =
|
|
37682
|
+
const handlePointerUp = React80.useCallback((event) => {
|
|
37388
37683
|
if (!editor) return;
|
|
37389
37684
|
const state = stateRef.current;
|
|
37390
37685
|
if (!state) return;
|
|
@@ -37414,7 +37709,7 @@ function useTableRowResize({
|
|
|
37414
37709
|
clearAllTableResizeHover();
|
|
37415
37710
|
scheduleTableLayoutSync();
|
|
37416
37711
|
}, [clearAllTableResizeHover, clearHoveredTableCell, commitPreview, editor, scheduleTableLayoutSync]);
|
|
37417
|
-
const cancelResize =
|
|
37712
|
+
const cancelResize = React80.useCallback(() => {
|
|
37418
37713
|
if (!stateRef.current) return;
|
|
37419
37714
|
if (commitFrameRef.current !== null) {
|
|
37420
37715
|
window.cancelAnimationFrame(commitFrameRef.current);
|
|
@@ -37426,7 +37721,7 @@ function useTableRowResize({
|
|
|
37426
37721
|
clearAllTableResizeHover();
|
|
37427
37722
|
scheduleTableLayoutSync();
|
|
37428
37723
|
}, [clearAllTableResizeHover, clearHoveredTableCell, scheduleTableLayoutSync]);
|
|
37429
|
-
const cleanup =
|
|
37724
|
+
const cleanup = React80.useCallback(() => {
|
|
37430
37725
|
if (commitFrameRef.current !== null) {
|
|
37431
37726
|
window.cancelAnimationFrame(commitFrameRef.current);
|
|
37432
37727
|
commitFrameRef.current = null;
|
|
@@ -37455,16 +37750,16 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
37455
37750
|
const activeTableCellRef = useRef35(null);
|
|
37456
37751
|
const suppressActiveCellHighlightRef = useRef35(false);
|
|
37457
37752
|
const tableLayoutSyncFrameRef = useRef35(null);
|
|
37458
|
-
const getProseMirrorElement =
|
|
37753
|
+
const getProseMirrorElement = React81.useCallback(() => {
|
|
37459
37754
|
return editorContentRef.current?.querySelector(".ProseMirror");
|
|
37460
37755
|
}, []);
|
|
37461
|
-
const setEditorResizeCursor =
|
|
37756
|
+
const setEditorResizeCursor = React81.useCallback((cursor) => {
|
|
37462
37757
|
const proseMirror = getProseMirrorElement();
|
|
37463
37758
|
if (proseMirror) {
|
|
37464
37759
|
proseMirror.style.cursor = cursor;
|
|
37465
37760
|
}
|
|
37466
37761
|
}, [getProseMirrorElement]);
|
|
37467
|
-
const hideColumnGuide =
|
|
37762
|
+
const hideColumnGuide = React81.useCallback(() => {
|
|
37468
37763
|
editorContentRef.current?.classList.remove("resize-cursor");
|
|
37469
37764
|
getProseMirrorElement()?.classList.remove("resize-cursor");
|
|
37470
37765
|
const guide = tableColumnGuideRef.current;
|
|
@@ -37472,7 +37767,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
37472
37767
|
guide.style.opacity = "0";
|
|
37473
37768
|
}
|
|
37474
37769
|
}, [getProseMirrorElement]);
|
|
37475
|
-
const hideRowGuide =
|
|
37770
|
+
const hideRowGuide = React81.useCallback(() => {
|
|
37476
37771
|
editorContentRef.current?.classList.remove("resize-row-cursor");
|
|
37477
37772
|
getProseMirrorElement()?.classList.remove("resize-row-cursor");
|
|
37478
37773
|
const guide = tableRowGuideRef.current;
|
|
@@ -37480,12 +37775,12 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
37480
37775
|
guide.style.opacity = "0";
|
|
37481
37776
|
}
|
|
37482
37777
|
}, [getProseMirrorElement]);
|
|
37483
|
-
const clearAllTableResizeHover =
|
|
37778
|
+
const clearAllTableResizeHover = React81.useCallback(() => {
|
|
37484
37779
|
setEditorResizeCursor("");
|
|
37485
37780
|
hideColumnGuide();
|
|
37486
37781
|
hideRowGuide();
|
|
37487
37782
|
}, [hideColumnGuide, hideRowGuide, setEditorResizeCursor]);
|
|
37488
|
-
const updateActiveCellHighlight =
|
|
37783
|
+
const updateActiveCellHighlight = React81.useCallback((cell) => {
|
|
37489
37784
|
const surface = editorContentRef.current;
|
|
37490
37785
|
const highlight = activeTableCellHighlightRef.current;
|
|
37491
37786
|
if (!highlight) return;
|
|
@@ -37500,7 +37795,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
37500
37795
|
highlight.style.width = `${metrics.width}px`;
|
|
37501
37796
|
highlight.style.height = `${metrics.height}px`;
|
|
37502
37797
|
}, []);
|
|
37503
|
-
const scheduleTableLayoutSync =
|
|
37798
|
+
const scheduleTableLayoutSync = React81.useCallback(() => {
|
|
37504
37799
|
if (tableLayoutSyncFrameRef.current !== null) return;
|
|
37505
37800
|
tableLayoutSyncFrameRef.current = window.requestAnimationFrame(() => {
|
|
37506
37801
|
tableLayoutSyncFrameRef.current = null;
|
|
@@ -37508,7 +37803,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
37508
37803
|
editorContentRef.current?.dispatchEvent(new CustomEvent(UEDITOR_TABLE_LAYOUT_CHANGE_EVENT));
|
|
37509
37804
|
});
|
|
37510
37805
|
}, [updateActiveCellHighlight]);
|
|
37511
|
-
const setActiveTableCell =
|
|
37806
|
+
const setActiveTableCell = React81.useCallback((cell) => {
|
|
37512
37807
|
if (activeTableCellRef.current === cell) {
|
|
37513
37808
|
updateActiveCellHighlight(cell);
|
|
37514
37809
|
return;
|
|
@@ -37516,17 +37811,17 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
37516
37811
|
activeTableCellRef.current = cell;
|
|
37517
37812
|
updateActiveCellHighlight(activeTableCellRef.current);
|
|
37518
37813
|
}, [updateActiveCellHighlight]);
|
|
37519
|
-
const clearActiveTableCell =
|
|
37814
|
+
const clearActiveTableCell = React81.useCallback(() => {
|
|
37520
37815
|
activeTableCellRef.current = null;
|
|
37521
37816
|
updateActiveCellHighlight(null);
|
|
37522
37817
|
}, [updateActiveCellHighlight]);
|
|
37523
|
-
const setHoveredTableCell =
|
|
37818
|
+
const setHoveredTableCell = React81.useCallback((cell) => {
|
|
37524
37819
|
hoveredTableCellRef.current = cell;
|
|
37525
37820
|
}, []);
|
|
37526
|
-
const clearHoveredTableCell =
|
|
37821
|
+
const clearHoveredTableCell = React81.useCallback(() => {
|
|
37527
37822
|
hoveredTableCellRef.current = null;
|
|
37528
37823
|
}, []);
|
|
37529
|
-
const showColumnGuide =
|
|
37824
|
+
const showColumnGuide = React81.useCallback((table, row, cell) => {
|
|
37530
37825
|
const surface = editorContentRef.current;
|
|
37531
37826
|
const guide = tableColumnGuideRef.current;
|
|
37532
37827
|
if (!surface || !guide) return;
|
|
@@ -37540,7 +37835,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
37540
37835
|
getProseMirrorElement()?.classList.add("resize-cursor");
|
|
37541
37836
|
setEditorResizeCursor("col-resize");
|
|
37542
37837
|
}, [getProseMirrorElement, setEditorResizeCursor]);
|
|
37543
|
-
const showRowGuide =
|
|
37838
|
+
const showRowGuide = React81.useCallback((table, row, cell) => {
|
|
37544
37839
|
const surface = editorContentRef.current;
|
|
37545
37840
|
const guide = tableRowGuideRef.current;
|
|
37546
37841
|
if (!surface || !guide) return;
|
|
@@ -37570,7 +37865,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
37570
37865
|
clearAllTableResizeHover,
|
|
37571
37866
|
scheduleTableLayoutSync
|
|
37572
37867
|
});
|
|
37573
|
-
const syncActiveTableCellFromSelection =
|
|
37868
|
+
const syncActiveTableCellFromSelection = React81.useCallback(() => {
|
|
37574
37869
|
if (!editor) return;
|
|
37575
37870
|
if (!editor.isFocused) {
|
|
37576
37871
|
clearActiveTableCell();
|
|
@@ -37751,7 +38046,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
37751
38046
|
}
|
|
37752
38047
|
|
|
37753
38048
|
// src/components/UEditor/menu-bar.tsx
|
|
37754
|
-
import
|
|
38049
|
+
import React82, { useRef as useRef36, useState as useState49 } from "react";
|
|
37755
38050
|
import { useEditorState as useEditorState3 } from "@tiptap/react";
|
|
37756
38051
|
import {
|
|
37757
38052
|
AlignCenter as AlignCenter4,
|
|
@@ -37782,14 +38077,14 @@ import {
|
|
|
37782
38077
|
Undo as UndoIcon2,
|
|
37783
38078
|
Upload as Upload4
|
|
37784
38079
|
} from "lucide-react";
|
|
37785
|
-
import { Fragment as Fragment35, jsx as
|
|
38080
|
+
import { Fragment as Fragment35, jsx as jsx93, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
37786
38081
|
function MenuTableInsertGrid({
|
|
37787
38082
|
insertLabel,
|
|
37788
38083
|
previewTemplate,
|
|
37789
38084
|
onInsert
|
|
37790
38085
|
}) {
|
|
37791
38086
|
const closeMenu = useDropdownMenuClose();
|
|
37792
|
-
return /* @__PURE__ */
|
|
38087
|
+
return /* @__PURE__ */ jsx93(
|
|
37793
38088
|
TableInsertGrid,
|
|
37794
38089
|
{
|
|
37795
38090
|
insertLabel,
|
|
@@ -37805,9 +38100,9 @@ function renderMenuItems(items) {
|
|
|
37805
38100
|
return items.map((item, i) => {
|
|
37806
38101
|
switch (item.type) {
|
|
37807
38102
|
case "separator":
|
|
37808
|
-
return /* @__PURE__ */
|
|
38103
|
+
return /* @__PURE__ */ jsx93(DropdownMenuSeparator, {}, i);
|
|
37809
38104
|
case "action":
|
|
37810
|
-
return /* @__PURE__ */
|
|
38105
|
+
return /* @__PURE__ */ jsx93(
|
|
37811
38106
|
DropdownMenuItem,
|
|
37812
38107
|
{
|
|
37813
38108
|
label: item.label,
|
|
@@ -37821,9 +38116,9 @@ function renderMenuItems(items) {
|
|
|
37821
38116
|
i
|
|
37822
38117
|
);
|
|
37823
38118
|
case "sub":
|
|
37824
|
-
return /* @__PURE__ */
|
|
38119
|
+
return /* @__PURE__ */ jsx93(DropdownMenuSub, { label: item.label, icon: item.icon, disabled: item.disabled, children: renderMenuItems(item.items) }, i);
|
|
37825
38120
|
case "custom":
|
|
37826
|
-
return /* @__PURE__ */
|
|
38121
|
+
return /* @__PURE__ */ jsx93(React82.Fragment, { children: item.render() }, item.key);
|
|
37827
38122
|
}
|
|
37828
38123
|
});
|
|
37829
38124
|
}
|
|
@@ -38125,7 +38420,7 @@ function buildTableMenuItems(t, editor, onInsertTable) {
|
|
|
38125
38420
|
{
|
|
38126
38421
|
type: "custom",
|
|
38127
38422
|
key: "table-insert-grid",
|
|
38128
|
-
render: () => /* @__PURE__ */
|
|
38423
|
+
render: () => /* @__PURE__ */ jsx93(
|
|
38129
38424
|
MenuTableInsertGrid,
|
|
38130
38425
|
{
|
|
38131
38426
|
insertLabel: t("tableMenu.insertTable"),
|
|
@@ -38221,8 +38516,8 @@ function buildTableMenuItems(t, editor, onInsertTable) {
|
|
|
38221
38516
|
}
|
|
38222
38517
|
];
|
|
38223
38518
|
}
|
|
38224
|
-
var MenuBarTrigger =
|
|
38225
|
-
({ children, className, ...props }, ref) => /* @__PURE__ */
|
|
38519
|
+
var MenuBarTrigger = React82.forwardRef(
|
|
38520
|
+
({ children, className, ...props }, ref) => /* @__PURE__ */ jsx93(
|
|
38226
38521
|
"button",
|
|
38227
38522
|
{
|
|
38228
38523
|
ref,
|
|
@@ -38324,9 +38619,9 @@ var MenuBar = ({
|
|
|
38324
38619
|
{
|
|
38325
38620
|
type: "custom",
|
|
38326
38621
|
key: "image",
|
|
38327
|
-
render: () => showImageInput ? /* @__PURE__ */
|
|
38328
|
-
/* @__PURE__ */
|
|
38329
|
-
/* @__PURE__ */
|
|
38622
|
+
render: () => showImageInput ? /* @__PURE__ */ jsx93(ImageInput, { onSubmit: handleImageUrl, onCancel: () => setShowImageInput(false) }) : /* @__PURE__ */ jsxs78(Fragment35, { children: [
|
|
38623
|
+
/* @__PURE__ */ jsx93(DropdownMenuItem, { label: t("menubar.image"), icon: ImageIcon3, onClick: () => setShowImageInput(true), closeOnSelect: false }),
|
|
38624
|
+
/* @__PURE__ */ jsx93(
|
|
38330
38625
|
DropdownMenuItem,
|
|
38331
38626
|
{
|
|
38332
38627
|
label: t("menubar.imageUpload"),
|
|
@@ -38341,7 +38636,7 @@ var MenuBar = ({
|
|
|
38341
38636
|
{
|
|
38342
38637
|
type: "custom",
|
|
38343
38638
|
key: "link",
|
|
38344
|
-
render: () => showLinkInput ? /* @__PURE__ */
|
|
38639
|
+
render: () => showLinkInput ? /* @__PURE__ */ jsx93(LinkInput, { onSubmit: handleLinkSubmit, onCancel: () => setShowLinkInput(false), initialUrl: editor.getAttributes("link").href ?? "" }) : /* @__PURE__ */ jsx93(
|
|
38345
38640
|
DropdownMenuItem,
|
|
38346
38641
|
{
|
|
38347
38642
|
label: t("menubar.link"),
|
|
@@ -38361,7 +38656,7 @@ var MenuBar = ({
|
|
|
38361
38656
|
{
|
|
38362
38657
|
type: "custom",
|
|
38363
38658
|
key: "table-grid",
|
|
38364
|
-
render: () => /* @__PURE__ */
|
|
38659
|
+
render: () => /* @__PURE__ */ jsx93(
|
|
38365
38660
|
MenuTableInsertGrid,
|
|
38366
38661
|
{
|
|
38367
38662
|
insertLabel: t("tableMenu.insertTable"),
|
|
@@ -38414,8 +38709,8 @@ var MenuBar = ({
|
|
|
38414
38709
|
},
|
|
38415
38710
|
{ label: t("menubar.table"), items: buildTableMenuItems(t, editor, handleInsertTable), open: void 0, onOpenChange: void 0 }
|
|
38416
38711
|
];
|
|
38417
|
-
return /* @__PURE__ */
|
|
38418
|
-
/* @__PURE__ */
|
|
38712
|
+
return /* @__PURE__ */ jsxs78(Fragment35, { children: [
|
|
38713
|
+
/* @__PURE__ */ jsx93(
|
|
38419
38714
|
"input",
|
|
38420
38715
|
{
|
|
38421
38716
|
ref: fileInputRef,
|
|
@@ -38426,11 +38721,11 @@ var MenuBar = ({
|
|
|
38426
38721
|
onChange: (e) => handleImageFiles(e.target.files)
|
|
38427
38722
|
}
|
|
38428
38723
|
),
|
|
38429
|
-
/* @__PURE__ */
|
|
38430
|
-
menus.map(({ label, items, open, onOpenChange }) => /* @__PURE__ */
|
|
38724
|
+
/* @__PURE__ */ jsxs78("div", { className: "flex items-center gap-0.5 border-b border-border/35 bg-muted/20 px-1.5 py-0.5", children: [
|
|
38725
|
+
menus.map(({ label, items, open, onOpenChange }) => /* @__PURE__ */ jsx93(
|
|
38431
38726
|
DropdownMenu,
|
|
38432
38727
|
{
|
|
38433
|
-
trigger: /* @__PURE__ */
|
|
38728
|
+
trigger: /* @__PURE__ */ jsx93(MenuBarTrigger, { children: label }),
|
|
38434
38729
|
placement: "bottom-start",
|
|
38435
38730
|
isOpen: open,
|
|
38436
38731
|
onOpenChange,
|
|
@@ -38438,7 +38733,7 @@ var MenuBar = ({
|
|
|
38438
38733
|
},
|
|
38439
38734
|
label
|
|
38440
38735
|
)),
|
|
38441
|
-
/* @__PURE__ */
|
|
38736
|
+
/* @__PURE__ */ jsx93(
|
|
38442
38737
|
"button",
|
|
38443
38738
|
{
|
|
38444
38739
|
type: "button",
|
|
@@ -38449,20 +38744,20 @@ var MenuBar = ({
|
|
|
38449
38744
|
"ml-auto inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors",
|
|
38450
38745
|
"hover:bg-accent hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1"
|
|
38451
38746
|
),
|
|
38452
|
-
children: /* @__PURE__ */
|
|
38747
|
+
children: /* @__PURE__ */ jsx93(Eye3, { className: "h-4 w-4", "aria-hidden": "true" })
|
|
38453
38748
|
}
|
|
38454
38749
|
)
|
|
38455
38750
|
] }),
|
|
38456
|
-
/* @__PURE__ */
|
|
38751
|
+
/* @__PURE__ */ jsx93(
|
|
38457
38752
|
Modal_default,
|
|
38458
38753
|
{
|
|
38459
38754
|
isOpen: showSourceDialog,
|
|
38460
38755
|
onClose: () => setShowSourceDialog(false),
|
|
38461
38756
|
title: t("menubar.sourceCode"),
|
|
38462
38757
|
size: "lg",
|
|
38463
|
-
children: /* @__PURE__ */
|
|
38464
|
-
/* @__PURE__ */
|
|
38465
|
-
/* @__PURE__ */
|
|
38758
|
+
children: /* @__PURE__ */ jsxs78("div", { className: "space-y-3", children: [
|
|
38759
|
+
/* @__PURE__ */ jsx93("p", { className: "text-xs text-muted-foreground", children: t("menubar.sourceCodeHint") }),
|
|
38760
|
+
/* @__PURE__ */ jsx93(
|
|
38466
38761
|
"textarea",
|
|
38467
38762
|
{
|
|
38468
38763
|
"data-testid": "source-code-textarea",
|
|
@@ -38472,8 +38767,8 @@ var MenuBar = ({
|
|
|
38472
38767
|
spellCheck: false
|
|
38473
38768
|
}
|
|
38474
38769
|
),
|
|
38475
|
-
/* @__PURE__ */
|
|
38476
|
-
/* @__PURE__ */
|
|
38770
|
+
/* @__PURE__ */ jsxs78("div", { className: "flex gap-2 justify-end", children: [
|
|
38771
|
+
/* @__PURE__ */ jsx93(
|
|
38477
38772
|
"button",
|
|
38478
38773
|
{
|
|
38479
38774
|
type: "button",
|
|
@@ -38482,7 +38777,7 @@ var MenuBar = ({
|
|
|
38482
38777
|
children: t("menubar.applySource")
|
|
38483
38778
|
}
|
|
38484
38779
|
),
|
|
38485
|
-
/* @__PURE__ */
|
|
38780
|
+
/* @__PURE__ */ jsx93(
|
|
38486
38781
|
"button",
|
|
38487
38782
|
{
|
|
38488
38783
|
type: "button",
|
|
@@ -38495,7 +38790,7 @@ var MenuBar = ({
|
|
|
38495
38790
|
] })
|
|
38496
38791
|
}
|
|
38497
38792
|
),
|
|
38498
|
-
/* @__PURE__ */
|
|
38793
|
+
/* @__PURE__ */ jsx93(
|
|
38499
38794
|
Modal_default,
|
|
38500
38795
|
{
|
|
38501
38796
|
isOpen: showPreviewDialog,
|
|
@@ -38506,12 +38801,12 @@ var MenuBar = ({
|
|
|
38506
38801
|
height: "min(860px, calc(100vh - 2rem))",
|
|
38507
38802
|
className: "flex flex-col overflow-hidden rounded-xl md:rounded-2xl",
|
|
38508
38803
|
contentClassName: "flex min-h-0 flex-1 overflow-hidden p-0",
|
|
38509
|
-
children: /* @__PURE__ */
|
|
38804
|
+
children: /* @__PURE__ */ jsx93(
|
|
38510
38805
|
"div",
|
|
38511
38806
|
{
|
|
38512
38807
|
"data-testid": "preview-content",
|
|
38513
38808
|
className: "min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 py-4 md:px-8",
|
|
38514
|
-
children: editor.isEmpty ? /* @__PURE__ */
|
|
38809
|
+
children: editor.isEmpty ? /* @__PURE__ */ jsx93("p", { className: "text-muted-foreground text-sm", children: t("menubar.previewEmpty") }) : /* @__PURE__ */ jsx93(
|
|
38515
38810
|
"div",
|
|
38516
38811
|
{
|
|
38517
38812
|
className: UEDITOR_PROSEMIRROR_CLASS_NAME,
|
|
@@ -38526,8 +38821,8 @@ var MenuBar = ({
|
|
|
38526
38821
|
};
|
|
38527
38822
|
|
|
38528
38823
|
// src/components/UEditor/UEditor.tsx
|
|
38529
|
-
import { jsx as
|
|
38530
|
-
var UEditor =
|
|
38824
|
+
import { jsx as jsx94, jsxs as jsxs79 } from "react/jsx-runtime";
|
|
38825
|
+
var UEditor = React83.forwardRef(({
|
|
38531
38826
|
content = "",
|
|
38532
38827
|
onChange,
|
|
38533
38828
|
onHtmlChange,
|
|
@@ -38570,6 +38865,17 @@ var UEditor = React82.forwardRef(({
|
|
|
38570
38865
|
const inFlightPrepareRef = useRef37(null);
|
|
38571
38866
|
const lastAppliedContentRef = useRef37(content ?? "");
|
|
38572
38867
|
const scheduledFormulaRecalculateRef = useRef37(false);
|
|
38868
|
+
const scheduleFormulaRecalculate = React83.useCallback((editor2, options) => {
|
|
38869
|
+
if (editor2.isDestroyed || scheduledFormulaRecalculateRef.current) return;
|
|
38870
|
+
if (!options?.force && isEditingTableFormulaText(editor2)) return;
|
|
38871
|
+
scheduledFormulaRecalculateRef.current = true;
|
|
38872
|
+
queueMicrotask(() => {
|
|
38873
|
+
scheduledFormulaRecalculateRef.current = false;
|
|
38874
|
+
if (!editor2.isDestroyed && (options?.force || !isEditingTableFormulaText(editor2))) {
|
|
38875
|
+
recalculateAllTableFormulas(editor2);
|
|
38876
|
+
}
|
|
38877
|
+
});
|
|
38878
|
+
}, []);
|
|
38573
38879
|
const resolvedUploadFile = useMemo24(() => {
|
|
38574
38880
|
if (uploadFile) return uploadFile;
|
|
38575
38881
|
if (uploadFileForSave) {
|
|
@@ -38634,19 +38940,19 @@ var UEditor = React82.forwardRef(({
|
|
|
38634
38940
|
}
|
|
38635
38941
|
},
|
|
38636
38942
|
onUpdate: ({ editor: editor2, transaction }) => {
|
|
38637
|
-
if (!transaction.getMeta(UEDITOR_TABLE_FORMULA_RECALCULATE_META)
|
|
38638
|
-
|
|
38639
|
-
queueMicrotask(() => {
|
|
38640
|
-
scheduledFormulaRecalculateRef.current = false;
|
|
38641
|
-
if (!editor2.isDestroyed) {
|
|
38642
|
-
recalculateAllTableFormulas(editor2);
|
|
38643
|
-
}
|
|
38644
|
-
});
|
|
38943
|
+
if (!transaction.getMeta(UEDITOR_TABLE_FORMULA_RECALCULATE_META)) {
|
|
38944
|
+
scheduleFormulaRecalculate(editor2);
|
|
38645
38945
|
}
|
|
38646
38946
|
const html = editor2.getHTML();
|
|
38647
38947
|
onChange?.(html);
|
|
38648
38948
|
onHtmlChange?.(html);
|
|
38649
38949
|
onJsonChange?.(editor2.getJSON());
|
|
38950
|
+
},
|
|
38951
|
+
onSelectionUpdate: ({ editor: editor2 }) => {
|
|
38952
|
+
scheduleFormulaRecalculate(editor2);
|
|
38953
|
+
},
|
|
38954
|
+
onBlur: ({ editor: editor2 }) => {
|
|
38955
|
+
scheduleFormulaRecalculate(editor2, { force: true });
|
|
38650
38956
|
}
|
|
38651
38957
|
});
|
|
38652
38958
|
const {
|
|
@@ -38655,7 +38961,7 @@ var UEditor = React82.forwardRef(({
|
|
|
38655
38961
|
tableRowGuideRef,
|
|
38656
38962
|
activeTableCellHighlightRef
|
|
38657
38963
|
} = useUEditorTableInteractions(editor, editable);
|
|
38658
|
-
|
|
38964
|
+
useImperativeHandle4(
|
|
38659
38965
|
ref,
|
|
38660
38966
|
() => ({
|
|
38661
38967
|
editor,
|
|
@@ -38707,7 +39013,7 @@ var UEditor = React82.forwardRef(({
|
|
|
38707
39013
|
}
|
|
38708
39014
|
}, [content, editor]);
|
|
38709
39015
|
if (!editor) {
|
|
38710
|
-
return /* @__PURE__ */
|
|
39016
|
+
return /* @__PURE__ */ jsx94(
|
|
38711
39017
|
"div",
|
|
38712
39018
|
{
|
|
38713
39019
|
className: cn("w-full border bg-background flex items-center justify-center text-muted-foreground", className),
|
|
@@ -38716,7 +39022,7 @@ var UEditor = React82.forwardRef(({
|
|
|
38716
39022
|
}
|
|
38717
39023
|
);
|
|
38718
39024
|
}
|
|
38719
|
-
return /* @__PURE__ */
|
|
39025
|
+
return /* @__PURE__ */ jsxs79(
|
|
38720
39026
|
"div",
|
|
38721
39027
|
{
|
|
38722
39028
|
className: cn(
|
|
@@ -38731,7 +39037,7 @@ var UEditor = React82.forwardRef(({
|
|
|
38731
39037
|
className
|
|
38732
39038
|
),
|
|
38733
39039
|
children: [
|
|
38734
|
-
editable && showMenuBar && /* @__PURE__ */
|
|
39040
|
+
editable && showMenuBar && /* @__PURE__ */ jsx94(
|
|
38735
39041
|
MenuBar,
|
|
38736
39042
|
{
|
|
38737
39043
|
editor,
|
|
@@ -38746,7 +39052,7 @@ var UEditor = React82.forwardRef(({
|
|
|
38746
39052
|
onPreview
|
|
38747
39053
|
}
|
|
38748
39054
|
),
|
|
38749
|
-
editable && showToolbar && /* @__PURE__ */
|
|
39055
|
+
editable && showToolbar && /* @__PURE__ */ jsx94(
|
|
38750
39056
|
EditorToolbar,
|
|
38751
39057
|
{
|
|
38752
39058
|
editor,
|
|
@@ -38761,7 +39067,7 @@ var UEditor = React82.forwardRef(({
|
|
|
38761
39067
|
letterSpacings
|
|
38762
39068
|
}
|
|
38763
39069
|
),
|
|
38764
|
-
editable && showBubbleMenu && /* @__PURE__ */
|
|
39070
|
+
editable && showBubbleMenu && /* @__PURE__ */ jsx94(
|
|
38765
39071
|
CustomBubbleMenu,
|
|
38766
39072
|
{
|
|
38767
39073
|
editor,
|
|
@@ -38769,7 +39075,7 @@ var UEditor = React82.forwardRef(({
|
|
|
38769
39075
|
lineHeights
|
|
38770
39076
|
}
|
|
38771
39077
|
),
|
|
38772
|
-
/* @__PURE__ */
|
|
39078
|
+
/* @__PURE__ */ jsxs79(
|
|
38773
39079
|
"div",
|
|
38774
39080
|
{
|
|
38775
39081
|
ref: editorContentRef,
|
|
@@ -38779,7 +39085,7 @@ var UEditor = React82.forwardRef(({
|
|
|
38779
39085
|
maxHeight
|
|
38780
39086
|
},
|
|
38781
39087
|
children: [
|
|
38782
|
-
/* @__PURE__ */
|
|
39088
|
+
/* @__PURE__ */ jsx94(
|
|
38783
39089
|
"span",
|
|
38784
39090
|
{
|
|
38785
39091
|
ref: tableColumnGuideRef,
|
|
@@ -38787,7 +39093,7 @@ var UEditor = React82.forwardRef(({
|
|
|
38787
39093
|
className: "pointer-events-none absolute z-20 bg-primary opacity-0 transition-opacity duration-100"
|
|
38788
39094
|
}
|
|
38789
39095
|
),
|
|
38790
|
-
/* @__PURE__ */
|
|
39096
|
+
/* @__PURE__ */ jsx94(
|
|
38791
39097
|
"span",
|
|
38792
39098
|
{
|
|
38793
39099
|
ref: tableRowGuideRef,
|
|
@@ -38795,7 +39101,7 @@ var UEditor = React82.forwardRef(({
|
|
|
38795
39101
|
className: "pointer-events-none absolute z-20 bg-primary opacity-0 transition-opacity duration-100"
|
|
38796
39102
|
}
|
|
38797
39103
|
),
|
|
38798
|
-
/* @__PURE__ */
|
|
39104
|
+
/* @__PURE__ */ jsx94(
|
|
38799
39105
|
"span",
|
|
38800
39106
|
{
|
|
38801
39107
|
ref: activeTableCellHighlightRef,
|
|
@@ -38804,8 +39110,8 @@ var UEditor = React82.forwardRef(({
|
|
|
38804
39110
|
className: "pointer-events-none hidden absolute z-20 rounded-[2px] border-2 border-primary bg-primary/10"
|
|
38805
39111
|
}
|
|
38806
39112
|
),
|
|
38807
|
-
editable && /* @__PURE__ */
|
|
38808
|
-
/* @__PURE__ */
|
|
39113
|
+
editable && /* @__PURE__ */ jsx94(TableControls, { editor, containerRef: editorContentRef }),
|
|
39114
|
+
/* @__PURE__ */ jsx94(
|
|
38809
39115
|
EditorContent,
|
|
38810
39116
|
{
|
|
38811
39117
|
editor,
|
|
@@ -38815,7 +39121,7 @@ var UEditor = React82.forwardRef(({
|
|
|
38815
39121
|
]
|
|
38816
39122
|
}
|
|
38817
39123
|
),
|
|
38818
|
-
showCharacterCount && /* @__PURE__ */
|
|
39124
|
+
showCharacterCount && /* @__PURE__ */ jsx94(CharacterCountDisplay, { editor, maxCharacters })
|
|
38819
39125
|
]
|
|
38820
39126
|
}
|
|
38821
39127
|
);
|