@underverse-ui/underverse 1.0.153 → 1.0.154
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 +1009 -728
- 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 +805 -524
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -995,6 +995,15 @@ var en_default = {
|
|
|
995
995
|
noResults: "No emoji found",
|
|
996
996
|
showingCount: "Showing first {shown} of {total} emojis"
|
|
997
997
|
},
|
|
998
|
+
formulaSuggestion: {
|
|
999
|
+
title: "Functions",
|
|
1000
|
+
noResults: "No function found",
|
|
1001
|
+
sum: "Add values in a range",
|
|
1002
|
+
avg: "Average values in a range",
|
|
1003
|
+
min: "Smallest value in a range",
|
|
1004
|
+
max: "Largest value in a range",
|
|
1005
|
+
count: "Count numeric cells in a range"
|
|
1006
|
+
},
|
|
998
1007
|
tableMenu: {
|
|
999
1008
|
insert3x3: "Insert 3\xD73 Table",
|
|
1000
1009
|
insertTable: "Insert Table",
|
|
@@ -1378,6 +1387,15 @@ var vi_default = {
|
|
|
1378
1387
|
noResults: "Kh\xF4ng t\xECm th\u1EA5y emoji",
|
|
1379
1388
|
showingCount: "Hi\u1EC3n th\u1ECB {shown} trong t\u1ED5ng s\u1ED1 {total} emoji"
|
|
1380
1389
|
},
|
|
1390
|
+
formulaSuggestion: {
|
|
1391
|
+
title: "H\xE0m",
|
|
1392
|
+
noResults: "Kh\xF4ng t\xECm th\u1EA5y h\xE0m",
|
|
1393
|
+
sum: "C\u1ED9ng c\xE1c gi\xE1 tr\u1ECB trong v\xF9ng",
|
|
1394
|
+
avg: "T\xEDnh trung b\xECnh c\xE1c gi\xE1 tr\u1ECB trong v\xF9ng",
|
|
1395
|
+
min: "Gi\xE1 tr\u1ECB nh\u1ECF nh\u1EA5t trong v\xF9ng",
|
|
1396
|
+
max: "Gi\xE1 tr\u1ECB l\u1EDBn nh\u1EA5t trong v\xF9ng",
|
|
1397
|
+
count: "\u0110\u1EBFm c\xE1c \xF4 d\u1EA1ng s\u1ED1 trong v\xF9ng"
|
|
1398
|
+
},
|
|
1381
1399
|
tableMenu: {
|
|
1382
1400
|
insert3x3: "Ch\xE8n b\u1EA3ng 3\xD73",
|
|
1383
1401
|
insertTable: "Ch\xE8n b\u1EA3ng",
|
|
@@ -1722,6 +1740,7 @@ var ko_default = {
|
|
|
1722
1740
|
dividerDesc: "\uC2DC\uAC01\uC801 \uAD6C\uBD84\uC120",
|
|
1723
1741
|
table: "\uD45C",
|
|
1724
1742
|
tableDesc: "\uD45C \uCD94\uAC00",
|
|
1743
|
+
noResults: "\uC77C\uCE58\uD558\uB294 \uBE14\uB85D\uC774 \uC5C6\uC2B5\uB2C8\uB2E4",
|
|
1725
1744
|
callout: "\uCF5C\uC544\uC6C3",
|
|
1726
1745
|
calloutDesc: "\uC911\uC694\uD55C \uC815\uBCF4\uB97C \uCF5C\uC544\uC6C3 \uBE14\uB85D\uC73C\uB85C \uAC15\uC870\uD569\uB2C8\uB2E4",
|
|
1727
1746
|
bookmark: "\uBD81\uB9C8\uD06C \uCE74\uB4DC",
|
|
@@ -1760,6 +1779,15 @@ var ko_default = {
|
|
|
1760
1779
|
noResults: "\uC774\uBAA8\uC9C0\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4",
|
|
1761
1780
|
showingCount: "\uCD1D {total}\uAC1C \uC911 \uCC98\uC74C {shown}\uAC1C\uC758 \uC774\uBAA8\uC9C0\uB97C \uD45C\uC2DC \uC911"
|
|
1762
1781
|
},
|
|
1782
|
+
formulaSuggestion: {
|
|
1783
|
+
title: "\uD568\uC218",
|
|
1784
|
+
noResults: "\uD568\uC218\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4",
|
|
1785
|
+
sum: "\uBC94\uC704\uC758 \uAC12\uC744 \uD569\uC0B0",
|
|
1786
|
+
avg: "\uBC94\uC704\uC758 \uAC12 \uD3C9\uADE0",
|
|
1787
|
+
min: "\uBC94\uC704\uC758 \uCD5C\uC19F\uAC12",
|
|
1788
|
+
max: "\uBC94\uC704\uC758 \uCD5C\uB313\uAC12",
|
|
1789
|
+
count: "\uBC94\uC704\uC758 \uC22B\uC790 \uC140 \uAC1C\uC218"
|
|
1790
|
+
},
|
|
1763
1791
|
tableMenu: {
|
|
1764
1792
|
insert3x3: "3x3 \uD45C \uC0BD\uC785",
|
|
1765
1793
|
insertTable: "\uD45C \uC0BD\uC785",
|
|
@@ -1794,6 +1822,13 @@ var ko_default = {
|
|
|
1794
1822
|
borderWidth: "\uD14C\uB450\uB9AC \uB450\uAED8",
|
|
1795
1823
|
borderColor: "\uD14C\uB450\uB9AC \uC0C9\uC0C1",
|
|
1796
1824
|
clearBorder: "\uD14C\uB450\uB9AC \uC9C0\uC6B0\uAE30",
|
|
1825
|
+
formula: "\uC218\uC2DD",
|
|
1826
|
+
numberFormat: "\uD45C\uC2DC \uD615\uC2DD",
|
|
1827
|
+
formatText: "\uD14D\uC2A4\uD2B8",
|
|
1828
|
+
formatDate: "\uB0A0\uC9DC",
|
|
1829
|
+
apply: "\uC801\uC6A9",
|
|
1830
|
+
clear: "\uC9C0\uC6B0\uAE30",
|
|
1831
|
+
recalculate: "\uB2E4\uC2DC \uACC4\uC0B0",
|
|
1797
1832
|
done: "\uC644\uB8CC"
|
|
1798
1833
|
},
|
|
1799
1834
|
callout: {
|
|
@@ -2097,6 +2132,7 @@ var ja_default = {
|
|
|
2097
2132
|
dividerDesc: "\u8996\u899A\u7684\u306A\u533A\u5207\u308A\u7DDA",
|
|
2098
2133
|
table: "\u8868",
|
|
2099
2134
|
tableDesc: "\u8868\u3092\u8FFD\u52A0",
|
|
2135
|
+
noResults: "\u4E00\u81F4\u3059\u308B\u30D6\u30ED\u30C3\u30AF\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093",
|
|
2100
2136
|
callout: "\u30B3\u30FC\u30EB\u30A2\u30A6\u30C8",
|
|
2101
2137
|
calloutDesc: "\u91CD\u8981\u306A\u60C5\u5831\u3092\u30B3\u30FC\u30EB\u30A2\u30A6\u30C8\u30D6\u30ED\u30C3\u30AF\u3067\u5F37\u8ABF\u3057\u307E\u3059",
|
|
2102
2138
|
bookmark: "\u30D6\u30C3\u30AF\u30DE\u30FC\u30AF\u30AB\u30FC\u30C9",
|
|
@@ -2135,6 +2171,15 @@ var ja_default = {
|
|
|
2135
2171
|
noResults: "\u7D75\u6587\u5B57\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093",
|
|
2136
2172
|
showingCount: "{total} \u4EF6\u4E2D {shown} \u4EF6\u306E\u7D75\u6587\u5B57\u3092\u8868\u793A\u4E2D"
|
|
2137
2173
|
},
|
|
2174
|
+
formulaSuggestion: {
|
|
2175
|
+
title: "\u95A2\u6570",
|
|
2176
|
+
noResults: "\u95A2\u6570\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093",
|
|
2177
|
+
sum: "\u7BC4\u56F2\u5185\u306E\u5024\u3092\u5408\u8A08",
|
|
2178
|
+
avg: "\u7BC4\u56F2\u5185\u306E\u5024\u306E\u5E73\u5747",
|
|
2179
|
+
min: "\u7BC4\u56F2\u5185\u306E\u6700\u5C0F\u5024",
|
|
2180
|
+
max: "\u7BC4\u56F2\u5185\u306E\u6700\u5927\u5024",
|
|
2181
|
+
count: "\u7BC4\u56F2\u5185\u306E\u6570\u5024\u30BB\u30EB\u3092\u30AB\u30A6\u30F3\u30C8"
|
|
2182
|
+
},
|
|
2138
2183
|
tableMenu: {
|
|
2139
2184
|
insert3x3: "3x3 \u8868\u3092\u633F\u5165",
|
|
2140
2185
|
insertTable: "\u8868\u3092\u633F\u5165",
|
|
@@ -2169,6 +2214,13 @@ var ja_default = {
|
|
|
2169
2214
|
borderWidth: "\u67A0\u7DDA\u306E\u592A\u3055",
|
|
2170
2215
|
borderColor: "\u67A0\u7DDA\u306E\u8272",
|
|
2171
2216
|
clearBorder: "\u67A0\u7DDA\u3092\u30AF\u30EA\u30A2",
|
|
2217
|
+
formula: "\u6570\u5F0F",
|
|
2218
|
+
numberFormat: "\u8868\u793A\u5F62\u5F0F",
|
|
2219
|
+
formatText: "\u30C6\u30AD\u30B9\u30C8",
|
|
2220
|
+
formatDate: "\u65E5\u4ED8",
|
|
2221
|
+
apply: "\u9069\u7528",
|
|
2222
|
+
clear: "\u30AF\u30EA\u30A2",
|
|
2223
|
+
recalculate: "\u518D\u8A08\u7B97",
|
|
2172
2224
|
done: "\u5B8C\u4E86"
|
|
2173
2225
|
},
|
|
2174
2226
|
callout: {
|
|
@@ -24813,11 +24865,11 @@ function useLocale2() {
|
|
|
24813
24865
|
}
|
|
24814
24866
|
|
|
24815
24867
|
// src/components/UEditor/UEditor.tsx
|
|
24816
|
-
var
|
|
24817
|
-
var
|
|
24868
|
+
var import_react71 = __toESM(require("react"), 1);
|
|
24869
|
+
var import_react72 = require("@tiptap/react");
|
|
24818
24870
|
|
|
24819
24871
|
// src/components/UEditor/extensions.ts
|
|
24820
|
-
var
|
|
24872
|
+
var import_core14 = require("@tiptap/core");
|
|
24821
24873
|
var import_extension_document = __toESM(require("@tiptap/extension-document"), 1);
|
|
24822
24874
|
var import_extension_paragraph = __toESM(require("@tiptap/extension-paragraph"), 1);
|
|
24823
24875
|
var import_extension_text = __toESM(require("@tiptap/extension-text"), 1);
|
|
@@ -24833,8 +24885,8 @@ var import_extension_task_list = __toESM(require("@tiptap/extension-task-list"),
|
|
|
24833
24885
|
var import_extension_task_item = __toESM(require("@tiptap/extension-task-item"), 1);
|
|
24834
24886
|
var import_extension_blockquote = __toESM(require("@tiptap/extension-blockquote"), 1);
|
|
24835
24887
|
var import_extension_code = __toESM(require("@tiptap/extension-code"), 1);
|
|
24836
|
-
var
|
|
24837
|
-
var
|
|
24888
|
+
var import_core15 = require("@tiptap/core");
|
|
24889
|
+
var import_react59 = require("@tiptap/react");
|
|
24838
24890
|
|
|
24839
24891
|
// src/components/UEditor/callout.ts
|
|
24840
24892
|
var import_core = require("@tiptap/core");
|
|
@@ -26864,11 +26916,189 @@ var EmojiSuggestion = import_core6.Extension.create({
|
|
|
26864
26916
|
}
|
|
26865
26917
|
});
|
|
26866
26918
|
|
|
26867
|
-
// src/components/UEditor/
|
|
26919
|
+
// src/components/UEditor/formula-suggestion.tsx
|
|
26868
26920
|
var import_core7 = require("@tiptap/core");
|
|
26921
|
+
var import_suggestion3 = __toESM(require("@tiptap/suggestion"), 1);
|
|
26922
|
+
var import_react53 = require("@tiptap/react");
|
|
26869
26923
|
var import_state4 = require("@tiptap/pm/state");
|
|
26924
|
+
var import_react54 = __toESM(require("react"), 1);
|
|
26925
|
+
var import_lucide_react45 = require("lucide-react");
|
|
26926
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
26927
|
+
var FORMULA_FUNCTIONS = [
|
|
26928
|
+
{
|
|
26929
|
+
name: "SUM",
|
|
26930
|
+
signature: "SUM(range)",
|
|
26931
|
+
descriptionKey: "formulaSuggestion.sum"
|
|
26932
|
+
},
|
|
26933
|
+
{
|
|
26934
|
+
name: "AVG",
|
|
26935
|
+
signature: "AVG(range)",
|
|
26936
|
+
descriptionKey: "formulaSuggestion.avg"
|
|
26937
|
+
},
|
|
26938
|
+
{
|
|
26939
|
+
name: "MIN",
|
|
26940
|
+
signature: "MIN(range)",
|
|
26941
|
+
descriptionKey: "formulaSuggestion.min"
|
|
26942
|
+
},
|
|
26943
|
+
{
|
|
26944
|
+
name: "MAX",
|
|
26945
|
+
signature: "MAX(range)",
|
|
26946
|
+
descriptionKey: "formulaSuggestion.max"
|
|
26947
|
+
},
|
|
26948
|
+
{
|
|
26949
|
+
name: "COUNT",
|
|
26950
|
+
signature: "COUNT(range)",
|
|
26951
|
+
descriptionKey: "formulaSuggestion.count"
|
|
26952
|
+
}
|
|
26953
|
+
];
|
|
26954
|
+
function isInTableCell(editor) {
|
|
26955
|
+
const { $from } = editor.state.selection;
|
|
26956
|
+
for (let depth = $from.depth; depth > 0; depth -= 1) {
|
|
26957
|
+
const nodeName = $from.node(depth).type.name;
|
|
26958
|
+
if (nodeName === "tableCell" || nodeName === "tableHeader") {
|
|
26959
|
+
return true;
|
|
26960
|
+
}
|
|
26961
|
+
}
|
|
26962
|
+
return false;
|
|
26963
|
+
}
|
|
26964
|
+
function buildFormulaSuggestionItems({ query }) {
|
|
26965
|
+
const normalizedQuery = query.trim().toUpperCase();
|
|
26966
|
+
if (!normalizedQuery) {
|
|
26967
|
+
return FORMULA_FUNCTIONS;
|
|
26968
|
+
}
|
|
26969
|
+
return FORMULA_FUNCTIONS.filter((item) => item.name.startsWith(normalizedQuery));
|
|
26970
|
+
}
|
|
26971
|
+
var FormulaSuggestionList = (0, import_react54.forwardRef)((props, ref) => {
|
|
26972
|
+
const t = useSmartTranslations("UEditor");
|
|
26973
|
+
const [selectedIndex, setSelectedIndex] = import_react54.default.useState(0);
|
|
26974
|
+
import_react54.default.useEffect(() => {
|
|
26975
|
+
setSelectedIndex(0);
|
|
26976
|
+
}, [props.items]);
|
|
26977
|
+
(0, import_react54.useImperativeHandle)(ref, () => ({
|
|
26978
|
+
onKeyDown: ({ event }) => {
|
|
26979
|
+
if (props.items.length === 0) return false;
|
|
26980
|
+
if (event.key === "ArrowUp") {
|
|
26981
|
+
setSelectedIndex((prev) => (prev + props.items.length - 1) % props.items.length);
|
|
26982
|
+
return true;
|
|
26983
|
+
}
|
|
26984
|
+
if (event.key === "ArrowDown") {
|
|
26985
|
+
setSelectedIndex((prev) => (prev + 1) % props.items.length);
|
|
26986
|
+
return true;
|
|
26987
|
+
}
|
|
26988
|
+
if (event.key === "Enter" || event.key === "Tab") {
|
|
26989
|
+
const item = props.items[selectedIndex];
|
|
26990
|
+
if (item) {
|
|
26991
|
+
props.command(item);
|
|
26992
|
+
}
|
|
26993
|
+
return true;
|
|
26994
|
+
}
|
|
26995
|
+
return false;
|
|
26996
|
+
}
|
|
26997
|
+
}));
|
|
26998
|
+
if (props.items.length === 0) {
|
|
26999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("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") });
|
|
27000
|
+
}
|
|
27001
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "w-72 max-h-80 overflow-y-auto bg-card border border-border/50 rounded-lg shadow-lg", children: [
|
|
27002
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "px-3 py-2 border-b bg-muted/30", children: /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
27003
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_lucide_react45.Sigma, { className: "w-4 h-4 text-primary" }),
|
|
27004
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: t("formulaSuggestion.title") })
|
|
27005
|
+
] }) }),
|
|
27006
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "p-1.5", children: props.items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
|
|
27007
|
+
"button",
|
|
27008
|
+
{
|
|
27009
|
+
type: "button",
|
|
27010
|
+
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"}`,
|
|
27011
|
+
onMouseEnter: () => setSelectedIndex(index),
|
|
27012
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
27013
|
+
onClick: () => props.command(item),
|
|
27014
|
+
children: [
|
|
27015
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "flex items-center justify-between gap-3", children: [
|
|
27016
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { className: "font-mono text-sm font-semibold", children: item.name }),
|
|
27017
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { className: "font-mono text-xs text-muted-foreground", children: item.signature })
|
|
27018
|
+
] }),
|
|
27019
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "mt-0.5 text-xs text-muted-foreground", children: t(item.descriptionKey) })
|
|
27020
|
+
]
|
|
27021
|
+
},
|
|
27022
|
+
item.name
|
|
27023
|
+
)) })
|
|
27024
|
+
] });
|
|
27025
|
+
});
|
|
27026
|
+
FormulaSuggestionList.displayName = "FormulaSuggestionList";
|
|
27027
|
+
function insertFormulaFunction(editor, range, item) {
|
|
27028
|
+
const insertedText = `=${item.name}()`;
|
|
27029
|
+
const cursorPosition = range.from + item.name.length + 2;
|
|
27030
|
+
editor.chain().focus().deleteRange(range).insertContent(insertedText).run();
|
|
27031
|
+
editor.commands.setTextSelection(cursorPosition);
|
|
27032
|
+
}
|
|
27033
|
+
var FormulaSuggestion = import_core7.Extension.create({
|
|
27034
|
+
name: "formulaSuggestion",
|
|
27035
|
+
addProseMirrorPlugins() {
|
|
27036
|
+
return [
|
|
27037
|
+
(0, import_suggestion3.default)({
|
|
27038
|
+
editor: this.editor,
|
|
27039
|
+
char: "=",
|
|
27040
|
+
pluginKey: new import_state4.PluginKey("formulaSuggestion"),
|
|
27041
|
+
allow: ({ editor }) => isInTableCell(editor),
|
|
27042
|
+
command: ({ editor, range, props }) => {
|
|
27043
|
+
insertFormulaFunction(editor, range, props);
|
|
27044
|
+
},
|
|
27045
|
+
items: buildFormulaSuggestionItems,
|
|
27046
|
+
render: () => {
|
|
27047
|
+
let component;
|
|
27048
|
+
let popup;
|
|
27049
|
+
return {
|
|
27050
|
+
onStart: (props) => {
|
|
27051
|
+
component = new import_react53.ReactRenderer(FormulaSuggestionList, {
|
|
27052
|
+
props,
|
|
27053
|
+
editor: props.editor
|
|
27054
|
+
});
|
|
27055
|
+
if (!props.clientRect) {
|
|
27056
|
+
return;
|
|
27057
|
+
}
|
|
27058
|
+
popup = tippy("body", {
|
|
27059
|
+
getReferenceClientRect: props.clientRect,
|
|
27060
|
+
appendTo: () => document.body,
|
|
27061
|
+
content: component.element,
|
|
27062
|
+
showOnCreate: true,
|
|
27063
|
+
interactive: true,
|
|
27064
|
+
trigger: "manual",
|
|
27065
|
+
placement: "bottom-start",
|
|
27066
|
+
zIndex: 99999
|
|
27067
|
+
});
|
|
27068
|
+
},
|
|
27069
|
+
onUpdate(props) {
|
|
27070
|
+
component?.updateProps(props);
|
|
27071
|
+
if (!props.clientRect) {
|
|
27072
|
+
return;
|
|
27073
|
+
}
|
|
27074
|
+
popup?.[0]?.setProps({
|
|
27075
|
+
getReferenceClientRect: props.clientRect
|
|
27076
|
+
});
|
|
27077
|
+
},
|
|
27078
|
+
onKeyDown(props) {
|
|
27079
|
+
const popupInstance = getFirstTippyInstance(popup);
|
|
27080
|
+
if (props.event.key === "Escape") {
|
|
27081
|
+
hideTippyInstance(popupInstance);
|
|
27082
|
+
return true;
|
|
27083
|
+
}
|
|
27084
|
+
return component?.ref?.onKeyDown(props) ?? false;
|
|
27085
|
+
},
|
|
27086
|
+
onExit() {
|
|
27087
|
+
destroyTippyInstance(getFirstTippyInstance(popup));
|
|
27088
|
+
component?.destroy();
|
|
27089
|
+
}
|
|
27090
|
+
};
|
|
27091
|
+
}
|
|
27092
|
+
})
|
|
27093
|
+
];
|
|
27094
|
+
}
|
|
27095
|
+
});
|
|
27096
|
+
|
|
27097
|
+
// src/components/UEditor/placeholder.ts
|
|
27098
|
+
var import_core8 = require("@tiptap/core");
|
|
27099
|
+
var import_state5 = require("@tiptap/pm/state");
|
|
26870
27100
|
var import_view = require("@tiptap/pm/view");
|
|
26871
|
-
var UEditorPlaceholder =
|
|
27101
|
+
var UEditorPlaceholder = import_core8.Extension.create({
|
|
26872
27102
|
name: "placeholder",
|
|
26873
27103
|
addOptions() {
|
|
26874
27104
|
return {
|
|
@@ -26885,8 +27115,8 @@ var UEditorPlaceholder = import_core7.Extension.create({
|
|
|
26885
27115
|
addProseMirrorPlugins() {
|
|
26886
27116
|
const dataAttribute = `data-${this.options.dataAttribute}`;
|
|
26887
27117
|
return [
|
|
26888
|
-
new
|
|
26889
|
-
key: new
|
|
27118
|
+
new import_state5.Plugin({
|
|
27119
|
+
key: new import_state5.PluginKey("placeholder"),
|
|
26890
27120
|
props: {
|
|
26891
27121
|
decorations: ({ doc, selection }) => {
|
|
26892
27122
|
const active = this.editor.isEditable || !this.options.showOnlyWhenEditable;
|
|
@@ -26906,7 +27136,7 @@ var UEditorPlaceholder = import_core7.Extension.create({
|
|
|
26906
27136
|
});
|
|
26907
27137
|
doc.descendants((node, pos) => {
|
|
26908
27138
|
const hasAnchor = anchor >= pos && anchor <= pos + node.nodeSize;
|
|
26909
|
-
const isEmpty = !node.isLeaf && (0,
|
|
27139
|
+
const isEmpty = !node.isLeaf && (0, import_core8.isNodeEmpty)(node);
|
|
26910
27140
|
if (!((hasAnchor || !this.options.showOnlyCurrent) && isEmpty)) {
|
|
26911
27141
|
return this.options.includeChildren;
|
|
26912
27142
|
}
|
|
@@ -26938,11 +27168,11 @@ var UEditorPlaceholder = import_core7.Extension.create({
|
|
|
26938
27168
|
});
|
|
26939
27169
|
|
|
26940
27170
|
// src/components/UEditor/resizable-image.tsx
|
|
26941
|
-
var
|
|
27171
|
+
var import_react55 = require("react");
|
|
26942
27172
|
var import_extension_image = __toESM(require("@tiptap/extension-image"), 1);
|
|
26943
|
-
var
|
|
26944
|
-
var
|
|
26945
|
-
var
|
|
27173
|
+
var import_core9 = require("@tiptap/core");
|
|
27174
|
+
var import_react56 = require("@tiptap/react");
|
|
27175
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
26946
27176
|
var MIN_IMAGE_SIZE_PX = 40;
|
|
26947
27177
|
var IMAGE_LAYOUTS = /* @__PURE__ */ new Set(["block", "left", "right"]);
|
|
26948
27178
|
var IMAGE_WIDTH_PRESETS = /* @__PURE__ */ new Set(["sm", "md", "lg"]);
|
|
@@ -27021,16 +27251,16 @@ function sizeFromHeight(height, aspect, maxWidth) {
|
|
|
27021
27251
|
}
|
|
27022
27252
|
function ResizableImageNodeView(props) {
|
|
27023
27253
|
const { node, selected, updateAttributes, editor, getPos } = props;
|
|
27024
|
-
const wrapperRef = (0,
|
|
27025
|
-
const imgRef = (0,
|
|
27026
|
-
const [isHovered, setIsHovered] = (0,
|
|
27027
|
-
const [isResizing, setIsResizing] = (0,
|
|
27254
|
+
const wrapperRef = (0, import_react55.useRef)(null);
|
|
27255
|
+
const imgRef = (0, import_react55.useRef)(null);
|
|
27256
|
+
const [isHovered, setIsHovered] = (0, import_react55.useState)(false);
|
|
27257
|
+
const [isResizing, setIsResizing] = (0, import_react55.useState)(false);
|
|
27028
27258
|
const widthAttr = toNullableNumber(node.attrs["width"]);
|
|
27029
27259
|
const heightAttr = toNullableNumber(node.attrs["height"]);
|
|
27030
27260
|
const textAlign = String(node.attrs["textAlign"] ?? "");
|
|
27031
27261
|
const imageLayout = parseImageLayout(node.attrs["imageLayout"]);
|
|
27032
|
-
const dragStateRef = (0,
|
|
27033
|
-
(0,
|
|
27262
|
+
const dragStateRef = (0, import_react55.useRef)(null);
|
|
27263
|
+
(0, import_react55.useEffect)(() => {
|
|
27034
27264
|
const img = imgRef.current;
|
|
27035
27265
|
if (!img) return;
|
|
27036
27266
|
img.style.width = widthAttr ? `${widthAttr}px` : "";
|
|
@@ -27116,8 +27346,8 @@ function ResizableImageNodeView(props) {
|
|
|
27116
27346
|
const showHandle = selected || isHovered || isResizing;
|
|
27117
27347
|
const wrapperAlignClass = imageLayout === "block" ? textAlign === "center" ? "mx-auto" : textAlign === "right" ? "ml-auto" : textAlign === "justify" ? "mx-auto" : "" : "";
|
|
27118
27348
|
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";
|
|
27119
|
-
return /* @__PURE__ */ (0,
|
|
27120
|
-
|
|
27349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
|
|
27350
|
+
import_react56.NodeViewWrapper,
|
|
27121
27351
|
{
|
|
27122
27352
|
as: "div",
|
|
27123
27353
|
ref: wrapperRef,
|
|
@@ -27131,7 +27361,7 @@ function ResizableImageNodeView(props) {
|
|
|
27131
27361
|
},
|
|
27132
27362
|
contentEditable: false,
|
|
27133
27363
|
children: [
|
|
27134
|
-
/* @__PURE__ */ (0,
|
|
27364
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
27135
27365
|
"img",
|
|
27136
27366
|
{
|
|
27137
27367
|
ref: imgRef,
|
|
@@ -27150,7 +27380,7 @@ function ResizableImageNodeView(props) {
|
|
|
27150
27380
|
}
|
|
27151
27381
|
}
|
|
27152
27382
|
),
|
|
27153
|
-
showHandle && /* @__PURE__ */ (0,
|
|
27383
|
+
showHandle && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
27154
27384
|
"div",
|
|
27155
27385
|
{
|
|
27156
27386
|
"aria-hidden": "true",
|
|
@@ -27215,10 +27445,10 @@ var ResizableImage = import_extension_image.default.extend({
|
|
|
27215
27445
|
};
|
|
27216
27446
|
},
|
|
27217
27447
|
renderHTML({ HTMLAttributes }) {
|
|
27218
|
-
return ["img", (0,
|
|
27448
|
+
return ["img", (0, import_core9.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes)];
|
|
27219
27449
|
},
|
|
27220
27450
|
addNodeView() {
|
|
27221
|
-
return (0,
|
|
27451
|
+
return (0, import_react56.ReactNodeViewRenderer)(ResizableImageNodeView);
|
|
27222
27452
|
}
|
|
27223
27453
|
}).configure({
|
|
27224
27454
|
allowBase64: true,
|
|
@@ -27263,8 +27493,8 @@ var UEditorTableRow = import_extension_table_row.default.extend({
|
|
|
27263
27493
|
var table_row_default = UEditorTableRow;
|
|
27264
27494
|
|
|
27265
27495
|
// src/components/UEditor/font-family.ts
|
|
27266
|
-
var
|
|
27267
|
-
var FontFamily =
|
|
27496
|
+
var import_core10 = require("@tiptap/core");
|
|
27497
|
+
var FontFamily = import_core10.Extension.create({
|
|
27268
27498
|
name: "fontFamily",
|
|
27269
27499
|
addOptions() {
|
|
27270
27500
|
return {
|
|
@@ -27299,8 +27529,8 @@ var FontFamily = import_core9.Extension.create({
|
|
|
27299
27529
|
var font_family_default = FontFamily;
|
|
27300
27530
|
|
|
27301
27531
|
// src/components/UEditor/font-size.ts
|
|
27302
|
-
var
|
|
27303
|
-
var FontSize =
|
|
27532
|
+
var import_core11 = require("@tiptap/core");
|
|
27533
|
+
var FontSize = import_core11.Extension.create({
|
|
27304
27534
|
name: "fontSize",
|
|
27305
27535
|
addOptions() {
|
|
27306
27536
|
return {
|
|
@@ -27335,8 +27565,8 @@ var FontSize = import_core10.Extension.create({
|
|
|
27335
27565
|
var font_size_default = FontSize;
|
|
27336
27566
|
|
|
27337
27567
|
// src/components/UEditor/line-height.ts
|
|
27338
|
-
var
|
|
27339
|
-
var LineHeight =
|
|
27568
|
+
var import_core12 = require("@tiptap/core");
|
|
27569
|
+
var LineHeight = import_core12.Extension.create({
|
|
27340
27570
|
name: "lineHeight",
|
|
27341
27571
|
addOptions() {
|
|
27342
27572
|
return {
|
|
@@ -27371,8 +27601,8 @@ var LineHeight = import_core11.Extension.create({
|
|
|
27371
27601
|
var line_height_default = LineHeight;
|
|
27372
27602
|
|
|
27373
27603
|
// src/components/UEditor/letter-spacing.ts
|
|
27374
|
-
var
|
|
27375
|
-
var LetterSpacing =
|
|
27604
|
+
var import_core13 = require("@tiptap/core");
|
|
27605
|
+
var LetterSpacing = import_core13.Extension.create({
|
|
27376
27606
|
name: "letterSpacing",
|
|
27377
27607
|
addOptions() {
|
|
27378
27608
|
return {
|
|
@@ -27408,7 +27638,7 @@ var letter_spacing_default = LetterSpacing;
|
|
|
27408
27638
|
|
|
27409
27639
|
// src/components/UEditor/table-align.ts
|
|
27410
27640
|
var import_extension_table = require("@tiptap/extension-table");
|
|
27411
|
-
var
|
|
27641
|
+
var import_state6 = require("@tiptap/pm/state");
|
|
27412
27642
|
|
|
27413
27643
|
// src/components/UEditor/table-dom-utils.ts
|
|
27414
27644
|
var MIN_TABLE_ROW_HEIGHT = 36;
|
|
@@ -27650,7 +27880,7 @@ var UEditorTable = import_extension_table.Table.extend({
|
|
|
27650
27880
|
addProseMirrorPlugins() {
|
|
27651
27881
|
return [
|
|
27652
27882
|
...this.parent?.() ?? [],
|
|
27653
|
-
new
|
|
27883
|
+
new import_state6.Plugin({
|
|
27654
27884
|
appendTransaction(_transactions, _oldState, newState) {
|
|
27655
27885
|
const { doc, schema } = newState;
|
|
27656
27886
|
const paragraphType = schema.nodes.paragraph;
|
|
@@ -27670,10 +27900,10 @@ var UEditorTable = import_extension_table.Table.extend({
|
|
|
27670
27900
|
var table_align_default = UEditorTable;
|
|
27671
27901
|
|
|
27672
27902
|
// src/components/UEditor/CodeBlockView.tsx
|
|
27673
|
-
var
|
|
27674
|
-
var
|
|
27675
|
-
var
|
|
27676
|
-
var
|
|
27903
|
+
var import_react57 = __toESM(require("react"), 1);
|
|
27904
|
+
var import_react58 = require("@tiptap/react");
|
|
27905
|
+
var import_lucide_react46 = require("lucide-react");
|
|
27906
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
27677
27907
|
var LANGUAGES = [
|
|
27678
27908
|
{ label: "Plain Text", value: "text" },
|
|
27679
27909
|
{ label: "JavaScript", value: "javascript" },
|
|
@@ -27695,12 +27925,12 @@ var CodeBlockView = ({
|
|
|
27695
27925
|
updateAttributes,
|
|
27696
27926
|
extension
|
|
27697
27927
|
}) => {
|
|
27698
|
-
const [copied, setCopied] = (0,
|
|
27699
|
-
const [isDropdownOpen, setIsDropdownOpen] = (0,
|
|
27700
|
-
const timeoutRef =
|
|
27928
|
+
const [copied, setCopied] = (0, import_react57.useState)(false);
|
|
27929
|
+
const [isDropdownOpen, setIsDropdownOpen] = (0, import_react57.useState)(false);
|
|
27930
|
+
const timeoutRef = import_react57.default.useRef(null);
|
|
27701
27931
|
const currentLangValue = node.attrs.language || "text";
|
|
27702
27932
|
const currentLangLabel = LANGUAGES.find((lang) => lang.value === currentLangValue)?.label || "Plain Text";
|
|
27703
|
-
|
|
27933
|
+
import_react57.default.useEffect(() => {
|
|
27704
27934
|
return () => {
|
|
27705
27935
|
if (timeoutRef.current) {
|
|
27706
27936
|
clearTimeout(timeoutRef.current);
|
|
@@ -27721,15 +27951,15 @@ var CodeBlockView = ({
|
|
|
27721
27951
|
console.error("Failed to copy code text: ", err);
|
|
27722
27952
|
}
|
|
27723
27953
|
};
|
|
27724
|
-
return /* @__PURE__ */ (0,
|
|
27725
|
-
/* @__PURE__ */ (0,
|
|
27954
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_react58.NodeViewWrapper, { 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: [
|
|
27955
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
|
|
27726
27956
|
"div",
|
|
27727
27957
|
{
|
|
27728
27958
|
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",
|
|
27729
27959
|
contentEditable: false,
|
|
27730
27960
|
children: [
|
|
27731
|
-
/* @__PURE__ */ (0,
|
|
27732
|
-
/* @__PURE__ */ (0,
|
|
27961
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "relative", children: [
|
|
27962
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
|
|
27733
27963
|
"button",
|
|
27734
27964
|
{
|
|
27735
27965
|
type: "button",
|
|
@@ -27737,19 +27967,19 @@ var CodeBlockView = ({
|
|
|
27737
27967
|
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",
|
|
27738
27968
|
children: [
|
|
27739
27969
|
currentLangLabel,
|
|
27740
|
-
/* @__PURE__ */ (0,
|
|
27970
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react46.ChevronDown, { className: "h-3 w-3" })
|
|
27741
27971
|
]
|
|
27742
27972
|
}
|
|
27743
27973
|
),
|
|
27744
|
-
isDropdownOpen && /* @__PURE__ */ (0,
|
|
27745
|
-
/* @__PURE__ */ (0,
|
|
27974
|
+
isDropdownOpen && /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_jsx_runtime83.Fragment, { children: [
|
|
27975
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
27746
27976
|
"div",
|
|
27747
27977
|
{
|
|
27748
27978
|
className: "fixed inset-0 z-20",
|
|
27749
27979
|
onClick: () => setIsDropdownOpen(false)
|
|
27750
27980
|
}
|
|
27751
27981
|
),
|
|
27752
|
-
/* @__PURE__ */ (0,
|
|
27982
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("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__ */ (0, import_jsx_runtime83.jsx)(
|
|
27753
27983
|
"button",
|
|
27754
27984
|
{
|
|
27755
27985
|
type: "button",
|
|
@@ -27767,20 +27997,20 @@ var CodeBlockView = ({
|
|
|
27767
27997
|
)) })
|
|
27768
27998
|
] })
|
|
27769
27999
|
] }),
|
|
27770
|
-
/* @__PURE__ */ (0,
|
|
28000
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
27771
28001
|
"button",
|
|
27772
28002
|
{
|
|
27773
28003
|
type: "button",
|
|
27774
28004
|
onClick: handleCopy,
|
|
27775
28005
|
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",
|
|
27776
28006
|
title: "Copy code",
|
|
27777
|
-
children: copied ? /* @__PURE__ */ (0,
|
|
28007
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react46.Check, { className: "h-3.5 w-3.5 text-success animate-in fade-in-0 zoom-in-75" }) : /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react46.Copy, { className: "h-3.5 w-3.5" })
|
|
27778
28008
|
}
|
|
27779
28009
|
)
|
|
27780
28010
|
]
|
|
27781
28011
|
}
|
|
27782
28012
|
),
|
|
27783
|
-
/* @__PURE__ */ (0,
|
|
28013
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("pre", { className: "m-0 overflow-x-auto [scrollbar-width:thin] pt-4 sm:pt-0", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("code", { className: "bg-transparent! text-foreground!", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_react58.NodeViewContent, {}) }) })
|
|
27784
28014
|
] });
|
|
27785
28015
|
};
|
|
27786
28016
|
|
|
@@ -27897,7 +28127,7 @@ var CustomTableCell = import_extension_table_cell.default.extend({
|
|
|
27897
28127
|
mergedStyle = mergedStyle.replace(/^;/, "").trim();
|
|
27898
28128
|
return [
|
|
27899
28129
|
"td",
|
|
27900
|
-
(0,
|
|
28130
|
+
(0, import_core14.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes, getFormulaStateAttributes(HTMLAttributes), mergedStyle ? { style: mergedStyle } : {}),
|
|
27901
28131
|
0
|
|
27902
28132
|
];
|
|
27903
28133
|
}
|
|
@@ -28004,7 +28234,7 @@ var CustomTableHeader = import_extension_table_header.default.extend({
|
|
|
28004
28234
|
mergedStyle = mergedStyle.replace(/^;/, "").trim();
|
|
28005
28235
|
return [
|
|
28006
28236
|
"th",
|
|
28007
|
-
(0,
|
|
28237
|
+
(0, import_core14.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes, getFormulaStateAttributes(HTMLAttributes), mergedStyle ? { style: mergedStyle } : {}),
|
|
28008
28238
|
0
|
|
28009
28239
|
];
|
|
28010
28240
|
}
|
|
@@ -28012,15 +28242,15 @@ var CustomTableHeader = import_extension_table_header.default.extend({
|
|
|
28012
28242
|
var CustomTaskList = import_extension_task_list.default.extend({
|
|
28013
28243
|
addInputRules() {
|
|
28014
28244
|
return [
|
|
28015
|
-
(0,
|
|
28245
|
+
(0, import_core15.wrappingInputRule)({
|
|
28016
28246
|
find: /^\s*(\[ \]|\[\])\s$/,
|
|
28017
28247
|
type: this.type
|
|
28018
28248
|
}),
|
|
28019
|
-
(0,
|
|
28249
|
+
(0, import_core15.wrappingInputRule)({
|
|
28020
28250
|
find: /^\s*(-\s*\[ \]|-\s*\[\])\s$/,
|
|
28021
28251
|
type: this.type
|
|
28022
28252
|
}),
|
|
28023
|
-
(0,
|
|
28253
|
+
(0, import_core15.wrappingInputRule)({
|
|
28024
28254
|
find: /^\s*(\*\s*\[ \]|-\s*\[\])\s$/,
|
|
28025
28255
|
type: this.type
|
|
28026
28256
|
})
|
|
@@ -28030,7 +28260,7 @@ var CustomTaskList = import_extension_task_list.default.extend({
|
|
|
28030
28260
|
var lowlight = (0, import_lowlight.createLowlight)(import_lowlight.common);
|
|
28031
28261
|
var CustomCodeBlockLowlight = import_extension_code_block_lowlight.default.extend({
|
|
28032
28262
|
addNodeView() {
|
|
28033
|
-
return (0,
|
|
28263
|
+
return (0, import_react59.ReactNodeViewRenderer)(CodeBlockView);
|
|
28034
28264
|
}
|
|
28035
28265
|
});
|
|
28036
28266
|
function buildUEditorExtensions({
|
|
@@ -28166,6 +28396,7 @@ function buildUEditorExtensions({
|
|
|
28166
28396
|
SlashCommand.configure({
|
|
28167
28397
|
messages: buildSlashCommandMessages(translate)
|
|
28168
28398
|
}),
|
|
28399
|
+
FormulaSuggestion,
|
|
28169
28400
|
EmojiSuggestion,
|
|
28170
28401
|
Callout,
|
|
28171
28402
|
Bookmark.configure({
|
|
@@ -28178,19 +28409,19 @@ function buildUEditorExtensions({
|
|
|
28178
28409
|
}
|
|
28179
28410
|
|
|
28180
28411
|
// src/components/UEditor/toolbar.tsx
|
|
28181
|
-
var
|
|
28182
|
-
var
|
|
28183
|
-
var
|
|
28412
|
+
var import_react62 = __toESM(require("react"), 1);
|
|
28413
|
+
var import_react63 = require("@tiptap/react");
|
|
28414
|
+
var import_lucide_react49 = require("lucide-react");
|
|
28184
28415
|
|
|
28185
28416
|
// src/components/UEditor/colors.tsx
|
|
28186
|
-
var
|
|
28187
|
-
var
|
|
28188
|
-
var
|
|
28417
|
+
var import_react60 = require("react");
|
|
28418
|
+
var import_lucide_react47 = require("lucide-react");
|
|
28419
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
28189
28420
|
var TextColorIcon = ({ color }) => {
|
|
28190
28421
|
const underlineColor = color && color !== "inherit" ? color : "currentColor";
|
|
28191
|
-
return /* @__PURE__ */ (0,
|
|
28192
|
-
/* @__PURE__ */ (0,
|
|
28193
|
-
/* @__PURE__ */ (0,
|
|
28422
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("span", { className: "relative flex h-5 w-5 items-center justify-center leading-none", children: [
|
|
28423
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { className: "text-[15px] font-semibold leading-none", children: "A" }),
|
|
28424
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
28194
28425
|
"span",
|
|
28195
28426
|
{
|
|
28196
28427
|
"aria-hidden": "true",
|
|
@@ -28202,9 +28433,9 @@ var TextColorIcon = ({ color }) => {
|
|
|
28202
28433
|
};
|
|
28203
28434
|
var HighlightColorIcon = ({ color }) => {
|
|
28204
28435
|
const underlineColor = color || "currentColor";
|
|
28205
|
-
return /* @__PURE__ */ (0,
|
|
28206
|
-
/* @__PURE__ */ (0,
|
|
28207
|
-
/* @__PURE__ */ (0,
|
|
28436
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("span", { className: "relative flex h-5 w-5 items-center justify-center leading-none", children: [
|
|
28437
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_lucide_react47.Highlighter, { className: "h-4 w-4" }),
|
|
28438
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
28208
28439
|
"span",
|
|
28209
28440
|
{
|
|
28210
28441
|
"aria-hidden": "true",
|
|
@@ -28216,9 +28447,9 @@ var HighlightColorIcon = ({ color }) => {
|
|
|
28216
28447
|
};
|
|
28217
28448
|
var CellBgColorIcon = ({ color }) => {
|
|
28218
28449
|
const underlineColor = color && color !== "inherit" ? color : "currentColor";
|
|
28219
|
-
return /* @__PURE__ */ (0,
|
|
28220
|
-
/* @__PURE__ */ (0,
|
|
28221
|
-
/* @__PURE__ */ (0,
|
|
28450
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("span", { className: "relative flex h-5 w-5 items-center justify-center leading-none", children: [
|
|
28451
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_lucide_react47.Paintbrush, { className: "h-4 w-4" }),
|
|
28452
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
28222
28453
|
"span",
|
|
28223
28454
|
{
|
|
28224
28455
|
"aria-hidden": "true",
|
|
@@ -28230,9 +28461,9 @@ var CellBgColorIcon = ({ color }) => {
|
|
|
28230
28461
|
};
|
|
28231
28462
|
var CellBorderIcon = ({ color }) => {
|
|
28232
28463
|
const underlineColor = color && color !== "inherit" ? color : "currentColor";
|
|
28233
|
-
return /* @__PURE__ */ (0,
|
|
28234
|
-
/* @__PURE__ */ (0,
|
|
28235
|
-
/* @__PURE__ */ (0,
|
|
28464
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("span", { className: "relative flex h-5 w-5 items-center justify-center leading-none", children: [
|
|
28465
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_lucide_react47.Grid, { className: "h-4 w-4" }),
|
|
28466
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
28236
28467
|
"span",
|
|
28237
28468
|
{
|
|
28238
28469
|
"aria-hidden": "true",
|
|
@@ -28315,7 +28546,7 @@ function buildColorOptions(colors, prefix) {
|
|
|
28315
28546
|
}
|
|
28316
28547
|
var useEditorColors = () => {
|
|
28317
28548
|
const t = useSmartTranslations("UEditor");
|
|
28318
|
-
const textColors = (0,
|
|
28549
|
+
const textColors = (0, import_react60.useMemo)(
|
|
28319
28550
|
() => [
|
|
28320
28551
|
{ name: t("colors.default"), color: "inherit", cssClass: "text-foreground" },
|
|
28321
28552
|
{ name: t("colors.muted"), color: "var(--muted-foreground)", cssClass: "text-muted-foreground" },
|
|
@@ -28329,7 +28560,7 @@ var useEditorColors = () => {
|
|
|
28329
28560
|
],
|
|
28330
28561
|
[t]
|
|
28331
28562
|
);
|
|
28332
|
-
const highlightColors = (0,
|
|
28563
|
+
const highlightColors = (0, import_react60.useMemo)(
|
|
28333
28564
|
() => [
|
|
28334
28565
|
{ name: t("colors.default"), color: "", cssClass: "" },
|
|
28335
28566
|
{ name: t("colors.muted"), color: "var(--muted)", cssClass: "bg-muted" },
|
|
@@ -28353,12 +28584,12 @@ var EditorColorPalette = ({
|
|
|
28353
28584
|
label
|
|
28354
28585
|
}) => {
|
|
28355
28586
|
const t = useSmartTranslations("UEditor");
|
|
28356
|
-
const colorInputRef = (0,
|
|
28587
|
+
const colorInputRef = (0, import_react60.useRef)(null);
|
|
28357
28588
|
const automaticColor = colors[0]?.color ?? "";
|
|
28358
28589
|
const paletteColors = colors.slice(1);
|
|
28359
|
-
return /* @__PURE__ */ (0,
|
|
28360
|
-
/* @__PURE__ */ (0,
|
|
28361
|
-
/* @__PURE__ */ (0,
|
|
28590
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "w-56 p-2", children: [
|
|
28591
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { className: "px-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: label }),
|
|
28592
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
|
|
28362
28593
|
"button",
|
|
28363
28594
|
{
|
|
28364
28595
|
type: "button",
|
|
@@ -28370,12 +28601,12 @@ var EditorColorPalette = ({
|
|
|
28370
28601
|
currentColor === automaticColor ? "border-primary text-primary" : "border-transparent text-foreground"
|
|
28371
28602
|
),
|
|
28372
28603
|
children: [
|
|
28373
|
-
/* @__PURE__ */ (0,
|
|
28374
|
-
/* @__PURE__ */ (0,
|
|
28604
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { className: "flex h-5 w-5 items-center justify-center rounded border border-border bg-background", children: currentColor === automaticColor && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_lucide_react47.Check, { className: "h-3.5 w-3.5" }) }),
|
|
28605
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { className: "flex-1 text-center", children: t("colors.automatic") })
|
|
28375
28606
|
]
|
|
28376
28607
|
}
|
|
28377
28608
|
),
|
|
28378
|
-
/* @__PURE__ */ (0,
|
|
28609
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: "mt-2 grid grid-cols-8 gap-1", children: paletteColors.map((c) => /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Tooltip, { placement: "top", content: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { className: "text-xs font-medium", children: c.name }), children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
28379
28610
|
"button",
|
|
28380
28611
|
{
|
|
28381
28612
|
type: "button",
|
|
@@ -28387,10 +28618,10 @@ var EditorColorPalette = ({
|
|
|
28387
28618
|
currentColor === c.color ? "border-primary ring-2 ring-primary/25" : "border-border/70"
|
|
28388
28619
|
),
|
|
28389
28620
|
style: { backgroundColor: c.color || "transparent" },
|
|
28390
|
-
children: currentColor === c.color && /* @__PURE__ */ (0,
|
|
28621
|
+
children: currentColor === c.color && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_lucide_react47.Check, { className: "h-3.5 w-3.5 text-white drop-shadow-[0_1px_1px_rgba(0,0,0,0.8)]" }) })
|
|
28391
28622
|
}
|
|
28392
28623
|
) }, `${c.name}-${c.color}`)) }),
|
|
28393
|
-
/* @__PURE__ */ (0,
|
|
28624
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
|
|
28394
28625
|
"button",
|
|
28395
28626
|
{
|
|
28396
28627
|
type: "button",
|
|
@@ -28398,7 +28629,7 @@ var EditorColorPalette = ({
|
|
|
28398
28629
|
onClick: () => colorInputRef.current?.click(),
|
|
28399
28630
|
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",
|
|
28400
28631
|
children: [
|
|
28401
|
-
/* @__PURE__ */ (0,
|
|
28632
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
28402
28633
|
"span",
|
|
28403
28634
|
{
|
|
28404
28635
|
"aria-hidden": "true",
|
|
@@ -28408,9 +28639,9 @@ var EditorColorPalette = ({
|
|
|
28408
28639
|
}
|
|
28409
28640
|
}
|
|
28410
28641
|
),
|
|
28411
|
-
/* @__PURE__ */ (0,
|
|
28412
|
-
/* @__PURE__ */ (0,
|
|
28413
|
-
/* @__PURE__ */ (0,
|
|
28642
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { className: "flex-1 text-center", children: t("colors.moreColors") }),
|
|
28643
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_lucide_react47.Palette, { className: "h-4 w-4 text-muted-foreground" }),
|
|
28644
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
28414
28645
|
"input",
|
|
28415
28646
|
{
|
|
28416
28647
|
ref: colorInputRef,
|
|
@@ -28428,7 +28659,7 @@ var EditorColorPalette = ({
|
|
|
28428
28659
|
};
|
|
28429
28660
|
|
|
28430
28661
|
// src/components/UEditor/image-commands.ts
|
|
28431
|
-
var
|
|
28662
|
+
var import_state7 = require("@tiptap/pm/state");
|
|
28432
28663
|
var IMAGE_WIDTHS_BY_LAYOUT = {
|
|
28433
28664
|
block: {
|
|
28434
28665
|
sm: 180,
|
|
@@ -28443,7 +28674,7 @@ var IMAGE_WIDTHS_BY_LAYOUT = {
|
|
|
28443
28674
|
};
|
|
28444
28675
|
function isSelectedImage(editor) {
|
|
28445
28676
|
const { selection } = editor.state;
|
|
28446
|
-
return selection instanceof
|
|
28677
|
+
return selection instanceof import_state7.NodeSelection && selection.node.type.name === "image";
|
|
28447
28678
|
}
|
|
28448
28679
|
function toPositiveNumber(value) {
|
|
28449
28680
|
if (typeof value === "number" && Number.isFinite(value) && value > 0) return value;
|
|
@@ -28485,7 +28716,7 @@ function getImagePresetAttributes(editor, width, preset, attrs, pos) {
|
|
|
28485
28716
|
function applyImageLayout(editor, layout) {
|
|
28486
28717
|
const { state, view } = editor;
|
|
28487
28718
|
const { selection, schema } = state;
|
|
28488
|
-
if (!(selection instanceof
|
|
28719
|
+
if (!(selection instanceof import_state7.NodeSelection) || selection.node.type.name !== "image") {
|
|
28489
28720
|
editor.chain().focus().updateAttributes("image", { imageLayout: layout }).run();
|
|
28490
28721
|
return;
|
|
28491
28722
|
}
|
|
@@ -28503,10 +28734,10 @@ function applyImageLayout(editor, layout) {
|
|
|
28503
28734
|
}
|
|
28504
28735
|
}
|
|
28505
28736
|
const resolvedPos = transaction.doc.resolve(Math.min(nextPos + 1, transaction.doc.content.size));
|
|
28506
|
-
transaction = transaction.setSelection(
|
|
28737
|
+
transaction = transaction.setSelection(import_state7.TextSelection.near(resolvedPos));
|
|
28507
28738
|
} else {
|
|
28508
28739
|
const resolvedPos = transaction.doc.resolve(selection.from);
|
|
28509
|
-
transaction = transaction.setSelection(
|
|
28740
|
+
transaction = transaction.setSelection(import_state7.NodeSelection.create(transaction.doc, resolvedPos.pos));
|
|
28510
28741
|
}
|
|
28511
28742
|
view.dispatch(transaction.scrollIntoView());
|
|
28512
28743
|
view.focus();
|
|
@@ -28555,9 +28786,9 @@ function deleteSelectedImage(editor) {
|
|
|
28555
28786
|
}
|
|
28556
28787
|
|
|
28557
28788
|
// src/components/UEditor/inputs.tsx
|
|
28558
|
-
var
|
|
28559
|
-
var
|
|
28560
|
-
var
|
|
28789
|
+
var import_react61 = require("react");
|
|
28790
|
+
var import_lucide_react48 = require("lucide-react");
|
|
28791
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
28561
28792
|
function normalizeUrl(raw) {
|
|
28562
28793
|
return sanitizeUEditorUrl(raw, "link");
|
|
28563
28794
|
}
|
|
@@ -28567,9 +28798,9 @@ var LinkInput = ({
|
|
|
28567
28798
|
initialUrl = ""
|
|
28568
28799
|
}) => {
|
|
28569
28800
|
const t = useSmartTranslations("UEditor");
|
|
28570
|
-
const [url, setUrl] = (0,
|
|
28571
|
-
const inputRef = (0,
|
|
28572
|
-
(0,
|
|
28801
|
+
const [url, setUrl] = (0, import_react61.useState)(initialUrl);
|
|
28802
|
+
const inputRef = (0, import_react61.useRef)(null);
|
|
28803
|
+
(0, import_react61.useEffect)(() => {
|
|
28573
28804
|
inputRef.current?.focus();
|
|
28574
28805
|
inputRef.current?.select();
|
|
28575
28806
|
}, []);
|
|
@@ -28578,8 +28809,8 @@ var LinkInput = ({
|
|
|
28578
28809
|
const normalized = normalizeUrl(url);
|
|
28579
28810
|
if (normalized) onSubmit(normalized);
|
|
28580
28811
|
};
|
|
28581
|
-
return /* @__PURE__ */ (0,
|
|
28582
|
-
/* @__PURE__ */ (0,
|
|
28812
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("form", { onSubmit: handleSubmit, className: "flex items-center gap-2 p-2", children: [
|
|
28813
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
28583
28814
|
"input",
|
|
28584
28815
|
{
|
|
28585
28816
|
ref: inputRef,
|
|
@@ -28590,16 +28821,16 @@ var LinkInput = ({
|
|
|
28590
28821
|
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"
|
|
28591
28822
|
}
|
|
28592
28823
|
),
|
|
28593
|
-
/* @__PURE__ */ (0,
|
|
28594
|
-
/* @__PURE__ */ (0,
|
|
28824
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("button", { type: "submit", className: "p-2 rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_lucide_react48.Check, { className: "w-4 h-4" }) }),
|
|
28825
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("button", { type: "button", onClick: onCancel, className: "p-2 rounded-lg hover:bg-muted transition-colors text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_lucide_react48.X, { className: "w-4 h-4" }) })
|
|
28595
28826
|
] });
|
|
28596
28827
|
};
|
|
28597
28828
|
var ImageInput = ({ onSubmit, onCancel }) => {
|
|
28598
28829
|
const t = useSmartTranslations("UEditor");
|
|
28599
|
-
const [url, setUrl] = (0,
|
|
28600
|
-
const [alt, setAlt] = (0,
|
|
28601
|
-
const inputRef = (0,
|
|
28602
|
-
(0,
|
|
28830
|
+
const [url, setUrl] = (0, import_react61.useState)("");
|
|
28831
|
+
const [alt, setAlt] = (0, import_react61.useState)("");
|
|
28832
|
+
const inputRef = (0, import_react61.useRef)(null);
|
|
28833
|
+
(0, import_react61.useEffect)(() => {
|
|
28603
28834
|
inputRef.current?.focus();
|
|
28604
28835
|
}, []);
|
|
28605
28836
|
const handleSubmit = (e) => {
|
|
@@ -28609,10 +28840,10 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
28609
28840
|
onSubmit(safeUrl, alt);
|
|
28610
28841
|
}
|
|
28611
28842
|
};
|
|
28612
|
-
return /* @__PURE__ */ (0,
|
|
28613
|
-
/* @__PURE__ */ (0,
|
|
28614
|
-
/* @__PURE__ */ (0,
|
|
28615
|
-
/* @__PURE__ */ (0,
|
|
28843
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("form", { onSubmit: handleSubmit, className: "p-3 space-y-3", children: [
|
|
28844
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { children: [
|
|
28845
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("label", { className: "text-xs font-medium text-muted-foreground", children: t("imageInput.urlLabel") }),
|
|
28846
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
28616
28847
|
"input",
|
|
28617
28848
|
{
|
|
28618
28849
|
ref: inputRef,
|
|
@@ -28624,9 +28855,9 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
28624
28855
|
}
|
|
28625
28856
|
)
|
|
28626
28857
|
] }),
|
|
28627
|
-
/* @__PURE__ */ (0,
|
|
28628
|
-
/* @__PURE__ */ (0,
|
|
28629
|
-
/* @__PURE__ */ (0,
|
|
28858
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { children: [
|
|
28859
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("label", { className: "text-xs font-medium text-muted-foreground", children: t("imageInput.altLabel") }),
|
|
28860
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
28630
28861
|
"input",
|
|
28631
28862
|
{
|
|
28632
28863
|
type: "text",
|
|
@@ -28637,8 +28868,8 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
28637
28868
|
}
|
|
28638
28869
|
)
|
|
28639
28870
|
] }),
|
|
28640
|
-
/* @__PURE__ */ (0,
|
|
28641
|
-
/* @__PURE__ */ (0,
|
|
28871
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "flex gap-2", children: [
|
|
28872
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
28642
28873
|
"button",
|
|
28643
28874
|
{
|
|
28644
28875
|
type: "submit",
|
|
@@ -28647,13 +28878,13 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
28647
28878
|
children: t("imageInput.addBtn")
|
|
28648
28879
|
}
|
|
28649
28880
|
),
|
|
28650
|
-
/* @__PURE__ */ (0,
|
|
28881
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("button", { type: "button", onClick: onCancel, className: "px-4 py-2 rounded-lg hover:bg-muted transition-colors text-muted-foreground", children: t("imageInput.cancelBtn") })
|
|
28651
28882
|
] })
|
|
28652
28883
|
] });
|
|
28653
28884
|
};
|
|
28654
28885
|
|
|
28655
28886
|
// src/components/UEditor/table-cell-commands.ts
|
|
28656
|
-
var
|
|
28887
|
+
var import_state8 = require("@tiptap/pm/state");
|
|
28657
28888
|
var import_tables = require("@tiptap/pm/tables");
|
|
28658
28889
|
function getCellSelectionPositions(selection) {
|
|
28659
28890
|
const value = selection;
|
|
@@ -28687,7 +28918,7 @@ function getFocusableCellPos(editor, cellPos) {
|
|
|
28687
28918
|
return node?.isTextblock ? offset + 1 : cellPos + 1;
|
|
28688
28919
|
}
|
|
28689
28920
|
function focusCell(editor, cellPos) {
|
|
28690
|
-
const selection =
|
|
28921
|
+
const selection = import_state8.TextSelection.near(editor.state.doc.resolve(getFocusableCellPos(editor, cellPos)));
|
|
28691
28922
|
editor.view.dispatch(editor.state.tr.setSelection(selection));
|
|
28692
28923
|
editor.view.focus();
|
|
28693
28924
|
}
|
|
@@ -28978,7 +29209,7 @@ function getDefaultLetterSpacings() {
|
|
|
28978
29209
|
}
|
|
28979
29210
|
|
|
28980
29211
|
// src/components/UEditor/toolbar.tsx
|
|
28981
|
-
var
|
|
29212
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
28982
29213
|
function getTableAnchorPos(editor) {
|
|
28983
29214
|
const tableInfo = findTableNodeInfoFromState(editor.state);
|
|
28984
29215
|
if (tableInfo) return editor.state.selection.from;
|
|
@@ -29008,8 +29239,8 @@ function fileToDataUrl2(file) {
|
|
|
29008
29239
|
function formatTableInsertLabel(template, rows, cols) {
|
|
29009
29240
|
return template.replace("{rows}", String(rows)).replace("{cols}", String(cols));
|
|
29010
29241
|
}
|
|
29011
|
-
var ToolbarButton =
|
|
29012
|
-
const button = /* @__PURE__ */ (0,
|
|
29242
|
+
var ToolbarButton = import_react62.default.forwardRef(({ onClick, onMouseDown, active, disabled, children, title, className }, ref) => {
|
|
29243
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29013
29244
|
"button",
|
|
29014
29245
|
{
|
|
29015
29246
|
ref,
|
|
@@ -29034,28 +29265,28 @@ var ToolbarButton = import_react60.default.forwardRef(({ onClick, onMouseDown, a
|
|
|
29034
29265
|
}
|
|
29035
29266
|
);
|
|
29036
29267
|
if (title) {
|
|
29037
|
-
return /* @__PURE__ */ (0,
|
|
29268
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Tooltip, { content: title, placement: "top", delay: { open: 200, close: 0 }, children: button });
|
|
29038
29269
|
}
|
|
29039
29270
|
return button;
|
|
29040
29271
|
});
|
|
29041
29272
|
ToolbarButton.displayName = "ToolbarButton";
|
|
29042
|
-
var ToolbarDivider = () => /* @__PURE__ */ (0,
|
|
29273
|
+
var ToolbarDivider = () => /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "mx-0.5 h-5 w-px bg-border/60" });
|
|
29043
29274
|
var TableInsertGrid = ({
|
|
29044
29275
|
insertLabel,
|
|
29045
29276
|
previewTemplate,
|
|
29046
29277
|
onInsert
|
|
29047
29278
|
}) => {
|
|
29048
|
-
const [selection, setSelection] =
|
|
29279
|
+
const [selection, setSelection] = import_react62.default.useState({ rows: 3, cols: 3 });
|
|
29049
29280
|
const maxRows = 8;
|
|
29050
29281
|
const maxCols = 8;
|
|
29051
|
-
return /* @__PURE__ */ (0,
|
|
29052
|
-
/* @__PURE__ */ (0,
|
|
29053
|
-
/* @__PURE__ */ (0,
|
|
29282
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "mb-2 rounded-xl border border-border/60 bg-muted/20 p-2", children: [
|
|
29283
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "mb-2 text-sm font-medium text-foreground", children: formatTableInsertLabel(previewTemplate, selection.rows, selection.cols) }),
|
|
29284
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "grid grid-cols-8 gap-1", onMouseLeave: () => setSelection((prev) => prev), children: Array.from({ length: maxRows }).map(
|
|
29054
29285
|
(_, rowIndex) => Array.from({ length: maxCols }).map((__, colIndex) => {
|
|
29055
29286
|
const rows = rowIndex + 1;
|
|
29056
29287
|
const cols = colIndex + 1;
|
|
29057
29288
|
const active = rows <= selection.rows && cols <= selection.cols;
|
|
29058
|
-
return /* @__PURE__ */ (0,
|
|
29289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29059
29290
|
"button",
|
|
29060
29291
|
{
|
|
29061
29292
|
type: "button",
|
|
@@ -29073,7 +29304,7 @@ var TableInsertGrid = ({
|
|
|
29073
29304
|
);
|
|
29074
29305
|
})
|
|
29075
29306
|
) }),
|
|
29076
|
-
/* @__PURE__ */ (0,
|
|
29307
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "mt-2 text-xs text-muted-foreground", children: insertLabel })
|
|
29077
29308
|
] });
|
|
29078
29309
|
};
|
|
29079
29310
|
var EditorToolbar = ({
|
|
@@ -29089,18 +29320,18 @@ var EditorToolbar = ({
|
|
|
29089
29320
|
letterSpacings
|
|
29090
29321
|
}) => {
|
|
29091
29322
|
const t = useSmartTranslations("UEditor");
|
|
29092
|
-
(0,
|
|
29323
|
+
(0, import_react63.useEditorState)({
|
|
29093
29324
|
editor,
|
|
29094
29325
|
selector: ({ transactionNumber }) => transactionNumber
|
|
29095
29326
|
});
|
|
29096
29327
|
const { textColors, highlightColors } = useEditorColors();
|
|
29097
|
-
const [showImageInput, setShowImageInput] = (0,
|
|
29098
|
-
const [showLinkInput, setShowLinkInput] = (0,
|
|
29099
|
-
const [isTableMenuOpen, setIsTableMenuOpen] = (0,
|
|
29100
|
-
const tableCommandAnchorPosRef = (0,
|
|
29101
|
-
const fileInputRef = (0,
|
|
29102
|
-
const [isUploadingImage, setIsUploadingImage] = (0,
|
|
29103
|
-
const [imageUploadError, setImageUploadError] = (0,
|
|
29328
|
+
const [showImageInput, setShowImageInput] = (0, import_react62.useState)(false);
|
|
29329
|
+
const [showLinkInput, setShowLinkInput] = (0, import_react62.useState)(false);
|
|
29330
|
+
const [isTableMenuOpen, setIsTableMenuOpen] = (0, import_react62.useState)(false);
|
|
29331
|
+
const tableCommandAnchorPosRef = (0, import_react62.useRef)(null);
|
|
29332
|
+
const fileInputRef = (0, import_react62.useRef)(null);
|
|
29333
|
+
const [isUploadingImage, setIsUploadingImage] = (0, import_react62.useState)(false);
|
|
29334
|
+
const [imageUploadError, setImageUploadError] = (0, import_react62.useState)(null);
|
|
29104
29335
|
const isImageSelected = editor.isActive("image");
|
|
29105
29336
|
const imageAttrs = editor.getAttributes("image");
|
|
29106
29337
|
const tableAnchorPos = getTableAnchorPos(editor);
|
|
@@ -29121,10 +29352,10 @@ var EditorToolbar = ({
|
|
|
29121
29352
|
const currentHighlightColor = normalizeStyleValue(editor.getAttributes("highlight").color) || "";
|
|
29122
29353
|
const currentLineHeight = normalizeStyleValue(textStyleAttrs.lineHeight);
|
|
29123
29354
|
const currentLetterSpacing = normalizeStyleValue(textStyleAttrs.letterSpacing);
|
|
29124
|
-
const availableFontFamilies =
|
|
29125
|
-
const availableFontSizes =
|
|
29126
|
-
const availableLineHeights =
|
|
29127
|
-
const availableLetterSpacings =
|
|
29355
|
+
const availableFontFamilies = import_react62.default.useMemo(() => fontFamilies ?? getDefaultFontFamilies(t), [fontFamilies, t]);
|
|
29356
|
+
const availableFontSizes = import_react62.default.useMemo(() => fontSizes ?? getDefaultFontSizes(), [fontSizes]);
|
|
29357
|
+
const availableLineHeights = import_react62.default.useMemo(() => lineHeights ?? getDefaultLineHeights(), [lineHeights]);
|
|
29358
|
+
const availableLetterSpacings = import_react62.default.useMemo(() => letterSpacings ?? getDefaultLetterSpacings(), [letterSpacings]);
|
|
29128
29359
|
const currentFontFamilyDisplayValue = currentFontFamily.split(",")[0]?.trim() ?? currentFontFamily;
|
|
29129
29360
|
const currentFontFamilyLabel = availableFontFamilies.find((option) => normalizeStyleValue(option.value) === currentFontFamily)?.label ?? (currentFontFamilyDisplayValue || t("toolbar.fontDefault"));
|
|
29130
29361
|
const currentFontSizeLabel = availableFontSizes.find((option) => normalizeStyleValue(option.value) === currentFontSize)?.label ?? t("toolbar.sizeDefault");
|
|
@@ -29153,41 +29384,41 @@ var EditorToolbar = ({
|
|
|
29153
29384
|
setIsUploadingImage(false);
|
|
29154
29385
|
};
|
|
29155
29386
|
if (variant === "minimal") {
|
|
29156
|
-
return /* @__PURE__ */ (0,
|
|
29157
|
-
/* @__PURE__ */ (0,
|
|
29158
|
-
/* @__PURE__ */ (0,
|
|
29159
|
-
/* @__PURE__ */ (0,
|
|
29387
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "flex items-center gap-1 border-b border-border/35 bg-muted/30 p-2", children: [
|
|
29388
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.Bold, { className: "w-4 h-4" }) }),
|
|
29389
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.Italic, { className: "w-4 h-4" }) }),
|
|
29390
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29160
29391
|
ToolbarButton,
|
|
29161
29392
|
{
|
|
29162
29393
|
onClick: () => editor.chain().focus().toggleBulletList().run(),
|
|
29163
29394
|
active: editor.isActive("bulletList"),
|
|
29164
29395
|
title: t("toolbar.bulletList"),
|
|
29165
|
-
children: /* @__PURE__ */ (0,
|
|
29396
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.List, { className: "w-4 h-4" })
|
|
29166
29397
|
}
|
|
29167
29398
|
)
|
|
29168
29399
|
] });
|
|
29169
29400
|
}
|
|
29170
|
-
return /* @__PURE__ */ (0,
|
|
29171
|
-
/* @__PURE__ */ (0,
|
|
29401
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("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: [
|
|
29402
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
|
|
29172
29403
|
DropdownMenu,
|
|
29173
29404
|
{
|
|
29174
|
-
trigger: /* @__PURE__ */ (0,
|
|
29405
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(ToolbarButton, { onClick: () => {
|
|
29175
29406
|
}, title: t("toolbar.fontFamily"), className: "px-1.5 w-auto gap-0.5", children: [
|
|
29176
|
-
/* @__PURE__ */ (0,
|
|
29177
|
-
/* @__PURE__ */ (0,
|
|
29407
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.Baseline, { className: "w-4 h-4" }),
|
|
29408
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.ChevronDown, { className: "h-3 w-3 text-muted-foreground" })
|
|
29178
29409
|
] }),
|
|
29179
29410
|
contentClassName: "max-h-80 overflow-y-auto min-w-56 p-2",
|
|
29180
29411
|
children: [
|
|
29181
|
-
/* @__PURE__ */ (0,
|
|
29412
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29182
29413
|
DropdownMenuItem,
|
|
29183
29414
|
{
|
|
29184
|
-
icon:
|
|
29415
|
+
icon: import_lucide_react49.Type,
|
|
29185
29416
|
label: t("toolbar.fontDefault"),
|
|
29186
29417
|
onClick: () => editor.chain().focus().unsetFontFamily().run(),
|
|
29187
29418
|
active: !currentFontFamily
|
|
29188
29419
|
}
|
|
29189
29420
|
),
|
|
29190
|
-
availableFontFamilies.map((option) => /* @__PURE__ */ (0,
|
|
29421
|
+
availableFontFamilies.map((option) => /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29191
29422
|
DropdownMenuItem,
|
|
29192
29423
|
{
|
|
29193
29424
|
label: option.label,
|
|
@@ -29200,29 +29431,29 @@ var EditorToolbar = ({
|
|
|
29200
29431
|
]
|
|
29201
29432
|
}
|
|
29202
29433
|
),
|
|
29203
|
-
/* @__PURE__ */ (0,
|
|
29434
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
|
|
29204
29435
|
DropdownMenu,
|
|
29205
29436
|
{
|
|
29206
|
-
trigger: /* @__PURE__ */ (0,
|
|
29437
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(ToolbarButton, { onClick: () => {
|
|
29207
29438
|
}, title: t("toolbar.fontSize"), className: "px-1.5 w-auto gap-0.5", children: [
|
|
29208
|
-
/* @__PURE__ */ (0,
|
|
29209
|
-
/* @__PURE__ */ (0,
|
|
29210
|
-
/* @__PURE__ */ (0,
|
|
29439
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "flex items-center gap-0.5", children: [
|
|
29440
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.ChevronsUpDown, { className: "h-3 w-3 text-muted-foreground", strokeWidth: 2.5 }),
|
|
29441
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("span", { className: "text-xs font-bold leading-none", children: "A" })
|
|
29211
29442
|
] }),
|
|
29212
|
-
/* @__PURE__ */ (0,
|
|
29443
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.ChevronDown, { className: "h-3 w-3 text-muted-foreground" })
|
|
29213
29444
|
] }),
|
|
29214
29445
|
contentClassName: "max-h-80 overflow-y-auto min-w-32 p-2",
|
|
29215
29446
|
children: [
|
|
29216
|
-
/* @__PURE__ */ (0,
|
|
29447
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29217
29448
|
DropdownMenuItem,
|
|
29218
29449
|
{
|
|
29219
|
-
icon:
|
|
29450
|
+
icon: import_lucide_react49.Type,
|
|
29220
29451
|
label: t("toolbar.sizeDefault"),
|
|
29221
29452
|
onClick: () => editor.chain().focus().unsetFontSize().run(),
|
|
29222
29453
|
active: !currentFontSize
|
|
29223
29454
|
}
|
|
29224
29455
|
),
|
|
29225
|
-
availableFontSizes.map((option) => /* @__PURE__ */ (0,
|
|
29456
|
+
availableFontSizes.map((option) => /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29226
29457
|
DropdownMenuItem,
|
|
29227
29458
|
{
|
|
29228
29459
|
label: option.label,
|
|
@@ -29234,49 +29465,49 @@ var EditorToolbar = ({
|
|
|
29234
29465
|
]
|
|
29235
29466
|
}
|
|
29236
29467
|
),
|
|
29237
|
-
/* @__PURE__ */ (0,
|
|
29468
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
|
|
29238
29469
|
DropdownMenu,
|
|
29239
29470
|
{
|
|
29240
29471
|
contentClassName: "p-1",
|
|
29241
|
-
trigger: /* @__PURE__ */ (0,
|
|
29472
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(ToolbarButton, { onClick: () => {
|
|
29242
29473
|
}, title: t("toolbar.textStyle"), className: "px-1.5 w-auto gap-0.5", children: [
|
|
29243
|
-
/* @__PURE__ */ (0,
|
|
29244
|
-
/* @__PURE__ */ (0,
|
|
29474
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.Type, { className: "w-4 h-4" }),
|
|
29475
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.ChevronDown, { className: "h-3 w-3 text-muted-foreground" })
|
|
29245
29476
|
] }),
|
|
29246
29477
|
children: [
|
|
29247
|
-
/* @__PURE__ */ (0,
|
|
29478
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29248
29479
|
DropdownMenuItem,
|
|
29249
29480
|
{
|
|
29250
|
-
icon:
|
|
29481
|
+
icon: import_lucide_react49.Type,
|
|
29251
29482
|
label: t("toolbar.normal"),
|
|
29252
29483
|
onClick: () => editor.chain().focus().setParagraph().run(),
|
|
29253
29484
|
active: editor.isActive("paragraph")
|
|
29254
29485
|
}
|
|
29255
29486
|
),
|
|
29256
|
-
/* @__PURE__ */ (0,
|
|
29487
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29257
29488
|
DropdownMenuItem,
|
|
29258
29489
|
{
|
|
29259
|
-
icon:
|
|
29490
|
+
icon: import_lucide_react49.Heading1,
|
|
29260
29491
|
label: t("toolbar.heading1"),
|
|
29261
29492
|
onClick: () => editor.chain().focus().toggleHeading({ level: 1 }).run(),
|
|
29262
29493
|
active: editor.isActive("heading", { level: 1 }),
|
|
29263
29494
|
shortcut: "Ctrl+Alt+1"
|
|
29264
29495
|
}
|
|
29265
29496
|
),
|
|
29266
|
-
/* @__PURE__ */ (0,
|
|
29497
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29267
29498
|
DropdownMenuItem,
|
|
29268
29499
|
{
|
|
29269
|
-
icon:
|
|
29500
|
+
icon: import_lucide_react49.Heading2,
|
|
29270
29501
|
label: t("toolbar.heading2"),
|
|
29271
29502
|
onClick: () => editor.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
29272
29503
|
active: editor.isActive("heading", { level: 2 }),
|
|
29273
29504
|
shortcut: "Ctrl+Alt+2"
|
|
29274
29505
|
}
|
|
29275
29506
|
),
|
|
29276
|
-
/* @__PURE__ */ (0,
|
|
29507
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29277
29508
|
DropdownMenuItem,
|
|
29278
29509
|
{
|
|
29279
|
-
icon:
|
|
29510
|
+
icon: import_lucide_react49.Heading3,
|
|
29280
29511
|
label: t("toolbar.heading3"),
|
|
29281
29512
|
onClick: () => editor.chain().focus().toggleHeading({ level: 3 }).run(),
|
|
29282
29513
|
active: editor.isActive("heading", { level: 3 }),
|
|
@@ -29286,26 +29517,26 @@ var EditorToolbar = ({
|
|
|
29286
29517
|
]
|
|
29287
29518
|
}
|
|
29288
29519
|
),
|
|
29289
|
-
/* @__PURE__ */ (0,
|
|
29520
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
|
|
29290
29521
|
DropdownMenu,
|
|
29291
29522
|
{
|
|
29292
|
-
trigger: /* @__PURE__ */ (0,
|
|
29523
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(ToolbarButton, { onClick: () => {
|
|
29293
29524
|
}, title: t("toolbar.lineHeight"), className: "gap-0.5", children: [
|
|
29294
|
-
/* @__PURE__ */ (0,
|
|
29295
|
-
/* @__PURE__ */ (0,
|
|
29525
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.ArrowUp, { className: "w-3 h-3" }),
|
|
29526
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.ArrowDown, { className: "w-3 h-3" })
|
|
29296
29527
|
] }),
|
|
29297
29528
|
contentClassName: "max-h-72 overflow-y-auto p-1",
|
|
29298
29529
|
children: [
|
|
29299
|
-
/* @__PURE__ */ (0,
|
|
29530
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29300
29531
|
DropdownMenuItem,
|
|
29301
29532
|
{
|
|
29302
|
-
icon:
|
|
29533
|
+
icon: import_lucide_react49.Type,
|
|
29303
29534
|
label: t("toolbar.lineHeightDefault"),
|
|
29304
29535
|
onClick: () => editor.chain().focus().unsetLineHeight().run(),
|
|
29305
29536
|
active: !currentLineHeight
|
|
29306
29537
|
}
|
|
29307
29538
|
),
|
|
29308
|
-
availableLineHeights.map((option) => /* @__PURE__ */ (0,
|
|
29539
|
+
availableLineHeights.map((option) => /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29309
29540
|
DropdownMenuItem,
|
|
29310
29541
|
{
|
|
29311
29542
|
label: option.label,
|
|
@@ -29317,26 +29548,26 @@ var EditorToolbar = ({
|
|
|
29317
29548
|
]
|
|
29318
29549
|
}
|
|
29319
29550
|
),
|
|
29320
|
-
/* @__PURE__ */ (0,
|
|
29551
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
|
|
29321
29552
|
DropdownMenu,
|
|
29322
29553
|
{
|
|
29323
|
-
trigger: /* @__PURE__ */ (0,
|
|
29554
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(ToolbarButton, { onClick: () => {
|
|
29324
29555
|
}, title: t("toolbar.letterSpacing"), className: "gap-0.5", children: [
|
|
29325
|
-
/* @__PURE__ */ (0,
|
|
29326
|
-
/* @__PURE__ */ (0,
|
|
29556
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.ArrowLeft, { className: "w-3 h-3" }),
|
|
29557
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.ArrowRight, { className: "w-3 h-3" })
|
|
29327
29558
|
] }),
|
|
29328
29559
|
contentClassName: "max-h-72 overflow-y-auto p-1",
|
|
29329
29560
|
children: [
|
|
29330
|
-
/* @__PURE__ */ (0,
|
|
29561
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29331
29562
|
DropdownMenuItem,
|
|
29332
29563
|
{
|
|
29333
|
-
icon:
|
|
29564
|
+
icon: import_lucide_react49.Type,
|
|
29334
29565
|
label: t("toolbar.letterSpacingDefault"),
|
|
29335
29566
|
onClick: () => editor.chain().focus().unsetLetterSpacing().run(),
|
|
29336
29567
|
active: !currentLetterSpacing
|
|
29337
29568
|
}
|
|
29338
29569
|
),
|
|
29339
|
-
availableLetterSpacings.map((option) => /* @__PURE__ */ (0,
|
|
29570
|
+
availableLetterSpacings.map((option) => /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29340
29571
|
DropdownMenuItem,
|
|
29341
29572
|
{
|
|
29342
29573
|
label: option.label,
|
|
@@ -29348,44 +29579,44 @@ var EditorToolbar = ({
|
|
|
29348
29579
|
]
|
|
29349
29580
|
}
|
|
29350
29581
|
),
|
|
29351
|
-
/* @__PURE__ */ (0,
|
|
29352
|
-
/* @__PURE__ */ (0,
|
|
29353
|
-
/* @__PURE__ */ (0,
|
|
29354
|
-
/* @__PURE__ */ (0,
|
|
29582
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(ToolbarDivider, {}),
|
|
29583
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.Bold, { className: "w-4 h-4" }) }),
|
|
29584
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.Italic, { className: "w-4 h-4" }) }),
|
|
29585
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29355
29586
|
ToolbarButton,
|
|
29356
29587
|
{
|
|
29357
29588
|
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
29358
29589
|
active: editor.isActive("underline"),
|
|
29359
29590
|
title: t("toolbar.underline"),
|
|
29360
|
-
children: /* @__PURE__ */ (0,
|
|
29591
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.Underline, { className: "w-4 h-4" })
|
|
29361
29592
|
}
|
|
29362
29593
|
),
|
|
29363
|
-
/* @__PURE__ */ (0,
|
|
29364
|
-
/* @__PURE__ */ (0,
|
|
29365
|
-
/* @__PURE__ */ (0,
|
|
29594
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleStrike().run(), active: editor.isActive("strike"), title: t("toolbar.strike"), children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.Strikethrough, { className: "w-4 h-4" }) }),
|
|
29595
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleCode().run(), active: editor.isActive("code"), title: t("toolbar.code"), children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.Code, { className: "w-4 h-4" }) }),
|
|
29596
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29366
29597
|
ToolbarButton,
|
|
29367
29598
|
{
|
|
29368
29599
|
onClick: () => editor.chain().focus().toggleSubscript().run(),
|
|
29369
29600
|
active: editor.isActive("subscript"),
|
|
29370
29601
|
title: t("toolbar.subscript"),
|
|
29371
|
-
children: /* @__PURE__ */ (0,
|
|
29602
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.Subscript, { className: "w-4 h-4" })
|
|
29372
29603
|
}
|
|
29373
29604
|
),
|
|
29374
|
-
/* @__PURE__ */ (0,
|
|
29605
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29375
29606
|
ToolbarButton,
|
|
29376
29607
|
{
|
|
29377
29608
|
onClick: () => editor.chain().focus().toggleSuperscript().run(),
|
|
29378
29609
|
active: editor.isActive("superscript"),
|
|
29379
29610
|
title: t("toolbar.superscript"),
|
|
29380
|
-
children: /* @__PURE__ */ (0,
|
|
29611
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.Superscript, { className: "w-4 h-4" })
|
|
29381
29612
|
}
|
|
29382
29613
|
),
|
|
29383
|
-
/* @__PURE__ */ (0,
|
|
29614
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29384
29615
|
DropdownMenu,
|
|
29385
29616
|
{
|
|
29386
29617
|
contentClassName: "min-w-72",
|
|
29387
|
-
trigger: /* @__PURE__ */ (0,
|
|
29388
|
-
children: showLinkInput ? /* @__PURE__ */ (0,
|
|
29618
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(ToolbarButton, { onClick: () => setShowLinkInput(!editor.isActive("link")), active: editor.isActive("link"), title: t("toolbar.link"), children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.Link, { className: "w-4 h-4" }) }),
|
|
29619
|
+
children: showLinkInput ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29389
29620
|
LinkInput,
|
|
29390
29621
|
{
|
|
29391
29622
|
initialUrl: String(editor.getAttributes("link").href ?? ""),
|
|
@@ -29395,21 +29626,21 @@ var EditorToolbar = ({
|
|
|
29395
29626
|
},
|
|
29396
29627
|
onCancel: () => setShowLinkInput(false)
|
|
29397
29628
|
}
|
|
29398
|
-
) : /* @__PURE__ */ (0,
|
|
29399
|
-
/* @__PURE__ */ (0,
|
|
29629
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(import_jsx_runtime86.Fragment, { children: [
|
|
29630
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29400
29631
|
DropdownMenuItem,
|
|
29401
29632
|
{
|
|
29402
|
-
icon:
|
|
29633
|
+
icon: import_lucide_react49.Link,
|
|
29403
29634
|
label: t("toolbar.link"),
|
|
29404
29635
|
onClick: () => setShowLinkInput(true),
|
|
29405
29636
|
active: editor.isActive("link"),
|
|
29406
29637
|
closeOnSelect: false
|
|
29407
29638
|
}
|
|
29408
29639
|
),
|
|
29409
|
-
/* @__PURE__ */ (0,
|
|
29640
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29410
29641
|
DropdownMenuItem,
|
|
29411
29642
|
{
|
|
29412
|
-
icon:
|
|
29643
|
+
icon: import_lucide_react49.Trash2,
|
|
29413
29644
|
label: t("toolbar.removeLink"),
|
|
29414
29645
|
onClick: () => editor.chain().focus().extendMarkRange("link").unsetLink().run(),
|
|
29415
29646
|
disabled: !editor.isActive("link"),
|
|
@@ -29419,16 +29650,16 @@ var EditorToolbar = ({
|
|
|
29419
29650
|
] })
|
|
29420
29651
|
}
|
|
29421
29652
|
),
|
|
29422
|
-
/* @__PURE__ */ (0,
|
|
29423
|
-
/* @__PURE__ */ (0,
|
|
29653
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(ToolbarDivider, {}),
|
|
29654
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29424
29655
|
DropdownMenu,
|
|
29425
29656
|
{
|
|
29426
|
-
trigger: /* @__PURE__ */ (0,
|
|
29657
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(ToolbarButton, { onClick: () => {
|
|
29427
29658
|
}, title: t("colors.textColor"), children: [
|
|
29428
|
-
/* @__PURE__ */ (0,
|
|
29429
|
-
/* @__PURE__ */ (0,
|
|
29659
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(TextColorIcon, { color: currentTextColor }),
|
|
29660
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.ChevronDown, { className: "w-3 h-3" })
|
|
29430
29661
|
] }),
|
|
29431
|
-
children: /* @__PURE__ */ (0,
|
|
29662
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29432
29663
|
EditorColorPalette,
|
|
29433
29664
|
{
|
|
29434
29665
|
colors: textColors,
|
|
@@ -29445,15 +29676,15 @@ var EditorToolbar = ({
|
|
|
29445
29676
|
)
|
|
29446
29677
|
}
|
|
29447
29678
|
),
|
|
29448
|
-
/* @__PURE__ */ (0,
|
|
29679
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29449
29680
|
DropdownMenu,
|
|
29450
29681
|
{
|
|
29451
|
-
trigger: /* @__PURE__ */ (0,
|
|
29682
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(ToolbarButton, { onClick: () => {
|
|
29452
29683
|
}, active: editor.isActive("highlight"), title: t("colors.highlight"), children: [
|
|
29453
|
-
/* @__PURE__ */ (0,
|
|
29454
|
-
/* @__PURE__ */ (0,
|
|
29684
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(HighlightColorIcon, { color: currentHighlightColor }),
|
|
29685
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.ChevronDown, { className: "w-3 h-3" })
|
|
29455
29686
|
] }),
|
|
29456
|
-
children: /* @__PURE__ */ (0,
|
|
29687
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29457
29688
|
EditorColorPalette,
|
|
29458
29689
|
{
|
|
29459
29690
|
colors: highlightColors,
|
|
@@ -29470,14 +29701,14 @@ var EditorToolbar = ({
|
|
|
29470
29701
|
)
|
|
29471
29702
|
}
|
|
29472
29703
|
),
|
|
29473
|
-
/* @__PURE__ */ (0,
|
|
29474
|
-
/* @__PURE__ */ (0,
|
|
29704
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(ToolbarDivider, {}),
|
|
29705
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29475
29706
|
DropdownMenu,
|
|
29476
29707
|
{
|
|
29477
29708
|
contentClassName: "p-0 overflow-hidden",
|
|
29478
|
-
trigger: /* @__PURE__ */ (0,
|
|
29479
|
-
}, title: t("toolbar.emoji"), children: /* @__PURE__ */ (0,
|
|
29480
|
-
children: /* @__PURE__ */ (0,
|
|
29709
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(ToolbarButton, { onClick: () => {
|
|
29710
|
+
}, title: t("toolbar.emoji"), children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.Smile, { className: "w-4 h-4" }) }),
|
|
29711
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29481
29712
|
EmojiPicker2,
|
|
29482
29713
|
{
|
|
29483
29714
|
onSelect: (emoji) => {
|
|
@@ -29487,47 +29718,47 @@ var EditorToolbar = ({
|
|
|
29487
29718
|
)
|
|
29488
29719
|
}
|
|
29489
29720
|
),
|
|
29490
|
-
/* @__PURE__ */ (0,
|
|
29491
|
-
/* @__PURE__ */ (0,
|
|
29721
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(ToolbarDivider, {}),
|
|
29722
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
|
|
29492
29723
|
DropdownMenu,
|
|
29493
29724
|
{
|
|
29494
|
-
trigger: /* @__PURE__ */ (0,
|
|
29725
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(ToolbarButton, { onClick: () => {
|
|
29495
29726
|
}, title: t("toolbar.alignment"), children: [
|
|
29496
|
-
/* @__PURE__ */ (0,
|
|
29497
|
-
/* @__PURE__ */ (0,
|
|
29727
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.AlignLeft, { className: "w-4 h-4" }),
|
|
29728
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.ChevronDown, { className: "w-3 h-3" })
|
|
29498
29729
|
] }),
|
|
29499
29730
|
children: [
|
|
29500
|
-
/* @__PURE__ */ (0,
|
|
29731
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29501
29732
|
DropdownMenuItem,
|
|
29502
29733
|
{
|
|
29503
|
-
icon:
|
|
29734
|
+
icon: import_lucide_react49.AlignLeft,
|
|
29504
29735
|
label: t("toolbar.alignLeft"),
|
|
29505
29736
|
onClick: () => editor.chain().focus().setTextAlign("left").run(),
|
|
29506
29737
|
active: editor.isActive({ textAlign: "left" })
|
|
29507
29738
|
}
|
|
29508
29739
|
),
|
|
29509
|
-
/* @__PURE__ */ (0,
|
|
29740
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29510
29741
|
DropdownMenuItem,
|
|
29511
29742
|
{
|
|
29512
|
-
icon:
|
|
29743
|
+
icon: import_lucide_react49.AlignCenter,
|
|
29513
29744
|
label: t("toolbar.alignCenter"),
|
|
29514
29745
|
onClick: () => editor.chain().focus().setTextAlign("center").run(),
|
|
29515
29746
|
active: editor.isActive({ textAlign: "center" })
|
|
29516
29747
|
}
|
|
29517
29748
|
),
|
|
29518
|
-
/* @__PURE__ */ (0,
|
|
29749
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29519
29750
|
DropdownMenuItem,
|
|
29520
29751
|
{
|
|
29521
|
-
icon:
|
|
29752
|
+
icon: import_lucide_react49.AlignRight,
|
|
29522
29753
|
label: t("toolbar.alignRight"),
|
|
29523
29754
|
onClick: () => editor.chain().focus().setTextAlign("right").run(),
|
|
29524
29755
|
active: editor.isActive({ textAlign: "right" })
|
|
29525
29756
|
}
|
|
29526
29757
|
),
|
|
29527
|
-
/* @__PURE__ */ (0,
|
|
29758
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29528
29759
|
DropdownMenuItem,
|
|
29529
29760
|
{
|
|
29530
|
-
icon:
|
|
29761
|
+
icon: import_lucide_react49.AlignJustify,
|
|
29531
29762
|
label: t("toolbar.justify"),
|
|
29532
29763
|
onClick: () => editor.chain().focus().setTextAlign("justify").run(),
|
|
29533
29764
|
active: editor.isActive({ textAlign: "justify" })
|
|
@@ -29536,40 +29767,40 @@ var EditorToolbar = ({
|
|
|
29536
29767
|
]
|
|
29537
29768
|
}
|
|
29538
29769
|
),
|
|
29539
|
-
/* @__PURE__ */ (0,
|
|
29540
|
-
/* @__PURE__ */ (0,
|
|
29770
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(ToolbarDivider, {}),
|
|
29771
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
|
|
29541
29772
|
DropdownMenu,
|
|
29542
29773
|
{
|
|
29543
|
-
trigger: /* @__PURE__ */ (0,
|
|
29774
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(ToolbarButton, { onClick: () => {
|
|
29544
29775
|
}, title: t("toolbar.bulletList"), children: [
|
|
29545
|
-
/* @__PURE__ */ (0,
|
|
29546
|
-
/* @__PURE__ */ (0,
|
|
29776
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.List, { className: "w-4 h-4" }),
|
|
29777
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.ChevronDown, { className: "w-3 h-3" })
|
|
29547
29778
|
] }),
|
|
29548
29779
|
children: [
|
|
29549
|
-
/* @__PURE__ */ (0,
|
|
29780
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29550
29781
|
DropdownMenuItem,
|
|
29551
29782
|
{
|
|
29552
|
-
icon:
|
|
29783
|
+
icon: import_lucide_react49.List,
|
|
29553
29784
|
label: t("toolbar.bulletList"),
|
|
29554
29785
|
onClick: () => editor.chain().focus().toggleBulletList().run(),
|
|
29555
29786
|
active: editor.isActive("bulletList"),
|
|
29556
29787
|
shortcut: "Ctrl+Shift+8"
|
|
29557
29788
|
}
|
|
29558
29789
|
),
|
|
29559
|
-
/* @__PURE__ */ (0,
|
|
29790
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29560
29791
|
DropdownMenuItem,
|
|
29561
29792
|
{
|
|
29562
|
-
icon:
|
|
29793
|
+
icon: import_lucide_react49.ListOrdered,
|
|
29563
29794
|
label: t("toolbar.orderedList"),
|
|
29564
29795
|
onClick: () => editor.chain().focus().toggleOrderedList().run(),
|
|
29565
29796
|
active: editor.isActive("orderedList"),
|
|
29566
29797
|
shortcut: "Ctrl+Shift+7"
|
|
29567
29798
|
}
|
|
29568
29799
|
),
|
|
29569
|
-
/* @__PURE__ */ (0,
|
|
29800
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29570
29801
|
DropdownMenuItem,
|
|
29571
29802
|
{
|
|
29572
|
-
icon:
|
|
29803
|
+
icon: import_lucide_react49.ListTodo,
|
|
29573
29804
|
label: t("toolbar.taskList"),
|
|
29574
29805
|
onClick: () => editor.chain().focus().toggleTaskList().run(),
|
|
29575
29806
|
active: editor.isActive("taskList"),
|
|
@@ -29579,29 +29810,29 @@ var EditorToolbar = ({
|
|
|
29579
29810
|
]
|
|
29580
29811
|
}
|
|
29581
29812
|
),
|
|
29582
|
-
/* @__PURE__ */ (0,
|
|
29813
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
|
|
29583
29814
|
DropdownMenu,
|
|
29584
29815
|
{
|
|
29585
|
-
trigger: /* @__PURE__ */ (0,
|
|
29816
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(ToolbarButton, { onClick: () => {
|
|
29586
29817
|
}, title: t("toolbar.quote"), children: [
|
|
29587
|
-
/* @__PURE__ */ (0,
|
|
29588
|
-
/* @__PURE__ */ (0,
|
|
29818
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.Quote, { className: "w-4 h-4" }),
|
|
29819
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.ChevronDown, { className: "w-3 h-3" })
|
|
29589
29820
|
] }),
|
|
29590
29821
|
children: [
|
|
29591
|
-
/* @__PURE__ */ (0,
|
|
29822
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29592
29823
|
DropdownMenuItem,
|
|
29593
29824
|
{
|
|
29594
|
-
icon:
|
|
29825
|
+
icon: import_lucide_react49.Quote,
|
|
29595
29826
|
label: t("toolbar.quote"),
|
|
29596
29827
|
onClick: () => editor.chain().focus().toggleBlockquote().run(),
|
|
29597
29828
|
active: editor.isActive("blockquote"),
|
|
29598
29829
|
shortcut: "Ctrl+Shift+B"
|
|
29599
29830
|
}
|
|
29600
29831
|
),
|
|
29601
|
-
/* @__PURE__ */ (0,
|
|
29832
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29602
29833
|
DropdownMenuItem,
|
|
29603
29834
|
{
|
|
29604
|
-
icon:
|
|
29835
|
+
icon: import_lucide_react49.FileCode,
|
|
29605
29836
|
label: t("toolbar.codeBlock"),
|
|
29606
29837
|
onClick: () => editor.chain().focus().toggleCodeBlock().run(),
|
|
29607
29838
|
active: editor.isActive("codeBlock"),
|
|
@@ -29611,15 +29842,15 @@ var EditorToolbar = ({
|
|
|
29611
29842
|
]
|
|
29612
29843
|
}
|
|
29613
29844
|
),
|
|
29614
|
-
/* @__PURE__ */ (0,
|
|
29845
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29615
29846
|
DropdownMenu,
|
|
29616
29847
|
{
|
|
29617
|
-
trigger: /* @__PURE__ */ (0,
|
|
29848
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(ToolbarButton, { onClick: () => {
|
|
29618
29849
|
}, title: t("toolbar.image"), children: [
|
|
29619
|
-
/* @__PURE__ */ (0,
|
|
29620
|
-
/* @__PURE__ */ (0,
|
|
29850
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.Image, { className: "w-4 h-4" }),
|
|
29851
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.ChevronDown, { className: "w-3 h-3" })
|
|
29621
29852
|
] }),
|
|
29622
|
-
children: showImageInput ? /* @__PURE__ */ (0,
|
|
29853
|
+
children: showImageInput ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29623
29854
|
ImageInput,
|
|
29624
29855
|
{
|
|
29625
29856
|
onSubmit: (url, alt) => {
|
|
@@ -29628,20 +29859,20 @@ var EditorToolbar = ({
|
|
|
29628
29859
|
},
|
|
29629
29860
|
onCancel: () => setShowImageInput(false)
|
|
29630
29861
|
}
|
|
29631
|
-
) : /* @__PURE__ */ (0,
|
|
29632
|
-
/* @__PURE__ */ (0,
|
|
29633
|
-
/* @__PURE__ */ (0,
|
|
29862
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(import_jsx_runtime86.Fragment, { children: [
|
|
29863
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(DropdownMenuItem, { icon: import_lucide_react49.Link, label: t("imageInput.addFromUrl"), onClick: () => setShowImageInput(true), closeOnSelect: false }),
|
|
29864
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29634
29865
|
DropdownMenuItem,
|
|
29635
29866
|
{
|
|
29636
|
-
icon:
|
|
29867
|
+
icon: import_lucide_react49.Upload,
|
|
29637
29868
|
label: isUploadingImage ? t("imageInput.uploading") : t("imageInput.uploadTab"),
|
|
29638
29869
|
disabled: isUploadingImage,
|
|
29639
29870
|
onClick: () => fileInputRef.current?.click(),
|
|
29640
29871
|
closeOnSelect: false
|
|
29641
29872
|
}
|
|
29642
29873
|
),
|
|
29643
|
-
imageUploadError && /* @__PURE__ */ (0,
|
|
29644
|
-
/* @__PURE__ */ (0,
|
|
29874
|
+
imageUploadError && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(DropdownMenuItem, { label: imageUploadError, disabled: true, destructive: true }),
|
|
29875
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29645
29876
|
"input",
|
|
29646
29877
|
{
|
|
29647
29878
|
ref: fileInputRef,
|
|
@@ -29656,39 +29887,39 @@ var EditorToolbar = ({
|
|
|
29656
29887
|
}
|
|
29657
29888
|
}
|
|
29658
29889
|
),
|
|
29659
|
-
/* @__PURE__ */ (0,
|
|
29660
|
-
/* @__PURE__ */ (0,
|
|
29890
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "my-1 border-t" }),
|
|
29891
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29661
29892
|
DropdownMenuItem,
|
|
29662
29893
|
{
|
|
29663
|
-
icon:
|
|
29894
|
+
icon: import_lucide_react49.AlignCenter,
|
|
29664
29895
|
label: t("toolbar.imageLayoutBlock"),
|
|
29665
29896
|
onClick: () => applyImageLayout(editor, "block"),
|
|
29666
29897
|
active: isImageSelected && imageLayout === "block",
|
|
29667
29898
|
disabled: !isImageSelected
|
|
29668
29899
|
}
|
|
29669
29900
|
),
|
|
29670
|
-
/* @__PURE__ */ (0,
|
|
29901
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29671
29902
|
DropdownMenuItem,
|
|
29672
29903
|
{
|
|
29673
|
-
icon:
|
|
29904
|
+
icon: import_lucide_react49.AlignLeft,
|
|
29674
29905
|
label: t("toolbar.imageLayoutLeft"),
|
|
29675
29906
|
onClick: () => applyImageLayout(editor, "left"),
|
|
29676
29907
|
active: isImageSelected && imageLayout === "left",
|
|
29677
29908
|
disabled: !isImageSelected
|
|
29678
29909
|
}
|
|
29679
29910
|
),
|
|
29680
|
-
/* @__PURE__ */ (0,
|
|
29911
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29681
29912
|
DropdownMenuItem,
|
|
29682
29913
|
{
|
|
29683
|
-
icon:
|
|
29914
|
+
icon: import_lucide_react49.AlignRight,
|
|
29684
29915
|
label: t("toolbar.imageLayoutRight"),
|
|
29685
29916
|
onClick: () => applyImageLayout(editor, "right"),
|
|
29686
29917
|
active: isImageSelected && imageLayout === "right",
|
|
29687
29918
|
disabled: !isImageSelected
|
|
29688
29919
|
}
|
|
29689
29920
|
),
|
|
29690
|
-
/* @__PURE__ */ (0,
|
|
29691
|
-
/* @__PURE__ */ (0,
|
|
29921
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "my-1 border-t" }),
|
|
29922
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29692
29923
|
DropdownMenuItem,
|
|
29693
29924
|
{
|
|
29694
29925
|
label: t("toolbar.imageWidthSm"),
|
|
@@ -29697,7 +29928,7 @@ var EditorToolbar = ({
|
|
|
29697
29928
|
disabled: !isImageSelected
|
|
29698
29929
|
}
|
|
29699
29930
|
),
|
|
29700
|
-
/* @__PURE__ */ (0,
|
|
29931
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29701
29932
|
DropdownMenuItem,
|
|
29702
29933
|
{
|
|
29703
29934
|
label: t("toolbar.imageWidthMd"),
|
|
@@ -29706,7 +29937,7 @@ var EditorToolbar = ({
|
|
|
29706
29937
|
disabled: !isImageSelected
|
|
29707
29938
|
}
|
|
29708
29939
|
),
|
|
29709
|
-
/* @__PURE__ */ (0,
|
|
29940
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29710
29941
|
DropdownMenuItem,
|
|
29711
29942
|
{
|
|
29712
29943
|
label: t("toolbar.imageWidthLg"),
|
|
@@ -29715,20 +29946,20 @@ var EditorToolbar = ({
|
|
|
29715
29946
|
disabled: !isImageSelected
|
|
29716
29947
|
}
|
|
29717
29948
|
),
|
|
29718
|
-
/* @__PURE__ */ (0,
|
|
29719
|
-
/* @__PURE__ */ (0,
|
|
29949
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "my-1 border-t" }),
|
|
29950
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29720
29951
|
DropdownMenuItem,
|
|
29721
29952
|
{
|
|
29722
|
-
icon:
|
|
29953
|
+
icon: import_lucide_react49.RotateCcw,
|
|
29723
29954
|
label: t("toolbar.imageResetSize"),
|
|
29724
29955
|
onClick: () => resetImageSize(editor),
|
|
29725
29956
|
disabled: !isImageSelected
|
|
29726
29957
|
}
|
|
29727
29958
|
),
|
|
29728
|
-
/* @__PURE__ */ (0,
|
|
29959
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29729
29960
|
DropdownMenuItem,
|
|
29730
29961
|
{
|
|
29731
|
-
icon:
|
|
29962
|
+
icon: import_lucide_react49.Trash2,
|
|
29732
29963
|
label: t("toolbar.imageDelete"),
|
|
29733
29964
|
onClick: () => deleteSelectedImage(editor),
|
|
29734
29965
|
disabled: !isImageSelected,
|
|
@@ -29738,7 +29969,7 @@ var EditorToolbar = ({
|
|
|
29738
29969
|
] })
|
|
29739
29970
|
}
|
|
29740
29971
|
),
|
|
29741
|
-
/* @__PURE__ */ (0,
|
|
29972
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
|
|
29742
29973
|
DropdownMenu,
|
|
29743
29974
|
{
|
|
29744
29975
|
isOpen: isTableMenuOpen,
|
|
@@ -29746,14 +29977,14 @@ var EditorToolbar = ({
|
|
|
29746
29977
|
setIsTableMenuOpen(open);
|
|
29747
29978
|
tableCommandAnchorPosRef.current = open ? getTableAnchorPos(editor) : null;
|
|
29748
29979
|
},
|
|
29749
|
-
trigger: /* @__PURE__ */ (0,
|
|
29980
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(ToolbarButton, { onClick: () => {
|
|
29750
29981
|
}, title: t("toolbar.table"), children: [
|
|
29751
|
-
/* @__PURE__ */ (0,
|
|
29752
|
-
/* @__PURE__ */ (0,
|
|
29982
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.Table, { className: "w-4 h-4" }),
|
|
29983
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.ChevronDown, { className: "w-3 h-3" })
|
|
29753
29984
|
] }),
|
|
29754
29985
|
contentClassName: "p-2 min-w-56",
|
|
29755
29986
|
children: [
|
|
29756
|
-
/* @__PURE__ */ (0,
|
|
29987
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29757
29988
|
TableInsertGrid,
|
|
29758
29989
|
{
|
|
29759
29990
|
insertLabel: t("tableMenu.insertTable"),
|
|
@@ -29764,116 +29995,116 @@ var EditorToolbar = ({
|
|
|
29764
29995
|
}
|
|
29765
29996
|
}
|
|
29766
29997
|
),
|
|
29767
|
-
/* @__PURE__ */ (0,
|
|
29768
|
-
/* @__PURE__ */ (0,
|
|
29998
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "my-1 border-t" }),
|
|
29999
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29769
30000
|
DropdownMenuItem,
|
|
29770
30001
|
{
|
|
29771
|
-
icon:
|
|
30002
|
+
icon: import_lucide_react49.AlignLeft,
|
|
29772
30003
|
label: t("tableMenu.alignLeft"),
|
|
29773
30004
|
onClick: () => applyTableAlignment(editor, "left", tableCommandAnchorPos),
|
|
29774
30005
|
active: hasTableContext && currentTableAlign === "left",
|
|
29775
30006
|
disabled: !hasTableContext
|
|
29776
30007
|
}
|
|
29777
30008
|
),
|
|
29778
|
-
/* @__PURE__ */ (0,
|
|
30009
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29779
30010
|
DropdownMenuItem,
|
|
29780
30011
|
{
|
|
29781
|
-
icon:
|
|
30012
|
+
icon: import_lucide_react49.AlignCenter,
|
|
29782
30013
|
label: t("tableMenu.alignCenter"),
|
|
29783
30014
|
onClick: () => applyTableAlignment(editor, "center", tableCommandAnchorPos),
|
|
29784
30015
|
active: hasTableContext && currentTableAlign === "center",
|
|
29785
30016
|
disabled: !hasTableContext
|
|
29786
30017
|
}
|
|
29787
30018
|
),
|
|
29788
|
-
/* @__PURE__ */ (0,
|
|
30019
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29789
30020
|
DropdownMenuItem,
|
|
29790
30021
|
{
|
|
29791
|
-
icon:
|
|
30022
|
+
icon: import_lucide_react49.AlignRight,
|
|
29792
30023
|
label: t("tableMenu.alignRight"),
|
|
29793
30024
|
onClick: () => applyTableAlignment(editor, "right", tableCommandAnchorPos),
|
|
29794
30025
|
active: hasTableContext && currentTableAlign === "right",
|
|
29795
30026
|
disabled: !hasTableContext
|
|
29796
30027
|
}
|
|
29797
30028
|
),
|
|
29798
|
-
/* @__PURE__ */ (0,
|
|
29799
|
-
/* @__PURE__ */ (0,
|
|
30029
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "my-1 border-t" }),
|
|
30030
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29800
30031
|
DropdownMenuItem,
|
|
29801
30032
|
{
|
|
29802
|
-
icon:
|
|
30033
|
+
icon: import_lucide_react49.ArrowLeft,
|
|
29803
30034
|
label: t("tableMenu.addColumnBefore"),
|
|
29804
30035
|
onClick: () => editor.chain().focus().addColumnBefore().run(),
|
|
29805
30036
|
disabled: !hasTableContext || !editor.can().addColumnBefore()
|
|
29806
30037
|
}
|
|
29807
30038
|
),
|
|
29808
|
-
/* @__PURE__ */ (0,
|
|
30039
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29809
30040
|
DropdownMenuItem,
|
|
29810
30041
|
{
|
|
29811
|
-
icon:
|
|
30042
|
+
icon: import_lucide_react49.ArrowDown,
|
|
29812
30043
|
label: t("tableMenu.addColumnAfter"),
|
|
29813
30044
|
onClick: () => editor.chain().focus().addColumnAfter().run(),
|
|
29814
30045
|
disabled: !hasTableContext || !editor.can().addColumnAfter()
|
|
29815
30046
|
}
|
|
29816
30047
|
),
|
|
29817
|
-
/* @__PURE__ */ (0,
|
|
30048
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29818
30049
|
DropdownMenuItem,
|
|
29819
30050
|
{
|
|
29820
|
-
icon:
|
|
30051
|
+
icon: import_lucide_react49.ArrowUp,
|
|
29821
30052
|
label: t("tableMenu.addRowBefore"),
|
|
29822
30053
|
onClick: () => editor.chain().focus().addRowBefore().run(),
|
|
29823
30054
|
disabled: !hasTableContext || !editor.can().addRowBefore()
|
|
29824
30055
|
}
|
|
29825
30056
|
),
|
|
29826
|
-
/* @__PURE__ */ (0,
|
|
30057
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29827
30058
|
DropdownMenuItem,
|
|
29828
30059
|
{
|
|
29829
|
-
icon:
|
|
30060
|
+
icon: import_lucide_react49.ArrowRight,
|
|
29830
30061
|
label: t("tableMenu.addRowAfter"),
|
|
29831
30062
|
onClick: () => editor.chain().focus().addRowAfter().run(),
|
|
29832
30063
|
disabled: !hasTableContext || !editor.can().addRowAfter()
|
|
29833
30064
|
}
|
|
29834
30065
|
),
|
|
29835
|
-
/* @__PURE__ */ (0,
|
|
29836
|
-
/* @__PURE__ */ (0,
|
|
30066
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "my-1 border-t" }),
|
|
30067
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29837
30068
|
DropdownMenuItem,
|
|
29838
30069
|
{
|
|
29839
|
-
icon:
|
|
30070
|
+
icon: import_lucide_react49.Table,
|
|
29840
30071
|
label: t("tableMenu.toggleHeaderRow"),
|
|
29841
30072
|
onClick: () => editor.chain().focus().toggleHeaderRow().run(),
|
|
29842
30073
|
disabled: !hasTableContext || !editor.can().toggleHeaderRow()
|
|
29843
30074
|
}
|
|
29844
30075
|
),
|
|
29845
|
-
/* @__PURE__ */ (0,
|
|
30076
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29846
30077
|
DropdownMenuItem,
|
|
29847
30078
|
{
|
|
29848
|
-
icon:
|
|
30079
|
+
icon: import_lucide_react49.Table,
|
|
29849
30080
|
label: t("tableMenu.toggleHeaderColumn"),
|
|
29850
30081
|
onClick: () => editor.chain().focus().toggleHeaderColumn().run(),
|
|
29851
30082
|
disabled: !hasTableContext || !editor.can().toggleHeaderColumn()
|
|
29852
30083
|
}
|
|
29853
30084
|
),
|
|
29854
|
-
/* @__PURE__ */ (0,
|
|
29855
|
-
/* @__PURE__ */ (0,
|
|
30085
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "my-1 border-t" }),
|
|
30086
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29856
30087
|
DropdownMenuItem,
|
|
29857
30088
|
{
|
|
29858
|
-
icon:
|
|
30089
|
+
icon: import_lucide_react49.Trash2,
|
|
29859
30090
|
label: t("tableMenu.deleteColumn"),
|
|
29860
30091
|
onClick: () => editor.chain().focus().deleteColumn().run(),
|
|
29861
30092
|
disabled: !hasTableContext || !editor.can().deleteColumn()
|
|
29862
30093
|
}
|
|
29863
30094
|
),
|
|
29864
|
-
/* @__PURE__ */ (0,
|
|
30095
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29865
30096
|
DropdownMenuItem,
|
|
29866
30097
|
{
|
|
29867
|
-
icon:
|
|
30098
|
+
icon: import_lucide_react49.Trash2,
|
|
29868
30099
|
label: t("tableMenu.deleteRow"),
|
|
29869
30100
|
onClick: () => editor.chain().focus().deleteRow().run(),
|
|
29870
30101
|
disabled: !hasTableContext || !editor.can().deleteRow()
|
|
29871
30102
|
}
|
|
29872
30103
|
),
|
|
29873
|
-
/* @__PURE__ */ (0,
|
|
30104
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29874
30105
|
DropdownMenuItem,
|
|
29875
30106
|
{
|
|
29876
|
-
icon:
|
|
30107
|
+
icon: import_lucide_react49.Trash2,
|
|
29877
30108
|
label: t("tableMenu.deleteTable"),
|
|
29878
30109
|
onClick: () => editor.chain().focus().deleteTable().run(),
|
|
29879
30110
|
disabled: !hasTableContext || !editor.can().deleteTable()
|
|
@@ -29882,48 +30113,48 @@ var EditorToolbar = ({
|
|
|
29882
30113
|
]
|
|
29883
30114
|
}
|
|
29884
30115
|
),
|
|
29885
|
-
/* @__PURE__ */ (0,
|
|
29886
|
-
/* @__PURE__ */ (0,
|
|
29887
|
-
/* @__PURE__ */ (0,
|
|
29888
|
-
hasTableContext && /* @__PURE__ */ (0,
|
|
29889
|
-
/* @__PURE__ */ (0,
|
|
29890
|
-
/* @__PURE__ */ (0,
|
|
30116
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(ToolbarDivider, {}),
|
|
30117
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().undo().run(), disabled: !editor.can().undo(), title: t("toolbar.undo"), children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.Undo, { className: "w-4 h-4" }) }),
|
|
30118
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().redo().run(), disabled: !editor.can().redo(), title: t("toolbar.redo"), children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.Redo, { className: "w-4 h-4" }) }),
|
|
30119
|
+
hasTableContext && /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(import_jsx_runtime86.Fragment, { children: [
|
|
30120
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(ToolbarDivider, {}),
|
|
30121
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29891
30122
|
ToolbarButton,
|
|
29892
30123
|
{
|
|
29893
30124
|
onClick: () => editor.chain().focus().addColumnBefore().run(),
|
|
29894
30125
|
disabled: !editor.can().addColumnBefore(),
|
|
29895
30126
|
title: t("tableMenu.addColumnBefore"),
|
|
29896
|
-
children: /* @__PURE__ */ (0,
|
|
30127
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.ArrowLeft, { className: "w-4 h-4" })
|
|
29897
30128
|
}
|
|
29898
30129
|
),
|
|
29899
|
-
/* @__PURE__ */ (0,
|
|
30130
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29900
30131
|
ToolbarButton,
|
|
29901
30132
|
{
|
|
29902
30133
|
onClick: () => editor.chain().focus().addColumnAfter().run(),
|
|
29903
30134
|
disabled: !editor.can().addColumnAfter(),
|
|
29904
30135
|
title: t("tableMenu.addColumnAfter"),
|
|
29905
|
-
children: /* @__PURE__ */ (0,
|
|
30136
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.ArrowRight, { className: "w-4 h-4" })
|
|
29906
30137
|
}
|
|
29907
30138
|
),
|
|
29908
|
-
/* @__PURE__ */ (0,
|
|
30139
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29909
30140
|
ToolbarButton,
|
|
29910
30141
|
{
|
|
29911
30142
|
onClick: () => editor.chain().focus().addRowBefore().run(),
|
|
29912
30143
|
disabled: !editor.can().addRowBefore(),
|
|
29913
30144
|
title: t("tableMenu.addRowBefore"),
|
|
29914
|
-
children: /* @__PURE__ */ (0,
|
|
30145
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.ArrowUp, { className: "w-4 h-4" })
|
|
29915
30146
|
}
|
|
29916
30147
|
),
|
|
29917
|
-
/* @__PURE__ */ (0,
|
|
30148
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29918
30149
|
ToolbarButton,
|
|
29919
30150
|
{
|
|
29920
30151
|
onClick: () => editor.chain().focus().addRowAfter().run(),
|
|
29921
30152
|
disabled: !editor.can().addRowAfter(),
|
|
29922
30153
|
title: t("tableMenu.addRowAfter"),
|
|
29923
|
-
children: /* @__PURE__ */ (0,
|
|
30154
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.ArrowDown, { className: "w-4 h-4" })
|
|
29924
30155
|
}
|
|
29925
30156
|
),
|
|
29926
|
-
/* @__PURE__ */ (0,
|
|
30157
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
29927
30158
|
ToolbarButton,
|
|
29928
30159
|
{
|
|
29929
30160
|
onClick: () => {
|
|
@@ -29936,7 +30167,7 @@ var EditorToolbar = ({
|
|
|
29936
30167
|
active: canSplitCell,
|
|
29937
30168
|
disabled: !canMergeCells && !canSplitCell,
|
|
29938
30169
|
title: canSplitCell ? t("tableMenu.splitCell") : t("tableMenu.mergeCells"),
|
|
29939
|
-
children: /* @__PURE__ */ (0,
|
|
30170
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_lucide_react49.TableCellsMerge, { className: "w-4 h-4" })
|
|
29940
30171
|
}
|
|
29941
30172
|
)
|
|
29942
30173
|
] })
|
|
@@ -29944,11 +30175,11 @@ var EditorToolbar = ({
|
|
|
29944
30175
|
};
|
|
29945
30176
|
|
|
29946
30177
|
// src/components/UEditor/menus.tsx
|
|
29947
|
-
var
|
|
29948
|
-
var
|
|
30178
|
+
var import_react64 = require("react");
|
|
30179
|
+
var import_react65 = require("@tiptap/react");
|
|
29949
30180
|
var import_tables3 = require("@tiptap/pm/tables");
|
|
29950
30181
|
var import_react_dom8 = require("react-dom");
|
|
29951
|
-
var
|
|
30182
|
+
var import_lucide_react50 = require("lucide-react");
|
|
29952
30183
|
|
|
29953
30184
|
// src/components/UEditor/table-formula-commands.ts
|
|
29954
30185
|
var import_tables2 = require("@tiptap/pm/tables");
|
|
@@ -30025,6 +30256,20 @@ function getTableCellRangeLabels(range) {
|
|
|
30025
30256
|
function normalizeTableFormula(formula) {
|
|
30026
30257
|
return formula.trim().replace(/^=/, "").trim();
|
|
30027
30258
|
}
|
|
30259
|
+
function isDraftTableFormula(formula) {
|
|
30260
|
+
const normalized = normalizeTableFormula(formula);
|
|
30261
|
+
if (!normalized) return true;
|
|
30262
|
+
let depth = 0;
|
|
30263
|
+
for (const char of normalized) {
|
|
30264
|
+
if (char === "(") depth += 1;
|
|
30265
|
+
if (char === ")") depth -= 1;
|
|
30266
|
+
if (depth < 0) return false;
|
|
30267
|
+
}
|
|
30268
|
+
if (depth > 0) return true;
|
|
30269
|
+
if (/^[A-Z]+\(\s*\)$/i.test(normalized)) return true;
|
|
30270
|
+
if (/[+\-*/,(]\s*$/.test(normalized)) return true;
|
|
30271
|
+
return false;
|
|
30272
|
+
}
|
|
30028
30273
|
function formatFormulaError(error) {
|
|
30029
30274
|
return `#${error.toUpperCase()}`;
|
|
30030
30275
|
}
|
|
@@ -30484,18 +30729,54 @@ function promoteFormulaTextInTableNode(tableNode) {
|
|
|
30484
30729
|
const cells = collectChildren2(rowInfo.node);
|
|
30485
30730
|
for (const entry of rowInfo.cells) {
|
|
30486
30731
|
const text = getCellText(entry.node);
|
|
30487
|
-
const
|
|
30488
|
-
|
|
30489
|
-
|
|
30490
|
-
{
|
|
30491
|
-
|
|
30492
|
-
|
|
30493
|
-
|
|
30494
|
-
|
|
30495
|
-
|
|
30496
|
-
|
|
30497
|
-
|
|
30498
|
-
|
|
30732
|
+
const existingFormula = typeof entry.node.attrs.formula === "string" ? entry.node.attrs.formula.trim() : "";
|
|
30733
|
+
const existingComputedValue = typeof entry.node.attrs.computedValue === "string" ? entry.node.attrs.computedValue.trim() : "";
|
|
30734
|
+
if (text.startsWith("=")) {
|
|
30735
|
+
if (!normalizeTableFormula(text)) {
|
|
30736
|
+
if (!existingFormula && !existingComputedValue) continue;
|
|
30737
|
+
cells[entry.index] = entry.node.type.create(
|
|
30738
|
+
{
|
|
30739
|
+
...entry.node.attrs,
|
|
30740
|
+
formula: null,
|
|
30741
|
+
computedValue: null
|
|
30742
|
+
},
|
|
30743
|
+
text === formatFormulaError("empty") ? createCellDisplayContent(entry.node, "") : entry.node.content,
|
|
30744
|
+
entry.node.marks
|
|
30745
|
+
);
|
|
30746
|
+
changed = true;
|
|
30747
|
+
continue;
|
|
30748
|
+
}
|
|
30749
|
+
if (isDraftTableFormula(text)) {
|
|
30750
|
+
continue;
|
|
30751
|
+
}
|
|
30752
|
+
const formula = normalizeFormulaInput(text);
|
|
30753
|
+
if (entry.node.attrs.formula === formula) continue;
|
|
30754
|
+
cells[entry.index] = entry.node.type.create(
|
|
30755
|
+
{
|
|
30756
|
+
...entry.node.attrs,
|
|
30757
|
+
formula,
|
|
30758
|
+
computedValue: null
|
|
30759
|
+
},
|
|
30760
|
+
entry.node.content,
|
|
30761
|
+
entry.node.marks
|
|
30762
|
+
);
|
|
30763
|
+
changed = true;
|
|
30764
|
+
continue;
|
|
30765
|
+
}
|
|
30766
|
+
if (existingFormula) {
|
|
30767
|
+
const isExistingEmptyFormula = !normalizeTableFormula(existingFormula);
|
|
30768
|
+
if (!isExistingEmptyFormula) continue;
|
|
30769
|
+
cells[entry.index] = entry.node.type.create(
|
|
30770
|
+
{
|
|
30771
|
+
...entry.node.attrs,
|
|
30772
|
+
formula: null,
|
|
30773
|
+
computedValue: null
|
|
30774
|
+
},
|
|
30775
|
+
isExistingEmptyFormula && text === formatFormulaError("empty") ? createCellDisplayContent(entry.node, "") : entry.node.content,
|
|
30776
|
+
entry.node.marks
|
|
30777
|
+
);
|
|
30778
|
+
changed = true;
|
|
30779
|
+
}
|
|
30499
30780
|
}
|
|
30500
30781
|
return rowInfo.node.type.create(rowInfo.node.attrs, cells);
|
|
30501
30782
|
});
|
|
@@ -30610,7 +30891,7 @@ function recalculateAllTableFormulas(editor) {
|
|
|
30610
30891
|
}
|
|
30611
30892
|
|
|
30612
30893
|
// src/components/UEditor/menus.tsx
|
|
30613
|
-
var
|
|
30894
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
30614
30895
|
function applyTableCellBackground(editor, color) {
|
|
30615
30896
|
const value = color || null;
|
|
30616
30897
|
const { state, view } = editor;
|
|
@@ -30629,21 +30910,21 @@ var BubbleMenuContent = ({
|
|
|
30629
30910
|
initialShowLinkInput = false
|
|
30630
30911
|
}) => {
|
|
30631
30912
|
const t = useSmartTranslations("UEditor");
|
|
30632
|
-
(0,
|
|
30913
|
+
(0, import_react65.useEditorState)({
|
|
30633
30914
|
editor,
|
|
30634
30915
|
selector: ({ transactionNumber }) => transactionNumber
|
|
30635
30916
|
});
|
|
30636
30917
|
const { textColors, highlightColors } = useEditorColors();
|
|
30637
|
-
const [showLinkInput, setShowLinkInput] = (0,
|
|
30638
|
-
const [activeColorPalette, setActiveColorPalette] = (0,
|
|
30639
|
-
(0,
|
|
30918
|
+
const [showLinkInput, setShowLinkInput] = (0, import_react64.useState)(initialShowLinkInput);
|
|
30919
|
+
const [activeColorPalette, setActiveColorPalette] = (0, import_react64.useState)(null);
|
|
30920
|
+
(0, import_react64.useEffect)(() => {
|
|
30640
30921
|
setShowLinkInput(initialShowLinkInput);
|
|
30641
30922
|
}, [initialShowLinkInput]);
|
|
30642
|
-
const [showTypographyPanel, setShowTypographyPanel] = (0,
|
|
30643
|
-
const [showFormulaPanel, setShowFormulaPanel] = (0,
|
|
30644
|
-
const [formulaDraft, setFormulaDraft] = (0,
|
|
30645
|
-
const [showFontSizeOptions, setShowFontSizeOptions] = (0,
|
|
30646
|
-
const [fontSizeDraft, setFontSizeDraft] = (0,
|
|
30923
|
+
const [showTypographyPanel, setShowTypographyPanel] = (0, import_react64.useState)(false);
|
|
30924
|
+
const [showFormulaPanel, setShowFormulaPanel] = (0, import_react64.useState)(false);
|
|
30925
|
+
const [formulaDraft, setFormulaDraft] = (0, import_react64.useState)("");
|
|
30926
|
+
const [showFontSizeOptions, setShowFontSizeOptions] = (0, import_react64.useState)(false);
|
|
30927
|
+
const [fontSizeDraft, setFontSizeDraft] = (0, import_react64.useState)("");
|
|
30647
30928
|
const isImageSelected = editor.isActive("image");
|
|
30648
30929
|
const imageAttrs = editor.getAttributes("image");
|
|
30649
30930
|
const imageLayout = imageAttrs.imageLayout === "left" || imageAttrs.imageLayout === "right" ? imageAttrs.imageLayout : "block";
|
|
@@ -30659,18 +30940,18 @@ var BubbleMenuContent = ({
|
|
|
30659
30940
|
const canSplitCell = isInTable2 && editor.can().splitCell();
|
|
30660
30941
|
const currentFontSize = normalizeStyleValue(textStyleAttrs.fontSize);
|
|
30661
30942
|
const currentLineHeight = normalizeStyleValue(textStyleAttrs.lineHeight);
|
|
30662
|
-
const quickFontSizes = (0,
|
|
30943
|
+
const quickFontSizes = (0, import_react64.useMemo)(
|
|
30663
30944
|
() => (fontSizes ?? getDefaultFontSizes()).filter((option) => ["14px", "16px", "24px"].includes(option.value)),
|
|
30664
30945
|
[fontSizes]
|
|
30665
30946
|
);
|
|
30666
|
-
const quickLineHeights = (0,
|
|
30947
|
+
const quickLineHeights = (0, import_react64.useMemo)(
|
|
30667
30948
|
() => (lineHeights ?? getDefaultLineHeights()).filter((option) => ["1.2", "1.5", "1.75"].includes(option.value)),
|
|
30668
30949
|
[lineHeights]
|
|
30669
30950
|
);
|
|
30670
|
-
(0,
|
|
30951
|
+
(0, import_react64.useEffect)(() => {
|
|
30671
30952
|
setFontSizeDraft(currentFontSize.replace(/px$/i, ""));
|
|
30672
30953
|
}, [currentFontSize]);
|
|
30673
|
-
(0,
|
|
30954
|
+
(0, import_react64.useEffect)(() => {
|
|
30674
30955
|
setFormulaDraft(currentCellFormula);
|
|
30675
30956
|
}, [currentCellFormula]);
|
|
30676
30957
|
const applyFontSizeDraft = () => {
|
|
@@ -30685,10 +30966,10 @@ var BubbleMenuContent = ({
|
|
|
30685
30966
|
editor.chain().focus().setFontSize(`${clamped}px`).run();
|
|
30686
30967
|
setFontSizeDraft(String(clamped));
|
|
30687
30968
|
};
|
|
30688
|
-
(0,
|
|
30969
|
+
(0, import_react64.useEffect)(() => {
|
|
30689
30970
|
onKeepOpenChange?.(showLinkInput);
|
|
30690
30971
|
}, [onKeepOpenChange, showLinkInput]);
|
|
30691
|
-
(0,
|
|
30972
|
+
(0, import_react64.useEffect)(() => {
|
|
30692
30973
|
if (!showLinkInput) return;
|
|
30693
30974
|
const close2 = () => setShowLinkInput(false);
|
|
30694
30975
|
editor.on("selectionUpdate", close2);
|
|
@@ -30699,7 +30980,7 @@ var BubbleMenuContent = ({
|
|
|
30699
30980
|
};
|
|
30700
30981
|
}, [editor, showLinkInput]);
|
|
30701
30982
|
if (showLinkInput) {
|
|
30702
|
-
return /* @__PURE__ */ (0,
|
|
30983
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
30703
30984
|
LinkInput,
|
|
30704
30985
|
{
|
|
30705
30986
|
initialUrl: editor.getAttributes("link").href || "",
|
|
@@ -30722,11 +31003,11 @@ var BubbleMenuContent = ({
|
|
|
30722
31003
|
const currentBorderStyle = editor.getAttributes("tableCell").borderStyle || editor.getAttributes("tableHeader").borderStyle || "solid";
|
|
30723
31004
|
const currentBorderWidth = editor.getAttributes("tableCell").borderWidth || editor.getAttributes("tableHeader").borderWidth || "1px";
|
|
30724
31005
|
const currentBorderColor = editor.getAttributes("tableCell").borderColor || editor.getAttributes("tableHeader").borderColor || "currentColor";
|
|
30725
|
-
return /* @__PURE__ */ (0,
|
|
30726
|
-
/* @__PURE__ */ (0,
|
|
30727
|
-
/* @__PURE__ */ (0,
|
|
30728
|
-
/* @__PURE__ */ (0,
|
|
30729
|
-
/* @__PURE__ */ (0,
|
|
31006
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "flex flex-col gap-2 p-2 w-56 text-sm", children: [
|
|
31007
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "font-semibold text-xs text-muted-foreground uppercase tracking-wider mb-1", children: t("tableMenu.cellBorder") || "Cell Borders" }),
|
|
31008
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
31009
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("label", { className: "text-xs text-muted-foreground", children: t("tableMenu.borderStyle") || "Border Style" }),
|
|
31010
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
30730
31011
|
"select",
|
|
30731
31012
|
{
|
|
30732
31013
|
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",
|
|
@@ -30736,18 +31017,18 @@ var BubbleMenuContent = ({
|
|
|
30736
31017
|
editor.chain().focus().setCellAttribute("borderStyle", style).run();
|
|
30737
31018
|
},
|
|
30738
31019
|
children: [
|
|
30739
|
-
/* @__PURE__ */ (0,
|
|
30740
|
-
/* @__PURE__ */ (0,
|
|
30741
|
-
/* @__PURE__ */ (0,
|
|
30742
|
-
/* @__PURE__ */ (0,
|
|
30743
|
-
/* @__PURE__ */ (0,
|
|
31020
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("option", { value: "solid", children: "Solid" }),
|
|
31021
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("option", { value: "dashed", children: "Dashed" }),
|
|
31022
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("option", { value: "dotted", children: "Dotted" }),
|
|
31023
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("option", { value: "double", children: "Double" }),
|
|
31024
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("option", { value: "none", children: "None" })
|
|
30744
31025
|
]
|
|
30745
31026
|
}
|
|
30746
31027
|
)
|
|
30747
31028
|
] }),
|
|
30748
|
-
/* @__PURE__ */ (0,
|
|
30749
|
-
/* @__PURE__ */ (0,
|
|
30750
|
-
/* @__PURE__ */ (0,
|
|
31029
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
31030
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("label", { className: "text-xs text-muted-foreground", children: t("tableMenu.borderWidth") || "Border Width" }),
|
|
31031
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
30751
31032
|
"select",
|
|
30752
31033
|
{
|
|
30753
31034
|
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",
|
|
@@ -30757,23 +31038,23 @@ var BubbleMenuContent = ({
|
|
|
30757
31038
|
editor.chain().focus().setCellAttribute("borderWidth", width).run();
|
|
30758
31039
|
},
|
|
30759
31040
|
children: [
|
|
30760
|
-
/* @__PURE__ */ (0,
|
|
30761
|
-
/* @__PURE__ */ (0,
|
|
30762
|
-
/* @__PURE__ */ (0,
|
|
30763
|
-
/* @__PURE__ */ (0,
|
|
31041
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("option", { value: "1px", children: "1px" }),
|
|
31042
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("option", { value: "2px", children: "2px" }),
|
|
31043
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("option", { value: "3px", children: "3px" }),
|
|
31044
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("option", { value: "4px", children: "4px" })
|
|
30764
31045
|
]
|
|
30765
31046
|
}
|
|
30766
31047
|
)
|
|
30767
31048
|
] }),
|
|
30768
|
-
/* @__PURE__ */ (0,
|
|
31049
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
30769
31050
|
"button",
|
|
30770
31051
|
{
|
|
30771
31052
|
type: "button",
|
|
30772
31053
|
onClick: () => setActiveColorPalette("cell-border-color"),
|
|
30773
31054
|
className: "flex items-center justify-between w-full h-8 px-2 rounded-md border border-input hover:bg-accent text-xs",
|
|
30774
31055
|
children: [
|
|
30775
|
-
/* @__PURE__ */ (0,
|
|
30776
|
-
/* @__PURE__ */ (0,
|
|
31056
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { children: t("tableMenu.borderColor") || "Border Color" }),
|
|
31057
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
30777
31058
|
"span",
|
|
30778
31059
|
{
|
|
30779
31060
|
className: "w-4 h-4 rounded-full border border-border",
|
|
@@ -30785,8 +31066,8 @@ var BubbleMenuContent = ({
|
|
|
30785
31066
|
]
|
|
30786
31067
|
}
|
|
30787
31068
|
),
|
|
30788
|
-
/* @__PURE__ */ (0,
|
|
30789
|
-
/* @__PURE__ */ (0,
|
|
31069
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "flex items-center justify-between gap-2 mt-2 pt-2 border-t border-border", children: [
|
|
31070
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
30790
31071
|
"button",
|
|
30791
31072
|
{
|
|
30792
31073
|
type: "button",
|
|
@@ -30798,7 +31079,7 @@ var BubbleMenuContent = ({
|
|
|
30798
31079
|
children: t("tableMenu.clearBorder") || "Clear Border"
|
|
30799
31080
|
}
|
|
30800
31081
|
),
|
|
30801
|
-
/* @__PURE__ */ (0,
|
|
31082
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
30802
31083
|
"button",
|
|
30803
31084
|
{
|
|
30804
31085
|
type: "button",
|
|
@@ -30812,7 +31093,7 @@ var BubbleMenuContent = ({
|
|
|
30812
31093
|
}
|
|
30813
31094
|
if (activeColorPalette === "cell-border-color") {
|
|
30814
31095
|
const currentBorderColor = normalizeStyleValue(editor.getAttributes("tableCell").borderColor || editor.getAttributes("tableHeader").borderColor) || "";
|
|
30815
|
-
return /* @__PURE__ */ (0,
|
|
31096
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "w-56", children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
30816
31097
|
EditorColorPalette,
|
|
30817
31098
|
{
|
|
30818
31099
|
colors: highlightColors,
|
|
@@ -30826,7 +31107,7 @@ var BubbleMenuContent = ({
|
|
|
30826
31107
|
}
|
|
30827
31108
|
) });
|
|
30828
31109
|
}
|
|
30829
|
-
return /* @__PURE__ */ (0,
|
|
31110
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "w-56", children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
30830
31111
|
EditorColorPalette,
|
|
30831
31112
|
{
|
|
30832
31113
|
colors: isTextPalette ? textColors : highlightColors,
|
|
@@ -30854,32 +31135,32 @@ var BubbleMenuContent = ({
|
|
|
30854
31135
|
) });
|
|
30855
31136
|
}
|
|
30856
31137
|
if (isImageSelected) {
|
|
30857
|
-
return /* @__PURE__ */ (0,
|
|
30858
|
-
/* @__PURE__ */ (0,
|
|
30859
|
-
/* @__PURE__ */ (0,
|
|
30860
|
-
/* @__PURE__ */ (0,
|
|
30861
|
-
/* @__PURE__ */ (0,
|
|
30862
|
-
/* @__PURE__ */ (0,
|
|
30863
|
-
/* @__PURE__ */ (0,
|
|
30864
|
-
/* @__PURE__ */ (0,
|
|
30865
|
-
/* @__PURE__ */ (0,
|
|
30866
|
-
/* @__PURE__ */ (0,
|
|
30867
|
-
/* @__PURE__ */ (0,
|
|
31138
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "flex items-center gap-0.5 p-1", children: [
|
|
31139
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(ToolbarButton, { onClick: () => applyImageLayout(editor, "block"), active: imageLayout === "block", title: t("toolbar.imageLayoutBlock"), children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_lucide_react50.AlignCenter, { className: "w-4 h-4" }) }),
|
|
31140
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(ToolbarButton, { onClick: () => applyImageLayout(editor, "left"), active: imageLayout === "left", title: t("toolbar.imageLayoutLeft"), children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_lucide_react50.AlignLeft, { className: "w-4 h-4" }) }),
|
|
31141
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(ToolbarButton, { onClick: () => applyImageLayout(editor, "right"), active: imageLayout === "right", title: t("toolbar.imageLayoutRight"), children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_lucide_react50.AlignRight, { className: "w-4 h-4" }) }),
|
|
31142
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
31143
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(ToolbarButton, { onClick: () => applyImageWidthPreset(editor, "sm"), active: imageWidthPreset === "sm", title: t("toolbar.imageWidthSm"), children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "text-[10px] font-semibold", children: "S" }) }),
|
|
31144
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(ToolbarButton, { onClick: () => applyImageWidthPreset(editor, "md"), active: imageWidthPreset === "md", title: t("toolbar.imageWidthMd"), children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "text-[10px] font-semibold", children: "M" }) }),
|
|
31145
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(ToolbarButton, { onClick: () => applyImageWidthPreset(editor, "lg"), active: imageWidthPreset === "lg", title: t("toolbar.imageWidthLg"), children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "text-[10px] font-semibold", children: "L" }) }),
|
|
31146
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
31147
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(ToolbarButton, { onClick: () => resetImageSize(editor), title: t("toolbar.imageResetSize"), children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_lucide_react50.RotateCcw, { className: "w-4 h-4" }) }),
|
|
31148
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
30868
31149
|
ToolbarButton,
|
|
30869
31150
|
{
|
|
30870
31151
|
onClick: () => deleteSelectedImage(editor),
|
|
30871
31152
|
title: t("toolbar.imageDelete"),
|
|
30872
31153
|
className: "text-destructive hover:text-destructive",
|
|
30873
|
-
children: /* @__PURE__ */ (0,
|
|
31154
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_lucide_react50.Trash2, { className: "w-4 h-4" })
|
|
30874
31155
|
}
|
|
30875
31156
|
)
|
|
30876
31157
|
] });
|
|
30877
31158
|
}
|
|
30878
31159
|
if (showFormulaPanel && isInTable2) {
|
|
30879
|
-
return /* @__PURE__ */ (0,
|
|
30880
|
-
/* @__PURE__ */ (0,
|
|
30881
|
-
/* @__PURE__ */ (0,
|
|
30882
|
-
/* @__PURE__ */ (0,
|
|
31160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "w-72 p-2", children: [
|
|
31161
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "mb-2 flex items-center justify-between gap-2", children: [
|
|
31162
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "px-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: t("tableMenu.formula") || "Formula" }),
|
|
31163
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
30883
31164
|
"button",
|
|
30884
31165
|
{
|
|
30885
31166
|
type: "button",
|
|
@@ -30892,7 +31173,7 @@ var BubbleMenuContent = ({
|
|
|
30892
31173
|
}
|
|
30893
31174
|
)
|
|
30894
31175
|
] }),
|
|
30895
|
-
/* @__PURE__ */ (0,
|
|
31176
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "flex h-9 items-center overflow-hidden rounded-md border border-border/60 bg-muted/40", children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
30896
31177
|
"input",
|
|
30897
31178
|
{
|
|
30898
31179
|
value: formulaDraft,
|
|
@@ -30913,15 +31194,15 @@ var BubbleMenuContent = ({
|
|
|
30913
31194
|
className: "h-full min-w-0 flex-1 bg-transparent px-2 text-sm font-medium text-foreground outline-none"
|
|
30914
31195
|
}
|
|
30915
31196
|
) }),
|
|
30916
|
-
/* @__PURE__ */ (0,
|
|
30917
|
-
/* @__PURE__ */ (0,
|
|
30918
|
-
/* @__PURE__ */ (0,
|
|
31197
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "mt-2", children: [
|
|
31198
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "mb-1 px-1 text-[11px] font-medium text-muted-foreground", children: t("tableMenu.numberFormat") || "Number format" }),
|
|
31199
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "grid grid-cols-5 gap-1", children: [
|
|
30919
31200
|
["text", "Text"],
|
|
30920
31201
|
["number", "123"],
|
|
30921
31202
|
["currency", "$"],
|
|
30922
31203
|
["percent", "%"],
|
|
30923
31204
|
["date", "Date"]
|
|
30924
|
-
].map(([format, label]) => /* @__PURE__ */ (0,
|
|
31205
|
+
].map(([format, label]) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
30925
31206
|
"button",
|
|
30926
31207
|
{
|
|
30927
31208
|
type: "button",
|
|
@@ -30935,8 +31216,8 @@ var BubbleMenuContent = ({
|
|
|
30935
31216
|
format
|
|
30936
31217
|
)) })
|
|
30937
31218
|
] }),
|
|
30938
|
-
/* @__PURE__ */ (0,
|
|
30939
|
-
/* @__PURE__ */ (0,
|
|
31219
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "mt-2 grid grid-cols-3 gap-1", children: [
|
|
31220
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
30940
31221
|
"button",
|
|
30941
31222
|
{
|
|
30942
31223
|
type: "button",
|
|
@@ -30949,7 +31230,7 @@ var BubbleMenuContent = ({
|
|
|
30949
31230
|
children: t("tableMenu.apply") || "Apply"
|
|
30950
31231
|
}
|
|
30951
31232
|
),
|
|
30952
|
-
/* @__PURE__ */ (0,
|
|
31233
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
30953
31234
|
"button",
|
|
30954
31235
|
{
|
|
30955
31236
|
type: "button",
|
|
@@ -30961,7 +31242,7 @@ var BubbleMenuContent = ({
|
|
|
30961
31242
|
children: t("tableMenu.clear") || "Clear"
|
|
30962
31243
|
}
|
|
30963
31244
|
),
|
|
30964
|
-
/* @__PURE__ */ (0,
|
|
31245
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
30965
31246
|
"button",
|
|
30966
31247
|
{
|
|
30967
31248
|
type: "button",
|
|
@@ -30974,10 +31255,10 @@ var BubbleMenuContent = ({
|
|
|
30974
31255
|
] });
|
|
30975
31256
|
}
|
|
30976
31257
|
if (showTypographyPanel) {
|
|
30977
|
-
return /* @__PURE__ */ (0,
|
|
30978
|
-
/* @__PURE__ */ (0,
|
|
30979
|
-
/* @__PURE__ */ (0,
|
|
30980
|
-
/* @__PURE__ */ (0,
|
|
31258
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "w-72 p-2", children: [
|
|
31259
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "mb-2 flex items-center justify-between gap-2", children: [
|
|
31260
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "px-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: t("toolbar.textStyle") }),
|
|
31261
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
30981
31262
|
"button",
|
|
30982
31263
|
{
|
|
30983
31264
|
type: "button",
|
|
@@ -30987,11 +31268,11 @@ var BubbleMenuContent = ({
|
|
|
30987
31268
|
}
|
|
30988
31269
|
)
|
|
30989
31270
|
] }),
|
|
30990
|
-
/* @__PURE__ */ (0,
|
|
30991
|
-
/* @__PURE__ */ (0,
|
|
30992
|
-
/* @__PURE__ */ (0,
|
|
30993
|
-
/* @__PURE__ */ (0,
|
|
30994
|
-
/* @__PURE__ */ (0,
|
|
31271
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "space-y-2", children: [
|
|
31272
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { children: [
|
|
31273
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "mb-1 px-1 text-[11px] font-medium text-muted-foreground", children: t("toolbar.fontSize") }),
|
|
31274
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "flex h-9 items-center overflow-hidden rounded-md border border-border/60 bg-muted/40", children: [
|
|
31275
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
30995
31276
|
"input",
|
|
30996
31277
|
{
|
|
30997
31278
|
type: "number",
|
|
@@ -31015,8 +31296,8 @@ var BubbleMenuContent = ({
|
|
|
31015
31296
|
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"
|
|
31016
31297
|
}
|
|
31017
31298
|
),
|
|
31018
|
-
/* @__PURE__ */ (0,
|
|
31019
|
-
/* @__PURE__ */ (0,
|
|
31299
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "border-l border-border/50 px-2 text-[11px] text-muted-foreground", children: "px" }),
|
|
31300
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
31020
31301
|
"button",
|
|
31021
31302
|
{
|
|
31022
31303
|
type: "button",
|
|
@@ -31026,12 +31307,12 @@ var BubbleMenuContent = ({
|
|
|
31026
31307
|
"flex h-full w-9 items-center justify-center border-l border-border/50 transition-colors hover:bg-muted",
|
|
31027
31308
|
showFontSizeOptions && "bg-primary/10 text-primary"
|
|
31028
31309
|
),
|
|
31029
|
-
children: /* @__PURE__ */ (0,
|
|
31310
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_lucide_react50.ChevronDown, { className: "h-4 w-4" })
|
|
31030
31311
|
}
|
|
31031
31312
|
)
|
|
31032
31313
|
] }),
|
|
31033
|
-
showFontSizeOptions && /* @__PURE__ */ (0,
|
|
31034
|
-
/* @__PURE__ */ (0,
|
|
31314
|
+
showFontSizeOptions && /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "mt-1 grid grid-cols-4 gap-1", children: [
|
|
31315
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
31035
31316
|
"button",
|
|
31036
31317
|
{
|
|
31037
31318
|
type: "button",
|
|
@@ -31046,7 +31327,7 @@ var BubbleMenuContent = ({
|
|
|
31046
31327
|
children: "A"
|
|
31047
31328
|
}
|
|
31048
31329
|
),
|
|
31049
|
-
quickFontSizes.map((option) => /* @__PURE__ */ (0,
|
|
31330
|
+
quickFontSizes.map((option) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
31050
31331
|
"button",
|
|
31051
31332
|
{
|
|
31052
31333
|
type: "button",
|
|
@@ -31064,10 +31345,10 @@ var BubbleMenuContent = ({
|
|
|
31064
31345
|
))
|
|
31065
31346
|
] })
|
|
31066
31347
|
] }),
|
|
31067
|
-
/* @__PURE__ */ (0,
|
|
31068
|
-
/* @__PURE__ */ (0,
|
|
31069
|
-
/* @__PURE__ */ (0,
|
|
31070
|
-
/* @__PURE__ */ (0,
|
|
31348
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { children: [
|
|
31349
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "mb-1 px-1 text-[11px] font-medium text-muted-foreground", children: t("toolbar.lineHeight") }),
|
|
31350
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "grid grid-cols-4 gap-1", children: [
|
|
31351
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
31071
31352
|
"button",
|
|
31072
31353
|
{
|
|
31073
31354
|
type: "button",
|
|
@@ -31079,7 +31360,7 @@ var BubbleMenuContent = ({
|
|
|
31079
31360
|
children: "LH"
|
|
31080
31361
|
}
|
|
31081
31362
|
),
|
|
31082
|
-
quickLineHeights.map((option) => /* @__PURE__ */ (0,
|
|
31363
|
+
quickLineHeights.map((option) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
31083
31364
|
"button",
|
|
31084
31365
|
{
|
|
31085
31366
|
type: "button",
|
|
@@ -31094,8 +31375,8 @@ var BubbleMenuContent = ({
|
|
|
31094
31375
|
))
|
|
31095
31376
|
] })
|
|
31096
31377
|
] }),
|
|
31097
|
-
/* @__PURE__ */ (0,
|
|
31098
|
-
/* @__PURE__ */ (0,
|
|
31378
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "grid grid-cols-2 gap-1 border-t border-border/40 pt-2", children: [
|
|
31379
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
31099
31380
|
"button",
|
|
31100
31381
|
{
|
|
31101
31382
|
type: "button",
|
|
@@ -31105,12 +31386,12 @@ var BubbleMenuContent = ({
|
|
|
31105
31386
|
editor.isActive("subscript") ? "bg-primary/10 text-primary" : "bg-muted/40 text-foreground"
|
|
31106
31387
|
),
|
|
31107
31388
|
children: [
|
|
31108
|
-
/* @__PURE__ */ (0,
|
|
31389
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_lucide_react50.Subscript, { className: "h-4 w-4" }),
|
|
31109
31390
|
t("toolbar.subscript")
|
|
31110
31391
|
]
|
|
31111
31392
|
}
|
|
31112
31393
|
),
|
|
31113
|
-
/* @__PURE__ */ (0,
|
|
31394
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
31114
31395
|
"button",
|
|
31115
31396
|
{
|
|
31116
31397
|
type: "button",
|
|
@@ -31120,7 +31401,7 @@ var BubbleMenuContent = ({
|
|
|
31120
31401
|
editor.isActive("superscript") ? "bg-primary/10 text-primary" : "bg-muted/40 text-foreground"
|
|
31121
31402
|
),
|
|
31122
31403
|
children: [
|
|
31123
|
-
/* @__PURE__ */ (0,
|
|
31404
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_lucide_react50.Superscript, { className: "h-4 w-4" }),
|
|
31124
31405
|
t("toolbar.superscript")
|
|
31125
31406
|
]
|
|
31126
31407
|
}
|
|
@@ -31129,22 +31410,22 @@ var BubbleMenuContent = ({
|
|
|
31129
31410
|
] })
|
|
31130
31411
|
] });
|
|
31131
31412
|
}
|
|
31132
|
-
return /* @__PURE__ */ (0,
|
|
31133
|
-
/* @__PURE__ */ (0,
|
|
31134
|
-
/* @__PURE__ */ (0,
|
|
31135
|
-
/* @__PURE__ */ (0,
|
|
31413
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "flex items-center gap-0.5 p-1", children: [
|
|
31414
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_lucide_react50.Bold, { className: "w-4 h-4" }) }),
|
|
31415
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_lucide_react50.Italic, { className: "w-4 h-4" }) }),
|
|
31416
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
31136
31417
|
ToolbarButton,
|
|
31137
31418
|
{
|
|
31138
31419
|
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
31139
31420
|
active: editor.isActive("underline"),
|
|
31140
31421
|
title: t("toolbar.underline"),
|
|
31141
|
-
children: /* @__PURE__ */ (0,
|
|
31422
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_lucide_react50.Underline, { className: "w-4 h-4" })
|
|
31142
31423
|
}
|
|
31143
31424
|
),
|
|
31144
|
-
/* @__PURE__ */ (0,
|
|
31145
|
-
/* @__PURE__ */ (0,
|
|
31146
|
-
/* @__PURE__ */ (0,
|
|
31147
|
-
/* @__PURE__ */ (0,
|
|
31425
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleStrike().run(), active: editor.isActive("strike"), title: t("toolbar.strike"), children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_lucide_react50.Strikethrough, { className: "w-4 h-4" }) }),
|
|
31426
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleCode().run(), active: editor.isActive("code"), title: t("toolbar.code"), children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_lucide_react50.Code, { className: "w-4 h-4" }) }),
|
|
31427
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
31428
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
31148
31429
|
ToolbarButton,
|
|
31149
31430
|
{
|
|
31150
31431
|
onMouseDown: () => {
|
|
@@ -31155,22 +31436,22 @@ var BubbleMenuContent = ({
|
|
|
31155
31436
|
},
|
|
31156
31437
|
active: editor.isActive("link"),
|
|
31157
31438
|
title: t("toolbar.link"),
|
|
31158
|
-
children: /* @__PURE__ */ (0,
|
|
31439
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_lucide_react50.Link, { className: "w-4 h-4" })
|
|
31159
31440
|
}
|
|
31160
31441
|
),
|
|
31161
|
-
/* @__PURE__ */ (0,
|
|
31162
|
-
/* @__PURE__ */ (0,
|
|
31163
|
-
isInTable2 && /* @__PURE__ */ (0,
|
|
31164
|
-
/* @__PURE__ */ (0,
|
|
31442
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(ToolbarButton, { onClick: () => setActiveColorPalette("text"), title: t("colors.textColor"), children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(TextColorIcon, { color: currentTextColor }) }),
|
|
31443
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(ToolbarButton, { onClick: () => setActiveColorPalette("highlight"), active: editor.isActive("highlight"), title: t("colors.highlight"), children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(HighlightColorIcon, { color: currentHighlightColor }) }),
|
|
31444
|
+
isInTable2 && /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [
|
|
31445
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
31165
31446
|
ToolbarButton,
|
|
31166
31447
|
{
|
|
31167
31448
|
onClick: () => setActiveColorPalette("cell-bg"),
|
|
31168
31449
|
active: Boolean(currentCellBgColor),
|
|
31169
31450
|
title: t("tableMenu.cellBackground") || "Cell background",
|
|
31170
|
-
children: /* @__PURE__ */ (0,
|
|
31451
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(CellBgColorIcon, { color: currentCellBgColor })
|
|
31171
31452
|
}
|
|
31172
31453
|
),
|
|
31173
|
-
/* @__PURE__ */ (0,
|
|
31454
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
31174
31455
|
ToolbarButton,
|
|
31175
31456
|
{
|
|
31176
31457
|
onClick: () => setActiveColorPalette("cell-border"),
|
|
@@ -31178,7 +31459,7 @@ var BubbleMenuContent = ({
|
|
|
31178
31459
|
editor.getAttributes("tableCell").borderColor || editor.getAttributes("tableHeader").borderColor || editor.getAttributes("tableCell").borderStyle || editor.getAttributes("tableHeader").borderStyle || editor.getAttributes("tableCell").borderWidth || editor.getAttributes("tableHeader").borderWidth
|
|
31179
31460
|
),
|
|
31180
31461
|
title: t("tableMenu.cellBorder") || "Cell border",
|
|
31181
|
-
children: /* @__PURE__ */ (0,
|
|
31462
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
31182
31463
|
CellBorderIcon,
|
|
31183
31464
|
{
|
|
31184
31465
|
color: editor.getAttributes("tableCell").borderColor || editor.getAttributes("tableHeader").borderColor
|
|
@@ -31186,7 +31467,7 @@ var BubbleMenuContent = ({
|
|
|
31186
31467
|
)
|
|
31187
31468
|
}
|
|
31188
31469
|
),
|
|
31189
|
-
/* @__PURE__ */ (0,
|
|
31470
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
31190
31471
|
ToolbarButton,
|
|
31191
31472
|
{
|
|
31192
31473
|
onMouseDown: () => {
|
|
@@ -31198,10 +31479,10 @@ var BubbleMenuContent = ({
|
|
|
31198
31479
|
},
|
|
31199
31480
|
active: Boolean(currentCellFormula),
|
|
31200
31481
|
title: t("tableMenu.formula") || "Formula",
|
|
31201
|
-
children: /* @__PURE__ */ (0,
|
|
31482
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_lucide_react50.Sigma, { className: "w-4 h-4" })
|
|
31202
31483
|
}
|
|
31203
31484
|
),
|
|
31204
|
-
/* @__PURE__ */ (0,
|
|
31485
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
31205
31486
|
ToolbarButton,
|
|
31206
31487
|
{
|
|
31207
31488
|
onClick: () => {
|
|
@@ -31214,17 +31495,17 @@ var BubbleMenuContent = ({
|
|
|
31214
31495
|
active: canSplitCell,
|
|
31215
31496
|
disabled: !canMergeCells && !canSplitCell,
|
|
31216
31497
|
title: canSplitCell ? t("tableMenu.splitCell") || "Split cell" : t("tableMenu.mergeCells") || "Merge cells",
|
|
31217
|
-
children: /* @__PURE__ */ (0,
|
|
31498
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_lucide_react50.TableCellsMerge, { className: "w-4 h-4" })
|
|
31218
31499
|
}
|
|
31219
31500
|
)
|
|
31220
31501
|
] }),
|
|
31221
|
-
/* @__PURE__ */ (0,
|
|
31502
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
31222
31503
|
ToolbarButton,
|
|
31223
31504
|
{
|
|
31224
31505
|
onClick: () => setShowTypographyPanel(true),
|
|
31225
31506
|
active: Boolean(currentFontSize || currentLineHeight || editor.isActive("subscript") || editor.isActive("superscript")),
|
|
31226
31507
|
title: t("toolbar.textStyle"),
|
|
31227
|
-
children: /* @__PURE__ */ (0,
|
|
31508
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_lucide_react50.Type, { className: "w-4 h-4" })
|
|
31228
31509
|
}
|
|
31229
31510
|
)
|
|
31230
31511
|
] });
|
|
@@ -31238,12 +31519,12 @@ var LinkPreviewContent = ({ editor, onEdit }) => {
|
|
|
31238
31519
|
const handleUnlink = () => {
|
|
31239
31520
|
editor.chain().focus().unsetLink().run();
|
|
31240
31521
|
};
|
|
31241
|
-
return /* @__PURE__ */ (0,
|
|
31242
|
-
/* @__PURE__ */ (0,
|
|
31243
|
-
/* @__PURE__ */ (0,
|
|
31244
|
-
/* @__PURE__ */ (0,
|
|
31245
|
-
/* @__PURE__ */ (0,
|
|
31246
|
-
/* @__PURE__ */ (0,
|
|
31522
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "flex items-center gap-1 p-1 max-w-sm", children: [
|
|
31523
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "text-xs text-muted-foreground font-mono px-2 truncate max-w-[180px]", children: url }),
|
|
31524
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
31525
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(ToolbarButton, { onClick: handleOpen, title: t("linkPreview.open") || "Open link", children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_lucide_react50.ExternalLink, { className: "w-4 h-4" }) }),
|
|
31526
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(ToolbarButton, { onClick: onEdit, title: t("linkPreview.edit") || "Edit link", children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_lucide_react50.Edit2, { className: "w-4 h-4" }) }),
|
|
31527
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(ToolbarButton, { onClick: handleUnlink, title: t("linkPreview.unlink") || "Remove link", className: "text-destructive hover:text-destructive", children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_lucide_react50.Unlink, { className: "w-4 h-4" }) })
|
|
31247
31528
|
] });
|
|
31248
31529
|
};
|
|
31249
31530
|
var CustomBubbleMenu = ({
|
|
@@ -31253,16 +31534,16 @@ var CustomBubbleMenu = ({
|
|
|
31253
31534
|
}) => {
|
|
31254
31535
|
const SHOW_DELAY_MS = 180;
|
|
31255
31536
|
const BUBBLE_MENU_OFFSET = 16;
|
|
31256
|
-
const [isVisible, setIsVisible] = (0,
|
|
31257
|
-
const [position, setPosition] = (0,
|
|
31258
|
-
const menuRef = (0,
|
|
31259
|
-
const keepOpenRef = (0,
|
|
31260
|
-
const showTimeoutRef = (0,
|
|
31261
|
-
const setKeepOpen = (0,
|
|
31537
|
+
const [isVisible, setIsVisible] = (0, import_react64.useState)(false);
|
|
31538
|
+
const [position, setPosition] = (0, import_react64.useState)({ top: 0, left: 0 });
|
|
31539
|
+
const menuRef = (0, import_react64.useRef)(null);
|
|
31540
|
+
const keepOpenRef = (0, import_react64.useRef)(false);
|
|
31541
|
+
const showTimeoutRef = (0, import_react64.useRef)(null);
|
|
31542
|
+
const setKeepOpen = (0, import_react64.useCallback)((next) => {
|
|
31262
31543
|
keepOpenRef.current = next;
|
|
31263
31544
|
if (next) setIsVisible(true);
|
|
31264
31545
|
}, []);
|
|
31265
|
-
(0,
|
|
31546
|
+
(0, import_react64.useEffect)(() => {
|
|
31266
31547
|
const clearShowTimeout = () => {
|
|
31267
31548
|
if (showTimeoutRef.current) {
|
|
31268
31549
|
clearTimeout(showTimeoutRef.current);
|
|
@@ -31330,7 +31611,7 @@ var CustomBubbleMenu = ({
|
|
|
31330
31611
|
}, [editor]);
|
|
31331
31612
|
if (!isVisible) return null;
|
|
31332
31613
|
return (0, import_react_dom8.createPortal)(
|
|
31333
|
-
/* @__PURE__ */ (0,
|
|
31614
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
31334
31615
|
"div",
|
|
31335
31616
|
{
|
|
31336
31617
|
ref: menuRef,
|
|
@@ -31342,7 +31623,7 @@ var CustomBubbleMenu = ({
|
|
|
31342
31623
|
transform: "translate(-50%, -100%)"
|
|
31343
31624
|
},
|
|
31344
31625
|
onMouseDown: (e) => e.preventDefault(),
|
|
31345
|
-
children: editor.isActive("link") && !keepOpenRef.current ? /* @__PURE__ */ (0,
|
|
31626
|
+
children: editor.isActive("link") && !keepOpenRef.current ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(LinkPreviewContent, { editor, onEdit: () => setKeepOpen(true) }) : /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
31346
31627
|
BubbleMenuContent,
|
|
31347
31628
|
{
|
|
31348
31629
|
editor,
|
|
@@ -31359,25 +31640,25 @@ var CustomBubbleMenu = ({
|
|
|
31359
31640
|
};
|
|
31360
31641
|
|
|
31361
31642
|
// src/components/UEditor/CharacterCount.tsx
|
|
31362
|
-
var
|
|
31643
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
31363
31644
|
var CharacterCountDisplay = ({ editor, maxCharacters }) => {
|
|
31364
31645
|
const t = useSmartTranslations("UEditor");
|
|
31365
31646
|
const storage = editor.storage;
|
|
31366
31647
|
const characterCount = storage.characterCount?.characters?.() ?? 0;
|
|
31367
31648
|
const wordCount = storage.characterCount?.words?.() ?? 0;
|
|
31368
31649
|
const percentage = maxCharacters ? Math.round(characterCount / maxCharacters * 100) : 0;
|
|
31369
|
-
return /* @__PURE__ */ (0,
|
|
31370
|
-
/* @__PURE__ */ (0,
|
|
31650
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "flex items-center gap-3 px-3 py-2 text-xs text-muted-foreground border-t bg-muted/20", children: [
|
|
31651
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("span", { children: [
|
|
31371
31652
|
wordCount,
|
|
31372
31653
|
" ",
|
|
31373
31654
|
t("words")
|
|
31374
31655
|
] }),
|
|
31375
|
-
/* @__PURE__ */ (0,
|
|
31656
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("span", { children: [
|
|
31376
31657
|
characterCount,
|
|
31377
31658
|
" ",
|
|
31378
31659
|
t("characters")
|
|
31379
31660
|
] }),
|
|
31380
|
-
maxCharacters && /* @__PURE__ */ (0,
|
|
31661
|
+
maxCharacters && /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("span", { className: cn(percentage > 90 && "text-destructive", percentage > 100 && "font-bold"), children: [
|
|
31381
31662
|
characterCount,
|
|
31382
31663
|
"/",
|
|
31383
31664
|
maxCharacters
|
|
@@ -31798,7 +32079,7 @@ async function prepareUEditorContentForSave({
|
|
|
31798
32079
|
}
|
|
31799
32080
|
|
|
31800
32081
|
// src/components/UEditor/table-controls.tsx
|
|
31801
|
-
var
|
|
32082
|
+
var import_react66 = __toESM(require("react"), 1);
|
|
31802
32083
|
|
|
31803
32084
|
// node_modules/prosemirror-model/dist/index.js
|
|
31804
32085
|
function findDiffStart(a, b, pos) {
|
|
@@ -34815,7 +35096,7 @@ function createKey(name) {
|
|
|
34815
35096
|
keys[name] = 0;
|
|
34816
35097
|
return name + "$";
|
|
34817
35098
|
}
|
|
34818
|
-
var
|
|
35099
|
+
var PluginKey5 = class {
|
|
34819
35100
|
/**
|
|
34820
35101
|
Create a plugin key.
|
|
34821
35102
|
*/
|
|
@@ -35247,7 +35528,7 @@ function tableNodeTypes(schema) {
|
|
|
35247
35528
|
}
|
|
35248
35529
|
return result;
|
|
35249
35530
|
}
|
|
35250
|
-
var tableEditingKey = new
|
|
35531
|
+
var tableEditingKey = new PluginKey5("selectingCells");
|
|
35251
35532
|
function cellAround($pos) {
|
|
35252
35533
|
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));
|
|
35253
35534
|
return null;
|
|
@@ -35478,7 +35759,7 @@ var CellBookmark = class CellBookmark2 {
|
|
|
35478
35759
|
else return Selection.near($headCell, 1);
|
|
35479
35760
|
}
|
|
35480
35761
|
};
|
|
35481
|
-
var fixTablesKey = new
|
|
35762
|
+
var fixTablesKey = new PluginKey5("fix-tables");
|
|
35482
35763
|
function convertTableNodeToArrayOfRows(tableNode) {
|
|
35483
35764
|
const map = TableMap3.get(tableNode);
|
|
35484
35765
|
const rows = [];
|
|
@@ -35956,10 +36237,10 @@ function atEndOfCell(view, axis, dir) {
|
|
|
35956
36237
|
}
|
|
35957
36238
|
return null;
|
|
35958
36239
|
}
|
|
35959
|
-
var columnResizingPluginKey = new
|
|
36240
|
+
var columnResizingPluginKey = new PluginKey5("tableColumnResizing");
|
|
35960
36241
|
|
|
35961
36242
|
// src/components/UEditor/table-controls.tsx
|
|
35962
|
-
var
|
|
36243
|
+
var import_lucide_react53 = require("lucide-react");
|
|
35963
36244
|
|
|
35964
36245
|
// src/components/UEditor/table-layout-model.ts
|
|
35965
36246
|
var FALLBACK_TABLE_ROW_HEIGHT = 44;
|
|
@@ -36272,7 +36553,7 @@ function buildTableHoverState({
|
|
|
36272
36553
|
}
|
|
36273
36554
|
|
|
36274
36555
|
// src/components/UEditor/table-drag-preview.tsx
|
|
36275
|
-
var
|
|
36556
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
36276
36557
|
function TableDragPreview({
|
|
36277
36558
|
columnDragLabel,
|
|
36278
36559
|
dragPreview,
|
|
@@ -36283,9 +36564,9 @@ function TableDragPreview({
|
|
|
36283
36564
|
const expandPreviewWidth = dragPreview.kind === "add-column" ? layout.tableWidth + dragPreview.previewCols * layout.avgColumnWidth : layout.tableWidth;
|
|
36284
36565
|
const expandPreviewHeight = dragPreview.kind === "add-row" ? layout.tableHeight + dragPreview.previewRows * layout.avgRowHeight : layout.tableHeight;
|
|
36285
36566
|
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`;
|
|
36286
|
-
return /* @__PURE__ */ (0,
|
|
36287
|
-
dragPreview.kind === "row" && /* @__PURE__ */ (0,
|
|
36288
|
-
/* @__PURE__ */ (0,
|
|
36567
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_jsx_runtime89.Fragment, { children: [
|
|
36568
|
+
dragPreview.kind === "row" && /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_jsx_runtime89.Fragment, { children: [
|
|
36569
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
36289
36570
|
"div",
|
|
36290
36571
|
{
|
|
36291
36572
|
"aria-hidden": "true",
|
|
@@ -36298,7 +36579,7 @@ function TableDragPreview({
|
|
|
36298
36579
|
}
|
|
36299
36580
|
}
|
|
36300
36581
|
),
|
|
36301
|
-
/* @__PURE__ */ (0,
|
|
36582
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
36302
36583
|
"div",
|
|
36303
36584
|
{
|
|
36304
36585
|
"aria-hidden": "true",
|
|
@@ -36312,8 +36593,8 @@ function TableDragPreview({
|
|
|
36312
36593
|
}
|
|
36313
36594
|
)
|
|
36314
36595
|
] }),
|
|
36315
|
-
dragPreview.kind === "column" && /* @__PURE__ */ (0,
|
|
36316
|
-
/* @__PURE__ */ (0,
|
|
36596
|
+
dragPreview.kind === "column" && /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_jsx_runtime89.Fragment, { children: [
|
|
36597
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
36317
36598
|
"div",
|
|
36318
36599
|
{
|
|
36319
36600
|
"aria-hidden": "true",
|
|
@@ -36326,7 +36607,7 @@ function TableDragPreview({
|
|
|
36326
36607
|
}
|
|
36327
36608
|
}
|
|
36328
36609
|
),
|
|
36329
|
-
/* @__PURE__ */ (0,
|
|
36610
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
36330
36611
|
"div",
|
|
36331
36612
|
{
|
|
36332
36613
|
"aria-hidden": "true",
|
|
@@ -36340,7 +36621,7 @@ function TableDragPreview({
|
|
|
36340
36621
|
}
|
|
36341
36622
|
)
|
|
36342
36623
|
] }),
|
|
36343
|
-
(dragPreview.kind === "add-row" || dragPreview.kind === "add-column") && /* @__PURE__ */ (0,
|
|
36624
|
+
(dragPreview.kind === "add-row" || dragPreview.kind === "add-column") && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
36344
36625
|
"div",
|
|
36345
36626
|
{
|
|
36346
36627
|
"aria-hidden": "true",
|
|
@@ -36353,7 +36634,7 @@ function TableDragPreview({
|
|
|
36353
36634
|
}
|
|
36354
36635
|
}
|
|
36355
36636
|
),
|
|
36356
|
-
/* @__PURE__ */ (0,
|
|
36637
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
36357
36638
|
"div",
|
|
36358
36639
|
{
|
|
36359
36640
|
role: "status",
|
|
@@ -36369,7 +36650,7 @@ function TableDragPreview({
|
|
|
36369
36650
|
}
|
|
36370
36651
|
|
|
36371
36652
|
// src/components/UEditor/table-add-rails.tsx
|
|
36372
|
-
var
|
|
36653
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
36373
36654
|
var ADD_COLUMN_RAIL_GAP = 4;
|
|
36374
36655
|
var ADD_ROW_RAIL_GAP = 4;
|
|
36375
36656
|
function TableAddRails({
|
|
@@ -36390,13 +36671,13 @@ function TableAddRails({
|
|
|
36390
36671
|
const rowRailLeft = visibleBounds.left;
|
|
36391
36672
|
const showColumnRail = controlsVisible || addColumnVisible;
|
|
36392
36673
|
const showRowRail = controlsVisible || addRowVisible;
|
|
36393
|
-
return /* @__PURE__ */ (0,
|
|
36394
|
-
/* @__PURE__ */ (0,
|
|
36674
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(import_jsx_runtime90.Fragment, { children: [
|
|
36675
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
36395
36676
|
Tooltip,
|
|
36396
36677
|
{
|
|
36397
36678
|
placement: "right",
|
|
36398
|
-
content: /* @__PURE__ */ (0,
|
|
36399
|
-
children: /* @__PURE__ */ (0,
|
|
36679
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "text-xs font-medium", children: quickAddColumnLabel }),
|
|
36680
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
36400
36681
|
"button",
|
|
36401
36682
|
{
|
|
36402
36683
|
type: "button",
|
|
@@ -36423,17 +36704,17 @@ function TableAddRails({
|
|
|
36423
36704
|
transform: showColumnRail ? "scale(1)" : "scale(0.92)",
|
|
36424
36705
|
pointerEvents: showColumnRail ? "auto" : "none"
|
|
36425
36706
|
},
|
|
36426
|
-
children: /* @__PURE__ */ (0,
|
|
36707
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "text-sm font-medium leading-none", children: "+" })
|
|
36427
36708
|
}
|
|
36428
36709
|
)
|
|
36429
36710
|
}
|
|
36430
36711
|
),
|
|
36431
|
-
/* @__PURE__ */ (0,
|
|
36712
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
36432
36713
|
Tooltip,
|
|
36433
36714
|
{
|
|
36434
36715
|
placement: "bottom",
|
|
36435
|
-
content: /* @__PURE__ */ (0,
|
|
36436
|
-
children: /* @__PURE__ */ (0,
|
|
36716
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "text-xs font-medium", children: quickAddRowLabel }),
|
|
36717
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
36437
36718
|
"button",
|
|
36438
36719
|
{
|
|
36439
36720
|
type: "button",
|
|
@@ -36460,7 +36741,7 @@ function TableAddRails({
|
|
|
36460
36741
|
transform: showRowRail ? "scale(1)" : "scale(0.92)",
|
|
36461
36742
|
pointerEvents: showRowRail ? "auto" : "none"
|
|
36462
36743
|
},
|
|
36463
|
-
children: /* @__PURE__ */ (0,
|
|
36744
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "text-sm font-medium leading-none", children: "+" })
|
|
36464
36745
|
}
|
|
36465
36746
|
)
|
|
36466
36747
|
}
|
|
@@ -36469,8 +36750,8 @@ function TableAddRails({
|
|
|
36469
36750
|
}
|
|
36470
36751
|
|
|
36471
36752
|
// src/components/UEditor/table-control-menu.tsx
|
|
36472
|
-
var
|
|
36473
|
-
var
|
|
36753
|
+
var import_lucide_react51 = require("lucide-react");
|
|
36754
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
36474
36755
|
function TableControlMenu({
|
|
36475
36756
|
controlsVisible,
|
|
36476
36757
|
isOpen,
|
|
@@ -36482,7 +36763,7 @@ function TableControlMenu({
|
|
|
36482
36763
|
top
|
|
36483
36764
|
}) {
|
|
36484
36765
|
const shown = controlsVisible || menuVisible || isOpen;
|
|
36485
|
-
return /* @__PURE__ */ (0,
|
|
36766
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
36486
36767
|
"div",
|
|
36487
36768
|
{
|
|
36488
36769
|
className: "absolute z-30",
|
|
@@ -36491,13 +36772,13 @@ function TableControlMenu({
|
|
|
36491
36772
|
top,
|
|
36492
36773
|
left
|
|
36493
36774
|
},
|
|
36494
|
-
children: /* @__PURE__ */ (0,
|
|
36775
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
36495
36776
|
Tooltip,
|
|
36496
36777
|
{
|
|
36497
36778
|
placement: "top",
|
|
36498
36779
|
disabled: isOpen,
|
|
36499
|
-
content: /* @__PURE__ */ (0,
|
|
36500
|
-
children: /* @__PURE__ */ (0,
|
|
36780
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "text-xs font-medium", children: label }),
|
|
36781
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "inline-flex", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
36501
36782
|
DropdownMenu,
|
|
36502
36783
|
{
|
|
36503
36784
|
placement: "bottom-start",
|
|
@@ -36505,7 +36786,7 @@ function TableControlMenu({
|
|
|
36505
36786
|
onOpenChange,
|
|
36506
36787
|
contentClassName: "p-2",
|
|
36507
36788
|
items,
|
|
36508
|
-
trigger: /* @__PURE__ */ (0,
|
|
36789
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
36509
36790
|
"button",
|
|
36510
36791
|
{
|
|
36511
36792
|
type: "button",
|
|
@@ -36521,7 +36802,7 @@ function TableControlMenu({
|
|
|
36521
36802
|
transform: shown ? "scale(1)" : "scale(0.82)",
|
|
36522
36803
|
pointerEvents: shown ? "auto" : "none"
|
|
36523
36804
|
},
|
|
36524
|
-
children: /* @__PURE__ */ (0,
|
|
36805
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_lucide_react51.MoreHorizontal, { className: "h-4 w-4" })
|
|
36525
36806
|
}
|
|
36526
36807
|
)
|
|
36527
36808
|
}
|
|
@@ -36533,8 +36814,8 @@ function TableControlMenu({
|
|
|
36533
36814
|
}
|
|
36534
36815
|
|
|
36535
36816
|
// src/components/UEditor/table-axis-handles.tsx
|
|
36536
|
-
var
|
|
36537
|
-
var
|
|
36817
|
+
var import_lucide_react52 = require("lucide-react");
|
|
36818
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
36538
36819
|
var IDLE_HANDLE_SCALE = "0.78";
|
|
36539
36820
|
function TableRowHandles({
|
|
36540
36821
|
activeRowIndex,
|
|
@@ -36548,12 +36829,12 @@ function TableRowHandles({
|
|
|
36548
36829
|
rowHandleLeft,
|
|
36549
36830
|
rowHandles
|
|
36550
36831
|
}) {
|
|
36551
|
-
return /* @__PURE__ */ (0,
|
|
36832
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_jsx_runtime92.Fragment, { children: rowHandles.map((rowHandle) => {
|
|
36552
36833
|
const menuKey = `row:${rowHandle.index}`;
|
|
36553
36834
|
const isActive = rowHandle.index === activeRowIndex;
|
|
36554
36835
|
const visible = controlsVisible || hoverRowHandleIndex === rowHandle.index || openMenuKey === menuKey;
|
|
36555
36836
|
const isShown = visible || isActive;
|
|
36556
|
-
return /* @__PURE__ */ (0,
|
|
36837
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
36557
36838
|
"div",
|
|
36558
36839
|
{
|
|
36559
36840
|
className: "absolute z-30",
|
|
@@ -36562,13 +36843,13 @@ function TableRowHandles({
|
|
|
36562
36843
|
top: Math.max(8, rowHandle.center - 12),
|
|
36563
36844
|
left: rowHandleLeft
|
|
36564
36845
|
},
|
|
36565
|
-
children: /* @__PURE__ */ (0,
|
|
36846
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
36566
36847
|
Tooltip,
|
|
36567
36848
|
{
|
|
36568
36849
|
placement: "right",
|
|
36569
36850
|
disabled: openMenuKey === menuKey || !visible && isActive,
|
|
36570
|
-
content: /* @__PURE__ */ (0,
|
|
36571
|
-
children: /* @__PURE__ */ (0,
|
|
36851
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "text-xs font-medium", children: `${rowDragLabel} ${rowHandle.index + 1}` }),
|
|
36852
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "inline-flex", children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
36572
36853
|
DropdownMenu,
|
|
36573
36854
|
{
|
|
36574
36855
|
placement: "right",
|
|
@@ -36576,7 +36857,7 @@ function TableRowHandles({
|
|
|
36576
36857
|
onOpenChange: (open) => onOpenMenuChange(menuKey, open),
|
|
36577
36858
|
contentClassName: "p-2",
|
|
36578
36859
|
items: getMenuItems(rowHandle),
|
|
36579
|
-
trigger: /* @__PURE__ */ (0,
|
|
36860
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
36580
36861
|
"button",
|
|
36581
36862
|
{
|
|
36582
36863
|
type: "button",
|
|
@@ -36595,7 +36876,7 @@ function TableRowHandles({
|
|
|
36595
36876
|
transform: isShown ? "scale(1)" : `scale(${IDLE_HANDLE_SCALE})`,
|
|
36596
36877
|
pointerEvents: isShown ? "auto" : "none"
|
|
36597
36878
|
},
|
|
36598
|
-
children: visible ? /* @__PURE__ */ (0,
|
|
36879
|
+
children: visible ? /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.GripVertical, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "h-3 w-1 rounded-full bg-muted-foreground/50 hover:bg-muted-foreground" })
|
|
36599
36880
|
}
|
|
36600
36881
|
)
|
|
36601
36882
|
}
|
|
@@ -36619,12 +36900,12 @@ function TableColumnHandles({
|
|
|
36619
36900
|
onStartDrag,
|
|
36620
36901
|
openMenuKey
|
|
36621
36902
|
}) {
|
|
36622
|
-
return /* @__PURE__ */ (0,
|
|
36903
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_jsx_runtime92.Fragment, { children: columnHandles.map((columnHandle) => {
|
|
36623
36904
|
const menuKey = `column:${columnHandle.index}`;
|
|
36624
36905
|
const isActive = columnHandle.index === activeColumnIndex;
|
|
36625
36906
|
const visible = controlsVisible || hoverColumnHandleIndex === columnHandle.index || openMenuKey === menuKey;
|
|
36626
36907
|
const isShown = visible || isActive;
|
|
36627
|
-
return /* @__PURE__ */ (0,
|
|
36908
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
36628
36909
|
"div",
|
|
36629
36910
|
{
|
|
36630
36911
|
className: "absolute z-30",
|
|
@@ -36633,13 +36914,13 @@ function TableColumnHandles({
|
|
|
36633
36914
|
top: columnHandleTop,
|
|
36634
36915
|
left: Math.max(8, columnHandle.center - 12)
|
|
36635
36916
|
},
|
|
36636
|
-
children: /* @__PURE__ */ (0,
|
|
36917
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
36637
36918
|
Tooltip,
|
|
36638
36919
|
{
|
|
36639
36920
|
placement: "top",
|
|
36640
36921
|
disabled: openMenuKey === menuKey || !visible && isActive,
|
|
36641
|
-
content: /* @__PURE__ */ (0,
|
|
36642
|
-
children: /* @__PURE__ */ (0,
|
|
36922
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "text-xs font-medium", children: `${columnDragLabel} ${columnHandle.index + 1}` }),
|
|
36923
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "inline-flex", children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
36643
36924
|
DropdownMenu,
|
|
36644
36925
|
{
|
|
36645
36926
|
placement: "bottom-start",
|
|
@@ -36647,7 +36928,7 @@ function TableColumnHandles({
|
|
|
36647
36928
|
onOpenChange: (open) => onOpenMenuChange(menuKey, open),
|
|
36648
36929
|
contentClassName: "p-2",
|
|
36649
36930
|
items: getMenuItems(columnHandle),
|
|
36650
|
-
trigger: /* @__PURE__ */ (0,
|
|
36931
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
36651
36932
|
"button",
|
|
36652
36933
|
{
|
|
36653
36934
|
type: "button",
|
|
@@ -36666,7 +36947,7 @@ function TableColumnHandles({
|
|
|
36666
36947
|
transform: isShown ? "scale(1)" : `scale(${IDLE_HANDLE_SCALE})`,
|
|
36667
36948
|
pointerEvents: isShown ? "auto" : "none"
|
|
36668
36949
|
},
|
|
36669
|
-
children: visible ? /* @__PURE__ */ (0,
|
|
36950
|
+
children: visible ? /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.GripHorizontal, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "h-1 w-3 rounded-full bg-muted-foreground/50 hover:bg-muted-foreground" })
|
|
36670
36951
|
}
|
|
36671
36952
|
)
|
|
36672
36953
|
}
|
|
@@ -36680,7 +36961,7 @@ function TableColumnHandles({
|
|
|
36680
36961
|
}
|
|
36681
36962
|
|
|
36682
36963
|
// src/components/UEditor/table-controls.tsx
|
|
36683
|
-
var
|
|
36964
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
36684
36965
|
var TABLE_MENU_TOP_OFFSET = 10;
|
|
36685
36966
|
function nearestIndex(centers, position) {
|
|
36686
36967
|
let bestIndex = 0;
|
|
@@ -36706,17 +36987,17 @@ function getSelectedCell(editor) {
|
|
|
36706
36987
|
}
|
|
36707
36988
|
function TableControls({ editor, containerRef }) {
|
|
36708
36989
|
const t = useSmartTranslations("UEditor");
|
|
36709
|
-
const [layout, setLayout] =
|
|
36710
|
-
const [dragPreview, setDragPreview] =
|
|
36711
|
-
const [hoverState, setHoverState] =
|
|
36712
|
-
const [openMenuKey, setOpenMenuKey] =
|
|
36713
|
-
const layoutRef =
|
|
36714
|
-
const dragStateRef =
|
|
36715
|
-
const syncFrameRef =
|
|
36716
|
-
|
|
36990
|
+
const [layout, setLayout] = import_react66.default.useState(null);
|
|
36991
|
+
const [dragPreview, setDragPreview] = import_react66.default.useState(null);
|
|
36992
|
+
const [hoverState, setHoverState] = import_react66.default.useState(DEFAULT_TABLE_HOVER_STATE);
|
|
36993
|
+
const [openMenuKey, setOpenMenuKey] = import_react66.default.useState(null);
|
|
36994
|
+
const layoutRef = import_react66.default.useRef(null);
|
|
36995
|
+
const dragStateRef = import_react66.default.useRef(null);
|
|
36996
|
+
const syncFrameRef = import_react66.default.useRef(null);
|
|
36997
|
+
import_react66.default.useEffect(() => {
|
|
36717
36998
|
layoutRef.current = layout;
|
|
36718
36999
|
}, [layout]);
|
|
36719
|
-
const syncFromCell =
|
|
37000
|
+
const syncFromCell = import_react66.default.useCallback((cell) => {
|
|
36720
37001
|
const surface = containerRef.current;
|
|
36721
37002
|
if (!surface || !cell) {
|
|
36722
37003
|
setLayout(null);
|
|
@@ -36724,23 +37005,23 @@ function TableControls({ editor, containerRef }) {
|
|
|
36724
37005
|
}
|
|
36725
37006
|
setLayout(buildTableControlLayout(editor, surface, cell));
|
|
36726
37007
|
}, [containerRef, editor]);
|
|
36727
|
-
const syncFromSelection =
|
|
37008
|
+
const syncFromSelection = import_react66.default.useCallback(() => {
|
|
36728
37009
|
syncFromCell(getSelectedCell(editor));
|
|
36729
37010
|
}, [editor, syncFromCell]);
|
|
36730
|
-
const scheduleSyncFromSelection =
|
|
37011
|
+
const scheduleSyncFromSelection = import_react66.default.useCallback(() => {
|
|
36731
37012
|
if (syncFrameRef.current !== null) return;
|
|
36732
37013
|
syncFrameRef.current = window.requestAnimationFrame(() => {
|
|
36733
37014
|
syncFrameRef.current = null;
|
|
36734
37015
|
syncFromSelection();
|
|
36735
37016
|
});
|
|
36736
37017
|
}, [syncFromSelection]);
|
|
36737
|
-
|
|
37018
|
+
import_react66.default.useEffect(() => () => {
|
|
36738
37019
|
if (syncFrameRef.current !== null) {
|
|
36739
37020
|
window.cancelAnimationFrame(syncFrameRef.current);
|
|
36740
37021
|
syncFrameRef.current = null;
|
|
36741
37022
|
}
|
|
36742
37023
|
}, []);
|
|
36743
|
-
const refreshCurrentLayout =
|
|
37024
|
+
const refreshCurrentLayout = import_react66.default.useCallback(() => {
|
|
36744
37025
|
setLayout((prev) => {
|
|
36745
37026
|
if (!prev) return prev;
|
|
36746
37027
|
const surface = containerRef.current;
|
|
@@ -36750,12 +37031,12 @@ function TableControls({ editor, containerRef }) {
|
|
|
36750
37031
|
return cell ? buildTableControlLayout(editor, surface, cell) : null;
|
|
36751
37032
|
});
|
|
36752
37033
|
}, [containerRef, editor]);
|
|
36753
|
-
const clearDrag =
|
|
37034
|
+
const clearDrag = import_react66.default.useCallback(() => {
|
|
36754
37035
|
dragStateRef.current = null;
|
|
36755
37036
|
setDragPreview(null);
|
|
36756
37037
|
document.body.style.cursor = "";
|
|
36757
37038
|
}, []);
|
|
36758
|
-
const updateHoverState =
|
|
37039
|
+
const updateHoverState = import_react66.default.useCallback((event) => {
|
|
36759
37040
|
const activeLayout = layoutRef.current;
|
|
36760
37041
|
const surface = containerRef.current;
|
|
36761
37042
|
if (!activeLayout || !surface || dragStateRef.current) {
|
|
@@ -36771,7 +37052,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
36771
37052
|
return areTableHoverStatesEqual(prev, nextState) ? prev : nextState;
|
|
36772
37053
|
});
|
|
36773
37054
|
}, [containerRef]);
|
|
36774
|
-
|
|
37055
|
+
import_react66.default.useEffect(() => {
|
|
36775
37056
|
const proseMirror = editor.view.dom;
|
|
36776
37057
|
const surface = containerRef.current;
|
|
36777
37058
|
if (!surface) return void 0;
|
|
@@ -36822,37 +37103,37 @@ function TableControls({ editor, containerRef }) {
|
|
|
36822
37103
|
editor.off("update", refreshCurrentLayout);
|
|
36823
37104
|
};
|
|
36824
37105
|
}, [clearDrag, containerRef, editor, refreshCurrentLayout, syncFromCell, syncFromSelection, updateHoverState]);
|
|
36825
|
-
const runAtCellPos =
|
|
37106
|
+
const runAtCellPos = import_react66.default.useCallback((cellPos, command, options) => {
|
|
36826
37107
|
const result = runTableCommandAtCellPos(editor, cellPos, command);
|
|
36827
37108
|
if (options?.sync !== false) {
|
|
36828
37109
|
scheduleSyncFromSelection();
|
|
36829
37110
|
}
|
|
36830
37111
|
return result;
|
|
36831
37112
|
}, [editor, scheduleSyncFromSelection]);
|
|
36832
|
-
const runAtActiveCell =
|
|
37113
|
+
const runAtActiveCell = import_react66.default.useCallback((command, options) => {
|
|
36833
37114
|
return runAtCellPos(layoutRef.current?.cellPos ?? null, command, options);
|
|
36834
37115
|
}, [runAtCellPos]);
|
|
36835
|
-
const duplicateRowAt =
|
|
37116
|
+
const duplicateRowAt = import_react66.default.useCallback((rowIndex, cellPos) => {
|
|
36836
37117
|
const result = duplicateTableRowAt(editor, rowIndex, cellPos);
|
|
36837
37118
|
scheduleSyncFromSelection();
|
|
36838
37119
|
return result;
|
|
36839
37120
|
}, [editor, scheduleSyncFromSelection]);
|
|
36840
|
-
const clearRowAt =
|
|
37121
|
+
const clearRowAt = import_react66.default.useCallback((rowIndex, cellPos) => {
|
|
36841
37122
|
const result = clearTableRowAt(editor, rowIndex, cellPos);
|
|
36842
37123
|
scheduleSyncFromSelection();
|
|
36843
37124
|
return result;
|
|
36844
37125
|
}, [editor, scheduleSyncFromSelection]);
|
|
36845
|
-
const duplicateColumnAt =
|
|
37126
|
+
const duplicateColumnAt = import_react66.default.useCallback((columnIndex, cellPos) => {
|
|
36846
37127
|
const result = duplicateTableColumnAt(editor, columnIndex, cellPos);
|
|
36847
37128
|
scheduleSyncFromSelection();
|
|
36848
37129
|
return result;
|
|
36849
37130
|
}, [editor, scheduleSyncFromSelection]);
|
|
36850
|
-
const clearColumnAt =
|
|
37131
|
+
const clearColumnAt = import_react66.default.useCallback((columnIndex, cellPos) => {
|
|
36851
37132
|
const result = clearTableColumnAt(editor, columnIndex, cellPos);
|
|
36852
37133
|
scheduleSyncFromSelection();
|
|
36853
37134
|
return result;
|
|
36854
37135
|
}, [editor, scheduleSyncFromSelection]);
|
|
36855
|
-
const expandTableBy =
|
|
37136
|
+
const expandTableBy = import_react66.default.useCallback((rows, cols) => {
|
|
36856
37137
|
const activeCellPos = layoutRef.current?.cellPos ?? editor.state.selection.from;
|
|
36857
37138
|
const result = expandTableFromCell(editor, activeCellPos, rows, cols);
|
|
36858
37139
|
scheduleSyncFromSelection();
|
|
@@ -36861,19 +37142,19 @@ function TableControls({ editor, containerRef }) {
|
|
|
36861
37142
|
const canExpandTable = Boolean(layout);
|
|
36862
37143
|
const controlsVisible = dragPreview !== null;
|
|
36863
37144
|
const tableMenuOpen = openMenuKey === "table";
|
|
36864
|
-
const startAddColumnDrag =
|
|
37145
|
+
const startAddColumnDrag = import_react66.default.useCallback(() => {
|
|
36865
37146
|
setOpenMenuKey(null);
|
|
36866
37147
|
dragStateRef.current = { kind: "add-column", previewCols: 1 };
|
|
36867
37148
|
setDragPreview({ kind: "add-column", previewCols: 1 });
|
|
36868
37149
|
document.body.style.cursor = "ew-resize";
|
|
36869
37150
|
}, []);
|
|
36870
|
-
const startAddRowDrag =
|
|
37151
|
+
const startAddRowDrag = import_react66.default.useCallback(() => {
|
|
36871
37152
|
setOpenMenuKey(null);
|
|
36872
37153
|
dragStateRef.current = { kind: "add-row", previewRows: 1 };
|
|
36873
37154
|
setDragPreview({ kind: "add-row", previewRows: 1 });
|
|
36874
37155
|
document.body.style.cursor = "ns-resize";
|
|
36875
37156
|
}, []);
|
|
36876
|
-
const startRowDrag =
|
|
37157
|
+
const startRowDrag = import_react66.default.useCallback((rowHandle) => {
|
|
36877
37158
|
setOpenMenuKey(null);
|
|
36878
37159
|
dragStateRef.current = {
|
|
36879
37160
|
kind: "row",
|
|
@@ -36890,7 +37171,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
36890
37171
|
});
|
|
36891
37172
|
document.body.style.cursor = "grabbing";
|
|
36892
37173
|
}, []);
|
|
36893
|
-
const startColumnDrag =
|
|
37174
|
+
const startColumnDrag = import_react66.default.useCallback((columnHandle) => {
|
|
36894
37175
|
setOpenMenuKey(null);
|
|
36895
37176
|
dragStateRef.current = {
|
|
36896
37177
|
kind: "column",
|
|
@@ -36907,7 +37188,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
36907
37188
|
});
|
|
36908
37189
|
document.body.style.cursor = "grabbing";
|
|
36909
37190
|
}, []);
|
|
36910
|
-
|
|
37191
|
+
import_react66.default.useEffect(() => {
|
|
36911
37192
|
const handleMouseMove = (event) => {
|
|
36912
37193
|
const dragState = dragStateRef.current;
|
|
36913
37194
|
const activeLayout = layoutRef.current;
|
|
@@ -36996,126 +37277,126 @@ function TableControls({ editor, containerRef }) {
|
|
|
36996
37277
|
window.removeEventListener("blur", clearDrag);
|
|
36997
37278
|
};
|
|
36998
37279
|
}, [clearDrag, containerRef, editor, expandTableBy, scheduleSyncFromSelection]);
|
|
36999
|
-
const menuItems =
|
|
37280
|
+
const menuItems = import_react66.default.useMemo(() => {
|
|
37000
37281
|
if (!layout) return [];
|
|
37001
37282
|
return [
|
|
37002
37283
|
{
|
|
37003
37284
|
label: t("tableMenu.alignLeft"),
|
|
37004
|
-
icon:
|
|
37285
|
+
icon: import_lucide_react53.AlignLeft,
|
|
37005
37286
|
onClick: () => applyTableAlignment(editor, "left", layout.cellPos)
|
|
37006
37287
|
},
|
|
37007
37288
|
{
|
|
37008
37289
|
label: t("tableMenu.alignCenter"),
|
|
37009
|
-
icon:
|
|
37290
|
+
icon: import_lucide_react53.AlignCenter,
|
|
37010
37291
|
onClick: () => applyTableAlignment(editor, "center", layout.cellPos)
|
|
37011
37292
|
},
|
|
37012
37293
|
{
|
|
37013
37294
|
label: t("tableMenu.alignRight"),
|
|
37014
|
-
icon:
|
|
37295
|
+
icon: import_lucide_react53.AlignRight,
|
|
37015
37296
|
onClick: () => applyTableAlignment(editor, "right", layout.cellPos)
|
|
37016
37297
|
},
|
|
37017
37298
|
{
|
|
37018
37299
|
label: t("tableMenu.addColumnBefore"),
|
|
37019
|
-
icon:
|
|
37300
|
+
icon: import_lucide_react53.ArrowLeft,
|
|
37020
37301
|
onClick: () => runAtActiveCell((chain) => chain.addColumnBefore())
|
|
37021
37302
|
},
|
|
37022
37303
|
{
|
|
37023
37304
|
label: t("tableMenu.addColumnAfter"),
|
|
37024
|
-
icon:
|
|
37305
|
+
icon: import_lucide_react53.ArrowRight,
|
|
37025
37306
|
onClick: () => runAtActiveCell((chain) => chain.addColumnAfter())
|
|
37026
37307
|
},
|
|
37027
37308
|
{
|
|
37028
37309
|
label: t("tableMenu.addRowBefore"),
|
|
37029
|
-
icon:
|
|
37310
|
+
icon: import_lucide_react53.ArrowUp,
|
|
37030
37311
|
onClick: () => runAtActiveCell((chain) => chain.addRowBefore())
|
|
37031
37312
|
},
|
|
37032
37313
|
{
|
|
37033
37314
|
label: t("tableMenu.addRowAfter"),
|
|
37034
|
-
icon:
|
|
37315
|
+
icon: import_lucide_react53.ArrowDown,
|
|
37035
37316
|
onClick: () => runAtActiveCell((chain) => chain.addRowAfter())
|
|
37036
37317
|
},
|
|
37037
37318
|
{
|
|
37038
37319
|
label: t("tableMenu.toggleHeaderRow"),
|
|
37039
|
-
icon:
|
|
37320
|
+
icon: import_lucide_react53.Table,
|
|
37040
37321
|
onClick: () => runAtActiveCell((chain) => chain.toggleHeaderRow())
|
|
37041
37322
|
},
|
|
37042
37323
|
{
|
|
37043
37324
|
label: t("tableMenu.toggleHeaderColumn"),
|
|
37044
|
-
icon:
|
|
37325
|
+
icon: import_lucide_react53.Table,
|
|
37045
37326
|
onClick: () => runAtActiveCell((chain) => chain.toggleHeaderColumn())
|
|
37046
37327
|
},
|
|
37047
37328
|
{
|
|
37048
37329
|
label: t("tableMenu.deleteColumn"),
|
|
37049
|
-
icon:
|
|
37330
|
+
icon: import_lucide_react53.Trash2,
|
|
37050
37331
|
onClick: () => runAtActiveCell((chain) => chain.deleteColumn()),
|
|
37051
37332
|
destructive: true
|
|
37052
37333
|
},
|
|
37053
37334
|
{
|
|
37054
37335
|
label: t("tableMenu.deleteRow"),
|
|
37055
|
-
icon:
|
|
37336
|
+
icon: import_lucide_react53.Trash2,
|
|
37056
37337
|
onClick: () => runAtActiveCell((chain) => chain.deleteRow()),
|
|
37057
37338
|
destructive: true
|
|
37058
37339
|
},
|
|
37059
37340
|
{
|
|
37060
37341
|
label: t("tableMenu.deleteTable"),
|
|
37061
|
-
icon:
|
|
37342
|
+
icon: import_lucide_react53.Trash2,
|
|
37062
37343
|
onClick: () => runAtActiveCell((chain) => chain.deleteTable()),
|
|
37063
37344
|
destructive: true
|
|
37064
37345
|
}
|
|
37065
37346
|
];
|
|
37066
37347
|
}, [layout, runAtActiveCell, t]);
|
|
37067
|
-
const getRowHandleMenuItems =
|
|
37348
|
+
const getRowHandleMenuItems = import_react66.default.useCallback((rowHandle) => [
|
|
37068
37349
|
{
|
|
37069
37350
|
label: t("tableMenu.addRowBefore"),
|
|
37070
|
-
icon:
|
|
37351
|
+
icon: import_lucide_react53.ArrowUp,
|
|
37071
37352
|
onClick: () => runAtCellPos(rowHandle.cellPos, (chain) => chain.addRowBefore())
|
|
37072
37353
|
},
|
|
37073
37354
|
{
|
|
37074
37355
|
label: t("tableMenu.addRowAfter"),
|
|
37075
|
-
icon:
|
|
37356
|
+
icon: import_lucide_react53.ArrowDown,
|
|
37076
37357
|
onClick: () => runAtCellPos(rowHandle.cellPos, (chain) => chain.addRowAfter())
|
|
37077
37358
|
},
|
|
37078
37359
|
{
|
|
37079
37360
|
label: t("tableMenu.duplicateRow"),
|
|
37080
|
-
icon:
|
|
37361
|
+
icon: import_lucide_react53.Copy,
|
|
37081
37362
|
onClick: () => duplicateRowAt(rowHandle.index, rowHandle.cellPos)
|
|
37082
37363
|
},
|
|
37083
37364
|
{
|
|
37084
37365
|
label: t("tableMenu.clearRowContents"),
|
|
37085
|
-
icon:
|
|
37366
|
+
icon: import_lucide_react53.Table,
|
|
37086
37367
|
onClick: () => clearRowAt(rowHandle.index, rowHandle.cellPos)
|
|
37087
37368
|
},
|
|
37088
37369
|
{
|
|
37089
37370
|
label: t("tableMenu.deleteRow"),
|
|
37090
|
-
icon:
|
|
37371
|
+
icon: import_lucide_react53.Trash2,
|
|
37091
37372
|
onClick: () => runAtCellPos(rowHandle.cellPos, (chain) => chain.deleteRow()),
|
|
37092
37373
|
destructive: true
|
|
37093
37374
|
}
|
|
37094
37375
|
], [clearRowAt, duplicateRowAt, runAtCellPos, t]);
|
|
37095
|
-
const getColumnHandleMenuItems =
|
|
37376
|
+
const getColumnHandleMenuItems = import_react66.default.useCallback((columnHandle) => [
|
|
37096
37377
|
{
|
|
37097
37378
|
label: t("tableMenu.addColumnBefore"),
|
|
37098
|
-
icon:
|
|
37379
|
+
icon: import_lucide_react53.ArrowLeft,
|
|
37099
37380
|
onClick: () => runAtCellPos(columnHandle.cellPos, (chain) => chain.addColumnBefore())
|
|
37100
37381
|
},
|
|
37101
37382
|
{
|
|
37102
37383
|
label: t("tableMenu.addColumnAfter"),
|
|
37103
|
-
icon:
|
|
37384
|
+
icon: import_lucide_react53.ArrowRight,
|
|
37104
37385
|
onClick: () => runAtCellPos(columnHandle.cellPos, (chain) => chain.addColumnAfter())
|
|
37105
37386
|
},
|
|
37106
37387
|
{
|
|
37107
37388
|
label: t("tableMenu.duplicateColumn"),
|
|
37108
|
-
icon:
|
|
37389
|
+
icon: import_lucide_react53.Copy,
|
|
37109
37390
|
onClick: () => duplicateColumnAt(columnHandle.index, columnHandle.cellPos)
|
|
37110
37391
|
},
|
|
37111
37392
|
{
|
|
37112
37393
|
label: t("tableMenu.clearColumnContents"),
|
|
37113
|
-
icon:
|
|
37394
|
+
icon: import_lucide_react53.Table,
|
|
37114
37395
|
onClick: () => clearColumnAt(columnHandle.index, columnHandle.cellPos)
|
|
37115
37396
|
},
|
|
37116
37397
|
{
|
|
37117
37398
|
label: t("tableMenu.deleteColumn"),
|
|
37118
|
-
icon:
|
|
37399
|
+
icon: import_lucide_react53.Trash2,
|
|
37119
37400
|
onClick: () => runAtCellPos(columnHandle.cellPos, (chain) => chain.deleteColumn()),
|
|
37120
37401
|
destructive: true
|
|
37121
37402
|
}
|
|
@@ -37127,8 +37408,8 @@ function TableControls({ editor, containerRef }) {
|
|
|
37127
37408
|
const menuLeft = Math.max(8, layout.tableLeft);
|
|
37128
37409
|
const rowHandleLeft = layout.tableLeft - 12;
|
|
37129
37410
|
const columnHandleTop = layout.tableTop - 12;
|
|
37130
|
-
return /* @__PURE__ */ (0,
|
|
37131
|
-
/* @__PURE__ */ (0,
|
|
37411
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
|
|
37412
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
37132
37413
|
TableRowHandles,
|
|
37133
37414
|
{
|
|
37134
37415
|
activeRowIndex: layout.activeRowIndex,
|
|
@@ -37145,7 +37426,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
37145
37426
|
rowHandles: layout.rowHandles
|
|
37146
37427
|
}
|
|
37147
37428
|
),
|
|
37148
|
-
/* @__PURE__ */ (0,
|
|
37429
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
37149
37430
|
TableColumnHandles,
|
|
37150
37431
|
{
|
|
37151
37432
|
activeColumnIndex: layout.activeColumnIndex,
|
|
@@ -37162,7 +37443,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
37162
37443
|
openMenuKey
|
|
37163
37444
|
}
|
|
37164
37445
|
),
|
|
37165
|
-
/* @__PURE__ */ (0,
|
|
37446
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
37166
37447
|
TableControlMenu,
|
|
37167
37448
|
{
|
|
37168
37449
|
controlsVisible,
|
|
@@ -37177,7 +37458,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
37177
37458
|
top: menuTop
|
|
37178
37459
|
}
|
|
37179
37460
|
),
|
|
37180
|
-
/* @__PURE__ */ (0,
|
|
37461
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
37181
37462
|
TableAddRails,
|
|
37182
37463
|
{
|
|
37183
37464
|
addColumnVisible: hoverState.addColumnVisible,
|
|
@@ -37191,7 +37472,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
37191
37472
|
quickAddRowLabel: t("tableMenu.quickAddRowAfter")
|
|
37192
37473
|
}
|
|
37193
37474
|
),
|
|
37194
|
-
/* @__PURE__ */ (0,
|
|
37475
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
37195
37476
|
TableDragPreview,
|
|
37196
37477
|
{
|
|
37197
37478
|
columnDragLabel: t("tableMenu.dragColumn"),
|
|
@@ -37362,10 +37643,10 @@ var UEDITOR_PROSEMIRROR_CLASS_NAME = cn(
|
|
|
37362
37643
|
);
|
|
37363
37644
|
|
|
37364
37645
|
// src/components/UEditor/use-table-interactions.ts
|
|
37365
|
-
var
|
|
37646
|
+
var import_react68 = __toESM(require("react"), 1);
|
|
37366
37647
|
|
|
37367
37648
|
// src/components/UEditor/use-table-row-resize.ts
|
|
37368
|
-
var
|
|
37649
|
+
var import_react67 = __toESM(require("react"), 1);
|
|
37369
37650
|
function useTableRowResize({
|
|
37370
37651
|
editor,
|
|
37371
37652
|
setHoveredTableCell,
|
|
@@ -37374,9 +37655,9 @@ function useTableRowResize({
|
|
|
37374
37655
|
clearAllTableResizeHover,
|
|
37375
37656
|
scheduleTableLayoutSync
|
|
37376
37657
|
}) {
|
|
37377
|
-
const commitFrameRef = (0,
|
|
37378
|
-
const stateRef = (0,
|
|
37379
|
-
const commitPreview =
|
|
37658
|
+
const commitFrameRef = (0, import_react67.useRef)(null);
|
|
37659
|
+
const stateRef = (0, import_react67.useRef)(null);
|
|
37660
|
+
const commitPreview = import_react67.default.useCallback(() => {
|
|
37380
37661
|
if (!editor) return;
|
|
37381
37662
|
const state = stateRef.current;
|
|
37382
37663
|
if (!state) return;
|
|
@@ -37411,22 +37692,22 @@ function useTableRowResize({
|
|
|
37411
37692
|
showRowGuide(state.tableElement, state.rowElement, state.cellElement);
|
|
37412
37693
|
scheduleTableLayoutSync();
|
|
37413
37694
|
}, [editor, scheduleTableLayoutSync, showRowGuide]);
|
|
37414
|
-
const scheduleCommit =
|
|
37695
|
+
const scheduleCommit = import_react67.default.useCallback(() => {
|
|
37415
37696
|
if (commitFrameRef.current !== null) return;
|
|
37416
37697
|
commitFrameRef.current = window.requestAnimationFrame(() => {
|
|
37417
37698
|
commitFrameRef.current = null;
|
|
37418
37699
|
commitPreview();
|
|
37419
37700
|
});
|
|
37420
37701
|
}, [commitPreview]);
|
|
37421
|
-
const syncActiveGuide =
|
|
37702
|
+
const syncActiveGuide = import_react67.default.useCallback(() => {
|
|
37422
37703
|
const state = stateRef.current;
|
|
37423
37704
|
if (!state) return false;
|
|
37424
37705
|
setHoveredTableCell(state.cellElement);
|
|
37425
37706
|
showRowGuide(state.tableElement, state.rowElement, state.cellElement);
|
|
37426
37707
|
return true;
|
|
37427
37708
|
}, [setHoveredTableCell, showRowGuide]);
|
|
37428
|
-
const isResizing =
|
|
37429
|
-
const beginResize =
|
|
37709
|
+
const isResizing = import_react67.default.useCallback(() => stateRef.current !== null, []);
|
|
37710
|
+
const beginResize = import_react67.default.useCallback((event, table, row, cell) => {
|
|
37430
37711
|
if (!editor || !isRowResizeHotspot(cell, event.clientX, event.clientY)) {
|
|
37431
37712
|
return false;
|
|
37432
37713
|
}
|
|
@@ -37452,7 +37733,7 @@ function useTableRowResize({
|
|
|
37452
37733
|
event.stopPropagation();
|
|
37453
37734
|
return true;
|
|
37454
37735
|
}, [editor, setHoveredTableCell, showRowGuide]);
|
|
37455
|
-
const handlePointerMove =
|
|
37736
|
+
const handlePointerMove = import_react67.default.useCallback((event) => {
|
|
37456
37737
|
const state = stateRef.current;
|
|
37457
37738
|
if (!state) return;
|
|
37458
37739
|
const nextHeight = Math.max(
|
|
@@ -37468,7 +37749,7 @@ function useTableRowResize({
|
|
|
37468
37749
|
document.body.style.cursor = "row-resize";
|
|
37469
37750
|
scheduleCommit();
|
|
37470
37751
|
}, [scheduleCommit, showRowGuide]);
|
|
37471
|
-
const handlePointerUp =
|
|
37752
|
+
const handlePointerUp = import_react67.default.useCallback((event) => {
|
|
37472
37753
|
if (!editor) return;
|
|
37473
37754
|
const state = stateRef.current;
|
|
37474
37755
|
if (!state) return;
|
|
@@ -37498,7 +37779,7 @@ function useTableRowResize({
|
|
|
37498
37779
|
clearAllTableResizeHover();
|
|
37499
37780
|
scheduleTableLayoutSync();
|
|
37500
37781
|
}, [clearAllTableResizeHover, clearHoveredTableCell, commitPreview, editor, scheduleTableLayoutSync]);
|
|
37501
|
-
const cancelResize =
|
|
37782
|
+
const cancelResize = import_react67.default.useCallback(() => {
|
|
37502
37783
|
if (!stateRef.current) return;
|
|
37503
37784
|
if (commitFrameRef.current !== null) {
|
|
37504
37785
|
window.cancelAnimationFrame(commitFrameRef.current);
|
|
@@ -37510,7 +37791,7 @@ function useTableRowResize({
|
|
|
37510
37791
|
clearAllTableResizeHover();
|
|
37511
37792
|
scheduleTableLayoutSync();
|
|
37512
37793
|
}, [clearAllTableResizeHover, clearHoveredTableCell, scheduleTableLayoutSync]);
|
|
37513
|
-
const cleanup =
|
|
37794
|
+
const cleanup = import_react67.default.useCallback(() => {
|
|
37514
37795
|
if (commitFrameRef.current !== null) {
|
|
37515
37796
|
window.cancelAnimationFrame(commitFrameRef.current);
|
|
37516
37797
|
commitFrameRef.current = null;
|
|
@@ -37531,24 +37812,24 @@ function useTableRowResize({
|
|
|
37531
37812
|
|
|
37532
37813
|
// src/components/UEditor/use-table-interactions.ts
|
|
37533
37814
|
function useUEditorTableInteractions(editor, editable = true) {
|
|
37534
|
-
const editorContentRef = (0,
|
|
37535
|
-
const tableColumnGuideRef = (0,
|
|
37536
|
-
const tableRowGuideRef = (0,
|
|
37537
|
-
const activeTableCellHighlightRef = (0,
|
|
37538
|
-
const hoveredTableCellRef = (0,
|
|
37539
|
-
const activeTableCellRef = (0,
|
|
37540
|
-
const suppressActiveCellHighlightRef = (0,
|
|
37541
|
-
const tableLayoutSyncFrameRef = (0,
|
|
37542
|
-
const getProseMirrorElement =
|
|
37815
|
+
const editorContentRef = (0, import_react68.useRef)(null);
|
|
37816
|
+
const tableColumnGuideRef = (0, import_react68.useRef)(null);
|
|
37817
|
+
const tableRowGuideRef = (0, import_react68.useRef)(null);
|
|
37818
|
+
const activeTableCellHighlightRef = (0, import_react68.useRef)(null);
|
|
37819
|
+
const hoveredTableCellRef = (0, import_react68.useRef)(null);
|
|
37820
|
+
const activeTableCellRef = (0, import_react68.useRef)(null);
|
|
37821
|
+
const suppressActiveCellHighlightRef = (0, import_react68.useRef)(false);
|
|
37822
|
+
const tableLayoutSyncFrameRef = (0, import_react68.useRef)(null);
|
|
37823
|
+
const getProseMirrorElement = import_react68.default.useCallback(() => {
|
|
37543
37824
|
return editorContentRef.current?.querySelector(".ProseMirror");
|
|
37544
37825
|
}, []);
|
|
37545
|
-
const setEditorResizeCursor =
|
|
37826
|
+
const setEditorResizeCursor = import_react68.default.useCallback((cursor) => {
|
|
37546
37827
|
const proseMirror = getProseMirrorElement();
|
|
37547
37828
|
if (proseMirror) {
|
|
37548
37829
|
proseMirror.style.cursor = cursor;
|
|
37549
37830
|
}
|
|
37550
37831
|
}, [getProseMirrorElement]);
|
|
37551
|
-
const hideColumnGuide =
|
|
37832
|
+
const hideColumnGuide = import_react68.default.useCallback(() => {
|
|
37552
37833
|
editorContentRef.current?.classList.remove("resize-cursor");
|
|
37553
37834
|
getProseMirrorElement()?.classList.remove("resize-cursor");
|
|
37554
37835
|
const guide = tableColumnGuideRef.current;
|
|
@@ -37556,7 +37837,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
37556
37837
|
guide.style.opacity = "0";
|
|
37557
37838
|
}
|
|
37558
37839
|
}, [getProseMirrorElement]);
|
|
37559
|
-
const hideRowGuide =
|
|
37840
|
+
const hideRowGuide = import_react68.default.useCallback(() => {
|
|
37560
37841
|
editorContentRef.current?.classList.remove("resize-row-cursor");
|
|
37561
37842
|
getProseMirrorElement()?.classList.remove("resize-row-cursor");
|
|
37562
37843
|
const guide = tableRowGuideRef.current;
|
|
@@ -37564,12 +37845,12 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
37564
37845
|
guide.style.opacity = "0";
|
|
37565
37846
|
}
|
|
37566
37847
|
}, [getProseMirrorElement]);
|
|
37567
|
-
const clearAllTableResizeHover =
|
|
37848
|
+
const clearAllTableResizeHover = import_react68.default.useCallback(() => {
|
|
37568
37849
|
setEditorResizeCursor("");
|
|
37569
37850
|
hideColumnGuide();
|
|
37570
37851
|
hideRowGuide();
|
|
37571
37852
|
}, [hideColumnGuide, hideRowGuide, setEditorResizeCursor]);
|
|
37572
|
-
const updateActiveCellHighlight =
|
|
37853
|
+
const updateActiveCellHighlight = import_react68.default.useCallback((cell) => {
|
|
37573
37854
|
const surface = editorContentRef.current;
|
|
37574
37855
|
const highlight = activeTableCellHighlightRef.current;
|
|
37575
37856
|
if (!highlight) return;
|
|
@@ -37584,7 +37865,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
37584
37865
|
highlight.style.width = `${metrics.width}px`;
|
|
37585
37866
|
highlight.style.height = `${metrics.height}px`;
|
|
37586
37867
|
}, []);
|
|
37587
|
-
const scheduleTableLayoutSync =
|
|
37868
|
+
const scheduleTableLayoutSync = import_react68.default.useCallback(() => {
|
|
37588
37869
|
if (tableLayoutSyncFrameRef.current !== null) return;
|
|
37589
37870
|
tableLayoutSyncFrameRef.current = window.requestAnimationFrame(() => {
|
|
37590
37871
|
tableLayoutSyncFrameRef.current = null;
|
|
@@ -37592,7 +37873,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
37592
37873
|
editorContentRef.current?.dispatchEvent(new CustomEvent(UEDITOR_TABLE_LAYOUT_CHANGE_EVENT));
|
|
37593
37874
|
});
|
|
37594
37875
|
}, [updateActiveCellHighlight]);
|
|
37595
|
-
const setActiveTableCell =
|
|
37876
|
+
const setActiveTableCell = import_react68.default.useCallback((cell) => {
|
|
37596
37877
|
if (activeTableCellRef.current === cell) {
|
|
37597
37878
|
updateActiveCellHighlight(cell);
|
|
37598
37879
|
return;
|
|
@@ -37600,17 +37881,17 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
37600
37881
|
activeTableCellRef.current = cell;
|
|
37601
37882
|
updateActiveCellHighlight(activeTableCellRef.current);
|
|
37602
37883
|
}, [updateActiveCellHighlight]);
|
|
37603
|
-
const clearActiveTableCell =
|
|
37884
|
+
const clearActiveTableCell = import_react68.default.useCallback(() => {
|
|
37604
37885
|
activeTableCellRef.current = null;
|
|
37605
37886
|
updateActiveCellHighlight(null);
|
|
37606
37887
|
}, [updateActiveCellHighlight]);
|
|
37607
|
-
const setHoveredTableCell =
|
|
37888
|
+
const setHoveredTableCell = import_react68.default.useCallback((cell) => {
|
|
37608
37889
|
hoveredTableCellRef.current = cell;
|
|
37609
37890
|
}, []);
|
|
37610
|
-
const clearHoveredTableCell =
|
|
37891
|
+
const clearHoveredTableCell = import_react68.default.useCallback(() => {
|
|
37611
37892
|
hoveredTableCellRef.current = null;
|
|
37612
37893
|
}, []);
|
|
37613
|
-
const showColumnGuide =
|
|
37894
|
+
const showColumnGuide = import_react68.default.useCallback((table, row, cell) => {
|
|
37614
37895
|
const surface = editorContentRef.current;
|
|
37615
37896
|
const guide = tableColumnGuideRef.current;
|
|
37616
37897
|
if (!surface || !guide) return;
|
|
@@ -37624,7 +37905,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
37624
37905
|
getProseMirrorElement()?.classList.add("resize-cursor");
|
|
37625
37906
|
setEditorResizeCursor("col-resize");
|
|
37626
37907
|
}, [getProseMirrorElement, setEditorResizeCursor]);
|
|
37627
|
-
const showRowGuide =
|
|
37908
|
+
const showRowGuide = import_react68.default.useCallback((table, row, cell) => {
|
|
37628
37909
|
const surface = editorContentRef.current;
|
|
37629
37910
|
const guide = tableRowGuideRef.current;
|
|
37630
37911
|
if (!surface || !guide) return;
|
|
@@ -37654,7 +37935,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
37654
37935
|
clearAllTableResizeHover,
|
|
37655
37936
|
scheduleTableLayoutSync
|
|
37656
37937
|
});
|
|
37657
|
-
const syncActiveTableCellFromSelection =
|
|
37938
|
+
const syncActiveTableCellFromSelection = import_react68.default.useCallback(() => {
|
|
37658
37939
|
if (!editor) return;
|
|
37659
37940
|
if (!editor.isFocused) {
|
|
37660
37941
|
clearActiveTableCell();
|
|
@@ -37662,7 +37943,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
37662
37943
|
}
|
|
37663
37944
|
setActiveTableCell(getSelectionTableCell(editor.view));
|
|
37664
37945
|
}, [clearActiveTableCell, editor, setActiveTableCell]);
|
|
37665
|
-
(0,
|
|
37946
|
+
(0, import_react68.useEffect)(() => {
|
|
37666
37947
|
if (!editor || !editable) return void 0;
|
|
37667
37948
|
const proseMirror = editor.view.dom;
|
|
37668
37949
|
const surface = editorContentRef.current;
|
|
@@ -37835,17 +38116,17 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
37835
38116
|
}
|
|
37836
38117
|
|
|
37837
38118
|
// src/components/UEditor/menu-bar.tsx
|
|
37838
|
-
var
|
|
37839
|
-
var
|
|
37840
|
-
var
|
|
37841
|
-
var
|
|
38119
|
+
var import_react69 = __toESM(require("react"), 1);
|
|
38120
|
+
var import_react70 = require("@tiptap/react");
|
|
38121
|
+
var import_lucide_react54 = require("lucide-react");
|
|
38122
|
+
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
37842
38123
|
function MenuTableInsertGrid({
|
|
37843
38124
|
insertLabel,
|
|
37844
38125
|
previewTemplate,
|
|
37845
38126
|
onInsert
|
|
37846
38127
|
}) {
|
|
37847
38128
|
const closeMenu = useDropdownMenuClose();
|
|
37848
|
-
return /* @__PURE__ */ (0,
|
|
38129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
37849
38130
|
TableInsertGrid,
|
|
37850
38131
|
{
|
|
37851
38132
|
insertLabel,
|
|
@@ -37861,9 +38142,9 @@ function renderMenuItems(items) {
|
|
|
37861
38142
|
return items.map((item, i) => {
|
|
37862
38143
|
switch (item.type) {
|
|
37863
38144
|
case "separator":
|
|
37864
|
-
return /* @__PURE__ */ (0,
|
|
38145
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(DropdownMenuSeparator, {}, i);
|
|
37865
38146
|
case "action":
|
|
37866
|
-
return /* @__PURE__ */ (0,
|
|
38147
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
37867
38148
|
DropdownMenuItem,
|
|
37868
38149
|
{
|
|
37869
38150
|
label: item.label,
|
|
@@ -37877,9 +38158,9 @@ function renderMenuItems(items) {
|
|
|
37877
38158
|
i
|
|
37878
38159
|
);
|
|
37879
38160
|
case "sub":
|
|
37880
|
-
return /* @__PURE__ */ (0,
|
|
38161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(DropdownMenuSub, { label: item.label, icon: item.icon, disabled: item.disabled, children: renderMenuItems(item.items) }, i);
|
|
37881
38162
|
case "custom":
|
|
37882
|
-
return /* @__PURE__ */ (0,
|
|
38163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react69.default.Fragment, { children: item.render() }, item.key);
|
|
37883
38164
|
}
|
|
37884
38165
|
});
|
|
37885
38166
|
}
|
|
@@ -37917,7 +38198,7 @@ function buildEditMenuItems(t, editor) {
|
|
|
37917
38198
|
{
|
|
37918
38199
|
type: "action",
|
|
37919
38200
|
label: t("menubar.undo"),
|
|
37920
|
-
icon:
|
|
38201
|
+
icon: import_lucide_react54.Undo,
|
|
37921
38202
|
shortcut: t("menubar.undoShortcut"),
|
|
37922
38203
|
onClick: () => editor.chain().focus().undo().run(),
|
|
37923
38204
|
disabled: !editor.can().undo()
|
|
@@ -37925,7 +38206,7 @@ function buildEditMenuItems(t, editor) {
|
|
|
37925
38206
|
{
|
|
37926
38207
|
type: "action",
|
|
37927
38208
|
label: t("menubar.redo"),
|
|
37928
|
-
icon:
|
|
38209
|
+
icon: import_lucide_react54.Redo,
|
|
37929
38210
|
shortcut: t("menubar.redoShortcut"),
|
|
37930
38211
|
onClick: () => editor.chain().focus().redo().run(),
|
|
37931
38212
|
disabled: !editor.can().redo()
|
|
@@ -37934,7 +38215,7 @@ function buildEditMenuItems(t, editor) {
|
|
|
37934
38215
|
{
|
|
37935
38216
|
type: "action",
|
|
37936
38217
|
label: t("menubar.cut"),
|
|
37937
|
-
icon:
|
|
38218
|
+
icon: import_lucide_react54.Scissors,
|
|
37938
38219
|
shortcut: t("menubar.cutShortcut"),
|
|
37939
38220
|
onClick: () => document.execCommand("cut")
|
|
37940
38221
|
},
|
|
@@ -37982,7 +38263,7 @@ function buildViewMenuItems(t, {
|
|
|
37982
38263
|
{
|
|
37983
38264
|
type: "action",
|
|
37984
38265
|
label: t("menubar.sourceCode"),
|
|
37985
|
-
icon:
|
|
38266
|
+
icon: import_lucide_react54.FileCode,
|
|
37986
38267
|
onClick: () => onSourceCode ? onSourceCode() : openSourceDialog()
|
|
37987
38268
|
},
|
|
37988
38269
|
{
|
|
@@ -37994,7 +38275,7 @@ function buildViewMenuItems(t, {
|
|
|
37994
38275
|
{
|
|
37995
38276
|
type: "action",
|
|
37996
38277
|
label: t("menubar.fullscreen"),
|
|
37997
|
-
icon:
|
|
38278
|
+
icon: import_lucide_react54.Maximize2,
|
|
37998
38279
|
shortcut: t("menubar.fullscreenShortcut"),
|
|
37999
38280
|
onClick: () => {
|
|
38000
38281
|
const el = containerRef.current;
|
|
@@ -38013,7 +38294,7 @@ function buildFormatMenuItems(t, editor) {
|
|
|
38013
38294
|
{
|
|
38014
38295
|
type: "action",
|
|
38015
38296
|
label: t("menubar.bold"),
|
|
38016
|
-
icon:
|
|
38297
|
+
icon: import_lucide_react54.Bold,
|
|
38017
38298
|
shortcut: t("menubar.boldShortcut"),
|
|
38018
38299
|
active: editor.isActive("bold"),
|
|
38019
38300
|
onClick: () => editor.chain().focus().toggleBold().run()
|
|
@@ -38021,7 +38302,7 @@ function buildFormatMenuItems(t, editor) {
|
|
|
38021
38302
|
{
|
|
38022
38303
|
type: "action",
|
|
38023
38304
|
label: t("menubar.italic"),
|
|
38024
|
-
icon:
|
|
38305
|
+
icon: import_lucide_react54.Italic,
|
|
38025
38306
|
shortcut: t("menubar.italicShortcut"),
|
|
38026
38307
|
active: editor.isActive("italic"),
|
|
38027
38308
|
onClick: () => editor.chain().focus().toggleItalic().run()
|
|
@@ -38029,7 +38310,7 @@ function buildFormatMenuItems(t, editor) {
|
|
|
38029
38310
|
{
|
|
38030
38311
|
type: "action",
|
|
38031
38312
|
label: t("menubar.underline"),
|
|
38032
|
-
icon:
|
|
38313
|
+
icon: import_lucide_react54.Underline,
|
|
38033
38314
|
shortcut: t("menubar.underlineShortcut"),
|
|
38034
38315
|
active: editor.isActive("underline"),
|
|
38035
38316
|
onClick: () => editor.chain().focus().toggleUnderline().run()
|
|
@@ -38037,28 +38318,28 @@ function buildFormatMenuItems(t, editor) {
|
|
|
38037
38318
|
{
|
|
38038
38319
|
type: "action",
|
|
38039
38320
|
label: t("menubar.strike"),
|
|
38040
|
-
icon:
|
|
38321
|
+
icon: import_lucide_react54.Strikethrough,
|
|
38041
38322
|
active: editor.isActive("strike"),
|
|
38042
38323
|
onClick: () => editor.chain().focus().toggleStrike().run()
|
|
38043
38324
|
},
|
|
38044
38325
|
{
|
|
38045
38326
|
type: "action",
|
|
38046
38327
|
label: t("menubar.superscript"),
|
|
38047
|
-
icon:
|
|
38328
|
+
icon: import_lucide_react54.Superscript,
|
|
38048
38329
|
active: editor.isActive("superscript"),
|
|
38049
38330
|
onClick: () => editor.chain().focus().toggleSuperscript().run()
|
|
38050
38331
|
},
|
|
38051
38332
|
{
|
|
38052
38333
|
type: "action",
|
|
38053
38334
|
label: t("menubar.subscript"),
|
|
38054
|
-
icon:
|
|
38335
|
+
icon: import_lucide_react54.Subscript,
|
|
38055
38336
|
active: editor.isActive("subscript"),
|
|
38056
38337
|
onClick: () => editor.chain().focus().toggleSubscript().run()
|
|
38057
38338
|
},
|
|
38058
38339
|
{
|
|
38059
38340
|
type: "action",
|
|
38060
38341
|
label: t("menubar.code"),
|
|
38061
|
-
icon:
|
|
38342
|
+
icon: import_lucide_react54.Code,
|
|
38062
38343
|
active: editor.isActive("code"),
|
|
38063
38344
|
onClick: () => editor.chain().focus().toggleCode().run()
|
|
38064
38345
|
},
|
|
@@ -38076,21 +38357,21 @@ function buildFormatMenuItems(t, editor) {
|
|
|
38076
38357
|
{
|
|
38077
38358
|
type: "action",
|
|
38078
38359
|
label: t("menubar.heading1"),
|
|
38079
|
-
icon:
|
|
38360
|
+
icon: import_lucide_react54.Heading1,
|
|
38080
38361
|
active: editor.isActive("heading", { level: 1 }),
|
|
38081
38362
|
onClick: () => editor.chain().focus().toggleHeading({ level: 1 }).run()
|
|
38082
38363
|
},
|
|
38083
38364
|
{
|
|
38084
38365
|
type: "action",
|
|
38085
38366
|
label: t("menubar.heading2"),
|
|
38086
|
-
icon:
|
|
38367
|
+
icon: import_lucide_react54.Heading2,
|
|
38087
38368
|
active: editor.isActive("heading", { level: 2 }),
|
|
38088
38369
|
onClick: () => editor.chain().focus().toggleHeading({ level: 2 }).run()
|
|
38089
38370
|
},
|
|
38090
38371
|
{
|
|
38091
38372
|
type: "action",
|
|
38092
38373
|
label: t("menubar.heading3"),
|
|
38093
|
-
icon:
|
|
38374
|
+
icon: import_lucide_react54.Heading3,
|
|
38094
38375
|
active: editor.isActive("heading", { level: 3 }),
|
|
38095
38376
|
onClick: () => editor.chain().focus().toggleHeading({ level: 3 }).run()
|
|
38096
38377
|
},
|
|
@@ -38098,21 +38379,21 @@ function buildFormatMenuItems(t, editor) {
|
|
|
38098
38379
|
{
|
|
38099
38380
|
type: "action",
|
|
38100
38381
|
label: t("menubar.blockquote"),
|
|
38101
|
-
icon:
|
|
38382
|
+
icon: import_lucide_react54.Quote,
|
|
38102
38383
|
active: editor.isActive("blockquote"),
|
|
38103
38384
|
onClick: () => editor.chain().focus().toggleBlockquote().run()
|
|
38104
38385
|
},
|
|
38105
38386
|
{
|
|
38106
38387
|
type: "action",
|
|
38107
38388
|
label: t("menubar.codeBlock"),
|
|
38108
|
-
icon:
|
|
38389
|
+
icon: import_lucide_react54.FileCode,
|
|
38109
38390
|
active: editor.isActive("codeBlock"),
|
|
38110
38391
|
onClick: () => editor.chain().focus().toggleCodeBlock().run()
|
|
38111
38392
|
},
|
|
38112
38393
|
{
|
|
38113
38394
|
type: "action",
|
|
38114
38395
|
label: t("menubar.taskList"),
|
|
38115
|
-
icon:
|
|
38396
|
+
icon: import_lucide_react54.ListTodo,
|
|
38116
38397
|
active: editor.isActive("taskList"),
|
|
38117
38398
|
onClick: () => editor.chain().focus().toggleTaskList().run()
|
|
38118
38399
|
}
|
|
@@ -38125,28 +38406,28 @@ function buildFormatMenuItems(t, editor) {
|
|
|
38125
38406
|
{
|
|
38126
38407
|
type: "action",
|
|
38127
38408
|
label: t("menubar.alignLeft"),
|
|
38128
|
-
icon:
|
|
38409
|
+
icon: import_lucide_react54.AlignLeft,
|
|
38129
38410
|
active: editor.isActive({ textAlign: "left" }),
|
|
38130
38411
|
onClick: () => editor.chain().focus().setTextAlign("left").run()
|
|
38131
38412
|
},
|
|
38132
38413
|
{
|
|
38133
38414
|
type: "action",
|
|
38134
38415
|
label: t("menubar.alignCenter"),
|
|
38135
|
-
icon:
|
|
38416
|
+
icon: import_lucide_react54.AlignCenter,
|
|
38136
38417
|
active: editor.isActive({ textAlign: "center" }),
|
|
38137
38418
|
onClick: () => editor.chain().focus().setTextAlign("center").run()
|
|
38138
38419
|
},
|
|
38139
38420
|
{
|
|
38140
38421
|
type: "action",
|
|
38141
38422
|
label: t("menubar.alignRight"),
|
|
38142
|
-
icon:
|
|
38423
|
+
icon: import_lucide_react54.AlignRight,
|
|
38143
38424
|
active: editor.isActive({ textAlign: "right" }),
|
|
38144
38425
|
onClick: () => editor.chain().focus().setTextAlign("right").run()
|
|
38145
38426
|
},
|
|
38146
38427
|
{
|
|
38147
38428
|
type: "action",
|
|
38148
38429
|
label: t("menubar.alignJustify"),
|
|
38149
|
-
icon:
|
|
38430
|
+
icon: import_lucide_react54.AlignJustify,
|
|
38150
38431
|
active: editor.isActive({ textAlign: "justify" }),
|
|
38151
38432
|
onClick: () => editor.chain().focus().setTextAlign("justify").run()
|
|
38152
38433
|
}
|
|
@@ -38165,7 +38446,7 @@ function buildToolsMenuItems(t, { onSourceCode, openSourceDialog }) {
|
|
|
38165
38446
|
{
|
|
38166
38447
|
type: "action",
|
|
38167
38448
|
label: t("menubar.sourceCode"),
|
|
38168
|
-
icon:
|
|
38449
|
+
icon: import_lucide_react54.FileCode,
|
|
38169
38450
|
onClick: () => onSourceCode ? onSourceCode() : openSourceDialog()
|
|
38170
38451
|
}
|
|
38171
38452
|
];
|
|
@@ -38176,12 +38457,12 @@ function buildTableMenuItems(t, editor, onInsertTable) {
|
|
|
38176
38457
|
{
|
|
38177
38458
|
type: "sub",
|
|
38178
38459
|
label: t("menubar.insertTable"),
|
|
38179
|
-
icon:
|
|
38460
|
+
icon: import_lucide_react54.Table,
|
|
38180
38461
|
items: [
|
|
38181
38462
|
{
|
|
38182
38463
|
type: "custom",
|
|
38183
38464
|
key: "table-insert-grid",
|
|
38184
|
-
render: () => /* @__PURE__ */ (0,
|
|
38465
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
38185
38466
|
MenuTableInsertGrid,
|
|
38186
38467
|
{
|
|
38187
38468
|
insertLabel: t("tableMenu.insertTable"),
|
|
@@ -38202,7 +38483,7 @@ function buildTableMenuItems(t, editor, onInsertTable) {
|
|
|
38202
38483
|
{
|
|
38203
38484
|
type: "action",
|
|
38204
38485
|
label: t("menubar.deleteTable"),
|
|
38205
|
-
icon:
|
|
38486
|
+
icon: import_lucide_react54.Trash2,
|
|
38206
38487
|
destructive: true,
|
|
38207
38488
|
disabled: !inTable,
|
|
38208
38489
|
onClick: () => editor.chain().focus().deleteTable().run()
|
|
@@ -38277,8 +38558,8 @@ function buildTableMenuItems(t, editor, onInsertTable) {
|
|
|
38277
38558
|
}
|
|
38278
38559
|
];
|
|
38279
38560
|
}
|
|
38280
|
-
var MenuBarTrigger =
|
|
38281
|
-
({ children, className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
38561
|
+
var MenuBarTrigger = import_react69.default.forwardRef(
|
|
38562
|
+
({ children, className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
38282
38563
|
"button",
|
|
38283
38564
|
{
|
|
38284
38565
|
ref,
|
|
@@ -38309,17 +38590,17 @@ var MenuBar = ({
|
|
|
38309
38590
|
onPreview
|
|
38310
38591
|
}) => {
|
|
38311
38592
|
const t = useSmartTranslations("UEditor");
|
|
38312
|
-
(0,
|
|
38593
|
+
(0, import_react70.useEditorState)({
|
|
38313
38594
|
editor,
|
|
38314
38595
|
selector: ({ transactionNumber }) => transactionNumber
|
|
38315
38596
|
});
|
|
38316
|
-
const fileInputRef = (0,
|
|
38317
|
-
const [showImageInput, setShowImageInput] = (0,
|
|
38318
|
-
const [showLinkInput, setShowLinkInput] = (0,
|
|
38319
|
-
const [isInsertMenuOpen, setIsInsertMenuOpen] = (0,
|
|
38320
|
-
const [showSourceDialog, setShowSourceDialog] = (0,
|
|
38321
|
-
const [sourceHtml, setSourceHtml] = (0,
|
|
38322
|
-
const [showPreviewDialog, setShowPreviewDialog] = (0,
|
|
38597
|
+
const fileInputRef = (0, import_react69.useRef)(null);
|
|
38598
|
+
const [showImageInput, setShowImageInput] = (0, import_react69.useState)(false);
|
|
38599
|
+
const [showLinkInput, setShowLinkInput] = (0, import_react69.useState)(false);
|
|
38600
|
+
const [isInsertMenuOpen, setIsInsertMenuOpen] = (0, import_react69.useState)(false);
|
|
38601
|
+
const [showSourceDialog, setShowSourceDialog] = (0, import_react69.useState)(false);
|
|
38602
|
+
const [sourceHtml, setSourceHtml] = (0, import_react69.useState)("");
|
|
38603
|
+
const [showPreviewDialog, setShowPreviewDialog] = (0, import_react69.useState)(false);
|
|
38323
38604
|
const openSourceDialog = () => {
|
|
38324
38605
|
setSourceHtml(editor.getHTML());
|
|
38325
38606
|
setShowSourceDialog(true);
|
|
@@ -38380,13 +38661,13 @@ var MenuBar = ({
|
|
|
38380
38661
|
{
|
|
38381
38662
|
type: "custom",
|
|
38382
38663
|
key: "image",
|
|
38383
|
-
render: () => showImageInput ? /* @__PURE__ */ (0,
|
|
38384
|
-
/* @__PURE__ */ (0,
|
|
38385
|
-
/* @__PURE__ */ (0,
|
|
38664
|
+
render: () => showImageInput ? /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ImageInput, { onSubmit: handleImageUrl, onCancel: () => setShowImageInput(false) }) : /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(import_jsx_runtime94.Fragment, { children: [
|
|
38665
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(DropdownMenuItem, { label: t("menubar.image"), icon: import_lucide_react54.Image, onClick: () => setShowImageInput(true), closeOnSelect: false }),
|
|
38666
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
38386
38667
|
DropdownMenuItem,
|
|
38387
38668
|
{
|
|
38388
38669
|
label: t("menubar.imageUpload"),
|
|
38389
|
-
icon:
|
|
38670
|
+
icon: import_lucide_react54.Upload,
|
|
38390
38671
|
onClick: () => fileInputRef.current?.click(),
|
|
38391
38672
|
closeOnSelect: false
|
|
38392
38673
|
}
|
|
@@ -38397,11 +38678,11 @@ var MenuBar = ({
|
|
|
38397
38678
|
{
|
|
38398
38679
|
type: "custom",
|
|
38399
38680
|
key: "link",
|
|
38400
|
-
render: () => showLinkInput ? /* @__PURE__ */ (0,
|
|
38681
|
+
render: () => showLinkInput ? /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(LinkInput, { onSubmit: handleLinkSubmit, onCancel: () => setShowLinkInput(false), initialUrl: editor.getAttributes("link").href ?? "" }) : /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
38401
38682
|
DropdownMenuItem,
|
|
38402
38683
|
{
|
|
38403
38684
|
label: t("menubar.link"),
|
|
38404
|
-
icon:
|
|
38685
|
+
icon: import_lucide_react54.Link,
|
|
38405
38686
|
shortcut: t("menubar.linkShortcut"),
|
|
38406
38687
|
onClick: () => setShowLinkInput(true),
|
|
38407
38688
|
closeOnSelect: false
|
|
@@ -38412,12 +38693,12 @@ var MenuBar = ({
|
|
|
38412
38693
|
{
|
|
38413
38694
|
type: "sub",
|
|
38414
38695
|
label: t("menubar.insertTable"),
|
|
38415
|
-
icon:
|
|
38696
|
+
icon: import_lucide_react54.Table,
|
|
38416
38697
|
items: [
|
|
38417
38698
|
{
|
|
38418
38699
|
type: "custom",
|
|
38419
38700
|
key: "table-grid",
|
|
38420
|
-
render: () => /* @__PURE__ */ (0,
|
|
38701
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
38421
38702
|
MenuTableInsertGrid,
|
|
38422
38703
|
{
|
|
38423
38704
|
insertLabel: t("tableMenu.insertTable"),
|
|
@@ -38470,8 +38751,8 @@ var MenuBar = ({
|
|
|
38470
38751
|
},
|
|
38471
38752
|
{ label: t("menubar.table"), items: buildTableMenuItems(t, editor, handleInsertTable), open: void 0, onOpenChange: void 0 }
|
|
38472
38753
|
];
|
|
38473
|
-
return /* @__PURE__ */ (0,
|
|
38474
|
-
/* @__PURE__ */ (0,
|
|
38754
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(import_jsx_runtime94.Fragment, { children: [
|
|
38755
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
38475
38756
|
"input",
|
|
38476
38757
|
{
|
|
38477
38758
|
ref: fileInputRef,
|
|
@@ -38482,11 +38763,11 @@ var MenuBar = ({
|
|
|
38482
38763
|
onChange: (e) => handleImageFiles(e.target.files)
|
|
38483
38764
|
}
|
|
38484
38765
|
),
|
|
38485
|
-
/* @__PURE__ */ (0,
|
|
38486
|
-
menus.map(({ label, items, open, onOpenChange }) => /* @__PURE__ */ (0,
|
|
38766
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "flex items-center gap-0.5 border-b border-border/35 bg-muted/20 px-1.5 py-0.5", children: [
|
|
38767
|
+
menus.map(({ label, items, open, onOpenChange }) => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
38487
38768
|
DropdownMenu,
|
|
38488
38769
|
{
|
|
38489
|
-
trigger: /* @__PURE__ */ (0,
|
|
38770
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(MenuBarTrigger, { children: label }),
|
|
38490
38771
|
placement: "bottom-start",
|
|
38491
38772
|
isOpen: open,
|
|
38492
38773
|
onOpenChange,
|
|
@@ -38494,7 +38775,7 @@ var MenuBar = ({
|
|
|
38494
38775
|
},
|
|
38495
38776
|
label
|
|
38496
38777
|
)),
|
|
38497
|
-
/* @__PURE__ */ (0,
|
|
38778
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
38498
38779
|
"button",
|
|
38499
38780
|
{
|
|
38500
38781
|
type: "button",
|
|
@@ -38505,20 +38786,20 @@ var MenuBar = ({
|
|
|
38505
38786
|
"ml-auto inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors",
|
|
38506
38787
|
"hover:bg-accent hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1"
|
|
38507
38788
|
),
|
|
38508
|
-
children: /* @__PURE__ */ (0,
|
|
38789
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react54.Eye, { className: "h-4 w-4", "aria-hidden": "true" })
|
|
38509
38790
|
}
|
|
38510
38791
|
)
|
|
38511
38792
|
] }),
|
|
38512
|
-
/* @__PURE__ */ (0,
|
|
38793
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
38513
38794
|
Modal_default,
|
|
38514
38795
|
{
|
|
38515
38796
|
isOpen: showSourceDialog,
|
|
38516
38797
|
onClose: () => setShowSourceDialog(false),
|
|
38517
38798
|
title: t("menubar.sourceCode"),
|
|
38518
38799
|
size: "lg",
|
|
38519
|
-
children: /* @__PURE__ */ (0,
|
|
38520
|
-
/* @__PURE__ */ (0,
|
|
38521
|
-
/* @__PURE__ */ (0,
|
|
38800
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "space-y-3", children: [
|
|
38801
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("p", { className: "text-xs text-muted-foreground", children: t("menubar.sourceCodeHint") }),
|
|
38802
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
38522
38803
|
"textarea",
|
|
38523
38804
|
{
|
|
38524
38805
|
"data-testid": "source-code-textarea",
|
|
@@ -38528,8 +38809,8 @@ var MenuBar = ({
|
|
|
38528
38809
|
spellCheck: false
|
|
38529
38810
|
}
|
|
38530
38811
|
),
|
|
38531
|
-
/* @__PURE__ */ (0,
|
|
38532
|
-
/* @__PURE__ */ (0,
|
|
38812
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "flex gap-2 justify-end", children: [
|
|
38813
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
38533
38814
|
"button",
|
|
38534
38815
|
{
|
|
38535
38816
|
type: "button",
|
|
@@ -38538,7 +38819,7 @@ var MenuBar = ({
|
|
|
38538
38819
|
children: t("menubar.applySource")
|
|
38539
38820
|
}
|
|
38540
38821
|
),
|
|
38541
|
-
/* @__PURE__ */ (0,
|
|
38822
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
38542
38823
|
"button",
|
|
38543
38824
|
{
|
|
38544
38825
|
type: "button",
|
|
@@ -38551,7 +38832,7 @@ var MenuBar = ({
|
|
|
38551
38832
|
] })
|
|
38552
38833
|
}
|
|
38553
38834
|
),
|
|
38554
|
-
/* @__PURE__ */ (0,
|
|
38835
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
38555
38836
|
Modal_default,
|
|
38556
38837
|
{
|
|
38557
38838
|
isOpen: showPreviewDialog,
|
|
@@ -38562,12 +38843,12 @@ var MenuBar = ({
|
|
|
38562
38843
|
height: "min(860px, calc(100vh - 2rem))",
|
|
38563
38844
|
className: "flex flex-col overflow-hidden rounded-xl md:rounded-2xl",
|
|
38564
38845
|
contentClassName: "flex min-h-0 flex-1 overflow-hidden p-0",
|
|
38565
|
-
children: /* @__PURE__ */ (0,
|
|
38846
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
38566
38847
|
"div",
|
|
38567
38848
|
{
|
|
38568
38849
|
"data-testid": "preview-content",
|
|
38569
38850
|
className: "min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 py-4 md:px-8",
|
|
38570
|
-
children: editor.isEmpty ? /* @__PURE__ */ (0,
|
|
38851
|
+
children: editor.isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("p", { className: "text-muted-foreground text-sm", children: t("menubar.previewEmpty") }) : /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
38571
38852
|
"div",
|
|
38572
38853
|
{
|
|
38573
38854
|
className: UEDITOR_PROSEMIRROR_CLASS_NAME,
|
|
@@ -38582,8 +38863,8 @@ var MenuBar = ({
|
|
|
38582
38863
|
};
|
|
38583
38864
|
|
|
38584
38865
|
// src/components/UEditor/UEditor.tsx
|
|
38585
|
-
var
|
|
38586
|
-
var UEditor =
|
|
38866
|
+
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
38867
|
+
var UEditor = import_react71.default.forwardRef(({
|
|
38587
38868
|
content = "",
|
|
38588
38869
|
onChange,
|
|
38589
38870
|
onHtmlChange,
|
|
@@ -38623,10 +38904,10 @@ var UEditor = import_react69.default.forwardRef(({
|
|
|
38623
38904
|
}, ref) => {
|
|
38624
38905
|
const t = useSmartTranslations("UEditor");
|
|
38625
38906
|
const effectivePlaceholder = placeholder ?? t("placeholder");
|
|
38626
|
-
const inFlightPrepareRef = (0,
|
|
38627
|
-
const lastAppliedContentRef = (0,
|
|
38628
|
-
const scheduledFormulaRecalculateRef = (0,
|
|
38629
|
-
const resolvedUploadFile = (0,
|
|
38907
|
+
const inFlightPrepareRef = (0, import_react71.useRef)(null);
|
|
38908
|
+
const lastAppliedContentRef = (0, import_react71.useRef)(content ?? "");
|
|
38909
|
+
const scheduledFormulaRecalculateRef = (0, import_react71.useRef)(false);
|
|
38910
|
+
const resolvedUploadFile = (0, import_react71.useMemo)(() => {
|
|
38630
38911
|
if (uploadFile) return uploadFile;
|
|
38631
38912
|
if (uploadFileForSave) {
|
|
38632
38913
|
return async (file) => {
|
|
@@ -38636,7 +38917,7 @@ var UEditor = import_react69.default.forwardRef(({
|
|
|
38636
38917
|
}
|
|
38637
38918
|
return uploadImage;
|
|
38638
38919
|
}, [uploadFile, uploadFileForSave, uploadImage]);
|
|
38639
|
-
const extensions = (0,
|
|
38920
|
+
const extensions = (0, import_react71.useMemo)(
|
|
38640
38921
|
() => [
|
|
38641
38922
|
...buildUEditorExtensions({
|
|
38642
38923
|
placeholder: effectivePlaceholder,
|
|
@@ -38655,7 +38936,7 @@ var UEditor = import_react69.default.forwardRef(({
|
|
|
38655
38936
|
],
|
|
38656
38937
|
[effectivePlaceholder, t, maxCharacters, uploadImage, resolvedUploadFile, imageInsertMode, maxImageFileSize, allowedImageMimeTypes, fallbackToDataUrl, editable, fetchMetadata, extraExtensions]
|
|
38657
38938
|
);
|
|
38658
|
-
const editor = (0,
|
|
38939
|
+
const editor = (0, import_react72.useEditor)({
|
|
38659
38940
|
immediatelyRender: false,
|
|
38660
38941
|
extensions,
|
|
38661
38942
|
content,
|
|
@@ -38711,7 +38992,7 @@ var UEditor = import_react69.default.forwardRef(({
|
|
|
38711
38992
|
tableRowGuideRef,
|
|
38712
38993
|
activeTableCellHighlightRef
|
|
38713
38994
|
} = useUEditorTableInteractions(editor, editable);
|
|
38714
|
-
(0,
|
|
38995
|
+
(0, import_react71.useImperativeHandle)(
|
|
38715
38996
|
ref,
|
|
38716
38997
|
() => ({
|
|
38717
38998
|
editor,
|
|
@@ -38736,7 +39017,7 @@ var UEditor = import_react69.default.forwardRef(({
|
|
|
38736
39017
|
}),
|
|
38737
39018
|
[content, editor, uploadImageForSave, uploadFileForSave, uploadImageConcurrency]
|
|
38738
39019
|
);
|
|
38739
|
-
(0,
|
|
39020
|
+
(0, import_react71.useEffect)(() => {
|
|
38740
39021
|
if (!editor) return;
|
|
38741
39022
|
queueMicrotask(() => {
|
|
38742
39023
|
if (!editor.isDestroyed) {
|
|
@@ -38744,7 +39025,7 @@ var UEditor = import_react69.default.forwardRef(({
|
|
|
38744
39025
|
}
|
|
38745
39026
|
});
|
|
38746
39027
|
}, [editor]);
|
|
38747
|
-
(0,
|
|
39028
|
+
(0, import_react71.useEffect)(() => {
|
|
38748
39029
|
if (!editor) return;
|
|
38749
39030
|
const nextContent = content ?? "";
|
|
38750
39031
|
if (lastAppliedContentRef.current === nextContent) return;
|
|
@@ -38763,7 +39044,7 @@ var UEditor = import_react69.default.forwardRef(({
|
|
|
38763
39044
|
}
|
|
38764
39045
|
}, [content, editor]);
|
|
38765
39046
|
if (!editor) {
|
|
38766
|
-
return /* @__PURE__ */ (0,
|
|
39047
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
38767
39048
|
"div",
|
|
38768
39049
|
{
|
|
38769
39050
|
className: cn("w-full border bg-background flex items-center justify-center text-muted-foreground", className),
|
|
@@ -38772,7 +39053,7 @@ var UEditor = import_react69.default.forwardRef(({
|
|
|
38772
39053
|
}
|
|
38773
39054
|
);
|
|
38774
39055
|
}
|
|
38775
|
-
return /* @__PURE__ */ (0,
|
|
39056
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
|
|
38776
39057
|
"div",
|
|
38777
39058
|
{
|
|
38778
39059
|
className: cn(
|
|
@@ -38787,7 +39068,7 @@ var UEditor = import_react69.default.forwardRef(({
|
|
|
38787
39068
|
className
|
|
38788
39069
|
),
|
|
38789
39070
|
children: [
|
|
38790
|
-
editable && showMenuBar && /* @__PURE__ */ (0,
|
|
39071
|
+
editable && showMenuBar && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
38791
39072
|
MenuBar,
|
|
38792
39073
|
{
|
|
38793
39074
|
editor,
|
|
@@ -38802,7 +39083,7 @@ var UEditor = import_react69.default.forwardRef(({
|
|
|
38802
39083
|
onPreview
|
|
38803
39084
|
}
|
|
38804
39085
|
),
|
|
38805
|
-
editable && showToolbar && /* @__PURE__ */ (0,
|
|
39086
|
+
editable && showToolbar && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
38806
39087
|
EditorToolbar,
|
|
38807
39088
|
{
|
|
38808
39089
|
editor,
|
|
@@ -38817,7 +39098,7 @@ var UEditor = import_react69.default.forwardRef(({
|
|
|
38817
39098
|
letterSpacings
|
|
38818
39099
|
}
|
|
38819
39100
|
),
|
|
38820
|
-
editable && showBubbleMenu && /* @__PURE__ */ (0,
|
|
39101
|
+
editable && showBubbleMenu && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
38821
39102
|
CustomBubbleMenu,
|
|
38822
39103
|
{
|
|
38823
39104
|
editor,
|
|
@@ -38825,7 +39106,7 @@ var UEditor = import_react69.default.forwardRef(({
|
|
|
38825
39106
|
lineHeights
|
|
38826
39107
|
}
|
|
38827
39108
|
),
|
|
38828
|
-
/* @__PURE__ */ (0,
|
|
39109
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
|
|
38829
39110
|
"div",
|
|
38830
39111
|
{
|
|
38831
39112
|
ref: editorContentRef,
|
|
@@ -38835,7 +39116,7 @@ var UEditor = import_react69.default.forwardRef(({
|
|
|
38835
39116
|
maxHeight
|
|
38836
39117
|
},
|
|
38837
39118
|
children: [
|
|
38838
|
-
/* @__PURE__ */ (0,
|
|
39119
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
38839
39120
|
"span",
|
|
38840
39121
|
{
|
|
38841
39122
|
ref: tableColumnGuideRef,
|
|
@@ -38843,7 +39124,7 @@ var UEditor = import_react69.default.forwardRef(({
|
|
|
38843
39124
|
className: "pointer-events-none absolute z-20 bg-primary opacity-0 transition-opacity duration-100"
|
|
38844
39125
|
}
|
|
38845
39126
|
),
|
|
38846
|
-
/* @__PURE__ */ (0,
|
|
39127
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
38847
39128
|
"span",
|
|
38848
39129
|
{
|
|
38849
39130
|
ref: tableRowGuideRef,
|
|
@@ -38851,7 +39132,7 @@ var UEditor = import_react69.default.forwardRef(({
|
|
|
38851
39132
|
className: "pointer-events-none absolute z-20 bg-primary opacity-0 transition-opacity duration-100"
|
|
38852
39133
|
}
|
|
38853
39134
|
),
|
|
38854
|
-
/* @__PURE__ */ (0,
|
|
39135
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
38855
39136
|
"span",
|
|
38856
39137
|
{
|
|
38857
39138
|
ref: activeTableCellHighlightRef,
|
|
@@ -38860,9 +39141,9 @@ var UEditor = import_react69.default.forwardRef(({
|
|
|
38860
39141
|
className: "pointer-events-none hidden absolute z-20 rounded-[2px] border-2 border-primary bg-primary/10"
|
|
38861
39142
|
}
|
|
38862
39143
|
),
|
|
38863
|
-
editable && /* @__PURE__ */ (0,
|
|
38864
|
-
/* @__PURE__ */ (0,
|
|
38865
|
-
|
|
39144
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(TableControls, { editor, containerRef: editorContentRef }),
|
|
39145
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
39146
|
+
import_react72.EditorContent,
|
|
38866
39147
|
{
|
|
38867
39148
|
editor,
|
|
38868
39149
|
className: "min-h-full"
|
|
@@ -38871,7 +39152,7 @@ var UEditor = import_react69.default.forwardRef(({
|
|
|
38871
39152
|
]
|
|
38872
39153
|
}
|
|
38873
39154
|
),
|
|
38874
|
-
showCharacterCount && /* @__PURE__ */ (0,
|
|
39155
|
+
showCharacterCount && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(CharacterCountDisplay, { editor, maxCharacters })
|
|
38875
39156
|
]
|
|
38876
39157
|
}
|
|
38877
39158
|
);
|