@underverse-ui/underverse 1.0.153 → 1.0.155

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