@underverse-ui/underverse 1.0.152 → 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 +1091 -726
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +116 -0
- package/dist/index.d.ts +116 -0
- package/dist/index.js +887 -522
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -809,6 +809,15 @@ var en_default = {
|
|
|
809
809
|
noResults: "No emoji found",
|
|
810
810
|
showingCount: "Showing first {shown} of {total} emojis"
|
|
811
811
|
},
|
|
812
|
+
formulaSuggestion: {
|
|
813
|
+
title: "Functions",
|
|
814
|
+
noResults: "No function found",
|
|
815
|
+
sum: "Add values in a range",
|
|
816
|
+
avg: "Average values in a range",
|
|
817
|
+
min: "Smallest value in a range",
|
|
818
|
+
max: "Largest value in a range",
|
|
819
|
+
count: "Count numeric cells in a range"
|
|
820
|
+
},
|
|
812
821
|
tableMenu: {
|
|
813
822
|
insert3x3: "Insert 3\xD73 Table",
|
|
814
823
|
insertTable: "Insert Table",
|
|
@@ -844,6 +853,9 @@ var en_default = {
|
|
|
844
853
|
borderColor: "Border Color",
|
|
845
854
|
clearBorder: "Clear Border",
|
|
846
855
|
formula: "Formula",
|
|
856
|
+
numberFormat: "Number Format",
|
|
857
|
+
formatText: "Text",
|
|
858
|
+
formatDate: "Date",
|
|
847
859
|
apply: "Apply",
|
|
848
860
|
clear: "Clear",
|
|
849
861
|
recalculate: "Recalculate",
|
|
@@ -1189,6 +1201,15 @@ var vi_default = {
|
|
|
1189
1201
|
noResults: "Kh\xF4ng t\xECm th\u1EA5y emoji",
|
|
1190
1202
|
showingCount: "Hi\u1EC3n th\u1ECB {shown} trong t\u1ED5ng s\u1ED1 {total} emoji"
|
|
1191
1203
|
},
|
|
1204
|
+
formulaSuggestion: {
|
|
1205
|
+
title: "H\xE0m",
|
|
1206
|
+
noResults: "Kh\xF4ng t\xECm th\u1EA5y h\xE0m",
|
|
1207
|
+
sum: "C\u1ED9ng c\xE1c gi\xE1 tr\u1ECB trong v\xF9ng",
|
|
1208
|
+
avg: "T\xEDnh trung b\xECnh c\xE1c gi\xE1 tr\u1ECB trong v\xF9ng",
|
|
1209
|
+
min: "Gi\xE1 tr\u1ECB nh\u1ECF nh\u1EA5t trong v\xF9ng",
|
|
1210
|
+
max: "Gi\xE1 tr\u1ECB l\u1EDBn nh\u1EA5t trong v\xF9ng",
|
|
1211
|
+
count: "\u0110\u1EBFm c\xE1c \xF4 d\u1EA1ng s\u1ED1 trong v\xF9ng"
|
|
1212
|
+
},
|
|
1192
1213
|
tableMenu: {
|
|
1193
1214
|
insert3x3: "Ch\xE8n b\u1EA3ng 3\xD73",
|
|
1194
1215
|
insertTable: "Ch\xE8n b\u1EA3ng",
|
|
@@ -1224,6 +1245,9 @@ var vi_default = {
|
|
|
1224
1245
|
borderColor: "M\xE0u vi\u1EC1n",
|
|
1225
1246
|
clearBorder: "X\xF3a vi\u1EC1n",
|
|
1226
1247
|
formula: "C\xF4ng th\u1EE9c",
|
|
1248
|
+
numberFormat: "\u0110\u1ECBnh d\u1EA1ng s\u1ED1",
|
|
1249
|
+
formatText: "Ch\u1EEF",
|
|
1250
|
+
formatDate: "Ng\xE0y",
|
|
1227
1251
|
apply: "\xC1p d\u1EE5ng",
|
|
1228
1252
|
clear: "X\xF3a",
|
|
1229
1253
|
recalculate: "T\xEDnh l\u1EA1i",
|
|
@@ -1530,6 +1554,7 @@ var ko_default = {
|
|
|
1530
1554
|
dividerDesc: "\uC2DC\uAC01\uC801 \uAD6C\uBD84\uC120",
|
|
1531
1555
|
table: "\uD45C",
|
|
1532
1556
|
tableDesc: "\uD45C \uCD94\uAC00",
|
|
1557
|
+
noResults: "\uC77C\uCE58\uD558\uB294 \uBE14\uB85D\uC774 \uC5C6\uC2B5\uB2C8\uB2E4",
|
|
1533
1558
|
callout: "\uCF5C\uC544\uC6C3",
|
|
1534
1559
|
calloutDesc: "\uC911\uC694\uD55C \uC815\uBCF4\uB97C \uCF5C\uC544\uC6C3 \uBE14\uB85D\uC73C\uB85C \uAC15\uC870\uD569\uB2C8\uB2E4",
|
|
1535
1560
|
bookmark: "\uBD81\uB9C8\uD06C \uCE74\uB4DC",
|
|
@@ -1568,6 +1593,15 @@ var ko_default = {
|
|
|
1568
1593
|
noResults: "\uC774\uBAA8\uC9C0\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4",
|
|
1569
1594
|
showingCount: "\uCD1D {total}\uAC1C \uC911 \uCC98\uC74C {shown}\uAC1C\uC758 \uC774\uBAA8\uC9C0\uB97C \uD45C\uC2DC \uC911"
|
|
1570
1595
|
},
|
|
1596
|
+
formulaSuggestion: {
|
|
1597
|
+
title: "\uD568\uC218",
|
|
1598
|
+
noResults: "\uD568\uC218\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4",
|
|
1599
|
+
sum: "\uBC94\uC704\uC758 \uAC12\uC744 \uD569\uC0B0",
|
|
1600
|
+
avg: "\uBC94\uC704\uC758 \uAC12 \uD3C9\uADE0",
|
|
1601
|
+
min: "\uBC94\uC704\uC758 \uCD5C\uC19F\uAC12",
|
|
1602
|
+
max: "\uBC94\uC704\uC758 \uCD5C\uB313\uAC12",
|
|
1603
|
+
count: "\uBC94\uC704\uC758 \uC22B\uC790 \uC140 \uAC1C\uC218"
|
|
1604
|
+
},
|
|
1571
1605
|
tableMenu: {
|
|
1572
1606
|
insert3x3: "3x3 \uD45C \uC0BD\uC785",
|
|
1573
1607
|
insertTable: "\uD45C \uC0BD\uC785",
|
|
@@ -1602,6 +1636,13 @@ var ko_default = {
|
|
|
1602
1636
|
borderWidth: "\uD14C\uB450\uB9AC \uB450\uAED8",
|
|
1603
1637
|
borderColor: "\uD14C\uB450\uB9AC \uC0C9\uC0C1",
|
|
1604
1638
|
clearBorder: "\uD14C\uB450\uB9AC \uC9C0\uC6B0\uAE30",
|
|
1639
|
+
formula: "\uC218\uC2DD",
|
|
1640
|
+
numberFormat: "\uD45C\uC2DC \uD615\uC2DD",
|
|
1641
|
+
formatText: "\uD14D\uC2A4\uD2B8",
|
|
1642
|
+
formatDate: "\uB0A0\uC9DC",
|
|
1643
|
+
apply: "\uC801\uC6A9",
|
|
1644
|
+
clear: "\uC9C0\uC6B0\uAE30",
|
|
1645
|
+
recalculate: "\uB2E4\uC2DC \uACC4\uC0B0",
|
|
1605
1646
|
done: "\uC644\uB8CC"
|
|
1606
1647
|
},
|
|
1607
1648
|
callout: {
|
|
@@ -1905,6 +1946,7 @@ var ja_default = {
|
|
|
1905
1946
|
dividerDesc: "\u8996\u899A\u7684\u306A\u533A\u5207\u308A\u7DDA",
|
|
1906
1947
|
table: "\u8868",
|
|
1907
1948
|
tableDesc: "\u8868\u3092\u8FFD\u52A0",
|
|
1949
|
+
noResults: "\u4E00\u81F4\u3059\u308B\u30D6\u30ED\u30C3\u30AF\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093",
|
|
1908
1950
|
callout: "\u30B3\u30FC\u30EB\u30A2\u30A6\u30C8",
|
|
1909
1951
|
calloutDesc: "\u91CD\u8981\u306A\u60C5\u5831\u3092\u30B3\u30FC\u30EB\u30A2\u30A6\u30C8\u30D6\u30ED\u30C3\u30AF\u3067\u5F37\u8ABF\u3057\u307E\u3059",
|
|
1910
1952
|
bookmark: "\u30D6\u30C3\u30AF\u30DE\u30FC\u30AF\u30AB\u30FC\u30C9",
|
|
@@ -1943,6 +1985,15 @@ var ja_default = {
|
|
|
1943
1985
|
noResults: "\u7D75\u6587\u5B57\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093",
|
|
1944
1986
|
showingCount: "{total} \u4EF6\u4E2D {shown} \u4EF6\u306E\u7D75\u6587\u5B57\u3092\u8868\u793A\u4E2D"
|
|
1945
1987
|
},
|
|
1988
|
+
formulaSuggestion: {
|
|
1989
|
+
title: "\u95A2\u6570",
|
|
1990
|
+
noResults: "\u95A2\u6570\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093",
|
|
1991
|
+
sum: "\u7BC4\u56F2\u5185\u306E\u5024\u3092\u5408\u8A08",
|
|
1992
|
+
avg: "\u7BC4\u56F2\u5185\u306E\u5024\u306E\u5E73\u5747",
|
|
1993
|
+
min: "\u7BC4\u56F2\u5185\u306E\u6700\u5C0F\u5024",
|
|
1994
|
+
max: "\u7BC4\u56F2\u5185\u306E\u6700\u5927\u5024",
|
|
1995
|
+
count: "\u7BC4\u56F2\u5185\u306E\u6570\u5024\u30BB\u30EB\u3092\u30AB\u30A6\u30F3\u30C8"
|
|
1996
|
+
},
|
|
1946
1997
|
tableMenu: {
|
|
1947
1998
|
insert3x3: "3x3 \u8868\u3092\u633F\u5165",
|
|
1948
1999
|
insertTable: "\u8868\u3092\u633F\u5165",
|
|
@@ -1977,6 +2028,13 @@ var ja_default = {
|
|
|
1977
2028
|
borderWidth: "\u67A0\u7DDA\u306E\u592A\u3055",
|
|
1978
2029
|
borderColor: "\u67A0\u7DDA\u306E\u8272",
|
|
1979
2030
|
clearBorder: "\u67A0\u7DDA\u3092\u30AF\u30EA\u30A2",
|
|
2031
|
+
formula: "\u6570\u5F0F",
|
|
2032
|
+
numberFormat: "\u8868\u793A\u5F62\u5F0F",
|
|
2033
|
+
formatText: "\u30C6\u30AD\u30B9\u30C8",
|
|
2034
|
+
formatDate: "\u65E5\u4ED8",
|
|
2035
|
+
apply: "\u9069\u7528",
|
|
2036
|
+
clear: "\u30AF\u30EA\u30A2",
|
|
2037
|
+
recalculate: "\u518D\u8A08\u7B97",
|
|
1980
2038
|
done: "\u5B8C\u4E86"
|
|
1981
2039
|
},
|
|
1982
2040
|
callout: {
|
|
@@ -24637,7 +24695,7 @@ function useLocale2() {
|
|
|
24637
24695
|
}
|
|
24638
24696
|
|
|
24639
24697
|
// src/components/UEditor/UEditor.tsx
|
|
24640
|
-
import
|
|
24698
|
+
import React83, { useEffect as useEffect38, useImperativeHandle as useImperativeHandle4, useMemo as useMemo24, useRef as useRef37 } from "react";
|
|
24641
24699
|
import { useEditor, EditorContent } from "@tiptap/react";
|
|
24642
24700
|
|
|
24643
24701
|
// src/components/UEditor/extensions.ts
|
|
@@ -26703,11 +26761,189 @@ var EmojiSuggestion = Extension3.create({
|
|
|
26703
26761
|
}
|
|
26704
26762
|
});
|
|
26705
26763
|
|
|
26764
|
+
// src/components/UEditor/formula-suggestion.tsx
|
|
26765
|
+
import { Extension as Extension4 } from "@tiptap/core";
|
|
26766
|
+
import Suggestion3 from "@tiptap/suggestion";
|
|
26767
|
+
import { ReactRenderer as ReactRenderer3 } from "@tiptap/react";
|
|
26768
|
+
import { PluginKey as PluginKey3 } from "@tiptap/pm/state";
|
|
26769
|
+
import React72, { forwardRef as forwardRef16, useImperativeHandle as useImperativeHandle3 } from "react";
|
|
26770
|
+
import { Sigma } from "lucide-react";
|
|
26771
|
+
import { jsx as jsx81, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
26772
|
+
var FORMULA_FUNCTIONS = [
|
|
26773
|
+
{
|
|
26774
|
+
name: "SUM",
|
|
26775
|
+
signature: "SUM(range)",
|
|
26776
|
+
descriptionKey: "formulaSuggestion.sum"
|
|
26777
|
+
},
|
|
26778
|
+
{
|
|
26779
|
+
name: "AVG",
|
|
26780
|
+
signature: "AVG(range)",
|
|
26781
|
+
descriptionKey: "formulaSuggestion.avg"
|
|
26782
|
+
},
|
|
26783
|
+
{
|
|
26784
|
+
name: "MIN",
|
|
26785
|
+
signature: "MIN(range)",
|
|
26786
|
+
descriptionKey: "formulaSuggestion.min"
|
|
26787
|
+
},
|
|
26788
|
+
{
|
|
26789
|
+
name: "MAX",
|
|
26790
|
+
signature: "MAX(range)",
|
|
26791
|
+
descriptionKey: "formulaSuggestion.max"
|
|
26792
|
+
},
|
|
26793
|
+
{
|
|
26794
|
+
name: "COUNT",
|
|
26795
|
+
signature: "COUNT(range)",
|
|
26796
|
+
descriptionKey: "formulaSuggestion.count"
|
|
26797
|
+
}
|
|
26798
|
+
];
|
|
26799
|
+
function isInTableCell(editor) {
|
|
26800
|
+
const { $from } = editor.state.selection;
|
|
26801
|
+
for (let depth = $from.depth; depth > 0; depth -= 1) {
|
|
26802
|
+
const nodeName = $from.node(depth).type.name;
|
|
26803
|
+
if (nodeName === "tableCell" || nodeName === "tableHeader") {
|
|
26804
|
+
return true;
|
|
26805
|
+
}
|
|
26806
|
+
}
|
|
26807
|
+
return false;
|
|
26808
|
+
}
|
|
26809
|
+
function buildFormulaSuggestionItems({ query }) {
|
|
26810
|
+
const normalizedQuery = query.trim().toUpperCase();
|
|
26811
|
+
if (!normalizedQuery) {
|
|
26812
|
+
return FORMULA_FUNCTIONS;
|
|
26813
|
+
}
|
|
26814
|
+
return FORMULA_FUNCTIONS.filter((item) => item.name.startsWith(normalizedQuery));
|
|
26815
|
+
}
|
|
26816
|
+
var FormulaSuggestionList = forwardRef16((props, ref) => {
|
|
26817
|
+
const t = useSmartTranslations("UEditor");
|
|
26818
|
+
const [selectedIndex, setSelectedIndex] = React72.useState(0);
|
|
26819
|
+
React72.useEffect(() => {
|
|
26820
|
+
setSelectedIndex(0);
|
|
26821
|
+
}, [props.items]);
|
|
26822
|
+
useImperativeHandle3(ref, () => ({
|
|
26823
|
+
onKeyDown: ({ event }) => {
|
|
26824
|
+
if (props.items.length === 0) return false;
|
|
26825
|
+
if (event.key === "ArrowUp") {
|
|
26826
|
+
setSelectedIndex((prev) => (prev + props.items.length - 1) % props.items.length);
|
|
26827
|
+
return true;
|
|
26828
|
+
}
|
|
26829
|
+
if (event.key === "ArrowDown") {
|
|
26830
|
+
setSelectedIndex((prev) => (prev + 1) % props.items.length);
|
|
26831
|
+
return true;
|
|
26832
|
+
}
|
|
26833
|
+
if (event.key === "Enter" || event.key === "Tab") {
|
|
26834
|
+
const item = props.items[selectedIndex];
|
|
26835
|
+
if (item) {
|
|
26836
|
+
props.command(item);
|
|
26837
|
+
}
|
|
26838
|
+
return true;
|
|
26839
|
+
}
|
|
26840
|
+
return false;
|
|
26841
|
+
}
|
|
26842
|
+
}));
|
|
26843
|
+
if (props.items.length === 0) {
|
|
26844
|
+
return /* @__PURE__ */ jsx81("div", { className: "w-72 p-3 text-sm text-muted-foreground bg-card border border-border/50 rounded-lg shadow-lg", children: t("formulaSuggestion.noResults") });
|
|
26845
|
+
}
|
|
26846
|
+
return /* @__PURE__ */ jsxs67("div", { className: "w-72 max-h-80 overflow-y-auto bg-card border border-border/50 rounded-lg shadow-lg", children: [
|
|
26847
|
+
/* @__PURE__ */ jsx81("div", { className: "px-3 py-2 border-b bg-muted/30", children: /* @__PURE__ */ jsxs67("div", { className: "flex items-center gap-2", children: [
|
|
26848
|
+
/* @__PURE__ */ jsx81(Sigma, { className: "w-4 h-4 text-primary" }),
|
|
26849
|
+
/* @__PURE__ */ jsx81("span", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: t("formulaSuggestion.title") })
|
|
26850
|
+
] }) }),
|
|
26851
|
+
/* @__PURE__ */ jsx81("div", { className: "p-1.5", children: props.items.map((item, index) => /* @__PURE__ */ jsxs67(
|
|
26852
|
+
"button",
|
|
26853
|
+
{
|
|
26854
|
+
type: "button",
|
|
26855
|
+
className: `w-full rounded-md px-2.5 py-2 text-left transition-colors ${selectedIndex === index ? "bg-primary/10 text-primary" : "text-foreground hover:bg-muted"}`,
|
|
26856
|
+
onMouseEnter: () => setSelectedIndex(index),
|
|
26857
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
26858
|
+
onClick: () => props.command(item),
|
|
26859
|
+
children: [
|
|
26860
|
+
/* @__PURE__ */ jsxs67("div", { className: "flex items-center justify-between gap-3", children: [
|
|
26861
|
+
/* @__PURE__ */ jsx81("span", { className: "font-mono text-sm font-semibold", children: item.name }),
|
|
26862
|
+
/* @__PURE__ */ jsx81("span", { className: "font-mono text-xs text-muted-foreground", children: item.signature })
|
|
26863
|
+
] }),
|
|
26864
|
+
/* @__PURE__ */ jsx81("div", { className: "mt-0.5 text-xs text-muted-foreground", children: t(item.descriptionKey) })
|
|
26865
|
+
]
|
|
26866
|
+
},
|
|
26867
|
+
item.name
|
|
26868
|
+
)) })
|
|
26869
|
+
] });
|
|
26870
|
+
});
|
|
26871
|
+
FormulaSuggestionList.displayName = "FormulaSuggestionList";
|
|
26872
|
+
function insertFormulaFunction(editor, range, item) {
|
|
26873
|
+
const insertedText = `=${item.name}()`;
|
|
26874
|
+
const cursorPosition = range.from + item.name.length + 2;
|
|
26875
|
+
editor.chain().focus().deleteRange(range).insertContent(insertedText).run();
|
|
26876
|
+
editor.commands.setTextSelection(cursorPosition);
|
|
26877
|
+
}
|
|
26878
|
+
var FormulaSuggestion = Extension4.create({
|
|
26879
|
+
name: "formulaSuggestion",
|
|
26880
|
+
addProseMirrorPlugins() {
|
|
26881
|
+
return [
|
|
26882
|
+
Suggestion3({
|
|
26883
|
+
editor: this.editor,
|
|
26884
|
+
char: "=",
|
|
26885
|
+
pluginKey: new PluginKey3("formulaSuggestion"),
|
|
26886
|
+
allow: ({ editor }) => isInTableCell(editor),
|
|
26887
|
+
command: ({ editor, range, props }) => {
|
|
26888
|
+
insertFormulaFunction(editor, range, props);
|
|
26889
|
+
},
|
|
26890
|
+
items: buildFormulaSuggestionItems,
|
|
26891
|
+
render: () => {
|
|
26892
|
+
let component;
|
|
26893
|
+
let popup;
|
|
26894
|
+
return {
|
|
26895
|
+
onStart: (props) => {
|
|
26896
|
+
component = new ReactRenderer3(FormulaSuggestionList, {
|
|
26897
|
+
props,
|
|
26898
|
+
editor: props.editor
|
|
26899
|
+
});
|
|
26900
|
+
if (!props.clientRect) {
|
|
26901
|
+
return;
|
|
26902
|
+
}
|
|
26903
|
+
popup = tippy("body", {
|
|
26904
|
+
getReferenceClientRect: props.clientRect,
|
|
26905
|
+
appendTo: () => document.body,
|
|
26906
|
+
content: component.element,
|
|
26907
|
+
showOnCreate: true,
|
|
26908
|
+
interactive: true,
|
|
26909
|
+
trigger: "manual",
|
|
26910
|
+
placement: "bottom-start",
|
|
26911
|
+
zIndex: 99999
|
|
26912
|
+
});
|
|
26913
|
+
},
|
|
26914
|
+
onUpdate(props) {
|
|
26915
|
+
component?.updateProps(props);
|
|
26916
|
+
if (!props.clientRect) {
|
|
26917
|
+
return;
|
|
26918
|
+
}
|
|
26919
|
+
popup?.[0]?.setProps({
|
|
26920
|
+
getReferenceClientRect: props.clientRect
|
|
26921
|
+
});
|
|
26922
|
+
},
|
|
26923
|
+
onKeyDown(props) {
|
|
26924
|
+
const popupInstance = getFirstTippyInstance(popup);
|
|
26925
|
+
if (props.event.key === "Escape") {
|
|
26926
|
+
hideTippyInstance(popupInstance);
|
|
26927
|
+
return true;
|
|
26928
|
+
}
|
|
26929
|
+
return component?.ref?.onKeyDown(props) ?? false;
|
|
26930
|
+
},
|
|
26931
|
+
onExit() {
|
|
26932
|
+
destroyTippyInstance(getFirstTippyInstance(popup));
|
|
26933
|
+
component?.destroy();
|
|
26934
|
+
}
|
|
26935
|
+
};
|
|
26936
|
+
}
|
|
26937
|
+
})
|
|
26938
|
+
];
|
|
26939
|
+
}
|
|
26940
|
+
});
|
|
26941
|
+
|
|
26706
26942
|
// src/components/UEditor/placeholder.ts
|
|
26707
|
-
import { Extension as
|
|
26708
|
-
import { Plugin as Plugin3, PluginKey as
|
|
26943
|
+
import { Extension as Extension5, isNodeEmpty } from "@tiptap/core";
|
|
26944
|
+
import { Plugin as Plugin3, PluginKey as PluginKey4 } from "@tiptap/pm/state";
|
|
26709
26945
|
import { Decoration, DecorationSet } from "@tiptap/pm/view";
|
|
26710
|
-
var UEditorPlaceholder =
|
|
26946
|
+
var UEditorPlaceholder = Extension5.create({
|
|
26711
26947
|
name: "placeholder",
|
|
26712
26948
|
addOptions() {
|
|
26713
26949
|
return {
|
|
@@ -26725,7 +26961,7 @@ var UEditorPlaceholder = Extension4.create({
|
|
|
26725
26961
|
const dataAttribute = `data-${this.options.dataAttribute}`;
|
|
26726
26962
|
return [
|
|
26727
26963
|
new Plugin3({
|
|
26728
|
-
key: new
|
|
26964
|
+
key: new PluginKey4("placeholder"),
|
|
26729
26965
|
props: {
|
|
26730
26966
|
decorations: ({ doc, selection }) => {
|
|
26731
26967
|
const active = this.editor.isEditable || !this.options.showOnlyWhenEditable;
|
|
@@ -26781,7 +27017,7 @@ import { useEffect as useEffect34, useRef as useRef29, useState as useState44 }
|
|
|
26781
27017
|
import Image4 from "@tiptap/extension-image";
|
|
26782
27018
|
import { mergeAttributes as mergeAttributes4 } from "@tiptap/core";
|
|
26783
27019
|
import { NodeViewWrapper as NodeViewWrapper4, ReactNodeViewRenderer as ReactNodeViewRenderer4 } from "@tiptap/react";
|
|
26784
|
-
import { jsx as
|
|
27020
|
+
import { jsx as jsx82, jsxs as jsxs68 } from "react/jsx-runtime";
|
|
26785
27021
|
var MIN_IMAGE_SIZE_PX = 40;
|
|
26786
27022
|
var IMAGE_LAYOUTS = /* @__PURE__ */ new Set(["block", "left", "right"]);
|
|
26787
27023
|
var IMAGE_WIDTH_PRESETS = /* @__PURE__ */ new Set(["sm", "md", "lg"]);
|
|
@@ -26955,7 +27191,7 @@ function ResizableImageNodeView(props) {
|
|
|
26955
27191
|
const showHandle = selected || isHovered || isResizing;
|
|
26956
27192
|
const wrapperAlignClass = imageLayout === "block" ? textAlign === "center" ? "mx-auto" : textAlign === "right" ? "ml-auto" : textAlign === "justify" ? "mx-auto" : "" : "";
|
|
26957
27193
|
const wrapperLayoutClass = imageLayout === "left" ? "float-left mr-4 mb-3 mt-1 clear-none max-w-[min(45%,20rem)]" : imageLayout === "right" ? "float-right ml-4 mb-3 mt-1 clear-none max-w-[min(45%,20rem)]" : "w-fit";
|
|
26958
|
-
return /* @__PURE__ */
|
|
27194
|
+
return /* @__PURE__ */ jsxs68(
|
|
26959
27195
|
NodeViewWrapper4,
|
|
26960
27196
|
{
|
|
26961
27197
|
as: "div",
|
|
@@ -26970,7 +27206,7 @@ function ResizableImageNodeView(props) {
|
|
|
26970
27206
|
},
|
|
26971
27207
|
contentEditable: false,
|
|
26972
27208
|
children: [
|
|
26973
|
-
/* @__PURE__ */
|
|
27209
|
+
/* @__PURE__ */ jsx82(
|
|
26974
27210
|
"img",
|
|
26975
27211
|
{
|
|
26976
27212
|
ref: imgRef,
|
|
@@ -26989,7 +27225,7 @@ function ResizableImageNodeView(props) {
|
|
|
26989
27225
|
}
|
|
26990
27226
|
}
|
|
26991
27227
|
),
|
|
26992
|
-
showHandle && /* @__PURE__ */
|
|
27228
|
+
showHandle && /* @__PURE__ */ jsx82(
|
|
26993
27229
|
"div",
|
|
26994
27230
|
{
|
|
26995
27231
|
"aria-hidden": "true",
|
|
@@ -27102,8 +27338,8 @@ var UEditorTableRow = TableRow2.extend({
|
|
|
27102
27338
|
var table_row_default = UEditorTableRow;
|
|
27103
27339
|
|
|
27104
27340
|
// src/components/UEditor/font-family.ts
|
|
27105
|
-
import { Extension as
|
|
27106
|
-
var FontFamily =
|
|
27341
|
+
import { Extension as Extension6 } from "@tiptap/core";
|
|
27342
|
+
var FontFamily = Extension6.create({
|
|
27107
27343
|
name: "fontFamily",
|
|
27108
27344
|
addOptions() {
|
|
27109
27345
|
return {
|
|
@@ -27138,8 +27374,8 @@ var FontFamily = Extension5.create({
|
|
|
27138
27374
|
var font_family_default = FontFamily;
|
|
27139
27375
|
|
|
27140
27376
|
// src/components/UEditor/font-size.ts
|
|
27141
|
-
import { Extension as
|
|
27142
|
-
var FontSize =
|
|
27377
|
+
import { Extension as Extension7 } from "@tiptap/core";
|
|
27378
|
+
var FontSize = Extension7.create({
|
|
27143
27379
|
name: "fontSize",
|
|
27144
27380
|
addOptions() {
|
|
27145
27381
|
return {
|
|
@@ -27174,8 +27410,8 @@ var FontSize = Extension6.create({
|
|
|
27174
27410
|
var font_size_default = FontSize;
|
|
27175
27411
|
|
|
27176
27412
|
// src/components/UEditor/line-height.ts
|
|
27177
|
-
import { Extension as
|
|
27178
|
-
var LineHeight =
|
|
27413
|
+
import { Extension as Extension8 } from "@tiptap/core";
|
|
27414
|
+
var LineHeight = Extension8.create({
|
|
27179
27415
|
name: "lineHeight",
|
|
27180
27416
|
addOptions() {
|
|
27181
27417
|
return {
|
|
@@ -27210,8 +27446,8 @@ var LineHeight = Extension7.create({
|
|
|
27210
27446
|
var line_height_default = LineHeight;
|
|
27211
27447
|
|
|
27212
27448
|
// src/components/UEditor/letter-spacing.ts
|
|
27213
|
-
import { Extension as
|
|
27214
|
-
var LetterSpacing =
|
|
27449
|
+
import { Extension as Extension9 } from "@tiptap/core";
|
|
27450
|
+
var LetterSpacing = Extension9.create({
|
|
27215
27451
|
name: "letterSpacing",
|
|
27216
27452
|
addOptions() {
|
|
27217
27453
|
return {
|
|
@@ -27509,10 +27745,10 @@ var UEditorTable = Table3.extend({
|
|
|
27509
27745
|
var table_align_default = UEditorTable;
|
|
27510
27746
|
|
|
27511
27747
|
// src/components/UEditor/CodeBlockView.tsx
|
|
27512
|
-
import
|
|
27748
|
+
import React74, { useState as useState45 } from "react";
|
|
27513
27749
|
import { NodeViewWrapper as NodeViewWrapper5, NodeViewContent as NodeViewContent2 } from "@tiptap/react";
|
|
27514
27750
|
import { Check as Check10, Copy as Copy2, ChevronDown as ChevronDown7 } from "lucide-react";
|
|
27515
|
-
import { Fragment as Fragment27, jsx as
|
|
27751
|
+
import { Fragment as Fragment27, jsx as jsx83, jsxs as jsxs69 } from "react/jsx-runtime";
|
|
27516
27752
|
var LANGUAGES = [
|
|
27517
27753
|
{ label: "Plain Text", value: "text" },
|
|
27518
27754
|
{ label: "JavaScript", value: "javascript" },
|
|
@@ -27536,10 +27772,10 @@ var CodeBlockView = ({
|
|
|
27536
27772
|
}) => {
|
|
27537
27773
|
const [copied, setCopied] = useState45(false);
|
|
27538
27774
|
const [isDropdownOpen, setIsDropdownOpen] = useState45(false);
|
|
27539
|
-
const timeoutRef =
|
|
27775
|
+
const timeoutRef = React74.useRef(null);
|
|
27540
27776
|
const currentLangValue = node.attrs.language || "text";
|
|
27541
27777
|
const currentLangLabel = LANGUAGES.find((lang) => lang.value === currentLangValue)?.label || "Plain Text";
|
|
27542
|
-
|
|
27778
|
+
React74.useEffect(() => {
|
|
27543
27779
|
return () => {
|
|
27544
27780
|
if (timeoutRef.current) {
|
|
27545
27781
|
clearTimeout(timeoutRef.current);
|
|
@@ -27560,15 +27796,15 @@ var CodeBlockView = ({
|
|
|
27560
27796
|
console.error("Failed to copy code text: ", err);
|
|
27561
27797
|
}
|
|
27562
27798
|
};
|
|
27563
|
-
return /* @__PURE__ */
|
|
27564
|
-
/* @__PURE__ */
|
|
27799
|
+
return /* @__PURE__ */ jsxs69(NodeViewWrapper5, { className: "group/code relative my-4 rounded-xl border border-border/60 bg-muted/40 p-4 font-mono text-sm shadow-sm overflow-visible", children: [
|
|
27800
|
+
/* @__PURE__ */ jsxs69(
|
|
27565
27801
|
"div",
|
|
27566
27802
|
{
|
|
27567
27803
|
className: "absolute right-3 top-3 z-10 flex items-center gap-1.5 opacity-0 group-hover/code:opacity-100 focus-within:opacity-100 transition-opacity duration-200 select-none",
|
|
27568
27804
|
contentEditable: false,
|
|
27569
27805
|
children: [
|
|
27570
|
-
/* @__PURE__ */
|
|
27571
|
-
/* @__PURE__ */
|
|
27806
|
+
/* @__PURE__ */ jsxs69("div", { className: "relative", children: [
|
|
27807
|
+
/* @__PURE__ */ jsxs69(
|
|
27572
27808
|
"button",
|
|
27573
27809
|
{
|
|
27574
27810
|
type: "button",
|
|
@@ -27576,19 +27812,19 @@ var CodeBlockView = ({
|
|
|
27576
27812
|
className: "flex items-center gap-1.5 rounded-lg border border-border bg-background px-2.5 py-1 text-xs text-muted-foreground hover:text-foreground hover:bg-muted active:scale-95 transition-all focus:outline-none",
|
|
27577
27813
|
children: [
|
|
27578
27814
|
currentLangLabel,
|
|
27579
|
-
/* @__PURE__ */
|
|
27815
|
+
/* @__PURE__ */ jsx83(ChevronDown7, { className: "h-3 w-3" })
|
|
27580
27816
|
]
|
|
27581
27817
|
}
|
|
27582
27818
|
),
|
|
27583
|
-
isDropdownOpen && /* @__PURE__ */
|
|
27584
|
-
/* @__PURE__ */
|
|
27819
|
+
isDropdownOpen && /* @__PURE__ */ jsxs69(Fragment27, { children: [
|
|
27820
|
+
/* @__PURE__ */ jsx83(
|
|
27585
27821
|
"div",
|
|
27586
27822
|
{
|
|
27587
27823
|
className: "fixed inset-0 z-20",
|
|
27588
27824
|
onClick: () => setIsDropdownOpen(false)
|
|
27589
27825
|
}
|
|
27590
27826
|
),
|
|
27591
|
-
/* @__PURE__ */
|
|
27827
|
+
/* @__PURE__ */ jsx83("div", { className: "absolute right-0 mt-1 max-h-56 w-36 overflow-y-auto rounded-lg border border-border/50 bg-popover p-1 shadow-lg z-30 [scrollbar-width:thin] animate-in fade-in-0 zoom-in-95", children: LANGUAGES.map((lang) => /* @__PURE__ */ jsx83(
|
|
27592
27828
|
"button",
|
|
27593
27829
|
{
|
|
27594
27830
|
type: "button",
|
|
@@ -27606,20 +27842,20 @@ var CodeBlockView = ({
|
|
|
27606
27842
|
)) })
|
|
27607
27843
|
] })
|
|
27608
27844
|
] }),
|
|
27609
|
-
/* @__PURE__ */
|
|
27845
|
+
/* @__PURE__ */ jsx83(
|
|
27610
27846
|
"button",
|
|
27611
27847
|
{
|
|
27612
27848
|
type: "button",
|
|
27613
27849
|
onClick: handleCopy,
|
|
27614
27850
|
className: "flex h-7 w-7 items-center justify-center rounded-lg border border-border bg-background text-muted-foreground hover:text-foreground hover:bg-muted active:scale-95 transition-all focus:outline-none",
|
|
27615
27851
|
title: "Copy code",
|
|
27616
|
-
children: copied ? /* @__PURE__ */
|
|
27852
|
+
children: copied ? /* @__PURE__ */ jsx83(Check10, { className: "h-3.5 w-3.5 text-success animate-in fade-in-0 zoom-in-75" }) : /* @__PURE__ */ jsx83(Copy2, { className: "h-3.5 w-3.5" })
|
|
27617
27853
|
}
|
|
27618
27854
|
)
|
|
27619
27855
|
]
|
|
27620
27856
|
}
|
|
27621
27857
|
),
|
|
27622
|
-
/* @__PURE__ */
|
|
27858
|
+
/* @__PURE__ */ jsx83("pre", { className: "m-0 overflow-x-auto [scrollbar-width:thin] pt-4 sm:pt-0", children: /* @__PURE__ */ jsx83("code", { className: "bg-transparent! text-foreground!", children: /* @__PURE__ */ jsx83(NodeViewContent2, {}) }) })
|
|
27623
27859
|
] });
|
|
27624
27860
|
};
|
|
27625
27861
|
|
|
@@ -28005,6 +28241,7 @@ function buildUEditorExtensions({
|
|
|
28005
28241
|
SlashCommand.configure({
|
|
28006
28242
|
messages: buildSlashCommandMessages(translate)
|
|
28007
28243
|
}),
|
|
28244
|
+
FormulaSuggestion,
|
|
28008
28245
|
EmojiSuggestion,
|
|
28009
28246
|
Callout,
|
|
28010
28247
|
Bookmark.configure({
|
|
@@ -28017,7 +28254,7 @@ function buildUEditorExtensions({
|
|
|
28017
28254
|
}
|
|
28018
28255
|
|
|
28019
28256
|
// src/components/UEditor/toolbar.tsx
|
|
28020
|
-
import
|
|
28257
|
+
import React77, { useRef as useRef32, useState as useState47 } from "react";
|
|
28021
28258
|
import { useEditorState } from "@tiptap/react";
|
|
28022
28259
|
import {
|
|
28023
28260
|
AlignCenter,
|
|
@@ -28062,12 +28299,12 @@ import {
|
|
|
28062
28299
|
// src/components/UEditor/colors.tsx
|
|
28063
28300
|
import { useMemo as useMemo22, useRef as useRef30 } from "react";
|
|
28064
28301
|
import { Check as Check11, Highlighter, Palette as Palette2, Paintbrush, Grid as Grid2 } from "lucide-react";
|
|
28065
|
-
import { jsx as
|
|
28302
|
+
import { jsx as jsx84, jsxs as jsxs70 } from "react/jsx-runtime";
|
|
28066
28303
|
var TextColorIcon = ({ color }) => {
|
|
28067
28304
|
const underlineColor = color && color !== "inherit" ? color : "currentColor";
|
|
28068
|
-
return /* @__PURE__ */
|
|
28069
|
-
/* @__PURE__ */
|
|
28070
|
-
/* @__PURE__ */
|
|
28305
|
+
return /* @__PURE__ */ jsxs70("span", { className: "relative flex h-5 w-5 items-center justify-center leading-none", children: [
|
|
28306
|
+
/* @__PURE__ */ jsx84("span", { className: "text-[15px] font-semibold leading-none", children: "A" }),
|
|
28307
|
+
/* @__PURE__ */ jsx84(
|
|
28071
28308
|
"span",
|
|
28072
28309
|
{
|
|
28073
28310
|
"aria-hidden": "true",
|
|
@@ -28079,9 +28316,9 @@ var TextColorIcon = ({ color }) => {
|
|
|
28079
28316
|
};
|
|
28080
28317
|
var HighlightColorIcon = ({ color }) => {
|
|
28081
28318
|
const underlineColor = color || "currentColor";
|
|
28082
|
-
return /* @__PURE__ */
|
|
28083
|
-
/* @__PURE__ */
|
|
28084
|
-
/* @__PURE__ */
|
|
28319
|
+
return /* @__PURE__ */ jsxs70("span", { className: "relative flex h-5 w-5 items-center justify-center leading-none", children: [
|
|
28320
|
+
/* @__PURE__ */ jsx84(Highlighter, { className: "h-4 w-4" }),
|
|
28321
|
+
/* @__PURE__ */ jsx84(
|
|
28085
28322
|
"span",
|
|
28086
28323
|
{
|
|
28087
28324
|
"aria-hidden": "true",
|
|
@@ -28093,9 +28330,9 @@ var HighlightColorIcon = ({ color }) => {
|
|
|
28093
28330
|
};
|
|
28094
28331
|
var CellBgColorIcon = ({ color }) => {
|
|
28095
28332
|
const underlineColor = color && color !== "inherit" ? color : "currentColor";
|
|
28096
|
-
return /* @__PURE__ */
|
|
28097
|
-
/* @__PURE__ */
|
|
28098
|
-
/* @__PURE__ */
|
|
28333
|
+
return /* @__PURE__ */ jsxs70("span", { className: "relative flex h-5 w-5 items-center justify-center leading-none", children: [
|
|
28334
|
+
/* @__PURE__ */ jsx84(Paintbrush, { className: "h-4 w-4" }),
|
|
28335
|
+
/* @__PURE__ */ jsx84(
|
|
28099
28336
|
"span",
|
|
28100
28337
|
{
|
|
28101
28338
|
"aria-hidden": "true",
|
|
@@ -28107,9 +28344,9 @@ var CellBgColorIcon = ({ color }) => {
|
|
|
28107
28344
|
};
|
|
28108
28345
|
var CellBorderIcon = ({ color }) => {
|
|
28109
28346
|
const underlineColor = color && color !== "inherit" ? color : "currentColor";
|
|
28110
|
-
return /* @__PURE__ */
|
|
28111
|
-
/* @__PURE__ */
|
|
28112
|
-
/* @__PURE__ */
|
|
28347
|
+
return /* @__PURE__ */ jsxs70("span", { className: "relative flex h-5 w-5 items-center justify-center leading-none", children: [
|
|
28348
|
+
/* @__PURE__ */ jsx84(Grid2, { className: "h-4 w-4" }),
|
|
28349
|
+
/* @__PURE__ */ jsx84(
|
|
28113
28350
|
"span",
|
|
28114
28351
|
{
|
|
28115
28352
|
"aria-hidden": "true",
|
|
@@ -28233,9 +28470,9 @@ var EditorColorPalette = ({
|
|
|
28233
28470
|
const colorInputRef = useRef30(null);
|
|
28234
28471
|
const automaticColor = colors[0]?.color ?? "";
|
|
28235
28472
|
const paletteColors = colors.slice(1);
|
|
28236
|
-
return /* @__PURE__ */
|
|
28237
|
-
/* @__PURE__ */
|
|
28238
|
-
/* @__PURE__ */
|
|
28473
|
+
return /* @__PURE__ */ jsxs70("div", { className: "w-56 p-2", children: [
|
|
28474
|
+
/* @__PURE__ */ jsx84("span", { className: "px-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: label }),
|
|
28475
|
+
/* @__PURE__ */ jsxs70(
|
|
28239
28476
|
"button",
|
|
28240
28477
|
{
|
|
28241
28478
|
type: "button",
|
|
@@ -28247,12 +28484,12 @@ var EditorColorPalette = ({
|
|
|
28247
28484
|
currentColor === automaticColor ? "border-primary text-primary" : "border-transparent text-foreground"
|
|
28248
28485
|
),
|
|
28249
28486
|
children: [
|
|
28250
|
-
/* @__PURE__ */
|
|
28251
|
-
/* @__PURE__ */
|
|
28487
|
+
/* @__PURE__ */ jsx84("span", { className: "flex h-5 w-5 items-center justify-center rounded border border-border bg-background", children: currentColor === automaticColor && /* @__PURE__ */ jsx84(Check11, { className: "h-3.5 w-3.5" }) }),
|
|
28488
|
+
/* @__PURE__ */ jsx84("span", { className: "flex-1 text-center", children: t("colors.automatic") })
|
|
28252
28489
|
]
|
|
28253
28490
|
}
|
|
28254
28491
|
),
|
|
28255
|
-
/* @__PURE__ */
|
|
28492
|
+
/* @__PURE__ */ jsx84("div", { className: "mt-2 grid grid-cols-8 gap-1", children: paletteColors.map((c) => /* @__PURE__ */ jsx84(Tooltip, { placement: "top", content: /* @__PURE__ */ jsx84("span", { className: "text-xs font-medium", children: c.name }), children: /* @__PURE__ */ jsx84(
|
|
28256
28493
|
"button",
|
|
28257
28494
|
{
|
|
28258
28495
|
type: "button",
|
|
@@ -28264,10 +28501,10 @@ var EditorColorPalette = ({
|
|
|
28264
28501
|
currentColor === c.color ? "border-primary ring-2 ring-primary/25" : "border-border/70"
|
|
28265
28502
|
),
|
|
28266
28503
|
style: { backgroundColor: c.color || "transparent" },
|
|
28267
|
-
children: currentColor === c.color && /* @__PURE__ */
|
|
28504
|
+
children: currentColor === c.color && /* @__PURE__ */ jsx84("span", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx84(Check11, { className: "h-3.5 w-3.5 text-white drop-shadow-[0_1px_1px_rgba(0,0,0,0.8)]" }) })
|
|
28268
28505
|
}
|
|
28269
28506
|
) }, `${c.name}-${c.color}`)) }),
|
|
28270
|
-
/* @__PURE__ */
|
|
28507
|
+
/* @__PURE__ */ jsxs70(
|
|
28271
28508
|
"button",
|
|
28272
28509
|
{
|
|
28273
28510
|
type: "button",
|
|
@@ -28275,7 +28512,7 @@ var EditorColorPalette = ({
|
|
|
28275
28512
|
onClick: () => colorInputRef.current?.click(),
|
|
28276
28513
|
className: "mt-3 flex h-9 w-full items-center gap-3 rounded-md px-2 text-sm text-foreground transition-colors hover:bg-muted",
|
|
28277
28514
|
children: [
|
|
28278
|
-
/* @__PURE__ */
|
|
28515
|
+
/* @__PURE__ */ jsx84(
|
|
28279
28516
|
"span",
|
|
28280
28517
|
{
|
|
28281
28518
|
"aria-hidden": "true",
|
|
@@ -28285,9 +28522,9 @@ var EditorColorPalette = ({
|
|
|
28285
28522
|
}
|
|
28286
28523
|
}
|
|
28287
28524
|
),
|
|
28288
|
-
/* @__PURE__ */
|
|
28289
|
-
/* @__PURE__ */
|
|
28290
|
-
/* @__PURE__ */
|
|
28525
|
+
/* @__PURE__ */ jsx84("span", { className: "flex-1 text-center", children: t("colors.moreColors") }),
|
|
28526
|
+
/* @__PURE__ */ jsx84(Palette2, { className: "h-4 w-4 text-muted-foreground" }),
|
|
28527
|
+
/* @__PURE__ */ jsx84(
|
|
28291
28528
|
"input",
|
|
28292
28529
|
{
|
|
28293
28530
|
ref: colorInputRef,
|
|
@@ -28434,7 +28671,7 @@ function deleteSelectedImage(editor) {
|
|
|
28434
28671
|
// src/components/UEditor/inputs.tsx
|
|
28435
28672
|
import { useEffect as useEffect35, useRef as useRef31, useState as useState46 } from "react";
|
|
28436
28673
|
import { Check as Check12, X as X18 } from "lucide-react";
|
|
28437
|
-
import { jsx as
|
|
28674
|
+
import { jsx as jsx85, jsxs as jsxs71 } from "react/jsx-runtime";
|
|
28438
28675
|
function normalizeUrl(raw) {
|
|
28439
28676
|
return sanitizeUEditorUrl(raw, "link");
|
|
28440
28677
|
}
|
|
@@ -28455,8 +28692,8 @@ var LinkInput = ({
|
|
|
28455
28692
|
const normalized = normalizeUrl(url);
|
|
28456
28693
|
if (normalized) onSubmit(normalized);
|
|
28457
28694
|
};
|
|
28458
|
-
return /* @__PURE__ */
|
|
28459
|
-
/* @__PURE__ */
|
|
28695
|
+
return /* @__PURE__ */ jsxs71("form", { onSubmit: handleSubmit, className: "flex items-center gap-2 p-2", children: [
|
|
28696
|
+
/* @__PURE__ */ jsx85(
|
|
28460
28697
|
"input",
|
|
28461
28698
|
{
|
|
28462
28699
|
ref: inputRef,
|
|
@@ -28467,8 +28704,8 @@ var LinkInput = ({
|
|
|
28467
28704
|
className: "flex-1 px-3 py-2 text-sm bg-muted/50 border-0 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary/20"
|
|
28468
28705
|
}
|
|
28469
28706
|
),
|
|
28470
|
-
/* @__PURE__ */
|
|
28471
|
-
/* @__PURE__ */
|
|
28707
|
+
/* @__PURE__ */ jsx85("button", { type: "submit", className: "p-2 rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors", children: /* @__PURE__ */ jsx85(Check12, { className: "w-4 h-4" }) }),
|
|
28708
|
+
/* @__PURE__ */ jsx85("button", { type: "button", onClick: onCancel, className: "p-2 rounded-lg hover:bg-muted transition-colors text-muted-foreground", children: /* @__PURE__ */ jsx85(X18, { className: "w-4 h-4" }) })
|
|
28472
28709
|
] });
|
|
28473
28710
|
};
|
|
28474
28711
|
var ImageInput = ({ onSubmit, onCancel }) => {
|
|
@@ -28486,10 +28723,10 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
28486
28723
|
onSubmit(safeUrl, alt);
|
|
28487
28724
|
}
|
|
28488
28725
|
};
|
|
28489
|
-
return /* @__PURE__ */
|
|
28490
|
-
/* @__PURE__ */
|
|
28491
|
-
/* @__PURE__ */
|
|
28492
|
-
/* @__PURE__ */
|
|
28726
|
+
return /* @__PURE__ */ jsxs71("form", { onSubmit: handleSubmit, className: "p-3 space-y-3", children: [
|
|
28727
|
+
/* @__PURE__ */ jsxs71("div", { children: [
|
|
28728
|
+
/* @__PURE__ */ jsx85("label", { className: "text-xs font-medium text-muted-foreground", children: t("imageInput.urlLabel") }),
|
|
28729
|
+
/* @__PURE__ */ jsx85(
|
|
28493
28730
|
"input",
|
|
28494
28731
|
{
|
|
28495
28732
|
ref: inputRef,
|
|
@@ -28501,9 +28738,9 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
28501
28738
|
}
|
|
28502
28739
|
)
|
|
28503
28740
|
] }),
|
|
28504
|
-
/* @__PURE__ */
|
|
28505
|
-
/* @__PURE__ */
|
|
28506
|
-
/* @__PURE__ */
|
|
28741
|
+
/* @__PURE__ */ jsxs71("div", { children: [
|
|
28742
|
+
/* @__PURE__ */ jsx85("label", { className: "text-xs font-medium text-muted-foreground", children: t("imageInput.altLabel") }),
|
|
28743
|
+
/* @__PURE__ */ jsx85(
|
|
28507
28744
|
"input",
|
|
28508
28745
|
{
|
|
28509
28746
|
type: "text",
|
|
@@ -28514,8 +28751,8 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
28514
28751
|
}
|
|
28515
28752
|
)
|
|
28516
28753
|
] }),
|
|
28517
|
-
/* @__PURE__ */
|
|
28518
|
-
/* @__PURE__ */
|
|
28754
|
+
/* @__PURE__ */ jsxs71("div", { className: "flex gap-2", children: [
|
|
28755
|
+
/* @__PURE__ */ jsx85(
|
|
28519
28756
|
"button",
|
|
28520
28757
|
{
|
|
28521
28758
|
type: "submit",
|
|
@@ -28524,7 +28761,7 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
28524
28761
|
children: t("imageInput.addBtn")
|
|
28525
28762
|
}
|
|
28526
28763
|
),
|
|
28527
|
-
/* @__PURE__ */
|
|
28764
|
+
/* @__PURE__ */ jsx85("button", { type: "button", onClick: onCancel, className: "px-4 py-2 rounded-lg hover:bg-muted transition-colors text-muted-foreground", children: t("imageInput.cancelBtn") })
|
|
28528
28765
|
] })
|
|
28529
28766
|
] });
|
|
28530
28767
|
};
|
|
@@ -28855,7 +29092,7 @@ function getDefaultLetterSpacings() {
|
|
|
28855
29092
|
}
|
|
28856
29093
|
|
|
28857
29094
|
// src/components/UEditor/toolbar.tsx
|
|
28858
|
-
import { Fragment as Fragment28, jsx as
|
|
29095
|
+
import { Fragment as Fragment28, jsx as jsx86, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
28859
29096
|
function getTableAnchorPos(editor) {
|
|
28860
29097
|
const tableInfo = findTableNodeInfoFromState(editor.state);
|
|
28861
29098
|
if (tableInfo) return editor.state.selection.from;
|
|
@@ -28885,8 +29122,8 @@ function fileToDataUrl2(file) {
|
|
|
28885
29122
|
function formatTableInsertLabel(template, rows, cols) {
|
|
28886
29123
|
return template.replace("{rows}", String(rows)).replace("{cols}", String(cols));
|
|
28887
29124
|
}
|
|
28888
|
-
var ToolbarButton =
|
|
28889
|
-
const button = /* @__PURE__ */
|
|
29125
|
+
var ToolbarButton = React77.forwardRef(({ onClick, onMouseDown, active, disabled, children, title, className }, ref) => {
|
|
29126
|
+
const button = /* @__PURE__ */ jsx86(
|
|
28890
29127
|
"button",
|
|
28891
29128
|
{
|
|
28892
29129
|
ref,
|
|
@@ -28911,28 +29148,28 @@ var ToolbarButton = React76.forwardRef(({ onClick, onMouseDown, active, disabled
|
|
|
28911
29148
|
}
|
|
28912
29149
|
);
|
|
28913
29150
|
if (title) {
|
|
28914
|
-
return /* @__PURE__ */
|
|
29151
|
+
return /* @__PURE__ */ jsx86(Tooltip, { content: title, placement: "top", delay: { open: 200, close: 0 }, children: button });
|
|
28915
29152
|
}
|
|
28916
29153
|
return button;
|
|
28917
29154
|
});
|
|
28918
29155
|
ToolbarButton.displayName = "ToolbarButton";
|
|
28919
|
-
var ToolbarDivider = () => /* @__PURE__ */
|
|
29156
|
+
var ToolbarDivider = () => /* @__PURE__ */ jsx86("div", { className: "mx-0.5 h-5 w-px bg-border/60" });
|
|
28920
29157
|
var TableInsertGrid = ({
|
|
28921
29158
|
insertLabel,
|
|
28922
29159
|
previewTemplate,
|
|
28923
29160
|
onInsert
|
|
28924
29161
|
}) => {
|
|
28925
|
-
const [selection, setSelection] =
|
|
29162
|
+
const [selection, setSelection] = React77.useState({ rows: 3, cols: 3 });
|
|
28926
29163
|
const maxRows = 8;
|
|
28927
29164
|
const maxCols = 8;
|
|
28928
|
-
return /* @__PURE__ */
|
|
28929
|
-
/* @__PURE__ */
|
|
28930
|
-
/* @__PURE__ */
|
|
29165
|
+
return /* @__PURE__ */ jsxs72("div", { className: "mb-2 rounded-xl border border-border/60 bg-muted/20 p-2", children: [
|
|
29166
|
+
/* @__PURE__ */ jsx86("div", { className: "mb-2 text-sm font-medium text-foreground", children: formatTableInsertLabel(previewTemplate, selection.rows, selection.cols) }),
|
|
29167
|
+
/* @__PURE__ */ jsx86("div", { className: "grid grid-cols-8 gap-1", onMouseLeave: () => setSelection((prev) => prev), children: Array.from({ length: maxRows }).map(
|
|
28931
29168
|
(_, rowIndex) => Array.from({ length: maxCols }).map((__, colIndex) => {
|
|
28932
29169
|
const rows = rowIndex + 1;
|
|
28933
29170
|
const cols = colIndex + 1;
|
|
28934
29171
|
const active = rows <= selection.rows && cols <= selection.cols;
|
|
28935
|
-
return /* @__PURE__ */
|
|
29172
|
+
return /* @__PURE__ */ jsx86(
|
|
28936
29173
|
"button",
|
|
28937
29174
|
{
|
|
28938
29175
|
type: "button",
|
|
@@ -28950,7 +29187,7 @@ var TableInsertGrid = ({
|
|
|
28950
29187
|
);
|
|
28951
29188
|
})
|
|
28952
29189
|
) }),
|
|
28953
|
-
/* @__PURE__ */
|
|
29190
|
+
/* @__PURE__ */ jsx86("div", { className: "mt-2 text-xs text-muted-foreground", children: insertLabel })
|
|
28954
29191
|
] });
|
|
28955
29192
|
};
|
|
28956
29193
|
var EditorToolbar = ({
|
|
@@ -28998,10 +29235,10 @@ var EditorToolbar = ({
|
|
|
28998
29235
|
const currentHighlightColor = normalizeStyleValue(editor.getAttributes("highlight").color) || "";
|
|
28999
29236
|
const currentLineHeight = normalizeStyleValue(textStyleAttrs.lineHeight);
|
|
29000
29237
|
const currentLetterSpacing = normalizeStyleValue(textStyleAttrs.letterSpacing);
|
|
29001
|
-
const availableFontFamilies =
|
|
29002
|
-
const availableFontSizes =
|
|
29003
|
-
const availableLineHeights =
|
|
29004
|
-
const availableLetterSpacings =
|
|
29238
|
+
const availableFontFamilies = React77.useMemo(() => fontFamilies ?? getDefaultFontFamilies(t), [fontFamilies, t]);
|
|
29239
|
+
const availableFontSizes = React77.useMemo(() => fontSizes ?? getDefaultFontSizes(), [fontSizes]);
|
|
29240
|
+
const availableLineHeights = React77.useMemo(() => lineHeights ?? getDefaultLineHeights(), [lineHeights]);
|
|
29241
|
+
const availableLetterSpacings = React77.useMemo(() => letterSpacings ?? getDefaultLetterSpacings(), [letterSpacings]);
|
|
29005
29242
|
const currentFontFamilyDisplayValue = currentFontFamily.split(",")[0]?.trim() ?? currentFontFamily;
|
|
29006
29243
|
const currentFontFamilyLabel = availableFontFamilies.find((option) => normalizeStyleValue(option.value) === currentFontFamily)?.label ?? (currentFontFamilyDisplayValue || t("toolbar.fontDefault"));
|
|
29007
29244
|
const currentFontSizeLabel = availableFontSizes.find((option) => normalizeStyleValue(option.value) === currentFontSize)?.label ?? t("toolbar.sizeDefault");
|
|
@@ -29030,32 +29267,32 @@ var EditorToolbar = ({
|
|
|
29030
29267
|
setIsUploadingImage(false);
|
|
29031
29268
|
};
|
|
29032
29269
|
if (variant === "minimal") {
|
|
29033
|
-
return /* @__PURE__ */
|
|
29034
|
-
/* @__PURE__ */
|
|
29035
|
-
/* @__PURE__ */
|
|
29036
|
-
/* @__PURE__ */
|
|
29270
|
+
return /* @__PURE__ */ jsxs72("div", { className: "flex items-center gap-1 border-b border-border/35 bg-muted/30 p-2", children: [
|
|
29271
|
+
/* @__PURE__ */ jsx86(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ jsx86(BoldIcon, { className: "w-4 h-4" }) }),
|
|
29272
|
+
/* @__PURE__ */ jsx86(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ jsx86(ItalicIcon, { className: "w-4 h-4" }) }),
|
|
29273
|
+
/* @__PURE__ */ jsx86(
|
|
29037
29274
|
ToolbarButton,
|
|
29038
29275
|
{
|
|
29039
29276
|
onClick: () => editor.chain().focus().toggleBulletList().run(),
|
|
29040
29277
|
active: editor.isActive("bulletList"),
|
|
29041
29278
|
title: t("toolbar.bulletList"),
|
|
29042
|
-
children: /* @__PURE__ */
|
|
29279
|
+
children: /* @__PURE__ */ jsx86(ListIcon, { className: "w-4 h-4" })
|
|
29043
29280
|
}
|
|
29044
29281
|
)
|
|
29045
29282
|
] });
|
|
29046
29283
|
}
|
|
29047
|
-
return /* @__PURE__ */
|
|
29048
|
-
/* @__PURE__ */
|
|
29284
|
+
return /* @__PURE__ */ jsxs72("div", { className: "flex flex-wrap items-center gap-0.5 border-b border-border/35 bg-linear-to-r from-muted/25 to-transparent p-1.5", children: [
|
|
29285
|
+
/* @__PURE__ */ jsxs72(
|
|
29049
29286
|
DropdownMenu,
|
|
29050
29287
|
{
|
|
29051
|
-
trigger: /* @__PURE__ */
|
|
29288
|
+
trigger: /* @__PURE__ */ jsxs72(ToolbarButton, { onClick: () => {
|
|
29052
29289
|
}, title: t("toolbar.fontFamily"), className: "px-1.5 w-auto gap-0.5", children: [
|
|
29053
|
-
/* @__PURE__ */
|
|
29054
|
-
/* @__PURE__ */
|
|
29290
|
+
/* @__PURE__ */ jsx86(Baseline, { className: "w-4 h-4" }),
|
|
29291
|
+
/* @__PURE__ */ jsx86(ChevronDown8, { className: "h-3 w-3 text-muted-foreground" })
|
|
29055
29292
|
] }),
|
|
29056
29293
|
contentClassName: "max-h-80 overflow-y-auto min-w-56 p-2",
|
|
29057
29294
|
children: [
|
|
29058
|
-
/* @__PURE__ */
|
|
29295
|
+
/* @__PURE__ */ jsx86(
|
|
29059
29296
|
DropdownMenuItem,
|
|
29060
29297
|
{
|
|
29061
29298
|
icon: Type2,
|
|
@@ -29064,7 +29301,7 @@ var EditorToolbar = ({
|
|
|
29064
29301
|
active: !currentFontFamily
|
|
29065
29302
|
}
|
|
29066
29303
|
),
|
|
29067
|
-
availableFontFamilies.map((option) => /* @__PURE__ */
|
|
29304
|
+
availableFontFamilies.map((option) => /* @__PURE__ */ jsx86(
|
|
29068
29305
|
DropdownMenuItem,
|
|
29069
29306
|
{
|
|
29070
29307
|
label: option.label,
|
|
@@ -29077,20 +29314,20 @@ var EditorToolbar = ({
|
|
|
29077
29314
|
]
|
|
29078
29315
|
}
|
|
29079
29316
|
),
|
|
29080
|
-
/* @__PURE__ */
|
|
29317
|
+
/* @__PURE__ */ jsxs72(
|
|
29081
29318
|
DropdownMenu,
|
|
29082
29319
|
{
|
|
29083
|
-
trigger: /* @__PURE__ */
|
|
29320
|
+
trigger: /* @__PURE__ */ jsxs72(ToolbarButton, { onClick: () => {
|
|
29084
29321
|
}, title: t("toolbar.fontSize"), className: "px-1.5 w-auto gap-0.5", children: [
|
|
29085
|
-
/* @__PURE__ */
|
|
29086
|
-
/* @__PURE__ */
|
|
29087
|
-
/* @__PURE__ */
|
|
29322
|
+
/* @__PURE__ */ jsxs72("div", { className: "flex items-center gap-0.5", children: [
|
|
29323
|
+
/* @__PURE__ */ jsx86(ChevronsUpDown, { className: "h-3 w-3 text-muted-foreground", strokeWidth: 2.5 }),
|
|
29324
|
+
/* @__PURE__ */ jsx86("span", { className: "text-xs font-bold leading-none", children: "A" })
|
|
29088
29325
|
] }),
|
|
29089
|
-
/* @__PURE__ */
|
|
29326
|
+
/* @__PURE__ */ jsx86(ChevronDown8, { className: "h-3 w-3 text-muted-foreground" })
|
|
29090
29327
|
] }),
|
|
29091
29328
|
contentClassName: "max-h-80 overflow-y-auto min-w-32 p-2",
|
|
29092
29329
|
children: [
|
|
29093
|
-
/* @__PURE__ */
|
|
29330
|
+
/* @__PURE__ */ jsx86(
|
|
29094
29331
|
DropdownMenuItem,
|
|
29095
29332
|
{
|
|
29096
29333
|
icon: Type2,
|
|
@@ -29099,7 +29336,7 @@ var EditorToolbar = ({
|
|
|
29099
29336
|
active: !currentFontSize
|
|
29100
29337
|
}
|
|
29101
29338
|
),
|
|
29102
|
-
availableFontSizes.map((option) => /* @__PURE__ */
|
|
29339
|
+
availableFontSizes.map((option) => /* @__PURE__ */ jsx86(
|
|
29103
29340
|
DropdownMenuItem,
|
|
29104
29341
|
{
|
|
29105
29342
|
label: option.label,
|
|
@@ -29111,17 +29348,17 @@ var EditorToolbar = ({
|
|
|
29111
29348
|
]
|
|
29112
29349
|
}
|
|
29113
29350
|
),
|
|
29114
|
-
/* @__PURE__ */
|
|
29351
|
+
/* @__PURE__ */ jsxs72(
|
|
29115
29352
|
DropdownMenu,
|
|
29116
29353
|
{
|
|
29117
29354
|
contentClassName: "p-1",
|
|
29118
|
-
trigger: /* @__PURE__ */
|
|
29355
|
+
trigger: /* @__PURE__ */ jsxs72(ToolbarButton, { onClick: () => {
|
|
29119
29356
|
}, title: t("toolbar.textStyle"), className: "px-1.5 w-auto gap-0.5", children: [
|
|
29120
|
-
/* @__PURE__ */
|
|
29121
|
-
/* @__PURE__ */
|
|
29357
|
+
/* @__PURE__ */ jsx86(Type2, { className: "w-4 h-4" }),
|
|
29358
|
+
/* @__PURE__ */ jsx86(ChevronDown8, { className: "h-3 w-3 text-muted-foreground" })
|
|
29122
29359
|
] }),
|
|
29123
29360
|
children: [
|
|
29124
|
-
/* @__PURE__ */
|
|
29361
|
+
/* @__PURE__ */ jsx86(
|
|
29125
29362
|
DropdownMenuItem,
|
|
29126
29363
|
{
|
|
29127
29364
|
icon: Type2,
|
|
@@ -29130,7 +29367,7 @@ var EditorToolbar = ({
|
|
|
29130
29367
|
active: editor.isActive("paragraph")
|
|
29131
29368
|
}
|
|
29132
29369
|
),
|
|
29133
|
-
/* @__PURE__ */
|
|
29370
|
+
/* @__PURE__ */ jsx86(
|
|
29134
29371
|
DropdownMenuItem,
|
|
29135
29372
|
{
|
|
29136
29373
|
icon: Heading1Icon,
|
|
@@ -29140,7 +29377,7 @@ var EditorToolbar = ({
|
|
|
29140
29377
|
shortcut: "Ctrl+Alt+1"
|
|
29141
29378
|
}
|
|
29142
29379
|
),
|
|
29143
|
-
/* @__PURE__ */
|
|
29380
|
+
/* @__PURE__ */ jsx86(
|
|
29144
29381
|
DropdownMenuItem,
|
|
29145
29382
|
{
|
|
29146
29383
|
icon: Heading2Icon,
|
|
@@ -29150,7 +29387,7 @@ var EditorToolbar = ({
|
|
|
29150
29387
|
shortcut: "Ctrl+Alt+2"
|
|
29151
29388
|
}
|
|
29152
29389
|
),
|
|
29153
|
-
/* @__PURE__ */
|
|
29390
|
+
/* @__PURE__ */ jsx86(
|
|
29154
29391
|
DropdownMenuItem,
|
|
29155
29392
|
{
|
|
29156
29393
|
icon: Heading3Icon,
|
|
@@ -29163,17 +29400,17 @@ var EditorToolbar = ({
|
|
|
29163
29400
|
]
|
|
29164
29401
|
}
|
|
29165
29402
|
),
|
|
29166
|
-
/* @__PURE__ */
|
|
29403
|
+
/* @__PURE__ */ jsxs72(
|
|
29167
29404
|
DropdownMenu,
|
|
29168
29405
|
{
|
|
29169
|
-
trigger: /* @__PURE__ */
|
|
29406
|
+
trigger: /* @__PURE__ */ jsxs72(ToolbarButton, { onClick: () => {
|
|
29170
29407
|
}, title: t("toolbar.lineHeight"), className: "gap-0.5", children: [
|
|
29171
|
-
/* @__PURE__ */
|
|
29172
|
-
/* @__PURE__ */
|
|
29408
|
+
/* @__PURE__ */ jsx86(ArrowUp, { className: "w-3 h-3" }),
|
|
29409
|
+
/* @__PURE__ */ jsx86(ArrowDown, { className: "w-3 h-3" })
|
|
29173
29410
|
] }),
|
|
29174
29411
|
contentClassName: "max-h-72 overflow-y-auto p-1",
|
|
29175
29412
|
children: [
|
|
29176
|
-
/* @__PURE__ */
|
|
29413
|
+
/* @__PURE__ */ jsx86(
|
|
29177
29414
|
DropdownMenuItem,
|
|
29178
29415
|
{
|
|
29179
29416
|
icon: Type2,
|
|
@@ -29182,7 +29419,7 @@ var EditorToolbar = ({
|
|
|
29182
29419
|
active: !currentLineHeight
|
|
29183
29420
|
}
|
|
29184
29421
|
),
|
|
29185
|
-
availableLineHeights.map((option) => /* @__PURE__ */
|
|
29422
|
+
availableLineHeights.map((option) => /* @__PURE__ */ jsx86(
|
|
29186
29423
|
DropdownMenuItem,
|
|
29187
29424
|
{
|
|
29188
29425
|
label: option.label,
|
|
@@ -29194,17 +29431,17 @@ var EditorToolbar = ({
|
|
|
29194
29431
|
]
|
|
29195
29432
|
}
|
|
29196
29433
|
),
|
|
29197
|
-
/* @__PURE__ */
|
|
29434
|
+
/* @__PURE__ */ jsxs72(
|
|
29198
29435
|
DropdownMenu,
|
|
29199
29436
|
{
|
|
29200
|
-
trigger: /* @__PURE__ */
|
|
29437
|
+
trigger: /* @__PURE__ */ jsxs72(ToolbarButton, { onClick: () => {
|
|
29201
29438
|
}, title: t("toolbar.letterSpacing"), className: "gap-0.5", children: [
|
|
29202
|
-
/* @__PURE__ */
|
|
29203
|
-
/* @__PURE__ */
|
|
29439
|
+
/* @__PURE__ */ jsx86(ArrowLeft, { className: "w-3 h-3" }),
|
|
29440
|
+
/* @__PURE__ */ jsx86(ArrowRight, { className: "w-3 h-3" })
|
|
29204
29441
|
] }),
|
|
29205
29442
|
contentClassName: "max-h-72 overflow-y-auto p-1",
|
|
29206
29443
|
children: [
|
|
29207
|
-
/* @__PURE__ */
|
|
29444
|
+
/* @__PURE__ */ jsx86(
|
|
29208
29445
|
DropdownMenuItem,
|
|
29209
29446
|
{
|
|
29210
29447
|
icon: Type2,
|
|
@@ -29213,7 +29450,7 @@ var EditorToolbar = ({
|
|
|
29213
29450
|
active: !currentLetterSpacing
|
|
29214
29451
|
}
|
|
29215
29452
|
),
|
|
29216
|
-
availableLetterSpacings.map((option) => /* @__PURE__ */
|
|
29453
|
+
availableLetterSpacings.map((option) => /* @__PURE__ */ jsx86(
|
|
29217
29454
|
DropdownMenuItem,
|
|
29218
29455
|
{
|
|
29219
29456
|
label: option.label,
|
|
@@ -29225,44 +29462,44 @@ var EditorToolbar = ({
|
|
|
29225
29462
|
]
|
|
29226
29463
|
}
|
|
29227
29464
|
),
|
|
29228
|
-
/* @__PURE__ */
|
|
29229
|
-
/* @__PURE__ */
|
|
29230
|
-
/* @__PURE__ */
|
|
29231
|
-
/* @__PURE__ */
|
|
29465
|
+
/* @__PURE__ */ jsx86(ToolbarDivider, {}),
|
|
29466
|
+
/* @__PURE__ */ jsx86(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ jsx86(BoldIcon, { className: "w-4 h-4" }) }),
|
|
29467
|
+
/* @__PURE__ */ jsx86(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ jsx86(ItalicIcon, { className: "w-4 h-4" }) }),
|
|
29468
|
+
/* @__PURE__ */ jsx86(
|
|
29232
29469
|
ToolbarButton,
|
|
29233
29470
|
{
|
|
29234
29471
|
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
29235
29472
|
active: editor.isActive("underline"),
|
|
29236
29473
|
title: t("toolbar.underline"),
|
|
29237
|
-
children: /* @__PURE__ */
|
|
29474
|
+
children: /* @__PURE__ */ jsx86(UnderlineIcon, { className: "w-4 h-4" })
|
|
29238
29475
|
}
|
|
29239
29476
|
),
|
|
29240
|
-
/* @__PURE__ */
|
|
29241
|
-
/* @__PURE__ */
|
|
29242
|
-
/* @__PURE__ */
|
|
29477
|
+
/* @__PURE__ */ jsx86(ToolbarButton, { onClick: () => editor.chain().focus().toggleStrike().run(), active: editor.isActive("strike"), title: t("toolbar.strike"), children: /* @__PURE__ */ jsx86(StrikethroughIcon, { className: "w-4 h-4" }) }),
|
|
29478
|
+
/* @__PURE__ */ jsx86(ToolbarButton, { onClick: () => editor.chain().focus().toggleCode().run(), active: editor.isActive("code"), title: t("toolbar.code"), children: /* @__PURE__ */ jsx86(CodeIcon, { className: "w-4 h-4" }) }),
|
|
29479
|
+
/* @__PURE__ */ jsx86(
|
|
29243
29480
|
ToolbarButton,
|
|
29244
29481
|
{
|
|
29245
29482
|
onClick: () => editor.chain().focus().toggleSubscript().run(),
|
|
29246
29483
|
active: editor.isActive("subscript"),
|
|
29247
29484
|
title: t("toolbar.subscript"),
|
|
29248
|
-
children: /* @__PURE__ */
|
|
29485
|
+
children: /* @__PURE__ */ jsx86(SubscriptIcon, { className: "w-4 h-4" })
|
|
29249
29486
|
}
|
|
29250
29487
|
),
|
|
29251
|
-
/* @__PURE__ */
|
|
29488
|
+
/* @__PURE__ */ jsx86(
|
|
29252
29489
|
ToolbarButton,
|
|
29253
29490
|
{
|
|
29254
29491
|
onClick: () => editor.chain().focus().toggleSuperscript().run(),
|
|
29255
29492
|
active: editor.isActive("superscript"),
|
|
29256
29493
|
title: t("toolbar.superscript"),
|
|
29257
|
-
children: /* @__PURE__ */
|
|
29494
|
+
children: /* @__PURE__ */ jsx86(SuperscriptIcon, { className: "w-4 h-4" })
|
|
29258
29495
|
}
|
|
29259
29496
|
),
|
|
29260
|
-
/* @__PURE__ */
|
|
29497
|
+
/* @__PURE__ */ jsx86(
|
|
29261
29498
|
DropdownMenu,
|
|
29262
29499
|
{
|
|
29263
29500
|
contentClassName: "min-w-72",
|
|
29264
|
-
trigger: /* @__PURE__ */
|
|
29265
|
-
children: showLinkInput ? /* @__PURE__ */
|
|
29501
|
+
trigger: /* @__PURE__ */ jsx86(ToolbarButton, { onClick: () => setShowLinkInput(!editor.isActive("link")), active: editor.isActive("link"), title: t("toolbar.link"), children: /* @__PURE__ */ jsx86(LinkIcon, { className: "w-4 h-4" }) }),
|
|
29502
|
+
children: showLinkInput ? /* @__PURE__ */ jsx86(
|
|
29266
29503
|
LinkInput,
|
|
29267
29504
|
{
|
|
29268
29505
|
initialUrl: String(editor.getAttributes("link").href ?? ""),
|
|
@@ -29272,8 +29509,8 @@ var EditorToolbar = ({
|
|
|
29272
29509
|
},
|
|
29273
29510
|
onCancel: () => setShowLinkInput(false)
|
|
29274
29511
|
}
|
|
29275
|
-
) : /* @__PURE__ */
|
|
29276
|
-
/* @__PURE__ */
|
|
29512
|
+
) : /* @__PURE__ */ jsxs72(Fragment28, { children: [
|
|
29513
|
+
/* @__PURE__ */ jsx86(
|
|
29277
29514
|
DropdownMenuItem,
|
|
29278
29515
|
{
|
|
29279
29516
|
icon: LinkIcon,
|
|
@@ -29283,7 +29520,7 @@ var EditorToolbar = ({
|
|
|
29283
29520
|
closeOnSelect: false
|
|
29284
29521
|
}
|
|
29285
29522
|
),
|
|
29286
|
-
/* @__PURE__ */
|
|
29523
|
+
/* @__PURE__ */ jsx86(
|
|
29287
29524
|
DropdownMenuItem,
|
|
29288
29525
|
{
|
|
29289
29526
|
icon: Trash22,
|
|
@@ -29296,16 +29533,16 @@ var EditorToolbar = ({
|
|
|
29296
29533
|
] })
|
|
29297
29534
|
}
|
|
29298
29535
|
),
|
|
29299
|
-
/* @__PURE__ */
|
|
29300
|
-
/* @__PURE__ */
|
|
29536
|
+
/* @__PURE__ */ jsx86(ToolbarDivider, {}),
|
|
29537
|
+
/* @__PURE__ */ jsx86(
|
|
29301
29538
|
DropdownMenu,
|
|
29302
29539
|
{
|
|
29303
|
-
trigger: /* @__PURE__ */
|
|
29540
|
+
trigger: /* @__PURE__ */ jsxs72(ToolbarButton, { onClick: () => {
|
|
29304
29541
|
}, title: t("colors.textColor"), children: [
|
|
29305
|
-
/* @__PURE__ */
|
|
29306
|
-
/* @__PURE__ */
|
|
29542
|
+
/* @__PURE__ */ jsx86(TextColorIcon, { color: currentTextColor }),
|
|
29543
|
+
/* @__PURE__ */ jsx86(ChevronDown8, { className: "w-3 h-3" })
|
|
29307
29544
|
] }),
|
|
29308
|
-
children: /* @__PURE__ */
|
|
29545
|
+
children: /* @__PURE__ */ jsx86(
|
|
29309
29546
|
EditorColorPalette,
|
|
29310
29547
|
{
|
|
29311
29548
|
colors: textColors,
|
|
@@ -29322,15 +29559,15 @@ var EditorToolbar = ({
|
|
|
29322
29559
|
)
|
|
29323
29560
|
}
|
|
29324
29561
|
),
|
|
29325
|
-
/* @__PURE__ */
|
|
29562
|
+
/* @__PURE__ */ jsx86(
|
|
29326
29563
|
DropdownMenu,
|
|
29327
29564
|
{
|
|
29328
|
-
trigger: /* @__PURE__ */
|
|
29565
|
+
trigger: /* @__PURE__ */ jsxs72(ToolbarButton, { onClick: () => {
|
|
29329
29566
|
}, active: editor.isActive("highlight"), title: t("colors.highlight"), children: [
|
|
29330
|
-
/* @__PURE__ */
|
|
29331
|
-
/* @__PURE__ */
|
|
29567
|
+
/* @__PURE__ */ jsx86(HighlightColorIcon, { color: currentHighlightColor }),
|
|
29568
|
+
/* @__PURE__ */ jsx86(ChevronDown8, { className: "w-3 h-3" })
|
|
29332
29569
|
] }),
|
|
29333
|
-
children: /* @__PURE__ */
|
|
29570
|
+
children: /* @__PURE__ */ jsx86(
|
|
29334
29571
|
EditorColorPalette,
|
|
29335
29572
|
{
|
|
29336
29573
|
colors: highlightColors,
|
|
@@ -29347,14 +29584,14 @@ var EditorToolbar = ({
|
|
|
29347
29584
|
)
|
|
29348
29585
|
}
|
|
29349
29586
|
),
|
|
29350
|
-
/* @__PURE__ */
|
|
29351
|
-
/* @__PURE__ */
|
|
29587
|
+
/* @__PURE__ */ jsx86(ToolbarDivider, {}),
|
|
29588
|
+
/* @__PURE__ */ jsx86(
|
|
29352
29589
|
DropdownMenu,
|
|
29353
29590
|
{
|
|
29354
29591
|
contentClassName: "p-0 overflow-hidden",
|
|
29355
|
-
trigger: /* @__PURE__ */
|
|
29356
|
-
}, title: t("toolbar.emoji"), children: /* @__PURE__ */
|
|
29357
|
-
children: /* @__PURE__ */
|
|
29592
|
+
trigger: /* @__PURE__ */ jsx86(ToolbarButton, { onClick: () => {
|
|
29593
|
+
}, title: t("toolbar.emoji"), children: /* @__PURE__ */ jsx86(Smile3, { className: "w-4 h-4" }) }),
|
|
29594
|
+
children: /* @__PURE__ */ jsx86(
|
|
29358
29595
|
EmojiPicker2,
|
|
29359
29596
|
{
|
|
29360
29597
|
onSelect: (emoji) => {
|
|
@@ -29364,17 +29601,17 @@ var EditorToolbar = ({
|
|
|
29364
29601
|
)
|
|
29365
29602
|
}
|
|
29366
29603
|
),
|
|
29367
|
-
/* @__PURE__ */
|
|
29368
|
-
/* @__PURE__ */
|
|
29604
|
+
/* @__PURE__ */ jsx86(ToolbarDivider, {}),
|
|
29605
|
+
/* @__PURE__ */ jsxs72(
|
|
29369
29606
|
DropdownMenu,
|
|
29370
29607
|
{
|
|
29371
|
-
trigger: /* @__PURE__ */
|
|
29608
|
+
trigger: /* @__PURE__ */ jsxs72(ToolbarButton, { onClick: () => {
|
|
29372
29609
|
}, title: t("toolbar.alignment"), children: [
|
|
29373
|
-
/* @__PURE__ */
|
|
29374
|
-
/* @__PURE__ */
|
|
29610
|
+
/* @__PURE__ */ jsx86(AlignLeft, { className: "w-4 h-4" }),
|
|
29611
|
+
/* @__PURE__ */ jsx86(ChevronDown8, { className: "w-3 h-3" })
|
|
29375
29612
|
] }),
|
|
29376
29613
|
children: [
|
|
29377
|
-
/* @__PURE__ */
|
|
29614
|
+
/* @__PURE__ */ jsx86(
|
|
29378
29615
|
DropdownMenuItem,
|
|
29379
29616
|
{
|
|
29380
29617
|
icon: AlignLeft,
|
|
@@ -29383,7 +29620,7 @@ var EditorToolbar = ({
|
|
|
29383
29620
|
active: editor.isActive({ textAlign: "left" })
|
|
29384
29621
|
}
|
|
29385
29622
|
),
|
|
29386
|
-
/* @__PURE__ */
|
|
29623
|
+
/* @__PURE__ */ jsx86(
|
|
29387
29624
|
DropdownMenuItem,
|
|
29388
29625
|
{
|
|
29389
29626
|
icon: AlignCenter,
|
|
@@ -29392,7 +29629,7 @@ var EditorToolbar = ({
|
|
|
29392
29629
|
active: editor.isActive({ textAlign: "center" })
|
|
29393
29630
|
}
|
|
29394
29631
|
),
|
|
29395
|
-
/* @__PURE__ */
|
|
29632
|
+
/* @__PURE__ */ jsx86(
|
|
29396
29633
|
DropdownMenuItem,
|
|
29397
29634
|
{
|
|
29398
29635
|
icon: AlignRight,
|
|
@@ -29401,7 +29638,7 @@ var EditorToolbar = ({
|
|
|
29401
29638
|
active: editor.isActive({ textAlign: "right" })
|
|
29402
29639
|
}
|
|
29403
29640
|
),
|
|
29404
|
-
/* @__PURE__ */
|
|
29641
|
+
/* @__PURE__ */ jsx86(
|
|
29405
29642
|
DropdownMenuItem,
|
|
29406
29643
|
{
|
|
29407
29644
|
icon: AlignJustify,
|
|
@@ -29413,17 +29650,17 @@ var EditorToolbar = ({
|
|
|
29413
29650
|
]
|
|
29414
29651
|
}
|
|
29415
29652
|
),
|
|
29416
|
-
/* @__PURE__ */
|
|
29417
|
-
/* @__PURE__ */
|
|
29653
|
+
/* @__PURE__ */ jsx86(ToolbarDivider, {}),
|
|
29654
|
+
/* @__PURE__ */ jsxs72(
|
|
29418
29655
|
DropdownMenu,
|
|
29419
29656
|
{
|
|
29420
|
-
trigger: /* @__PURE__ */
|
|
29657
|
+
trigger: /* @__PURE__ */ jsxs72(ToolbarButton, { onClick: () => {
|
|
29421
29658
|
}, title: t("toolbar.bulletList"), children: [
|
|
29422
|
-
/* @__PURE__ */
|
|
29423
|
-
/* @__PURE__ */
|
|
29659
|
+
/* @__PURE__ */ jsx86(ListIcon, { className: "w-4 h-4" }),
|
|
29660
|
+
/* @__PURE__ */ jsx86(ChevronDown8, { className: "w-3 h-3" })
|
|
29424
29661
|
] }),
|
|
29425
29662
|
children: [
|
|
29426
|
-
/* @__PURE__ */
|
|
29663
|
+
/* @__PURE__ */ jsx86(
|
|
29427
29664
|
DropdownMenuItem,
|
|
29428
29665
|
{
|
|
29429
29666
|
icon: ListIcon,
|
|
@@ -29433,7 +29670,7 @@ var EditorToolbar = ({
|
|
|
29433
29670
|
shortcut: "Ctrl+Shift+8"
|
|
29434
29671
|
}
|
|
29435
29672
|
),
|
|
29436
|
-
/* @__PURE__ */
|
|
29673
|
+
/* @__PURE__ */ jsx86(
|
|
29437
29674
|
DropdownMenuItem,
|
|
29438
29675
|
{
|
|
29439
29676
|
icon: ListOrderedIcon,
|
|
@@ -29443,7 +29680,7 @@ var EditorToolbar = ({
|
|
|
29443
29680
|
shortcut: "Ctrl+Shift+7"
|
|
29444
29681
|
}
|
|
29445
29682
|
),
|
|
29446
|
-
/* @__PURE__ */
|
|
29683
|
+
/* @__PURE__ */ jsx86(
|
|
29447
29684
|
DropdownMenuItem,
|
|
29448
29685
|
{
|
|
29449
29686
|
icon: ListTodo2,
|
|
@@ -29456,16 +29693,16 @@ var EditorToolbar = ({
|
|
|
29456
29693
|
]
|
|
29457
29694
|
}
|
|
29458
29695
|
),
|
|
29459
|
-
/* @__PURE__ */
|
|
29696
|
+
/* @__PURE__ */ jsxs72(
|
|
29460
29697
|
DropdownMenu,
|
|
29461
29698
|
{
|
|
29462
|
-
trigger: /* @__PURE__ */
|
|
29699
|
+
trigger: /* @__PURE__ */ jsxs72(ToolbarButton, { onClick: () => {
|
|
29463
29700
|
}, title: t("toolbar.quote"), children: [
|
|
29464
|
-
/* @__PURE__ */
|
|
29465
|
-
/* @__PURE__ */
|
|
29701
|
+
/* @__PURE__ */ jsx86(QuoteIcon, { className: "w-4 h-4" }),
|
|
29702
|
+
/* @__PURE__ */ jsx86(ChevronDown8, { className: "w-3 h-3" })
|
|
29466
29703
|
] }),
|
|
29467
29704
|
children: [
|
|
29468
|
-
/* @__PURE__ */
|
|
29705
|
+
/* @__PURE__ */ jsx86(
|
|
29469
29706
|
DropdownMenuItem,
|
|
29470
29707
|
{
|
|
29471
29708
|
icon: QuoteIcon,
|
|
@@ -29475,7 +29712,7 @@ var EditorToolbar = ({
|
|
|
29475
29712
|
shortcut: "Ctrl+Shift+B"
|
|
29476
29713
|
}
|
|
29477
29714
|
),
|
|
29478
|
-
/* @__PURE__ */
|
|
29715
|
+
/* @__PURE__ */ jsx86(
|
|
29479
29716
|
DropdownMenuItem,
|
|
29480
29717
|
{
|
|
29481
29718
|
icon: FileCode3,
|
|
@@ -29488,15 +29725,15 @@ var EditorToolbar = ({
|
|
|
29488
29725
|
]
|
|
29489
29726
|
}
|
|
29490
29727
|
),
|
|
29491
|
-
/* @__PURE__ */
|
|
29728
|
+
/* @__PURE__ */ jsx86(
|
|
29492
29729
|
DropdownMenu,
|
|
29493
29730
|
{
|
|
29494
|
-
trigger: /* @__PURE__ */
|
|
29731
|
+
trigger: /* @__PURE__ */ jsxs72(ToolbarButton, { onClick: () => {
|
|
29495
29732
|
}, title: t("toolbar.image"), children: [
|
|
29496
|
-
/* @__PURE__ */
|
|
29497
|
-
/* @__PURE__ */
|
|
29733
|
+
/* @__PURE__ */ jsx86(ImageIcon2, { className: "w-4 h-4" }),
|
|
29734
|
+
/* @__PURE__ */ jsx86(ChevronDown8, { className: "w-3 h-3" })
|
|
29498
29735
|
] }),
|
|
29499
|
-
children: showImageInput ? /* @__PURE__ */
|
|
29736
|
+
children: showImageInput ? /* @__PURE__ */ jsx86(
|
|
29500
29737
|
ImageInput,
|
|
29501
29738
|
{
|
|
29502
29739
|
onSubmit: (url, alt) => {
|
|
@@ -29505,9 +29742,9 @@ var EditorToolbar = ({
|
|
|
29505
29742
|
},
|
|
29506
29743
|
onCancel: () => setShowImageInput(false)
|
|
29507
29744
|
}
|
|
29508
|
-
) : /* @__PURE__ */
|
|
29509
|
-
/* @__PURE__ */
|
|
29510
|
-
/* @__PURE__ */
|
|
29745
|
+
) : /* @__PURE__ */ jsxs72(Fragment28, { children: [
|
|
29746
|
+
/* @__PURE__ */ jsx86(DropdownMenuItem, { icon: LinkIcon, label: t("imageInput.addFromUrl"), onClick: () => setShowImageInput(true), closeOnSelect: false }),
|
|
29747
|
+
/* @__PURE__ */ jsx86(
|
|
29511
29748
|
DropdownMenuItem,
|
|
29512
29749
|
{
|
|
29513
29750
|
icon: Upload3,
|
|
@@ -29517,8 +29754,8 @@ var EditorToolbar = ({
|
|
|
29517
29754
|
closeOnSelect: false
|
|
29518
29755
|
}
|
|
29519
29756
|
),
|
|
29520
|
-
imageUploadError && /* @__PURE__ */
|
|
29521
|
-
/* @__PURE__ */
|
|
29757
|
+
imageUploadError && /* @__PURE__ */ jsx86(DropdownMenuItem, { label: imageUploadError, disabled: true, destructive: true }),
|
|
29758
|
+
/* @__PURE__ */ jsx86(
|
|
29522
29759
|
"input",
|
|
29523
29760
|
{
|
|
29524
29761
|
ref: fileInputRef,
|
|
@@ -29533,8 +29770,8 @@ var EditorToolbar = ({
|
|
|
29533
29770
|
}
|
|
29534
29771
|
}
|
|
29535
29772
|
),
|
|
29536
|
-
/* @__PURE__ */
|
|
29537
|
-
/* @__PURE__ */
|
|
29773
|
+
/* @__PURE__ */ jsx86("div", { className: "my-1 border-t" }),
|
|
29774
|
+
/* @__PURE__ */ jsx86(
|
|
29538
29775
|
DropdownMenuItem,
|
|
29539
29776
|
{
|
|
29540
29777
|
icon: AlignCenter,
|
|
@@ -29544,7 +29781,7 @@ var EditorToolbar = ({
|
|
|
29544
29781
|
disabled: !isImageSelected
|
|
29545
29782
|
}
|
|
29546
29783
|
),
|
|
29547
|
-
/* @__PURE__ */
|
|
29784
|
+
/* @__PURE__ */ jsx86(
|
|
29548
29785
|
DropdownMenuItem,
|
|
29549
29786
|
{
|
|
29550
29787
|
icon: AlignLeft,
|
|
@@ -29554,7 +29791,7 @@ var EditorToolbar = ({
|
|
|
29554
29791
|
disabled: !isImageSelected
|
|
29555
29792
|
}
|
|
29556
29793
|
),
|
|
29557
|
-
/* @__PURE__ */
|
|
29794
|
+
/* @__PURE__ */ jsx86(
|
|
29558
29795
|
DropdownMenuItem,
|
|
29559
29796
|
{
|
|
29560
29797
|
icon: AlignRight,
|
|
@@ -29564,8 +29801,8 @@ var EditorToolbar = ({
|
|
|
29564
29801
|
disabled: !isImageSelected
|
|
29565
29802
|
}
|
|
29566
29803
|
),
|
|
29567
|
-
/* @__PURE__ */
|
|
29568
|
-
/* @__PURE__ */
|
|
29804
|
+
/* @__PURE__ */ jsx86("div", { className: "my-1 border-t" }),
|
|
29805
|
+
/* @__PURE__ */ jsx86(
|
|
29569
29806
|
DropdownMenuItem,
|
|
29570
29807
|
{
|
|
29571
29808
|
label: t("toolbar.imageWidthSm"),
|
|
@@ -29574,7 +29811,7 @@ var EditorToolbar = ({
|
|
|
29574
29811
|
disabled: !isImageSelected
|
|
29575
29812
|
}
|
|
29576
29813
|
),
|
|
29577
|
-
/* @__PURE__ */
|
|
29814
|
+
/* @__PURE__ */ jsx86(
|
|
29578
29815
|
DropdownMenuItem,
|
|
29579
29816
|
{
|
|
29580
29817
|
label: t("toolbar.imageWidthMd"),
|
|
@@ -29583,7 +29820,7 @@ var EditorToolbar = ({
|
|
|
29583
29820
|
disabled: !isImageSelected
|
|
29584
29821
|
}
|
|
29585
29822
|
),
|
|
29586
|
-
/* @__PURE__ */
|
|
29823
|
+
/* @__PURE__ */ jsx86(
|
|
29587
29824
|
DropdownMenuItem,
|
|
29588
29825
|
{
|
|
29589
29826
|
label: t("toolbar.imageWidthLg"),
|
|
@@ -29592,8 +29829,8 @@ var EditorToolbar = ({
|
|
|
29592
29829
|
disabled: !isImageSelected
|
|
29593
29830
|
}
|
|
29594
29831
|
),
|
|
29595
|
-
/* @__PURE__ */
|
|
29596
|
-
/* @__PURE__ */
|
|
29832
|
+
/* @__PURE__ */ jsx86("div", { className: "my-1 border-t" }),
|
|
29833
|
+
/* @__PURE__ */ jsx86(
|
|
29597
29834
|
DropdownMenuItem,
|
|
29598
29835
|
{
|
|
29599
29836
|
icon: RotateCcw2,
|
|
@@ -29602,7 +29839,7 @@ var EditorToolbar = ({
|
|
|
29602
29839
|
disabled: !isImageSelected
|
|
29603
29840
|
}
|
|
29604
29841
|
),
|
|
29605
|
-
/* @__PURE__ */
|
|
29842
|
+
/* @__PURE__ */ jsx86(
|
|
29606
29843
|
DropdownMenuItem,
|
|
29607
29844
|
{
|
|
29608
29845
|
icon: Trash22,
|
|
@@ -29615,7 +29852,7 @@ var EditorToolbar = ({
|
|
|
29615
29852
|
] })
|
|
29616
29853
|
}
|
|
29617
29854
|
),
|
|
29618
|
-
/* @__PURE__ */
|
|
29855
|
+
/* @__PURE__ */ jsxs72(
|
|
29619
29856
|
DropdownMenu,
|
|
29620
29857
|
{
|
|
29621
29858
|
isOpen: isTableMenuOpen,
|
|
@@ -29623,14 +29860,14 @@ var EditorToolbar = ({
|
|
|
29623
29860
|
setIsTableMenuOpen(open);
|
|
29624
29861
|
tableCommandAnchorPosRef.current = open ? getTableAnchorPos(editor) : null;
|
|
29625
29862
|
},
|
|
29626
|
-
trigger: /* @__PURE__ */
|
|
29863
|
+
trigger: /* @__PURE__ */ jsxs72(ToolbarButton, { onClick: () => {
|
|
29627
29864
|
}, title: t("toolbar.table"), children: [
|
|
29628
|
-
/* @__PURE__ */
|
|
29629
|
-
/* @__PURE__ */
|
|
29865
|
+
/* @__PURE__ */ jsx86(TableIcon, { className: "w-4 h-4" }),
|
|
29866
|
+
/* @__PURE__ */ jsx86(ChevronDown8, { className: "w-3 h-3" })
|
|
29630
29867
|
] }),
|
|
29631
29868
|
contentClassName: "p-2 min-w-56",
|
|
29632
29869
|
children: [
|
|
29633
|
-
/* @__PURE__ */
|
|
29870
|
+
/* @__PURE__ */ jsx86(
|
|
29634
29871
|
TableInsertGrid,
|
|
29635
29872
|
{
|
|
29636
29873
|
insertLabel: t("tableMenu.insertTable"),
|
|
@@ -29641,8 +29878,8 @@ var EditorToolbar = ({
|
|
|
29641
29878
|
}
|
|
29642
29879
|
}
|
|
29643
29880
|
),
|
|
29644
|
-
/* @__PURE__ */
|
|
29645
|
-
/* @__PURE__ */
|
|
29881
|
+
/* @__PURE__ */ jsx86("div", { className: "my-1 border-t" }),
|
|
29882
|
+
/* @__PURE__ */ jsx86(
|
|
29646
29883
|
DropdownMenuItem,
|
|
29647
29884
|
{
|
|
29648
29885
|
icon: AlignLeft,
|
|
@@ -29652,7 +29889,7 @@ var EditorToolbar = ({
|
|
|
29652
29889
|
disabled: !hasTableContext
|
|
29653
29890
|
}
|
|
29654
29891
|
),
|
|
29655
|
-
/* @__PURE__ */
|
|
29892
|
+
/* @__PURE__ */ jsx86(
|
|
29656
29893
|
DropdownMenuItem,
|
|
29657
29894
|
{
|
|
29658
29895
|
icon: AlignCenter,
|
|
@@ -29662,7 +29899,7 @@ var EditorToolbar = ({
|
|
|
29662
29899
|
disabled: !hasTableContext
|
|
29663
29900
|
}
|
|
29664
29901
|
),
|
|
29665
|
-
/* @__PURE__ */
|
|
29902
|
+
/* @__PURE__ */ jsx86(
|
|
29666
29903
|
DropdownMenuItem,
|
|
29667
29904
|
{
|
|
29668
29905
|
icon: AlignRight,
|
|
@@ -29672,8 +29909,8 @@ var EditorToolbar = ({
|
|
|
29672
29909
|
disabled: !hasTableContext
|
|
29673
29910
|
}
|
|
29674
29911
|
),
|
|
29675
|
-
/* @__PURE__ */
|
|
29676
|
-
/* @__PURE__ */
|
|
29912
|
+
/* @__PURE__ */ jsx86("div", { className: "my-1 border-t" }),
|
|
29913
|
+
/* @__PURE__ */ jsx86(
|
|
29677
29914
|
DropdownMenuItem,
|
|
29678
29915
|
{
|
|
29679
29916
|
icon: ArrowLeft,
|
|
@@ -29682,7 +29919,7 @@ var EditorToolbar = ({
|
|
|
29682
29919
|
disabled: !hasTableContext || !editor.can().addColumnBefore()
|
|
29683
29920
|
}
|
|
29684
29921
|
),
|
|
29685
|
-
/* @__PURE__ */
|
|
29922
|
+
/* @__PURE__ */ jsx86(
|
|
29686
29923
|
DropdownMenuItem,
|
|
29687
29924
|
{
|
|
29688
29925
|
icon: ArrowDown,
|
|
@@ -29691,7 +29928,7 @@ var EditorToolbar = ({
|
|
|
29691
29928
|
disabled: !hasTableContext || !editor.can().addColumnAfter()
|
|
29692
29929
|
}
|
|
29693
29930
|
),
|
|
29694
|
-
/* @__PURE__ */
|
|
29931
|
+
/* @__PURE__ */ jsx86(
|
|
29695
29932
|
DropdownMenuItem,
|
|
29696
29933
|
{
|
|
29697
29934
|
icon: ArrowUp,
|
|
@@ -29700,7 +29937,7 @@ var EditorToolbar = ({
|
|
|
29700
29937
|
disabled: !hasTableContext || !editor.can().addRowBefore()
|
|
29701
29938
|
}
|
|
29702
29939
|
),
|
|
29703
|
-
/* @__PURE__ */
|
|
29940
|
+
/* @__PURE__ */ jsx86(
|
|
29704
29941
|
DropdownMenuItem,
|
|
29705
29942
|
{
|
|
29706
29943
|
icon: ArrowRight,
|
|
@@ -29709,8 +29946,8 @@ var EditorToolbar = ({
|
|
|
29709
29946
|
disabled: !hasTableContext || !editor.can().addRowAfter()
|
|
29710
29947
|
}
|
|
29711
29948
|
),
|
|
29712
|
-
/* @__PURE__ */
|
|
29713
|
-
/* @__PURE__ */
|
|
29949
|
+
/* @__PURE__ */ jsx86("div", { className: "my-1 border-t" }),
|
|
29950
|
+
/* @__PURE__ */ jsx86(
|
|
29714
29951
|
DropdownMenuItem,
|
|
29715
29952
|
{
|
|
29716
29953
|
icon: TableIcon,
|
|
@@ -29719,7 +29956,7 @@ var EditorToolbar = ({
|
|
|
29719
29956
|
disabled: !hasTableContext || !editor.can().toggleHeaderRow()
|
|
29720
29957
|
}
|
|
29721
29958
|
),
|
|
29722
|
-
/* @__PURE__ */
|
|
29959
|
+
/* @__PURE__ */ jsx86(
|
|
29723
29960
|
DropdownMenuItem,
|
|
29724
29961
|
{
|
|
29725
29962
|
icon: TableIcon,
|
|
@@ -29728,8 +29965,8 @@ var EditorToolbar = ({
|
|
|
29728
29965
|
disabled: !hasTableContext || !editor.can().toggleHeaderColumn()
|
|
29729
29966
|
}
|
|
29730
29967
|
),
|
|
29731
|
-
/* @__PURE__ */
|
|
29732
|
-
/* @__PURE__ */
|
|
29968
|
+
/* @__PURE__ */ jsx86("div", { className: "my-1 border-t" }),
|
|
29969
|
+
/* @__PURE__ */ jsx86(
|
|
29733
29970
|
DropdownMenuItem,
|
|
29734
29971
|
{
|
|
29735
29972
|
icon: Trash22,
|
|
@@ -29738,7 +29975,7 @@ var EditorToolbar = ({
|
|
|
29738
29975
|
disabled: !hasTableContext || !editor.can().deleteColumn()
|
|
29739
29976
|
}
|
|
29740
29977
|
),
|
|
29741
|
-
/* @__PURE__ */
|
|
29978
|
+
/* @__PURE__ */ jsx86(
|
|
29742
29979
|
DropdownMenuItem,
|
|
29743
29980
|
{
|
|
29744
29981
|
icon: Trash22,
|
|
@@ -29747,7 +29984,7 @@ var EditorToolbar = ({
|
|
|
29747
29984
|
disabled: !hasTableContext || !editor.can().deleteRow()
|
|
29748
29985
|
}
|
|
29749
29986
|
),
|
|
29750
|
-
/* @__PURE__ */
|
|
29987
|
+
/* @__PURE__ */ jsx86(
|
|
29751
29988
|
DropdownMenuItem,
|
|
29752
29989
|
{
|
|
29753
29990
|
icon: Trash22,
|
|
@@ -29759,48 +29996,48 @@ var EditorToolbar = ({
|
|
|
29759
29996
|
]
|
|
29760
29997
|
}
|
|
29761
29998
|
),
|
|
29762
|
-
/* @__PURE__ */
|
|
29763
|
-
/* @__PURE__ */
|
|
29764
|
-
/* @__PURE__ */
|
|
29765
|
-
hasTableContext && /* @__PURE__ */
|
|
29766
|
-
/* @__PURE__ */
|
|
29767
|
-
/* @__PURE__ */
|
|
29999
|
+
/* @__PURE__ */ jsx86(ToolbarDivider, {}),
|
|
30000
|
+
/* @__PURE__ */ jsx86(ToolbarButton, { onClick: () => editor.chain().focus().undo().run(), disabled: !editor.can().undo(), title: t("toolbar.undo"), children: /* @__PURE__ */ jsx86(UndoIcon, { className: "w-4 h-4" }) }),
|
|
30001
|
+
/* @__PURE__ */ jsx86(ToolbarButton, { onClick: () => editor.chain().focus().redo().run(), disabled: !editor.can().redo(), title: t("toolbar.redo"), children: /* @__PURE__ */ jsx86(RedoIcon, { className: "w-4 h-4" }) }),
|
|
30002
|
+
hasTableContext && /* @__PURE__ */ jsxs72(Fragment28, { children: [
|
|
30003
|
+
/* @__PURE__ */ jsx86(ToolbarDivider, {}),
|
|
30004
|
+
/* @__PURE__ */ jsx86(
|
|
29768
30005
|
ToolbarButton,
|
|
29769
30006
|
{
|
|
29770
30007
|
onClick: () => editor.chain().focus().addColumnBefore().run(),
|
|
29771
30008
|
disabled: !editor.can().addColumnBefore(),
|
|
29772
30009
|
title: t("tableMenu.addColumnBefore"),
|
|
29773
|
-
children: /* @__PURE__ */
|
|
30010
|
+
children: /* @__PURE__ */ jsx86(ArrowLeft, { className: "w-4 h-4" })
|
|
29774
30011
|
}
|
|
29775
30012
|
),
|
|
29776
|
-
/* @__PURE__ */
|
|
30013
|
+
/* @__PURE__ */ jsx86(
|
|
29777
30014
|
ToolbarButton,
|
|
29778
30015
|
{
|
|
29779
30016
|
onClick: () => editor.chain().focus().addColumnAfter().run(),
|
|
29780
30017
|
disabled: !editor.can().addColumnAfter(),
|
|
29781
30018
|
title: t("tableMenu.addColumnAfter"),
|
|
29782
|
-
children: /* @__PURE__ */
|
|
30019
|
+
children: /* @__PURE__ */ jsx86(ArrowRight, { className: "w-4 h-4" })
|
|
29783
30020
|
}
|
|
29784
30021
|
),
|
|
29785
|
-
/* @__PURE__ */
|
|
30022
|
+
/* @__PURE__ */ jsx86(
|
|
29786
30023
|
ToolbarButton,
|
|
29787
30024
|
{
|
|
29788
30025
|
onClick: () => editor.chain().focus().addRowBefore().run(),
|
|
29789
30026
|
disabled: !editor.can().addRowBefore(),
|
|
29790
30027
|
title: t("tableMenu.addRowBefore"),
|
|
29791
|
-
children: /* @__PURE__ */
|
|
30028
|
+
children: /* @__PURE__ */ jsx86(ArrowUp, { className: "w-4 h-4" })
|
|
29792
30029
|
}
|
|
29793
30030
|
),
|
|
29794
|
-
/* @__PURE__ */
|
|
30031
|
+
/* @__PURE__ */ jsx86(
|
|
29795
30032
|
ToolbarButton,
|
|
29796
30033
|
{
|
|
29797
30034
|
onClick: () => editor.chain().focus().addRowAfter().run(),
|
|
29798
30035
|
disabled: !editor.can().addRowAfter(),
|
|
29799
30036
|
title: t("tableMenu.addRowAfter"),
|
|
29800
|
-
children: /* @__PURE__ */
|
|
30037
|
+
children: /* @__PURE__ */ jsx86(ArrowDown, { className: "w-4 h-4" })
|
|
29801
30038
|
}
|
|
29802
30039
|
),
|
|
29803
|
-
/* @__PURE__ */
|
|
30040
|
+
/* @__PURE__ */ jsx86(
|
|
29804
30041
|
ToolbarButton,
|
|
29805
30042
|
{
|
|
29806
30043
|
onClick: () => {
|
|
@@ -29813,7 +30050,7 @@ var EditorToolbar = ({
|
|
|
29813
30050
|
active: canSplitCell,
|
|
29814
30051
|
disabled: !canMergeCells && !canSplitCell,
|
|
29815
30052
|
title: canSplitCell ? t("tableMenu.splitCell") : t("tableMenu.mergeCells"),
|
|
29816
|
-
children: /* @__PURE__ */
|
|
30053
|
+
children: /* @__PURE__ */ jsx86(TableCellsMerge, { className: "w-4 h-4" })
|
|
29817
30054
|
}
|
|
29818
30055
|
)
|
|
29819
30056
|
] })
|
|
@@ -29846,7 +30083,7 @@ import {
|
|
|
29846
30083
|
Edit2,
|
|
29847
30084
|
Unlink,
|
|
29848
30085
|
ExternalLink as ExternalLink3,
|
|
29849
|
-
Sigma
|
|
30086
|
+
Sigma as Sigma2
|
|
29850
30087
|
} from "lucide-react";
|
|
29851
30088
|
|
|
29852
30089
|
// src/components/UEditor/table-formula-commands.ts
|
|
@@ -29924,9 +30161,67 @@ function getTableCellRangeLabels(range) {
|
|
|
29924
30161
|
function normalizeTableFormula(formula) {
|
|
29925
30162
|
return formula.trim().replace(/^=/, "").trim();
|
|
29926
30163
|
}
|
|
30164
|
+
function isDraftTableFormula(formula) {
|
|
30165
|
+
const normalized = normalizeTableFormula(formula);
|
|
30166
|
+
if (!normalized) return true;
|
|
30167
|
+
let depth = 0;
|
|
30168
|
+
for (const char of normalized) {
|
|
30169
|
+
if (char === "(") depth += 1;
|
|
30170
|
+
if (char === ")") depth -= 1;
|
|
30171
|
+
if (depth < 0) return false;
|
|
30172
|
+
}
|
|
30173
|
+
if (depth > 0) return true;
|
|
30174
|
+
if (/^[A-Z]+\(\s*\)$/i.test(normalized)) return true;
|
|
30175
|
+
if (/[+\-*/,(]\s*$/.test(normalized)) return true;
|
|
30176
|
+
return false;
|
|
30177
|
+
}
|
|
29927
30178
|
function formatFormulaError(error) {
|
|
29928
30179
|
return `#${error.toUpperCase()}`;
|
|
29929
30180
|
}
|
|
30181
|
+
function normalizeTableNumberFormat(format) {
|
|
30182
|
+
return format === "text" || format === "number" || format === "currency" || format === "percent" || format === "date" ? format : "text";
|
|
30183
|
+
}
|
|
30184
|
+
function formatTableFormulaDisplayValue(value, numberFormat) {
|
|
30185
|
+
const stringValue = String(value);
|
|
30186
|
+
if (stringValue.startsWith("#")) {
|
|
30187
|
+
return stringValue;
|
|
30188
|
+
}
|
|
30189
|
+
const normalizedFormat = normalizeTableNumberFormat(numberFormat);
|
|
30190
|
+
if (normalizedFormat === "text") {
|
|
30191
|
+
return stringValue;
|
|
30192
|
+
}
|
|
30193
|
+
const numericValue = typeof value === "number" ? value : Number.parseFloat(stringValue.replace(/,/g, ""));
|
|
30194
|
+
if (!Number.isFinite(numericValue)) {
|
|
30195
|
+
return stringValue;
|
|
30196
|
+
}
|
|
30197
|
+
if (normalizedFormat === "number") {
|
|
30198
|
+
return new Intl.NumberFormat("en-US", { maximumFractionDigits: 6 }).format(numericValue);
|
|
30199
|
+
}
|
|
30200
|
+
if (normalizedFormat === "currency") {
|
|
30201
|
+
return new Intl.NumberFormat("en-US", {
|
|
30202
|
+
style: "currency",
|
|
30203
|
+
currency: "USD",
|
|
30204
|
+
maximumFractionDigits: 2
|
|
30205
|
+
}).format(numericValue);
|
|
30206
|
+
}
|
|
30207
|
+
if (normalizedFormat === "percent") {
|
|
30208
|
+
return new Intl.NumberFormat("en-US", {
|
|
30209
|
+
style: "percent",
|
|
30210
|
+
maximumFractionDigits: 2
|
|
30211
|
+
}).format(numericValue);
|
|
30212
|
+
}
|
|
30213
|
+
const excelEpochMs = Date.UTC(1899, 11, 30);
|
|
30214
|
+
const date = new Date(excelEpochMs + numericValue * 24 * 60 * 60 * 1e3);
|
|
30215
|
+
if (Number.isNaN(date.getTime())) {
|
|
30216
|
+
return stringValue;
|
|
30217
|
+
}
|
|
30218
|
+
return new Intl.DateTimeFormat("en-US", {
|
|
30219
|
+
year: "numeric",
|
|
30220
|
+
month: "2-digit",
|
|
30221
|
+
day: "2-digit",
|
|
30222
|
+
timeZone: "UTC"
|
|
30223
|
+
}).format(date);
|
|
30224
|
+
}
|
|
29930
30225
|
function getTableFormulaReferences(formula) {
|
|
29931
30226
|
const normalized = normalizeTableFormula(formula);
|
|
29932
30227
|
if (!normalized) return [];
|
|
@@ -30323,24 +30618,70 @@ function setSelectedTableCellFormula(editor, formula) {
|
|
|
30323
30618
|
function clearSelectedTableCellFormula(editor) {
|
|
30324
30619
|
return setSelectedTableCellFormula(editor, "");
|
|
30325
30620
|
}
|
|
30621
|
+
function setSelectedTableCellNumberFormat(editor, numberFormat) {
|
|
30622
|
+
const value = numberFormat && numberFormat !== "text" ? numberFormat : null;
|
|
30623
|
+
const { state, view } = editor;
|
|
30624
|
+
const applied = setCellAttr("numberFormat", value)(state, view.dispatch.bind(view));
|
|
30625
|
+
if (!applied) return false;
|
|
30626
|
+
recalculateSelectedTable(editor);
|
|
30627
|
+
view.focus();
|
|
30628
|
+
dispatchTableLayoutChange(editor);
|
|
30629
|
+
return true;
|
|
30630
|
+
}
|
|
30326
30631
|
function promoteFormulaTextInTableNode(tableNode) {
|
|
30327
30632
|
let changed = false;
|
|
30328
30633
|
const rows = getTableRows2(tableNode).map((rowInfo) => {
|
|
30329
30634
|
const cells = collectChildren2(rowInfo.node);
|
|
30330
30635
|
for (const entry of rowInfo.cells) {
|
|
30331
30636
|
const text = getCellText(entry.node);
|
|
30332
|
-
const
|
|
30333
|
-
|
|
30334
|
-
|
|
30335
|
-
{
|
|
30336
|
-
|
|
30337
|
-
|
|
30338
|
-
|
|
30339
|
-
|
|
30340
|
-
|
|
30341
|
-
|
|
30342
|
-
|
|
30343
|
-
|
|
30637
|
+
const existingFormula = typeof entry.node.attrs.formula === "string" ? entry.node.attrs.formula.trim() : "";
|
|
30638
|
+
const existingComputedValue = typeof entry.node.attrs.computedValue === "string" ? entry.node.attrs.computedValue.trim() : "";
|
|
30639
|
+
if (text.startsWith("=")) {
|
|
30640
|
+
if (!normalizeTableFormula(text)) {
|
|
30641
|
+
if (!existingFormula && !existingComputedValue) continue;
|
|
30642
|
+
cells[entry.index] = entry.node.type.create(
|
|
30643
|
+
{
|
|
30644
|
+
...entry.node.attrs,
|
|
30645
|
+
formula: null,
|
|
30646
|
+
computedValue: null
|
|
30647
|
+
},
|
|
30648
|
+
text === formatFormulaError("empty") ? createCellDisplayContent(entry.node, "") : entry.node.content,
|
|
30649
|
+
entry.node.marks
|
|
30650
|
+
);
|
|
30651
|
+
changed = true;
|
|
30652
|
+
continue;
|
|
30653
|
+
}
|
|
30654
|
+
if (isDraftTableFormula(text)) {
|
|
30655
|
+
continue;
|
|
30656
|
+
}
|
|
30657
|
+
const formula = normalizeFormulaInput(text);
|
|
30658
|
+
if (entry.node.attrs.formula === formula) continue;
|
|
30659
|
+
cells[entry.index] = entry.node.type.create(
|
|
30660
|
+
{
|
|
30661
|
+
...entry.node.attrs,
|
|
30662
|
+
formula,
|
|
30663
|
+
computedValue: null
|
|
30664
|
+
},
|
|
30665
|
+
entry.node.content,
|
|
30666
|
+
entry.node.marks
|
|
30667
|
+
);
|
|
30668
|
+
changed = true;
|
|
30669
|
+
continue;
|
|
30670
|
+
}
|
|
30671
|
+
if (existingFormula) {
|
|
30672
|
+
const isExistingEmptyFormula = !normalizeTableFormula(existingFormula);
|
|
30673
|
+
if (!isExistingEmptyFormula) continue;
|
|
30674
|
+
cells[entry.index] = entry.node.type.create(
|
|
30675
|
+
{
|
|
30676
|
+
...entry.node.attrs,
|
|
30677
|
+
formula: null,
|
|
30678
|
+
computedValue: null
|
|
30679
|
+
},
|
|
30680
|
+
isExistingEmptyFormula && text === formatFormulaError("empty") ? createCellDisplayContent(entry.node, "") : entry.node.content,
|
|
30681
|
+
entry.node.marks
|
|
30682
|
+
);
|
|
30683
|
+
changed = true;
|
|
30684
|
+
}
|
|
30344
30685
|
}
|
|
30345
30686
|
return rowInfo.node.type.create(rowInfo.node.attrs, cells);
|
|
30346
30687
|
});
|
|
@@ -30401,14 +30742,15 @@ function recalculateTableNode(tableNode) {
|
|
|
30401
30742
|
const label = `${indexToColumnName(rectForCell.left)}${rectForCell.top + 1}`;
|
|
30402
30743
|
const computedValue = computedValues.get(label);
|
|
30403
30744
|
if (computedValue == null) continue;
|
|
30404
|
-
const
|
|
30745
|
+
const displayValue = formatTableFormulaDisplayValue(computedValue, entry.node.attrs.numberFormat);
|
|
30746
|
+
const contentMatchesComputedValue = getCellText(entry.node) === displayValue;
|
|
30405
30747
|
if (entry.node.attrs.computedValue === computedValue && contentMatchesComputedValue) continue;
|
|
30406
30748
|
cells[entry.index] = entry.node.type.create(
|
|
30407
30749
|
{
|
|
30408
30750
|
...entry.node.attrs,
|
|
30409
30751
|
computedValue
|
|
30410
30752
|
},
|
|
30411
|
-
createCellDisplayContent(entry.node,
|
|
30753
|
+
createCellDisplayContent(entry.node, displayValue),
|
|
30412
30754
|
entry.node.marks
|
|
30413
30755
|
);
|
|
30414
30756
|
changed = true;
|
|
@@ -30454,7 +30796,7 @@ function recalculateAllTableFormulas(editor) {
|
|
|
30454
30796
|
}
|
|
30455
30797
|
|
|
30456
30798
|
// src/components/UEditor/menus.tsx
|
|
30457
|
-
import { Fragment as Fragment29, jsx as
|
|
30799
|
+
import { Fragment as Fragment29, jsx as jsx87, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
30458
30800
|
function applyTableCellBackground(editor, color) {
|
|
30459
30801
|
const value = color || null;
|
|
30460
30802
|
const { state, view } = editor;
|
|
@@ -30497,6 +30839,7 @@ var BubbleMenuContent = ({
|
|
|
30497
30839
|
const currentHighlightColor = normalizeStyleValue(editor.getAttributes("highlight").color) || "";
|
|
30498
30840
|
const currentCellBgColor = normalizeStyleValue(editor.getAttributes("tableCell").backgroundColor || editor.getAttributes("tableHeader").backgroundColor) || "";
|
|
30499
30841
|
const currentCellFormula = normalizeStyleValue(editor.getAttributes("tableCell").formula || editor.getAttributes("tableHeader").formula) || "";
|
|
30842
|
+
const currentCellNumberFormat = normalizeStyleValue(editor.getAttributes("tableCell").numberFormat || editor.getAttributes("tableHeader").numberFormat) || "text";
|
|
30500
30843
|
const isInTable2 = isSelectionInTable(editor.state);
|
|
30501
30844
|
const canMergeCells = isInTable2 && editor.can().mergeCells();
|
|
30502
30845
|
const canSplitCell = isInTable2 && editor.can().splitCell();
|
|
@@ -30542,7 +30885,7 @@ var BubbleMenuContent = ({
|
|
|
30542
30885
|
};
|
|
30543
30886
|
}, [editor, showLinkInput]);
|
|
30544
30887
|
if (showLinkInput) {
|
|
30545
|
-
return /* @__PURE__ */
|
|
30888
|
+
return /* @__PURE__ */ jsx87(
|
|
30546
30889
|
LinkInput,
|
|
30547
30890
|
{
|
|
30548
30891
|
initialUrl: editor.getAttributes("link").href || "",
|
|
@@ -30565,11 +30908,11 @@ var BubbleMenuContent = ({
|
|
|
30565
30908
|
const currentBorderStyle = editor.getAttributes("tableCell").borderStyle || editor.getAttributes("tableHeader").borderStyle || "solid";
|
|
30566
30909
|
const currentBorderWidth = editor.getAttributes("tableCell").borderWidth || editor.getAttributes("tableHeader").borderWidth || "1px";
|
|
30567
30910
|
const currentBorderColor = editor.getAttributes("tableCell").borderColor || editor.getAttributes("tableHeader").borderColor || "currentColor";
|
|
30568
|
-
return /* @__PURE__ */
|
|
30569
|
-
/* @__PURE__ */
|
|
30570
|
-
/* @__PURE__ */
|
|
30571
|
-
/* @__PURE__ */
|
|
30572
|
-
/* @__PURE__ */
|
|
30911
|
+
return /* @__PURE__ */ jsxs73("div", { className: "flex flex-col gap-2 p-2 w-56 text-sm", children: [
|
|
30912
|
+
/* @__PURE__ */ jsx87("div", { className: "font-semibold text-xs text-muted-foreground uppercase tracking-wider mb-1", children: t("tableMenu.cellBorder") || "Cell Borders" }),
|
|
30913
|
+
/* @__PURE__ */ jsxs73("div", { className: "flex flex-col gap-1", children: [
|
|
30914
|
+
/* @__PURE__ */ jsx87("label", { className: "text-xs text-muted-foreground", children: t("tableMenu.borderStyle") || "Border Style" }),
|
|
30915
|
+
/* @__PURE__ */ jsxs73(
|
|
30573
30916
|
"select",
|
|
30574
30917
|
{
|
|
30575
30918
|
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",
|
|
@@ -30579,18 +30922,18 @@ var BubbleMenuContent = ({
|
|
|
30579
30922
|
editor.chain().focus().setCellAttribute("borderStyle", style).run();
|
|
30580
30923
|
},
|
|
30581
30924
|
children: [
|
|
30582
|
-
/* @__PURE__ */
|
|
30583
|
-
/* @__PURE__ */
|
|
30584
|
-
/* @__PURE__ */
|
|
30585
|
-
/* @__PURE__ */
|
|
30586
|
-
/* @__PURE__ */
|
|
30925
|
+
/* @__PURE__ */ jsx87("option", { value: "solid", children: "Solid" }),
|
|
30926
|
+
/* @__PURE__ */ jsx87("option", { value: "dashed", children: "Dashed" }),
|
|
30927
|
+
/* @__PURE__ */ jsx87("option", { value: "dotted", children: "Dotted" }),
|
|
30928
|
+
/* @__PURE__ */ jsx87("option", { value: "double", children: "Double" }),
|
|
30929
|
+
/* @__PURE__ */ jsx87("option", { value: "none", children: "None" })
|
|
30587
30930
|
]
|
|
30588
30931
|
}
|
|
30589
30932
|
)
|
|
30590
30933
|
] }),
|
|
30591
|
-
/* @__PURE__ */
|
|
30592
|
-
/* @__PURE__ */
|
|
30593
|
-
/* @__PURE__ */
|
|
30934
|
+
/* @__PURE__ */ jsxs73("div", { className: "flex flex-col gap-1", children: [
|
|
30935
|
+
/* @__PURE__ */ jsx87("label", { className: "text-xs text-muted-foreground", children: t("tableMenu.borderWidth") || "Border Width" }),
|
|
30936
|
+
/* @__PURE__ */ jsxs73(
|
|
30594
30937
|
"select",
|
|
30595
30938
|
{
|
|
30596
30939
|
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",
|
|
@@ -30600,23 +30943,23 @@ var BubbleMenuContent = ({
|
|
|
30600
30943
|
editor.chain().focus().setCellAttribute("borderWidth", width).run();
|
|
30601
30944
|
},
|
|
30602
30945
|
children: [
|
|
30603
|
-
/* @__PURE__ */
|
|
30604
|
-
/* @__PURE__ */
|
|
30605
|
-
/* @__PURE__ */
|
|
30606
|
-
/* @__PURE__ */
|
|
30946
|
+
/* @__PURE__ */ jsx87("option", { value: "1px", children: "1px" }),
|
|
30947
|
+
/* @__PURE__ */ jsx87("option", { value: "2px", children: "2px" }),
|
|
30948
|
+
/* @__PURE__ */ jsx87("option", { value: "3px", children: "3px" }),
|
|
30949
|
+
/* @__PURE__ */ jsx87("option", { value: "4px", children: "4px" })
|
|
30607
30950
|
]
|
|
30608
30951
|
}
|
|
30609
30952
|
)
|
|
30610
30953
|
] }),
|
|
30611
|
-
/* @__PURE__ */
|
|
30954
|
+
/* @__PURE__ */ jsxs73(
|
|
30612
30955
|
"button",
|
|
30613
30956
|
{
|
|
30614
30957
|
type: "button",
|
|
30615
30958
|
onClick: () => setActiveColorPalette("cell-border-color"),
|
|
30616
30959
|
className: "flex items-center justify-between w-full h-8 px-2 rounded-md border border-input hover:bg-accent text-xs",
|
|
30617
30960
|
children: [
|
|
30618
|
-
/* @__PURE__ */
|
|
30619
|
-
/* @__PURE__ */
|
|
30961
|
+
/* @__PURE__ */ jsx87("span", { children: t("tableMenu.borderColor") || "Border Color" }),
|
|
30962
|
+
/* @__PURE__ */ jsx87(
|
|
30620
30963
|
"span",
|
|
30621
30964
|
{
|
|
30622
30965
|
className: "w-4 h-4 rounded-full border border-border",
|
|
@@ -30628,8 +30971,8 @@ var BubbleMenuContent = ({
|
|
|
30628
30971
|
]
|
|
30629
30972
|
}
|
|
30630
30973
|
),
|
|
30631
|
-
/* @__PURE__ */
|
|
30632
|
-
/* @__PURE__ */
|
|
30974
|
+
/* @__PURE__ */ jsxs73("div", { className: "flex items-center justify-between gap-2 mt-2 pt-2 border-t border-border", children: [
|
|
30975
|
+
/* @__PURE__ */ jsx87(
|
|
30633
30976
|
"button",
|
|
30634
30977
|
{
|
|
30635
30978
|
type: "button",
|
|
@@ -30641,7 +30984,7 @@ var BubbleMenuContent = ({
|
|
|
30641
30984
|
children: t("tableMenu.clearBorder") || "Clear Border"
|
|
30642
30985
|
}
|
|
30643
30986
|
),
|
|
30644
|
-
/* @__PURE__ */
|
|
30987
|
+
/* @__PURE__ */ jsx87(
|
|
30645
30988
|
"button",
|
|
30646
30989
|
{
|
|
30647
30990
|
type: "button",
|
|
@@ -30655,7 +30998,7 @@ var BubbleMenuContent = ({
|
|
|
30655
30998
|
}
|
|
30656
30999
|
if (activeColorPalette === "cell-border-color") {
|
|
30657
31000
|
const currentBorderColor = normalizeStyleValue(editor.getAttributes("tableCell").borderColor || editor.getAttributes("tableHeader").borderColor) || "";
|
|
30658
|
-
return /* @__PURE__ */
|
|
31001
|
+
return /* @__PURE__ */ jsx87("div", { className: "w-56", children: /* @__PURE__ */ jsx87(
|
|
30659
31002
|
EditorColorPalette,
|
|
30660
31003
|
{
|
|
30661
31004
|
colors: highlightColors,
|
|
@@ -30669,7 +31012,7 @@ var BubbleMenuContent = ({
|
|
|
30669
31012
|
}
|
|
30670
31013
|
) });
|
|
30671
31014
|
}
|
|
30672
|
-
return /* @__PURE__ */
|
|
31015
|
+
return /* @__PURE__ */ jsx87("div", { className: "w-56", children: /* @__PURE__ */ jsx87(
|
|
30673
31016
|
EditorColorPalette,
|
|
30674
31017
|
{
|
|
30675
31018
|
colors: isTextPalette ? textColors : highlightColors,
|
|
@@ -30697,32 +31040,32 @@ var BubbleMenuContent = ({
|
|
|
30697
31040
|
) });
|
|
30698
31041
|
}
|
|
30699
31042
|
if (isImageSelected) {
|
|
30700
|
-
return /* @__PURE__ */
|
|
30701
|
-
/* @__PURE__ */
|
|
30702
|
-
/* @__PURE__ */
|
|
30703
|
-
/* @__PURE__ */
|
|
30704
|
-
/* @__PURE__ */
|
|
30705
|
-
/* @__PURE__ */
|
|
30706
|
-
/* @__PURE__ */
|
|
30707
|
-
/* @__PURE__ */
|
|
30708
|
-
/* @__PURE__ */
|
|
30709
|
-
/* @__PURE__ */
|
|
30710
|
-
/* @__PURE__ */
|
|
31043
|
+
return /* @__PURE__ */ jsxs73("div", { className: "flex items-center gap-0.5 p-1", children: [
|
|
31044
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: () => applyImageLayout(editor, "block"), active: imageLayout === "block", title: t("toolbar.imageLayoutBlock"), children: /* @__PURE__ */ jsx87(AlignCenter2, { className: "w-4 h-4" }) }),
|
|
31045
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: () => applyImageLayout(editor, "left"), active: imageLayout === "left", title: t("toolbar.imageLayoutLeft"), children: /* @__PURE__ */ jsx87(AlignLeft2, { className: "w-4 h-4" }) }),
|
|
31046
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: () => applyImageLayout(editor, "right"), active: imageLayout === "right", title: t("toolbar.imageLayoutRight"), children: /* @__PURE__ */ jsx87(AlignRight2, { className: "w-4 h-4" }) }),
|
|
31047
|
+
/* @__PURE__ */ jsx87("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
31048
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: () => applyImageWidthPreset(editor, "sm"), active: imageWidthPreset === "sm", title: t("toolbar.imageWidthSm"), children: /* @__PURE__ */ jsx87("span", { className: "text-[10px] font-semibold", children: "S" }) }),
|
|
31049
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: () => applyImageWidthPreset(editor, "md"), active: imageWidthPreset === "md", title: t("toolbar.imageWidthMd"), children: /* @__PURE__ */ jsx87("span", { className: "text-[10px] font-semibold", children: "M" }) }),
|
|
31050
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: () => applyImageWidthPreset(editor, "lg"), active: imageWidthPreset === "lg", title: t("toolbar.imageWidthLg"), children: /* @__PURE__ */ jsx87("span", { className: "text-[10px] font-semibold", children: "L" }) }),
|
|
31051
|
+
/* @__PURE__ */ jsx87("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
31052
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: () => resetImageSize(editor), title: t("toolbar.imageResetSize"), children: /* @__PURE__ */ jsx87(RotateCcw3, { className: "w-4 h-4" }) }),
|
|
31053
|
+
/* @__PURE__ */ jsx87(
|
|
30711
31054
|
ToolbarButton,
|
|
30712
31055
|
{
|
|
30713
31056
|
onClick: () => deleteSelectedImage(editor),
|
|
30714
31057
|
title: t("toolbar.imageDelete"),
|
|
30715
31058
|
className: "text-destructive hover:text-destructive",
|
|
30716
|
-
children: /* @__PURE__ */
|
|
31059
|
+
children: /* @__PURE__ */ jsx87(Trash23, { className: "w-4 h-4" })
|
|
30717
31060
|
}
|
|
30718
31061
|
)
|
|
30719
31062
|
] });
|
|
30720
31063
|
}
|
|
30721
31064
|
if (showFormulaPanel && isInTable2) {
|
|
30722
|
-
return /* @__PURE__ */
|
|
30723
|
-
/* @__PURE__ */
|
|
30724
|
-
/* @__PURE__ */
|
|
30725
|
-
/* @__PURE__ */
|
|
31065
|
+
return /* @__PURE__ */ jsxs73("div", { className: "w-72 p-2", children: [
|
|
31066
|
+
/* @__PURE__ */ jsxs73("div", { className: "mb-2 flex items-center justify-between gap-2", children: [
|
|
31067
|
+
/* @__PURE__ */ jsx87("span", { className: "px-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: t("tableMenu.formula") || "Formula" }),
|
|
31068
|
+
/* @__PURE__ */ jsx87(
|
|
30726
31069
|
"button",
|
|
30727
31070
|
{
|
|
30728
31071
|
type: "button",
|
|
@@ -30735,7 +31078,7 @@ var BubbleMenuContent = ({
|
|
|
30735
31078
|
}
|
|
30736
31079
|
)
|
|
30737
31080
|
] }),
|
|
30738
|
-
/* @__PURE__ */
|
|
31081
|
+
/* @__PURE__ */ jsx87("div", { className: "flex h-9 items-center overflow-hidden rounded-md border border-border/60 bg-muted/40", children: /* @__PURE__ */ jsx87(
|
|
30739
31082
|
"input",
|
|
30740
31083
|
{
|
|
30741
31084
|
value: formulaDraft,
|
|
@@ -30756,8 +31099,30 @@ var BubbleMenuContent = ({
|
|
|
30756
31099
|
className: "h-full min-w-0 flex-1 bg-transparent px-2 text-sm font-medium text-foreground outline-none"
|
|
30757
31100
|
}
|
|
30758
31101
|
) }),
|
|
30759
|
-
/* @__PURE__ */
|
|
30760
|
-
/* @__PURE__ */
|
|
31102
|
+
/* @__PURE__ */ jsxs73("div", { className: "mt-2", children: [
|
|
31103
|
+
/* @__PURE__ */ jsx87("div", { className: "mb-1 px-1 text-[11px] font-medium text-muted-foreground", children: t("tableMenu.numberFormat") || "Number format" }),
|
|
31104
|
+
/* @__PURE__ */ jsx87("div", { className: "grid grid-cols-5 gap-1", children: [
|
|
31105
|
+
["text", "Text"],
|
|
31106
|
+
["number", "123"],
|
|
31107
|
+
["currency", "$"],
|
|
31108
|
+
["percent", "%"],
|
|
31109
|
+
["date", "Date"]
|
|
31110
|
+
].map(([format, label]) => /* @__PURE__ */ jsx87(
|
|
31111
|
+
"button",
|
|
31112
|
+
{
|
|
31113
|
+
type: "button",
|
|
31114
|
+
onClick: () => setSelectedTableCellNumberFormat(editor, format),
|
|
31115
|
+
className: cn(
|
|
31116
|
+
"h-8 rounded-md text-[11px] font-semibold transition-colors hover:bg-muted",
|
|
31117
|
+
currentCellNumberFormat === format || format === "text" && !currentCellNumberFormat ? "bg-primary/10 text-primary" : "bg-muted/40 text-foreground"
|
|
31118
|
+
),
|
|
31119
|
+
children: format === "text" ? t("tableMenu.formatText") || label : format === "date" ? t("tableMenu.formatDate") || label : label
|
|
31120
|
+
},
|
|
31121
|
+
format
|
|
31122
|
+
)) })
|
|
31123
|
+
] }),
|
|
31124
|
+
/* @__PURE__ */ jsxs73("div", { className: "mt-2 grid grid-cols-3 gap-1", children: [
|
|
31125
|
+
/* @__PURE__ */ jsx87(
|
|
30761
31126
|
"button",
|
|
30762
31127
|
{
|
|
30763
31128
|
type: "button",
|
|
@@ -30770,7 +31135,7 @@ var BubbleMenuContent = ({
|
|
|
30770
31135
|
children: t("tableMenu.apply") || "Apply"
|
|
30771
31136
|
}
|
|
30772
31137
|
),
|
|
30773
|
-
/* @__PURE__ */
|
|
31138
|
+
/* @__PURE__ */ jsx87(
|
|
30774
31139
|
"button",
|
|
30775
31140
|
{
|
|
30776
31141
|
type: "button",
|
|
@@ -30782,7 +31147,7 @@ var BubbleMenuContent = ({
|
|
|
30782
31147
|
children: t("tableMenu.clear") || "Clear"
|
|
30783
31148
|
}
|
|
30784
31149
|
),
|
|
30785
|
-
/* @__PURE__ */
|
|
31150
|
+
/* @__PURE__ */ jsx87(
|
|
30786
31151
|
"button",
|
|
30787
31152
|
{
|
|
30788
31153
|
type: "button",
|
|
@@ -30795,10 +31160,10 @@ var BubbleMenuContent = ({
|
|
|
30795
31160
|
] });
|
|
30796
31161
|
}
|
|
30797
31162
|
if (showTypographyPanel) {
|
|
30798
|
-
return /* @__PURE__ */
|
|
30799
|
-
/* @__PURE__ */
|
|
30800
|
-
/* @__PURE__ */
|
|
30801
|
-
/* @__PURE__ */
|
|
31163
|
+
return /* @__PURE__ */ jsxs73("div", { className: "w-72 p-2", children: [
|
|
31164
|
+
/* @__PURE__ */ jsxs73("div", { className: "mb-2 flex items-center justify-between gap-2", children: [
|
|
31165
|
+
/* @__PURE__ */ jsx87("span", { className: "px-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: t("toolbar.textStyle") }),
|
|
31166
|
+
/* @__PURE__ */ jsx87(
|
|
30802
31167
|
"button",
|
|
30803
31168
|
{
|
|
30804
31169
|
type: "button",
|
|
@@ -30808,11 +31173,11 @@ var BubbleMenuContent = ({
|
|
|
30808
31173
|
}
|
|
30809
31174
|
)
|
|
30810
31175
|
] }),
|
|
30811
|
-
/* @__PURE__ */
|
|
30812
|
-
/* @__PURE__ */
|
|
30813
|
-
/* @__PURE__ */
|
|
30814
|
-
/* @__PURE__ */
|
|
30815
|
-
/* @__PURE__ */
|
|
31176
|
+
/* @__PURE__ */ jsxs73("div", { className: "space-y-2", children: [
|
|
31177
|
+
/* @__PURE__ */ jsxs73("div", { children: [
|
|
31178
|
+
/* @__PURE__ */ jsx87("div", { className: "mb-1 px-1 text-[11px] font-medium text-muted-foreground", children: t("toolbar.fontSize") }),
|
|
31179
|
+
/* @__PURE__ */ jsxs73("div", { className: "flex h-9 items-center overflow-hidden rounded-md border border-border/60 bg-muted/40", children: [
|
|
31180
|
+
/* @__PURE__ */ jsx87(
|
|
30816
31181
|
"input",
|
|
30817
31182
|
{
|
|
30818
31183
|
type: "number",
|
|
@@ -30836,8 +31201,8 @@ var BubbleMenuContent = ({
|
|
|
30836
31201
|
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"
|
|
30837
31202
|
}
|
|
30838
31203
|
),
|
|
30839
|
-
/* @__PURE__ */
|
|
30840
|
-
/* @__PURE__ */
|
|
31204
|
+
/* @__PURE__ */ jsx87("span", { className: "border-l border-border/50 px-2 text-[11px] text-muted-foreground", children: "px" }),
|
|
31205
|
+
/* @__PURE__ */ jsx87(
|
|
30841
31206
|
"button",
|
|
30842
31207
|
{
|
|
30843
31208
|
type: "button",
|
|
@@ -30847,12 +31212,12 @@ var BubbleMenuContent = ({
|
|
|
30847
31212
|
"flex h-full w-9 items-center justify-center border-l border-border/50 transition-colors hover:bg-muted",
|
|
30848
31213
|
showFontSizeOptions && "bg-primary/10 text-primary"
|
|
30849
31214
|
),
|
|
30850
|
-
children: /* @__PURE__ */
|
|
31215
|
+
children: /* @__PURE__ */ jsx87(ChevronDown9, { className: "h-4 w-4" })
|
|
30851
31216
|
}
|
|
30852
31217
|
)
|
|
30853
31218
|
] }),
|
|
30854
|
-
showFontSizeOptions && /* @__PURE__ */
|
|
30855
|
-
/* @__PURE__ */
|
|
31219
|
+
showFontSizeOptions && /* @__PURE__ */ jsxs73("div", { className: "mt-1 grid grid-cols-4 gap-1", children: [
|
|
31220
|
+
/* @__PURE__ */ jsx87(
|
|
30856
31221
|
"button",
|
|
30857
31222
|
{
|
|
30858
31223
|
type: "button",
|
|
@@ -30867,7 +31232,7 @@ var BubbleMenuContent = ({
|
|
|
30867
31232
|
children: "A"
|
|
30868
31233
|
}
|
|
30869
31234
|
),
|
|
30870
|
-
quickFontSizes.map((option) => /* @__PURE__ */
|
|
31235
|
+
quickFontSizes.map((option) => /* @__PURE__ */ jsx87(
|
|
30871
31236
|
"button",
|
|
30872
31237
|
{
|
|
30873
31238
|
type: "button",
|
|
@@ -30885,10 +31250,10 @@ var BubbleMenuContent = ({
|
|
|
30885
31250
|
))
|
|
30886
31251
|
] })
|
|
30887
31252
|
] }),
|
|
30888
|
-
/* @__PURE__ */
|
|
30889
|
-
/* @__PURE__ */
|
|
30890
|
-
/* @__PURE__ */
|
|
30891
|
-
/* @__PURE__ */
|
|
31253
|
+
/* @__PURE__ */ jsxs73("div", { children: [
|
|
31254
|
+
/* @__PURE__ */ jsx87("div", { className: "mb-1 px-1 text-[11px] font-medium text-muted-foreground", children: t("toolbar.lineHeight") }),
|
|
31255
|
+
/* @__PURE__ */ jsxs73("div", { className: "grid grid-cols-4 gap-1", children: [
|
|
31256
|
+
/* @__PURE__ */ jsx87(
|
|
30892
31257
|
"button",
|
|
30893
31258
|
{
|
|
30894
31259
|
type: "button",
|
|
@@ -30900,7 +31265,7 @@ var BubbleMenuContent = ({
|
|
|
30900
31265
|
children: "LH"
|
|
30901
31266
|
}
|
|
30902
31267
|
),
|
|
30903
|
-
quickLineHeights.map((option) => /* @__PURE__ */
|
|
31268
|
+
quickLineHeights.map((option) => /* @__PURE__ */ jsx87(
|
|
30904
31269
|
"button",
|
|
30905
31270
|
{
|
|
30906
31271
|
type: "button",
|
|
@@ -30915,8 +31280,8 @@ var BubbleMenuContent = ({
|
|
|
30915
31280
|
))
|
|
30916
31281
|
] })
|
|
30917
31282
|
] }),
|
|
30918
|
-
/* @__PURE__ */
|
|
30919
|
-
/* @__PURE__ */
|
|
31283
|
+
/* @__PURE__ */ jsxs73("div", { className: "grid grid-cols-2 gap-1 border-t border-border/40 pt-2", children: [
|
|
31284
|
+
/* @__PURE__ */ jsxs73(
|
|
30920
31285
|
"button",
|
|
30921
31286
|
{
|
|
30922
31287
|
type: "button",
|
|
@@ -30926,12 +31291,12 @@ var BubbleMenuContent = ({
|
|
|
30926
31291
|
editor.isActive("subscript") ? "bg-primary/10 text-primary" : "bg-muted/40 text-foreground"
|
|
30927
31292
|
),
|
|
30928
31293
|
children: [
|
|
30929
|
-
/* @__PURE__ */
|
|
31294
|
+
/* @__PURE__ */ jsx87(SubscriptIcon2, { className: "h-4 w-4" }),
|
|
30930
31295
|
t("toolbar.subscript")
|
|
30931
31296
|
]
|
|
30932
31297
|
}
|
|
30933
31298
|
),
|
|
30934
|
-
/* @__PURE__ */
|
|
31299
|
+
/* @__PURE__ */ jsxs73(
|
|
30935
31300
|
"button",
|
|
30936
31301
|
{
|
|
30937
31302
|
type: "button",
|
|
@@ -30941,7 +31306,7 @@ var BubbleMenuContent = ({
|
|
|
30941
31306
|
editor.isActive("superscript") ? "bg-primary/10 text-primary" : "bg-muted/40 text-foreground"
|
|
30942
31307
|
),
|
|
30943
31308
|
children: [
|
|
30944
|
-
/* @__PURE__ */
|
|
31309
|
+
/* @__PURE__ */ jsx87(SuperscriptIcon2, { className: "h-4 w-4" }),
|
|
30945
31310
|
t("toolbar.superscript")
|
|
30946
31311
|
]
|
|
30947
31312
|
}
|
|
@@ -30950,22 +31315,22 @@ var BubbleMenuContent = ({
|
|
|
30950
31315
|
] })
|
|
30951
31316
|
] });
|
|
30952
31317
|
}
|
|
30953
|
-
return /* @__PURE__ */
|
|
30954
|
-
/* @__PURE__ */
|
|
30955
|
-
/* @__PURE__ */
|
|
30956
|
-
/* @__PURE__ */
|
|
31318
|
+
return /* @__PURE__ */ jsxs73("div", { className: "flex items-center gap-0.5 p-1", children: [
|
|
31319
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ jsx87(BoldIcon2, { className: "w-4 h-4" }) }),
|
|
31320
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ jsx87(ItalicIcon2, { className: "w-4 h-4" }) }),
|
|
31321
|
+
/* @__PURE__ */ jsx87(
|
|
30957
31322
|
ToolbarButton,
|
|
30958
31323
|
{
|
|
30959
31324
|
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
30960
31325
|
active: editor.isActive("underline"),
|
|
30961
31326
|
title: t("toolbar.underline"),
|
|
30962
|
-
children: /* @__PURE__ */
|
|
31327
|
+
children: /* @__PURE__ */ jsx87(UnderlineIcon2, { className: "w-4 h-4" })
|
|
30963
31328
|
}
|
|
30964
31329
|
),
|
|
30965
|
-
/* @__PURE__ */
|
|
30966
|
-
/* @__PURE__ */
|
|
30967
|
-
/* @__PURE__ */
|
|
30968
|
-
/* @__PURE__ */
|
|
31330
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: () => editor.chain().focus().toggleStrike().run(), active: editor.isActive("strike"), title: t("toolbar.strike"), children: /* @__PURE__ */ jsx87(StrikethroughIcon2, { className: "w-4 h-4" }) }),
|
|
31331
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: () => editor.chain().focus().toggleCode().run(), active: editor.isActive("code"), title: t("toolbar.code"), children: /* @__PURE__ */ jsx87(CodeIcon2, { className: "w-4 h-4" }) }),
|
|
31332
|
+
/* @__PURE__ */ jsx87("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
31333
|
+
/* @__PURE__ */ jsx87(
|
|
30969
31334
|
ToolbarButton,
|
|
30970
31335
|
{
|
|
30971
31336
|
onMouseDown: () => {
|
|
@@ -30976,22 +31341,22 @@ var BubbleMenuContent = ({
|
|
|
30976
31341
|
},
|
|
30977
31342
|
active: editor.isActive("link"),
|
|
30978
31343
|
title: t("toolbar.link"),
|
|
30979
|
-
children: /* @__PURE__ */
|
|
31344
|
+
children: /* @__PURE__ */ jsx87(LinkIcon2, { className: "w-4 h-4" })
|
|
30980
31345
|
}
|
|
30981
31346
|
),
|
|
30982
|
-
/* @__PURE__ */
|
|
30983
|
-
/* @__PURE__ */
|
|
30984
|
-
isInTable2 && /* @__PURE__ */
|
|
30985
|
-
/* @__PURE__ */
|
|
31347
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: () => setActiveColorPalette("text"), title: t("colors.textColor"), children: /* @__PURE__ */ jsx87(TextColorIcon, { color: currentTextColor }) }),
|
|
31348
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: () => setActiveColorPalette("highlight"), active: editor.isActive("highlight"), title: t("colors.highlight"), children: /* @__PURE__ */ jsx87(HighlightColorIcon, { color: currentHighlightColor }) }),
|
|
31349
|
+
isInTable2 && /* @__PURE__ */ jsxs73(Fragment29, { children: [
|
|
31350
|
+
/* @__PURE__ */ jsx87(
|
|
30986
31351
|
ToolbarButton,
|
|
30987
31352
|
{
|
|
30988
31353
|
onClick: () => setActiveColorPalette("cell-bg"),
|
|
30989
31354
|
active: Boolean(currentCellBgColor),
|
|
30990
31355
|
title: t("tableMenu.cellBackground") || "Cell background",
|
|
30991
|
-
children: /* @__PURE__ */
|
|
31356
|
+
children: /* @__PURE__ */ jsx87(CellBgColorIcon, { color: currentCellBgColor })
|
|
30992
31357
|
}
|
|
30993
31358
|
),
|
|
30994
|
-
/* @__PURE__ */
|
|
31359
|
+
/* @__PURE__ */ jsx87(
|
|
30995
31360
|
ToolbarButton,
|
|
30996
31361
|
{
|
|
30997
31362
|
onClick: () => setActiveColorPalette("cell-border"),
|
|
@@ -30999,7 +31364,7 @@ var BubbleMenuContent = ({
|
|
|
30999
31364
|
editor.getAttributes("tableCell").borderColor || editor.getAttributes("tableHeader").borderColor || editor.getAttributes("tableCell").borderStyle || editor.getAttributes("tableHeader").borderStyle || editor.getAttributes("tableCell").borderWidth || editor.getAttributes("tableHeader").borderWidth
|
|
31000
31365
|
),
|
|
31001
31366
|
title: t("tableMenu.cellBorder") || "Cell border",
|
|
31002
|
-
children: /* @__PURE__ */
|
|
31367
|
+
children: /* @__PURE__ */ jsx87(
|
|
31003
31368
|
CellBorderIcon,
|
|
31004
31369
|
{
|
|
31005
31370
|
color: editor.getAttributes("tableCell").borderColor || editor.getAttributes("tableHeader").borderColor
|
|
@@ -31007,7 +31372,7 @@ var BubbleMenuContent = ({
|
|
|
31007
31372
|
)
|
|
31008
31373
|
}
|
|
31009
31374
|
),
|
|
31010
|
-
/* @__PURE__ */
|
|
31375
|
+
/* @__PURE__ */ jsx87(
|
|
31011
31376
|
ToolbarButton,
|
|
31012
31377
|
{
|
|
31013
31378
|
onMouseDown: () => {
|
|
@@ -31019,10 +31384,10 @@ var BubbleMenuContent = ({
|
|
|
31019
31384
|
},
|
|
31020
31385
|
active: Boolean(currentCellFormula),
|
|
31021
31386
|
title: t("tableMenu.formula") || "Formula",
|
|
31022
|
-
children: /* @__PURE__ */
|
|
31387
|
+
children: /* @__PURE__ */ jsx87(Sigma2, { className: "w-4 h-4" })
|
|
31023
31388
|
}
|
|
31024
31389
|
),
|
|
31025
|
-
/* @__PURE__ */
|
|
31390
|
+
/* @__PURE__ */ jsx87(
|
|
31026
31391
|
ToolbarButton,
|
|
31027
31392
|
{
|
|
31028
31393
|
onClick: () => {
|
|
@@ -31035,17 +31400,17 @@ var BubbleMenuContent = ({
|
|
|
31035
31400
|
active: canSplitCell,
|
|
31036
31401
|
disabled: !canMergeCells && !canSplitCell,
|
|
31037
31402
|
title: canSplitCell ? t("tableMenu.splitCell") || "Split cell" : t("tableMenu.mergeCells") || "Merge cells",
|
|
31038
|
-
children: /* @__PURE__ */
|
|
31403
|
+
children: /* @__PURE__ */ jsx87(TableCellsMerge2, { className: "w-4 h-4" })
|
|
31039
31404
|
}
|
|
31040
31405
|
)
|
|
31041
31406
|
] }),
|
|
31042
|
-
/* @__PURE__ */
|
|
31407
|
+
/* @__PURE__ */ jsx87(
|
|
31043
31408
|
ToolbarButton,
|
|
31044
31409
|
{
|
|
31045
31410
|
onClick: () => setShowTypographyPanel(true),
|
|
31046
31411
|
active: Boolean(currentFontSize || currentLineHeight || editor.isActive("subscript") || editor.isActive("superscript")),
|
|
31047
31412
|
title: t("toolbar.textStyle"),
|
|
31048
|
-
children: /* @__PURE__ */
|
|
31413
|
+
children: /* @__PURE__ */ jsx87(Type3, { className: "w-4 h-4" })
|
|
31049
31414
|
}
|
|
31050
31415
|
)
|
|
31051
31416
|
] });
|
|
@@ -31059,12 +31424,12 @@ var LinkPreviewContent = ({ editor, onEdit }) => {
|
|
|
31059
31424
|
const handleUnlink = () => {
|
|
31060
31425
|
editor.chain().focus().unsetLink().run();
|
|
31061
31426
|
};
|
|
31062
|
-
return /* @__PURE__ */
|
|
31063
|
-
/* @__PURE__ */
|
|
31064
|
-
/* @__PURE__ */
|
|
31065
|
-
/* @__PURE__ */
|
|
31066
|
-
/* @__PURE__ */
|
|
31067
|
-
/* @__PURE__ */
|
|
31427
|
+
return /* @__PURE__ */ jsxs73("div", { className: "flex items-center gap-1 p-1 max-w-sm", children: [
|
|
31428
|
+
/* @__PURE__ */ jsx87("span", { className: "text-xs text-muted-foreground font-mono px-2 truncate max-w-[180px]", children: url }),
|
|
31429
|
+
/* @__PURE__ */ jsx87("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
31430
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: handleOpen, title: t("linkPreview.open") || "Open link", children: /* @__PURE__ */ jsx87(ExternalLink3, { className: "w-4 h-4" }) }),
|
|
31431
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: onEdit, title: t("linkPreview.edit") || "Edit link", children: /* @__PURE__ */ jsx87(Edit2, { className: "w-4 h-4" }) }),
|
|
31432
|
+
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: handleUnlink, title: t("linkPreview.unlink") || "Remove link", className: "text-destructive hover:text-destructive", children: /* @__PURE__ */ jsx87(Unlink, { className: "w-4 h-4" }) })
|
|
31068
31433
|
] });
|
|
31069
31434
|
};
|
|
31070
31435
|
var CustomBubbleMenu = ({
|
|
@@ -31151,7 +31516,7 @@ var CustomBubbleMenu = ({
|
|
|
31151
31516
|
}, [editor]);
|
|
31152
31517
|
if (!isVisible) return null;
|
|
31153
31518
|
return createPortal8(
|
|
31154
|
-
/* @__PURE__ */
|
|
31519
|
+
/* @__PURE__ */ jsx87(
|
|
31155
31520
|
"div",
|
|
31156
31521
|
{
|
|
31157
31522
|
ref: menuRef,
|
|
@@ -31163,7 +31528,7 @@ var CustomBubbleMenu = ({
|
|
|
31163
31528
|
transform: "translate(-50%, -100%)"
|
|
31164
31529
|
},
|
|
31165
31530
|
onMouseDown: (e) => e.preventDefault(),
|
|
31166
|
-
children: editor.isActive("link") && !keepOpenRef.current ? /* @__PURE__ */
|
|
31531
|
+
children: editor.isActive("link") && !keepOpenRef.current ? /* @__PURE__ */ jsx87(LinkPreviewContent, { editor, onEdit: () => setKeepOpen(true) }) : /* @__PURE__ */ jsx87(
|
|
31167
31532
|
BubbleMenuContent,
|
|
31168
31533
|
{
|
|
31169
31534
|
editor,
|
|
@@ -31180,25 +31545,25 @@ var CustomBubbleMenu = ({
|
|
|
31180
31545
|
};
|
|
31181
31546
|
|
|
31182
31547
|
// src/components/UEditor/CharacterCount.tsx
|
|
31183
|
-
import { jsxs as
|
|
31548
|
+
import { jsxs as jsxs74 } from "react/jsx-runtime";
|
|
31184
31549
|
var CharacterCountDisplay = ({ editor, maxCharacters }) => {
|
|
31185
31550
|
const t = useSmartTranslations("UEditor");
|
|
31186
31551
|
const storage = editor.storage;
|
|
31187
31552
|
const characterCount = storage.characterCount?.characters?.() ?? 0;
|
|
31188
31553
|
const wordCount = storage.characterCount?.words?.() ?? 0;
|
|
31189
31554
|
const percentage = maxCharacters ? Math.round(characterCount / maxCharacters * 100) : 0;
|
|
31190
|
-
return /* @__PURE__ */
|
|
31191
|
-
/* @__PURE__ */
|
|
31555
|
+
return /* @__PURE__ */ jsxs74("div", { className: "flex items-center gap-3 px-3 py-2 text-xs text-muted-foreground border-t bg-muted/20", children: [
|
|
31556
|
+
/* @__PURE__ */ jsxs74("span", { children: [
|
|
31192
31557
|
wordCount,
|
|
31193
31558
|
" ",
|
|
31194
31559
|
t("words")
|
|
31195
31560
|
] }),
|
|
31196
|
-
/* @__PURE__ */
|
|
31561
|
+
/* @__PURE__ */ jsxs74("span", { children: [
|
|
31197
31562
|
characterCount,
|
|
31198
31563
|
" ",
|
|
31199
31564
|
t("characters")
|
|
31200
31565
|
] }),
|
|
31201
|
-
maxCharacters && /* @__PURE__ */
|
|
31566
|
+
maxCharacters && /* @__PURE__ */ jsxs74("span", { className: cn(percentage > 90 && "text-destructive", percentage > 100 && "font-bold"), children: [
|
|
31202
31567
|
characterCount,
|
|
31203
31568
|
"/",
|
|
31204
31569
|
maxCharacters
|
|
@@ -31619,7 +31984,7 @@ async function prepareUEditorContentForSave({
|
|
|
31619
31984
|
}
|
|
31620
31985
|
|
|
31621
31986
|
// src/components/UEditor/table-controls.tsx
|
|
31622
|
-
import
|
|
31987
|
+
import React79 from "react";
|
|
31623
31988
|
|
|
31624
31989
|
// node_modules/prosemirror-model/dist/index.js
|
|
31625
31990
|
function findDiffStart(a, b, pos) {
|
|
@@ -34636,7 +35001,7 @@ function createKey(name) {
|
|
|
34636
35001
|
keys[name] = 0;
|
|
34637
35002
|
return name + "$";
|
|
34638
35003
|
}
|
|
34639
|
-
var
|
|
35004
|
+
var PluginKey5 = class {
|
|
34640
35005
|
/**
|
|
34641
35006
|
Create a plugin key.
|
|
34642
35007
|
*/
|
|
@@ -35068,7 +35433,7 @@ function tableNodeTypes(schema) {
|
|
|
35068
35433
|
}
|
|
35069
35434
|
return result;
|
|
35070
35435
|
}
|
|
35071
|
-
var tableEditingKey = new
|
|
35436
|
+
var tableEditingKey = new PluginKey5("selectingCells");
|
|
35072
35437
|
function cellAround($pos) {
|
|
35073
35438
|
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));
|
|
35074
35439
|
return null;
|
|
@@ -35299,7 +35664,7 @@ var CellBookmark = class CellBookmark2 {
|
|
|
35299
35664
|
else return Selection.near($headCell, 1);
|
|
35300
35665
|
}
|
|
35301
35666
|
};
|
|
35302
|
-
var fixTablesKey = new
|
|
35667
|
+
var fixTablesKey = new PluginKey5("fix-tables");
|
|
35303
35668
|
function convertTableNodeToArrayOfRows(tableNode) {
|
|
35304
35669
|
const map = TableMap3.get(tableNode);
|
|
35305
35670
|
const rows = [];
|
|
@@ -35777,7 +36142,7 @@ function atEndOfCell(view, axis, dir) {
|
|
|
35777
36142
|
}
|
|
35778
36143
|
return null;
|
|
35779
36144
|
}
|
|
35780
|
-
var columnResizingPluginKey = new
|
|
36145
|
+
var columnResizingPluginKey = new PluginKey5("tableColumnResizing");
|
|
35781
36146
|
|
|
35782
36147
|
// src/components/UEditor/table-controls.tsx
|
|
35783
36148
|
import {
|
|
@@ -36104,7 +36469,7 @@ function buildTableHoverState({
|
|
|
36104
36469
|
}
|
|
36105
36470
|
|
|
36106
36471
|
// src/components/UEditor/table-drag-preview.tsx
|
|
36107
|
-
import { Fragment as Fragment31, jsx as
|
|
36472
|
+
import { Fragment as Fragment31, jsx as jsx88, jsxs as jsxs75 } from "react/jsx-runtime";
|
|
36108
36473
|
function TableDragPreview({
|
|
36109
36474
|
columnDragLabel,
|
|
36110
36475
|
dragPreview,
|
|
@@ -36115,9 +36480,9 @@ function TableDragPreview({
|
|
|
36115
36480
|
const expandPreviewWidth = dragPreview.kind === "add-column" ? layout.tableWidth + dragPreview.previewCols * layout.avgColumnWidth : layout.tableWidth;
|
|
36116
36481
|
const expandPreviewHeight = dragPreview.kind === "add-row" ? layout.tableHeight + dragPreview.previewRows * layout.avgRowHeight : layout.tableHeight;
|
|
36117
36482
|
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`;
|
|
36118
|
-
return /* @__PURE__ */
|
|
36119
|
-
dragPreview.kind === "row" && /* @__PURE__ */
|
|
36120
|
-
/* @__PURE__ */
|
|
36483
|
+
return /* @__PURE__ */ jsxs75(Fragment31, { children: [
|
|
36484
|
+
dragPreview.kind === "row" && /* @__PURE__ */ jsxs75(Fragment31, { children: [
|
|
36485
|
+
/* @__PURE__ */ jsx88(
|
|
36121
36486
|
"div",
|
|
36122
36487
|
{
|
|
36123
36488
|
"aria-hidden": "true",
|
|
@@ -36130,7 +36495,7 @@ function TableDragPreview({
|
|
|
36130
36495
|
}
|
|
36131
36496
|
}
|
|
36132
36497
|
),
|
|
36133
|
-
/* @__PURE__ */
|
|
36498
|
+
/* @__PURE__ */ jsx88(
|
|
36134
36499
|
"div",
|
|
36135
36500
|
{
|
|
36136
36501
|
"aria-hidden": "true",
|
|
@@ -36144,8 +36509,8 @@ function TableDragPreview({
|
|
|
36144
36509
|
}
|
|
36145
36510
|
)
|
|
36146
36511
|
] }),
|
|
36147
|
-
dragPreview.kind === "column" && /* @__PURE__ */
|
|
36148
|
-
/* @__PURE__ */
|
|
36512
|
+
dragPreview.kind === "column" && /* @__PURE__ */ jsxs75(Fragment31, { children: [
|
|
36513
|
+
/* @__PURE__ */ jsx88(
|
|
36149
36514
|
"div",
|
|
36150
36515
|
{
|
|
36151
36516
|
"aria-hidden": "true",
|
|
@@ -36158,7 +36523,7 @@ function TableDragPreview({
|
|
|
36158
36523
|
}
|
|
36159
36524
|
}
|
|
36160
36525
|
),
|
|
36161
|
-
/* @__PURE__ */
|
|
36526
|
+
/* @__PURE__ */ jsx88(
|
|
36162
36527
|
"div",
|
|
36163
36528
|
{
|
|
36164
36529
|
"aria-hidden": "true",
|
|
@@ -36172,7 +36537,7 @@ function TableDragPreview({
|
|
|
36172
36537
|
}
|
|
36173
36538
|
)
|
|
36174
36539
|
] }),
|
|
36175
|
-
(dragPreview.kind === "add-row" || dragPreview.kind === "add-column") && /* @__PURE__ */
|
|
36540
|
+
(dragPreview.kind === "add-row" || dragPreview.kind === "add-column") && /* @__PURE__ */ jsx88(
|
|
36176
36541
|
"div",
|
|
36177
36542
|
{
|
|
36178
36543
|
"aria-hidden": "true",
|
|
@@ -36185,7 +36550,7 @@ function TableDragPreview({
|
|
|
36185
36550
|
}
|
|
36186
36551
|
}
|
|
36187
36552
|
),
|
|
36188
|
-
/* @__PURE__ */
|
|
36553
|
+
/* @__PURE__ */ jsx88(
|
|
36189
36554
|
"div",
|
|
36190
36555
|
{
|
|
36191
36556
|
role: "status",
|
|
@@ -36201,7 +36566,7 @@ function TableDragPreview({
|
|
|
36201
36566
|
}
|
|
36202
36567
|
|
|
36203
36568
|
// src/components/UEditor/table-add-rails.tsx
|
|
36204
|
-
import { Fragment as Fragment32, jsx as
|
|
36569
|
+
import { Fragment as Fragment32, jsx as jsx89, jsxs as jsxs76 } from "react/jsx-runtime";
|
|
36205
36570
|
var ADD_COLUMN_RAIL_GAP = 4;
|
|
36206
36571
|
var ADD_ROW_RAIL_GAP = 4;
|
|
36207
36572
|
function TableAddRails({
|
|
@@ -36222,13 +36587,13 @@ function TableAddRails({
|
|
|
36222
36587
|
const rowRailLeft = visibleBounds.left;
|
|
36223
36588
|
const showColumnRail = controlsVisible || addColumnVisible;
|
|
36224
36589
|
const showRowRail = controlsVisible || addRowVisible;
|
|
36225
|
-
return /* @__PURE__ */
|
|
36226
|
-
/* @__PURE__ */
|
|
36590
|
+
return /* @__PURE__ */ jsxs76(Fragment32, { children: [
|
|
36591
|
+
/* @__PURE__ */ jsx89(
|
|
36227
36592
|
Tooltip,
|
|
36228
36593
|
{
|
|
36229
36594
|
placement: "right",
|
|
36230
|
-
content: /* @__PURE__ */
|
|
36231
|
-
children: /* @__PURE__ */
|
|
36595
|
+
content: /* @__PURE__ */ jsx89("span", { className: "text-xs font-medium", children: quickAddColumnLabel }),
|
|
36596
|
+
children: /* @__PURE__ */ jsx89(
|
|
36232
36597
|
"button",
|
|
36233
36598
|
{
|
|
36234
36599
|
type: "button",
|
|
@@ -36255,17 +36620,17 @@ function TableAddRails({
|
|
|
36255
36620
|
transform: showColumnRail ? "scale(1)" : "scale(0.92)",
|
|
36256
36621
|
pointerEvents: showColumnRail ? "auto" : "none"
|
|
36257
36622
|
},
|
|
36258
|
-
children: /* @__PURE__ */
|
|
36623
|
+
children: /* @__PURE__ */ jsx89("span", { className: "text-sm font-medium leading-none", children: "+" })
|
|
36259
36624
|
}
|
|
36260
36625
|
)
|
|
36261
36626
|
}
|
|
36262
36627
|
),
|
|
36263
|
-
/* @__PURE__ */
|
|
36628
|
+
/* @__PURE__ */ jsx89(
|
|
36264
36629
|
Tooltip,
|
|
36265
36630
|
{
|
|
36266
36631
|
placement: "bottom",
|
|
36267
|
-
content: /* @__PURE__ */
|
|
36268
|
-
children: /* @__PURE__ */
|
|
36632
|
+
content: /* @__PURE__ */ jsx89("span", { className: "text-xs font-medium", children: quickAddRowLabel }),
|
|
36633
|
+
children: /* @__PURE__ */ jsx89(
|
|
36269
36634
|
"button",
|
|
36270
36635
|
{
|
|
36271
36636
|
type: "button",
|
|
@@ -36292,7 +36657,7 @@ function TableAddRails({
|
|
|
36292
36657
|
transform: showRowRail ? "scale(1)" : "scale(0.92)",
|
|
36293
36658
|
pointerEvents: showRowRail ? "auto" : "none"
|
|
36294
36659
|
},
|
|
36295
|
-
children: /* @__PURE__ */
|
|
36660
|
+
children: /* @__PURE__ */ jsx89("span", { className: "text-sm font-medium leading-none", children: "+" })
|
|
36296
36661
|
}
|
|
36297
36662
|
)
|
|
36298
36663
|
}
|
|
@@ -36302,7 +36667,7 @@ function TableAddRails({
|
|
|
36302
36667
|
|
|
36303
36668
|
// src/components/UEditor/table-control-menu.tsx
|
|
36304
36669
|
import { MoreHorizontal as MoreHorizontal2 } from "lucide-react";
|
|
36305
|
-
import { jsx as
|
|
36670
|
+
import { jsx as jsx90 } from "react/jsx-runtime";
|
|
36306
36671
|
function TableControlMenu({
|
|
36307
36672
|
controlsVisible,
|
|
36308
36673
|
isOpen,
|
|
@@ -36314,7 +36679,7 @@ function TableControlMenu({
|
|
|
36314
36679
|
top
|
|
36315
36680
|
}) {
|
|
36316
36681
|
const shown = controlsVisible || menuVisible || isOpen;
|
|
36317
|
-
return /* @__PURE__ */
|
|
36682
|
+
return /* @__PURE__ */ jsx90(
|
|
36318
36683
|
"div",
|
|
36319
36684
|
{
|
|
36320
36685
|
className: "absolute z-30",
|
|
@@ -36323,13 +36688,13 @@ function TableControlMenu({
|
|
|
36323
36688
|
top,
|
|
36324
36689
|
left
|
|
36325
36690
|
},
|
|
36326
|
-
children: /* @__PURE__ */
|
|
36691
|
+
children: /* @__PURE__ */ jsx90(
|
|
36327
36692
|
Tooltip,
|
|
36328
36693
|
{
|
|
36329
36694
|
placement: "top",
|
|
36330
36695
|
disabled: isOpen,
|
|
36331
|
-
content: /* @__PURE__ */
|
|
36332
|
-
children: /* @__PURE__ */
|
|
36696
|
+
content: /* @__PURE__ */ jsx90("span", { className: "text-xs font-medium", children: label }),
|
|
36697
|
+
children: /* @__PURE__ */ jsx90("span", { className: "inline-flex", children: /* @__PURE__ */ jsx90(
|
|
36333
36698
|
DropdownMenu,
|
|
36334
36699
|
{
|
|
36335
36700
|
placement: "bottom-start",
|
|
@@ -36337,7 +36702,7 @@ function TableControlMenu({
|
|
|
36337
36702
|
onOpenChange,
|
|
36338
36703
|
contentClassName: "p-2",
|
|
36339
36704
|
items,
|
|
36340
|
-
trigger: /* @__PURE__ */
|
|
36705
|
+
trigger: /* @__PURE__ */ jsx90(
|
|
36341
36706
|
"button",
|
|
36342
36707
|
{
|
|
36343
36708
|
type: "button",
|
|
@@ -36353,7 +36718,7 @@ function TableControlMenu({
|
|
|
36353
36718
|
transform: shown ? "scale(1)" : "scale(0.82)",
|
|
36354
36719
|
pointerEvents: shown ? "auto" : "none"
|
|
36355
36720
|
},
|
|
36356
|
-
children: /* @__PURE__ */
|
|
36721
|
+
children: /* @__PURE__ */ jsx90(MoreHorizontal2, { className: "h-4 w-4" })
|
|
36357
36722
|
}
|
|
36358
36723
|
)
|
|
36359
36724
|
}
|
|
@@ -36366,7 +36731,7 @@ function TableControlMenu({
|
|
|
36366
36731
|
|
|
36367
36732
|
// src/components/UEditor/table-axis-handles.tsx
|
|
36368
36733
|
import { GripHorizontal, GripVertical as GripVertical3 } from "lucide-react";
|
|
36369
|
-
import { Fragment as Fragment33, jsx as
|
|
36734
|
+
import { Fragment as Fragment33, jsx as jsx91 } from "react/jsx-runtime";
|
|
36370
36735
|
var IDLE_HANDLE_SCALE = "0.78";
|
|
36371
36736
|
function TableRowHandles({
|
|
36372
36737
|
activeRowIndex,
|
|
@@ -36380,12 +36745,12 @@ function TableRowHandles({
|
|
|
36380
36745
|
rowHandleLeft,
|
|
36381
36746
|
rowHandles
|
|
36382
36747
|
}) {
|
|
36383
|
-
return /* @__PURE__ */
|
|
36748
|
+
return /* @__PURE__ */ jsx91(Fragment33, { children: rowHandles.map((rowHandle) => {
|
|
36384
36749
|
const menuKey = `row:${rowHandle.index}`;
|
|
36385
36750
|
const isActive = rowHandle.index === activeRowIndex;
|
|
36386
36751
|
const visible = controlsVisible || hoverRowHandleIndex === rowHandle.index || openMenuKey === menuKey;
|
|
36387
36752
|
const isShown = visible || isActive;
|
|
36388
|
-
return /* @__PURE__ */
|
|
36753
|
+
return /* @__PURE__ */ jsx91(
|
|
36389
36754
|
"div",
|
|
36390
36755
|
{
|
|
36391
36756
|
className: "absolute z-30",
|
|
@@ -36394,13 +36759,13 @@ function TableRowHandles({
|
|
|
36394
36759
|
top: Math.max(8, rowHandle.center - 12),
|
|
36395
36760
|
left: rowHandleLeft
|
|
36396
36761
|
},
|
|
36397
|
-
children: /* @__PURE__ */
|
|
36762
|
+
children: /* @__PURE__ */ jsx91(
|
|
36398
36763
|
Tooltip,
|
|
36399
36764
|
{
|
|
36400
36765
|
placement: "right",
|
|
36401
36766
|
disabled: openMenuKey === menuKey || !visible && isActive,
|
|
36402
|
-
content: /* @__PURE__ */
|
|
36403
|
-
children: /* @__PURE__ */
|
|
36767
|
+
content: /* @__PURE__ */ jsx91("span", { className: "text-xs font-medium", children: `${rowDragLabel} ${rowHandle.index + 1}` }),
|
|
36768
|
+
children: /* @__PURE__ */ jsx91("span", { className: "inline-flex", children: /* @__PURE__ */ jsx91(
|
|
36404
36769
|
DropdownMenu,
|
|
36405
36770
|
{
|
|
36406
36771
|
placement: "right",
|
|
@@ -36408,7 +36773,7 @@ function TableRowHandles({
|
|
|
36408
36773
|
onOpenChange: (open) => onOpenMenuChange(menuKey, open),
|
|
36409
36774
|
contentClassName: "p-2",
|
|
36410
36775
|
items: getMenuItems(rowHandle),
|
|
36411
|
-
trigger: /* @__PURE__ */
|
|
36776
|
+
trigger: /* @__PURE__ */ jsx91(
|
|
36412
36777
|
"button",
|
|
36413
36778
|
{
|
|
36414
36779
|
type: "button",
|
|
@@ -36427,7 +36792,7 @@ function TableRowHandles({
|
|
|
36427
36792
|
transform: isShown ? "scale(1)" : `scale(${IDLE_HANDLE_SCALE})`,
|
|
36428
36793
|
pointerEvents: isShown ? "auto" : "none"
|
|
36429
36794
|
},
|
|
36430
|
-
children: visible ? /* @__PURE__ */
|
|
36795
|
+
children: visible ? /* @__PURE__ */ jsx91(GripVertical3, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx91("div", { className: "h-3 w-1 rounded-full bg-muted-foreground/50 hover:bg-muted-foreground" })
|
|
36431
36796
|
}
|
|
36432
36797
|
)
|
|
36433
36798
|
}
|
|
@@ -36451,12 +36816,12 @@ function TableColumnHandles({
|
|
|
36451
36816
|
onStartDrag,
|
|
36452
36817
|
openMenuKey
|
|
36453
36818
|
}) {
|
|
36454
|
-
return /* @__PURE__ */
|
|
36819
|
+
return /* @__PURE__ */ jsx91(Fragment33, { children: columnHandles.map((columnHandle) => {
|
|
36455
36820
|
const menuKey = `column:${columnHandle.index}`;
|
|
36456
36821
|
const isActive = columnHandle.index === activeColumnIndex;
|
|
36457
36822
|
const visible = controlsVisible || hoverColumnHandleIndex === columnHandle.index || openMenuKey === menuKey;
|
|
36458
36823
|
const isShown = visible || isActive;
|
|
36459
|
-
return /* @__PURE__ */
|
|
36824
|
+
return /* @__PURE__ */ jsx91(
|
|
36460
36825
|
"div",
|
|
36461
36826
|
{
|
|
36462
36827
|
className: "absolute z-30",
|
|
@@ -36465,13 +36830,13 @@ function TableColumnHandles({
|
|
|
36465
36830
|
top: columnHandleTop,
|
|
36466
36831
|
left: Math.max(8, columnHandle.center - 12)
|
|
36467
36832
|
},
|
|
36468
|
-
children: /* @__PURE__ */
|
|
36833
|
+
children: /* @__PURE__ */ jsx91(
|
|
36469
36834
|
Tooltip,
|
|
36470
36835
|
{
|
|
36471
36836
|
placement: "top",
|
|
36472
36837
|
disabled: openMenuKey === menuKey || !visible && isActive,
|
|
36473
|
-
content: /* @__PURE__ */
|
|
36474
|
-
children: /* @__PURE__ */
|
|
36838
|
+
content: /* @__PURE__ */ jsx91("span", { className: "text-xs font-medium", children: `${columnDragLabel} ${columnHandle.index + 1}` }),
|
|
36839
|
+
children: /* @__PURE__ */ jsx91("span", { className: "inline-flex", children: /* @__PURE__ */ jsx91(
|
|
36475
36840
|
DropdownMenu,
|
|
36476
36841
|
{
|
|
36477
36842
|
placement: "bottom-start",
|
|
@@ -36479,7 +36844,7 @@ function TableColumnHandles({
|
|
|
36479
36844
|
onOpenChange: (open) => onOpenMenuChange(menuKey, open),
|
|
36480
36845
|
contentClassName: "p-2",
|
|
36481
36846
|
items: getMenuItems(columnHandle),
|
|
36482
|
-
trigger: /* @__PURE__ */
|
|
36847
|
+
trigger: /* @__PURE__ */ jsx91(
|
|
36483
36848
|
"button",
|
|
36484
36849
|
{
|
|
36485
36850
|
type: "button",
|
|
@@ -36498,7 +36863,7 @@ function TableColumnHandles({
|
|
|
36498
36863
|
transform: isShown ? "scale(1)" : `scale(${IDLE_HANDLE_SCALE})`,
|
|
36499
36864
|
pointerEvents: isShown ? "auto" : "none"
|
|
36500
36865
|
},
|
|
36501
|
-
children: visible ? /* @__PURE__ */
|
|
36866
|
+
children: visible ? /* @__PURE__ */ jsx91(GripHorizontal, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx91("div", { className: "h-1 w-3 rounded-full bg-muted-foreground/50 hover:bg-muted-foreground" })
|
|
36502
36867
|
}
|
|
36503
36868
|
)
|
|
36504
36869
|
}
|
|
@@ -36512,7 +36877,7 @@ function TableColumnHandles({
|
|
|
36512
36877
|
}
|
|
36513
36878
|
|
|
36514
36879
|
// src/components/UEditor/table-controls.tsx
|
|
36515
|
-
import { Fragment as Fragment34, jsx as
|
|
36880
|
+
import { Fragment as Fragment34, jsx as jsx92, jsxs as jsxs77 } from "react/jsx-runtime";
|
|
36516
36881
|
var TABLE_MENU_TOP_OFFSET = 10;
|
|
36517
36882
|
function nearestIndex(centers, position) {
|
|
36518
36883
|
let bestIndex = 0;
|
|
@@ -36538,17 +36903,17 @@ function getSelectedCell(editor) {
|
|
|
36538
36903
|
}
|
|
36539
36904
|
function TableControls({ editor, containerRef }) {
|
|
36540
36905
|
const t = useSmartTranslations("UEditor");
|
|
36541
|
-
const [layout, setLayout] =
|
|
36542
|
-
const [dragPreview, setDragPreview] =
|
|
36543
|
-
const [hoverState, setHoverState] =
|
|
36544
|
-
const [openMenuKey, setOpenMenuKey] =
|
|
36545
|
-
const layoutRef =
|
|
36546
|
-
const dragStateRef =
|
|
36547
|
-
const syncFrameRef =
|
|
36548
|
-
|
|
36906
|
+
const [layout, setLayout] = React79.useState(null);
|
|
36907
|
+
const [dragPreview, setDragPreview] = React79.useState(null);
|
|
36908
|
+
const [hoverState, setHoverState] = React79.useState(DEFAULT_TABLE_HOVER_STATE);
|
|
36909
|
+
const [openMenuKey, setOpenMenuKey] = React79.useState(null);
|
|
36910
|
+
const layoutRef = React79.useRef(null);
|
|
36911
|
+
const dragStateRef = React79.useRef(null);
|
|
36912
|
+
const syncFrameRef = React79.useRef(null);
|
|
36913
|
+
React79.useEffect(() => {
|
|
36549
36914
|
layoutRef.current = layout;
|
|
36550
36915
|
}, [layout]);
|
|
36551
|
-
const syncFromCell =
|
|
36916
|
+
const syncFromCell = React79.useCallback((cell) => {
|
|
36552
36917
|
const surface = containerRef.current;
|
|
36553
36918
|
if (!surface || !cell) {
|
|
36554
36919
|
setLayout(null);
|
|
@@ -36556,23 +36921,23 @@ function TableControls({ editor, containerRef }) {
|
|
|
36556
36921
|
}
|
|
36557
36922
|
setLayout(buildTableControlLayout(editor, surface, cell));
|
|
36558
36923
|
}, [containerRef, editor]);
|
|
36559
|
-
const syncFromSelection =
|
|
36924
|
+
const syncFromSelection = React79.useCallback(() => {
|
|
36560
36925
|
syncFromCell(getSelectedCell(editor));
|
|
36561
36926
|
}, [editor, syncFromCell]);
|
|
36562
|
-
const scheduleSyncFromSelection =
|
|
36927
|
+
const scheduleSyncFromSelection = React79.useCallback(() => {
|
|
36563
36928
|
if (syncFrameRef.current !== null) return;
|
|
36564
36929
|
syncFrameRef.current = window.requestAnimationFrame(() => {
|
|
36565
36930
|
syncFrameRef.current = null;
|
|
36566
36931
|
syncFromSelection();
|
|
36567
36932
|
});
|
|
36568
36933
|
}, [syncFromSelection]);
|
|
36569
|
-
|
|
36934
|
+
React79.useEffect(() => () => {
|
|
36570
36935
|
if (syncFrameRef.current !== null) {
|
|
36571
36936
|
window.cancelAnimationFrame(syncFrameRef.current);
|
|
36572
36937
|
syncFrameRef.current = null;
|
|
36573
36938
|
}
|
|
36574
36939
|
}, []);
|
|
36575
|
-
const refreshCurrentLayout =
|
|
36940
|
+
const refreshCurrentLayout = React79.useCallback(() => {
|
|
36576
36941
|
setLayout((prev) => {
|
|
36577
36942
|
if (!prev) return prev;
|
|
36578
36943
|
const surface = containerRef.current;
|
|
@@ -36582,12 +36947,12 @@ function TableControls({ editor, containerRef }) {
|
|
|
36582
36947
|
return cell ? buildTableControlLayout(editor, surface, cell) : null;
|
|
36583
36948
|
});
|
|
36584
36949
|
}, [containerRef, editor]);
|
|
36585
|
-
const clearDrag =
|
|
36950
|
+
const clearDrag = React79.useCallback(() => {
|
|
36586
36951
|
dragStateRef.current = null;
|
|
36587
36952
|
setDragPreview(null);
|
|
36588
36953
|
document.body.style.cursor = "";
|
|
36589
36954
|
}, []);
|
|
36590
|
-
const updateHoverState =
|
|
36955
|
+
const updateHoverState = React79.useCallback((event) => {
|
|
36591
36956
|
const activeLayout = layoutRef.current;
|
|
36592
36957
|
const surface = containerRef.current;
|
|
36593
36958
|
if (!activeLayout || !surface || dragStateRef.current) {
|
|
@@ -36603,7 +36968,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
36603
36968
|
return areTableHoverStatesEqual(prev, nextState) ? prev : nextState;
|
|
36604
36969
|
});
|
|
36605
36970
|
}, [containerRef]);
|
|
36606
|
-
|
|
36971
|
+
React79.useEffect(() => {
|
|
36607
36972
|
const proseMirror = editor.view.dom;
|
|
36608
36973
|
const surface = containerRef.current;
|
|
36609
36974
|
if (!surface) return void 0;
|
|
@@ -36654,37 +37019,37 @@ function TableControls({ editor, containerRef }) {
|
|
|
36654
37019
|
editor.off("update", refreshCurrentLayout);
|
|
36655
37020
|
};
|
|
36656
37021
|
}, [clearDrag, containerRef, editor, refreshCurrentLayout, syncFromCell, syncFromSelection, updateHoverState]);
|
|
36657
|
-
const runAtCellPos =
|
|
37022
|
+
const runAtCellPos = React79.useCallback((cellPos, command, options) => {
|
|
36658
37023
|
const result = runTableCommandAtCellPos(editor, cellPos, command);
|
|
36659
37024
|
if (options?.sync !== false) {
|
|
36660
37025
|
scheduleSyncFromSelection();
|
|
36661
37026
|
}
|
|
36662
37027
|
return result;
|
|
36663
37028
|
}, [editor, scheduleSyncFromSelection]);
|
|
36664
|
-
const runAtActiveCell =
|
|
37029
|
+
const runAtActiveCell = React79.useCallback((command, options) => {
|
|
36665
37030
|
return runAtCellPos(layoutRef.current?.cellPos ?? null, command, options);
|
|
36666
37031
|
}, [runAtCellPos]);
|
|
36667
|
-
const duplicateRowAt =
|
|
37032
|
+
const duplicateRowAt = React79.useCallback((rowIndex, cellPos) => {
|
|
36668
37033
|
const result = duplicateTableRowAt(editor, rowIndex, cellPos);
|
|
36669
37034
|
scheduleSyncFromSelection();
|
|
36670
37035
|
return result;
|
|
36671
37036
|
}, [editor, scheduleSyncFromSelection]);
|
|
36672
|
-
const clearRowAt =
|
|
37037
|
+
const clearRowAt = React79.useCallback((rowIndex, cellPos) => {
|
|
36673
37038
|
const result = clearTableRowAt(editor, rowIndex, cellPos);
|
|
36674
37039
|
scheduleSyncFromSelection();
|
|
36675
37040
|
return result;
|
|
36676
37041
|
}, [editor, scheduleSyncFromSelection]);
|
|
36677
|
-
const duplicateColumnAt =
|
|
37042
|
+
const duplicateColumnAt = React79.useCallback((columnIndex, cellPos) => {
|
|
36678
37043
|
const result = duplicateTableColumnAt(editor, columnIndex, cellPos);
|
|
36679
37044
|
scheduleSyncFromSelection();
|
|
36680
37045
|
return result;
|
|
36681
37046
|
}, [editor, scheduleSyncFromSelection]);
|
|
36682
|
-
const clearColumnAt =
|
|
37047
|
+
const clearColumnAt = React79.useCallback((columnIndex, cellPos) => {
|
|
36683
37048
|
const result = clearTableColumnAt(editor, columnIndex, cellPos);
|
|
36684
37049
|
scheduleSyncFromSelection();
|
|
36685
37050
|
return result;
|
|
36686
37051
|
}, [editor, scheduleSyncFromSelection]);
|
|
36687
|
-
const expandTableBy =
|
|
37052
|
+
const expandTableBy = React79.useCallback((rows, cols) => {
|
|
36688
37053
|
const activeCellPos = layoutRef.current?.cellPos ?? editor.state.selection.from;
|
|
36689
37054
|
const result = expandTableFromCell(editor, activeCellPos, rows, cols);
|
|
36690
37055
|
scheduleSyncFromSelection();
|
|
@@ -36693,19 +37058,19 @@ function TableControls({ editor, containerRef }) {
|
|
|
36693
37058
|
const canExpandTable = Boolean(layout);
|
|
36694
37059
|
const controlsVisible = dragPreview !== null;
|
|
36695
37060
|
const tableMenuOpen = openMenuKey === "table";
|
|
36696
|
-
const startAddColumnDrag =
|
|
37061
|
+
const startAddColumnDrag = React79.useCallback(() => {
|
|
36697
37062
|
setOpenMenuKey(null);
|
|
36698
37063
|
dragStateRef.current = { kind: "add-column", previewCols: 1 };
|
|
36699
37064
|
setDragPreview({ kind: "add-column", previewCols: 1 });
|
|
36700
37065
|
document.body.style.cursor = "ew-resize";
|
|
36701
37066
|
}, []);
|
|
36702
|
-
const startAddRowDrag =
|
|
37067
|
+
const startAddRowDrag = React79.useCallback(() => {
|
|
36703
37068
|
setOpenMenuKey(null);
|
|
36704
37069
|
dragStateRef.current = { kind: "add-row", previewRows: 1 };
|
|
36705
37070
|
setDragPreview({ kind: "add-row", previewRows: 1 });
|
|
36706
37071
|
document.body.style.cursor = "ns-resize";
|
|
36707
37072
|
}, []);
|
|
36708
|
-
const startRowDrag =
|
|
37073
|
+
const startRowDrag = React79.useCallback((rowHandle) => {
|
|
36709
37074
|
setOpenMenuKey(null);
|
|
36710
37075
|
dragStateRef.current = {
|
|
36711
37076
|
kind: "row",
|
|
@@ -36722,7 +37087,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
36722
37087
|
});
|
|
36723
37088
|
document.body.style.cursor = "grabbing";
|
|
36724
37089
|
}, []);
|
|
36725
|
-
const startColumnDrag =
|
|
37090
|
+
const startColumnDrag = React79.useCallback((columnHandle) => {
|
|
36726
37091
|
setOpenMenuKey(null);
|
|
36727
37092
|
dragStateRef.current = {
|
|
36728
37093
|
kind: "column",
|
|
@@ -36739,7 +37104,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
36739
37104
|
});
|
|
36740
37105
|
document.body.style.cursor = "grabbing";
|
|
36741
37106
|
}, []);
|
|
36742
|
-
|
|
37107
|
+
React79.useEffect(() => {
|
|
36743
37108
|
const handleMouseMove = (event) => {
|
|
36744
37109
|
const dragState = dragStateRef.current;
|
|
36745
37110
|
const activeLayout = layoutRef.current;
|
|
@@ -36828,7 +37193,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
36828
37193
|
window.removeEventListener("blur", clearDrag);
|
|
36829
37194
|
};
|
|
36830
37195
|
}, [clearDrag, containerRef, editor, expandTableBy, scheduleSyncFromSelection]);
|
|
36831
|
-
const menuItems =
|
|
37196
|
+
const menuItems = React79.useMemo(() => {
|
|
36832
37197
|
if (!layout) return [];
|
|
36833
37198
|
return [
|
|
36834
37199
|
{
|
|
@@ -36896,7 +37261,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
36896
37261
|
}
|
|
36897
37262
|
];
|
|
36898
37263
|
}, [layout, runAtActiveCell, t]);
|
|
36899
|
-
const getRowHandleMenuItems =
|
|
37264
|
+
const getRowHandleMenuItems = React79.useCallback((rowHandle) => [
|
|
36900
37265
|
{
|
|
36901
37266
|
label: t("tableMenu.addRowBefore"),
|
|
36902
37267
|
icon: ArrowUp2,
|
|
@@ -36924,7 +37289,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
36924
37289
|
destructive: true
|
|
36925
37290
|
}
|
|
36926
37291
|
], [clearRowAt, duplicateRowAt, runAtCellPos, t]);
|
|
36927
|
-
const getColumnHandleMenuItems =
|
|
37292
|
+
const getColumnHandleMenuItems = React79.useCallback((columnHandle) => [
|
|
36928
37293
|
{
|
|
36929
37294
|
label: t("tableMenu.addColumnBefore"),
|
|
36930
37295
|
icon: ArrowLeft2,
|
|
@@ -36959,8 +37324,8 @@ function TableControls({ editor, containerRef }) {
|
|
|
36959
37324
|
const menuLeft = Math.max(8, layout.tableLeft);
|
|
36960
37325
|
const rowHandleLeft = layout.tableLeft - 12;
|
|
36961
37326
|
const columnHandleTop = layout.tableTop - 12;
|
|
36962
|
-
return /* @__PURE__ */
|
|
36963
|
-
/* @__PURE__ */
|
|
37327
|
+
return /* @__PURE__ */ jsxs77(Fragment34, { children: [
|
|
37328
|
+
/* @__PURE__ */ jsx92(
|
|
36964
37329
|
TableRowHandles,
|
|
36965
37330
|
{
|
|
36966
37331
|
activeRowIndex: layout.activeRowIndex,
|
|
@@ -36977,7 +37342,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
36977
37342
|
rowHandles: layout.rowHandles
|
|
36978
37343
|
}
|
|
36979
37344
|
),
|
|
36980
|
-
/* @__PURE__ */
|
|
37345
|
+
/* @__PURE__ */ jsx92(
|
|
36981
37346
|
TableColumnHandles,
|
|
36982
37347
|
{
|
|
36983
37348
|
activeColumnIndex: layout.activeColumnIndex,
|
|
@@ -36994,7 +37359,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
36994
37359
|
openMenuKey
|
|
36995
37360
|
}
|
|
36996
37361
|
),
|
|
36997
|
-
/* @__PURE__ */
|
|
37362
|
+
/* @__PURE__ */ jsx92(
|
|
36998
37363
|
TableControlMenu,
|
|
36999
37364
|
{
|
|
37000
37365
|
controlsVisible,
|
|
@@ -37009,7 +37374,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
37009
37374
|
top: menuTop
|
|
37010
37375
|
}
|
|
37011
37376
|
),
|
|
37012
|
-
/* @__PURE__ */
|
|
37377
|
+
/* @__PURE__ */ jsx92(
|
|
37013
37378
|
TableAddRails,
|
|
37014
37379
|
{
|
|
37015
37380
|
addColumnVisible: hoverState.addColumnVisible,
|
|
@@ -37023,7 +37388,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
37023
37388
|
quickAddRowLabel: t("tableMenu.quickAddRowAfter")
|
|
37024
37389
|
}
|
|
37025
37390
|
),
|
|
37026
|
-
/* @__PURE__ */
|
|
37391
|
+
/* @__PURE__ */ jsx92(
|
|
37027
37392
|
TableDragPreview,
|
|
37028
37393
|
{
|
|
37029
37394
|
columnDragLabel: t("tableMenu.dragColumn"),
|
|
@@ -37194,10 +37559,10 @@ var UEDITOR_PROSEMIRROR_CLASS_NAME = cn(
|
|
|
37194
37559
|
);
|
|
37195
37560
|
|
|
37196
37561
|
// src/components/UEditor/use-table-interactions.ts
|
|
37197
|
-
import
|
|
37562
|
+
import React81, { useEffect as useEffect37, useRef as useRef35 } from "react";
|
|
37198
37563
|
|
|
37199
37564
|
// src/components/UEditor/use-table-row-resize.ts
|
|
37200
|
-
import
|
|
37565
|
+
import React80, { useRef as useRef34 } from "react";
|
|
37201
37566
|
function useTableRowResize({
|
|
37202
37567
|
editor,
|
|
37203
37568
|
setHoveredTableCell,
|
|
@@ -37208,7 +37573,7 @@ function useTableRowResize({
|
|
|
37208
37573
|
}) {
|
|
37209
37574
|
const commitFrameRef = useRef34(null);
|
|
37210
37575
|
const stateRef = useRef34(null);
|
|
37211
|
-
const commitPreview =
|
|
37576
|
+
const commitPreview = React80.useCallback(() => {
|
|
37212
37577
|
if (!editor) return;
|
|
37213
37578
|
const state = stateRef.current;
|
|
37214
37579
|
if (!state) return;
|
|
@@ -37243,22 +37608,22 @@ function useTableRowResize({
|
|
|
37243
37608
|
showRowGuide(state.tableElement, state.rowElement, state.cellElement);
|
|
37244
37609
|
scheduleTableLayoutSync();
|
|
37245
37610
|
}, [editor, scheduleTableLayoutSync, showRowGuide]);
|
|
37246
|
-
const scheduleCommit =
|
|
37611
|
+
const scheduleCommit = React80.useCallback(() => {
|
|
37247
37612
|
if (commitFrameRef.current !== null) return;
|
|
37248
37613
|
commitFrameRef.current = window.requestAnimationFrame(() => {
|
|
37249
37614
|
commitFrameRef.current = null;
|
|
37250
37615
|
commitPreview();
|
|
37251
37616
|
});
|
|
37252
37617
|
}, [commitPreview]);
|
|
37253
|
-
const syncActiveGuide =
|
|
37618
|
+
const syncActiveGuide = React80.useCallback(() => {
|
|
37254
37619
|
const state = stateRef.current;
|
|
37255
37620
|
if (!state) return false;
|
|
37256
37621
|
setHoveredTableCell(state.cellElement);
|
|
37257
37622
|
showRowGuide(state.tableElement, state.rowElement, state.cellElement);
|
|
37258
37623
|
return true;
|
|
37259
37624
|
}, [setHoveredTableCell, showRowGuide]);
|
|
37260
|
-
const isResizing =
|
|
37261
|
-
const beginResize =
|
|
37625
|
+
const isResizing = React80.useCallback(() => stateRef.current !== null, []);
|
|
37626
|
+
const beginResize = React80.useCallback((event, table, row, cell) => {
|
|
37262
37627
|
if (!editor || !isRowResizeHotspot(cell, event.clientX, event.clientY)) {
|
|
37263
37628
|
return false;
|
|
37264
37629
|
}
|
|
@@ -37284,7 +37649,7 @@ function useTableRowResize({
|
|
|
37284
37649
|
event.stopPropagation();
|
|
37285
37650
|
return true;
|
|
37286
37651
|
}, [editor, setHoveredTableCell, showRowGuide]);
|
|
37287
|
-
const handlePointerMove =
|
|
37652
|
+
const handlePointerMove = React80.useCallback((event) => {
|
|
37288
37653
|
const state = stateRef.current;
|
|
37289
37654
|
if (!state) return;
|
|
37290
37655
|
const nextHeight = Math.max(
|
|
@@ -37300,7 +37665,7 @@ function useTableRowResize({
|
|
|
37300
37665
|
document.body.style.cursor = "row-resize";
|
|
37301
37666
|
scheduleCommit();
|
|
37302
37667
|
}, [scheduleCommit, showRowGuide]);
|
|
37303
|
-
const handlePointerUp =
|
|
37668
|
+
const handlePointerUp = React80.useCallback((event) => {
|
|
37304
37669
|
if (!editor) return;
|
|
37305
37670
|
const state = stateRef.current;
|
|
37306
37671
|
if (!state) return;
|
|
@@ -37330,7 +37695,7 @@ function useTableRowResize({
|
|
|
37330
37695
|
clearAllTableResizeHover();
|
|
37331
37696
|
scheduleTableLayoutSync();
|
|
37332
37697
|
}, [clearAllTableResizeHover, clearHoveredTableCell, commitPreview, editor, scheduleTableLayoutSync]);
|
|
37333
|
-
const cancelResize =
|
|
37698
|
+
const cancelResize = React80.useCallback(() => {
|
|
37334
37699
|
if (!stateRef.current) return;
|
|
37335
37700
|
if (commitFrameRef.current !== null) {
|
|
37336
37701
|
window.cancelAnimationFrame(commitFrameRef.current);
|
|
@@ -37342,7 +37707,7 @@ function useTableRowResize({
|
|
|
37342
37707
|
clearAllTableResizeHover();
|
|
37343
37708
|
scheduleTableLayoutSync();
|
|
37344
37709
|
}, [clearAllTableResizeHover, clearHoveredTableCell, scheduleTableLayoutSync]);
|
|
37345
|
-
const cleanup =
|
|
37710
|
+
const cleanup = React80.useCallback(() => {
|
|
37346
37711
|
if (commitFrameRef.current !== null) {
|
|
37347
37712
|
window.cancelAnimationFrame(commitFrameRef.current);
|
|
37348
37713
|
commitFrameRef.current = null;
|
|
@@ -37371,16 +37736,16 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
37371
37736
|
const activeTableCellRef = useRef35(null);
|
|
37372
37737
|
const suppressActiveCellHighlightRef = useRef35(false);
|
|
37373
37738
|
const tableLayoutSyncFrameRef = useRef35(null);
|
|
37374
|
-
const getProseMirrorElement =
|
|
37739
|
+
const getProseMirrorElement = React81.useCallback(() => {
|
|
37375
37740
|
return editorContentRef.current?.querySelector(".ProseMirror");
|
|
37376
37741
|
}, []);
|
|
37377
|
-
const setEditorResizeCursor =
|
|
37742
|
+
const setEditorResizeCursor = React81.useCallback((cursor) => {
|
|
37378
37743
|
const proseMirror = getProseMirrorElement();
|
|
37379
37744
|
if (proseMirror) {
|
|
37380
37745
|
proseMirror.style.cursor = cursor;
|
|
37381
37746
|
}
|
|
37382
37747
|
}, [getProseMirrorElement]);
|
|
37383
|
-
const hideColumnGuide =
|
|
37748
|
+
const hideColumnGuide = React81.useCallback(() => {
|
|
37384
37749
|
editorContentRef.current?.classList.remove("resize-cursor");
|
|
37385
37750
|
getProseMirrorElement()?.classList.remove("resize-cursor");
|
|
37386
37751
|
const guide = tableColumnGuideRef.current;
|
|
@@ -37388,7 +37753,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
37388
37753
|
guide.style.opacity = "0";
|
|
37389
37754
|
}
|
|
37390
37755
|
}, [getProseMirrorElement]);
|
|
37391
|
-
const hideRowGuide =
|
|
37756
|
+
const hideRowGuide = React81.useCallback(() => {
|
|
37392
37757
|
editorContentRef.current?.classList.remove("resize-row-cursor");
|
|
37393
37758
|
getProseMirrorElement()?.classList.remove("resize-row-cursor");
|
|
37394
37759
|
const guide = tableRowGuideRef.current;
|
|
@@ -37396,12 +37761,12 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
37396
37761
|
guide.style.opacity = "0";
|
|
37397
37762
|
}
|
|
37398
37763
|
}, [getProseMirrorElement]);
|
|
37399
|
-
const clearAllTableResizeHover =
|
|
37764
|
+
const clearAllTableResizeHover = React81.useCallback(() => {
|
|
37400
37765
|
setEditorResizeCursor("");
|
|
37401
37766
|
hideColumnGuide();
|
|
37402
37767
|
hideRowGuide();
|
|
37403
37768
|
}, [hideColumnGuide, hideRowGuide, setEditorResizeCursor]);
|
|
37404
|
-
const updateActiveCellHighlight =
|
|
37769
|
+
const updateActiveCellHighlight = React81.useCallback((cell) => {
|
|
37405
37770
|
const surface = editorContentRef.current;
|
|
37406
37771
|
const highlight = activeTableCellHighlightRef.current;
|
|
37407
37772
|
if (!highlight) return;
|
|
@@ -37416,7 +37781,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
37416
37781
|
highlight.style.width = `${metrics.width}px`;
|
|
37417
37782
|
highlight.style.height = `${metrics.height}px`;
|
|
37418
37783
|
}, []);
|
|
37419
|
-
const scheduleTableLayoutSync =
|
|
37784
|
+
const scheduleTableLayoutSync = React81.useCallback(() => {
|
|
37420
37785
|
if (tableLayoutSyncFrameRef.current !== null) return;
|
|
37421
37786
|
tableLayoutSyncFrameRef.current = window.requestAnimationFrame(() => {
|
|
37422
37787
|
tableLayoutSyncFrameRef.current = null;
|
|
@@ -37424,7 +37789,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
37424
37789
|
editorContentRef.current?.dispatchEvent(new CustomEvent(UEDITOR_TABLE_LAYOUT_CHANGE_EVENT));
|
|
37425
37790
|
});
|
|
37426
37791
|
}, [updateActiveCellHighlight]);
|
|
37427
|
-
const setActiveTableCell =
|
|
37792
|
+
const setActiveTableCell = React81.useCallback((cell) => {
|
|
37428
37793
|
if (activeTableCellRef.current === cell) {
|
|
37429
37794
|
updateActiveCellHighlight(cell);
|
|
37430
37795
|
return;
|
|
@@ -37432,17 +37797,17 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
37432
37797
|
activeTableCellRef.current = cell;
|
|
37433
37798
|
updateActiveCellHighlight(activeTableCellRef.current);
|
|
37434
37799
|
}, [updateActiveCellHighlight]);
|
|
37435
|
-
const clearActiveTableCell =
|
|
37800
|
+
const clearActiveTableCell = React81.useCallback(() => {
|
|
37436
37801
|
activeTableCellRef.current = null;
|
|
37437
37802
|
updateActiveCellHighlight(null);
|
|
37438
37803
|
}, [updateActiveCellHighlight]);
|
|
37439
|
-
const setHoveredTableCell =
|
|
37804
|
+
const setHoveredTableCell = React81.useCallback((cell) => {
|
|
37440
37805
|
hoveredTableCellRef.current = cell;
|
|
37441
37806
|
}, []);
|
|
37442
|
-
const clearHoveredTableCell =
|
|
37807
|
+
const clearHoveredTableCell = React81.useCallback(() => {
|
|
37443
37808
|
hoveredTableCellRef.current = null;
|
|
37444
37809
|
}, []);
|
|
37445
|
-
const showColumnGuide =
|
|
37810
|
+
const showColumnGuide = React81.useCallback((table, row, cell) => {
|
|
37446
37811
|
const surface = editorContentRef.current;
|
|
37447
37812
|
const guide = tableColumnGuideRef.current;
|
|
37448
37813
|
if (!surface || !guide) return;
|
|
@@ -37456,7 +37821,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
37456
37821
|
getProseMirrorElement()?.classList.add("resize-cursor");
|
|
37457
37822
|
setEditorResizeCursor("col-resize");
|
|
37458
37823
|
}, [getProseMirrorElement, setEditorResizeCursor]);
|
|
37459
|
-
const showRowGuide =
|
|
37824
|
+
const showRowGuide = React81.useCallback((table, row, cell) => {
|
|
37460
37825
|
const surface = editorContentRef.current;
|
|
37461
37826
|
const guide = tableRowGuideRef.current;
|
|
37462
37827
|
if (!surface || !guide) return;
|
|
@@ -37486,7 +37851,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
37486
37851
|
clearAllTableResizeHover,
|
|
37487
37852
|
scheduleTableLayoutSync
|
|
37488
37853
|
});
|
|
37489
|
-
const syncActiveTableCellFromSelection =
|
|
37854
|
+
const syncActiveTableCellFromSelection = React81.useCallback(() => {
|
|
37490
37855
|
if (!editor) return;
|
|
37491
37856
|
if (!editor.isFocused) {
|
|
37492
37857
|
clearActiveTableCell();
|
|
@@ -37667,7 +38032,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
37667
38032
|
}
|
|
37668
38033
|
|
|
37669
38034
|
// src/components/UEditor/menu-bar.tsx
|
|
37670
|
-
import
|
|
38035
|
+
import React82, { useRef as useRef36, useState as useState49 } from "react";
|
|
37671
38036
|
import { useEditorState as useEditorState3 } from "@tiptap/react";
|
|
37672
38037
|
import {
|
|
37673
38038
|
AlignCenter as AlignCenter4,
|
|
@@ -37698,14 +38063,14 @@ import {
|
|
|
37698
38063
|
Undo as UndoIcon2,
|
|
37699
38064
|
Upload as Upload4
|
|
37700
38065
|
} from "lucide-react";
|
|
37701
|
-
import { Fragment as Fragment35, jsx as
|
|
38066
|
+
import { Fragment as Fragment35, jsx as jsx93, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
37702
38067
|
function MenuTableInsertGrid({
|
|
37703
38068
|
insertLabel,
|
|
37704
38069
|
previewTemplate,
|
|
37705
38070
|
onInsert
|
|
37706
38071
|
}) {
|
|
37707
38072
|
const closeMenu = useDropdownMenuClose();
|
|
37708
|
-
return /* @__PURE__ */
|
|
38073
|
+
return /* @__PURE__ */ jsx93(
|
|
37709
38074
|
TableInsertGrid,
|
|
37710
38075
|
{
|
|
37711
38076
|
insertLabel,
|
|
@@ -37721,9 +38086,9 @@ function renderMenuItems(items) {
|
|
|
37721
38086
|
return items.map((item, i) => {
|
|
37722
38087
|
switch (item.type) {
|
|
37723
38088
|
case "separator":
|
|
37724
|
-
return /* @__PURE__ */
|
|
38089
|
+
return /* @__PURE__ */ jsx93(DropdownMenuSeparator, {}, i);
|
|
37725
38090
|
case "action":
|
|
37726
|
-
return /* @__PURE__ */
|
|
38091
|
+
return /* @__PURE__ */ jsx93(
|
|
37727
38092
|
DropdownMenuItem,
|
|
37728
38093
|
{
|
|
37729
38094
|
label: item.label,
|
|
@@ -37737,9 +38102,9 @@ function renderMenuItems(items) {
|
|
|
37737
38102
|
i
|
|
37738
38103
|
);
|
|
37739
38104
|
case "sub":
|
|
37740
|
-
return /* @__PURE__ */
|
|
38105
|
+
return /* @__PURE__ */ jsx93(DropdownMenuSub, { label: item.label, icon: item.icon, disabled: item.disabled, children: renderMenuItems(item.items) }, i);
|
|
37741
38106
|
case "custom":
|
|
37742
|
-
return /* @__PURE__ */
|
|
38107
|
+
return /* @__PURE__ */ jsx93(React82.Fragment, { children: item.render() }, item.key);
|
|
37743
38108
|
}
|
|
37744
38109
|
});
|
|
37745
38110
|
}
|
|
@@ -38041,7 +38406,7 @@ function buildTableMenuItems(t, editor, onInsertTable) {
|
|
|
38041
38406
|
{
|
|
38042
38407
|
type: "custom",
|
|
38043
38408
|
key: "table-insert-grid",
|
|
38044
|
-
render: () => /* @__PURE__ */
|
|
38409
|
+
render: () => /* @__PURE__ */ jsx93(
|
|
38045
38410
|
MenuTableInsertGrid,
|
|
38046
38411
|
{
|
|
38047
38412
|
insertLabel: t("tableMenu.insertTable"),
|
|
@@ -38137,8 +38502,8 @@ function buildTableMenuItems(t, editor, onInsertTable) {
|
|
|
38137
38502
|
}
|
|
38138
38503
|
];
|
|
38139
38504
|
}
|
|
38140
|
-
var MenuBarTrigger =
|
|
38141
|
-
({ children, className, ...props }, ref) => /* @__PURE__ */
|
|
38505
|
+
var MenuBarTrigger = React82.forwardRef(
|
|
38506
|
+
({ children, className, ...props }, ref) => /* @__PURE__ */ jsx93(
|
|
38142
38507
|
"button",
|
|
38143
38508
|
{
|
|
38144
38509
|
ref,
|
|
@@ -38240,9 +38605,9 @@ var MenuBar = ({
|
|
|
38240
38605
|
{
|
|
38241
38606
|
type: "custom",
|
|
38242
38607
|
key: "image",
|
|
38243
|
-
render: () => showImageInput ? /* @__PURE__ */
|
|
38244
|
-
/* @__PURE__ */
|
|
38245
|
-
/* @__PURE__ */
|
|
38608
|
+
render: () => showImageInput ? /* @__PURE__ */ jsx93(ImageInput, { onSubmit: handleImageUrl, onCancel: () => setShowImageInput(false) }) : /* @__PURE__ */ jsxs78(Fragment35, { children: [
|
|
38609
|
+
/* @__PURE__ */ jsx93(DropdownMenuItem, { label: t("menubar.image"), icon: ImageIcon3, onClick: () => setShowImageInput(true), closeOnSelect: false }),
|
|
38610
|
+
/* @__PURE__ */ jsx93(
|
|
38246
38611
|
DropdownMenuItem,
|
|
38247
38612
|
{
|
|
38248
38613
|
label: t("menubar.imageUpload"),
|
|
@@ -38257,7 +38622,7 @@ var MenuBar = ({
|
|
|
38257
38622
|
{
|
|
38258
38623
|
type: "custom",
|
|
38259
38624
|
key: "link",
|
|
38260
|
-
render: () => showLinkInput ? /* @__PURE__ */
|
|
38625
|
+
render: () => showLinkInput ? /* @__PURE__ */ jsx93(LinkInput, { onSubmit: handleLinkSubmit, onCancel: () => setShowLinkInput(false), initialUrl: editor.getAttributes("link").href ?? "" }) : /* @__PURE__ */ jsx93(
|
|
38261
38626
|
DropdownMenuItem,
|
|
38262
38627
|
{
|
|
38263
38628
|
label: t("menubar.link"),
|
|
@@ -38277,7 +38642,7 @@ var MenuBar = ({
|
|
|
38277
38642
|
{
|
|
38278
38643
|
type: "custom",
|
|
38279
38644
|
key: "table-grid",
|
|
38280
|
-
render: () => /* @__PURE__ */
|
|
38645
|
+
render: () => /* @__PURE__ */ jsx93(
|
|
38281
38646
|
MenuTableInsertGrid,
|
|
38282
38647
|
{
|
|
38283
38648
|
insertLabel: t("tableMenu.insertTable"),
|
|
@@ -38330,8 +38695,8 @@ var MenuBar = ({
|
|
|
38330
38695
|
},
|
|
38331
38696
|
{ label: t("menubar.table"), items: buildTableMenuItems(t, editor, handleInsertTable), open: void 0, onOpenChange: void 0 }
|
|
38332
38697
|
];
|
|
38333
|
-
return /* @__PURE__ */
|
|
38334
|
-
/* @__PURE__ */
|
|
38698
|
+
return /* @__PURE__ */ jsxs78(Fragment35, { children: [
|
|
38699
|
+
/* @__PURE__ */ jsx93(
|
|
38335
38700
|
"input",
|
|
38336
38701
|
{
|
|
38337
38702
|
ref: fileInputRef,
|
|
@@ -38342,11 +38707,11 @@ var MenuBar = ({
|
|
|
38342
38707
|
onChange: (e) => handleImageFiles(e.target.files)
|
|
38343
38708
|
}
|
|
38344
38709
|
),
|
|
38345
|
-
/* @__PURE__ */
|
|
38346
|
-
menus.map(({ label, items, open, onOpenChange }) => /* @__PURE__ */
|
|
38710
|
+
/* @__PURE__ */ jsxs78("div", { className: "flex items-center gap-0.5 border-b border-border/35 bg-muted/20 px-1.5 py-0.5", children: [
|
|
38711
|
+
menus.map(({ label, items, open, onOpenChange }) => /* @__PURE__ */ jsx93(
|
|
38347
38712
|
DropdownMenu,
|
|
38348
38713
|
{
|
|
38349
|
-
trigger: /* @__PURE__ */
|
|
38714
|
+
trigger: /* @__PURE__ */ jsx93(MenuBarTrigger, { children: label }),
|
|
38350
38715
|
placement: "bottom-start",
|
|
38351
38716
|
isOpen: open,
|
|
38352
38717
|
onOpenChange,
|
|
@@ -38354,7 +38719,7 @@ var MenuBar = ({
|
|
|
38354
38719
|
},
|
|
38355
38720
|
label
|
|
38356
38721
|
)),
|
|
38357
|
-
/* @__PURE__ */
|
|
38722
|
+
/* @__PURE__ */ jsx93(
|
|
38358
38723
|
"button",
|
|
38359
38724
|
{
|
|
38360
38725
|
type: "button",
|
|
@@ -38365,20 +38730,20 @@ var MenuBar = ({
|
|
|
38365
38730
|
"ml-auto inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors",
|
|
38366
38731
|
"hover:bg-accent hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1"
|
|
38367
38732
|
),
|
|
38368
|
-
children: /* @__PURE__ */
|
|
38733
|
+
children: /* @__PURE__ */ jsx93(Eye3, { className: "h-4 w-4", "aria-hidden": "true" })
|
|
38369
38734
|
}
|
|
38370
38735
|
)
|
|
38371
38736
|
] }),
|
|
38372
|
-
/* @__PURE__ */
|
|
38737
|
+
/* @__PURE__ */ jsx93(
|
|
38373
38738
|
Modal_default,
|
|
38374
38739
|
{
|
|
38375
38740
|
isOpen: showSourceDialog,
|
|
38376
38741
|
onClose: () => setShowSourceDialog(false),
|
|
38377
38742
|
title: t("menubar.sourceCode"),
|
|
38378
38743
|
size: "lg",
|
|
38379
|
-
children: /* @__PURE__ */
|
|
38380
|
-
/* @__PURE__ */
|
|
38381
|
-
/* @__PURE__ */
|
|
38744
|
+
children: /* @__PURE__ */ jsxs78("div", { className: "space-y-3", children: [
|
|
38745
|
+
/* @__PURE__ */ jsx93("p", { className: "text-xs text-muted-foreground", children: t("menubar.sourceCodeHint") }),
|
|
38746
|
+
/* @__PURE__ */ jsx93(
|
|
38382
38747
|
"textarea",
|
|
38383
38748
|
{
|
|
38384
38749
|
"data-testid": "source-code-textarea",
|
|
@@ -38388,8 +38753,8 @@ var MenuBar = ({
|
|
|
38388
38753
|
spellCheck: false
|
|
38389
38754
|
}
|
|
38390
38755
|
),
|
|
38391
|
-
/* @__PURE__ */
|
|
38392
|
-
/* @__PURE__ */
|
|
38756
|
+
/* @__PURE__ */ jsxs78("div", { className: "flex gap-2 justify-end", children: [
|
|
38757
|
+
/* @__PURE__ */ jsx93(
|
|
38393
38758
|
"button",
|
|
38394
38759
|
{
|
|
38395
38760
|
type: "button",
|
|
@@ -38398,7 +38763,7 @@ var MenuBar = ({
|
|
|
38398
38763
|
children: t("menubar.applySource")
|
|
38399
38764
|
}
|
|
38400
38765
|
),
|
|
38401
|
-
/* @__PURE__ */
|
|
38766
|
+
/* @__PURE__ */ jsx93(
|
|
38402
38767
|
"button",
|
|
38403
38768
|
{
|
|
38404
38769
|
type: "button",
|
|
@@ -38411,7 +38776,7 @@ var MenuBar = ({
|
|
|
38411
38776
|
] })
|
|
38412
38777
|
}
|
|
38413
38778
|
),
|
|
38414
|
-
/* @__PURE__ */
|
|
38779
|
+
/* @__PURE__ */ jsx93(
|
|
38415
38780
|
Modal_default,
|
|
38416
38781
|
{
|
|
38417
38782
|
isOpen: showPreviewDialog,
|
|
@@ -38422,12 +38787,12 @@ var MenuBar = ({
|
|
|
38422
38787
|
height: "min(860px, calc(100vh - 2rem))",
|
|
38423
38788
|
className: "flex flex-col overflow-hidden rounded-xl md:rounded-2xl",
|
|
38424
38789
|
contentClassName: "flex min-h-0 flex-1 overflow-hidden p-0",
|
|
38425
|
-
children: /* @__PURE__ */
|
|
38790
|
+
children: /* @__PURE__ */ jsx93(
|
|
38426
38791
|
"div",
|
|
38427
38792
|
{
|
|
38428
38793
|
"data-testid": "preview-content",
|
|
38429
38794
|
className: "min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 py-4 md:px-8",
|
|
38430
|
-
children: editor.isEmpty ? /* @__PURE__ */
|
|
38795
|
+
children: editor.isEmpty ? /* @__PURE__ */ jsx93("p", { className: "text-muted-foreground text-sm", children: t("menubar.previewEmpty") }) : /* @__PURE__ */ jsx93(
|
|
38431
38796
|
"div",
|
|
38432
38797
|
{
|
|
38433
38798
|
className: UEDITOR_PROSEMIRROR_CLASS_NAME,
|
|
@@ -38442,8 +38807,8 @@ var MenuBar = ({
|
|
|
38442
38807
|
};
|
|
38443
38808
|
|
|
38444
38809
|
// src/components/UEditor/UEditor.tsx
|
|
38445
|
-
import { jsx as
|
|
38446
|
-
var UEditor =
|
|
38810
|
+
import { jsx as jsx94, jsxs as jsxs79 } from "react/jsx-runtime";
|
|
38811
|
+
var UEditor = React83.forwardRef(({
|
|
38447
38812
|
content = "",
|
|
38448
38813
|
onChange,
|
|
38449
38814
|
onHtmlChange,
|
|
@@ -38571,7 +38936,7 @@ var UEditor = React82.forwardRef(({
|
|
|
38571
38936
|
tableRowGuideRef,
|
|
38572
38937
|
activeTableCellHighlightRef
|
|
38573
38938
|
} = useUEditorTableInteractions(editor, editable);
|
|
38574
|
-
|
|
38939
|
+
useImperativeHandle4(
|
|
38575
38940
|
ref,
|
|
38576
38941
|
() => ({
|
|
38577
38942
|
editor,
|
|
@@ -38623,7 +38988,7 @@ var UEditor = React82.forwardRef(({
|
|
|
38623
38988
|
}
|
|
38624
38989
|
}, [content, editor]);
|
|
38625
38990
|
if (!editor) {
|
|
38626
|
-
return /* @__PURE__ */
|
|
38991
|
+
return /* @__PURE__ */ jsx94(
|
|
38627
38992
|
"div",
|
|
38628
38993
|
{
|
|
38629
38994
|
className: cn("w-full border bg-background flex items-center justify-center text-muted-foreground", className),
|
|
@@ -38632,7 +38997,7 @@ var UEditor = React82.forwardRef(({
|
|
|
38632
38997
|
}
|
|
38633
38998
|
);
|
|
38634
38999
|
}
|
|
38635
|
-
return /* @__PURE__ */
|
|
39000
|
+
return /* @__PURE__ */ jsxs79(
|
|
38636
39001
|
"div",
|
|
38637
39002
|
{
|
|
38638
39003
|
className: cn(
|
|
@@ -38647,7 +39012,7 @@ var UEditor = React82.forwardRef(({
|
|
|
38647
39012
|
className
|
|
38648
39013
|
),
|
|
38649
39014
|
children: [
|
|
38650
|
-
editable && showMenuBar && /* @__PURE__ */
|
|
39015
|
+
editable && showMenuBar && /* @__PURE__ */ jsx94(
|
|
38651
39016
|
MenuBar,
|
|
38652
39017
|
{
|
|
38653
39018
|
editor,
|
|
@@ -38662,7 +39027,7 @@ var UEditor = React82.forwardRef(({
|
|
|
38662
39027
|
onPreview
|
|
38663
39028
|
}
|
|
38664
39029
|
),
|
|
38665
|
-
editable && showToolbar && /* @__PURE__ */
|
|
39030
|
+
editable && showToolbar && /* @__PURE__ */ jsx94(
|
|
38666
39031
|
EditorToolbar,
|
|
38667
39032
|
{
|
|
38668
39033
|
editor,
|
|
@@ -38677,7 +39042,7 @@ var UEditor = React82.forwardRef(({
|
|
|
38677
39042
|
letterSpacings
|
|
38678
39043
|
}
|
|
38679
39044
|
),
|
|
38680
|
-
editable && showBubbleMenu && /* @__PURE__ */
|
|
39045
|
+
editable && showBubbleMenu && /* @__PURE__ */ jsx94(
|
|
38681
39046
|
CustomBubbleMenu,
|
|
38682
39047
|
{
|
|
38683
39048
|
editor,
|
|
@@ -38685,7 +39050,7 @@ var UEditor = React82.forwardRef(({
|
|
|
38685
39050
|
lineHeights
|
|
38686
39051
|
}
|
|
38687
39052
|
),
|
|
38688
|
-
/* @__PURE__ */
|
|
39053
|
+
/* @__PURE__ */ jsxs79(
|
|
38689
39054
|
"div",
|
|
38690
39055
|
{
|
|
38691
39056
|
ref: editorContentRef,
|
|
@@ -38695,7 +39060,7 @@ var UEditor = React82.forwardRef(({
|
|
|
38695
39060
|
maxHeight
|
|
38696
39061
|
},
|
|
38697
39062
|
children: [
|
|
38698
|
-
/* @__PURE__ */
|
|
39063
|
+
/* @__PURE__ */ jsx94(
|
|
38699
39064
|
"span",
|
|
38700
39065
|
{
|
|
38701
39066
|
ref: tableColumnGuideRef,
|
|
@@ -38703,7 +39068,7 @@ var UEditor = React82.forwardRef(({
|
|
|
38703
39068
|
className: "pointer-events-none absolute z-20 bg-primary opacity-0 transition-opacity duration-100"
|
|
38704
39069
|
}
|
|
38705
39070
|
),
|
|
38706
|
-
/* @__PURE__ */
|
|
39071
|
+
/* @__PURE__ */ jsx94(
|
|
38707
39072
|
"span",
|
|
38708
39073
|
{
|
|
38709
39074
|
ref: tableRowGuideRef,
|
|
@@ -38711,7 +39076,7 @@ var UEditor = React82.forwardRef(({
|
|
|
38711
39076
|
className: "pointer-events-none absolute z-20 bg-primary opacity-0 transition-opacity duration-100"
|
|
38712
39077
|
}
|
|
38713
39078
|
),
|
|
38714
|
-
/* @__PURE__ */
|
|
39079
|
+
/* @__PURE__ */ jsx94(
|
|
38715
39080
|
"span",
|
|
38716
39081
|
{
|
|
38717
39082
|
ref: activeTableCellHighlightRef,
|
|
@@ -38720,8 +39085,8 @@ var UEditor = React82.forwardRef(({
|
|
|
38720
39085
|
className: "pointer-events-none hidden absolute z-20 rounded-[2px] border-2 border-primary bg-primary/10"
|
|
38721
39086
|
}
|
|
38722
39087
|
),
|
|
38723
|
-
editable && /* @__PURE__ */
|
|
38724
|
-
/* @__PURE__ */
|
|
39088
|
+
editable && /* @__PURE__ */ jsx94(TableControls, { editor, containerRef: editorContentRef }),
|
|
39089
|
+
/* @__PURE__ */ jsx94(
|
|
38725
39090
|
EditorContent,
|
|
38726
39091
|
{
|
|
38727
39092
|
editor,
|
|
@@ -38731,7 +39096,7 @@ var UEditor = React82.forwardRef(({
|
|
|
38731
39096
|
]
|
|
38732
39097
|
}
|
|
38733
39098
|
),
|
|
38734
|
-
showCharacterCount && /* @__PURE__ */
|
|
39099
|
+
showCharacterCount && /* @__PURE__ */ jsx94(CharacterCountDisplay, { editor, maxCharacters })
|
|
38735
39100
|
]
|
|
38736
39101
|
}
|
|
38737
39102
|
);
|