@underverse-ui/underverse 1.0.194 → 1.0.195
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api-reference.json +1 -1
- package/dist/index.cjs +1448 -1289
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1284 -1137
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -28005,8 +28005,8 @@ function useLocale2() {
|
|
|
28005
28005
|
}
|
|
28006
28006
|
|
|
28007
28007
|
// src/components/UEditor/UEditor.tsx
|
|
28008
|
-
var
|
|
28009
|
-
var
|
|
28008
|
+
var import_react84 = __toESM(require("react"), 1);
|
|
28009
|
+
var import_react85 = require("@tiptap/react");
|
|
28010
28010
|
|
|
28011
28011
|
// src/components/UEditor/extensions.ts
|
|
28012
28012
|
var import_core16 = require("@tiptap/core");
|
|
@@ -32613,20 +32613,165 @@ function buildUEditorExtensions({
|
|
|
32613
32613
|
}
|
|
32614
32614
|
|
|
32615
32615
|
// src/components/UEditor/toolbar.tsx
|
|
32616
|
-
var
|
|
32617
|
-
var
|
|
32616
|
+
var import_react72 = __toESM(require("react"), 1);
|
|
32617
|
+
var import_react73 = require("@tiptap/react");
|
|
32618
32618
|
var import_lucide_react52 = require("lucide-react");
|
|
32619
32619
|
var import_tables4 = require("@tiptap/pm/tables");
|
|
32620
32620
|
|
|
32621
32621
|
// src/components/UEditor/colors.tsx
|
|
32622
|
-
var
|
|
32622
|
+
var import_react70 = require("react");
|
|
32623
32623
|
var import_lucide_react50 = require("lucide-react");
|
|
32624
|
+
|
|
32625
|
+
// src/components/UEditor/figma-toolbar-icons.tsx
|
|
32626
|
+
var import_react69 = __toESM(require("react"), 1);
|
|
32624
32627
|
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
32628
|
+
function createToolbarIcon(displayName, width, height, path) {
|
|
32629
|
+
const Icon = import_react69.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
32630
|
+
"svg",
|
|
32631
|
+
{
|
|
32632
|
+
ref,
|
|
32633
|
+
"aria-hidden": "true",
|
|
32634
|
+
focusable: "false",
|
|
32635
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
32636
|
+
className,
|
|
32637
|
+
fill: "currentColor",
|
|
32638
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
32639
|
+
...props,
|
|
32640
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("path", { d: path })
|
|
32641
|
+
}
|
|
32642
|
+
));
|
|
32643
|
+
Icon.displayName = displayName;
|
|
32644
|
+
return Icon;
|
|
32645
|
+
}
|
|
32646
|
+
var FigmaChevronDownIcon = createToolbarIcon(
|
|
32647
|
+
"FigmaChevronDownIcon",
|
|
32648
|
+
512,
|
|
32649
|
+
512,
|
|
32650
|
+
"M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"
|
|
32651
|
+
);
|
|
32652
|
+
var FigmaTextStyleIcon = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("svg", { "aria-hidden": "true", focusable: "false", viewBox: "0 0 24 24", className, fill: "currentColor", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("path", { d: "M4 4.25C4 3.56 4.56 3 5.25 3h13.5C19.44 3 20 3.56 20 4.25v2.5a1 1 0 1 1-2 0V5h-5v14h2a1 1 0 1 1 0 2H9a1 1 0 1 1 0-2h2V5H6v1.75a1 1 0 1 1-2 0v-2.5Z" }) });
|
|
32653
|
+
var FigmaLineHeightIcon = createToolbarIcon(
|
|
32654
|
+
"FigmaLineHeightIcon",
|
|
32655
|
+
576,
|
|
32656
|
+
512,
|
|
32657
|
+
"M64 128l0-32 64 0 0 320-32 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l128 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-32 0 0-320 64 0 0 32c0 17.7 14.3 32 32 32s32-14.3 32-32l0-48c0-26.5-21.5-48-48-48L160 32 48 32C21.5 32 0 53.5 0 80l0 48c0 17.7 14.3 32 32 32s32-14.3 32-32zM502.6 41.4c-12.5-12.5-32.8-12.5-45.3 0l-64 64c-9.2 9.2-11.9 22.9-6.9 34.9s16.6 19.8 29.6 19.8l32 0 0 192-32 0c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9l64 64c12.5 12.5 32.8 12.5 45.3 0l64-64c9.2-9.2 11.9-22.9 6.9-34.9s-16.6-19.8-29.6-19.8l-32 0 0-192 32 0c12.9 0 24.6-7.8 29.6-19.8s2.2-25.7-6.9-34.9l-64-64z"
|
|
32658
|
+
);
|
|
32659
|
+
var FigmaLetterSpacingIcon = createToolbarIcon(
|
|
32660
|
+
"FigmaLetterSpacingIcon",
|
|
32661
|
+
448,
|
|
32662
|
+
512,
|
|
32663
|
+
"M64 128l0-32 128 0 0 128-16 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l96 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-16 0 0-128 128 0 0 32c0 17.7 14.3 32 32 32s32-14.3 32-32l0-48c0-26.5-21.5-48-48-48L224 32 48 32C21.5 32 0 53.5 0 80l0 48c0 17.7 14.3 32 32 32s32-14.3 32-32zM9.4 361.4c-12.5 12.5-12.5 32.8 0 45.3l64 64c9.2 9.2 22.9 11.9 34.9 6.9s19.8-16.6 19.8-29.6l0-32 192 0 0 32c0 12.9 7.8 24.6 19.8 29.6s25.7 2.2 34.9-6.9l64-64c12.5-12.5 12.5-32.8 0-45.3l-64-64c-9.2-9.2-22.9-11.9-34.9-6.9s-19.8 16.6-19.8 29.6l0 32-192 0 0-32c0-12.9-7.8-24.6-19.8-29.6s-25.7-2.2-34.9 6.9l-64 64z"
|
|
32664
|
+
);
|
|
32665
|
+
var FigmaBoldIcon = createToolbarIcon(
|
|
32666
|
+
"FigmaBoldIcon",
|
|
32667
|
+
384,
|
|
32668
|
+
512,
|
|
32669
|
+
"M0 64C0 46.3 14.3 32 32 32l48 0 16 0 128 0c70.7 0 128 57.3 128 128c0 31.3-11.3 60.1-30 82.3c37.1 22.4 62 63.1 62 109.7c0 70.7-57.3 128-128 128L96 480l-16 0-48 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l16 0 0-160L48 96 32 96C14.3 96 0 81.7 0 64zM224 224c35.3 0 64-28.7 64-64s-28.7-64-64-64L112 96l0 128 112 0zM112 288l0 128 144 0c35.3 0 64-28.7 64-64s-28.7-64-64-64l-32 0-112 0z"
|
|
32670
|
+
);
|
|
32671
|
+
var FigmaItalicIcon = createToolbarIcon(
|
|
32672
|
+
"FigmaItalicIcon",
|
|
32673
|
+
384,
|
|
32674
|
+
512,
|
|
32675
|
+
"M128 64c0-17.7 14.3-32 32-32l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-58.7 0L160 416l64 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l58.7 0L224 96l-64 0c-17.7 0-32-14.3-32-32z"
|
|
32676
|
+
);
|
|
32677
|
+
var FigmaUnderlineIcon = createToolbarIcon(
|
|
32678
|
+
"FigmaUnderlineIcon",
|
|
32679
|
+
448,
|
|
32680
|
+
512,
|
|
32681
|
+
"M16 64c0-17.7 14.3-32 32-32l96 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-16 0 0 128c0 53 43 96 96 96s96-43 96-96l0-128-16 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l96 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-16 0 0 128c0 88.4-71.6 160-160 160s-160-71.6-160-160L64 96 48 96C30.3 96 16 81.7 16 64zM0 448c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32z"
|
|
32682
|
+
);
|
|
32683
|
+
var FigmaStrikeIcon = createToolbarIcon(
|
|
32684
|
+
"FigmaStrikeIcon",
|
|
32685
|
+
512,
|
|
32686
|
+
512,
|
|
32687
|
+
"M161.3 144c3.2-17.2 14-30.1 33.7-38.6c21.1-9 51.8-12.3 88.6-6.5c11.9 1.9 48.8 9.1 60.1 12c17.1 4.5 34.6-5.6 39.2-22.7s-5.6-34.6-22.7-39.2c-14.3-3.8-53.6-11.4-66.6-13.4c-44.7-7-88.3-4.2-123.7 10.9c-36.5 15.6-64.4 44.8-71.8 87.3c-.1 .6-.2 1.1-.2 1.7c-2.8 23.9 .5 45.6 10.1 64.6c4.5 9 10.2 16.9 16.7 23.9L32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l448 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-209.9 0-.4-.1-1.1-.3c-36-10.8-65.2-19.6-85.2-33.1c-9.3-6.3-15-12.6-18.2-19.1c-3.1-6.1-5.2-14.6-3.8-27.4zM348.9 337.2c2.7 6.5 4.4 15.8 1.9 30.1c-3 17.6-13.8 30.8-33.9 39.4c-21.1 9-51.7 12.3-88.5 6.5c-18-2.9-49.1-13.5-74.4-22.1c-5.6-1.9-11-3.7-15.9-5.4c-16.8-5.6-34.9 3.5-40.5 20.3s3.5 34.9 20.3 40.5c3.6 1.2 7.9 2.7 12.7 4.3c24.9 8.5 63.6 21.7 87.6 25.6l.2 0c44.7 7 88.3 4.2 123.7-10.9c36.5-15.6 64.4-44.8 71.8-87.3c3.6-21 2.7-40.4-3.1-58.1l-75.7 0c7 5.6 11.4 11.2 13.9 17.2z"
|
|
32688
|
+
);
|
|
32689
|
+
var FigmaCodeIcon = createToolbarIcon(
|
|
32690
|
+
"FigmaCodeIcon",
|
|
32691
|
+
640,
|
|
32692
|
+
512,
|
|
32693
|
+
"M392.8 1.2c-17-4.9-34.7 5-39.6 22l-128 448c-4.9 17 5 34.7 22 39.6s34.7-5 39.6-22l128-448c4.9-17-5-34.7-22-39.6zm80.6 120.1c-12.5 12.5-12.5 32.8 0 45.3L562.7 256l-89.4 89.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l112-112c12.5-12.5 12.5-32.8 0-45.3l-112-112c-12.5-12.5-32.8-12.5-45.3 0zm-306.7 0c-12.5-12.5-32.8-12.5-45.3 0l-112 112c-12.5 12.5-12.5 32.8 0 45.3l112 112c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256l89.4-89.4c12.5-12.5 12.5-32.8 0-45.3z"
|
|
32694
|
+
);
|
|
32695
|
+
var FigmaSubscriptIcon = createToolbarIcon(
|
|
32696
|
+
"FigmaSubscriptIcon",
|
|
32697
|
+
512,
|
|
32698
|
+
512,
|
|
32699
|
+
"M32 64C14.3 64 0 78.3 0 96s14.3 32 32 32l15.3 0 89.6 128L47.3 384 32 384c-17.7 0-32 14.3-32 32s14.3 32 32 32l32 0c10.4 0 20.2-5.1 26.2-13.6L176 311.8l85.8 122.6c6 8.6 15.8 13.6 26.2 13.6l32 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-15.3 0L215.1 256l89.6-128 15.3 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-32 0c-10.4 0-20.2 5.1-26.2 13.6L176 200.2 90.2 77.6C84.2 69.1 74.4 64 64 64L32 64zM480 320c0-11.1-5.7-21.4-15.2-27.2s-21.2-6.4-31.1-1.4l-32 16c-15.8 7.9-22.2 27.1-14.3 42.9C393 361.5 404.3 368 416 368l0 80c-17.7 0-32 14.3-32 32s14.3 32 32 32l64 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l0-128z"
|
|
32700
|
+
);
|
|
32701
|
+
var FigmaSuperscriptIcon = createToolbarIcon(
|
|
32702
|
+
"FigmaSuperscriptIcon",
|
|
32703
|
+
512,
|
|
32704
|
+
512,
|
|
32705
|
+
"M480 32c0-11.1-5.7-21.4-15.2-27.2s-21.2-6.4-31.1-1.4l-32 16c-15.8 7.9-22.2 27.1-14.3 42.9C393 73.5 404.3 80 416 80l0 80c-17.7 0-32 14.3-32 32s14.3 32 32 32l64 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l0-128zM32 64C14.3 64 0 78.3 0 96s14.3 32 32 32l15.3 0 89.6 128L47.3 384 32 384c-17.7 0-32 14.3-32 32s14.3 32 32 32l32 0c10.4 0 20.2-5.1 26.2-13.6L176 311.8l85.8 122.6c6 8.6 15.8 13.6 26.2 13.6l32 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-15.3 0L215.1 256l89.6-128 15.3 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-32 0c-10.4 0-20.2 5.1-26.2 13.6L176 200.2 90.2 77.6C84.2 69.1 74.4 64 64 64L32 64z"
|
|
32706
|
+
);
|
|
32707
|
+
var FigmaLinkIcon = createToolbarIcon(
|
|
32708
|
+
"FigmaLinkIcon",
|
|
32709
|
+
640,
|
|
32710
|
+
512,
|
|
32711
|
+
"M579.8 267.7c56.5-56.5 56.5-148 0-204.5c-50-50-128.8-56.5-186.3-15.4l-1.6 1.1c-14.4 10.3-17.7 30.3-7.4 44.6s30.3 17.7 44.6 7.4l1.6-1.1c32.1-22.9 76-19.3 103.8 8.6c31.5 31.5 31.5 82.5 0 114L422.3 334.8c-31.5 31.5-82.5 31.5-114 0c-27.9-27.9-31.5-71.8-8.6-103.8l1.1-1.6c10.3-14.4 6.9-34.4-7.4-44.6s-34.4-6.9-44.6 7.4l-1.1 1.6C206.5 251.2 213 330 263 380c56.5 56.5 148 56.5 204.5 0L579.8 267.7zM60.2 244.3c-56.5 56.5-56.5 148 0 204.5c50 50 128.8 56.5 186.3 15.4l1.6-1.1c14.4-10.3 17.7-30.3 7.4-44.6s-30.3-17.7-44.6-7.4l-1.6 1.1c-32.1 22.9-76 19.3-103.8-8.6C74 372 74 321 105.5 289.5L217.7 177.2c31.5-31.5 82.5-31.5 114 0c27.9 27.9 31.5 71.8 8.6 103.9l-1.1 1.6c-10.3 14.4-6.9 34.4 7.4 44.6s34.4 6.9 44.6-7.4l1.1-1.6C433.5 260.8 427 182 377 132c-56.5-56.5-148-56.5-204.5 0L60.2 244.3z"
|
|
32712
|
+
);
|
|
32713
|
+
var FigmaSmileIcon = createToolbarIcon(
|
|
32714
|
+
"FigmaSmileIcon",
|
|
32715
|
+
512,
|
|
32716
|
+
512,
|
|
32717
|
+
"M464 256A208 208 0 1 0 48 256a208 208 0 1 0 416 0zM0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256zm177.6 62.1C192.8 334.5 218.8 352 256 352s63.2-17.5 78.4-33.9c9-9.7 24.2-10.4 33.9-1.4s10.4 24.2 1.4 33.9c-22 23.8-60 49.4-113.6 49.4s-91.7-25.5-113.6-49.4c-9-9.7-8.4-24.9 1.4-33.9s24.9-8.4 33.9 1.4zM144.4 208a32 32 0 1 1 64 0 32 32 0 1 1 -64 0zm192-32a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"
|
|
32718
|
+
);
|
|
32719
|
+
var FigmaAlignLeftIcon = createToolbarIcon(
|
|
32720
|
+
"FigmaAlignLeftIcon",
|
|
32721
|
+
448,
|
|
32722
|
+
512,
|
|
32723
|
+
"M288 64c0 17.7-14.3 32-32 32L32 96C14.3 96 0 81.7 0 64S14.3 32 32 32l224 0c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32L32 352c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 224c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z"
|
|
32724
|
+
);
|
|
32725
|
+
var FigmaListIcon = createToolbarIcon(
|
|
32726
|
+
"FigmaListIcon",
|
|
32727
|
+
512,
|
|
32728
|
+
512,
|
|
32729
|
+
"M64 144a48 48 0 1 0 0-96 48 48 0 1 0 0 96zM192 64c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L192 64zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zM64 464a48 48 0 1 0 0-96 48 48 0 1 0 0 96zm48-208a48 48 0 1 0-96 0 48 48 0 1 0 96 0z"
|
|
32730
|
+
);
|
|
32731
|
+
var FigmaQuoteIcon = createToolbarIcon(
|
|
32732
|
+
"FigmaQuoteIcon",
|
|
32733
|
+
448,
|
|
32734
|
+
512,
|
|
32735
|
+
"M0 216C0 149.7 53.7 96 120 96l8 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-8 0c-30.9 0-56 25.1-56 56l0 8 64 0c35.3 0 64 28.7 64 64l0 64c0 35.3-28.7 64-64 64l-64 0c-35.3 0-64-28.7-64-64l0-136zm256 0c0-66.3 53.7-120 120-120l8 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-8 0c-30.9 0-56 25.1-56 56l0 8 64 0c35.3 0 64 28.7 64 64l0 64c0 35.3-28.7 64-64 64l-64 0c-35.3 0-64-28.7-64-64l0-136z"
|
|
32736
|
+
);
|
|
32737
|
+
var FigmaImageIcon = createToolbarIcon(
|
|
32738
|
+
"FigmaImageIcon",
|
|
32739
|
+
512,
|
|
32740
|
+
512,
|
|
32741
|
+
"M0 96C0 60.7 28.7 32 64 32l384 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6l336 0c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"
|
|
32742
|
+
);
|
|
32743
|
+
var FigmaTableIcon = createToolbarIcon(
|
|
32744
|
+
"FigmaTableIcon",
|
|
32745
|
+
512,
|
|
32746
|
+
512,
|
|
32747
|
+
"M64 256l0-96 160 0 0 96L64 256zm0 64l160 0 0 96L64 416l0-96zm224 96l0-96 160 0 0 96-160 0zM448 256l-160 0 0-96 160 0 0 96zM64 32C28.7 32 0 60.7 0 96L0 416c0 35.3 28.7 64 64 64l384 0c35.3 0 64-28.7 64-64l0-320c0-35.3-28.7-64-64-64L64 32z"
|
|
32748
|
+
);
|
|
32749
|
+
var FigmaUndoIcon = createToolbarIcon(
|
|
32750
|
+
"FigmaUndoIcon",
|
|
32751
|
+
512,
|
|
32752
|
+
512,
|
|
32753
|
+
"M48.5 224L40 224c-13.3 0-24-10.7-24-24L16 72c0-9.7 5.8-18.5 14.8-22.2s19.3-1.7 26.2 5.2l41.6 41.6c87.6-86.5 228.7-86.2 315.8 1c87.5 87.5 87.5 229.3 0 316.8s-229.3 87.5-316.8 0c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0c62.5 62.5 163.8 62.5 226.3 0s62.5-163.8 0-226.3c-62.2-62.2-162.7-62.5-225.3-1L185 183c6.9 6.9 8.9 17.2 5.2 26.2S177.7 224 168 224L48.5 224z"
|
|
32754
|
+
);
|
|
32755
|
+
var FigmaRedoIcon = createToolbarIcon(
|
|
32756
|
+
"FigmaRedoIcon",
|
|
32757
|
+
512,
|
|
32758
|
+
512,
|
|
32759
|
+
"M463.5 224l8.5 0c13.3 0 24-10.7 24-24l0-128c0-9.7-5.8-18.5-14.8-22.2s-19.3-1.7-26.2 5.2l-41.6 41.6c-87.6-86.5-228.7-86.2-315.8 1c-87.5 87.5-87.5 229.3 0 316.8s229.3 87.5 316.8 0c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0c-62.5 62.5-163.8 62.5-226.3 0s-62.5-163.8 0-226.3c62.2-62.2 162.7-62.5 225.3-1L327 183c-6.9 6.9-8.9 17.2-5.2 26.2S334.3 224 344 224l119.5 0z"
|
|
32760
|
+
);
|
|
32761
|
+
var FigmaHighlighterIcon = createToolbarIcon(
|
|
32762
|
+
"FigmaHighlighterIcon",
|
|
32763
|
+
576,
|
|
32764
|
+
512,
|
|
32765
|
+
"M315 315l158.4-215L444.1 70.6 229 229 315 315zm-187 5l0-71.7c0-15.3 7.2-29.6 19.5-38.6L420.6 8.4C428 2.9 437 0 446.2 0c11.4 0 22.4 4.5 30.5 12.6l54.8 54.8c8.1 8.1 12.6 19 12.6 30.5c0 9.2-2.9 18.2-8.4 25.6L334.4 396.5c-9 12.3-23.4 19.5-38.6 19.5L224 416l-25.4 25.4c-12.5 12.5-32.8 12.5-45.3 0l-50.7-50.7c-12.5-12.5-12.5-32.8 0-45.3L128 320zM7 466.3l63-63 70.6 70.6-31 31c-4.5 4.5-10.6 7-17 7L24 512c-13.3 0-24-10.7-24-24l0-4.7c0-6.4 2.5-12.5 7-17z"
|
|
32766
|
+
);
|
|
32767
|
+
|
|
32768
|
+
// src/components/UEditor/colors.tsx
|
|
32769
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
32625
32770
|
var TextColorIcon = ({ color }) => {
|
|
32626
32771
|
const underlineColor = color && color !== "inherit" ? color : "currentColor";
|
|
32627
|
-
return /* @__PURE__ */ (0,
|
|
32628
|
-
/* @__PURE__ */ (0,
|
|
32629
|
-
/* @__PURE__ */ (0,
|
|
32772
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("span", { className: "relative flex h-5 w-5 items-center justify-center leading-none", children: [
|
|
32773
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "text-[15px] font-semibold leading-none", children: "A" }),
|
|
32774
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
32630
32775
|
"span",
|
|
32631
32776
|
{
|
|
32632
32777
|
"aria-hidden": "true",
|
|
@@ -32638,9 +32783,9 @@ var TextColorIcon = ({ color }) => {
|
|
|
32638
32783
|
};
|
|
32639
32784
|
var HighlightColorIcon = ({ color }) => {
|
|
32640
32785
|
const underlineColor = color || "currentColor";
|
|
32641
|
-
return /* @__PURE__ */ (0,
|
|
32642
|
-
/* @__PURE__ */ (0,
|
|
32643
|
-
/* @__PURE__ */ (0,
|
|
32786
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("span", { className: "relative flex h-5 w-5 items-center justify-center leading-none", children: [
|
|
32787
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(FigmaHighlighterIcon, { className: "h-4 w-4" }),
|
|
32788
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
32644
32789
|
"span",
|
|
32645
32790
|
{
|
|
32646
32791
|
"aria-hidden": "true",
|
|
@@ -32652,9 +32797,9 @@ var HighlightColorIcon = ({ color }) => {
|
|
|
32652
32797
|
};
|
|
32653
32798
|
var CellBgColorIcon = ({ color }) => {
|
|
32654
32799
|
const underlineColor = color && color !== "inherit" ? color : "currentColor";
|
|
32655
|
-
return /* @__PURE__ */ (0,
|
|
32656
|
-
/* @__PURE__ */ (0,
|
|
32657
|
-
/* @__PURE__ */ (0,
|
|
32800
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("span", { className: "relative flex h-5 w-5 items-center justify-center leading-none", children: [
|
|
32801
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_lucide_react50.Paintbrush, { className: "h-4 w-4" }),
|
|
32802
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
32658
32803
|
"span",
|
|
32659
32804
|
{
|
|
32660
32805
|
"aria-hidden": "true",
|
|
@@ -32666,9 +32811,9 @@ var CellBgColorIcon = ({ color }) => {
|
|
|
32666
32811
|
};
|
|
32667
32812
|
var CellBorderIcon = ({ color }) => {
|
|
32668
32813
|
const underlineColor = color && color !== "inherit" ? color : "currentColor";
|
|
32669
|
-
return /* @__PURE__ */ (0,
|
|
32670
|
-
/* @__PURE__ */ (0,
|
|
32671
|
-
/* @__PURE__ */ (0,
|
|
32814
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("span", { className: "relative flex h-5 w-5 items-center justify-center leading-none", children: [
|
|
32815
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_lucide_react50.Grid, { className: "h-4 w-4" }),
|
|
32816
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
32672
32817
|
"span",
|
|
32673
32818
|
{
|
|
32674
32819
|
"aria-hidden": "true",
|
|
@@ -32754,7 +32899,7 @@ function getSwatchCheckClass(color) {
|
|
|
32754
32899
|
}
|
|
32755
32900
|
var useEditorColors = () => {
|
|
32756
32901
|
const t = useSmartTranslations("UEditor");
|
|
32757
|
-
const textColors = (0,
|
|
32902
|
+
const textColors = (0, import_react70.useMemo)(
|
|
32758
32903
|
() => [
|
|
32759
32904
|
{ name: t("colors.default"), color: "inherit", cssClass: "text-foreground" },
|
|
32760
32905
|
{ name: t("colors.muted"), color: "var(--muted-foreground)", cssClass: "text-muted-foreground" },
|
|
@@ -32768,7 +32913,7 @@ var useEditorColors = () => {
|
|
|
32768
32913
|
],
|
|
32769
32914
|
[t]
|
|
32770
32915
|
);
|
|
32771
|
-
const highlightColors = (0,
|
|
32916
|
+
const highlightColors = (0, import_react70.useMemo)(
|
|
32772
32917
|
() => [
|
|
32773
32918
|
{ name: t("colors.default"), color: "", cssClass: "" },
|
|
32774
32919
|
{ name: t("colors.muted"), color: "var(--muted)", cssClass: "bg-muted" },
|
|
@@ -32792,12 +32937,12 @@ var EditorColorPalette = ({
|
|
|
32792
32937
|
label
|
|
32793
32938
|
}) => {
|
|
32794
32939
|
const t = useSmartTranslations("UEditor");
|
|
32795
|
-
const colorInputRef = (0,
|
|
32940
|
+
const colorInputRef = (0, import_react70.useRef)(null);
|
|
32796
32941
|
const automaticColor = colors[0]?.color ?? "";
|
|
32797
32942
|
const paletteColors = colors.slice(1);
|
|
32798
|
-
return /* @__PURE__ */ (0,
|
|
32799
|
-
/* @__PURE__ */ (0,
|
|
32800
|
-
/* @__PURE__ */ (0,
|
|
32943
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "w-56 p-2", children: [
|
|
32944
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "px-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: label }),
|
|
32945
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
32801
32946
|
"button",
|
|
32802
32947
|
{
|
|
32803
32948
|
type: "button",
|
|
@@ -32809,12 +32954,12 @@ var EditorColorPalette = ({
|
|
|
32809
32954
|
currentColor === automaticColor ? "border-primary text-primary" : "border-transparent text-foreground"
|
|
32810
32955
|
),
|
|
32811
32956
|
children: [
|
|
32812
|
-
/* @__PURE__ */ (0,
|
|
32813
|
-
/* @__PURE__ */ (0,
|
|
32957
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.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_runtime91.jsx)(import_lucide_react50.Check, { className: "h-3.5 w-3.5" }) }),
|
|
32958
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "flex-1 text-center", children: t("colors.automatic") })
|
|
32814
32959
|
]
|
|
32815
32960
|
}
|
|
32816
32961
|
),
|
|
32817
|
-
/* @__PURE__ */ (0,
|
|
32962
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "mt-2 grid grid-cols-8 gap-1", children: paletteColors.map((c) => /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Tooltip, { placement: "top", content: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "text-xs font-medium", children: c.name }), children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
32818
32963
|
"button",
|
|
32819
32964
|
{
|
|
32820
32965
|
type: "button",
|
|
@@ -32826,10 +32971,10 @@ var EditorColorPalette = ({
|
|
|
32826
32971
|
currentColor === c.color ? "border-primary ring-2 ring-primary/25" : "border-border/70"
|
|
32827
32972
|
),
|
|
32828
32973
|
style: { backgroundColor: c.color || "transparent" },
|
|
32829
|
-
children: currentColor === c.color && /* @__PURE__ */ (0,
|
|
32974
|
+
children: currentColor === c.color && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_lucide_react50.Check, { className: cn("h-3.5 w-3.5", getSwatchCheckClass(c.color)) }) })
|
|
32830
32975
|
}
|
|
32831
32976
|
) }, `${c.name}-${c.color}`)) }),
|
|
32832
|
-
/* @__PURE__ */ (0,
|
|
32977
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
32833
32978
|
"button",
|
|
32834
32979
|
{
|
|
32835
32980
|
type: "button",
|
|
@@ -32837,7 +32982,7 @@ var EditorColorPalette = ({
|
|
|
32837
32982
|
onClick: () => colorInputRef.current?.click(),
|
|
32838
32983
|
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",
|
|
32839
32984
|
children: [
|
|
32840
|
-
/* @__PURE__ */ (0,
|
|
32985
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
32841
32986
|
"span",
|
|
32842
32987
|
{
|
|
32843
32988
|
"aria-hidden": "true",
|
|
@@ -32847,9 +32992,9 @@ var EditorColorPalette = ({
|
|
|
32847
32992
|
}
|
|
32848
32993
|
}
|
|
32849
32994
|
),
|
|
32850
|
-
/* @__PURE__ */ (0,
|
|
32851
|
-
/* @__PURE__ */ (0,
|
|
32852
|
-
/* @__PURE__ */ (0,
|
|
32995
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "flex-1 text-center", children: t("colors.moreColors") }),
|
|
32996
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_lucide_react50.Palette, { className: "h-4 w-4 text-muted-foreground" }),
|
|
32997
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
32853
32998
|
"input",
|
|
32854
32999
|
{
|
|
32855
33000
|
ref: colorInputRef,
|
|
@@ -32994,9 +33139,9 @@ function deleteSelectedImage(editor) {
|
|
|
32994
33139
|
}
|
|
32995
33140
|
|
|
32996
33141
|
// src/components/UEditor/inputs.tsx
|
|
32997
|
-
var
|
|
33142
|
+
var import_react71 = require("react");
|
|
32998
33143
|
var import_lucide_react51 = require("lucide-react");
|
|
32999
|
-
var
|
|
33144
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
33000
33145
|
function normalizeUrl(raw) {
|
|
33001
33146
|
return sanitizeUEditorUrl(raw, "link");
|
|
33002
33147
|
}
|
|
@@ -33006,11 +33151,11 @@ var LinkInput = ({
|
|
|
33006
33151
|
initialUrl = ""
|
|
33007
33152
|
}) => {
|
|
33008
33153
|
const t = useSmartTranslations("UEditor");
|
|
33009
|
-
const [url, setUrl] = (0,
|
|
33010
|
-
const [error, setError] = (0,
|
|
33011
|
-
const inputRef = (0,
|
|
33012
|
-
const errorId = (0,
|
|
33013
|
-
(0,
|
|
33154
|
+
const [url, setUrl] = (0, import_react71.useState)(initialUrl);
|
|
33155
|
+
const [error, setError] = (0, import_react71.useState)("");
|
|
33156
|
+
const inputRef = (0, import_react71.useRef)(null);
|
|
33157
|
+
const errorId = (0, import_react71.useId)();
|
|
33158
|
+
(0, import_react71.useEffect)(() => {
|
|
33014
33159
|
inputRef.current?.focus();
|
|
33015
33160
|
inputRef.current?.select();
|
|
33016
33161
|
}, []);
|
|
@@ -33024,9 +33169,9 @@ var LinkInput = ({
|
|
|
33024
33169
|
setError("");
|
|
33025
33170
|
onSubmit(normalized);
|
|
33026
33171
|
};
|
|
33027
|
-
return /* @__PURE__ */ (0,
|
|
33028
|
-
/* @__PURE__ */ (0,
|
|
33029
|
-
/* @__PURE__ */ (0,
|
|
33172
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("form", { onSubmit: handleSubmit, className: "p-2", children: [
|
|
33173
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
33174
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33030
33175
|
"input",
|
|
33031
33176
|
{
|
|
33032
33177
|
ref: inputRef,
|
|
@@ -33042,18 +33187,18 @@ var LinkInput = ({
|
|
|
33042
33187
|
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 aria-invalid:ring-2 aria-invalid:ring-destructive/40"
|
|
33043
33188
|
}
|
|
33044
33189
|
),
|
|
33045
|
-
/* @__PURE__ */ (0,
|
|
33046
|
-
/* @__PURE__ */ (0,
|
|
33190
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.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_runtime92.jsx)(import_lucide_react51.Check, { className: "w-4 h-4" }) }),
|
|
33191
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("button", { type: "button", onClick: onCancel, className: "p-2 rounded-lg hover:bg-muted transition-colors text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react51.X, { className: "w-4 h-4" }) })
|
|
33047
33192
|
] }),
|
|
33048
|
-
error ? /* @__PURE__ */ (0,
|
|
33193
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("p", { id: errorId, role: "alert", className: "mt-1.5 px-1 text-xs text-destructive", children: error }) : null
|
|
33049
33194
|
] });
|
|
33050
33195
|
};
|
|
33051
33196
|
var ImageInput = ({ onSubmit, onCancel }) => {
|
|
33052
33197
|
const t = useSmartTranslations("UEditor");
|
|
33053
|
-
const [url, setUrl] = (0,
|
|
33054
|
-
const [alt, setAlt] = (0,
|
|
33055
|
-
const inputRef = (0,
|
|
33056
|
-
(0,
|
|
33198
|
+
const [url, setUrl] = (0, import_react71.useState)("");
|
|
33199
|
+
const [alt, setAlt] = (0, import_react71.useState)("");
|
|
33200
|
+
const inputRef = (0, import_react71.useRef)(null);
|
|
33201
|
+
(0, import_react71.useEffect)(() => {
|
|
33057
33202
|
inputRef.current?.focus();
|
|
33058
33203
|
}, []);
|
|
33059
33204
|
const handleSubmit = (e) => {
|
|
@@ -33063,10 +33208,10 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
33063
33208
|
onSubmit(safeUrl, alt);
|
|
33064
33209
|
}
|
|
33065
33210
|
};
|
|
33066
|
-
return /* @__PURE__ */ (0,
|
|
33067
|
-
/* @__PURE__ */ (0,
|
|
33068
|
-
/* @__PURE__ */ (0,
|
|
33069
|
-
/* @__PURE__ */ (0,
|
|
33211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("form", { onSubmit: handleSubmit, className: "p-3 space-y-3", children: [
|
|
33212
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { children: [
|
|
33213
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("label", { className: "text-xs font-medium text-muted-foreground", children: t("imageInput.urlLabel") }),
|
|
33214
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33070
33215
|
"input",
|
|
33071
33216
|
{
|
|
33072
33217
|
ref: inputRef,
|
|
@@ -33078,9 +33223,9 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
33078
33223
|
}
|
|
33079
33224
|
)
|
|
33080
33225
|
] }),
|
|
33081
|
-
/* @__PURE__ */ (0,
|
|
33082
|
-
/* @__PURE__ */ (0,
|
|
33083
|
-
/* @__PURE__ */ (0,
|
|
33226
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { children: [
|
|
33227
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("label", { className: "text-xs font-medium text-muted-foreground", children: t("imageInput.altLabel") }),
|
|
33228
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33084
33229
|
"input",
|
|
33085
33230
|
{
|
|
33086
33231
|
type: "text",
|
|
@@ -33091,8 +33236,8 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
33091
33236
|
}
|
|
33092
33237
|
)
|
|
33093
33238
|
] }),
|
|
33094
|
-
/* @__PURE__ */ (0,
|
|
33095
|
-
/* @__PURE__ */ (0,
|
|
33239
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "flex gap-2", children: [
|
|
33240
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33096
33241
|
"button",
|
|
33097
33242
|
{
|
|
33098
33243
|
type: "submit",
|
|
@@ -33101,7 +33246,7 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
33101
33246
|
children: t("imageInput.addBtn")
|
|
33102
33247
|
}
|
|
33103
33248
|
),
|
|
33104
|
-
/* @__PURE__ */ (0,
|
|
33249
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.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") })
|
|
33105
33250
|
] })
|
|
33106
33251
|
] });
|
|
33107
33252
|
};
|
|
@@ -33417,6 +33562,7 @@ function normalizeStyleValue(value) {
|
|
|
33417
33562
|
}
|
|
33418
33563
|
function getDefaultFontFamilies(t) {
|
|
33419
33564
|
return [
|
|
33565
|
+
{ label: "Inter", value: '"Inter", "Noto Sans", "Noto Sans CJK KR", "Noto Sans CJK JP", "Segoe UI", sans-serif' },
|
|
33420
33566
|
{ label: "\uAD74\uB9BC", value: '"Gulim", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif' },
|
|
33421
33567
|
{ label: "\uAD74\uB9BC\uCCB4", value: '"GulimChe", "Gulim", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif' },
|
|
33422
33568
|
{ label: "\uAD81\uC11C", value: '"Gungsuh", "Nanum Myeongjo", serif' },
|
|
@@ -33427,7 +33573,6 @@ function getDefaultFontFamilies(t) {
|
|
|
33427
33573
|
{ label: "\uBC14\uD0D5\uCCB4", value: '"BatangChe", "Batang", "Nanum Myeongjo", serif' },
|
|
33428
33574
|
{ label: "\uB9D1\uC740\uACE0\uB515", value: '"Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif' },
|
|
33429
33575
|
{ label: "\uB098\uB214\uBA85\uC870", value: '"Nanum Myeongjo", "Batang", serif' },
|
|
33430
|
-
{ label: "Inter", value: '"Inter", "Noto Sans", "Noto Sans CJK KR", "Noto Sans CJK JP", "Segoe UI", sans-serif' },
|
|
33431
33576
|
{ label: "System UI", value: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif' },
|
|
33432
33577
|
{ label: "Roboto", value: '"Roboto", "Noto Sans", "Apple SD Gothic Neo", "Hiragino Kaku Gothic ProN", sans-serif' },
|
|
33433
33578
|
{ label: "Lexend", value: '"Lexend", "Be Vietnam Pro", "Segoe UI", sans-serif' },
|
|
@@ -33489,7 +33634,7 @@ function getDefaultLetterSpacings() {
|
|
|
33489
33634
|
}
|
|
33490
33635
|
|
|
33491
33636
|
// src/components/UEditor/toolbar.tsx
|
|
33492
|
-
var
|
|
33637
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
33493
33638
|
function getTableAnchorPos(editor) {
|
|
33494
33639
|
const tableInfo = findTableNodeInfoFromState(editor.state);
|
|
33495
33640
|
if (tableInfo) return editor.state.selection.from;
|
|
@@ -33519,8 +33664,8 @@ function fileToDataUrl2(file) {
|
|
|
33519
33664
|
function formatTableInsertLabel(template, rows, cols) {
|
|
33520
33665
|
return template.replace("{rows}", String(rows)).replace("{cols}", String(cols));
|
|
33521
33666
|
}
|
|
33522
|
-
var ToolbarButton =
|
|
33523
|
-
const button = /* @__PURE__ */ (0,
|
|
33667
|
+
var ToolbarButton = import_react72.default.forwardRef(({ onClick, onMouseDown, active, disabled, children, title, className }, ref) => {
|
|
33668
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
33524
33669
|
"button",
|
|
33525
33670
|
{
|
|
33526
33671
|
ref,
|
|
@@ -33533,40 +33678,40 @@ var ToolbarButton = import_react71.default.forwardRef(({ onClick, onMouseDown, a
|
|
|
33533
33678
|
onClick,
|
|
33534
33679
|
disabled,
|
|
33535
33680
|
className: cn(
|
|
33536
|
-
"flex items-center justify-center
|
|
33681
|
+
"flex h-8 w-8 shrink-0 items-center justify-center rounded-md transition-colors duration-150 cursor-pointer",
|
|
33537
33682
|
"gap-0.5 [&_svg+svg]:-ml-1",
|
|
33538
33683
|
"hover:bg-accent",
|
|
33539
33684
|
"focus:outline-none focus:ring-2 focus:ring-primary/20",
|
|
33540
33685
|
"disabled:opacity-40 disabled:cursor-not-allowed",
|
|
33541
|
-
active ? "bg-primary/10 text-primary shadow-sm" : "text-
|
|
33686
|
+
active ? "bg-primary/10 text-primary shadow-sm" : "text-[#7B8184] hover:text-foreground dark:text-muted-foreground",
|
|
33542
33687
|
className
|
|
33543
33688
|
),
|
|
33544
33689
|
children
|
|
33545
33690
|
}
|
|
33546
33691
|
);
|
|
33547
33692
|
if (title) {
|
|
33548
|
-
return /* @__PURE__ */ (0,
|
|
33693
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Tooltip, { content: title, placement: "top", delay: { open: 200, close: 0 }, children: button });
|
|
33549
33694
|
}
|
|
33550
33695
|
return button;
|
|
33551
33696
|
});
|
|
33552
33697
|
ToolbarButton.displayName = "ToolbarButton";
|
|
33553
|
-
var ToolbarDivider = () => /* @__PURE__ */ (0,
|
|
33698
|
+
var ToolbarDivider = () => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { "aria-hidden": "true", className: "mx-2 h-9 w-px shrink-0 bg-[rgba(123,129,132,0.24)]" });
|
|
33554
33699
|
var TableInsertGrid = ({
|
|
33555
33700
|
insertLabel,
|
|
33556
33701
|
previewTemplate,
|
|
33557
33702
|
onInsert
|
|
33558
33703
|
}) => {
|
|
33559
|
-
const [selection, setSelection] =
|
|
33704
|
+
const [selection, setSelection] = import_react72.default.useState({ rows: 3, cols: 3 });
|
|
33560
33705
|
const maxRows = 8;
|
|
33561
33706
|
const maxCols = 8;
|
|
33562
|
-
return /* @__PURE__ */ (0,
|
|
33563
|
-
/* @__PURE__ */ (0,
|
|
33564
|
-
/* @__PURE__ */ (0,
|
|
33707
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "mb-2 rounded-xl border border-border/60 bg-muted/20 p-2", children: [
|
|
33708
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "mb-2 text-sm font-medium text-foreground", children: formatTableInsertLabel(previewTemplate, selection.rows, selection.cols) }),
|
|
33709
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "grid grid-cols-8 gap-1", onMouseLeave: () => setSelection((prev) => prev), children: Array.from({ length: maxRows }).map(
|
|
33565
33710
|
(_, rowIndex) => Array.from({ length: maxCols }).map((__, colIndex) => {
|
|
33566
33711
|
const rows = rowIndex + 1;
|
|
33567
33712
|
const cols = colIndex + 1;
|
|
33568
33713
|
const active = rows <= selection.rows && cols <= selection.cols;
|
|
33569
|
-
return /* @__PURE__ */ (0,
|
|
33714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
33570
33715
|
"button",
|
|
33571
33716
|
{
|
|
33572
33717
|
type: "button",
|
|
@@ -33584,7 +33729,7 @@ var TableInsertGrid = ({
|
|
|
33584
33729
|
);
|
|
33585
33730
|
})
|
|
33586
33731
|
) }),
|
|
33587
|
-
/* @__PURE__ */ (0,
|
|
33732
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "mt-2 text-xs text-muted-foreground", children: insertLabel })
|
|
33588
33733
|
] });
|
|
33589
33734
|
};
|
|
33590
33735
|
function applyTableCellAttribute(editor, name, value) {
|
|
@@ -33609,18 +33754,18 @@ var EditorToolbar = ({
|
|
|
33609
33754
|
letterSpacings
|
|
33610
33755
|
}) => {
|
|
33611
33756
|
const t = useSmartTranslations("UEditor");
|
|
33612
|
-
(0,
|
|
33757
|
+
(0, import_react73.useEditorState)({
|
|
33613
33758
|
editor,
|
|
33614
33759
|
selector: ({ transactionNumber }) => transactionNumber
|
|
33615
33760
|
});
|
|
33616
33761
|
const { textColors, highlightColors } = useEditorColors();
|
|
33617
|
-
const [showImageInput, setShowImageInput] = (0,
|
|
33618
|
-
const [showLinkInput, setShowLinkInput] = (0,
|
|
33619
|
-
const [isTableMenuOpen, setIsTableMenuOpen] = (0,
|
|
33620
|
-
const [preservedTableAnchorPos, setPreservedTableAnchorPos] = (0,
|
|
33621
|
-
const fileInputRef = (0,
|
|
33622
|
-
const [isUploadingImage, setIsUploadingImage] = (0,
|
|
33623
|
-
const [imageUploadError, setImageUploadError] = (0,
|
|
33762
|
+
const [showImageInput, setShowImageInput] = (0, import_react72.useState)(false);
|
|
33763
|
+
const [showLinkInput, setShowLinkInput] = (0, import_react72.useState)(false);
|
|
33764
|
+
const [isTableMenuOpen, setIsTableMenuOpen] = (0, import_react72.useState)(false);
|
|
33765
|
+
const [preservedTableAnchorPos, setPreservedTableAnchorPos] = (0, import_react72.useState)(null);
|
|
33766
|
+
const fileInputRef = (0, import_react72.useRef)(null);
|
|
33767
|
+
const [isUploadingImage, setIsUploadingImage] = (0, import_react72.useState)(false);
|
|
33768
|
+
const [imageUploadError, setImageUploadError] = (0, import_react72.useState)(null);
|
|
33624
33769
|
const isImageSelected = editor.isActive("image");
|
|
33625
33770
|
const imageAttrs = editor.getAttributes("image");
|
|
33626
33771
|
const tableAnchorPos = getTableAnchorPos(editor);
|
|
@@ -33643,10 +33788,10 @@ var EditorToolbar = ({
|
|
|
33643
33788
|
const currentHighlightColor = normalizeStyleValue(editor.getAttributes("highlight").color) || "";
|
|
33644
33789
|
const currentLineHeight = normalizeStyleValue(textStyleAttrs.lineHeight);
|
|
33645
33790
|
const currentLetterSpacing = normalizeStyleValue(textStyleAttrs.letterSpacing);
|
|
33646
|
-
const availableFontFamilies =
|
|
33647
|
-
const availableFontSizes =
|
|
33648
|
-
const availableLineHeights =
|
|
33649
|
-
const availableLetterSpacings =
|
|
33791
|
+
const availableFontFamilies = import_react72.default.useMemo(() => fontFamilies ?? getDefaultFontFamilies(t), [fontFamilies, t]);
|
|
33792
|
+
const availableFontSizes = import_react72.default.useMemo(() => fontSizes ?? getDefaultFontSizes(), [fontSizes]);
|
|
33793
|
+
const availableLineHeights = import_react72.default.useMemo(() => lineHeights ?? getDefaultLineHeights(), [lineHeights]);
|
|
33794
|
+
const availableLetterSpacings = import_react72.default.useMemo(() => letterSpacings ?? getDefaultLetterSpacings(), [letterSpacings]);
|
|
33650
33795
|
const currentFontFamilyDisplayValue = currentFontFamily.split(",")[0]?.trim() ?? currentFontFamily;
|
|
33651
33796
|
const currentFontFamilyLabel = availableFontFamilies.find((option) => normalizeStyleValue(option.value) === currentFontFamily)?.label ?? (currentFontFamilyDisplayValue || t("toolbar.fontDefault"));
|
|
33652
33797
|
const currentFontSizeLabel = availableFontSizes.find((option) => normalizeStyleValue(option.value) === currentFontSize)?.label ?? "13";
|
|
@@ -33683,31 +33828,31 @@ var EditorToolbar = ({
|
|
|
33683
33828
|
setIsUploadingImage(false);
|
|
33684
33829
|
};
|
|
33685
33830
|
if (variant === "minimal") {
|
|
33686
|
-
return /* @__PURE__ */ (0,
|
|
33687
|
-
/* @__PURE__ */ (0,
|
|
33688
|
-
/* @__PURE__ */ (0,
|
|
33689
|
-
/* @__PURE__ */ (0,
|
|
33690
|
-
/* @__PURE__ */ (0,
|
|
33691
|
-
/* @__PURE__ */ (0,
|
|
33692
|
-
/* @__PURE__ */ (0,
|
|
33831
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "flex flex-wrap items-center gap-0.5 border-b border-border/35 bg-muted/30 p-1.5", children: [
|
|
33832
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().undo().run(), disabled: !editor.can().undo(), title: t("toolbar.undo"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaUndoIcon, { className: "h-4 w-4" }) }),
|
|
33833
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().redo().run(), disabled: !editor.can().redo(), title: t("toolbar.redo"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaRedoIcon, { className: "h-4 w-4" }) }),
|
|
33834
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarDivider, {}),
|
|
33835
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaBoldIcon, { className: "h-4 w-4" }) }),
|
|
33836
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaItalicIcon, { className: "h-4 w-4" }) }),
|
|
33837
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
33693
33838
|
ToolbarButton,
|
|
33694
33839
|
{
|
|
33695
33840
|
onClick: () => editor.chain().focus().toggleBulletList().run(),
|
|
33696
33841
|
active: editor.isActive("bulletList"),
|
|
33697
33842
|
title: t("toolbar.bulletList"),
|
|
33698
|
-
children: /* @__PURE__ */ (0,
|
|
33843
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaListIcon, { className: "h-4 w-4" })
|
|
33699
33844
|
}
|
|
33700
33845
|
),
|
|
33701
|
-
/* @__PURE__ */ (0,
|
|
33846
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
33702
33847
|
DropdownMenu,
|
|
33703
33848
|
{
|
|
33704
|
-
trigger: /* @__PURE__ */ (0,
|
|
33849
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(ToolbarButton, { onClick: () => {
|
|
33705
33850
|
}, active: editor.isActive("formCheckbox"), title: t("slashCommand.formCheckbox"), children: [
|
|
33706
|
-
/* @__PURE__ */ (0,
|
|
33707
|
-
/* @__PURE__ */ (0,
|
|
33851
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.SquareCheckBig, { className: "w-4 h-4" }),
|
|
33852
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.ChevronDown, { className: "w-3 h-3" })
|
|
33708
33853
|
] }),
|
|
33709
33854
|
children: [
|
|
33710
|
-
/* @__PURE__ */ (0,
|
|
33855
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
33711
33856
|
DropdownMenuItem,
|
|
33712
33857
|
{
|
|
33713
33858
|
icon: import_lucide_react52.SquareCheckBig,
|
|
@@ -33715,7 +33860,7 @@ var EditorToolbar = ({
|
|
|
33715
33860
|
onClick: () => editor.chain().focus().setFormCheckbox().run()
|
|
33716
33861
|
}
|
|
33717
33862
|
),
|
|
33718
|
-
/* @__PURE__ */ (0,
|
|
33863
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
33719
33864
|
DropdownMenuItem,
|
|
33720
33865
|
{
|
|
33721
33866
|
icon: import_lucide_react52.CircleCheckBig,
|
|
@@ -33726,12 +33871,12 @@ var EditorToolbar = ({
|
|
|
33726
33871
|
]
|
|
33727
33872
|
}
|
|
33728
33873
|
),
|
|
33729
|
-
/* @__PURE__ */ (0,
|
|
33874
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
33730
33875
|
DropdownMenu,
|
|
33731
33876
|
{
|
|
33732
33877
|
contentClassName: "min-w-72",
|
|
33733
|
-
trigger: /* @__PURE__ */ (0,
|
|
33734
|
-
children: showLinkInput ? /* @__PURE__ */ (0,
|
|
33878
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => setShowLinkInput(!editor.isActive("link")), active: editor.isActive("link"), title: t("toolbar.link"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaLinkIcon, { className: "h-4 w-4" }) }),
|
|
33879
|
+
children: showLinkInput ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
33735
33880
|
LinkInput,
|
|
33736
33881
|
{
|
|
33737
33882
|
initialUrl: String(editor.getAttributes("link").href ?? ""),
|
|
@@ -33741,8 +33886,8 @@ var EditorToolbar = ({
|
|
|
33741
33886
|
},
|
|
33742
33887
|
onCancel: () => setShowLinkInput(false)
|
|
33743
33888
|
}
|
|
33744
|
-
) : /* @__PURE__ */ (0,
|
|
33745
|
-
/* @__PURE__ */ (0,
|
|
33889
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
|
|
33890
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
33746
33891
|
DropdownMenuItem,
|
|
33747
33892
|
{
|
|
33748
33893
|
icon: import_lucide_react52.Link,
|
|
@@ -33752,7 +33897,7 @@ var EditorToolbar = ({
|
|
|
33752
33897
|
closeOnSelect: false
|
|
33753
33898
|
}
|
|
33754
33899
|
),
|
|
33755
|
-
/* @__PURE__ */ (0,
|
|
33900
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
33756
33901
|
DropdownMenuItem,
|
|
33757
33902
|
{
|
|
33758
33903
|
icon: import_lucide_react52.Trash2,
|
|
@@ -33768,861 +33913,875 @@ var EditorToolbar = ({
|
|
|
33768
33913
|
] });
|
|
33769
33914
|
}
|
|
33770
33915
|
const VerticalAlignActiveIcon = currentCellVerticalAlign === "middle" ? import_lucide_react52.AlignCenterVertical : currentCellVerticalAlign === "bottom" ? import_lucide_react52.AlignEndVertical : import_lucide_react52.AlignStartVertical;
|
|
33771
|
-
return /* @__PURE__ */ (0,
|
|
33772
|
-
|
|
33773
|
-
|
|
33774
|
-
|
|
33775
|
-
|
|
33776
|
-
|
|
33777
|
-
|
|
33778
|
-
|
|
33779
|
-
] }),
|
|
33780
|
-
contentClassName: "max-h-80 overflow-y-auto min-w-56 p-2",
|
|
33781
|
-
children: availableFontFamilies.map((option) => /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33782
|
-
DropdownMenuItem,
|
|
33783
|
-
{
|
|
33784
|
-
label: option.label,
|
|
33785
|
-
onClick: () => editor.chain().focus().setFontFamily(option.value).run(),
|
|
33786
|
-
active: normalizeStyleValue(option.value) === (currentFontFamily || normalizeStyleValue(defaultFontFamilyValue)),
|
|
33787
|
-
className: "font-medium"
|
|
33788
|
-
},
|
|
33789
|
-
option.value
|
|
33790
|
-
))
|
|
33791
|
-
}
|
|
33792
|
-
),
|
|
33793
|
-
(isMediumFull || isFull) && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33794
|
-
DropdownMenu,
|
|
33795
|
-
{
|
|
33796
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(ToolbarButton, { onClick: () => {
|
|
33797
|
-
}, title: t("toolbar.fontSize"), className: "px-1.5 w-auto gap-1", children: [
|
|
33798
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "flex items-center gap-0.5", children: [
|
|
33799
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ChevronsUpDown, { className: "h-3 w-3 text-muted-foreground", strokeWidth: 2.5 }),
|
|
33800
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "min-w-4 text-center text-xs font-semibold leading-none", children: displayedFontSizeLabel })
|
|
33801
|
-
] }),
|
|
33802
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ChevronDown, { className: "h-3 w-3 text-muted-foreground" })
|
|
33803
|
-
] }),
|
|
33804
|
-
contentClassName: "max-h-80 overflow-y-auto min-w-32 p-2",
|
|
33805
|
-
children: availableFontSizes.map((option) => /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33806
|
-
DropdownMenuItem,
|
|
33916
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
33917
|
+
"div",
|
|
33918
|
+
{
|
|
33919
|
+
role: "toolbar",
|
|
33920
|
+
className: "flex min-h-[60px] flex-nowrap items-center gap-1 overflow-x-auto border-b border-[rgba(196,197,213,0.6)] bg-[#F4F4F4] px-3 py-3 dark:bg-muted/60",
|
|
33921
|
+
children: [
|
|
33922
|
+
isFull && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
33923
|
+
DropdownMenu,
|
|
33807
33924
|
{
|
|
33808
|
-
|
|
33809
|
-
|
|
33810
|
-
active: normalizeStyleValue(option.value) === activeFontSize
|
|
33811
|
-
},
|
|
33812
|
-
option.value
|
|
33813
|
-
))
|
|
33814
|
-
}
|
|
33815
|
-
),
|
|
33816
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
|
|
33817
|
-
DropdownMenu,
|
|
33818
|
-
{
|
|
33819
|
-
contentClassName: "p-1",
|
|
33820
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(ToolbarButton, { onClick: () => {
|
|
33821
|
-
}, title: t("toolbar.textStyle"), className: "px-1.5 w-auto gap-0.5", children: [
|
|
33822
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Type, { className: "w-4 h-4" }),
|
|
33823
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ChevronDown, { className: "h-3 w-3 text-muted-foreground" })
|
|
33824
|
-
] }),
|
|
33825
|
-
children: [
|
|
33826
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33827
|
-
DropdownMenuItem,
|
|
33828
|
-
{
|
|
33829
|
-
icon: import_lucide_react52.Type,
|
|
33830
|
-
label: t("toolbar.normal"),
|
|
33831
|
-
onClick: () => editor.chain().focus().setParagraph().run(),
|
|
33832
|
-
active: editor.isActive("paragraph")
|
|
33833
|
-
}
|
|
33834
|
-
),
|
|
33835
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33836
|
-
DropdownMenuItem,
|
|
33837
|
-
{
|
|
33838
|
-
icon: import_lucide_react52.Heading1,
|
|
33839
|
-
label: t("toolbar.heading1"),
|
|
33840
|
-
onClick: () => editor.chain().focus().toggleHeading({ level: 1 }).run(),
|
|
33841
|
-
active: editor.isActive("heading", { level: 1 }),
|
|
33842
|
-
shortcut: "Ctrl+Alt+1"
|
|
33843
|
-
}
|
|
33844
|
-
),
|
|
33845
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33846
|
-
DropdownMenuItem,
|
|
33847
|
-
{
|
|
33848
|
-
icon: import_lucide_react52.Heading2,
|
|
33849
|
-
label: t("toolbar.heading2"),
|
|
33850
|
-
onClick: () => editor.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
33851
|
-
active: editor.isActive("heading", { level: 2 }),
|
|
33852
|
-
shortcut: "Ctrl+Alt+2"
|
|
33853
|
-
}
|
|
33854
|
-
),
|
|
33855
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33856
|
-
DropdownMenuItem,
|
|
33857
|
-
{
|
|
33858
|
-
icon: import_lucide_react52.Heading3,
|
|
33859
|
-
label: t("toolbar.heading3"),
|
|
33860
|
-
onClick: () => editor.chain().focus().toggleHeading({ level: 3 }).run(),
|
|
33861
|
-
active: editor.isActive("heading", { level: 3 }),
|
|
33862
|
-
shortcut: "Ctrl+Alt+3"
|
|
33863
|
-
}
|
|
33864
|
-
)
|
|
33865
|
-
]
|
|
33866
|
-
}
|
|
33867
|
-
),
|
|
33868
|
-
isFull && /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(import_jsx_runtime92.Fragment, { children: [
|
|
33869
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
|
|
33870
|
-
DropdownMenu,
|
|
33871
|
-
{
|
|
33872
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(ToolbarButton, { onClick: () => {
|
|
33873
|
-
}, title: t("toolbar.lineHeight"), className: "gap-0.5", children: [
|
|
33874
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ArrowUp, { className: "w-3 h-3" }),
|
|
33875
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ArrowDown, { className: "w-3 h-3" })
|
|
33876
|
-
] }),
|
|
33877
|
-
contentClassName: "max-h-72 overflow-y-auto p-1",
|
|
33878
|
-
children: [
|
|
33879
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33880
|
-
DropdownMenuItem,
|
|
33925
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
33926
|
+
ToolbarButton,
|
|
33881
33927
|
{
|
|
33882
|
-
|
|
33883
|
-
|
|
33884
|
-
|
|
33885
|
-
|
|
33928
|
+
onClick: () => {
|
|
33929
|
+
},
|
|
33930
|
+
title: t("toolbar.fontFamily"),
|
|
33931
|
+
className: "h-9 w-[200px] max-w-[200px] justify-between gap-3 rounded-lg border border-[rgba(196,197,213,0.6)] bg-white px-3 text-[#404040] shadow-[0_1px_2px_rgba(0,0,0,0.07)] hover:bg-white hover:text-[#404040] dark:bg-background dark:text-foreground",
|
|
33932
|
+
children: [
|
|
33933
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "min-w-0 flex-1 truncate text-left text-sm font-normal", style: { fontFamily: displayedFontFamilyValue || void 0 }, children: displayedFontFamilyLabel }),
|
|
33934
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaChevronDownIcon, { className: "h-3 w-3 shrink-0 text-[#7B8184]" })
|
|
33935
|
+
]
|
|
33886
33936
|
}
|
|
33887
33937
|
),
|
|
33888
|
-
|
|
33938
|
+
contentClassName: "max-h-80 overflow-y-auto min-w-56 p-2",
|
|
33939
|
+
children: availableFontFamilies.map((option) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
33889
33940
|
DropdownMenuItem,
|
|
33890
33941
|
{
|
|
33891
33942
|
label: option.label,
|
|
33892
|
-
onClick: () => editor.chain().focus().
|
|
33893
|
-
active: normalizeStyleValue(option.value) ===
|
|
33943
|
+
onClick: () => editor.chain().focus().setFontFamily(option.value).run(),
|
|
33944
|
+
active: normalizeStyleValue(option.value) === (currentFontFamily || normalizeStyleValue(defaultFontFamilyValue)),
|
|
33945
|
+
className: "font-medium"
|
|
33894
33946
|
},
|
|
33895
33947
|
option.value
|
|
33896
33948
|
))
|
|
33897
|
-
|
|
33898
|
-
|
|
33899
|
-
|
|
33900
|
-
|
|
33901
|
-
|
|
33902
|
-
|
|
33903
|
-
|
|
33904
|
-
}, title: t("toolbar.letterSpacing"), className: "gap-0.5", children: [
|
|
33905
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ArrowLeft, { className: "w-3 h-3" }),
|
|
33906
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ArrowRight, { className: "w-3 h-3" })
|
|
33907
|
-
] }),
|
|
33908
|
-
contentClassName: "max-h-72 overflow-y-auto p-1",
|
|
33909
|
-
children: [
|
|
33910
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33911
|
-
DropdownMenuItem,
|
|
33949
|
+
}
|
|
33950
|
+
),
|
|
33951
|
+
(isMediumFull || isFull) && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
33952
|
+
DropdownMenu,
|
|
33953
|
+
{
|
|
33954
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
33955
|
+
ToolbarButton,
|
|
33912
33956
|
{
|
|
33913
|
-
|
|
33914
|
-
|
|
33915
|
-
|
|
33916
|
-
|
|
33957
|
+
onClick: () => {
|
|
33958
|
+
},
|
|
33959
|
+
title: t("toolbar.fontSize"),
|
|
33960
|
+
className: "h-9 w-20 justify-between gap-3 rounded-lg border border-[rgba(196,197,213,0.6)] bg-white px-3 text-[#404040] shadow-[0_1px_2px_rgba(0,0,0,0.07)] hover:bg-white hover:text-[#404040] dark:bg-background dark:text-foreground",
|
|
33961
|
+
children: [
|
|
33962
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "text-sm font-normal leading-none", children: displayedFontSizeLabel }),
|
|
33963
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaChevronDownIcon, { className: "h-3 w-3 shrink-0 text-[#7B8184]" })
|
|
33964
|
+
]
|
|
33917
33965
|
}
|
|
33918
33966
|
),
|
|
33919
|
-
|
|
33967
|
+
contentClassName: "max-h-80 overflow-y-auto min-w-32 p-2",
|
|
33968
|
+
children: availableFontSizes.map((option) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
33920
33969
|
DropdownMenuItem,
|
|
33921
33970
|
{
|
|
33922
33971
|
label: option.label,
|
|
33923
|
-
onClick: () => editor.chain().focus().
|
|
33924
|
-
active: normalizeStyleValue(option.value) ===
|
|
33972
|
+
onClick: () => editor.chain().focus().setFontSize(option.value).run(),
|
|
33973
|
+
active: normalizeStyleValue(option.value) === activeFontSize
|
|
33925
33974
|
},
|
|
33926
33975
|
option.value
|
|
33927
33976
|
))
|
|
33928
|
-
|
|
33929
|
-
|
|
33930
|
-
|
|
33931
|
-
|
|
33932
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarDivider, {}),
|
|
33933
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Bold, { className: "w-4 h-4" }) }),
|
|
33934
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Italic, { className: "w-4 h-4" }) }),
|
|
33935
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33936
|
-
ToolbarButton,
|
|
33937
|
-
{
|
|
33938
|
-
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
33939
|
-
active: editor.isActive("underline"),
|
|
33940
|
-
title: t("toolbar.underline"),
|
|
33941
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Underline, { className: "w-4 h-4" })
|
|
33942
|
-
}
|
|
33943
|
-
),
|
|
33944
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleStrike().run(), active: editor.isActive("strike"), title: t("toolbar.strike"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Strikethrough, { className: "w-4 h-4" }) }),
|
|
33945
|
-
(isMediumFull || isFull) && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleCode().run(), active: editor.isActive("code"), title: t("toolbar.code"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Code, { className: "w-4 h-4" }) }),
|
|
33946
|
-
isFull && /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(import_jsx_runtime92.Fragment, { children: [
|
|
33947
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33948
|
-
ToolbarButton,
|
|
33949
|
-
{
|
|
33950
|
-
onClick: () => editor.chain().focus().toggleSubscript().run(),
|
|
33951
|
-
active: editor.isActive("subscript"),
|
|
33952
|
-
title: t("toolbar.subscript"),
|
|
33953
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Subscript, { className: "w-4 h-4" })
|
|
33954
|
-
}
|
|
33955
|
-
),
|
|
33956
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33957
|
-
ToolbarButton,
|
|
33958
|
-
{
|
|
33959
|
-
onClick: () => editor.chain().focus().toggleSuperscript().run(),
|
|
33960
|
-
active: editor.isActive("superscript"),
|
|
33961
|
-
title: t("toolbar.superscript"),
|
|
33962
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Superscript, { className: "w-4 h-4" })
|
|
33963
|
-
}
|
|
33964
|
-
)
|
|
33965
|
-
] }),
|
|
33966
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33967
|
-
DropdownMenu,
|
|
33968
|
-
{
|
|
33969
|
-
contentClassName: "min-w-72",
|
|
33970
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => setShowLinkInput(!editor.isActive("link")), active: editor.isActive("link"), title: t("toolbar.link"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Link, { className: "w-4 h-4" }) }),
|
|
33971
|
-
children: showLinkInput ? /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
33972
|
-
LinkInput,
|
|
33977
|
+
}
|
|
33978
|
+
),
|
|
33979
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
33980
|
+
DropdownMenu,
|
|
33973
33981
|
{
|
|
33974
|
-
|
|
33975
|
-
|
|
33976
|
-
|
|
33977
|
-
|
|
33978
|
-
|
|
33979
|
-
|
|
33982
|
+
contentClassName: "p-1",
|
|
33983
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(ToolbarButton, { onClick: () => {
|
|
33984
|
+
}, title: t("toolbar.textStyle"), className: "px-1.5 w-auto gap-0.5", children: [
|
|
33985
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaTextStyleIcon, { className: "h-4 w-4" }),
|
|
33986
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaChevronDownIcon, { className: "h-2.5 w-2.5" })
|
|
33987
|
+
] }),
|
|
33988
|
+
children: [
|
|
33989
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
33990
|
+
DropdownMenuItem,
|
|
33991
|
+
{
|
|
33992
|
+
icon: import_lucide_react52.Type,
|
|
33993
|
+
label: t("toolbar.normal"),
|
|
33994
|
+
onClick: () => editor.chain().focus().setParagraph().run(),
|
|
33995
|
+
active: editor.isActive("paragraph")
|
|
33996
|
+
}
|
|
33997
|
+
),
|
|
33998
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
33999
|
+
DropdownMenuItem,
|
|
34000
|
+
{
|
|
34001
|
+
icon: import_lucide_react52.Heading1,
|
|
34002
|
+
label: t("toolbar.heading1"),
|
|
34003
|
+
onClick: () => editor.chain().focus().toggleHeading({ level: 1 }).run(),
|
|
34004
|
+
active: editor.isActive("heading", { level: 1 }),
|
|
34005
|
+
shortcut: "Ctrl+Alt+1"
|
|
34006
|
+
}
|
|
34007
|
+
),
|
|
34008
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34009
|
+
DropdownMenuItem,
|
|
34010
|
+
{
|
|
34011
|
+
icon: import_lucide_react52.Heading2,
|
|
34012
|
+
label: t("toolbar.heading2"),
|
|
34013
|
+
onClick: () => editor.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
34014
|
+
active: editor.isActive("heading", { level: 2 }),
|
|
34015
|
+
shortcut: "Ctrl+Alt+2"
|
|
34016
|
+
}
|
|
34017
|
+
),
|
|
34018
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34019
|
+
DropdownMenuItem,
|
|
34020
|
+
{
|
|
34021
|
+
icon: import_lucide_react52.Heading3,
|
|
34022
|
+
label: t("toolbar.heading3"),
|
|
34023
|
+
onClick: () => editor.chain().focus().toggleHeading({ level: 3 }).run(),
|
|
34024
|
+
active: editor.isActive("heading", { level: 3 }),
|
|
34025
|
+
shortcut: "Ctrl+Alt+3"
|
|
34026
|
+
}
|
|
34027
|
+
)
|
|
34028
|
+
]
|
|
33980
34029
|
}
|
|
33981
|
-
)
|
|
33982
|
-
|
|
33983
|
-
|
|
34030
|
+
),
|
|
34031
|
+
isFull && /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
|
|
34032
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
34033
|
+
DropdownMenu,
|
|
33984
34034
|
{
|
|
33985
|
-
|
|
33986
|
-
|
|
33987
|
-
|
|
33988
|
-
|
|
33989
|
-
|
|
34035
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => {
|
|
34036
|
+
}, title: t("toolbar.lineHeight"), className: "gap-0.5", children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaLineHeightIcon, { className: "h-4 w-4" }) }),
|
|
34037
|
+
contentClassName: "max-h-72 overflow-y-auto p-1",
|
|
34038
|
+
children: [
|
|
34039
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34040
|
+
DropdownMenuItem,
|
|
34041
|
+
{
|
|
34042
|
+
icon: import_lucide_react52.Type,
|
|
34043
|
+
label: t("toolbar.lineHeightDefault"),
|
|
34044
|
+
onClick: () => editor.chain().focus().unsetLineHeight().run(),
|
|
34045
|
+
active: !currentLineHeight
|
|
34046
|
+
}
|
|
34047
|
+
),
|
|
34048
|
+
availableLineHeights.map((option) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34049
|
+
DropdownMenuItem,
|
|
34050
|
+
{
|
|
34051
|
+
label: option.label,
|
|
34052
|
+
onClick: () => editor.chain().focus().setLineHeight(option.value).run(),
|
|
34053
|
+
active: normalizeStyleValue(option.value) === currentLineHeight
|
|
34054
|
+
},
|
|
34055
|
+
option.value
|
|
34056
|
+
))
|
|
34057
|
+
]
|
|
33990
34058
|
}
|
|
33991
34059
|
),
|
|
33992
|
-
/* @__PURE__ */ (0,
|
|
33993
|
-
|
|
34060
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
34061
|
+
DropdownMenu,
|
|
33994
34062
|
{
|
|
33995
|
-
|
|
33996
|
-
|
|
33997
|
-
|
|
33998
|
-
|
|
33999
|
-
|
|
34063
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => {
|
|
34064
|
+
}, title: t("toolbar.letterSpacing"), className: "gap-0.5", children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaLetterSpacingIcon, { className: "h-4 w-4" }) }),
|
|
34065
|
+
contentClassName: "max-h-72 overflow-y-auto p-1",
|
|
34066
|
+
children: [
|
|
34067
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34068
|
+
DropdownMenuItem,
|
|
34069
|
+
{
|
|
34070
|
+
icon: import_lucide_react52.Type,
|
|
34071
|
+
label: t("toolbar.letterSpacingDefault"),
|
|
34072
|
+
onClick: () => editor.chain().focus().unsetLetterSpacing().run(),
|
|
34073
|
+
active: !currentLetterSpacing
|
|
34074
|
+
}
|
|
34075
|
+
),
|
|
34076
|
+
availableLetterSpacings.map((option) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34077
|
+
DropdownMenuItem,
|
|
34078
|
+
{
|
|
34079
|
+
label: option.label,
|
|
34080
|
+
onClick: () => editor.chain().focus().setLetterSpacing(option.value).run(),
|
|
34081
|
+
active: normalizeStyleValue(option.value) === currentLetterSpacing
|
|
34082
|
+
},
|
|
34083
|
+
option.value
|
|
34084
|
+
))
|
|
34085
|
+
]
|
|
34000
34086
|
}
|
|
34001
34087
|
)
|
|
34002
|
-
] })
|
|
34003
|
-
}
|
|
34004
|
-
),
|
|
34005
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarDivider, {}),
|
|
34006
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34007
|
-
DropdownMenu,
|
|
34008
|
-
{
|
|
34009
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(ToolbarButton, { onClick: () => {
|
|
34010
|
-
}, title: t("colors.textColor"), children: [
|
|
34011
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(TextColorIcon, { color: currentTextColor }),
|
|
34012
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ChevronDown, { className: "w-3 h-3" })
|
|
34013
34088
|
] }),
|
|
34014
|
-
|
|
34015
|
-
|
|
34016
|
-
|
|
34017
|
-
|
|
34018
|
-
|
|
34019
|
-
onSelect: (color) => {
|
|
34020
|
-
if (color === "inherit") {
|
|
34021
|
-
editor.chain().focus().unsetColor().run();
|
|
34022
|
-
} else {
|
|
34023
|
-
editor.chain().focus().setColor(color).run();
|
|
34024
|
-
}
|
|
34025
|
-
},
|
|
34026
|
-
label: t("colors.textColor")
|
|
34027
|
-
}
|
|
34028
|
-
)
|
|
34029
|
-
}
|
|
34030
|
-
),
|
|
34031
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34032
|
-
DropdownMenu,
|
|
34033
|
-
{
|
|
34034
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(ToolbarButton, { onClick: () => {
|
|
34035
|
-
}, active: editor.isActive("highlight"), title: t("colors.highlight"), children: [
|
|
34036
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(HighlightColorIcon, { color: currentHighlightColor }),
|
|
34037
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ChevronDown, { className: "w-3 h-3" })
|
|
34038
|
-
] }),
|
|
34039
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34040
|
-
EditorColorPalette,
|
|
34089
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarDivider, {}),
|
|
34090
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaBoldIcon, { className: "h-4 w-4" }) }),
|
|
34091
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaItalicIcon, { className: "h-4 w-4" }) }),
|
|
34092
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34093
|
+
ToolbarButton,
|
|
34041
34094
|
{
|
|
34042
|
-
|
|
34043
|
-
|
|
34044
|
-
|
|
34045
|
-
|
|
34046
|
-
editor.chain().focus().unsetHighlight().run();
|
|
34047
|
-
} else {
|
|
34048
|
-
editor.chain().focus().toggleHighlight({ color }).run();
|
|
34049
|
-
}
|
|
34050
|
-
},
|
|
34051
|
-
label: t("colors.highlight")
|
|
34095
|
+
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
34096
|
+
active: editor.isActive("underline"),
|
|
34097
|
+
title: t("toolbar.underline"),
|
|
34098
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaUnderlineIcon, { className: "h-4 w-4" })
|
|
34052
34099
|
}
|
|
34053
|
-
)
|
|
34054
|
-
|
|
34055
|
-
|
|
34056
|
-
|
|
34057
|
-
|
|
34058
|
-
|
|
34059
|
-
DropdownMenu,
|
|
34060
|
-
{
|
|
34061
|
-
contentClassName: "p-0 overflow-hidden",
|
|
34062
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => {
|
|
34063
|
-
}, title: t("toolbar.emoji"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Smile, { className: "w-4 h-4" }) }),
|
|
34064
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34065
|
-
EmojiPicker2,
|
|
34100
|
+
),
|
|
34101
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleStrike().run(), active: editor.isActive("strike"), title: t("toolbar.strike"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaStrikeIcon, { className: "h-4 w-4" }) }),
|
|
34102
|
+
(isMediumFull || isFull) && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleCode().run(), active: editor.isActive("code"), title: t("toolbar.code"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaCodeIcon, { className: "h-4 w-4" }) }),
|
|
34103
|
+
isFull && /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
|
|
34104
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34105
|
+
ToolbarButton,
|
|
34066
34106
|
{
|
|
34067
|
-
|
|
34068
|
-
|
|
34069
|
-
|
|
34107
|
+
onClick: () => editor.chain().focus().toggleSubscript().run(),
|
|
34108
|
+
active: editor.isActive("subscript"),
|
|
34109
|
+
title: t("toolbar.subscript"),
|
|
34110
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaSubscriptIcon, { className: "h-4 w-4" })
|
|
34111
|
+
}
|
|
34112
|
+
),
|
|
34113
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34114
|
+
ToolbarButton,
|
|
34115
|
+
{
|
|
34116
|
+
onClick: () => editor.chain().focus().toggleSuperscript().run(),
|
|
34117
|
+
active: editor.isActive("superscript"),
|
|
34118
|
+
title: t("toolbar.superscript"),
|
|
34119
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaSuperscriptIcon, { className: "h-4 w-4" })
|
|
34070
34120
|
}
|
|
34071
34121
|
)
|
|
34072
|
-
}
|
|
34073
|
-
|
|
34074
|
-
|
|
34075
|
-
|
|
34076
|
-
|
|
34077
|
-
|
|
34078
|
-
|
|
34079
|
-
|
|
34080
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(ToolbarButton, { onClick: () => {
|
|
34081
|
-
}, title: t("toolbar.alignment"), children: [
|
|
34082
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.AlignLeft, { className: "w-4 h-4" }),
|
|
34083
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ChevronDown, { className: "w-3 h-3" })
|
|
34084
|
-
] }),
|
|
34085
|
-
children: [
|
|
34086
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34087
|
-
DropdownMenuItem,
|
|
34088
|
-
{
|
|
34089
|
-
icon: import_lucide_react52.AlignLeft,
|
|
34090
|
-
label: t("toolbar.alignLeft"),
|
|
34091
|
-
onClick: () => editor.chain().focus().setTextAlign("left").run(),
|
|
34092
|
-
active: editor.isActive({ textAlign: "left" })
|
|
34093
|
-
}
|
|
34094
|
-
),
|
|
34095
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34096
|
-
DropdownMenuItem,
|
|
34097
|
-
{
|
|
34098
|
-
icon: import_lucide_react52.AlignCenter,
|
|
34099
|
-
label: t("toolbar.alignCenter"),
|
|
34100
|
-
onClick: () => editor.chain().focus().setTextAlign("center").run(),
|
|
34101
|
-
active: editor.isActive({ textAlign: "center" })
|
|
34102
|
-
}
|
|
34103
|
-
),
|
|
34104
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34105
|
-
DropdownMenuItem,
|
|
34106
|
-
{
|
|
34107
|
-
icon: import_lucide_react52.AlignRight,
|
|
34108
|
-
label: t("toolbar.alignRight"),
|
|
34109
|
-
onClick: () => editor.chain().focus().setTextAlign("right").run(),
|
|
34110
|
-
active: editor.isActive({ textAlign: "right" })
|
|
34111
|
-
}
|
|
34112
|
-
),
|
|
34113
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34114
|
-
DropdownMenuItem,
|
|
34122
|
+
] }),
|
|
34123
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34124
|
+
DropdownMenu,
|
|
34125
|
+
{
|
|
34126
|
+
contentClassName: "min-w-72",
|
|
34127
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => setShowLinkInput(!editor.isActive("link")), active: editor.isActive("link"), title: t("toolbar.link"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaLinkIcon, { className: "h-4 w-4" }) }),
|
|
34128
|
+
children: showLinkInput ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34129
|
+
LinkInput,
|
|
34115
34130
|
{
|
|
34116
|
-
|
|
34117
|
-
|
|
34118
|
-
|
|
34119
|
-
|
|
34131
|
+
initialUrl: String(editor.getAttributes("link").href ?? ""),
|
|
34132
|
+
onSubmit: (url) => {
|
|
34133
|
+
applyEditorLink(editor, url);
|
|
34134
|
+
setShowLinkInput(false);
|
|
34135
|
+
},
|
|
34136
|
+
onCancel: () => setShowLinkInput(false)
|
|
34120
34137
|
}
|
|
34121
|
-
),
|
|
34122
|
-
|
|
34123
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "my-1 border-t" }),
|
|
34124
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34125
|
-
DropdownMenuItem,
|
|
34126
|
-
{
|
|
34127
|
-
icon: import_lucide_react52.AlignStartVertical,
|
|
34128
|
-
label: t("tableMenu.alignVerticalTop") || "Align top",
|
|
34129
|
-
onClick: () => applyTableCellAttribute(editor, "verticalAlign", "top"),
|
|
34130
|
-
active: currentCellVerticalAlign === "top"
|
|
34131
|
-
}
|
|
34132
|
-
),
|
|
34133
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34138
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
|
|
34139
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34134
34140
|
DropdownMenuItem,
|
|
34135
34141
|
{
|
|
34136
|
-
icon: import_lucide_react52.
|
|
34137
|
-
label: t("
|
|
34138
|
-
onClick: () =>
|
|
34139
|
-
active:
|
|
34142
|
+
icon: import_lucide_react52.Link,
|
|
34143
|
+
label: t("toolbar.link"),
|
|
34144
|
+
onClick: () => setShowLinkInput(true),
|
|
34145
|
+
active: editor.isActive("link"),
|
|
34146
|
+
closeOnSelect: false
|
|
34140
34147
|
}
|
|
34141
34148
|
),
|
|
34142
|
-
/* @__PURE__ */ (0,
|
|
34149
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34143
34150
|
DropdownMenuItem,
|
|
34144
34151
|
{
|
|
34145
|
-
icon: import_lucide_react52.
|
|
34146
|
-
label: t("
|
|
34147
|
-
onClick: () =>
|
|
34148
|
-
|
|
34152
|
+
icon: import_lucide_react52.Trash2,
|
|
34153
|
+
label: t("toolbar.removeLink"),
|
|
34154
|
+
onClick: () => editor.chain().focus().extendMarkRange("link").unsetLink().run(),
|
|
34155
|
+
disabled: !editor.isActive("link"),
|
|
34156
|
+
destructive: true
|
|
34149
34157
|
}
|
|
34150
34158
|
)
|
|
34151
34159
|
] })
|
|
34152
|
-
|
|
34153
|
-
|
|
34154
|
-
|
|
34155
|
-
|
|
34156
|
-
|
|
34157
|
-
|
|
34158
|
-
|
|
34159
|
-
|
|
34160
|
-
|
|
34161
|
-
|
|
34162
|
-
|
|
34163
|
-
|
|
34164
|
-
|
|
34165
|
-
DropdownMenuItem,
|
|
34160
|
+
}
|
|
34161
|
+
),
|
|
34162
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarDivider, {}),
|
|
34163
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34164
|
+
DropdownMenu,
|
|
34165
|
+
{
|
|
34166
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(ToolbarButton, { onClick: () => {
|
|
34167
|
+
}, title: t("colors.textColor"), children: [
|
|
34168
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(TextColorIcon, { color: currentTextColor }),
|
|
34169
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaChevronDownIcon, { className: "h-2.5 w-2.5" })
|
|
34170
|
+
] }),
|
|
34171
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34172
|
+
EditorColorPalette,
|
|
34166
34173
|
{
|
|
34167
|
-
|
|
34168
|
-
|
|
34169
|
-
|
|
34170
|
-
|
|
34174
|
+
colors: textColors,
|
|
34175
|
+
currentColor: currentTextColor,
|
|
34176
|
+
onSelect: (color) => {
|
|
34177
|
+
if (color === "inherit") {
|
|
34178
|
+
editor.chain().focus().unsetColor().run();
|
|
34179
|
+
} else {
|
|
34180
|
+
editor.chain().focus().setColor(color).run();
|
|
34181
|
+
}
|
|
34182
|
+
},
|
|
34183
|
+
label: t("colors.textColor")
|
|
34171
34184
|
}
|
|
34172
|
-
)
|
|
34173
|
-
|
|
34174
|
-
|
|
34185
|
+
)
|
|
34186
|
+
}
|
|
34187
|
+
),
|
|
34188
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34189
|
+
DropdownMenu,
|
|
34190
|
+
{
|
|
34191
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(ToolbarButton, { onClick: () => {
|
|
34192
|
+
}, active: editor.isActive("highlight"), title: t("colors.highlight"), children: [
|
|
34193
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(HighlightColorIcon, { color: currentHighlightColor }),
|
|
34194
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaChevronDownIcon, { className: "h-2.5 w-2.5" })
|
|
34195
|
+
] }),
|
|
34196
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34197
|
+
EditorColorPalette,
|
|
34175
34198
|
{
|
|
34176
|
-
|
|
34177
|
-
|
|
34178
|
-
|
|
34179
|
-
|
|
34199
|
+
colors: highlightColors,
|
|
34200
|
+
currentColor: currentHighlightColor,
|
|
34201
|
+
onSelect: (color) => {
|
|
34202
|
+
if (color === "") {
|
|
34203
|
+
editor.chain().focus().unsetHighlight().run();
|
|
34204
|
+
} else {
|
|
34205
|
+
editor.chain().focus().toggleHighlight({ color }).run();
|
|
34206
|
+
}
|
|
34207
|
+
},
|
|
34208
|
+
label: t("colors.highlight")
|
|
34180
34209
|
}
|
|
34181
34210
|
)
|
|
34182
|
-
|
|
34183
|
-
|
|
34184
|
-
|
|
34185
|
-
|
|
34186
|
-
|
|
34187
|
-
|
|
34188
|
-
DropdownMenu,
|
|
34189
|
-
{
|
|
34190
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(ToolbarButton, { onClick: () => {
|
|
34191
|
-
}, title: t("toolbar.bulletList"), children: [
|
|
34192
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.List, { className: "w-4 h-4" }),
|
|
34193
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ChevronDown, { className: "w-3 h-3" })
|
|
34194
|
-
] }),
|
|
34195
|
-
children: [
|
|
34196
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34197
|
-
DropdownMenuItem,
|
|
34198
|
-
{
|
|
34199
|
-
icon: import_lucide_react52.List,
|
|
34200
|
-
label: t("toolbar.bulletList"),
|
|
34201
|
-
onClick: () => editor.chain().focus().toggleBulletList().run(),
|
|
34202
|
-
active: editor.isActive("bulletList"),
|
|
34203
|
-
shortcut: "Ctrl+Shift+8"
|
|
34204
|
-
}
|
|
34205
|
-
),
|
|
34206
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34207
|
-
DropdownMenuItem,
|
|
34208
|
-
{
|
|
34209
|
-
icon: import_lucide_react52.ListOrdered,
|
|
34210
|
-
label: t("toolbar.orderedList"),
|
|
34211
|
-
onClick: () => editor.chain().focus().toggleOrderedList().run(),
|
|
34212
|
-
active: editor.isActive("orderedList"),
|
|
34213
|
-
shortcut: "Ctrl+Shift+7"
|
|
34214
|
-
}
|
|
34215
|
-
),
|
|
34216
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34217
|
-
DropdownMenuItem,
|
|
34218
|
-
{
|
|
34219
|
-
icon: import_lucide_react52.ListTodo,
|
|
34220
|
-
label: t("toolbar.taskList"),
|
|
34221
|
-
onClick: () => editor.chain().focus().toggleTaskList().run(),
|
|
34222
|
-
active: editor.isActive("taskList"),
|
|
34223
|
-
shortcut: "Ctrl+Shift+9"
|
|
34224
|
-
}
|
|
34225
|
-
)
|
|
34226
|
-
]
|
|
34227
|
-
}
|
|
34228
|
-
),
|
|
34229
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
|
|
34230
|
-
DropdownMenu,
|
|
34231
|
-
{
|
|
34232
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(ToolbarButton, { onClick: () => {
|
|
34233
|
-
}, active: editor.isActive("formCheckbox"), title: t("slashCommand.formCheckbox"), children: [
|
|
34234
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.SquareCheckBig, { className: "w-4 h-4" }),
|
|
34235
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ChevronDown, { className: "w-3 h-3" })
|
|
34236
|
-
] }),
|
|
34237
|
-
children: [
|
|
34238
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34239
|
-
DropdownMenuItem,
|
|
34240
|
-
{
|
|
34241
|
-
icon: import_lucide_react52.SquareCheckBig,
|
|
34242
|
-
label: t("slashCommand.formCheckbox"),
|
|
34243
|
-
onClick: () => editor.chain().focus().setFormCheckbox().run()
|
|
34244
|
-
}
|
|
34245
|
-
),
|
|
34246
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34247
|
-
DropdownMenuItem,
|
|
34211
|
+
}
|
|
34212
|
+
),
|
|
34213
|
+
(isMediumFull || isFull) && /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
|
|
34214
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarDivider, {}),
|
|
34215
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34216
|
+
DropdownMenu,
|
|
34248
34217
|
{
|
|
34249
|
-
|
|
34250
|
-
|
|
34251
|
-
|
|
34218
|
+
contentClassName: "p-0 overflow-hidden",
|
|
34219
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => {
|
|
34220
|
+
}, title: t("toolbar.emoji"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaSmileIcon, { className: "h-4 w-4" }) }),
|
|
34221
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34222
|
+
EmojiPicker2,
|
|
34223
|
+
{
|
|
34224
|
+
onSelect: (emoji) => {
|
|
34225
|
+
editor.chain().focus().insertContent(emoji).run();
|
|
34226
|
+
}
|
|
34227
|
+
}
|
|
34228
|
+
)
|
|
34252
34229
|
}
|
|
34253
34230
|
)
|
|
34254
|
-
]
|
|
34255
|
-
}
|
|
34256
|
-
),
|
|
34257
|
-
isMediumFull && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleBlockquote().run(), active: editor.isActive("blockquote"), title: t("toolbar.quote"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Quote, { className: "w-4 h-4" }) }),
|
|
34258
|
-
isFull && /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
|
|
34259
|
-
DropdownMenu,
|
|
34260
|
-
{
|
|
34261
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(ToolbarButton, { onClick: () => {
|
|
34262
|
-
}, title: t("toolbar.quote"), children: [
|
|
34263
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Quote, { className: "w-4 h-4" }),
|
|
34264
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ChevronDown, { className: "w-3 h-3" })
|
|
34265
34231
|
] }),
|
|
34266
|
-
children: [
|
|
34267
|
-
/* @__PURE__ */ (0,
|
|
34268
|
-
|
|
34232
|
+
(isMediumFull || isFull) && /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
|
|
34233
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarDivider, {}),
|
|
34234
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
34235
|
+
DropdownMenu,
|
|
34269
34236
|
{
|
|
34270
|
-
|
|
34271
|
-
|
|
34272
|
-
|
|
34273
|
-
|
|
34274
|
-
|
|
34237
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(ToolbarButton, { onClick: () => {
|
|
34238
|
+
}, title: t("toolbar.alignment"), children: [
|
|
34239
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaAlignLeftIcon, { className: "h-4 w-4" }),
|
|
34240
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaChevronDownIcon, { className: "h-2.5 w-2.5" })
|
|
34241
|
+
] }),
|
|
34242
|
+
children: [
|
|
34243
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34244
|
+
DropdownMenuItem,
|
|
34245
|
+
{
|
|
34246
|
+
icon: import_lucide_react52.AlignLeft,
|
|
34247
|
+
label: t("toolbar.alignLeft"),
|
|
34248
|
+
onClick: () => editor.chain().focus().setTextAlign("left").run(),
|
|
34249
|
+
active: editor.isActive({ textAlign: "left" })
|
|
34250
|
+
}
|
|
34251
|
+
),
|
|
34252
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34253
|
+
DropdownMenuItem,
|
|
34254
|
+
{
|
|
34255
|
+
icon: import_lucide_react52.AlignCenter,
|
|
34256
|
+
label: t("toolbar.alignCenter"),
|
|
34257
|
+
onClick: () => editor.chain().focus().setTextAlign("center").run(),
|
|
34258
|
+
active: editor.isActive({ textAlign: "center" })
|
|
34259
|
+
}
|
|
34260
|
+
),
|
|
34261
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34262
|
+
DropdownMenuItem,
|
|
34263
|
+
{
|
|
34264
|
+
icon: import_lucide_react52.AlignRight,
|
|
34265
|
+
label: t("toolbar.alignRight"),
|
|
34266
|
+
onClick: () => editor.chain().focus().setTextAlign("right").run(),
|
|
34267
|
+
active: editor.isActive({ textAlign: "right" })
|
|
34268
|
+
}
|
|
34269
|
+
),
|
|
34270
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34271
|
+
DropdownMenuItem,
|
|
34272
|
+
{
|
|
34273
|
+
icon: import_lucide_react52.AlignJustify,
|
|
34274
|
+
label: t("toolbar.justify"),
|
|
34275
|
+
onClick: () => editor.chain().focus().setTextAlign("justify").run(),
|
|
34276
|
+
active: editor.isActive({ textAlign: "justify" })
|
|
34277
|
+
}
|
|
34278
|
+
),
|
|
34279
|
+
hasTableContext && /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
|
|
34280
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "my-1 border-t" }),
|
|
34281
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34282
|
+
DropdownMenuItem,
|
|
34283
|
+
{
|
|
34284
|
+
icon: import_lucide_react52.AlignStartVertical,
|
|
34285
|
+
label: t("tableMenu.alignVerticalTop") || "Align top",
|
|
34286
|
+
onClick: () => applyTableCellAttribute(editor, "verticalAlign", "top"),
|
|
34287
|
+
active: currentCellVerticalAlign === "top"
|
|
34288
|
+
}
|
|
34289
|
+
),
|
|
34290
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34291
|
+
DropdownMenuItem,
|
|
34292
|
+
{
|
|
34293
|
+
icon: import_lucide_react52.AlignCenterVertical,
|
|
34294
|
+
label: t("tableMenu.alignVerticalMiddle") || "Align middle",
|
|
34295
|
+
onClick: () => applyTableCellAttribute(editor, "verticalAlign", "middle"),
|
|
34296
|
+
active: currentCellVerticalAlign === "middle"
|
|
34297
|
+
}
|
|
34298
|
+
),
|
|
34299
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34300
|
+
DropdownMenuItem,
|
|
34301
|
+
{
|
|
34302
|
+
icon: import_lucide_react52.AlignEndVertical,
|
|
34303
|
+
label: t("tableMenu.alignVerticalBottom") || "Align bottom",
|
|
34304
|
+
onClick: () => applyTableCellAttribute(editor, "verticalAlign", "bottom"),
|
|
34305
|
+
active: currentCellVerticalAlign === "bottom"
|
|
34306
|
+
}
|
|
34307
|
+
)
|
|
34308
|
+
] })
|
|
34309
|
+
]
|
|
34275
34310
|
}
|
|
34276
34311
|
),
|
|
34277
|
-
/* @__PURE__ */ (0,
|
|
34278
|
-
|
|
34312
|
+
hasTableContext && /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
34313
|
+
DropdownMenu,
|
|
34279
34314
|
{
|
|
34280
|
-
|
|
34281
|
-
|
|
34282
|
-
|
|
34283
|
-
|
|
34284
|
-
|
|
34315
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(ToolbarButton, { onClick: () => {
|
|
34316
|
+
}, title: t("tableMenu.textDirection"), children: [
|
|
34317
|
+
currentCellTextDirection === "vertical" ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.ArrowDown, { className: "w-4 h-4" }) : /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.ArrowRight, { className: "w-4 h-4" }),
|
|
34318
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.ChevronDown, { className: "w-3 h-3" })
|
|
34319
|
+
] }),
|
|
34320
|
+
children: [
|
|
34321
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34322
|
+
DropdownMenuItem,
|
|
34323
|
+
{
|
|
34324
|
+
icon: import_lucide_react52.ArrowRight,
|
|
34325
|
+
label: t("tableMenu.horizontalText"),
|
|
34326
|
+
onClick: () => applyTableCellAttribute(editor, "textDirection", null),
|
|
34327
|
+
active: currentCellTextDirection === "horizontal"
|
|
34328
|
+
}
|
|
34329
|
+
),
|
|
34330
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34331
|
+
DropdownMenuItem,
|
|
34332
|
+
{
|
|
34333
|
+
icon: import_lucide_react52.ArrowDown,
|
|
34334
|
+
label: t("tableMenu.verticalText"),
|
|
34335
|
+
onClick: () => applyTableCellAttribute(editor, "textDirection", "vertical"),
|
|
34336
|
+
active: currentCellTextDirection === "vertical"
|
|
34337
|
+
}
|
|
34338
|
+
)
|
|
34339
|
+
]
|
|
34285
34340
|
}
|
|
34286
34341
|
)
|
|
34287
|
-
]
|
|
34288
|
-
}
|
|
34289
|
-
),
|
|
34290
|
-
(isMediumFull || isFull) && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34291
|
-
DropdownMenu,
|
|
34292
|
-
{
|
|
34293
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(ToolbarButton, { onClick: () => {
|
|
34294
|
-
}, title: t("toolbar.image"), children: [
|
|
34295
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Image, { className: "w-4 h-4" }),
|
|
34296
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ChevronDown, { className: "w-3 h-3" })
|
|
34297
34342
|
] }),
|
|
34298
|
-
|
|
34299
|
-
|
|
34343
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarDivider, {}),
|
|
34344
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
34345
|
+
DropdownMenu,
|
|
34346
|
+
{
|
|
34347
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(ToolbarButton, { onClick: () => {
|
|
34348
|
+
}, title: t("toolbar.bulletList"), children: [
|
|
34349
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaListIcon, { className: "h-4 w-4" }),
|
|
34350
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaChevronDownIcon, { className: "h-2.5 w-2.5" })
|
|
34351
|
+
] }),
|
|
34352
|
+
children: [
|
|
34353
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34354
|
+
DropdownMenuItem,
|
|
34355
|
+
{
|
|
34356
|
+
icon: import_lucide_react52.List,
|
|
34357
|
+
label: t("toolbar.bulletList"),
|
|
34358
|
+
onClick: () => editor.chain().focus().toggleBulletList().run(),
|
|
34359
|
+
active: editor.isActive("bulletList"),
|
|
34360
|
+
shortcut: "Ctrl+Shift+8"
|
|
34361
|
+
}
|
|
34362
|
+
),
|
|
34363
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34364
|
+
DropdownMenuItem,
|
|
34365
|
+
{
|
|
34366
|
+
icon: import_lucide_react52.ListOrdered,
|
|
34367
|
+
label: t("toolbar.orderedList"),
|
|
34368
|
+
onClick: () => editor.chain().focus().toggleOrderedList().run(),
|
|
34369
|
+
active: editor.isActive("orderedList"),
|
|
34370
|
+
shortcut: "Ctrl+Shift+7"
|
|
34371
|
+
}
|
|
34372
|
+
),
|
|
34373
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34374
|
+
DropdownMenuItem,
|
|
34375
|
+
{
|
|
34376
|
+
icon: import_lucide_react52.ListTodo,
|
|
34377
|
+
label: t("toolbar.taskList"),
|
|
34378
|
+
onClick: () => editor.chain().focus().toggleTaskList().run(),
|
|
34379
|
+
active: editor.isActive("taskList"),
|
|
34380
|
+
shortcut: "Ctrl+Shift+9"
|
|
34381
|
+
}
|
|
34382
|
+
)
|
|
34383
|
+
]
|
|
34384
|
+
}
|
|
34385
|
+
),
|
|
34386
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
34387
|
+
DropdownMenu,
|
|
34388
|
+
{
|
|
34389
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(ToolbarButton, { onClick: () => {
|
|
34390
|
+
}, active: editor.isActive("formCheckbox"), title: t("slashCommand.formCheckbox"), children: [
|
|
34391
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.SquareCheckBig, { className: "w-4 h-4" }),
|
|
34392
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.ChevronDown, { className: "w-3 h-3" })
|
|
34393
|
+
] }),
|
|
34394
|
+
children: [
|
|
34395
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34396
|
+
DropdownMenuItem,
|
|
34397
|
+
{
|
|
34398
|
+
icon: import_lucide_react52.SquareCheckBig,
|
|
34399
|
+
label: t("slashCommand.formCheckbox"),
|
|
34400
|
+
onClick: () => editor.chain().focus().setFormCheckbox().run()
|
|
34401
|
+
}
|
|
34402
|
+
),
|
|
34403
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34404
|
+
DropdownMenuItem,
|
|
34405
|
+
{
|
|
34406
|
+
icon: import_lucide_react52.CircleCheckBig,
|
|
34407
|
+
label: t("slashCommand.roundCheckbox"),
|
|
34408
|
+
onClick: () => editor.chain().focus().setFormCheckbox({ variant: "circle" }).run()
|
|
34409
|
+
}
|
|
34410
|
+
)
|
|
34411
|
+
]
|
|
34412
|
+
}
|
|
34413
|
+
),
|
|
34414
|
+
isMediumFull && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleBlockquote().run(), active: editor.isActive("blockquote"), title: t("toolbar.quote"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaQuoteIcon, { className: "h-4 w-4" }) }),
|
|
34415
|
+
isFull && /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
34416
|
+
DropdownMenu,
|
|
34300
34417
|
{
|
|
34301
|
-
|
|
34302
|
-
|
|
34303
|
-
|
|
34418
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(ToolbarButton, { onClick: () => {
|
|
34419
|
+
}, title: t("toolbar.quote"), children: [
|
|
34420
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaQuoteIcon, { className: "h-4 w-4" }),
|
|
34421
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaChevronDownIcon, { className: "h-2.5 w-2.5" })
|
|
34422
|
+
] }),
|
|
34423
|
+
children: [
|
|
34424
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34425
|
+
DropdownMenuItem,
|
|
34426
|
+
{
|
|
34427
|
+
icon: import_lucide_react52.Quote,
|
|
34428
|
+
label: t("toolbar.quote"),
|
|
34429
|
+
onClick: () => editor.chain().focus().toggleBlockquote().run(),
|
|
34430
|
+
active: editor.isActive("blockquote"),
|
|
34431
|
+
shortcut: "Ctrl+Shift+B"
|
|
34432
|
+
}
|
|
34433
|
+
),
|
|
34434
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34435
|
+
DropdownMenuItem,
|
|
34436
|
+
{
|
|
34437
|
+
icon: import_lucide_react52.FileCode,
|
|
34438
|
+
label: t("toolbar.codeBlock"),
|
|
34439
|
+
onClick: () => editor.chain().focus().toggleCodeBlock().run(),
|
|
34440
|
+
active: editor.isActive("codeBlock"),
|
|
34441
|
+
shortcut: "Ctrl+Alt+C"
|
|
34442
|
+
}
|
|
34443
|
+
)
|
|
34444
|
+
]
|
|
34445
|
+
}
|
|
34446
|
+
),
|
|
34447
|
+
(isMediumFull || isFull) && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34448
|
+
DropdownMenu,
|
|
34449
|
+
{
|
|
34450
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(ToolbarButton, { onClick: () => {
|
|
34451
|
+
}, title: t("toolbar.image"), children: [
|
|
34452
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaImageIcon, { className: "h-4 w-4" }),
|
|
34453
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaChevronDownIcon, { className: "h-2.5 w-2.5" })
|
|
34454
|
+
] }),
|
|
34455
|
+
children: showImageInput ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34456
|
+
ImageInput,
|
|
34457
|
+
{
|
|
34458
|
+
onSubmit: (url, alt) => {
|
|
34459
|
+
editor.chain().focus().setImage({ src: url, alt }).run();
|
|
34460
|
+
setShowImageInput(false);
|
|
34461
|
+
},
|
|
34462
|
+
onCancel: () => setShowImageInput(false)
|
|
34463
|
+
}
|
|
34464
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
|
|
34465
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(DropdownMenuItem, { icon: import_lucide_react52.Link, label: t("imageInput.addFromUrl"), onClick: () => setShowImageInput(true), closeOnSelect: false }),
|
|
34466
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34467
|
+
DropdownMenuItem,
|
|
34468
|
+
{
|
|
34469
|
+
icon: import_lucide_react52.Upload,
|
|
34470
|
+
label: isUploadingImage ? t("imageInput.uploading") : t("imageInput.uploadTab"),
|
|
34471
|
+
disabled: isUploadingImage,
|
|
34472
|
+
onClick: () => fileInputRef.current?.click(),
|
|
34473
|
+
closeOnSelect: false
|
|
34474
|
+
}
|
|
34475
|
+
),
|
|
34476
|
+
imageUploadError && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(DropdownMenuItem, { label: imageUploadError, disabled: true, destructive: true }),
|
|
34477
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34478
|
+
"input",
|
|
34479
|
+
{
|
|
34480
|
+
ref: fileInputRef,
|
|
34481
|
+
type: "file",
|
|
34482
|
+
accept: "image/*",
|
|
34483
|
+
multiple: true,
|
|
34484
|
+
className: "hidden",
|
|
34485
|
+
onChange: (e) => {
|
|
34486
|
+
const files = Array.from(e.target.files ?? []);
|
|
34487
|
+
e.target.value = "";
|
|
34488
|
+
void insertImageFiles(files);
|
|
34489
|
+
}
|
|
34490
|
+
}
|
|
34491
|
+
),
|
|
34492
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "my-1 border-t" }),
|
|
34493
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34494
|
+
DropdownMenuItem,
|
|
34495
|
+
{
|
|
34496
|
+
icon: import_lucide_react52.AlignCenter,
|
|
34497
|
+
label: t("toolbar.imageLayoutBlock"),
|
|
34498
|
+
onClick: () => applyImageLayout(editor, "block"),
|
|
34499
|
+
active: isImageSelected && imageLayout === "block",
|
|
34500
|
+
disabled: !isImageSelected
|
|
34501
|
+
}
|
|
34502
|
+
),
|
|
34503
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34504
|
+
DropdownMenuItem,
|
|
34505
|
+
{
|
|
34506
|
+
icon: import_lucide_react52.AlignLeft,
|
|
34507
|
+
label: t("toolbar.imageLayoutLeft"),
|
|
34508
|
+
onClick: () => applyImageLayout(editor, "left"),
|
|
34509
|
+
active: isImageSelected && imageLayout === "left",
|
|
34510
|
+
disabled: !isImageSelected
|
|
34511
|
+
}
|
|
34512
|
+
),
|
|
34513
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34514
|
+
DropdownMenuItem,
|
|
34515
|
+
{
|
|
34516
|
+
icon: import_lucide_react52.AlignRight,
|
|
34517
|
+
label: t("toolbar.imageLayoutRight"),
|
|
34518
|
+
onClick: () => applyImageLayout(editor, "right"),
|
|
34519
|
+
active: isImageSelected && imageLayout === "right",
|
|
34520
|
+
disabled: !isImageSelected
|
|
34521
|
+
}
|
|
34522
|
+
),
|
|
34523
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "my-1 border-t" }),
|
|
34524
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34525
|
+
DropdownMenuItem,
|
|
34526
|
+
{
|
|
34527
|
+
label: t("toolbar.imageWidthSm"),
|
|
34528
|
+
onClick: () => applyImageWidthPreset(editor, "sm"),
|
|
34529
|
+
active: isImageSelected && imageWidthPreset === "sm",
|
|
34530
|
+
disabled: !isImageSelected
|
|
34531
|
+
}
|
|
34532
|
+
),
|
|
34533
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34534
|
+
DropdownMenuItem,
|
|
34535
|
+
{
|
|
34536
|
+
label: t("toolbar.imageWidthMd"),
|
|
34537
|
+
onClick: () => applyImageWidthPreset(editor, "md"),
|
|
34538
|
+
active: isImageSelected && imageWidthPreset === "md",
|
|
34539
|
+
disabled: !isImageSelected
|
|
34540
|
+
}
|
|
34541
|
+
),
|
|
34542
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34543
|
+
DropdownMenuItem,
|
|
34544
|
+
{
|
|
34545
|
+
label: t("toolbar.imageWidthLg"),
|
|
34546
|
+
onClick: () => applyImageWidthPreset(editor, "lg"),
|
|
34547
|
+
active: isImageSelected && imageWidthPreset === "lg",
|
|
34548
|
+
disabled: !isImageSelected
|
|
34549
|
+
}
|
|
34550
|
+
),
|
|
34551
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "my-1 border-t" }),
|
|
34552
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34553
|
+
DropdownMenuItem,
|
|
34554
|
+
{
|
|
34555
|
+
icon: import_lucide_react52.RotateCcw,
|
|
34556
|
+
label: t("toolbar.imageResetSize"),
|
|
34557
|
+
onClick: () => resetImageSize(editor),
|
|
34558
|
+
disabled: !isImageSelected
|
|
34559
|
+
}
|
|
34560
|
+
),
|
|
34561
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34562
|
+
DropdownMenuItem,
|
|
34563
|
+
{
|
|
34564
|
+
icon: import_lucide_react52.Trash2,
|
|
34565
|
+
label: t("toolbar.imageDelete"),
|
|
34566
|
+
onClick: () => deleteSelectedImage(editor),
|
|
34567
|
+
disabled: !isImageSelected,
|
|
34568
|
+
destructive: true
|
|
34569
|
+
}
|
|
34570
|
+
)
|
|
34571
|
+
] })
|
|
34572
|
+
}
|
|
34573
|
+
),
|
|
34574
|
+
(isMediumFull || isFull) && /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
34575
|
+
DropdownMenu,
|
|
34576
|
+
{
|
|
34577
|
+
isOpen: isTableMenuOpen,
|
|
34578
|
+
onOpenChange: (open) => {
|
|
34579
|
+
setIsTableMenuOpen(open);
|
|
34580
|
+
setPreservedTableAnchorPos(open ? getTableAnchorPos(editor) : null);
|
|
34304
34581
|
},
|
|
34305
|
-
|
|
34582
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(ToolbarButton, { onClick: () => {
|
|
34583
|
+
}, title: t("toolbar.table"), children: [
|
|
34584
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaTableIcon, { className: "h-4 w-4" }),
|
|
34585
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaChevronDownIcon, { className: "h-2.5 w-2.5" })
|
|
34586
|
+
] }),
|
|
34587
|
+
contentClassName: "p-2 min-w-56",
|
|
34588
|
+
children: [
|
|
34589
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34590
|
+
TableInsertGrid,
|
|
34591
|
+
{
|
|
34592
|
+
insertLabel: t("tableMenu.insertTable"),
|
|
34593
|
+
previewTemplate: t("tableMenu.gridPreview"),
|
|
34594
|
+
onInsert: (rows, cols) => {
|
|
34595
|
+
editor.chain().focus().insertTable({ rows, cols, withHeaderRow: true }).run();
|
|
34596
|
+
setIsTableMenuOpen(false);
|
|
34597
|
+
setPreservedTableAnchorPos(null);
|
|
34598
|
+
}
|
|
34599
|
+
}
|
|
34600
|
+
),
|
|
34601
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "my-1 border-t" }),
|
|
34602
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34603
|
+
DropdownMenuItem,
|
|
34604
|
+
{
|
|
34605
|
+
icon: import_lucide_react52.AlignLeft,
|
|
34606
|
+
label: t("tableMenu.alignLeft"),
|
|
34607
|
+
onClick: () => applyTableAlignment(editor, "left", tableCommandAnchorPos),
|
|
34608
|
+
active: hasTableContext && currentTableAlign === "left",
|
|
34609
|
+
disabled: !hasTableContext
|
|
34610
|
+
}
|
|
34611
|
+
),
|
|
34612
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34613
|
+
DropdownMenuItem,
|
|
34614
|
+
{
|
|
34615
|
+
icon: import_lucide_react52.AlignCenter,
|
|
34616
|
+
label: t("tableMenu.alignCenter"),
|
|
34617
|
+
onClick: () => applyTableAlignment(editor, "center", tableCommandAnchorPos),
|
|
34618
|
+
active: hasTableContext && currentTableAlign === "center",
|
|
34619
|
+
disabled: !hasTableContext
|
|
34620
|
+
}
|
|
34621
|
+
),
|
|
34622
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34623
|
+
DropdownMenuItem,
|
|
34624
|
+
{
|
|
34625
|
+
icon: import_lucide_react52.AlignRight,
|
|
34626
|
+
label: t("tableMenu.alignRight"),
|
|
34627
|
+
onClick: () => applyTableAlignment(editor, "right", tableCommandAnchorPos),
|
|
34628
|
+
active: hasTableContext && currentTableAlign === "right",
|
|
34629
|
+
disabled: !hasTableContext
|
|
34630
|
+
}
|
|
34631
|
+
),
|
|
34632
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "my-1 border-t" }),
|
|
34633
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34634
|
+
DropdownMenuItem,
|
|
34635
|
+
{
|
|
34636
|
+
icon: import_lucide_react52.ArrowLeft,
|
|
34637
|
+
label: t("tableMenu.addColumnBefore"),
|
|
34638
|
+
onClick: () => editor.chain().focus().addColumnBefore().run(),
|
|
34639
|
+
disabled: !hasTableContext || !editor.can().addColumnBefore()
|
|
34640
|
+
}
|
|
34641
|
+
),
|
|
34642
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34643
|
+
DropdownMenuItem,
|
|
34644
|
+
{
|
|
34645
|
+
icon: import_lucide_react52.ArrowDown,
|
|
34646
|
+
label: t("tableMenu.addColumnAfter"),
|
|
34647
|
+
onClick: () => editor.chain().focus().addColumnAfter().run(),
|
|
34648
|
+
disabled: !hasTableContext || !editor.can().addColumnAfter()
|
|
34649
|
+
}
|
|
34650
|
+
),
|
|
34651
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34652
|
+
DropdownMenuItem,
|
|
34653
|
+
{
|
|
34654
|
+
icon: import_lucide_react52.ArrowUp,
|
|
34655
|
+
label: t("tableMenu.addRowBefore"),
|
|
34656
|
+
onClick: () => editor.chain().focus().addRowBefore().run(),
|
|
34657
|
+
disabled: !hasTableContext || !editor.can().addRowBefore()
|
|
34658
|
+
}
|
|
34659
|
+
),
|
|
34660
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34661
|
+
DropdownMenuItem,
|
|
34662
|
+
{
|
|
34663
|
+
icon: import_lucide_react52.ArrowRight,
|
|
34664
|
+
label: t("tableMenu.addRowAfter"),
|
|
34665
|
+
onClick: () => editor.chain().focus().addRowAfter().run(),
|
|
34666
|
+
disabled: !hasTableContext || !editor.can().addRowAfter()
|
|
34667
|
+
}
|
|
34668
|
+
),
|
|
34669
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "my-1 border-t" }),
|
|
34670
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34671
|
+
DropdownMenuItem,
|
|
34672
|
+
{
|
|
34673
|
+
icon: import_lucide_react52.Table,
|
|
34674
|
+
label: t("tableMenu.toggleHeaderRow"),
|
|
34675
|
+
onClick: () => editor.chain().focus().toggleHeaderRow().run(),
|
|
34676
|
+
disabled: !hasTableContext || !editor.can().toggleHeaderRow()
|
|
34677
|
+
}
|
|
34678
|
+
),
|
|
34679
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34680
|
+
DropdownMenuItem,
|
|
34681
|
+
{
|
|
34682
|
+
icon: import_lucide_react52.Table,
|
|
34683
|
+
label: t("tableMenu.toggleHeaderColumn"),
|
|
34684
|
+
onClick: () => editor.chain().focus().toggleHeaderColumn().run(),
|
|
34685
|
+
disabled: !hasTableContext || !editor.can().toggleHeaderColumn()
|
|
34686
|
+
}
|
|
34687
|
+
),
|
|
34688
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "my-1 border-t" }),
|
|
34689
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34690
|
+
DropdownMenuItem,
|
|
34691
|
+
{
|
|
34692
|
+
icon: import_lucide_react52.Trash2,
|
|
34693
|
+
label: t("tableMenu.deleteColumn"),
|
|
34694
|
+
onClick: () => editor.chain().focus().deleteColumn().run(),
|
|
34695
|
+
disabled: !hasTableContext || !editor.can().deleteColumn()
|
|
34696
|
+
}
|
|
34697
|
+
),
|
|
34698
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34699
|
+
DropdownMenuItem,
|
|
34700
|
+
{
|
|
34701
|
+
icon: import_lucide_react52.Trash2,
|
|
34702
|
+
label: t("tableMenu.deleteRow"),
|
|
34703
|
+
onClick: () => editor.chain().focus().deleteRow().run(),
|
|
34704
|
+
disabled: !hasTableContext || !editor.can().deleteRow()
|
|
34705
|
+
}
|
|
34706
|
+
),
|
|
34707
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34708
|
+
DropdownMenuItem,
|
|
34709
|
+
{
|
|
34710
|
+
icon: import_lucide_react52.Trash2,
|
|
34711
|
+
label: t("tableMenu.deleteTable"),
|
|
34712
|
+
onClick: () => editor.chain().focus().deleteTable().run(),
|
|
34713
|
+
disabled: !hasTableContext || !editor.can().deleteTable()
|
|
34714
|
+
}
|
|
34715
|
+
)
|
|
34716
|
+
]
|
|
34306
34717
|
}
|
|
34307
|
-
)
|
|
34308
|
-
|
|
34309
|
-
|
|
34310
|
-
|
|
34311
|
-
|
|
34312
|
-
|
|
34313
|
-
|
|
34314
|
-
|
|
34315
|
-
onClick: () => fileInputRef.current?.click(),
|
|
34316
|
-
closeOnSelect: false
|
|
34317
|
-
}
|
|
34318
|
-
),
|
|
34319
|
-
imageUploadError && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(DropdownMenuItem, { label: imageUploadError, disabled: true, destructive: true }),
|
|
34320
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34321
|
-
"input",
|
|
34322
|
-
{
|
|
34323
|
-
ref: fileInputRef,
|
|
34324
|
-
type: "file",
|
|
34325
|
-
accept: "image/*",
|
|
34326
|
-
multiple: true,
|
|
34327
|
-
className: "hidden",
|
|
34328
|
-
onChange: (e) => {
|
|
34329
|
-
const files = Array.from(e.target.files ?? []);
|
|
34330
|
-
e.target.value = "";
|
|
34331
|
-
void insertImageFiles(files);
|
|
34332
|
-
}
|
|
34333
|
-
}
|
|
34334
|
-
),
|
|
34335
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "my-1 border-t" }),
|
|
34336
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34337
|
-
DropdownMenuItem,
|
|
34338
|
-
{
|
|
34339
|
-
icon: import_lucide_react52.AlignCenter,
|
|
34340
|
-
label: t("toolbar.imageLayoutBlock"),
|
|
34341
|
-
onClick: () => applyImageLayout(editor, "block"),
|
|
34342
|
-
active: isImageSelected && imageLayout === "block",
|
|
34343
|
-
disabled: !isImageSelected
|
|
34344
|
-
}
|
|
34345
|
-
),
|
|
34346
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34347
|
-
DropdownMenuItem,
|
|
34348
|
-
{
|
|
34349
|
-
icon: import_lucide_react52.AlignLeft,
|
|
34350
|
-
label: t("toolbar.imageLayoutLeft"),
|
|
34351
|
-
onClick: () => applyImageLayout(editor, "left"),
|
|
34352
|
-
active: isImageSelected && imageLayout === "left",
|
|
34353
|
-
disabled: !isImageSelected
|
|
34354
|
-
}
|
|
34355
|
-
),
|
|
34356
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34357
|
-
DropdownMenuItem,
|
|
34358
|
-
{
|
|
34359
|
-
icon: import_lucide_react52.AlignRight,
|
|
34360
|
-
label: t("toolbar.imageLayoutRight"),
|
|
34361
|
-
onClick: () => applyImageLayout(editor, "right"),
|
|
34362
|
-
active: isImageSelected && imageLayout === "right",
|
|
34363
|
-
disabled: !isImageSelected
|
|
34364
|
-
}
|
|
34365
|
-
),
|
|
34366
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "my-1 border-t" }),
|
|
34367
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34368
|
-
DropdownMenuItem,
|
|
34369
|
-
{
|
|
34370
|
-
label: t("toolbar.imageWidthSm"),
|
|
34371
|
-
onClick: () => applyImageWidthPreset(editor, "sm"),
|
|
34372
|
-
active: isImageSelected && imageWidthPreset === "sm",
|
|
34373
|
-
disabled: !isImageSelected
|
|
34374
|
-
}
|
|
34375
|
-
),
|
|
34376
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34377
|
-
DropdownMenuItem,
|
|
34378
|
-
{
|
|
34379
|
-
label: t("toolbar.imageWidthMd"),
|
|
34380
|
-
onClick: () => applyImageWidthPreset(editor, "md"),
|
|
34381
|
-
active: isImageSelected && imageWidthPreset === "md",
|
|
34382
|
-
disabled: !isImageSelected
|
|
34383
|
-
}
|
|
34384
|
-
),
|
|
34385
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34386
|
-
DropdownMenuItem,
|
|
34387
|
-
{
|
|
34388
|
-
label: t("toolbar.imageWidthLg"),
|
|
34389
|
-
onClick: () => applyImageWidthPreset(editor, "lg"),
|
|
34390
|
-
active: isImageSelected && imageWidthPreset === "lg",
|
|
34391
|
-
disabled: !isImageSelected
|
|
34392
|
-
}
|
|
34393
|
-
),
|
|
34394
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "my-1 border-t" }),
|
|
34395
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34396
|
-
DropdownMenuItem,
|
|
34397
|
-
{
|
|
34398
|
-
icon: import_lucide_react52.RotateCcw,
|
|
34399
|
-
label: t("toolbar.imageResetSize"),
|
|
34400
|
-
onClick: () => resetImageSize(editor),
|
|
34401
|
-
disabled: !isImageSelected
|
|
34402
|
-
}
|
|
34403
|
-
),
|
|
34404
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34405
|
-
DropdownMenuItem,
|
|
34406
|
-
{
|
|
34407
|
-
icon: import_lucide_react52.Trash2,
|
|
34408
|
-
label: t("toolbar.imageDelete"),
|
|
34409
|
-
onClick: () => deleteSelectedImage(editor),
|
|
34410
|
-
disabled: !isImageSelected,
|
|
34411
|
-
destructive: true
|
|
34412
|
-
}
|
|
34413
|
-
)
|
|
34414
|
-
] })
|
|
34415
|
-
}
|
|
34416
|
-
),
|
|
34417
|
-
(isMediumFull || isFull) && /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
|
|
34418
|
-
DropdownMenu,
|
|
34419
|
-
{
|
|
34420
|
-
isOpen: isTableMenuOpen,
|
|
34421
|
-
onOpenChange: (open) => {
|
|
34422
|
-
setIsTableMenuOpen(open);
|
|
34423
|
-
setPreservedTableAnchorPos(open ? getTableAnchorPos(editor) : null);
|
|
34424
|
-
},
|
|
34425
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(ToolbarButton, { onClick: () => {
|
|
34426
|
-
}, title: t("toolbar.table"), children: [
|
|
34427
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Table, { className: "w-4 h-4" }),
|
|
34428
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ChevronDown, { className: "w-3 h-3" })
|
|
34429
|
-
] }),
|
|
34430
|
-
contentClassName: "p-2 min-w-56",
|
|
34431
|
-
children: [
|
|
34432
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34433
|
-
TableInsertGrid,
|
|
34434
|
-
{
|
|
34435
|
-
insertLabel: t("tableMenu.insertTable"),
|
|
34436
|
-
previewTemplate: t("tableMenu.gridPreview"),
|
|
34437
|
-
onInsert: (rows, cols) => {
|
|
34438
|
-
editor.chain().focus().insertTable({ rows, cols, withHeaderRow: true }).run();
|
|
34439
|
-
setIsTableMenuOpen(false);
|
|
34440
|
-
setPreservedTableAnchorPos(null);
|
|
34441
|
-
}
|
|
34442
|
-
}
|
|
34443
|
-
),
|
|
34444
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "my-1 border-t" }),
|
|
34445
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34446
|
-
DropdownMenuItem,
|
|
34447
|
-
{
|
|
34448
|
-
icon: import_lucide_react52.AlignLeft,
|
|
34449
|
-
label: t("tableMenu.alignLeft"),
|
|
34450
|
-
onClick: () => applyTableAlignment(editor, "left", tableCommandAnchorPos),
|
|
34451
|
-
active: hasTableContext && currentTableAlign === "left",
|
|
34452
|
-
disabled: !hasTableContext
|
|
34453
|
-
}
|
|
34454
|
-
),
|
|
34455
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34456
|
-
DropdownMenuItem,
|
|
34457
|
-
{
|
|
34458
|
-
icon: import_lucide_react52.AlignCenter,
|
|
34459
|
-
label: t("tableMenu.alignCenter"),
|
|
34460
|
-
onClick: () => applyTableAlignment(editor, "center", tableCommandAnchorPos),
|
|
34461
|
-
active: hasTableContext && currentTableAlign === "center",
|
|
34462
|
-
disabled: !hasTableContext
|
|
34463
|
-
}
|
|
34464
|
-
),
|
|
34465
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34466
|
-
DropdownMenuItem,
|
|
34467
|
-
{
|
|
34468
|
-
icon: import_lucide_react52.AlignRight,
|
|
34469
|
-
label: t("tableMenu.alignRight"),
|
|
34470
|
-
onClick: () => applyTableAlignment(editor, "right", tableCommandAnchorPos),
|
|
34471
|
-
active: hasTableContext && currentTableAlign === "right",
|
|
34472
|
-
disabled: !hasTableContext
|
|
34473
|
-
}
|
|
34474
|
-
),
|
|
34475
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "my-1 border-t" }),
|
|
34476
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34477
|
-
DropdownMenuItem,
|
|
34718
|
+
),
|
|
34719
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarDivider, {}),
|
|
34720
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().undo().run(), disabled: !editor.can().undo(), title: t("toolbar.undo"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaUndoIcon, { className: "h-4 w-4" }) }),
|
|
34721
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().redo().run(), disabled: !editor.can().redo(), title: t("toolbar.redo"), children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FigmaRedoIcon, { className: "h-4 w-4" }) }),
|
|
34722
|
+
hasTableContext && /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
|
|
34723
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ToolbarDivider, {}),
|
|
34724
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34725
|
+
ToolbarButton,
|
|
34478
34726
|
{
|
|
34479
|
-
icon: import_lucide_react52.ArrowLeft,
|
|
34480
|
-
label: t("tableMenu.addColumnBefore"),
|
|
34481
34727
|
onClick: () => editor.chain().focus().addColumnBefore().run(),
|
|
34482
|
-
disabled: !
|
|
34728
|
+
disabled: !editor.can().addColumnBefore(),
|
|
34729
|
+
title: t("tableMenu.addColumnBefore"),
|
|
34730
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.ArrowLeft, { className: "w-4 h-4" })
|
|
34483
34731
|
}
|
|
34484
34732
|
),
|
|
34485
|
-
/* @__PURE__ */ (0,
|
|
34486
|
-
|
|
34733
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34734
|
+
ToolbarButton,
|
|
34487
34735
|
{
|
|
34488
|
-
icon: import_lucide_react52.ArrowDown,
|
|
34489
|
-
label: t("tableMenu.addColumnAfter"),
|
|
34490
34736
|
onClick: () => editor.chain().focus().addColumnAfter().run(),
|
|
34491
|
-
disabled: !
|
|
34737
|
+
disabled: !editor.can().addColumnAfter(),
|
|
34738
|
+
title: t("tableMenu.addColumnAfter"),
|
|
34739
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.ArrowRight, { className: "w-4 h-4" })
|
|
34492
34740
|
}
|
|
34493
34741
|
),
|
|
34494
|
-
/* @__PURE__ */ (0,
|
|
34495
|
-
|
|
34742
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34743
|
+
ToolbarButton,
|
|
34496
34744
|
{
|
|
34497
|
-
icon: import_lucide_react52.ArrowUp,
|
|
34498
|
-
label: t("tableMenu.addRowBefore"),
|
|
34499
34745
|
onClick: () => editor.chain().focus().addRowBefore().run(),
|
|
34500
|
-
disabled: !
|
|
34746
|
+
disabled: !editor.can().addRowBefore(),
|
|
34747
|
+
title: t("tableMenu.addRowBefore"),
|
|
34748
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.ArrowUp, { className: "w-4 h-4" })
|
|
34501
34749
|
}
|
|
34502
34750
|
),
|
|
34503
|
-
/* @__PURE__ */ (0,
|
|
34504
|
-
|
|
34751
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34752
|
+
ToolbarButton,
|
|
34505
34753
|
{
|
|
34506
|
-
icon: import_lucide_react52.ArrowRight,
|
|
34507
|
-
label: t("tableMenu.addRowAfter"),
|
|
34508
34754
|
onClick: () => editor.chain().focus().addRowAfter().run(),
|
|
34509
|
-
disabled: !
|
|
34510
|
-
|
|
34511
|
-
|
|
34512
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "my-1 border-t" }),
|
|
34513
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34514
|
-
DropdownMenuItem,
|
|
34515
|
-
{
|
|
34516
|
-
icon: import_lucide_react52.Table,
|
|
34517
|
-
label: t("tableMenu.toggleHeaderRow"),
|
|
34518
|
-
onClick: () => editor.chain().focus().toggleHeaderRow().run(),
|
|
34519
|
-
disabled: !hasTableContext || !editor.can().toggleHeaderRow()
|
|
34520
|
-
}
|
|
34521
|
-
),
|
|
34522
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34523
|
-
DropdownMenuItem,
|
|
34524
|
-
{
|
|
34525
|
-
icon: import_lucide_react52.Table,
|
|
34526
|
-
label: t("tableMenu.toggleHeaderColumn"),
|
|
34527
|
-
onClick: () => editor.chain().focus().toggleHeaderColumn().run(),
|
|
34528
|
-
disabled: !hasTableContext || !editor.can().toggleHeaderColumn()
|
|
34529
|
-
}
|
|
34530
|
-
),
|
|
34531
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "my-1 border-t" }),
|
|
34532
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34533
|
-
DropdownMenuItem,
|
|
34534
|
-
{
|
|
34535
|
-
icon: import_lucide_react52.Trash2,
|
|
34536
|
-
label: t("tableMenu.deleteColumn"),
|
|
34537
|
-
onClick: () => editor.chain().focus().deleteColumn().run(),
|
|
34538
|
-
disabled: !hasTableContext || !editor.can().deleteColumn()
|
|
34539
|
-
}
|
|
34540
|
-
),
|
|
34541
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34542
|
-
DropdownMenuItem,
|
|
34543
|
-
{
|
|
34544
|
-
icon: import_lucide_react52.Trash2,
|
|
34545
|
-
label: t("tableMenu.deleteRow"),
|
|
34546
|
-
onClick: () => editor.chain().focus().deleteRow().run(),
|
|
34547
|
-
disabled: !hasTableContext || !editor.can().deleteRow()
|
|
34755
|
+
disabled: !editor.can().addRowAfter(),
|
|
34756
|
+
title: t("tableMenu.addRowAfter"),
|
|
34757
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.ArrowDown, { className: "w-4 h-4" })
|
|
34548
34758
|
}
|
|
34549
34759
|
),
|
|
34550
|
-
/* @__PURE__ */ (0,
|
|
34551
|
-
|
|
34760
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
34761
|
+
ToolbarButton,
|
|
34552
34762
|
{
|
|
34553
|
-
|
|
34554
|
-
|
|
34555
|
-
|
|
34556
|
-
|
|
34763
|
+
onClick: () => {
|
|
34764
|
+
if (canSplitCell) {
|
|
34765
|
+
editor.chain().focus().splitCell().run();
|
|
34766
|
+
return;
|
|
34767
|
+
}
|
|
34768
|
+
mergeTableCellsPreservingColumnWidths(editor);
|
|
34769
|
+
},
|
|
34770
|
+
active: canSplitCell,
|
|
34771
|
+
disabled: !canMergeCells && !canSplitCell,
|
|
34772
|
+
title: canSplitCell ? t("tableMenu.splitCell") : t("tableMenu.mergeCells"),
|
|
34773
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react52.TableCellsMerge, { className: "w-4 h-4" })
|
|
34557
34774
|
}
|
|
34558
34775
|
)
|
|
34559
|
-
]
|
|
34560
|
-
|
|
34561
|
-
|
|
34562
|
-
|
|
34563
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().undo().run(), disabled: !editor.can().undo(), title: t("toolbar.undo"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Undo, { className: "w-4 h-4" }) }),
|
|
34564
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().redo().run(), disabled: !editor.can().redo(), title: t("toolbar.redo"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.Redo, { className: "w-4 h-4" }) }),
|
|
34565
|
-
hasTableContext && /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(import_jsx_runtime92.Fragment, { children: [
|
|
34566
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToolbarDivider, {}),
|
|
34567
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34568
|
-
ToolbarButton,
|
|
34569
|
-
{
|
|
34570
|
-
onClick: () => editor.chain().focus().addColumnBefore().run(),
|
|
34571
|
-
disabled: !editor.can().addColumnBefore(),
|
|
34572
|
-
title: t("tableMenu.addColumnBefore"),
|
|
34573
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ArrowLeft, { className: "w-4 h-4" })
|
|
34574
|
-
}
|
|
34575
|
-
),
|
|
34576
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34577
|
-
ToolbarButton,
|
|
34578
|
-
{
|
|
34579
|
-
onClick: () => editor.chain().focus().addColumnAfter().run(),
|
|
34580
|
-
disabled: !editor.can().addColumnAfter(),
|
|
34581
|
-
title: t("tableMenu.addColumnAfter"),
|
|
34582
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ArrowRight, { className: "w-4 h-4" })
|
|
34583
|
-
}
|
|
34584
|
-
),
|
|
34585
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34586
|
-
ToolbarButton,
|
|
34587
|
-
{
|
|
34588
|
-
onClick: () => editor.chain().focus().addRowBefore().run(),
|
|
34589
|
-
disabled: !editor.can().addRowBefore(),
|
|
34590
|
-
title: t("tableMenu.addRowBefore"),
|
|
34591
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ArrowUp, { className: "w-4 h-4" })
|
|
34592
|
-
}
|
|
34593
|
-
),
|
|
34594
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34595
|
-
ToolbarButton,
|
|
34596
|
-
{
|
|
34597
|
-
onClick: () => editor.chain().focus().addRowAfter().run(),
|
|
34598
|
-
disabled: !editor.can().addRowAfter(),
|
|
34599
|
-
title: t("tableMenu.addRowAfter"),
|
|
34600
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.ArrowDown, { className: "w-4 h-4" })
|
|
34601
|
-
}
|
|
34602
|
-
),
|
|
34603
|
-
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
34604
|
-
ToolbarButton,
|
|
34605
|
-
{
|
|
34606
|
-
onClick: () => {
|
|
34607
|
-
if (canSplitCell) {
|
|
34608
|
-
editor.chain().focus().splitCell().run();
|
|
34609
|
-
return;
|
|
34610
|
-
}
|
|
34611
|
-
mergeTableCellsPreservingColumnWidths(editor);
|
|
34612
|
-
},
|
|
34613
|
-
active: canSplitCell,
|
|
34614
|
-
disabled: !canMergeCells && !canSplitCell,
|
|
34615
|
-
title: canSplitCell ? t("tableMenu.splitCell") : t("tableMenu.mergeCells"),
|
|
34616
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_lucide_react52.TableCellsMerge, { className: "w-4 h-4" })
|
|
34617
|
-
}
|
|
34618
|
-
)
|
|
34619
|
-
] })
|
|
34620
|
-
] });
|
|
34776
|
+
] })
|
|
34777
|
+
]
|
|
34778
|
+
}
|
|
34779
|
+
);
|
|
34621
34780
|
};
|
|
34622
34781
|
|
|
34623
34782
|
// src/components/UEditor/menus.tsx
|
|
34624
|
-
var
|
|
34625
|
-
var
|
|
34783
|
+
var import_react74 = require("react");
|
|
34784
|
+
var import_react75 = require("@tiptap/react");
|
|
34626
34785
|
var import_tables7 = require("@tiptap/pm/tables");
|
|
34627
34786
|
var import_react_dom8 = require("react-dom");
|
|
34628
34787
|
var import_lucide_react53 = require("lucide-react");
|
|
@@ -35697,13 +35856,13 @@ function recalculateAllTableFormulas(editor) {
|
|
|
35697
35856
|
}
|
|
35698
35857
|
|
|
35699
35858
|
// src/components/UEditor/menus.tsx
|
|
35700
|
-
var
|
|
35859
|
+
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
35701
35860
|
var FloatingSlashCommandMenu = ({ editor, onClose }) => {
|
|
35702
35861
|
const t = useSmartTranslations("UEditor");
|
|
35703
|
-
const messages = (0,
|
|
35704
|
-
const items = (0,
|
|
35705
|
-
const listRef = (0,
|
|
35706
|
-
(0,
|
|
35862
|
+
const messages = (0, import_react74.useMemo)(() => buildSlashCommandMessages(t), [t]);
|
|
35863
|
+
const items = (0, import_react74.useMemo)(() => buildSlashCommandItems({ query: "", messages }), [messages]);
|
|
35864
|
+
const listRef = (0, import_react74.useRef)(null);
|
|
35865
|
+
(0, import_react74.useEffect)(() => {
|
|
35707
35866
|
const handleKeyDown2 = (event) => {
|
|
35708
35867
|
if (event.key === "Escape") {
|
|
35709
35868
|
event.preventDefault();
|
|
@@ -35718,7 +35877,7 @@ var FloatingSlashCommandMenu = ({ editor, onClose }) => {
|
|
|
35718
35877
|
document.addEventListener("keydown", handleKeyDown2);
|
|
35719
35878
|
return () => document.removeEventListener("keydown", handleKeyDown2);
|
|
35720
35879
|
}, [onClose]);
|
|
35721
|
-
return /* @__PURE__ */ (0,
|
|
35880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
35722
35881
|
SlashCommandList,
|
|
35723
35882
|
{
|
|
35724
35883
|
ref: listRef,
|
|
@@ -35733,19 +35892,19 @@ var FloatingSlashCommandMenu = ({ editor, onClose }) => {
|
|
|
35733
35892
|
};
|
|
35734
35893
|
var FloatingMenuContent = ({ editor }) => {
|
|
35735
35894
|
const t = useSmartTranslations("UEditor");
|
|
35736
|
-
const [showCommands, setShowCommands] = (0,
|
|
35895
|
+
const [showCommands, setShowCommands] = (0, import_react74.useState)(false);
|
|
35737
35896
|
if (showCommands) {
|
|
35738
|
-
return /* @__PURE__ */ (0,
|
|
35897
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(FloatingSlashCommandMenu, { editor, onClose: () => setShowCommands(false) });
|
|
35739
35898
|
}
|
|
35740
|
-
return /* @__PURE__ */ (0,
|
|
35899
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
|
|
35741
35900
|
"button",
|
|
35742
35901
|
{
|
|
35743
35902
|
type: "button",
|
|
35744
35903
|
onClick: () => setShowCommands(true),
|
|
35745
35904
|
className: "flex items-center gap-1 px-2 py-1.5 rounded-lg hover:bg-accent transition-all group",
|
|
35746
35905
|
children: [
|
|
35747
|
-
/* @__PURE__ */ (0,
|
|
35748
|
-
/* @__PURE__ */ (0,
|
|
35906
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.Plus, { className: "w-4 h-4 text-muted-foreground group-hover:text-foreground" }),
|
|
35907
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "text-sm text-muted-foreground group-hover:text-foreground", children: t("floatingMenu.addBlock") })
|
|
35749
35908
|
]
|
|
35750
35909
|
}
|
|
35751
35910
|
);
|
|
@@ -35774,7 +35933,7 @@ function applyTableCellAttribute2(editor, name, value, options = {}) {
|
|
|
35774
35933
|
}
|
|
35775
35934
|
function BorderStylePreviewIcon({ style }) {
|
|
35776
35935
|
const isNone = style === "none";
|
|
35777
|
-
return /* @__PURE__ */ (0,
|
|
35936
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
35778
35937
|
"span",
|
|
35779
35938
|
{
|
|
35780
35939
|
"aria-hidden": "true",
|
|
@@ -35786,7 +35945,7 @@ function BorderStylePreviewIcon({ style }) {
|
|
|
35786
35945
|
borderStyle: style,
|
|
35787
35946
|
borderWidth: style === "double" ? 3 : 2
|
|
35788
35947
|
},
|
|
35789
|
-
children: isNone && /* @__PURE__ */ (0,
|
|
35948
|
+
children: isNone && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "absolute left-1/2 top-0 h-full w-px -translate-x-1/2 rotate-45 bg-muted-foreground/70" })
|
|
35790
35949
|
}
|
|
35791
35950
|
);
|
|
35792
35951
|
}
|
|
@@ -35797,8 +35956,8 @@ function BorderPositionPreviewIcon({ position }) {
|
|
|
35797
35956
|
const showLeft = position === "all" || position === "outer" || position === "left";
|
|
35798
35957
|
const showHorizontal = position === "all" || position === "inner" || position === "horizontal";
|
|
35799
35958
|
const showVertical = position === "all" || position === "inner" || position === "vertical";
|
|
35800
|
-
return /* @__PURE__ */ (0,
|
|
35801
|
-
/* @__PURE__ */ (0,
|
|
35959
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("svg", { "aria-hidden": "true", viewBox: "0 0 20 20", className: "h-5 w-5 fill-none stroke-current", children: [
|
|
35960
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
35802
35961
|
"path",
|
|
35803
35962
|
{
|
|
35804
35963
|
d: "M2 2H18V18H2Z M2 10H18 M10 2V18",
|
|
@@ -35808,12 +35967,12 @@ function BorderPositionPreviewIcon({ position }) {
|
|
|
35808
35967
|
strokeWidth: "1.25"
|
|
35809
35968
|
}
|
|
35810
35969
|
),
|
|
35811
|
-
showTop && /* @__PURE__ */ (0,
|
|
35812
|
-
showRight && /* @__PURE__ */ (0,
|
|
35813
|
-
showBottom && /* @__PURE__ */ (0,
|
|
35814
|
-
showLeft && /* @__PURE__ */ (0,
|
|
35815
|
-
showHorizontal && /* @__PURE__ */ (0,
|
|
35816
|
-
showVertical && /* @__PURE__ */ (0,
|
|
35970
|
+
showTop && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("path", { d: "M2 2H18", strokeWidth: "2" }),
|
|
35971
|
+
showRight && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("path", { d: "M18 2V18", strokeWidth: "2" }),
|
|
35972
|
+
showBottom && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("path", { d: "M2 18H18", strokeWidth: "2" }),
|
|
35973
|
+
showLeft && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("path", { d: "M2 2V18", strokeWidth: "2" }),
|
|
35974
|
+
showHorizontal && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("path", { d: "M2 10H18", strokeWidth: "2" }),
|
|
35975
|
+
showVertical && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("path", { d: "M10 2V18", strokeWidth: "2" })
|
|
35817
35976
|
] });
|
|
35818
35977
|
}
|
|
35819
35978
|
var BubbleMenuContent = ({
|
|
@@ -35827,26 +35986,26 @@ var BubbleMenuContent = ({
|
|
|
35827
35986
|
cellBorderOpenRequest = 0
|
|
35828
35987
|
}) => {
|
|
35829
35988
|
const t = useSmartTranslations("UEditor");
|
|
35830
|
-
(0,
|
|
35989
|
+
(0, import_react75.useEditorState)({
|
|
35831
35990
|
editor,
|
|
35832
35991
|
selector: ({ transactionNumber }) => transactionNumber
|
|
35833
35992
|
});
|
|
35834
35993
|
const { textColors, highlightColors } = useEditorColors();
|
|
35835
|
-
const [showLinkInput, setShowLinkInput] = (0,
|
|
35836
|
-
const [activeColorPalette, setActiveColorPalette] = (0,
|
|
35837
|
-
(0,
|
|
35994
|
+
const [showLinkInput, setShowLinkInput] = (0, import_react74.useState)(initialShowLinkInput);
|
|
35995
|
+
const [activeColorPalette, setActiveColorPalette] = (0, import_react74.useState)(null);
|
|
35996
|
+
(0, import_react74.useEffect)(() => {
|
|
35838
35997
|
setShowLinkInput(initialShowLinkInput);
|
|
35839
35998
|
}, [initialShowLinkInput]);
|
|
35840
|
-
(0,
|
|
35999
|
+
(0, import_react74.useEffect)(() => {
|
|
35841
36000
|
if (!cellBorderOpenRequest) return;
|
|
35842
36001
|
setActiveColorPalette("cell-border");
|
|
35843
36002
|
onKeepOpenChange?.(true);
|
|
35844
36003
|
}, [cellBorderOpenRequest, onKeepOpenChange]);
|
|
35845
|
-
const [showTypographyPanel, setShowTypographyPanel] = (0,
|
|
35846
|
-
const [showFormulaPanel, setShowFormulaPanel] = (0,
|
|
35847
|
-
const [formulaDraft, setFormulaDraft] = (0,
|
|
35848
|
-
const [showFontSizeOptions, setShowFontSizeOptions] = (0,
|
|
35849
|
-
const [fontSizeDraft, setFontSizeDraft] = (0,
|
|
36004
|
+
const [showTypographyPanel, setShowTypographyPanel] = (0, import_react74.useState)(false);
|
|
36005
|
+
const [showFormulaPanel, setShowFormulaPanel] = (0, import_react74.useState)(false);
|
|
36006
|
+
const [formulaDraft, setFormulaDraft] = (0, import_react74.useState)("");
|
|
36007
|
+
const [showFontSizeOptions, setShowFontSizeOptions] = (0, import_react74.useState)(false);
|
|
36008
|
+
const [fontSizeDraft, setFontSizeDraft] = (0, import_react74.useState)("");
|
|
35850
36009
|
const isImageSelected = editor.isActive("image");
|
|
35851
36010
|
const imageAttrs = editor.getAttributes("image");
|
|
35852
36011
|
const imageLayout = imageAttrs.imageLayout === "left" || imageAttrs.imageLayout === "right" ? imageAttrs.imageLayout : "block";
|
|
@@ -35860,13 +36019,13 @@ var BubbleMenuContent = ({
|
|
|
35860
36019
|
const currentCellBorderStyle = editor.getAttributes("tableCell").borderStyle || editor.getAttributes("tableHeader").borderStyle || "solid";
|
|
35861
36020
|
const currentCellBorderWidth = editor.getAttributes("tableCell").borderWidth || editor.getAttributes("tableHeader").borderWidth || "1px";
|
|
35862
36021
|
const currentCellBorderColor = normalizeStyleValue(editor.getAttributes("tableCell").borderColor || editor.getAttributes("tableHeader").borderColor) || "#000000";
|
|
35863
|
-
const [borderStyleDraft, setBorderStyleDraft] = (0,
|
|
36022
|
+
const [borderStyleDraft, setBorderStyleDraft] = (0, import_react74.useState)(
|
|
35864
36023
|
["solid", "dashed", "dotted", "double"].includes(currentCellBorderStyle) ? currentCellBorderStyle : "solid"
|
|
35865
36024
|
);
|
|
35866
|
-
const [borderWidthDraft, setBorderWidthDraft] = (0,
|
|
35867
|
-
const [borderColorDraft, setBorderColorDraft] = (0,
|
|
35868
|
-
const [borderEditMode, setBorderEditMode] = (0,
|
|
35869
|
-
const [activeBorderPosition, setActiveBorderPosition] = (0,
|
|
36025
|
+
const [borderWidthDraft, setBorderWidthDraft] = (0, import_react74.useState)(currentCellBorderWidth);
|
|
36026
|
+
const [borderColorDraft, setBorderColorDraft] = (0, import_react74.useState)(currentCellBorderColor);
|
|
36027
|
+
const [borderEditMode, setBorderEditMode] = (0, import_react74.useState)("draw");
|
|
36028
|
+
const [activeBorderPosition, setActiveBorderPosition] = (0, import_react74.useState)("all");
|
|
35870
36029
|
const currentCellVerticalAlign = normalizeStyleValue(editor.getAttributes("tableCell").verticalAlign || editor.getAttributes("tableHeader").verticalAlign) || "";
|
|
35871
36030
|
const currentCellTextDirection = normalizeStyleValue(editor.getAttributes("tableCell").textDirection || editor.getAttributes("tableHeader").textDirection) || "horizontal";
|
|
35872
36031
|
const isInTable2 = (0, import_tables7.isInTable)(editor.state);
|
|
@@ -35874,15 +36033,15 @@ var BubbleMenuContent = ({
|
|
|
35874
36033
|
const canSplitCell = isInTable2 && editor.can().splitCell();
|
|
35875
36034
|
const currentFontSize = normalizeStyleValue(textStyleAttrs.fontSize);
|
|
35876
36035
|
const currentLineHeight = normalizeStyleValue(textStyleAttrs.lineHeight);
|
|
35877
|
-
const quickFontSizes = (0,
|
|
36036
|
+
const quickFontSizes = (0, import_react74.useMemo)(
|
|
35878
36037
|
() => (fontSizes ?? getDefaultFontSizes()).filter((option) => ["14px", "16px", "24px"].includes(option.value)),
|
|
35879
36038
|
[fontSizes]
|
|
35880
36039
|
);
|
|
35881
|
-
const quickLineHeights = (0,
|
|
36040
|
+
const quickLineHeights = (0, import_react74.useMemo)(
|
|
35882
36041
|
() => (lineHeights ?? getDefaultLineHeights()).filter((option) => ["1.2", "1.5", "1.75"].includes(option.value)),
|
|
35883
36042
|
[lineHeights]
|
|
35884
36043
|
);
|
|
35885
|
-
const borderColors = (0,
|
|
36044
|
+
const borderColors = (0, import_react74.useMemo)(
|
|
35886
36045
|
() => [
|
|
35887
36046
|
highlightColors[0] ?? { name: t("colors.default"), color: "" },
|
|
35888
36047
|
{ name: "Black", color: "#000000" },
|
|
@@ -35891,10 +36050,10 @@ var BubbleMenuContent = ({
|
|
|
35891
36050
|
],
|
|
35892
36051
|
[highlightColors, t]
|
|
35893
36052
|
);
|
|
35894
|
-
(0,
|
|
36053
|
+
(0, import_react74.useEffect)(() => {
|
|
35895
36054
|
setFontSizeDraft(currentFontSize.replace(/px$/i, ""));
|
|
35896
36055
|
}, [currentFontSize]);
|
|
35897
|
-
(0,
|
|
36056
|
+
(0, import_react74.useEffect)(() => {
|
|
35898
36057
|
setFormulaDraft(currentCellFormula);
|
|
35899
36058
|
}, [currentCellFormula]);
|
|
35900
36059
|
const applyFontSizeDraft = () => {
|
|
@@ -35909,21 +36068,21 @@ var BubbleMenuContent = ({
|
|
|
35909
36068
|
editor.chain().focus().setFontSize(`${clamped}px`).run();
|
|
35910
36069
|
setFontSizeDraft(String(clamped));
|
|
35911
36070
|
};
|
|
35912
|
-
(0,
|
|
36071
|
+
(0, import_react74.useEffect)(() => {
|
|
35913
36072
|
onKeepOpenChange?.(showLinkInput);
|
|
35914
36073
|
onLinkInputOpenChange?.(showLinkInput);
|
|
35915
36074
|
}, [onKeepOpenChange, onLinkInputOpenChange, showLinkInput]);
|
|
35916
|
-
(0,
|
|
36075
|
+
(0, import_react74.useEffect)(() => {
|
|
35917
36076
|
onKeepOpenChange?.(Boolean(activeColorPalette));
|
|
35918
36077
|
}, [activeColorPalette, onKeepOpenChange]);
|
|
35919
|
-
const closeTransientPanels = (0,
|
|
36078
|
+
const closeTransientPanels = (0, import_react74.useCallback)(() => {
|
|
35920
36079
|
setActiveColorPalette(null);
|
|
35921
36080
|
setShowLinkInput(false);
|
|
35922
36081
|
onKeepOpenChange?.(false);
|
|
35923
36082
|
onLinkInputOpenChange?.(false);
|
|
35924
36083
|
onRequestClose?.();
|
|
35925
36084
|
}, [onKeepOpenChange, onLinkInputOpenChange, onRequestClose]);
|
|
35926
|
-
const selectTableCellBorderColor = (0,
|
|
36085
|
+
const selectTableCellBorderColor = (0, import_react74.useCallback)((color) => {
|
|
35927
36086
|
const value = color || "currentColor";
|
|
35928
36087
|
setBorderColorDraft(value);
|
|
35929
36088
|
setBorderEditMode("draw");
|
|
@@ -35936,7 +36095,7 @@ var BubbleMenuContent = ({
|
|
|
35936
36095
|
setActiveColorPalette("cell-border");
|
|
35937
36096
|
onKeepOpenChange?.(true);
|
|
35938
36097
|
}, [borderStyleDraft, borderWidthDraft, editor, onKeepOpenChange]);
|
|
35939
|
-
const applyTableCellBorderPosition = (0,
|
|
36098
|
+
const applyTableCellBorderPosition = (0, import_react74.useCallback)((position) => {
|
|
35940
36099
|
setActiveBorderPosition(position);
|
|
35941
36100
|
applyTableCellBorders(editor, position, {
|
|
35942
36101
|
color: borderColorDraft,
|
|
@@ -35945,7 +36104,7 @@ var BubbleMenuContent = ({
|
|
|
35945
36104
|
}, { focus: false });
|
|
35946
36105
|
onKeepOpenChange?.(true);
|
|
35947
36106
|
}, [borderColorDraft, borderEditMode, borderStyleDraft, borderWidthDraft, editor, onKeepOpenChange]);
|
|
35948
|
-
const applyTableCellBorderStyle = (0,
|
|
36107
|
+
const applyTableCellBorderStyle = (0, import_react74.useCallback)((style) => {
|
|
35949
36108
|
setBorderStyleDraft(style);
|
|
35950
36109
|
setBorderEditMode("draw");
|
|
35951
36110
|
setActiveBorderPosition("all");
|
|
@@ -35956,7 +36115,7 @@ var BubbleMenuContent = ({
|
|
|
35956
36115
|
}, { focus: false });
|
|
35957
36116
|
onKeepOpenChange?.(true);
|
|
35958
36117
|
}, [borderColorDraft, borderWidthDraft, editor, onKeepOpenChange]);
|
|
35959
|
-
const applyTableCellBorderWidth = (0,
|
|
36118
|
+
const applyTableCellBorderWidth = (0, import_react74.useCallback)((width) => {
|
|
35960
36119
|
setBorderWidthDraft(width);
|
|
35961
36120
|
setBorderEditMode("draw");
|
|
35962
36121
|
setActiveBorderPosition("all");
|
|
@@ -35967,7 +36126,7 @@ var BubbleMenuContent = ({
|
|
|
35967
36126
|
}, { focus: false });
|
|
35968
36127
|
onKeepOpenChange?.(true);
|
|
35969
36128
|
}, [borderColorDraft, borderStyleDraft, editor, onKeepOpenChange]);
|
|
35970
|
-
const clearTableCellBorders = (0,
|
|
36129
|
+
const clearTableCellBorders = (0, import_react74.useCallback)(() => {
|
|
35971
36130
|
setActiveBorderPosition("all");
|
|
35972
36131
|
setBorderEditMode("erase");
|
|
35973
36132
|
applyTableCellBorders(editor, "all", {
|
|
@@ -35977,11 +36136,11 @@ var BubbleMenuContent = ({
|
|
|
35977
36136
|
}, { focus: false });
|
|
35978
36137
|
onKeepOpenChange?.(true);
|
|
35979
36138
|
}, [borderColorDraft, borderWidthDraft, editor, onKeepOpenChange]);
|
|
35980
|
-
const closeColorPalette = (0,
|
|
36139
|
+
const closeColorPalette = (0, import_react74.useCallback)(() => {
|
|
35981
36140
|
setActiveColorPalette(null);
|
|
35982
36141
|
onKeepOpenChange?.(false);
|
|
35983
36142
|
}, [onKeepOpenChange]);
|
|
35984
|
-
const applyInlineColorAndClose = (0,
|
|
36143
|
+
const applyInlineColorAndClose = (0, import_react74.useCallback)((color) => {
|
|
35985
36144
|
if (activeColorPalette === "text") {
|
|
35986
36145
|
if (color === "inherit") {
|
|
35987
36146
|
editor.chain().focus().unsetColor().run();
|
|
@@ -35999,7 +36158,7 @@ var BubbleMenuContent = ({
|
|
|
35999
36158
|
}
|
|
36000
36159
|
closeColorPalette();
|
|
36001
36160
|
}, [activeColorPalette, closeColorPalette, editor]);
|
|
36002
|
-
(0,
|
|
36161
|
+
(0, import_react74.useEffect)(() => {
|
|
36003
36162
|
if (!showLinkInput) return;
|
|
36004
36163
|
const close2 = () => setShowLinkInput(false);
|
|
36005
36164
|
editor.on("selectionUpdate", close2);
|
|
@@ -36010,7 +36169,7 @@ var BubbleMenuContent = ({
|
|
|
36010
36169
|
};
|
|
36011
36170
|
}, [editor, showLinkInput]);
|
|
36012
36171
|
if (showLinkInput) {
|
|
36013
|
-
return /* @__PURE__ */ (0,
|
|
36172
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36014
36173
|
LinkInput,
|
|
36015
36174
|
{
|
|
36016
36175
|
initialUrl: editor.getAttributes("link").href || "",
|
|
@@ -36030,12 +36189,12 @@ var BubbleMenuContent = ({
|
|
|
36030
36189
|
const isTextPalette = activeColorPalette === "text";
|
|
36031
36190
|
const isHighlightPalette = activeColorPalette === "highlight";
|
|
36032
36191
|
if (activeColorPalette === "cell-border") {
|
|
36033
|
-
return /* @__PURE__ */ (0,
|
|
36034
|
-
/* @__PURE__ */ (0,
|
|
36035
|
-
/* @__PURE__ */ (0,
|
|
36036
|
-
/* @__PURE__ */ (0,
|
|
36037
|
-
/* @__PURE__ */ (0,
|
|
36038
|
-
/* @__PURE__ */ (0,
|
|
36192
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "flex w-72 flex-col gap-2 p-2 text-sm", "data-ueditor-keep-open": true, children: [
|
|
36193
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "font-semibold text-xs text-muted-foreground uppercase tracking-wider mb-1", children: t("tableMenu.cellBorder") || "Cell Borders" }),
|
|
36194
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "flex gap-2", children: [
|
|
36195
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
36196
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("label", { className: "mb-1 block text-xs text-muted-foreground", children: t("tableMenu.borderPosition") || "Border placement" }),
|
|
36197
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "grid grid-cols-5 gap-1", role: "group", "aria-label": t("tableMenu.borderPosition") || "Border placement", children: [
|
|
36039
36198
|
[
|
|
36040
36199
|
["all", "borderAll"],
|
|
36041
36200
|
["outer", "borderOuter"],
|
|
@@ -36048,7 +36207,7 @@ var BubbleMenuContent = ({
|
|
|
36048
36207
|
["left", "borderLeft"]
|
|
36049
36208
|
].map(([position, labelKey]) => {
|
|
36050
36209
|
const label = t(`tableMenu.${labelKey}`) || position;
|
|
36051
|
-
return /* @__PURE__ */ (0,
|
|
36210
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36052
36211
|
"button",
|
|
36053
36212
|
{
|
|
36054
36213
|
type: "button",
|
|
@@ -36060,12 +36219,12 @@ var BubbleMenuContent = ({
|
|
|
36060
36219
|
"inline-flex h-8 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted hover:text-primary",
|
|
36061
36220
|
activeBorderPosition === position ? "bg-primary/10 text-primary" : "bg-muted/40"
|
|
36062
36221
|
),
|
|
36063
|
-
children: /* @__PURE__ */ (0,
|
|
36222
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(BorderPositionPreviewIcon, { position })
|
|
36064
36223
|
},
|
|
36065
36224
|
position
|
|
36066
36225
|
);
|
|
36067
36226
|
}),
|
|
36068
|
-
/* @__PURE__ */ (0,
|
|
36227
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36069
36228
|
"button",
|
|
36070
36229
|
{
|
|
36071
36230
|
type: "button",
|
|
@@ -36074,13 +36233,13 @@ var BubbleMenuContent = ({
|
|
|
36074
36233
|
onMouseDown: (event) => event.preventDefault(),
|
|
36075
36234
|
onClick: clearTableCellBorders,
|
|
36076
36235
|
className: "inline-flex h-8 items-center justify-center rounded-md bg-muted/40 text-destructive transition-colors hover:bg-destructive/10",
|
|
36077
|
-
children: /* @__PURE__ */ (0,
|
|
36236
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(BorderStylePreviewIcon, { style: "none" })
|
|
36078
36237
|
}
|
|
36079
36238
|
)
|
|
36080
36239
|
] })
|
|
36081
36240
|
] }),
|
|
36082
|
-
/* @__PURE__ */ (0,
|
|
36083
|
-
/* @__PURE__ */ (0,
|
|
36241
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "flex flex-col gap-1 border-l border-border pl-2 pt-5", role: "group", "aria-label": t("tableMenu.borderMode") || "Border mode", children: [
|
|
36242
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36084
36243
|
"button",
|
|
36085
36244
|
{
|
|
36086
36245
|
type: "button",
|
|
@@ -36092,10 +36251,10 @@ var BubbleMenuContent = ({
|
|
|
36092
36251
|
"inline-flex h-8 w-8 items-center justify-center rounded-md transition-colors hover:bg-muted",
|
|
36093
36252
|
borderEditMode === "draw" ? "bg-primary/10 text-primary" : "text-muted-foreground"
|
|
36094
36253
|
),
|
|
36095
|
-
children: /* @__PURE__ */ (0,
|
|
36254
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.Edit2, { className: "h-4 w-4" })
|
|
36096
36255
|
}
|
|
36097
36256
|
),
|
|
36098
|
-
/* @__PURE__ */ (0,
|
|
36257
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36099
36258
|
"button",
|
|
36100
36259
|
{
|
|
36101
36260
|
type: "button",
|
|
@@ -36107,19 +36266,19 @@ var BubbleMenuContent = ({
|
|
|
36107
36266
|
"inline-flex h-8 w-8 items-center justify-center rounded-md transition-colors hover:bg-muted",
|
|
36108
36267
|
borderEditMode === "erase" ? "bg-destructive/10 text-destructive" : "text-muted-foreground"
|
|
36109
36268
|
),
|
|
36110
|
-
children: /* @__PURE__ */ (0,
|
|
36269
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.Eraser, { className: "h-4 w-4" })
|
|
36111
36270
|
}
|
|
36112
36271
|
)
|
|
36113
36272
|
] })
|
|
36114
36273
|
] }),
|
|
36115
|
-
/* @__PURE__ */ (0,
|
|
36116
|
-
/* @__PURE__ */ (0,
|
|
36117
|
-
/* @__PURE__ */ (0,
|
|
36274
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
36275
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("label", { className: "text-xs text-muted-foreground", children: t("tableMenu.borderStyle") || "Border Style" }),
|
|
36276
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "grid grid-cols-4 gap-1.5", role: "group", "aria-label": t("tableMenu.borderStyle") || "Border Style", children: [
|
|
36118
36277
|
["solid", "Solid"],
|
|
36119
36278
|
["dashed", "Dashed"],
|
|
36120
36279
|
["dotted", "Dotted"],
|
|
36121
36280
|
["double", "Double"]
|
|
36122
|
-
].map(([style, label]) => /* @__PURE__ */ (0,
|
|
36281
|
+
].map(([style, label]) => /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
|
|
36123
36282
|
"button",
|
|
36124
36283
|
{
|
|
36125
36284
|
type: "button",
|
|
@@ -36130,16 +36289,16 @@ var BubbleMenuContent = ({
|
|
|
36130
36289
|
borderStyleDraft === style ? "bg-primary/10 text-primary" : "bg-muted/40 text-foreground"
|
|
36131
36290
|
),
|
|
36132
36291
|
children: [
|
|
36133
|
-
/* @__PURE__ */ (0,
|
|
36134
|
-
/* @__PURE__ */ (0,
|
|
36292
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(BorderStylePreviewIcon, { style }),
|
|
36293
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { children: label })
|
|
36135
36294
|
]
|
|
36136
36295
|
},
|
|
36137
36296
|
style
|
|
36138
36297
|
)) })
|
|
36139
36298
|
] }),
|
|
36140
|
-
/* @__PURE__ */ (0,
|
|
36141
|
-
/* @__PURE__ */ (0,
|
|
36142
|
-
/* @__PURE__ */ (0,
|
|
36299
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
36300
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("label", { className: "text-xs text-muted-foreground", children: t("tableMenu.borderWidth") || "Border Width" }),
|
|
36301
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "grid grid-cols-4 gap-1", role: "group", "aria-label": t("tableMenu.borderWidth") || "Border Width", children: ["1px", "2px", "3px", "4px"].map((width) => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36143
36302
|
"button",
|
|
36144
36303
|
{
|
|
36145
36304
|
type: "button",
|
|
@@ -36154,15 +36313,15 @@ var BubbleMenuContent = ({
|
|
|
36154
36313
|
width
|
|
36155
36314
|
)) })
|
|
36156
36315
|
] }),
|
|
36157
|
-
/* @__PURE__ */ (0,
|
|
36316
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
|
|
36158
36317
|
"button",
|
|
36159
36318
|
{
|
|
36160
36319
|
type: "button",
|
|
36161
36320
|
onClick: () => setActiveColorPalette("cell-border-color"),
|
|
36162
36321
|
className: "flex items-center justify-between w-full h-8 px-2 rounded-md border border-input hover:bg-accent text-xs",
|
|
36163
36322
|
children: [
|
|
36164
|
-
/* @__PURE__ */ (0,
|
|
36165
|
-
/* @__PURE__ */ (0,
|
|
36323
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { children: t("tableMenu.borderColor") || "Border Color" }),
|
|
36324
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36166
36325
|
"span",
|
|
36167
36326
|
{
|
|
36168
36327
|
className: "w-4 h-4 rounded-full border border-border",
|
|
@@ -36177,7 +36336,7 @@ var BubbleMenuContent = ({
|
|
|
36177
36336
|
] });
|
|
36178
36337
|
}
|
|
36179
36338
|
if (activeColorPalette === "cell-border-color") {
|
|
36180
|
-
return /* @__PURE__ */ (0,
|
|
36339
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "w-56", "data-ueditor-keep-open": true, children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36181
36340
|
EditorColorPalette,
|
|
36182
36341
|
{
|
|
36183
36342
|
colors: borderColors,
|
|
@@ -36187,7 +36346,7 @@ var BubbleMenuContent = ({
|
|
|
36187
36346
|
}
|
|
36188
36347
|
) });
|
|
36189
36348
|
}
|
|
36190
|
-
return /* @__PURE__ */ (0,
|
|
36349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "w-56", "data-ueditor-keep-open": true, children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36191
36350
|
EditorColorPalette,
|
|
36192
36351
|
{
|
|
36193
36352
|
colors: isTextPalette ? textColors : highlightColors,
|
|
@@ -36198,32 +36357,32 @@ var BubbleMenuContent = ({
|
|
|
36198
36357
|
) });
|
|
36199
36358
|
}
|
|
36200
36359
|
if (isImageSelected) {
|
|
36201
|
-
return /* @__PURE__ */ (0,
|
|
36202
|
-
/* @__PURE__ */ (0,
|
|
36203
|
-
/* @__PURE__ */ (0,
|
|
36204
|
-
/* @__PURE__ */ (0,
|
|
36205
|
-
/* @__PURE__ */ (0,
|
|
36206
|
-
/* @__PURE__ */ (0,
|
|
36207
|
-
/* @__PURE__ */ (0,
|
|
36208
|
-
/* @__PURE__ */ (0,
|
|
36209
|
-
/* @__PURE__ */ (0,
|
|
36210
|
-
/* @__PURE__ */ (0,
|
|
36211
|
-
/* @__PURE__ */ (0,
|
|
36360
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "flex items-center gap-0.5 p-1", children: [
|
|
36361
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ToolbarButton, { onClick: () => applyImageLayout(editor, "block"), active: imageLayout === "block", title: t("toolbar.imageLayoutBlock"), children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.AlignCenter, { className: "w-4 h-4" }) }),
|
|
36362
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ToolbarButton, { onClick: () => applyImageLayout(editor, "left"), active: imageLayout === "left", title: t("toolbar.imageLayoutLeft"), children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.AlignLeft, { className: "w-4 h-4" }) }),
|
|
36363
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ToolbarButton, { onClick: () => applyImageLayout(editor, "right"), active: imageLayout === "right", title: t("toolbar.imageLayoutRight"), children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.AlignRight, { className: "w-4 h-4" }) }),
|
|
36364
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
36365
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ToolbarButton, { onClick: () => applyImageWidthPreset(editor, "sm"), active: imageWidthPreset === "sm", title: t("toolbar.imageWidthSm"), children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "text-[10px] font-semibold", children: "S" }) }),
|
|
36366
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ToolbarButton, { onClick: () => applyImageWidthPreset(editor, "md"), active: imageWidthPreset === "md", title: t("toolbar.imageWidthMd"), children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "text-[10px] font-semibold", children: "M" }) }),
|
|
36367
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ToolbarButton, { onClick: () => applyImageWidthPreset(editor, "lg"), active: imageWidthPreset === "lg", title: t("toolbar.imageWidthLg"), children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "text-[10px] font-semibold", children: "L" }) }),
|
|
36368
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
36369
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ToolbarButton, { onClick: () => resetImageSize(editor), title: t("toolbar.imageResetSize"), children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.RotateCcw, { className: "w-4 h-4" }) }),
|
|
36370
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36212
36371
|
ToolbarButton,
|
|
36213
36372
|
{
|
|
36214
36373
|
onClick: () => deleteSelectedImage(editor),
|
|
36215
36374
|
title: t("toolbar.imageDelete"),
|
|
36216
36375
|
className: "text-destructive hover:text-destructive",
|
|
36217
|
-
children: /* @__PURE__ */ (0,
|
|
36376
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.Trash2, { className: "w-4 h-4" })
|
|
36218
36377
|
}
|
|
36219
36378
|
)
|
|
36220
36379
|
] });
|
|
36221
36380
|
}
|
|
36222
36381
|
if (showFormulaPanel && isInTable2) {
|
|
36223
|
-
return /* @__PURE__ */ (0,
|
|
36224
|
-
/* @__PURE__ */ (0,
|
|
36225
|
-
/* @__PURE__ */ (0,
|
|
36226
|
-
/* @__PURE__ */ (0,
|
|
36382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "w-72 p-2", children: [
|
|
36383
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "mb-2 flex items-center justify-between gap-2", children: [
|
|
36384
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "px-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: t("tableMenu.formula") || "Formula" }),
|
|
36385
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36227
36386
|
"button",
|
|
36228
36387
|
{
|
|
36229
36388
|
type: "button",
|
|
@@ -36236,7 +36395,7 @@ var BubbleMenuContent = ({
|
|
|
36236
36395
|
}
|
|
36237
36396
|
)
|
|
36238
36397
|
] }),
|
|
36239
|
-
/* @__PURE__ */ (0,
|
|
36398
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "flex h-9 items-center overflow-hidden rounded-md border border-border/60 bg-muted/40", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36240
36399
|
"input",
|
|
36241
36400
|
{
|
|
36242
36401
|
value: formulaDraft,
|
|
@@ -36257,15 +36416,15 @@ var BubbleMenuContent = ({
|
|
|
36257
36416
|
className: "h-full min-w-0 flex-1 bg-transparent px-2 text-sm font-medium text-foreground outline-none"
|
|
36258
36417
|
}
|
|
36259
36418
|
) }),
|
|
36260
|
-
/* @__PURE__ */ (0,
|
|
36261
|
-
/* @__PURE__ */ (0,
|
|
36262
|
-
/* @__PURE__ */ (0,
|
|
36419
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "mt-2", children: [
|
|
36420
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "mb-1 px-1 text-[11px] font-medium text-muted-foreground", children: t("tableMenu.numberFormat") || "Number format" }),
|
|
36421
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "grid grid-cols-5 gap-1", children: [
|
|
36263
36422
|
["text", "Text"],
|
|
36264
36423
|
["number", "123"],
|
|
36265
36424
|
["currency", "$"],
|
|
36266
36425
|
["percent", "%"],
|
|
36267
36426
|
["date", "Date"]
|
|
36268
|
-
].map(([format, label]) => /* @__PURE__ */ (0,
|
|
36427
|
+
].map(([format, label]) => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36269
36428
|
"button",
|
|
36270
36429
|
{
|
|
36271
36430
|
type: "button",
|
|
@@ -36279,8 +36438,8 @@ var BubbleMenuContent = ({
|
|
|
36279
36438
|
format
|
|
36280
36439
|
)) })
|
|
36281
36440
|
] }),
|
|
36282
|
-
/* @__PURE__ */ (0,
|
|
36283
|
-
/* @__PURE__ */ (0,
|
|
36441
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "mt-2 grid grid-cols-3 gap-1", children: [
|
|
36442
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36284
36443
|
"button",
|
|
36285
36444
|
{
|
|
36286
36445
|
type: "button",
|
|
@@ -36293,7 +36452,7 @@ var BubbleMenuContent = ({
|
|
|
36293
36452
|
children: t("tableMenu.apply") || "Apply"
|
|
36294
36453
|
}
|
|
36295
36454
|
),
|
|
36296
|
-
/* @__PURE__ */ (0,
|
|
36455
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36297
36456
|
"button",
|
|
36298
36457
|
{
|
|
36299
36458
|
type: "button",
|
|
@@ -36305,7 +36464,7 @@ var BubbleMenuContent = ({
|
|
|
36305
36464
|
children: t("tableMenu.clear") || "Clear"
|
|
36306
36465
|
}
|
|
36307
36466
|
),
|
|
36308
|
-
/* @__PURE__ */ (0,
|
|
36467
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36309
36468
|
"button",
|
|
36310
36469
|
{
|
|
36311
36470
|
type: "button",
|
|
@@ -36318,10 +36477,10 @@ var BubbleMenuContent = ({
|
|
|
36318
36477
|
] });
|
|
36319
36478
|
}
|
|
36320
36479
|
if (showTypographyPanel) {
|
|
36321
|
-
return /* @__PURE__ */ (0,
|
|
36322
|
-
/* @__PURE__ */ (0,
|
|
36323
|
-
/* @__PURE__ */ (0,
|
|
36324
|
-
/* @__PURE__ */ (0,
|
|
36480
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "w-72 p-2", children: [
|
|
36481
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "mb-2 flex items-center justify-between gap-2", children: [
|
|
36482
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "px-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: t("toolbar.textStyle") }),
|
|
36483
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36325
36484
|
"button",
|
|
36326
36485
|
{
|
|
36327
36486
|
type: "button",
|
|
@@ -36331,11 +36490,11 @@ var BubbleMenuContent = ({
|
|
|
36331
36490
|
}
|
|
36332
36491
|
)
|
|
36333
36492
|
] }),
|
|
36334
|
-
/* @__PURE__ */ (0,
|
|
36335
|
-
/* @__PURE__ */ (0,
|
|
36336
|
-
/* @__PURE__ */ (0,
|
|
36337
|
-
/* @__PURE__ */ (0,
|
|
36338
|
-
/* @__PURE__ */ (0,
|
|
36493
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "space-y-2", children: [
|
|
36494
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { children: [
|
|
36495
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "mb-1 px-1 text-[11px] font-medium text-muted-foreground", children: t("toolbar.fontSize") }),
|
|
36496
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "flex h-9 items-center overflow-hidden rounded-md border border-border/60 bg-muted/40", children: [
|
|
36497
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36339
36498
|
"input",
|
|
36340
36499
|
{
|
|
36341
36500
|
type: "number",
|
|
@@ -36359,8 +36518,8 @@ var BubbleMenuContent = ({
|
|
|
36359
36518
|
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"
|
|
36360
36519
|
}
|
|
36361
36520
|
),
|
|
36362
|
-
/* @__PURE__ */ (0,
|
|
36363
|
-
/* @__PURE__ */ (0,
|
|
36521
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "border-l border-border/50 px-2 text-[11px] text-muted-foreground", children: "px" }),
|
|
36522
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36364
36523
|
"button",
|
|
36365
36524
|
{
|
|
36366
36525
|
type: "button",
|
|
@@ -36370,12 +36529,12 @@ var BubbleMenuContent = ({
|
|
|
36370
36529
|
"flex h-full w-9 items-center justify-center border-l border-border/50 transition-colors hover:bg-muted",
|
|
36371
36530
|
showFontSizeOptions && "bg-primary/10 text-primary"
|
|
36372
36531
|
),
|
|
36373
|
-
children: /* @__PURE__ */ (0,
|
|
36532
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.ChevronDown, { className: "h-4 w-4" })
|
|
36374
36533
|
}
|
|
36375
36534
|
)
|
|
36376
36535
|
] }),
|
|
36377
|
-
showFontSizeOptions && /* @__PURE__ */ (0,
|
|
36378
|
-
/* @__PURE__ */ (0,
|
|
36536
|
+
showFontSizeOptions && /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "mt-1 grid grid-cols-4 gap-1", children: [
|
|
36537
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36379
36538
|
"button",
|
|
36380
36539
|
{
|
|
36381
36540
|
type: "button",
|
|
@@ -36390,7 +36549,7 @@ var BubbleMenuContent = ({
|
|
|
36390
36549
|
children: "A"
|
|
36391
36550
|
}
|
|
36392
36551
|
),
|
|
36393
|
-
quickFontSizes.map((option) => /* @__PURE__ */ (0,
|
|
36552
|
+
quickFontSizes.map((option) => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36394
36553
|
"button",
|
|
36395
36554
|
{
|
|
36396
36555
|
type: "button",
|
|
@@ -36408,10 +36567,10 @@ var BubbleMenuContent = ({
|
|
|
36408
36567
|
))
|
|
36409
36568
|
] })
|
|
36410
36569
|
] }),
|
|
36411
|
-
/* @__PURE__ */ (0,
|
|
36412
|
-
/* @__PURE__ */ (0,
|
|
36413
|
-
/* @__PURE__ */ (0,
|
|
36414
|
-
/* @__PURE__ */ (0,
|
|
36570
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { children: [
|
|
36571
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "mb-1 px-1 text-[11px] font-medium text-muted-foreground", children: t("toolbar.lineHeight") }),
|
|
36572
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "grid grid-cols-4 gap-1", children: [
|
|
36573
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36415
36574
|
"button",
|
|
36416
36575
|
{
|
|
36417
36576
|
type: "button",
|
|
@@ -36423,7 +36582,7 @@ var BubbleMenuContent = ({
|
|
|
36423
36582
|
children: "LH"
|
|
36424
36583
|
}
|
|
36425
36584
|
),
|
|
36426
|
-
quickLineHeights.map((option) => /* @__PURE__ */ (0,
|
|
36585
|
+
quickLineHeights.map((option) => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36427
36586
|
"button",
|
|
36428
36587
|
{
|
|
36429
36588
|
type: "button",
|
|
@@ -36438,8 +36597,8 @@ var BubbleMenuContent = ({
|
|
|
36438
36597
|
))
|
|
36439
36598
|
] })
|
|
36440
36599
|
] }),
|
|
36441
|
-
/* @__PURE__ */ (0,
|
|
36442
|
-
/* @__PURE__ */ (0,
|
|
36600
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "grid grid-cols-2 gap-1 border-t border-border/40 pt-2", children: [
|
|
36601
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
|
|
36443
36602
|
"button",
|
|
36444
36603
|
{
|
|
36445
36604
|
type: "button",
|
|
@@ -36449,12 +36608,12 @@ var BubbleMenuContent = ({
|
|
|
36449
36608
|
editor.isActive("subscript") ? "bg-primary/10 text-primary" : "bg-muted/40 text-foreground"
|
|
36450
36609
|
),
|
|
36451
36610
|
children: [
|
|
36452
|
-
/* @__PURE__ */ (0,
|
|
36611
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.Subscript, { className: "h-4 w-4" }),
|
|
36453
36612
|
t("toolbar.subscript")
|
|
36454
36613
|
]
|
|
36455
36614
|
}
|
|
36456
36615
|
),
|
|
36457
|
-
/* @__PURE__ */ (0,
|
|
36616
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
|
|
36458
36617
|
"button",
|
|
36459
36618
|
{
|
|
36460
36619
|
type: "button",
|
|
@@ -36464,7 +36623,7 @@ var BubbleMenuContent = ({
|
|
|
36464
36623
|
editor.isActive("superscript") ? "bg-primary/10 text-primary" : "bg-muted/40 text-foreground"
|
|
36465
36624
|
),
|
|
36466
36625
|
children: [
|
|
36467
|
-
/* @__PURE__ */ (0,
|
|
36626
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.Superscript, { className: "h-4 w-4" }),
|
|
36468
36627
|
t("toolbar.superscript")
|
|
36469
36628
|
]
|
|
36470
36629
|
}
|
|
@@ -36474,22 +36633,22 @@ var BubbleMenuContent = ({
|
|
|
36474
36633
|
] });
|
|
36475
36634
|
}
|
|
36476
36635
|
const VerticalAlignActiveIcon = currentCellVerticalAlign === "middle" ? import_lucide_react53.AlignCenterVertical : currentCellVerticalAlign === "bottom" ? import_lucide_react53.AlignEndVertical : import_lucide_react53.AlignStartVertical;
|
|
36477
|
-
return /* @__PURE__ */ (0,
|
|
36478
|
-
/* @__PURE__ */ (0,
|
|
36479
|
-
/* @__PURE__ */ (0,
|
|
36480
|
-
/* @__PURE__ */ (0,
|
|
36636
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "flex items-center gap-0.5 p-1", children: [
|
|
36637
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.Bold, { className: "w-4 h-4" }) }),
|
|
36638
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.Italic, { className: "w-4 h-4" }) }),
|
|
36639
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36481
36640
|
ToolbarButton,
|
|
36482
36641
|
{
|
|
36483
36642
|
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
36484
36643
|
active: editor.isActive("underline"),
|
|
36485
36644
|
title: t("toolbar.underline"),
|
|
36486
|
-
children: /* @__PURE__ */ (0,
|
|
36645
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.Underline, { className: "w-4 h-4" })
|
|
36487
36646
|
}
|
|
36488
36647
|
),
|
|
36489
|
-
/* @__PURE__ */ (0,
|
|
36490
|
-
/* @__PURE__ */ (0,
|
|
36491
|
-
/* @__PURE__ */ (0,
|
|
36492
|
-
/* @__PURE__ */ (0,
|
|
36648
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleStrike().run(), active: editor.isActive("strike"), title: t("toolbar.strike"), children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.Strikethrough, { className: "w-4 h-4" }) }),
|
|
36649
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleCode().run(), active: editor.isActive("code"), title: t("toolbar.code"), children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.Code, { className: "w-4 h-4" }) }),
|
|
36650
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
36651
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36493
36652
|
ToolbarButton,
|
|
36494
36653
|
{
|
|
36495
36654
|
onMouseDown: () => {
|
|
@@ -36500,22 +36659,22 @@ var BubbleMenuContent = ({
|
|
|
36500
36659
|
},
|
|
36501
36660
|
active: editor.isActive("link"),
|
|
36502
36661
|
title: t("toolbar.link"),
|
|
36503
|
-
children: /* @__PURE__ */ (0,
|
|
36662
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.Link, { className: "w-4 h-4" })
|
|
36504
36663
|
}
|
|
36505
36664
|
),
|
|
36506
|
-
/* @__PURE__ */ (0,
|
|
36507
|
-
/* @__PURE__ */ (0,
|
|
36508
|
-
isInTable2 && /* @__PURE__ */ (0,
|
|
36509
|
-
/* @__PURE__ */ (0,
|
|
36665
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ToolbarButton, { onClick: () => setActiveColorPalette("text"), title: t("colors.textColor"), children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(TextColorIcon, { color: currentTextColor }) }),
|
|
36666
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ToolbarButton, { onClick: () => setActiveColorPalette("highlight"), active: editor.isActive("highlight"), title: t("colors.highlight"), children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(HighlightColorIcon, { color: currentHighlightColor }) }),
|
|
36667
|
+
isInTable2 && /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(import_jsx_runtime94.Fragment, { children: [
|
|
36668
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36510
36669
|
ToolbarButton,
|
|
36511
36670
|
{
|
|
36512
36671
|
onClick: () => setActiveColorPalette("cell-bg"),
|
|
36513
36672
|
active: Boolean(currentCellBgColor),
|
|
36514
36673
|
title: t("tableMenu.cellBackground") || "Cell background",
|
|
36515
|
-
children: /* @__PURE__ */ (0,
|
|
36674
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(CellBgColorIcon, { color: currentCellBgColor })
|
|
36516
36675
|
}
|
|
36517
36676
|
),
|
|
36518
|
-
/* @__PURE__ */ (0,
|
|
36677
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36519
36678
|
ToolbarButton,
|
|
36520
36679
|
{
|
|
36521
36680
|
onMouseDown: () => {
|
|
@@ -36526,7 +36685,7 @@ var BubbleMenuContent = ({
|
|
|
36526
36685
|
editor.getAttributes("tableCell").borderColor || editor.getAttributes("tableHeader").borderColor || editor.getAttributes("tableCell").borderStyle || editor.getAttributes("tableHeader").borderStyle || editor.getAttributes("tableCell").borderWidth || editor.getAttributes("tableHeader").borderWidth
|
|
36527
36686
|
),
|
|
36528
36687
|
title: t("tableMenu.cellBorder") || "Cell border",
|
|
36529
|
-
children: /* @__PURE__ */ (0,
|
|
36688
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36530
36689
|
CellBorderIcon,
|
|
36531
36690
|
{
|
|
36532
36691
|
color: editor.getAttributes("tableCell").borderColor || editor.getAttributes("tableHeader").borderColor
|
|
@@ -36534,7 +36693,7 @@ var BubbleMenuContent = ({
|
|
|
36534
36693
|
)
|
|
36535
36694
|
}
|
|
36536
36695
|
),
|
|
36537
|
-
/* @__PURE__ */ (0,
|
|
36696
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36538
36697
|
ToolbarButton,
|
|
36539
36698
|
{
|
|
36540
36699
|
onMouseDown: () => {
|
|
@@ -36546,10 +36705,10 @@ var BubbleMenuContent = ({
|
|
|
36546
36705
|
},
|
|
36547
36706
|
active: Boolean(currentCellFormula),
|
|
36548
36707
|
title: t("tableMenu.formula") || "Formula",
|
|
36549
|
-
children: /* @__PURE__ */ (0,
|
|
36708
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.Sigma, { className: "w-4 h-4" })
|
|
36550
36709
|
}
|
|
36551
36710
|
),
|
|
36552
|
-
/* @__PURE__ */ (0,
|
|
36711
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36553
36712
|
ToolbarButton,
|
|
36554
36713
|
{
|
|
36555
36714
|
onClick: () => {
|
|
@@ -36562,16 +36721,16 @@ var BubbleMenuContent = ({
|
|
|
36562
36721
|
active: canSplitCell,
|
|
36563
36722
|
disabled: !canMergeCells && !canSplitCell,
|
|
36564
36723
|
title: canSplitCell ? t("tableMenu.splitCell") || "Split cell" : t("tableMenu.mergeCells") || "Merge cells",
|
|
36565
|
-
children: /* @__PURE__ */ (0,
|
|
36724
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.TableCellsMerge, { className: "w-4 h-4" })
|
|
36566
36725
|
}
|
|
36567
36726
|
),
|
|
36568
|
-
/* @__PURE__ */ (0,
|
|
36727
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
|
|
36569
36728
|
DropdownMenu,
|
|
36570
36729
|
{
|
|
36571
36730
|
onOpenChange: (open) => {
|
|
36572
36731
|
onKeepOpenChange?.(open);
|
|
36573
36732
|
},
|
|
36574
|
-
trigger: /* @__PURE__ */ (0,
|
|
36733
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
|
|
36575
36734
|
ToolbarButton,
|
|
36576
36735
|
{
|
|
36577
36736
|
onMouseDown: () => {
|
|
@@ -36581,13 +36740,13 @@ var BubbleMenuContent = ({
|
|
|
36581
36740
|
},
|
|
36582
36741
|
title: t("tableMenu.alignVertical") || "Vertical alignment",
|
|
36583
36742
|
children: [
|
|
36584
|
-
/* @__PURE__ */ (0,
|
|
36585
|
-
/* @__PURE__ */ (0,
|
|
36743
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(VerticalAlignActiveIcon, { className: "w-4 h-4" }),
|
|
36744
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.ChevronDown, { className: "w-3 h-3" })
|
|
36586
36745
|
]
|
|
36587
36746
|
}
|
|
36588
36747
|
),
|
|
36589
36748
|
children: [
|
|
36590
|
-
/* @__PURE__ */ (0,
|
|
36749
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36591
36750
|
DropdownMenuItem,
|
|
36592
36751
|
{
|
|
36593
36752
|
icon: import_lucide_react53.AlignStartVertical,
|
|
@@ -36596,7 +36755,7 @@ var BubbleMenuContent = ({
|
|
|
36596
36755
|
active: currentCellVerticalAlign === "top"
|
|
36597
36756
|
}
|
|
36598
36757
|
),
|
|
36599
|
-
/* @__PURE__ */ (0,
|
|
36758
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36600
36759
|
DropdownMenuItem,
|
|
36601
36760
|
{
|
|
36602
36761
|
icon: import_lucide_react53.AlignCenterVertical,
|
|
@@ -36605,7 +36764,7 @@ var BubbleMenuContent = ({
|
|
|
36605
36764
|
active: currentCellVerticalAlign === "middle"
|
|
36606
36765
|
}
|
|
36607
36766
|
),
|
|
36608
|
-
/* @__PURE__ */ (0,
|
|
36767
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36609
36768
|
DropdownMenuItem,
|
|
36610
36769
|
{
|
|
36611
36770
|
icon: import_lucide_react53.AlignEndVertical,
|
|
@@ -36617,13 +36776,13 @@ var BubbleMenuContent = ({
|
|
|
36617
36776
|
]
|
|
36618
36777
|
}
|
|
36619
36778
|
),
|
|
36620
|
-
/* @__PURE__ */ (0,
|
|
36779
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
|
|
36621
36780
|
DropdownMenu,
|
|
36622
36781
|
{
|
|
36623
36782
|
onOpenChange: (open) => {
|
|
36624
36783
|
onKeepOpenChange?.(open);
|
|
36625
36784
|
},
|
|
36626
|
-
trigger: /* @__PURE__ */ (0,
|
|
36785
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
|
|
36627
36786
|
ToolbarButton,
|
|
36628
36787
|
{
|
|
36629
36788
|
onMouseDown: () => {
|
|
@@ -36633,13 +36792,13 @@ var BubbleMenuContent = ({
|
|
|
36633
36792
|
},
|
|
36634
36793
|
title: t("tableMenu.textDirection"),
|
|
36635
36794
|
children: [
|
|
36636
|
-
currentCellTextDirection === "vertical" ? /* @__PURE__ */ (0,
|
|
36637
|
-
/* @__PURE__ */ (0,
|
|
36795
|
+
currentCellTextDirection === "vertical" ? /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.ArrowDown, { className: "w-4 h-4" }) : /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.ArrowRight, { className: "w-4 h-4" }),
|
|
36796
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.ChevronDown, { className: "w-3 h-3" })
|
|
36638
36797
|
]
|
|
36639
36798
|
}
|
|
36640
36799
|
),
|
|
36641
36800
|
children: [
|
|
36642
|
-
/* @__PURE__ */ (0,
|
|
36801
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36643
36802
|
DropdownMenuItem,
|
|
36644
36803
|
{
|
|
36645
36804
|
icon: import_lucide_react53.ArrowRight,
|
|
@@ -36648,7 +36807,7 @@ var BubbleMenuContent = ({
|
|
|
36648
36807
|
active: currentCellTextDirection === "horizontal"
|
|
36649
36808
|
}
|
|
36650
36809
|
),
|
|
36651
|
-
/* @__PURE__ */ (0,
|
|
36810
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36652
36811
|
DropdownMenuItem,
|
|
36653
36812
|
{
|
|
36654
36813
|
icon: import_lucide_react53.ArrowDown,
|
|
@@ -36661,13 +36820,13 @@ var BubbleMenuContent = ({
|
|
|
36661
36820
|
}
|
|
36662
36821
|
)
|
|
36663
36822
|
] }),
|
|
36664
|
-
/* @__PURE__ */ (0,
|
|
36823
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36665
36824
|
ToolbarButton,
|
|
36666
36825
|
{
|
|
36667
36826
|
onClick: () => setShowTypographyPanel(true),
|
|
36668
36827
|
active: Boolean(currentFontSize || currentLineHeight || editor.isActive("subscript") || editor.isActive("superscript")),
|
|
36669
36828
|
title: t("toolbar.textStyle"),
|
|
36670
|
-
children: /* @__PURE__ */ (0,
|
|
36829
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.Type, { className: "w-4 h-4" })
|
|
36671
36830
|
}
|
|
36672
36831
|
)
|
|
36673
36832
|
] });
|
|
@@ -36682,12 +36841,12 @@ var LinkPreviewContent = ({ editor, onEdit }) => {
|
|
|
36682
36841
|
const handleUnlink = () => {
|
|
36683
36842
|
editor.chain().focus().unsetLink().run();
|
|
36684
36843
|
};
|
|
36685
|
-
return /* @__PURE__ */ (0,
|
|
36686
|
-
/* @__PURE__ */ (0,
|
|
36687
|
-
/* @__PURE__ */ (0,
|
|
36688
|
-
/* @__PURE__ */ (0,
|
|
36689
|
-
/* @__PURE__ */ (0,
|
|
36690
|
-
/* @__PURE__ */ (0,
|
|
36844
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "flex items-center gap-1 p-1 max-w-sm", children: [
|
|
36845
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "text-xs text-muted-foreground font-mono px-2 truncate max-w-45", children: url }),
|
|
36846
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
36847
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ToolbarButton, { onClick: handleOpen, title: t("linkPreview.open") || "Open link", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.ExternalLink, { className: "w-4 h-4" }) }),
|
|
36848
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ToolbarButton, { onClick: onEdit, title: t("linkPreview.edit") || "Edit link", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.Edit2, { className: "w-4 h-4" }) }),
|
|
36849
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ToolbarButton, { onClick: handleUnlink, title: t("linkPreview.unlink") || "Remove link", className: "text-destructive hover:text-destructive", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_lucide_react53.Unlink, { className: "w-4 h-4" }) })
|
|
36691
36850
|
] });
|
|
36692
36851
|
};
|
|
36693
36852
|
var CustomBubbleMenu = ({
|
|
@@ -36698,26 +36857,26 @@ var CustomBubbleMenu = ({
|
|
|
36698
36857
|
const SHOW_DELAY_MS = 180;
|
|
36699
36858
|
const BUBBLE_MENU_OFFSET = 16;
|
|
36700
36859
|
const BUBBLE_MENU_ESTIMATED_HEIGHT = 44;
|
|
36701
|
-
const [isVisible, setIsVisible] = (0,
|
|
36702
|
-
const [linkInputOpen, setLinkInputOpen] = (0,
|
|
36703
|
-
const [cellBorderOpenRequest, setCellBorderOpenRequest] = (0,
|
|
36704
|
-
const [position, setPosition2] = (0,
|
|
36860
|
+
const [isVisible, setIsVisible] = (0, import_react74.useState)(false);
|
|
36861
|
+
const [linkInputOpen, setLinkInputOpen] = (0, import_react74.useState)(false);
|
|
36862
|
+
const [cellBorderOpenRequest, setCellBorderOpenRequest] = (0, import_react74.useState)(0);
|
|
36863
|
+
const [position, setPosition2] = (0, import_react74.useState)({
|
|
36705
36864
|
top: 0,
|
|
36706
36865
|
left: 0,
|
|
36707
36866
|
placement: "top"
|
|
36708
36867
|
});
|
|
36709
|
-
const menuRef = (0,
|
|
36710
|
-
const keepOpenRef = (0,
|
|
36711
|
-
const [keepOpen, setKeepOpenState] = (0,
|
|
36712
|
-
const showTimeoutRef = (0,
|
|
36713
|
-
const suppressShowUntilRef = (0,
|
|
36714
|
-
const setKeepOpen = (0,
|
|
36868
|
+
const menuRef = (0, import_react74.useRef)(null);
|
|
36869
|
+
const keepOpenRef = (0, import_react74.useRef)(false);
|
|
36870
|
+
const [keepOpen, setKeepOpenState] = (0, import_react74.useState)(false);
|
|
36871
|
+
const showTimeoutRef = (0, import_react74.useRef)(null);
|
|
36872
|
+
const suppressShowUntilRef = (0, import_react74.useRef)(0);
|
|
36873
|
+
const setKeepOpen = (0, import_react74.useCallback)((next) => {
|
|
36715
36874
|
keepOpenRef.current = next;
|
|
36716
36875
|
setKeepOpenState(next);
|
|
36717
36876
|
if (!next) setLinkInputOpen(false);
|
|
36718
36877
|
if (next) setIsVisible(true);
|
|
36719
36878
|
}, []);
|
|
36720
|
-
const closeBubbleMenu = (0,
|
|
36879
|
+
const closeBubbleMenu = (0, import_react74.useCallback)((suppressShow = true) => {
|
|
36721
36880
|
suppressShowUntilRef.current = suppressShow ? Date.now() + 1e3 : 0;
|
|
36722
36881
|
keepOpenRef.current = false;
|
|
36723
36882
|
setKeepOpenState(false);
|
|
@@ -36728,7 +36887,7 @@ var CustomBubbleMenu = ({
|
|
|
36728
36887
|
showTimeoutRef.current = null;
|
|
36729
36888
|
}
|
|
36730
36889
|
}, []);
|
|
36731
|
-
(0,
|
|
36890
|
+
(0, import_react74.useEffect)(() => {
|
|
36732
36891
|
const clearShowTimeout = () => {
|
|
36733
36892
|
if (showTimeoutRef.current) {
|
|
36734
36893
|
clearTimeout(showTimeoutRef.current);
|
|
@@ -36810,7 +36969,7 @@ var CustomBubbleMenu = ({
|
|
|
36810
36969
|
editor.off("update", updatePosition);
|
|
36811
36970
|
};
|
|
36812
36971
|
}, [editor]);
|
|
36813
|
-
(0,
|
|
36972
|
+
(0, import_react74.useEffect)(() => {
|
|
36814
36973
|
if (!isVisible) return;
|
|
36815
36974
|
const handlePointerDown = (event) => {
|
|
36816
36975
|
const target = event.target;
|
|
@@ -36829,7 +36988,7 @@ var CustomBubbleMenu = ({
|
|
|
36829
36988
|
document.removeEventListener("keydown", handleKeyDown2);
|
|
36830
36989
|
};
|
|
36831
36990
|
}, [closeBubbleMenu, editor, isVisible]);
|
|
36832
|
-
(0,
|
|
36991
|
+
(0, import_react74.useEffect)(() => {
|
|
36833
36992
|
const handleTableDoubleClick = (event) => {
|
|
36834
36993
|
const target = event.target;
|
|
36835
36994
|
const cell = target?.closest("td,th");
|
|
@@ -36847,7 +37006,7 @@ var CustomBubbleMenu = ({
|
|
|
36847
37006
|
}, [editor]);
|
|
36848
37007
|
if (!isVisible) return null;
|
|
36849
37008
|
return (0, import_react_dom8.createPortal)(
|
|
36850
|
-
/* @__PURE__ */ (0,
|
|
37009
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36851
37010
|
"div",
|
|
36852
37011
|
{
|
|
36853
37012
|
ref: menuRef,
|
|
@@ -36867,7 +37026,7 @@ var CustomBubbleMenu = ({
|
|
|
36867
37026
|
}
|
|
36868
37027
|
e.preventDefault();
|
|
36869
37028
|
},
|
|
36870
|
-
children: editor.isActive("link") && !keepOpen && !linkInputOpen ? /* @__PURE__ */ (0,
|
|
37029
|
+
children: editor.isActive("link") && !keepOpen && !linkInputOpen ? /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36871
37030
|
LinkPreviewContent,
|
|
36872
37031
|
{
|
|
36873
37032
|
editor,
|
|
@@ -36876,7 +37035,7 @@ var CustomBubbleMenu = ({
|
|
|
36876
37035
|
setKeepOpen(true);
|
|
36877
37036
|
}
|
|
36878
37037
|
}
|
|
36879
|
-
) : /* @__PURE__ */ (0,
|
|
37038
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36880
37039
|
BubbleMenuContent,
|
|
36881
37040
|
{
|
|
36882
37041
|
editor,
|
|
@@ -36896,9 +37055,9 @@ var CustomBubbleMenu = ({
|
|
|
36896
37055
|
};
|
|
36897
37056
|
var CustomFloatingMenu = ({ editor }) => {
|
|
36898
37057
|
const FLOATING_MENU_OFFSET = 16;
|
|
36899
|
-
const [isVisible, setIsVisible] = (0,
|
|
36900
|
-
const [position, setPosition2] = (0,
|
|
36901
|
-
(0,
|
|
37058
|
+
const [isVisible, setIsVisible] = (0, import_react74.useState)(false);
|
|
37059
|
+
const [position, setPosition2] = (0, import_react74.useState)({ top: 0, left: 0 });
|
|
37060
|
+
(0, import_react74.useEffect)(() => {
|
|
36902
37061
|
const updatePosition = () => {
|
|
36903
37062
|
const { state, view } = editor;
|
|
36904
37063
|
const { $from, empty } = state.selection;
|
|
@@ -36925,7 +37084,7 @@ var CustomFloatingMenu = ({ editor }) => {
|
|
|
36925
37084
|
}, [editor]);
|
|
36926
37085
|
if (!isVisible) return null;
|
|
36927
37086
|
return (0, import_react_dom8.createPortal)(
|
|
36928
|
-
/* @__PURE__ */ (0,
|
|
37087
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
36929
37088
|
"div",
|
|
36930
37089
|
{
|
|
36931
37090
|
"data-popover": true,
|
|
@@ -36936,7 +37095,7 @@ var CustomFloatingMenu = ({ editor }) => {
|
|
|
36936
37095
|
transform: "translate(-50%, -100%)"
|
|
36937
37096
|
},
|
|
36938
37097
|
onMouseDown: (e) => e.preventDefault(),
|
|
36939
|
-
children: /* @__PURE__ */ (0,
|
|
37098
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(FloatingMenuContent, { editor })
|
|
36940
37099
|
}
|
|
36941
37100
|
),
|
|
36942
37101
|
document.body
|
|
@@ -36944,25 +37103,25 @@ var CustomFloatingMenu = ({ editor }) => {
|
|
|
36944
37103
|
};
|
|
36945
37104
|
|
|
36946
37105
|
// src/components/UEditor/CharacterCount.tsx
|
|
36947
|
-
var
|
|
37106
|
+
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
36948
37107
|
var CharacterCountDisplay = ({ editor, maxCharacters }) => {
|
|
36949
37108
|
const t = useSmartTranslations("UEditor");
|
|
36950
37109
|
const storage = editor.storage;
|
|
36951
37110
|
const characterCount = storage.characterCount?.characters?.() ?? 0;
|
|
36952
37111
|
const wordCount = storage.characterCount?.words?.() ?? 0;
|
|
36953
37112
|
const percentage = maxCharacters ? Math.round(characterCount / maxCharacters * 100) : 0;
|
|
36954
|
-
return /* @__PURE__ */ (0,
|
|
36955
|
-
/* @__PURE__ */ (0,
|
|
37113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { className: "flex items-center gap-3 px-3 py-2 text-xs text-muted-foreground border-t border-border/30 bg-muted/20", children: [
|
|
37114
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("span", { children: [
|
|
36956
37115
|
wordCount,
|
|
36957
37116
|
" ",
|
|
36958
37117
|
t("words")
|
|
36959
37118
|
] }),
|
|
36960
|
-
/* @__PURE__ */ (0,
|
|
37119
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("span", { children: [
|
|
36961
37120
|
characterCount,
|
|
36962
37121
|
" ",
|
|
36963
37122
|
t("characters")
|
|
36964
37123
|
] }),
|
|
36965
|
-
maxCharacters && /* @__PURE__ */ (0,
|
|
37124
|
+
maxCharacters && /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("span", { className: cn(percentage > 90 && "text-destructive", percentage > 100 && "font-bold"), children: [
|
|
36966
37125
|
characterCount,
|
|
36967
37126
|
"/",
|
|
36968
37127
|
maxCharacters
|
|
@@ -37383,7 +37542,7 @@ async function prepareUEditorContentForSave({
|
|
|
37383
37542
|
}
|
|
37384
37543
|
|
|
37385
37544
|
// src/components/UEditor/table-controls.tsx
|
|
37386
|
-
var
|
|
37545
|
+
var import_react76 = __toESM(require("react"), 1);
|
|
37387
37546
|
|
|
37388
37547
|
// node_modules/prosemirror-model/dist/index.js
|
|
37389
37548
|
function findDiffStart(a, b, pos) {
|
|
@@ -41857,7 +42016,7 @@ function buildTableHoverState({
|
|
|
41857
42016
|
}
|
|
41858
42017
|
|
|
41859
42018
|
// src/components/UEditor/table-drag-preview.tsx
|
|
41860
|
-
var
|
|
42019
|
+
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
41861
42020
|
function TableDragPreview({
|
|
41862
42021
|
columnDragLabel,
|
|
41863
42022
|
dragPreview,
|
|
@@ -41868,9 +42027,9 @@ function TableDragPreview({
|
|
|
41868
42027
|
const expandPreviewWidth = dragPreview.kind === "add-column" ? layout.tableWidth + dragPreview.previewCols * layout.avgColumnWidth : layout.tableWidth;
|
|
41869
42028
|
const expandPreviewHeight = dragPreview.kind === "add-row" ? layout.tableHeight + dragPreview.previewRows * layout.avgRowHeight : layout.tableHeight;
|
|
41870
42029
|
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`;
|
|
41871
|
-
return /* @__PURE__ */ (0,
|
|
41872
|
-
dragPreview.kind === "row" && /* @__PURE__ */ (0,
|
|
41873
|
-
/* @__PURE__ */ (0,
|
|
42030
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(import_jsx_runtime96.Fragment, { children: [
|
|
42031
|
+
dragPreview.kind === "row" && /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(import_jsx_runtime96.Fragment, { children: [
|
|
42032
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
41874
42033
|
"div",
|
|
41875
42034
|
{
|
|
41876
42035
|
"aria-hidden": "true",
|
|
@@ -41883,7 +42042,7 @@ function TableDragPreview({
|
|
|
41883
42042
|
}
|
|
41884
42043
|
}
|
|
41885
42044
|
),
|
|
41886
|
-
/* @__PURE__ */ (0,
|
|
42045
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
41887
42046
|
"div",
|
|
41888
42047
|
{
|
|
41889
42048
|
"aria-hidden": "true",
|
|
@@ -41897,8 +42056,8 @@ function TableDragPreview({
|
|
|
41897
42056
|
}
|
|
41898
42057
|
)
|
|
41899
42058
|
] }),
|
|
41900
|
-
dragPreview.kind === "column" && /* @__PURE__ */ (0,
|
|
41901
|
-
/* @__PURE__ */ (0,
|
|
42059
|
+
dragPreview.kind === "column" && /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(import_jsx_runtime96.Fragment, { children: [
|
|
42060
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
41902
42061
|
"div",
|
|
41903
42062
|
{
|
|
41904
42063
|
"aria-hidden": "true",
|
|
@@ -41911,7 +42070,7 @@ function TableDragPreview({
|
|
|
41911
42070
|
}
|
|
41912
42071
|
}
|
|
41913
42072
|
),
|
|
41914
|
-
/* @__PURE__ */ (0,
|
|
42073
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
41915
42074
|
"div",
|
|
41916
42075
|
{
|
|
41917
42076
|
"aria-hidden": "true",
|
|
@@ -41925,7 +42084,7 @@ function TableDragPreview({
|
|
|
41925
42084
|
}
|
|
41926
42085
|
)
|
|
41927
42086
|
] }),
|
|
41928
|
-
(dragPreview.kind === "add-row" || dragPreview.kind === "add-column") && /* @__PURE__ */ (0,
|
|
42087
|
+
(dragPreview.kind === "add-row" || dragPreview.kind === "add-column") && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
41929
42088
|
"div",
|
|
41930
42089
|
{
|
|
41931
42090
|
"aria-hidden": "true",
|
|
@@ -41938,7 +42097,7 @@ function TableDragPreview({
|
|
|
41938
42097
|
}
|
|
41939
42098
|
}
|
|
41940
42099
|
),
|
|
41941
|
-
/* @__PURE__ */ (0,
|
|
42100
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
41942
42101
|
"div",
|
|
41943
42102
|
{
|
|
41944
42103
|
role: "status",
|
|
@@ -41954,7 +42113,7 @@ function TableDragPreview({
|
|
|
41954
42113
|
}
|
|
41955
42114
|
|
|
41956
42115
|
// src/components/UEditor/table-add-rails.tsx
|
|
41957
|
-
var
|
|
42116
|
+
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
41958
42117
|
var ADD_COLUMN_RAIL_GAP = 4;
|
|
41959
42118
|
var ADD_ROW_RAIL_GAP = 4;
|
|
41960
42119
|
function TableAddRails({
|
|
@@ -41975,13 +42134,13 @@ function TableAddRails({
|
|
|
41975
42134
|
const rowRailLeft = visibleBounds.left;
|
|
41976
42135
|
const showColumnRail = controlsVisible || addColumnVisible;
|
|
41977
42136
|
const showRowRail = controlsVisible || addRowVisible;
|
|
41978
|
-
return /* @__PURE__ */ (0,
|
|
41979
|
-
/* @__PURE__ */ (0,
|
|
42137
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(import_jsx_runtime97.Fragment, { children: [
|
|
42138
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
41980
42139
|
Tooltip,
|
|
41981
42140
|
{
|
|
41982
42141
|
placement: "right",
|
|
41983
|
-
content: /* @__PURE__ */ (0,
|
|
41984
|
-
children: /* @__PURE__ */ (0,
|
|
42142
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "text-xs font-medium", children: quickAddColumnLabel }),
|
|
42143
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
41985
42144
|
"button",
|
|
41986
42145
|
{
|
|
41987
42146
|
type: "button",
|
|
@@ -42008,17 +42167,17 @@ function TableAddRails({
|
|
|
42008
42167
|
transform: showColumnRail ? "scale(1)" : "scale(0.92)",
|
|
42009
42168
|
pointerEvents: showColumnRail ? "auto" : "none"
|
|
42010
42169
|
},
|
|
42011
|
-
children: /* @__PURE__ */ (0,
|
|
42170
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "text-sm font-medium leading-none", children: "+" })
|
|
42012
42171
|
}
|
|
42013
42172
|
)
|
|
42014
42173
|
}
|
|
42015
42174
|
),
|
|
42016
|
-
/* @__PURE__ */ (0,
|
|
42175
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
42017
42176
|
Tooltip,
|
|
42018
42177
|
{
|
|
42019
42178
|
placement: "bottom",
|
|
42020
|
-
content: /* @__PURE__ */ (0,
|
|
42021
|
-
children: /* @__PURE__ */ (0,
|
|
42179
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "text-xs font-medium", children: quickAddRowLabel }),
|
|
42180
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
42022
42181
|
"button",
|
|
42023
42182
|
{
|
|
42024
42183
|
type: "button",
|
|
@@ -42045,7 +42204,7 @@ function TableAddRails({
|
|
|
42045
42204
|
transform: showRowRail ? "scale(1)" : "scale(0.92)",
|
|
42046
42205
|
pointerEvents: showRowRail ? "auto" : "none"
|
|
42047
42206
|
},
|
|
42048
|
-
children: /* @__PURE__ */ (0,
|
|
42207
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "text-sm font-medium leading-none", children: "+" })
|
|
42049
42208
|
}
|
|
42050
42209
|
)
|
|
42051
42210
|
}
|
|
@@ -42055,7 +42214,7 @@ function TableAddRails({
|
|
|
42055
42214
|
|
|
42056
42215
|
// src/components/UEditor/table-control-menu.tsx
|
|
42057
42216
|
var import_lucide_react54 = require("lucide-react");
|
|
42058
|
-
var
|
|
42217
|
+
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
42059
42218
|
function TableControlMenu({
|
|
42060
42219
|
controlsVisible,
|
|
42061
42220
|
isOpen,
|
|
@@ -42067,7 +42226,7 @@ function TableControlMenu({
|
|
|
42067
42226
|
top
|
|
42068
42227
|
}) {
|
|
42069
42228
|
const shown = controlsVisible || menuVisible || isOpen;
|
|
42070
|
-
return /* @__PURE__ */ (0,
|
|
42229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
42071
42230
|
"div",
|
|
42072
42231
|
{
|
|
42073
42232
|
className: "absolute z-30",
|
|
@@ -42076,13 +42235,13 @@ function TableControlMenu({
|
|
|
42076
42235
|
top,
|
|
42077
42236
|
left
|
|
42078
42237
|
},
|
|
42079
|
-
children: /* @__PURE__ */ (0,
|
|
42238
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
42080
42239
|
Tooltip,
|
|
42081
42240
|
{
|
|
42082
42241
|
placement: "top",
|
|
42083
42242
|
disabled: isOpen,
|
|
42084
|
-
content: /* @__PURE__ */ (0,
|
|
42085
|
-
children: /* @__PURE__ */ (0,
|
|
42243
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { className: "text-xs font-medium", children: label }),
|
|
42244
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { className: "inline-flex", children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
42086
42245
|
DropdownMenu,
|
|
42087
42246
|
{
|
|
42088
42247
|
placement: "bottom-start",
|
|
@@ -42090,7 +42249,7 @@ function TableControlMenu({
|
|
|
42090
42249
|
onOpenChange,
|
|
42091
42250
|
contentClassName: "p-2",
|
|
42092
42251
|
items,
|
|
42093
|
-
trigger: /* @__PURE__ */ (0,
|
|
42252
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
42094
42253
|
"button",
|
|
42095
42254
|
{
|
|
42096
42255
|
type: "button",
|
|
@@ -42106,7 +42265,7 @@ function TableControlMenu({
|
|
|
42106
42265
|
transform: shown ? "scale(1)" : "scale(0.82)",
|
|
42107
42266
|
pointerEvents: shown ? "auto" : "none"
|
|
42108
42267
|
},
|
|
42109
|
-
children: /* @__PURE__ */ (0,
|
|
42268
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_lucide_react54.MoreHorizontal, { className: "h-4 w-4" })
|
|
42110
42269
|
}
|
|
42111
42270
|
)
|
|
42112
42271
|
}
|
|
@@ -42119,7 +42278,7 @@ function TableControlMenu({
|
|
|
42119
42278
|
|
|
42120
42279
|
// src/components/UEditor/table-axis-handles.tsx
|
|
42121
42280
|
var import_lucide_react55 = require("lucide-react");
|
|
42122
|
-
var
|
|
42281
|
+
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
42123
42282
|
var IDLE_HANDLE_SCALE = "0.78";
|
|
42124
42283
|
function TableRowHandles({
|
|
42125
42284
|
activeRowIndex,
|
|
@@ -42133,12 +42292,12 @@ function TableRowHandles({
|
|
|
42133
42292
|
rowHandleLeft,
|
|
42134
42293
|
rowHandles
|
|
42135
42294
|
}) {
|
|
42136
|
-
return /* @__PURE__ */ (0,
|
|
42295
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_jsx_runtime99.Fragment, { children: rowHandles.map((rowHandle) => {
|
|
42137
42296
|
const menuKey = `row:${rowHandle.index}`;
|
|
42138
42297
|
const isActive = rowHandle.index === activeRowIndex;
|
|
42139
42298
|
const visible = controlsVisible || hoverRowHandleIndex === rowHandle.index || openMenuKey === menuKey;
|
|
42140
42299
|
const isShown = visible || isActive;
|
|
42141
|
-
return /* @__PURE__ */ (0,
|
|
42300
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
42142
42301
|
"div",
|
|
42143
42302
|
{
|
|
42144
42303
|
className: "absolute z-30",
|
|
@@ -42147,13 +42306,13 @@ function TableRowHandles({
|
|
|
42147
42306
|
top: Math.max(8, rowHandle.center - 12),
|
|
42148
42307
|
left: rowHandleLeft
|
|
42149
42308
|
},
|
|
42150
|
-
children: /* @__PURE__ */ (0,
|
|
42309
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
42151
42310
|
Tooltip,
|
|
42152
42311
|
{
|
|
42153
42312
|
placement: "right",
|
|
42154
42313
|
disabled: openMenuKey === menuKey || !visible && isActive,
|
|
42155
|
-
content: /* @__PURE__ */ (0,
|
|
42156
|
-
children: /* @__PURE__ */ (0,
|
|
42314
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("span", { className: "text-xs font-medium", children: `${rowDragLabel} ${rowHandle.index + 1}` }),
|
|
42315
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("span", { className: "inline-flex", children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
42157
42316
|
DropdownMenu,
|
|
42158
42317
|
{
|
|
42159
42318
|
placement: "right",
|
|
@@ -42161,7 +42320,7 @@ function TableRowHandles({
|
|
|
42161
42320
|
onOpenChange: (open) => onOpenMenuChange(menuKey, open),
|
|
42162
42321
|
contentClassName: "p-2",
|
|
42163
42322
|
items: getMenuItems(rowHandle),
|
|
42164
|
-
trigger: /* @__PURE__ */ (0,
|
|
42323
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
42165
42324
|
"button",
|
|
42166
42325
|
{
|
|
42167
42326
|
type: "button",
|
|
@@ -42180,7 +42339,7 @@ function TableRowHandles({
|
|
|
42180
42339
|
transform: isShown ? "scale(1)" : `scale(${IDLE_HANDLE_SCALE})`,
|
|
42181
42340
|
pointerEvents: isShown ? "auto" : "none"
|
|
42182
42341
|
},
|
|
42183
|
-
children: visible ? /* @__PURE__ */ (0,
|
|
42342
|
+
children: visible ? /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_lucide_react55.GripVertical, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: "h-3 w-1 rounded-full bg-muted-foreground/50 hover:bg-muted-foreground" })
|
|
42184
42343
|
}
|
|
42185
42344
|
)
|
|
42186
42345
|
}
|
|
@@ -42204,12 +42363,12 @@ function TableColumnHandles({
|
|
|
42204
42363
|
onStartDrag,
|
|
42205
42364
|
openMenuKey
|
|
42206
42365
|
}) {
|
|
42207
|
-
return /* @__PURE__ */ (0,
|
|
42366
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_jsx_runtime99.Fragment, { children: columnHandles.map((columnHandle) => {
|
|
42208
42367
|
const menuKey = `column:${columnHandle.index}`;
|
|
42209
42368
|
const isActive = columnHandle.index === activeColumnIndex;
|
|
42210
42369
|
const visible = controlsVisible || hoverColumnHandleIndex === columnHandle.index || openMenuKey === menuKey;
|
|
42211
42370
|
const isShown = visible || isActive;
|
|
42212
|
-
return /* @__PURE__ */ (0,
|
|
42371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
42213
42372
|
"div",
|
|
42214
42373
|
{
|
|
42215
42374
|
className: "absolute z-30",
|
|
@@ -42218,13 +42377,13 @@ function TableColumnHandles({
|
|
|
42218
42377
|
top: columnHandleTop,
|
|
42219
42378
|
left: Math.max(8, columnHandle.center - 12)
|
|
42220
42379
|
},
|
|
42221
|
-
children: /* @__PURE__ */ (0,
|
|
42380
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
42222
42381
|
Tooltip,
|
|
42223
42382
|
{
|
|
42224
42383
|
placement: "top",
|
|
42225
42384
|
disabled: openMenuKey === menuKey || !visible && isActive,
|
|
42226
|
-
content: /* @__PURE__ */ (0,
|
|
42227
|
-
children: /* @__PURE__ */ (0,
|
|
42385
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("span", { className: "text-xs font-medium", children: `${columnDragLabel} ${columnHandle.index + 1}` }),
|
|
42386
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("span", { className: "inline-flex", children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
42228
42387
|
DropdownMenu,
|
|
42229
42388
|
{
|
|
42230
42389
|
placement: "bottom-start",
|
|
@@ -42232,7 +42391,7 @@ function TableColumnHandles({
|
|
|
42232
42391
|
onOpenChange: (open) => onOpenMenuChange(menuKey, open),
|
|
42233
42392
|
contentClassName: "p-2",
|
|
42234
42393
|
items: getMenuItems(columnHandle),
|
|
42235
|
-
trigger: /* @__PURE__ */ (0,
|
|
42394
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
42236
42395
|
"button",
|
|
42237
42396
|
{
|
|
42238
42397
|
type: "button",
|
|
@@ -42251,7 +42410,7 @@ function TableColumnHandles({
|
|
|
42251
42410
|
transform: isShown ? "scale(1)" : `scale(${IDLE_HANDLE_SCALE})`,
|
|
42252
42411
|
pointerEvents: isShown ? "auto" : "none"
|
|
42253
42412
|
},
|
|
42254
|
-
children: visible ? /* @__PURE__ */ (0,
|
|
42413
|
+
children: visible ? /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_lucide_react55.GripHorizontal, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: "h-1 w-3 rounded-full bg-muted-foreground/50 hover:bg-muted-foreground" })
|
|
42255
42414
|
}
|
|
42256
42415
|
)
|
|
42257
42416
|
}
|
|
@@ -42265,7 +42424,7 @@ function TableColumnHandles({
|
|
|
42265
42424
|
}
|
|
42266
42425
|
|
|
42267
42426
|
// src/components/UEditor/table-controls.tsx
|
|
42268
|
-
var
|
|
42427
|
+
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
42269
42428
|
var TABLE_MENU_TOP_OFFSET = 10;
|
|
42270
42429
|
function nearestIndex(centers, position) {
|
|
42271
42430
|
let bestIndex = 0;
|
|
@@ -42291,17 +42450,17 @@ function getSelectedCell(editor) {
|
|
|
42291
42450
|
}
|
|
42292
42451
|
function TableControls({ editor, containerRef }) {
|
|
42293
42452
|
const t = useSmartTranslations("UEditor");
|
|
42294
|
-
const [layout, setLayout] =
|
|
42295
|
-
const [dragPreview, setDragPreview] =
|
|
42296
|
-
const [hoverState, setHoverState] =
|
|
42297
|
-
const [openMenuKey, setOpenMenuKey] =
|
|
42298
|
-
const layoutRef =
|
|
42299
|
-
const dragStateRef =
|
|
42300
|
-
const syncFrameRef =
|
|
42301
|
-
|
|
42453
|
+
const [layout, setLayout] = import_react76.default.useState(null);
|
|
42454
|
+
const [dragPreview, setDragPreview] = import_react76.default.useState(null);
|
|
42455
|
+
const [hoverState, setHoverState] = import_react76.default.useState(DEFAULT_TABLE_HOVER_STATE);
|
|
42456
|
+
const [openMenuKey, setOpenMenuKey] = import_react76.default.useState(null);
|
|
42457
|
+
const layoutRef = import_react76.default.useRef(null);
|
|
42458
|
+
const dragStateRef = import_react76.default.useRef(null);
|
|
42459
|
+
const syncFrameRef = import_react76.default.useRef(null);
|
|
42460
|
+
import_react76.default.useEffect(() => {
|
|
42302
42461
|
layoutRef.current = layout;
|
|
42303
42462
|
}, [layout]);
|
|
42304
|
-
const syncFromCell =
|
|
42463
|
+
const syncFromCell = import_react76.default.useCallback((cell) => {
|
|
42305
42464
|
const surface = containerRef.current;
|
|
42306
42465
|
if (!surface || !cell) {
|
|
42307
42466
|
setLayout(null);
|
|
@@ -42309,23 +42468,23 @@ function TableControls({ editor, containerRef }) {
|
|
|
42309
42468
|
}
|
|
42310
42469
|
setLayout(buildTableControlLayout(editor, surface, cell));
|
|
42311
42470
|
}, [containerRef, editor]);
|
|
42312
|
-
const syncFromSelection =
|
|
42471
|
+
const syncFromSelection = import_react76.default.useCallback(() => {
|
|
42313
42472
|
syncFromCell(getSelectedCell(editor));
|
|
42314
42473
|
}, [editor, syncFromCell]);
|
|
42315
|
-
const scheduleSyncFromSelection =
|
|
42474
|
+
const scheduleSyncFromSelection = import_react76.default.useCallback(() => {
|
|
42316
42475
|
if (syncFrameRef.current !== null) return;
|
|
42317
42476
|
syncFrameRef.current = window.requestAnimationFrame(() => {
|
|
42318
42477
|
syncFrameRef.current = null;
|
|
42319
42478
|
syncFromSelection();
|
|
42320
42479
|
});
|
|
42321
42480
|
}, [syncFromSelection]);
|
|
42322
|
-
|
|
42481
|
+
import_react76.default.useEffect(() => () => {
|
|
42323
42482
|
if (syncFrameRef.current !== null) {
|
|
42324
42483
|
window.cancelAnimationFrame(syncFrameRef.current);
|
|
42325
42484
|
syncFrameRef.current = null;
|
|
42326
42485
|
}
|
|
42327
42486
|
}, []);
|
|
42328
|
-
const refreshCurrentLayout =
|
|
42487
|
+
const refreshCurrentLayout = import_react76.default.useCallback(() => {
|
|
42329
42488
|
setLayout((prev) => {
|
|
42330
42489
|
if (!prev) return prev;
|
|
42331
42490
|
const surface = containerRef.current;
|
|
@@ -42335,12 +42494,12 @@ function TableControls({ editor, containerRef }) {
|
|
|
42335
42494
|
return cell ? buildTableControlLayout(editor, surface, cell) : null;
|
|
42336
42495
|
});
|
|
42337
42496
|
}, [containerRef, editor]);
|
|
42338
|
-
const clearDrag =
|
|
42497
|
+
const clearDrag = import_react76.default.useCallback(() => {
|
|
42339
42498
|
dragStateRef.current = null;
|
|
42340
42499
|
setDragPreview(null);
|
|
42341
42500
|
document.body.style.cursor = "";
|
|
42342
42501
|
}, []);
|
|
42343
|
-
const updateHoverState =
|
|
42502
|
+
const updateHoverState = import_react76.default.useCallback((event) => {
|
|
42344
42503
|
const activeLayout = layoutRef.current;
|
|
42345
42504
|
const surface = containerRef.current;
|
|
42346
42505
|
if (!activeLayout || !surface || dragStateRef.current) {
|
|
@@ -42356,7 +42515,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42356
42515
|
return areTableHoverStatesEqual(prev, nextState) ? prev : nextState;
|
|
42357
42516
|
});
|
|
42358
42517
|
}, [containerRef]);
|
|
42359
|
-
|
|
42518
|
+
import_react76.default.useEffect(() => {
|
|
42360
42519
|
const proseMirror = editor.view.dom;
|
|
42361
42520
|
const surface = containerRef.current;
|
|
42362
42521
|
if (!surface) return void 0;
|
|
@@ -42407,37 +42566,37 @@ function TableControls({ editor, containerRef }) {
|
|
|
42407
42566
|
editor.off("update", refreshCurrentLayout);
|
|
42408
42567
|
};
|
|
42409
42568
|
}, [clearDrag, containerRef, editor, refreshCurrentLayout, syncFromCell, syncFromSelection, updateHoverState]);
|
|
42410
|
-
const runAtCellPos =
|
|
42569
|
+
const runAtCellPos = import_react76.default.useCallback((cellPos, command, options) => {
|
|
42411
42570
|
const result = runTableCommandAtCellPos(editor, cellPos, command);
|
|
42412
42571
|
if (options?.sync !== false) {
|
|
42413
42572
|
scheduleSyncFromSelection();
|
|
42414
42573
|
}
|
|
42415
42574
|
return result;
|
|
42416
42575
|
}, [editor, scheduleSyncFromSelection]);
|
|
42417
|
-
const runAtActiveCell =
|
|
42576
|
+
const runAtActiveCell = import_react76.default.useCallback((command, options) => {
|
|
42418
42577
|
return runAtCellPos(layoutRef.current?.cellPos ?? null, command, options);
|
|
42419
42578
|
}, [runAtCellPos]);
|
|
42420
|
-
const duplicateRowAt =
|
|
42579
|
+
const duplicateRowAt = import_react76.default.useCallback((rowIndex, cellPos) => {
|
|
42421
42580
|
const result = duplicateTableRowAt(editor, rowIndex, cellPos);
|
|
42422
42581
|
scheduleSyncFromSelection();
|
|
42423
42582
|
return result;
|
|
42424
42583
|
}, [editor, scheduleSyncFromSelection]);
|
|
42425
|
-
const clearRowAt =
|
|
42584
|
+
const clearRowAt = import_react76.default.useCallback((rowIndex, cellPos) => {
|
|
42426
42585
|
const result = clearTableRowAt(editor, rowIndex, cellPos);
|
|
42427
42586
|
scheduleSyncFromSelection();
|
|
42428
42587
|
return result;
|
|
42429
42588
|
}, [editor, scheduleSyncFromSelection]);
|
|
42430
|
-
const duplicateColumnAt =
|
|
42589
|
+
const duplicateColumnAt = import_react76.default.useCallback((columnIndex, cellPos) => {
|
|
42431
42590
|
const result = duplicateTableColumnAt(editor, columnIndex, cellPos);
|
|
42432
42591
|
scheduleSyncFromSelection();
|
|
42433
42592
|
return result;
|
|
42434
42593
|
}, [editor, scheduleSyncFromSelection]);
|
|
42435
|
-
const clearColumnAt =
|
|
42594
|
+
const clearColumnAt = import_react76.default.useCallback((columnIndex, cellPos) => {
|
|
42436
42595
|
const result = clearTableColumnAt(editor, columnIndex, cellPos);
|
|
42437
42596
|
scheduleSyncFromSelection();
|
|
42438
42597
|
return result;
|
|
42439
42598
|
}, [editor, scheduleSyncFromSelection]);
|
|
42440
|
-
const expandTableBy =
|
|
42599
|
+
const expandTableBy = import_react76.default.useCallback((rows, cols) => {
|
|
42441
42600
|
const activeCellPos = layoutRef.current?.cellPos ?? editor.state.selection.from;
|
|
42442
42601
|
const result = expandTableFromCell(editor, activeCellPos, rows, cols);
|
|
42443
42602
|
scheduleSyncFromSelection();
|
|
@@ -42446,19 +42605,19 @@ function TableControls({ editor, containerRef }) {
|
|
|
42446
42605
|
const canExpandTable = Boolean(layout);
|
|
42447
42606
|
const controlsVisible = dragPreview !== null;
|
|
42448
42607
|
const tableMenuOpen = openMenuKey === "table";
|
|
42449
|
-
const startAddColumnDrag =
|
|
42608
|
+
const startAddColumnDrag = import_react76.default.useCallback(() => {
|
|
42450
42609
|
setOpenMenuKey(null);
|
|
42451
42610
|
dragStateRef.current = { kind: "add-column", previewCols: 1 };
|
|
42452
42611
|
setDragPreview({ kind: "add-column", previewCols: 1 });
|
|
42453
42612
|
document.body.style.cursor = "ew-resize";
|
|
42454
42613
|
}, []);
|
|
42455
|
-
const startAddRowDrag =
|
|
42614
|
+
const startAddRowDrag = import_react76.default.useCallback(() => {
|
|
42456
42615
|
setOpenMenuKey(null);
|
|
42457
42616
|
dragStateRef.current = { kind: "add-row", previewRows: 1 };
|
|
42458
42617
|
setDragPreview({ kind: "add-row", previewRows: 1 });
|
|
42459
42618
|
document.body.style.cursor = "ns-resize";
|
|
42460
42619
|
}, []);
|
|
42461
|
-
const startRowDrag =
|
|
42620
|
+
const startRowDrag = import_react76.default.useCallback((rowHandle) => {
|
|
42462
42621
|
setOpenMenuKey(null);
|
|
42463
42622
|
dragStateRef.current = {
|
|
42464
42623
|
kind: "row",
|
|
@@ -42475,7 +42634,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42475
42634
|
});
|
|
42476
42635
|
document.body.style.cursor = "grabbing";
|
|
42477
42636
|
}, []);
|
|
42478
|
-
const startColumnDrag =
|
|
42637
|
+
const startColumnDrag = import_react76.default.useCallback((columnHandle) => {
|
|
42479
42638
|
setOpenMenuKey(null);
|
|
42480
42639
|
dragStateRef.current = {
|
|
42481
42640
|
kind: "column",
|
|
@@ -42492,7 +42651,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42492
42651
|
});
|
|
42493
42652
|
document.body.style.cursor = "grabbing";
|
|
42494
42653
|
}, []);
|
|
42495
|
-
|
|
42654
|
+
import_react76.default.useEffect(() => {
|
|
42496
42655
|
const handleMouseMove2 = (event) => {
|
|
42497
42656
|
const dragState = dragStateRef.current;
|
|
42498
42657
|
const activeLayout = layoutRef.current;
|
|
@@ -42581,7 +42740,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42581
42740
|
window.removeEventListener("blur", clearDrag);
|
|
42582
42741
|
};
|
|
42583
42742
|
}, [clearDrag, containerRef, editor, expandTableBy, scheduleSyncFromSelection]);
|
|
42584
|
-
const menuItems =
|
|
42743
|
+
const menuItems = import_react76.default.useMemo(() => {
|
|
42585
42744
|
if (!layout) return [];
|
|
42586
42745
|
return [
|
|
42587
42746
|
{
|
|
@@ -42649,7 +42808,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42649
42808
|
}
|
|
42650
42809
|
];
|
|
42651
42810
|
}, [editor, layout, runAtActiveCell, t]);
|
|
42652
|
-
const getRowHandleMenuItems =
|
|
42811
|
+
const getRowHandleMenuItems = import_react76.default.useCallback((rowHandle) => [
|
|
42653
42812
|
{
|
|
42654
42813
|
label: t("tableMenu.addRowBefore"),
|
|
42655
42814
|
icon: import_lucide_react56.ArrowUp,
|
|
@@ -42677,7 +42836,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42677
42836
|
destructive: true
|
|
42678
42837
|
}
|
|
42679
42838
|
], [clearRowAt, duplicateRowAt, runAtCellPos, t]);
|
|
42680
|
-
const getColumnHandleMenuItems =
|
|
42839
|
+
const getColumnHandleMenuItems = import_react76.default.useCallback((columnHandle) => [
|
|
42681
42840
|
{
|
|
42682
42841
|
label: t("tableMenu.addColumnBefore"),
|
|
42683
42842
|
icon: import_lucide_react56.ArrowLeft,
|
|
@@ -42712,8 +42871,8 @@ function TableControls({ editor, containerRef }) {
|
|
|
42712
42871
|
const menuLeft = Math.max(8, layout.tableLeft);
|
|
42713
42872
|
const rowHandleLeft = layout.tableLeft - 12;
|
|
42714
42873
|
const columnHandleTop = layout.tableTop - 12;
|
|
42715
|
-
return /* @__PURE__ */ (0,
|
|
42716
|
-
/* @__PURE__ */ (0,
|
|
42874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(import_jsx_runtime100.Fragment, { children: [
|
|
42875
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
42717
42876
|
TableRowHandles,
|
|
42718
42877
|
{
|
|
42719
42878
|
activeRowIndex: layout.activeRowIndex,
|
|
@@ -42730,7 +42889,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42730
42889
|
rowHandles: layout.rowHandles
|
|
42731
42890
|
}
|
|
42732
42891
|
),
|
|
42733
|
-
/* @__PURE__ */ (0,
|
|
42892
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
42734
42893
|
TableColumnHandles,
|
|
42735
42894
|
{
|
|
42736
42895
|
activeColumnIndex: layout.activeColumnIndex,
|
|
@@ -42747,7 +42906,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42747
42906
|
openMenuKey
|
|
42748
42907
|
}
|
|
42749
42908
|
),
|
|
42750
|
-
/* @__PURE__ */ (0,
|
|
42909
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
42751
42910
|
TableControlMenu,
|
|
42752
42911
|
{
|
|
42753
42912
|
controlsVisible,
|
|
@@ -42762,7 +42921,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42762
42921
|
top: menuTop
|
|
42763
42922
|
}
|
|
42764
42923
|
),
|
|
42765
|
-
/* @__PURE__ */ (0,
|
|
42924
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
42766
42925
|
TableAddRails,
|
|
42767
42926
|
{
|
|
42768
42927
|
addColumnVisible: hoverState.addColumnVisible,
|
|
@@ -42776,7 +42935,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42776
42935
|
quickAddRowLabel: t("tableMenu.quickAddRowAfter")
|
|
42777
42936
|
}
|
|
42778
42937
|
),
|
|
42779
|
-
/* @__PURE__ */ (0,
|
|
42938
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
42780
42939
|
TableDragPreview,
|
|
42781
42940
|
{
|
|
42782
42941
|
columnDragLabel: t("tableMenu.dragColumn"),
|
|
@@ -42994,10 +43153,10 @@ var UEDITOR_PROSEMIRROR_CLASS_NAME = cn(
|
|
|
42994
43153
|
);
|
|
42995
43154
|
|
|
42996
43155
|
// src/components/UEditor/use-table-interactions.ts
|
|
42997
|
-
var
|
|
43156
|
+
var import_react78 = __toESM(require("react"), 1);
|
|
42998
43157
|
|
|
42999
43158
|
// src/components/UEditor/use-table-row-resize.ts
|
|
43000
|
-
var
|
|
43159
|
+
var import_react77 = __toESM(require("react"), 1);
|
|
43001
43160
|
function useTableRowResize({
|
|
43002
43161
|
editor,
|
|
43003
43162
|
setHoveredTableCell,
|
|
@@ -43006,16 +43165,16 @@ function useTableRowResize({
|
|
|
43006
43165
|
clearAllTableResizeHover,
|
|
43007
43166
|
scheduleTableLayoutSync
|
|
43008
43167
|
}) {
|
|
43009
|
-
const stateRef = (0,
|
|
43010
|
-
const syncActiveGuide =
|
|
43168
|
+
const stateRef = (0, import_react77.useRef)(null);
|
|
43169
|
+
const syncActiveGuide = import_react77.default.useCallback(() => {
|
|
43011
43170
|
const state = stateRef.current;
|
|
43012
43171
|
if (!state) return false;
|
|
43013
43172
|
setHoveredTableCell(state.cellElement);
|
|
43014
43173
|
showRowGuide(state.tableElement, state.rowElement, state.cellElement, state.pendingHeight);
|
|
43015
43174
|
return true;
|
|
43016
43175
|
}, [setHoveredTableCell, showRowGuide]);
|
|
43017
|
-
const isResizing =
|
|
43018
|
-
const beginResize =
|
|
43176
|
+
const isResizing = import_react77.default.useCallback(() => stateRef.current !== null, []);
|
|
43177
|
+
const beginResize = import_react77.default.useCallback((event, table, row, cell) => {
|
|
43019
43178
|
if (!editor || !isRowResizeHotspot(cell, event.clientX, event.clientY)) {
|
|
43020
43179
|
return false;
|
|
43021
43180
|
}
|
|
@@ -43041,7 +43200,7 @@ function useTableRowResize({
|
|
|
43041
43200
|
event.stopPropagation();
|
|
43042
43201
|
return true;
|
|
43043
43202
|
}, [editor, setHoveredTableCell, showRowGuide]);
|
|
43044
|
-
const handlePointerMove =
|
|
43203
|
+
const handlePointerMove = import_react77.default.useCallback((event) => {
|
|
43045
43204
|
const state = stateRef.current;
|
|
43046
43205
|
if (!state) return;
|
|
43047
43206
|
const nextHeight = Math.max(
|
|
@@ -43058,7 +43217,7 @@ function useTableRowResize({
|
|
|
43058
43217
|
document.body.style.cursor = "row-resize";
|
|
43059
43218
|
showRowGuide(state.tableElement, state.rowElement, state.cellElement, nextHeight);
|
|
43060
43219
|
}, [showRowGuide]);
|
|
43061
|
-
const handlePointerUp =
|
|
43220
|
+
const handlePointerUp = import_react77.default.useCallback((event) => {
|
|
43062
43221
|
if (!editor) return;
|
|
43063
43222
|
const state = stateRef.current;
|
|
43064
43223
|
if (!state) return;
|
|
@@ -43082,7 +43241,7 @@ function useTableRowResize({
|
|
|
43082
43241
|
clearAllTableResizeHover();
|
|
43083
43242
|
scheduleTableLayoutSync();
|
|
43084
43243
|
}, [clearAllTableResizeHover, clearHoveredTableCell, editor, scheduleTableLayoutSync]);
|
|
43085
|
-
const cancelResize =
|
|
43244
|
+
const cancelResize = import_react77.default.useCallback(() => {
|
|
43086
43245
|
if (!stateRef.current) return;
|
|
43087
43246
|
stateRef.current = null;
|
|
43088
43247
|
document.body.style.cursor = "";
|
|
@@ -43090,7 +43249,7 @@ function useTableRowResize({
|
|
|
43090
43249
|
clearAllTableResizeHover();
|
|
43091
43250
|
scheduleTableLayoutSync();
|
|
43092
43251
|
}, [clearAllTableResizeHover, clearHoveredTableCell, scheduleTableLayoutSync]);
|
|
43093
|
-
const cleanup =
|
|
43252
|
+
const cleanup = import_react77.default.useCallback(() => {
|
|
43094
43253
|
stateRef.current = null;
|
|
43095
43254
|
document.body.style.cursor = "";
|
|
43096
43255
|
}, []);
|
|
@@ -43107,24 +43266,24 @@ function useTableRowResize({
|
|
|
43107
43266
|
|
|
43108
43267
|
// src/components/UEditor/use-table-interactions.ts
|
|
43109
43268
|
function useUEditorTableInteractions(editor, editable = true) {
|
|
43110
|
-
const editorContentRef = (0,
|
|
43111
|
-
const tableColumnGuideRef = (0,
|
|
43112
|
-
const tableRowGuideRef = (0,
|
|
43113
|
-
const activeTableCellHighlightRef = (0,
|
|
43114
|
-
const hoveredTableCellRef = (0,
|
|
43115
|
-
const activeTableCellRef = (0,
|
|
43116
|
-
const suppressActiveCellHighlightRef = (0,
|
|
43117
|
-
const tableLayoutSyncFrameRef = (0,
|
|
43118
|
-
const getProseMirrorElement =
|
|
43269
|
+
const editorContentRef = (0, import_react78.useRef)(null);
|
|
43270
|
+
const tableColumnGuideRef = (0, import_react78.useRef)(null);
|
|
43271
|
+
const tableRowGuideRef = (0, import_react78.useRef)(null);
|
|
43272
|
+
const activeTableCellHighlightRef = (0, import_react78.useRef)(null);
|
|
43273
|
+
const hoveredTableCellRef = (0, import_react78.useRef)(null);
|
|
43274
|
+
const activeTableCellRef = (0, import_react78.useRef)(null);
|
|
43275
|
+
const suppressActiveCellHighlightRef = (0, import_react78.useRef)(false);
|
|
43276
|
+
const tableLayoutSyncFrameRef = (0, import_react78.useRef)(null);
|
|
43277
|
+
const getProseMirrorElement = import_react78.default.useCallback(() => {
|
|
43119
43278
|
return editorContentRef.current?.querySelector(".ProseMirror");
|
|
43120
43279
|
}, []);
|
|
43121
|
-
const setEditorResizeCursor =
|
|
43280
|
+
const setEditorResizeCursor = import_react78.default.useCallback((cursor) => {
|
|
43122
43281
|
const proseMirror = getProseMirrorElement();
|
|
43123
43282
|
if (proseMirror) {
|
|
43124
43283
|
proseMirror.style.cursor = cursor;
|
|
43125
43284
|
}
|
|
43126
43285
|
}, [getProseMirrorElement]);
|
|
43127
|
-
const hideColumnGuide =
|
|
43286
|
+
const hideColumnGuide = import_react78.default.useCallback(() => {
|
|
43128
43287
|
editorContentRef.current?.classList.remove("resize-cursor");
|
|
43129
43288
|
getProseMirrorElement()?.classList.remove("resize-cursor");
|
|
43130
43289
|
const guide = tableColumnGuideRef.current;
|
|
@@ -43132,7 +43291,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
43132
43291
|
guide.style.opacity = "0";
|
|
43133
43292
|
}
|
|
43134
43293
|
}, [getProseMirrorElement]);
|
|
43135
|
-
const hideRowGuide =
|
|
43294
|
+
const hideRowGuide = import_react78.default.useCallback(() => {
|
|
43136
43295
|
editorContentRef.current?.classList.remove("resize-row-cursor");
|
|
43137
43296
|
getProseMirrorElement()?.classList.remove("resize-row-cursor");
|
|
43138
43297
|
const guide = tableRowGuideRef.current;
|
|
@@ -43140,12 +43299,12 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
43140
43299
|
guide.style.opacity = "0";
|
|
43141
43300
|
}
|
|
43142
43301
|
}, [getProseMirrorElement]);
|
|
43143
|
-
const clearAllTableResizeHover =
|
|
43302
|
+
const clearAllTableResizeHover = import_react78.default.useCallback(() => {
|
|
43144
43303
|
setEditorResizeCursor("");
|
|
43145
43304
|
hideColumnGuide();
|
|
43146
43305
|
hideRowGuide();
|
|
43147
43306
|
}, [hideColumnGuide, hideRowGuide, setEditorResizeCursor]);
|
|
43148
|
-
const updateActiveCellHighlight =
|
|
43307
|
+
const updateActiveCellHighlight = import_react78.default.useCallback((cell) => {
|
|
43149
43308
|
const surface = editorContentRef.current;
|
|
43150
43309
|
const highlight = activeTableCellHighlightRef.current;
|
|
43151
43310
|
if (!highlight) return;
|
|
@@ -43160,7 +43319,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
43160
43319
|
highlight.style.width = `${metrics.width}px`;
|
|
43161
43320
|
highlight.style.height = `${metrics.height}px`;
|
|
43162
43321
|
}, []);
|
|
43163
|
-
const scheduleTableLayoutSync =
|
|
43322
|
+
const scheduleTableLayoutSync = import_react78.default.useCallback(() => {
|
|
43164
43323
|
if (tableLayoutSyncFrameRef.current !== null) return;
|
|
43165
43324
|
tableLayoutSyncFrameRef.current = window.requestAnimationFrame(() => {
|
|
43166
43325
|
tableLayoutSyncFrameRef.current = null;
|
|
@@ -43168,7 +43327,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
43168
43327
|
editorContentRef.current?.dispatchEvent(new CustomEvent(UEDITOR_TABLE_LAYOUT_CHANGE_EVENT));
|
|
43169
43328
|
});
|
|
43170
43329
|
}, [updateActiveCellHighlight]);
|
|
43171
|
-
const setActiveTableCell =
|
|
43330
|
+
const setActiveTableCell = import_react78.default.useCallback((cell) => {
|
|
43172
43331
|
if (activeTableCellRef.current === cell) {
|
|
43173
43332
|
updateActiveCellHighlight(cell);
|
|
43174
43333
|
return;
|
|
@@ -43176,17 +43335,17 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
43176
43335
|
activeTableCellRef.current = cell;
|
|
43177
43336
|
updateActiveCellHighlight(activeTableCellRef.current);
|
|
43178
43337
|
}, [updateActiveCellHighlight]);
|
|
43179
|
-
const clearActiveTableCell =
|
|
43338
|
+
const clearActiveTableCell = import_react78.default.useCallback(() => {
|
|
43180
43339
|
activeTableCellRef.current = null;
|
|
43181
43340
|
updateActiveCellHighlight(null);
|
|
43182
43341
|
}, [updateActiveCellHighlight]);
|
|
43183
|
-
const setHoveredTableCell =
|
|
43342
|
+
const setHoveredTableCell = import_react78.default.useCallback((cell) => {
|
|
43184
43343
|
hoveredTableCellRef.current = cell;
|
|
43185
43344
|
}, []);
|
|
43186
|
-
const clearHoveredTableCell =
|
|
43345
|
+
const clearHoveredTableCell = import_react78.default.useCallback(() => {
|
|
43187
43346
|
hoveredTableCellRef.current = null;
|
|
43188
43347
|
}, []);
|
|
43189
|
-
const showColumnGuide =
|
|
43348
|
+
const showColumnGuide = import_react78.default.useCallback((table, row, cell) => {
|
|
43190
43349
|
const surface = editorContentRef.current;
|
|
43191
43350
|
const guide = tableColumnGuideRef.current;
|
|
43192
43351
|
if (!surface || !guide) return;
|
|
@@ -43200,7 +43359,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
43200
43359
|
getProseMirrorElement()?.classList.add("resize-cursor");
|
|
43201
43360
|
setEditorResizeCursor("col-resize");
|
|
43202
43361
|
}, [getProseMirrorElement, setEditorResizeCursor]);
|
|
43203
|
-
const showRowGuide =
|
|
43362
|
+
const showRowGuide = import_react78.default.useCallback((table, row, cell, previewHeight) => {
|
|
43204
43363
|
const surface = editorContentRef.current;
|
|
43205
43364
|
const guide = tableRowGuideRef.current;
|
|
43206
43365
|
if (!surface || !guide) return;
|
|
@@ -43232,7 +43391,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
43232
43391
|
clearAllTableResizeHover,
|
|
43233
43392
|
scheduleTableLayoutSync
|
|
43234
43393
|
});
|
|
43235
|
-
const syncActiveTableCellFromSelection =
|
|
43394
|
+
const syncActiveTableCellFromSelection = import_react78.default.useCallback(() => {
|
|
43236
43395
|
if (!editor) return;
|
|
43237
43396
|
if (!editor.isFocused) {
|
|
43238
43397
|
clearActiveTableCell();
|
|
@@ -43240,7 +43399,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
43240
43399
|
}
|
|
43241
43400
|
setActiveTableCell(getSelectionTableCell(editor.view));
|
|
43242
43401
|
}, [clearActiveTableCell, editor, setActiveTableCell]);
|
|
43243
|
-
(0,
|
|
43402
|
+
(0, import_react78.useEffect)(() => {
|
|
43244
43403
|
if (!editor || !editable) return void 0;
|
|
43245
43404
|
const proseMirror = editor.view.dom;
|
|
43246
43405
|
const surface = editorContentRef.current;
|
|
@@ -43415,7 +43574,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
43415
43574
|
}
|
|
43416
43575
|
|
|
43417
43576
|
// src/components/UEditor/use-formula-coordinate-overlay.ts
|
|
43418
|
-
var
|
|
43577
|
+
var import_react79 = require("react");
|
|
43419
43578
|
var import_tables9 = require("@tiptap/pm/tables");
|
|
43420
43579
|
|
|
43421
43580
|
// src/components/UEditor/table-formula-range-picker.ts
|
|
@@ -43685,8 +43844,8 @@ function createBlockedReferenceHighlight(label) {
|
|
|
43685
43844
|
return element;
|
|
43686
43845
|
}
|
|
43687
43846
|
function useFormulaCoordinateOverlay(editor, containerRef, labels) {
|
|
43688
|
-
const overlayRef = (0,
|
|
43689
|
-
(0,
|
|
43847
|
+
const overlayRef = (0, import_react79.useRef)(null);
|
|
43848
|
+
(0, import_react79.useEffect)(() => {
|
|
43690
43849
|
if (!editor) return void 0;
|
|
43691
43850
|
const overlay = overlayRef.current;
|
|
43692
43851
|
const container = containerRef.current;
|
|
@@ -43893,8 +44052,8 @@ function useFormulaCoordinateOverlay(editor, containerRef, labels) {
|
|
|
43893
44052
|
}
|
|
43894
44053
|
|
|
43895
44054
|
// src/components/UEditor/menu-bar.tsx
|
|
43896
|
-
var
|
|
43897
|
-
var
|
|
44055
|
+
var import_react80 = __toESM(require("react"), 1);
|
|
44056
|
+
var import_react81 = require("@tiptap/react");
|
|
43898
44057
|
var import_lucide_react57 = require("lucide-react");
|
|
43899
44058
|
|
|
43900
44059
|
// src/components/UEditor/preview-html.ts
|
|
@@ -44034,14 +44193,14 @@ function prepareUEditorPreviewHtml(html) {
|
|
|
44034
44193
|
}
|
|
44035
44194
|
|
|
44036
44195
|
// src/components/UEditor/menu-bar.tsx
|
|
44037
|
-
var
|
|
44196
|
+
var import_jsx_runtime101 = require("react/jsx-runtime");
|
|
44038
44197
|
function MenuTableInsertGrid({
|
|
44039
44198
|
insertLabel,
|
|
44040
44199
|
previewTemplate,
|
|
44041
44200
|
onInsert
|
|
44042
44201
|
}) {
|
|
44043
44202
|
const closeMenu = useDropdownMenuClose();
|
|
44044
|
-
return /* @__PURE__ */ (0,
|
|
44203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
44045
44204
|
TableInsertGrid,
|
|
44046
44205
|
{
|
|
44047
44206
|
insertLabel,
|
|
@@ -44057,9 +44216,9 @@ function renderMenuItems(items) {
|
|
|
44057
44216
|
return items.map((item, i) => {
|
|
44058
44217
|
switch (item.type) {
|
|
44059
44218
|
case "separator":
|
|
44060
|
-
return /* @__PURE__ */ (0,
|
|
44219
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(DropdownMenuSeparator, {}, i);
|
|
44061
44220
|
case "action":
|
|
44062
|
-
return /* @__PURE__ */ (0,
|
|
44221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
44063
44222
|
DropdownMenuItem,
|
|
44064
44223
|
{
|
|
44065
44224
|
label: item.label,
|
|
@@ -44073,9 +44232,9 @@ function renderMenuItems(items) {
|
|
|
44073
44232
|
i
|
|
44074
44233
|
);
|
|
44075
44234
|
case "sub":
|
|
44076
|
-
return /* @__PURE__ */ (0,
|
|
44235
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(DropdownMenuSub, { label: item.label, icon: item.icon, disabled: item.disabled, children: renderMenuItems(item.items) }, i);
|
|
44077
44236
|
case "custom":
|
|
44078
|
-
return /* @__PURE__ */ (0,
|
|
44237
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(import_react80.default.Fragment, { children: item.render() }, item.key);
|
|
44079
44238
|
}
|
|
44080
44239
|
});
|
|
44081
44240
|
}
|
|
@@ -44377,7 +44536,7 @@ function buildTableMenuItems(t, editor, onInsertTable) {
|
|
|
44377
44536
|
{
|
|
44378
44537
|
type: "custom",
|
|
44379
44538
|
key: "table-insert-grid",
|
|
44380
|
-
render: () => /* @__PURE__ */ (0,
|
|
44539
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
44381
44540
|
MenuTableInsertGrid,
|
|
44382
44541
|
{
|
|
44383
44542
|
insertLabel: t("tableMenu.insertTable"),
|
|
@@ -44451,8 +44610,8 @@ function buildTableMenuItems(t, editor, onInsertTable) {
|
|
|
44451
44610
|
}
|
|
44452
44611
|
];
|
|
44453
44612
|
}
|
|
44454
|
-
var MenuBarTrigger =
|
|
44455
|
-
({ children, className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
44613
|
+
var MenuBarTrigger = import_react80.default.forwardRef(
|
|
44614
|
+
({ children, className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
44456
44615
|
"button",
|
|
44457
44616
|
{
|
|
44458
44617
|
ref,
|
|
@@ -44483,18 +44642,18 @@ var MenuBar = ({
|
|
|
44483
44642
|
onPreview
|
|
44484
44643
|
}) => {
|
|
44485
44644
|
const t = useSmartTranslations("UEditor");
|
|
44486
|
-
(0,
|
|
44645
|
+
(0, import_react81.useEditorState)({
|
|
44487
44646
|
editor,
|
|
44488
44647
|
selector: ({ transactionNumber }) => transactionNumber
|
|
44489
44648
|
});
|
|
44490
|
-
const fileInputRef = (0,
|
|
44491
|
-
const [showImageInput, setShowImageInput] = (0,
|
|
44492
|
-
const [showLinkInput, setShowLinkInput] = (0,
|
|
44493
|
-
const [isInsertMenuOpen, setIsInsertMenuOpen] = (0,
|
|
44494
|
-
const [showSourceDialog, setShowSourceDialog] = (0,
|
|
44495
|
-
const [sourceHtml, setSourceHtml] = (0,
|
|
44496
|
-
const [showPreviewDialog, setShowPreviewDialog] = (0,
|
|
44497
|
-
const previewHtml = (0,
|
|
44649
|
+
const fileInputRef = (0, import_react80.useRef)(null);
|
|
44650
|
+
const [showImageInput, setShowImageInput] = (0, import_react80.useState)(false);
|
|
44651
|
+
const [showLinkInput, setShowLinkInput] = (0, import_react80.useState)(false);
|
|
44652
|
+
const [isInsertMenuOpen, setIsInsertMenuOpen] = (0, import_react80.useState)(false);
|
|
44653
|
+
const [showSourceDialog, setShowSourceDialog] = (0, import_react80.useState)(false);
|
|
44654
|
+
const [sourceHtml, setSourceHtml] = (0, import_react80.useState)("");
|
|
44655
|
+
const [showPreviewDialog, setShowPreviewDialog] = (0, import_react80.useState)(false);
|
|
44656
|
+
const previewHtml = (0, import_react80.useMemo)(
|
|
44498
44657
|
() => showPreviewDialog ? prepareUEditorPreviewHtml(editor.getHTML()) : "",
|
|
44499
44658
|
[editor, showPreviewDialog]
|
|
44500
44659
|
);
|
|
@@ -44555,9 +44714,9 @@ var MenuBar = ({
|
|
|
44555
44714
|
{
|
|
44556
44715
|
type: "custom",
|
|
44557
44716
|
key: "image",
|
|
44558
|
-
render: () => showImageInput ? /* @__PURE__ */ (0,
|
|
44559
|
-
/* @__PURE__ */ (0,
|
|
44560
|
-
/* @__PURE__ */ (0,
|
|
44717
|
+
render: () => showImageInput ? /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(ImageInput, { onSubmit: handleImageUrl, onCancel: () => setShowImageInput(false) }) : /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(import_jsx_runtime101.Fragment, { children: [
|
|
44718
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(DropdownMenuItem, { label: t("menubar.image"), icon: import_lucide_react57.Image, onClick: () => setShowImageInput(true), closeOnSelect: false }),
|
|
44719
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
44561
44720
|
DropdownMenuItem,
|
|
44562
44721
|
{
|
|
44563
44722
|
label: t("menubar.imageUpload"),
|
|
@@ -44572,7 +44731,7 @@ var MenuBar = ({
|
|
|
44572
44731
|
{
|
|
44573
44732
|
type: "custom",
|
|
44574
44733
|
key: "link",
|
|
44575
|
-
render: () => showLinkInput ? /* @__PURE__ */ (0,
|
|
44734
|
+
render: () => showLinkInput ? /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(LinkInput, { onSubmit: handleLinkSubmit, onCancel: () => setShowLinkInput(false), initialUrl: editor.getAttributes("link").href ?? "" }) : /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
44576
44735
|
DropdownMenuItem,
|
|
44577
44736
|
{
|
|
44578
44737
|
label: t("menubar.link"),
|
|
@@ -44592,7 +44751,7 @@ var MenuBar = ({
|
|
|
44592
44751
|
{
|
|
44593
44752
|
type: "custom",
|
|
44594
44753
|
key: "table-grid",
|
|
44595
|
-
render: () => /* @__PURE__ */ (0,
|
|
44754
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
44596
44755
|
MenuTableInsertGrid,
|
|
44597
44756
|
{
|
|
44598
44757
|
insertLabel: t("tableMenu.insertTable"),
|
|
@@ -44671,8 +44830,8 @@ var MenuBar = ({
|
|
|
44671
44830
|
},
|
|
44672
44831
|
{ label: t("menubar.table"), items: buildTableMenuItems(t, editor, handleInsertTable), open: void 0, onOpenChange: void 0 }
|
|
44673
44832
|
];
|
|
44674
|
-
return /* @__PURE__ */ (0,
|
|
44675
|
-
/* @__PURE__ */ (0,
|
|
44833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(import_jsx_runtime101.Fragment, { children: [
|
|
44834
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
44676
44835
|
"input",
|
|
44677
44836
|
{
|
|
44678
44837
|
ref: fileInputRef,
|
|
@@ -44683,11 +44842,11 @@ var MenuBar = ({
|
|
|
44683
44842
|
onChange: (e) => handleImageFiles(e.target.files)
|
|
44684
44843
|
}
|
|
44685
44844
|
),
|
|
44686
|
-
/* @__PURE__ */ (0,
|
|
44687
|
-
menus.map(({ label, items, open, onOpenChange }) => /* @__PURE__ */ (0,
|
|
44845
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: "flex items-center gap-0.5 border-b border-border/35 bg-muted/20 px-1.5 py-0.5", children: [
|
|
44846
|
+
menus.map(({ label, items, open, onOpenChange }) => /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
44688
44847
|
DropdownMenu,
|
|
44689
44848
|
{
|
|
44690
|
-
trigger: /* @__PURE__ */ (0,
|
|
44849
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(MenuBarTrigger, { children: label }),
|
|
44691
44850
|
placement: "bottom-start",
|
|
44692
44851
|
isOpen: open,
|
|
44693
44852
|
onOpenChange,
|
|
@@ -44695,7 +44854,7 @@ var MenuBar = ({
|
|
|
44695
44854
|
},
|
|
44696
44855
|
label
|
|
44697
44856
|
)),
|
|
44698
|
-
/* @__PURE__ */ (0,
|
|
44857
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
44699
44858
|
"button",
|
|
44700
44859
|
{
|
|
44701
44860
|
type: "button",
|
|
@@ -44706,20 +44865,20 @@ var MenuBar = ({
|
|
|
44706
44865
|
"ml-auto inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors",
|
|
44707
44866
|
"hover:bg-accent hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1"
|
|
44708
44867
|
),
|
|
44709
|
-
children: /* @__PURE__ */ (0,
|
|
44868
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(import_lucide_react57.Eye, { className: "h-4 w-4", "aria-hidden": "true" })
|
|
44710
44869
|
}
|
|
44711
44870
|
)
|
|
44712
44871
|
] }),
|
|
44713
|
-
/* @__PURE__ */ (0,
|
|
44872
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
44714
44873
|
Modal_default,
|
|
44715
44874
|
{
|
|
44716
44875
|
isOpen: showSourceDialog,
|
|
44717
44876
|
onClose: () => setShowSourceDialog(false),
|
|
44718
44877
|
title: t("menubar.sourceCode"),
|
|
44719
44878
|
size: "lg",
|
|
44720
|
-
children: /* @__PURE__ */ (0,
|
|
44721
|
-
/* @__PURE__ */ (0,
|
|
44722
|
-
/* @__PURE__ */ (0,
|
|
44879
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: "space-y-3", children: [
|
|
44880
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("p", { className: "text-xs text-muted-foreground", children: t("menubar.sourceCodeHint") }),
|
|
44881
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
44723
44882
|
"textarea",
|
|
44724
44883
|
{
|
|
44725
44884
|
"data-testid": "source-code-textarea",
|
|
@@ -44729,8 +44888,8 @@ var MenuBar = ({
|
|
|
44729
44888
|
spellCheck: false
|
|
44730
44889
|
}
|
|
44731
44890
|
),
|
|
44732
|
-
/* @__PURE__ */ (0,
|
|
44733
|
-
/* @__PURE__ */ (0,
|
|
44891
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: "flex gap-2 justify-end", children: [
|
|
44892
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
44734
44893
|
"button",
|
|
44735
44894
|
{
|
|
44736
44895
|
type: "button",
|
|
@@ -44739,7 +44898,7 @@ var MenuBar = ({
|
|
|
44739
44898
|
children: t("menubar.applySource")
|
|
44740
44899
|
}
|
|
44741
44900
|
),
|
|
44742
|
-
/* @__PURE__ */ (0,
|
|
44901
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
44743
44902
|
"button",
|
|
44744
44903
|
{
|
|
44745
44904
|
type: "button",
|
|
@@ -44752,7 +44911,7 @@ var MenuBar = ({
|
|
|
44752
44911
|
] })
|
|
44753
44912
|
}
|
|
44754
44913
|
),
|
|
44755
|
-
/* @__PURE__ */ (0,
|
|
44914
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
44756
44915
|
Modal_default,
|
|
44757
44916
|
{
|
|
44758
44917
|
isOpen: showPreviewDialog,
|
|
@@ -44763,12 +44922,12 @@ var MenuBar = ({
|
|
|
44763
44922
|
height: "min(860px, calc(100vh - 2rem))",
|
|
44764
44923
|
className: "flex flex-col overflow-hidden rounded-xl md:rounded-2xl",
|
|
44765
44924
|
contentClassName: "flex min-h-0 flex-1 overflow-hidden p-0",
|
|
44766
|
-
children: /* @__PURE__ */ (0,
|
|
44925
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
44767
44926
|
"div",
|
|
44768
44927
|
{
|
|
44769
44928
|
"data-testid": "preview-content",
|
|
44770
44929
|
className: "min-h-0 flex-1 overflow-y-auto overscroll-contain",
|
|
44771
|
-
children: editor.isEmpty ? /* @__PURE__ */ (0,
|
|
44930
|
+
children: editor.isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("p", { className: "text-muted-foreground text-sm", children: t("menubar.previewEmpty") }) : /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
44772
44931
|
"div",
|
|
44773
44932
|
{
|
|
44774
44933
|
className: UEDITOR_PROSEMIRROR_CLASS_NAME,
|
|
@@ -44783,20 +44942,20 @@ var MenuBar = ({
|
|
|
44783
44942
|
};
|
|
44784
44943
|
|
|
44785
44944
|
// src/components/UEditor/table-formula-bar.tsx
|
|
44786
|
-
var
|
|
44787
|
-
var
|
|
44945
|
+
var import_react82 = require("react");
|
|
44946
|
+
var import_react83 = require("@tiptap/react");
|
|
44788
44947
|
var import_lucide_react58 = require("lucide-react");
|
|
44789
|
-
var
|
|
44948
|
+
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
44790
44949
|
function TableFormulaBar({ editor }) {
|
|
44791
44950
|
const t = useSmartTranslations("UEditor");
|
|
44792
|
-
const inputRef = (0,
|
|
44793
|
-
const [draftState, setDraftState] = (0,
|
|
44794
|
-
(0,
|
|
44951
|
+
const inputRef = (0, import_react82.useRef)(null);
|
|
44952
|
+
const [draftState, setDraftState] = (0, import_react82.useState)(null);
|
|
44953
|
+
(0, import_react83.useEditorState)({
|
|
44795
44954
|
editor,
|
|
44796
44955
|
selector: ({ transactionNumber }) => transactionNumber
|
|
44797
44956
|
});
|
|
44798
44957
|
const selectedCell = getSelectedTableFormulaCell(editor);
|
|
44799
|
-
(0,
|
|
44958
|
+
(0, import_react82.useEffect)(() => {
|
|
44800
44959
|
const focusFormulaInput = () => {
|
|
44801
44960
|
inputRef.current?.focus();
|
|
44802
44961
|
};
|
|
@@ -44836,7 +44995,7 @@ function TableFormulaBar({ editor }) {
|
|
|
44836
44995
|
if (!editor.isDestroyed) editor.commands.focus();
|
|
44837
44996
|
}, 0);
|
|
44838
44997
|
};
|
|
44839
|
-
return /* @__PURE__ */ (0,
|
|
44998
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)(
|
|
44840
44999
|
"div",
|
|
44841
45000
|
{
|
|
44842
45001
|
"data-ueditor-formula-bar": "",
|
|
@@ -44844,7 +45003,7 @@ function TableFormulaBar({ editor }) {
|
|
|
44844
45003
|
"aria-label": t("tableMenu.formulaBar"),
|
|
44845
45004
|
className: "flex min-h-10 items-center gap-2 border-b border-border/60 bg-muted/25 px-2 py-1.5",
|
|
44846
45005
|
children: [
|
|
44847
|
-
/* @__PURE__ */ (0,
|
|
45006
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
44848
45007
|
"span",
|
|
44849
45008
|
{
|
|
44850
45009
|
"data-ueditor-formula-cell-label": "",
|
|
@@ -44852,8 +45011,8 @@ function TableFormulaBar({ editor }) {
|
|
|
44852
45011
|
children: selectedCell.label
|
|
44853
45012
|
}
|
|
44854
45013
|
),
|
|
44855
|
-
/* @__PURE__ */ (0,
|
|
44856
|
-
/* @__PURE__ */ (0,
|
|
45014
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_lucide_react58.Sigma, { "aria-hidden": "true", className: "h-4 w-4 shrink-0 text-primary" }),
|
|
45015
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
44857
45016
|
"input",
|
|
44858
45017
|
{
|
|
44859
45018
|
ref: inputRef,
|
|
@@ -44874,18 +45033,18 @@ function TableFormulaBar({ editor }) {
|
|
|
44874
45033
|
className: "h-7 min-w-0 flex-1 rounded-md border border-border/60 bg-background px-2 font-mono text-sm text-foreground outline-none focus:border-primary/40 focus:ring-2 focus:ring-primary/15"
|
|
44875
45034
|
}
|
|
44876
45035
|
),
|
|
44877
|
-
selectedCell.formulaState === "error" && /* @__PURE__ */ (0,
|
|
45036
|
+
selectedCell.formulaState === "error" && /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)(
|
|
44878
45037
|
"span",
|
|
44879
45038
|
{
|
|
44880
45039
|
role: "status",
|
|
44881
45040
|
className: "hidden shrink-0 items-center gap-1 text-xs font-medium text-destructive sm:inline-flex",
|
|
44882
45041
|
children: [
|
|
44883
|
-
/* @__PURE__ */ (0,
|
|
45042
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_lucide_react58.AlertCircle, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
|
|
44884
45043
|
t("tableMenu.formulaError")
|
|
44885
45044
|
]
|
|
44886
45045
|
}
|
|
44887
45046
|
),
|
|
44888
|
-
/* @__PURE__ */ (0,
|
|
45047
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
44889
45048
|
"button",
|
|
44890
45049
|
{
|
|
44891
45050
|
type: "button",
|
|
@@ -44893,10 +45052,10 @@ function TableFormulaBar({ editor }) {
|
|
|
44893
45052
|
"aria-label": t("tableMenu.apply"),
|
|
44894
45053
|
title: t("tableMenu.apply"),
|
|
44895
45054
|
className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-primary text-primary-foreground transition-colors hover:bg-primary/90",
|
|
44896
|
-
children: /* @__PURE__ */ (0,
|
|
45055
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_lucide_react58.Check, { "aria-hidden": "true", className: "h-4 w-4" })
|
|
44897
45056
|
}
|
|
44898
45057
|
),
|
|
44899
|
-
/* @__PURE__ */ (0,
|
|
45058
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
44900
45059
|
"button",
|
|
44901
45060
|
{
|
|
44902
45061
|
type: "button",
|
|
@@ -44907,10 +45066,10 @@ function TableFormulaBar({ editor }) {
|
|
|
44907
45066
|
"aria-label": t("tableMenu.convertToValue"),
|
|
44908
45067
|
title: t("tableMenu.convertToValue"),
|
|
44909
45068
|
className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-border/60 bg-background text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",
|
|
44910
|
-
children: /* @__PURE__ */ (0,
|
|
45069
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_lucide_react58.Hash, { "aria-hidden": "true", className: "h-4 w-4" })
|
|
44911
45070
|
}
|
|
44912
45071
|
),
|
|
44913
|
-
/* @__PURE__ */ (0,
|
|
45072
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
44914
45073
|
"button",
|
|
44915
45074
|
{
|
|
44916
45075
|
type: "button",
|
|
@@ -44921,7 +45080,7 @@ function TableFormulaBar({ editor }) {
|
|
|
44921
45080
|
"aria-label": t("tableMenu.clearCell"),
|
|
44922
45081
|
title: t("tableMenu.clearCell"),
|
|
44923
45082
|
className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-destructive/30 bg-background text-destructive transition-colors hover:bg-destructive/10",
|
|
44924
|
-
children: /* @__PURE__ */ (0,
|
|
45083
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_lucide_react58.Trash2, { "aria-hidden": "true", className: "h-4 w-4" })
|
|
44925
45084
|
}
|
|
44926
45085
|
)
|
|
44927
45086
|
]
|
|
@@ -44930,8 +45089,8 @@ function TableFormulaBar({ editor }) {
|
|
|
44930
45089
|
}
|
|
44931
45090
|
|
|
44932
45091
|
// src/components/UEditor/UEditor.tsx
|
|
44933
|
-
var
|
|
44934
|
-
var UEditor =
|
|
45092
|
+
var import_jsx_runtime103 = require("react/jsx-runtime");
|
|
45093
|
+
var UEditor = import_react84.default.forwardRef(({
|
|
44935
45094
|
content = "",
|
|
44936
45095
|
onChange,
|
|
44937
45096
|
onHtmlChange,
|
|
@@ -44973,14 +45132,14 @@ var UEditor = import_react83.default.forwardRef(({
|
|
|
44973
45132
|
}, ref) => {
|
|
44974
45133
|
const t = useSmartTranslations("UEditor");
|
|
44975
45134
|
const effectivePlaceholder = placeholder ?? t("placeholder");
|
|
44976
|
-
const inFlightPrepareRef = (0,
|
|
44977
|
-
const lastAppliedContentRef = (0,
|
|
44978
|
-
const scheduledFormulaRecalculateRef = (0,
|
|
44979
|
-
const editorInstanceRef = (0,
|
|
44980
|
-
const formulaRangePickRef = (0,
|
|
44981
|
-
const formulaRangeSurfaceRef = (0,
|
|
44982
|
-
const [formulaRangeHighlight, setFormulaRangeHighlight] =
|
|
44983
|
-
const scheduleFormulaRecalculate =
|
|
45135
|
+
const inFlightPrepareRef = (0, import_react84.useRef)(null);
|
|
45136
|
+
const lastAppliedContentRef = (0, import_react84.useRef)(content ?? "");
|
|
45137
|
+
const scheduledFormulaRecalculateRef = (0, import_react84.useRef)(false);
|
|
45138
|
+
const editorInstanceRef = (0, import_react84.useRef)(null);
|
|
45139
|
+
const formulaRangePickRef = (0, import_react84.useRef)(null);
|
|
45140
|
+
const formulaRangeSurfaceRef = (0, import_react84.useRef)(null);
|
|
45141
|
+
const [formulaRangeHighlight, setFormulaRangeHighlight] = import_react84.default.useState(null);
|
|
45142
|
+
const scheduleFormulaRecalculate = import_react84.default.useCallback((editor2, options) => {
|
|
44984
45143
|
if (editor2.isDestroyed || scheduledFormulaRecalculateRef.current) return;
|
|
44985
45144
|
if (!options?.force && isEditingTableFormulaText(editor2)) return;
|
|
44986
45145
|
scheduledFormulaRecalculateRef.current = true;
|
|
@@ -44991,7 +45150,7 @@ var UEditor = import_react83.default.forwardRef(({
|
|
|
44991
45150
|
}
|
|
44992
45151
|
});
|
|
44993
45152
|
}, []);
|
|
44994
|
-
const resolvedUploadFile = (0,
|
|
45153
|
+
const resolvedUploadFile = (0, import_react84.useMemo)(() => {
|
|
44995
45154
|
if (uploadFile) return uploadFile;
|
|
44996
45155
|
if (uploadFileForSave) {
|
|
44997
45156
|
return async (file) => {
|
|
@@ -45001,7 +45160,7 @@ var UEditor = import_react83.default.forwardRef(({
|
|
|
45001
45160
|
}
|
|
45002
45161
|
return uploadImage;
|
|
45003
45162
|
}, [uploadFile, uploadFileForSave, uploadImage]);
|
|
45004
|
-
const extensions = (0,
|
|
45163
|
+
const extensions = (0, import_react84.useMemo)(
|
|
45005
45164
|
() => [
|
|
45006
45165
|
...buildUEditorExtensions({
|
|
45007
45166
|
placeholder: effectivePlaceholder,
|
|
@@ -45020,11 +45179,11 @@ var UEditor = import_react83.default.forwardRef(({
|
|
|
45020
45179
|
],
|
|
45021
45180
|
[effectivePlaceholder, t, maxCharacters, uploadImage, resolvedUploadFile, imageInsertMode, maxImageFileSize, allowedImageMimeTypes, fallbackToDataUrl, editable, fetchMetadata, extraExtensions]
|
|
45022
45181
|
);
|
|
45023
|
-
const syncFormulaRangeHighlight =
|
|
45182
|
+
const syncFormulaRangeHighlight = import_react84.default.useCallback((pickState) => {
|
|
45024
45183
|
const container = formulaRangeSurfaceRef.current;
|
|
45025
45184
|
setFormulaRangeHighlight(container && pickState ? getFormulaRangePickHighlight(container, pickState) : null);
|
|
45026
45185
|
}, []);
|
|
45027
|
-
const editor = (0,
|
|
45186
|
+
const editor = (0, import_react85.useEditor)({
|
|
45028
45187
|
immediatelyRender: false,
|
|
45029
45188
|
extensions,
|
|
45030
45189
|
content,
|
|
@@ -45130,7 +45289,7 @@ var UEditor = import_react83.default.forwardRef(({
|
|
|
45130
45289
|
scheduleFormulaRecalculate(editor2, { force: true });
|
|
45131
45290
|
}
|
|
45132
45291
|
});
|
|
45133
|
-
(0,
|
|
45292
|
+
(0, import_react84.useEffect)(() => {
|
|
45134
45293
|
editorInstanceRef.current = editor;
|
|
45135
45294
|
return () => {
|
|
45136
45295
|
if (editorInstanceRef.current === editor) editorInstanceRef.current = null;
|
|
@@ -45146,7 +45305,7 @@ var UEditor = import_react83.default.forwardRef(({
|
|
|
45146
45305
|
apply: t("tableMenu.apply"),
|
|
45147
45306
|
cancel: t("imageInput.cancelBtn")
|
|
45148
45307
|
});
|
|
45149
|
-
(0,
|
|
45308
|
+
(0, import_react84.useImperativeHandle)(
|
|
45150
45309
|
ref,
|
|
45151
45310
|
() => ({
|
|
45152
45311
|
editor,
|
|
@@ -45171,7 +45330,7 @@ var UEditor = import_react83.default.forwardRef(({
|
|
|
45171
45330
|
}),
|
|
45172
45331
|
[content, editor, uploadImageForSave, uploadFileForSave, uploadImageConcurrency]
|
|
45173
45332
|
);
|
|
45174
|
-
(0,
|
|
45333
|
+
(0, import_react84.useEffect)(() => {
|
|
45175
45334
|
if (!editor) return;
|
|
45176
45335
|
queueMicrotask(() => {
|
|
45177
45336
|
if (!editor.isDestroyed) {
|
|
@@ -45179,7 +45338,7 @@ var UEditor = import_react83.default.forwardRef(({
|
|
|
45179
45338
|
}
|
|
45180
45339
|
});
|
|
45181
45340
|
}, [editor]);
|
|
45182
|
-
(0,
|
|
45341
|
+
(0, import_react84.useEffect)(() => {
|
|
45183
45342
|
if (!editor) return;
|
|
45184
45343
|
const nextContent = content ?? "";
|
|
45185
45344
|
if (lastAppliedContentRef.current === nextContent) return;
|
|
@@ -45198,7 +45357,7 @@ var UEditor = import_react83.default.forwardRef(({
|
|
|
45198
45357
|
}
|
|
45199
45358
|
}, [content, editor]);
|
|
45200
45359
|
if (!editor) {
|
|
45201
|
-
return /* @__PURE__ */ (0,
|
|
45360
|
+
return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
45202
45361
|
"div",
|
|
45203
45362
|
{
|
|
45204
45363
|
className: cn("w-full border bg-background flex items-center justify-center text-muted-foreground", className),
|
|
@@ -45207,7 +45366,7 @@ var UEditor = import_react83.default.forwardRef(({
|
|
|
45207
45366
|
}
|
|
45208
45367
|
);
|
|
45209
45368
|
}
|
|
45210
|
-
return /* @__PURE__ */ (0,
|
|
45369
|
+
return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(
|
|
45211
45370
|
"div",
|
|
45212
45371
|
{
|
|
45213
45372
|
className: cn(
|
|
@@ -45223,7 +45382,7 @@ var UEditor = import_react83.default.forwardRef(({
|
|
|
45223
45382
|
className
|
|
45224
45383
|
),
|
|
45225
45384
|
children: [
|
|
45226
|
-
editable && showMenuBar && /* @__PURE__ */ (0,
|
|
45385
|
+
editable && showMenuBar && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
45227
45386
|
MenuBar,
|
|
45228
45387
|
{
|
|
45229
45388
|
editor,
|
|
@@ -45238,7 +45397,7 @@ var UEditor = import_react83.default.forwardRef(({
|
|
|
45238
45397
|
onPreview
|
|
45239
45398
|
}
|
|
45240
45399
|
),
|
|
45241
|
-
editable && showToolbar && /* @__PURE__ */ (0,
|
|
45400
|
+
editable && showToolbar && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
45242
45401
|
EditorToolbar,
|
|
45243
45402
|
{
|
|
45244
45403
|
editor,
|
|
@@ -45253,8 +45412,8 @@ var UEditor = import_react83.default.forwardRef(({
|
|
|
45253
45412
|
letterSpacings
|
|
45254
45413
|
}
|
|
45255
45414
|
),
|
|
45256
|
-
editable && /* @__PURE__ */ (0,
|
|
45257
|
-
editable && showBubbleMenu && /* @__PURE__ */ (0,
|
|
45415
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(TableFormulaBar, { editor }),
|
|
45416
|
+
editable && showBubbleMenu && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
45258
45417
|
CustomBubbleMenu,
|
|
45259
45418
|
{
|
|
45260
45419
|
editor,
|
|
@@ -45262,8 +45421,8 @@ var UEditor = import_react83.default.forwardRef(({
|
|
|
45262
45421
|
lineHeights
|
|
45263
45422
|
}
|
|
45264
45423
|
),
|
|
45265
|
-
editable && showFloatingMenu && /* @__PURE__ */ (0,
|
|
45266
|
-
/* @__PURE__ */ (0,
|
|
45424
|
+
editable && showFloatingMenu && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(CustomFloatingMenu, { editor }),
|
|
45425
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(
|
|
45267
45426
|
"div",
|
|
45268
45427
|
{
|
|
45269
45428
|
ref: (node) => {
|
|
@@ -45276,7 +45435,7 @@ var UEditor = import_react83.default.forwardRef(({
|
|
|
45276
45435
|
maxHeight
|
|
45277
45436
|
},
|
|
45278
45437
|
children: [
|
|
45279
|
-
/* @__PURE__ */ (0,
|
|
45438
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
45280
45439
|
"span",
|
|
45281
45440
|
{
|
|
45282
45441
|
ref: tableColumnGuideRef,
|
|
@@ -45284,7 +45443,7 @@ var UEditor = import_react83.default.forwardRef(({
|
|
|
45284
45443
|
className: "pointer-events-none absolute z-20 bg-primary opacity-0 transition-opacity duration-100"
|
|
45285
45444
|
}
|
|
45286
45445
|
),
|
|
45287
|
-
/* @__PURE__ */ (0,
|
|
45446
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
45288
45447
|
"span",
|
|
45289
45448
|
{
|
|
45290
45449
|
ref: tableRowGuideRef,
|
|
@@ -45292,7 +45451,7 @@ var UEditor = import_react83.default.forwardRef(({
|
|
|
45292
45451
|
className: "pointer-events-none absolute z-20 bg-primary opacity-0 transition-opacity duration-100"
|
|
45293
45452
|
}
|
|
45294
45453
|
),
|
|
45295
|
-
/* @__PURE__ */ (0,
|
|
45454
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
45296
45455
|
"span",
|
|
45297
45456
|
{
|
|
45298
45457
|
ref: activeTableCellHighlightRef,
|
|
@@ -45301,7 +45460,7 @@ var UEditor = import_react83.default.forwardRef(({
|
|
|
45301
45460
|
className: "pointer-events-none hidden absolute z-20 rounded-[2px] border-2 border-primary bg-primary/10"
|
|
45302
45461
|
}
|
|
45303
45462
|
),
|
|
45304
|
-
/* @__PURE__ */ (0,
|
|
45463
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
45305
45464
|
"div",
|
|
45306
45465
|
{
|
|
45307
45466
|
ref: formulaCoordinateOverlayRef,
|
|
@@ -45309,7 +45468,7 @@ var UEditor = import_react83.default.forwardRef(({
|
|
|
45309
45468
|
className: "pointer-events-none absolute inset-0 z-[35] hidden overflow-visible"
|
|
45310
45469
|
}
|
|
45311
45470
|
),
|
|
45312
|
-
formulaRangeHighlight && /* @__PURE__ */ (0,
|
|
45471
|
+
formulaRangeHighlight && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
45313
45472
|
"span",
|
|
45314
45473
|
{
|
|
45315
45474
|
"aria-hidden": "true",
|
|
@@ -45327,9 +45486,9 @@ var UEditor = import_react83.default.forwardRef(({
|
|
|
45327
45486
|
}
|
|
45328
45487
|
}
|
|
45329
45488
|
),
|
|
45330
|
-
editable && /* @__PURE__ */ (0,
|
|
45331
|
-
/* @__PURE__ */ (0,
|
|
45332
|
-
|
|
45489
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(TableControls, { editor, containerRef: editorContentRef }),
|
|
45490
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
45491
|
+
import_react85.EditorContent,
|
|
45333
45492
|
{
|
|
45334
45493
|
editor,
|
|
45335
45494
|
className: "min-h-full"
|
|
@@ -45338,7 +45497,7 @@ var UEditor = import_react83.default.forwardRef(({
|
|
|
45338
45497
|
]
|
|
45339
45498
|
}
|
|
45340
45499
|
),
|
|
45341
|
-
showFooter && showCharacterCount && /* @__PURE__ */ (0,
|
|
45500
|
+
showFooter && showCharacterCount && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(CharacterCountDisplay, { editor, maxCharacters })
|
|
45342
45501
|
]
|
|
45343
45502
|
}
|
|
45344
45503
|
);
|