@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.js
CHANGED
|
@@ -27824,7 +27824,7 @@ function useLocale2() {
|
|
|
27824
27824
|
}
|
|
27825
27825
|
|
|
27826
27826
|
// src/components/UEditor/UEditor.tsx
|
|
27827
|
-
import
|
|
27827
|
+
import React91, { useEffect as useEffect42, useImperativeHandle as useImperativeHandle4, useMemo as useMemo27, useRef as useRef41 } from "react";
|
|
27828
27828
|
import { useEditor, EditorContent } from "@tiptap/react";
|
|
27829
27829
|
|
|
27830
27830
|
// src/components/UEditor/extensions.ts
|
|
@@ -32459,7 +32459,7 @@ function buildUEditorExtensions({
|
|
|
32459
32459
|
}
|
|
32460
32460
|
|
|
32461
32461
|
// src/components/UEditor/toolbar.tsx
|
|
32462
|
-
import
|
|
32462
|
+
import React84, { useRef as useRef34, useState as useState50 } from "react";
|
|
32463
32463
|
import { useEditorState } from "@tiptap/react";
|
|
32464
32464
|
import {
|
|
32465
32465
|
AlignCenter,
|
|
@@ -32470,35 +32470,23 @@ import {
|
|
|
32470
32470
|
ArrowLeft,
|
|
32471
32471
|
ArrowRight,
|
|
32472
32472
|
ArrowUp,
|
|
32473
|
-
Bold as BoldIcon,
|
|
32474
32473
|
ChevronDown as ChevronDown8,
|
|
32475
|
-
ChevronsUpDown,
|
|
32476
32474
|
CircleCheckBig as CircleCheckBig2,
|
|
32477
|
-
Code as CodeIcon,
|
|
32478
32475
|
FileCode as FileCode3,
|
|
32479
32476
|
Heading1 as Heading1Icon,
|
|
32480
32477
|
Heading2 as Heading2Icon,
|
|
32481
32478
|
Heading3 as Heading3Icon,
|
|
32482
|
-
Image as ImageIcon2,
|
|
32483
|
-
Italic as ItalicIcon,
|
|
32484
32479
|
Link as LinkIcon,
|
|
32485
32480
|
List as ListIcon,
|
|
32486
32481
|
ListOrdered as ListOrderedIcon,
|
|
32487
32482
|
ListTodo as ListTodo2,
|
|
32488
32483
|
Quote as QuoteIcon,
|
|
32489
|
-
Redo as RedoIcon,
|
|
32490
32484
|
RotateCcw as RotateCcw2,
|
|
32491
|
-
Smile as Smile3,
|
|
32492
32485
|
SquareCheckBig,
|
|
32493
|
-
Strikethrough as StrikethroughIcon,
|
|
32494
|
-
Subscript as SubscriptIcon,
|
|
32495
|
-
Superscript as SuperscriptIcon,
|
|
32496
32486
|
Table as TableIcon,
|
|
32497
32487
|
TableCellsMerge,
|
|
32498
32488
|
Trash2 as Trash22,
|
|
32499
32489
|
Type as Type2,
|
|
32500
|
-
Underline as UnderlineIcon,
|
|
32501
|
-
Undo as UndoIcon,
|
|
32502
32490
|
Upload as Upload3,
|
|
32503
32491
|
AlignStartVertical,
|
|
32504
32492
|
AlignCenterVertical,
|
|
@@ -32508,13 +32496,158 @@ import { setCellAttr } from "@tiptap/pm/tables";
|
|
|
32508
32496
|
|
|
32509
32497
|
// src/components/UEditor/colors.tsx
|
|
32510
32498
|
import { useMemo as useMemo24, useRef as useRef32 } from "react";
|
|
32511
|
-
import { Check as Check12,
|
|
32512
|
-
|
|
32499
|
+
import { Check as Check12, Palette as Palette2, Paintbrush, Grid as Grid2 } from "lucide-react";
|
|
32500
|
+
|
|
32501
|
+
// src/components/UEditor/figma-toolbar-icons.tsx
|
|
32502
|
+
import React81 from "react";
|
|
32503
|
+
import { jsx as jsx90 } from "react/jsx-runtime";
|
|
32504
|
+
function createToolbarIcon(displayName, width, height, path) {
|
|
32505
|
+
const Icon = React81.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx90(
|
|
32506
|
+
"svg",
|
|
32507
|
+
{
|
|
32508
|
+
ref,
|
|
32509
|
+
"aria-hidden": "true",
|
|
32510
|
+
focusable: "false",
|
|
32511
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
32512
|
+
className,
|
|
32513
|
+
fill: "currentColor",
|
|
32514
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
32515
|
+
...props,
|
|
32516
|
+
children: /* @__PURE__ */ jsx90("path", { d: path })
|
|
32517
|
+
}
|
|
32518
|
+
));
|
|
32519
|
+
Icon.displayName = displayName;
|
|
32520
|
+
return Icon;
|
|
32521
|
+
}
|
|
32522
|
+
var FigmaChevronDownIcon = createToolbarIcon(
|
|
32523
|
+
"FigmaChevronDownIcon",
|
|
32524
|
+
512,
|
|
32525
|
+
512,
|
|
32526
|
+
"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"
|
|
32527
|
+
);
|
|
32528
|
+
var FigmaTextStyleIcon = ({ className, ...props }) => /* @__PURE__ */ jsx90("svg", { "aria-hidden": "true", focusable: "false", viewBox: "0 0 24 24", className, fill: "currentColor", ...props, children: /* @__PURE__ */ jsx90("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" }) });
|
|
32529
|
+
var FigmaLineHeightIcon = createToolbarIcon(
|
|
32530
|
+
"FigmaLineHeightIcon",
|
|
32531
|
+
576,
|
|
32532
|
+
512,
|
|
32533
|
+
"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"
|
|
32534
|
+
);
|
|
32535
|
+
var FigmaLetterSpacingIcon = createToolbarIcon(
|
|
32536
|
+
"FigmaLetterSpacingIcon",
|
|
32537
|
+
448,
|
|
32538
|
+
512,
|
|
32539
|
+
"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"
|
|
32540
|
+
);
|
|
32541
|
+
var FigmaBoldIcon = createToolbarIcon(
|
|
32542
|
+
"FigmaBoldIcon",
|
|
32543
|
+
384,
|
|
32544
|
+
512,
|
|
32545
|
+
"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"
|
|
32546
|
+
);
|
|
32547
|
+
var FigmaItalicIcon = createToolbarIcon(
|
|
32548
|
+
"FigmaItalicIcon",
|
|
32549
|
+
384,
|
|
32550
|
+
512,
|
|
32551
|
+
"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"
|
|
32552
|
+
);
|
|
32553
|
+
var FigmaUnderlineIcon = createToolbarIcon(
|
|
32554
|
+
"FigmaUnderlineIcon",
|
|
32555
|
+
448,
|
|
32556
|
+
512,
|
|
32557
|
+
"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"
|
|
32558
|
+
);
|
|
32559
|
+
var FigmaStrikeIcon = createToolbarIcon(
|
|
32560
|
+
"FigmaStrikeIcon",
|
|
32561
|
+
512,
|
|
32562
|
+
512,
|
|
32563
|
+
"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"
|
|
32564
|
+
);
|
|
32565
|
+
var FigmaCodeIcon = createToolbarIcon(
|
|
32566
|
+
"FigmaCodeIcon",
|
|
32567
|
+
640,
|
|
32568
|
+
512,
|
|
32569
|
+
"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"
|
|
32570
|
+
);
|
|
32571
|
+
var FigmaSubscriptIcon = createToolbarIcon(
|
|
32572
|
+
"FigmaSubscriptIcon",
|
|
32573
|
+
512,
|
|
32574
|
+
512,
|
|
32575
|
+
"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"
|
|
32576
|
+
);
|
|
32577
|
+
var FigmaSuperscriptIcon = createToolbarIcon(
|
|
32578
|
+
"FigmaSuperscriptIcon",
|
|
32579
|
+
512,
|
|
32580
|
+
512,
|
|
32581
|
+
"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"
|
|
32582
|
+
);
|
|
32583
|
+
var FigmaLinkIcon = createToolbarIcon(
|
|
32584
|
+
"FigmaLinkIcon",
|
|
32585
|
+
640,
|
|
32586
|
+
512,
|
|
32587
|
+
"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"
|
|
32588
|
+
);
|
|
32589
|
+
var FigmaSmileIcon = createToolbarIcon(
|
|
32590
|
+
"FigmaSmileIcon",
|
|
32591
|
+
512,
|
|
32592
|
+
512,
|
|
32593
|
+
"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"
|
|
32594
|
+
);
|
|
32595
|
+
var FigmaAlignLeftIcon = createToolbarIcon(
|
|
32596
|
+
"FigmaAlignLeftIcon",
|
|
32597
|
+
448,
|
|
32598
|
+
512,
|
|
32599
|
+
"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"
|
|
32600
|
+
);
|
|
32601
|
+
var FigmaListIcon = createToolbarIcon(
|
|
32602
|
+
"FigmaListIcon",
|
|
32603
|
+
512,
|
|
32604
|
+
512,
|
|
32605
|
+
"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"
|
|
32606
|
+
);
|
|
32607
|
+
var FigmaQuoteIcon = createToolbarIcon(
|
|
32608
|
+
"FigmaQuoteIcon",
|
|
32609
|
+
448,
|
|
32610
|
+
512,
|
|
32611
|
+
"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"
|
|
32612
|
+
);
|
|
32613
|
+
var FigmaImageIcon = createToolbarIcon(
|
|
32614
|
+
"FigmaImageIcon",
|
|
32615
|
+
512,
|
|
32616
|
+
512,
|
|
32617
|
+
"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"
|
|
32618
|
+
);
|
|
32619
|
+
var FigmaTableIcon = createToolbarIcon(
|
|
32620
|
+
"FigmaTableIcon",
|
|
32621
|
+
512,
|
|
32622
|
+
512,
|
|
32623
|
+
"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"
|
|
32624
|
+
);
|
|
32625
|
+
var FigmaUndoIcon = createToolbarIcon(
|
|
32626
|
+
"FigmaUndoIcon",
|
|
32627
|
+
512,
|
|
32628
|
+
512,
|
|
32629
|
+
"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"
|
|
32630
|
+
);
|
|
32631
|
+
var FigmaRedoIcon = createToolbarIcon(
|
|
32632
|
+
"FigmaRedoIcon",
|
|
32633
|
+
512,
|
|
32634
|
+
512,
|
|
32635
|
+
"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"
|
|
32636
|
+
);
|
|
32637
|
+
var FigmaHighlighterIcon = createToolbarIcon(
|
|
32638
|
+
"FigmaHighlighterIcon",
|
|
32639
|
+
576,
|
|
32640
|
+
512,
|
|
32641
|
+
"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"
|
|
32642
|
+
);
|
|
32643
|
+
|
|
32644
|
+
// src/components/UEditor/colors.tsx
|
|
32645
|
+
import { jsx as jsx91, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
32513
32646
|
var TextColorIcon = ({ color }) => {
|
|
32514
32647
|
const underlineColor = color && color !== "inherit" ? color : "currentColor";
|
|
32515
32648
|
return /* @__PURE__ */ jsxs73("span", { className: "relative flex h-5 w-5 items-center justify-center leading-none", children: [
|
|
32516
|
-
/* @__PURE__ */
|
|
32517
|
-
/* @__PURE__ */
|
|
32649
|
+
/* @__PURE__ */ jsx91("span", { className: "text-[15px] font-semibold leading-none", children: "A" }),
|
|
32650
|
+
/* @__PURE__ */ jsx91(
|
|
32518
32651
|
"span",
|
|
32519
32652
|
{
|
|
32520
32653
|
"aria-hidden": "true",
|
|
@@ -32527,8 +32660,8 @@ var TextColorIcon = ({ color }) => {
|
|
|
32527
32660
|
var HighlightColorIcon = ({ color }) => {
|
|
32528
32661
|
const underlineColor = color || "currentColor";
|
|
32529
32662
|
return /* @__PURE__ */ jsxs73("span", { className: "relative flex h-5 w-5 items-center justify-center leading-none", children: [
|
|
32530
|
-
/* @__PURE__ */
|
|
32531
|
-
/* @__PURE__ */
|
|
32663
|
+
/* @__PURE__ */ jsx91(FigmaHighlighterIcon, { className: "h-4 w-4" }),
|
|
32664
|
+
/* @__PURE__ */ jsx91(
|
|
32532
32665
|
"span",
|
|
32533
32666
|
{
|
|
32534
32667
|
"aria-hidden": "true",
|
|
@@ -32541,8 +32674,8 @@ var HighlightColorIcon = ({ color }) => {
|
|
|
32541
32674
|
var CellBgColorIcon = ({ color }) => {
|
|
32542
32675
|
const underlineColor = color && color !== "inherit" ? color : "currentColor";
|
|
32543
32676
|
return /* @__PURE__ */ jsxs73("span", { className: "relative flex h-5 w-5 items-center justify-center leading-none", children: [
|
|
32544
|
-
/* @__PURE__ */
|
|
32545
|
-
/* @__PURE__ */
|
|
32677
|
+
/* @__PURE__ */ jsx91(Paintbrush, { className: "h-4 w-4" }),
|
|
32678
|
+
/* @__PURE__ */ jsx91(
|
|
32546
32679
|
"span",
|
|
32547
32680
|
{
|
|
32548
32681
|
"aria-hidden": "true",
|
|
@@ -32555,8 +32688,8 @@ var CellBgColorIcon = ({ color }) => {
|
|
|
32555
32688
|
var CellBorderIcon = ({ color }) => {
|
|
32556
32689
|
const underlineColor = color && color !== "inherit" ? color : "currentColor";
|
|
32557
32690
|
return /* @__PURE__ */ jsxs73("span", { className: "relative flex h-5 w-5 items-center justify-center leading-none", children: [
|
|
32558
|
-
/* @__PURE__ */
|
|
32559
|
-
/* @__PURE__ */
|
|
32691
|
+
/* @__PURE__ */ jsx91(Grid2, { className: "h-4 w-4" }),
|
|
32692
|
+
/* @__PURE__ */ jsx91(
|
|
32560
32693
|
"span",
|
|
32561
32694
|
{
|
|
32562
32695
|
"aria-hidden": "true",
|
|
@@ -32684,7 +32817,7 @@ var EditorColorPalette = ({
|
|
|
32684
32817
|
const automaticColor = colors[0]?.color ?? "";
|
|
32685
32818
|
const paletteColors = colors.slice(1);
|
|
32686
32819
|
return /* @__PURE__ */ jsxs73("div", { className: "w-56 p-2", children: [
|
|
32687
|
-
/* @__PURE__ */
|
|
32820
|
+
/* @__PURE__ */ jsx91("span", { className: "px-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: label }),
|
|
32688
32821
|
/* @__PURE__ */ jsxs73(
|
|
32689
32822
|
"button",
|
|
32690
32823
|
{
|
|
@@ -32697,12 +32830,12 @@ var EditorColorPalette = ({
|
|
|
32697
32830
|
currentColor === automaticColor ? "border-primary text-primary" : "border-transparent text-foreground"
|
|
32698
32831
|
),
|
|
32699
32832
|
children: [
|
|
32700
|
-
/* @__PURE__ */
|
|
32701
|
-
/* @__PURE__ */
|
|
32833
|
+
/* @__PURE__ */ jsx91("span", { className: "flex h-5 w-5 items-center justify-center rounded border border-border bg-background", children: currentColor === automaticColor && /* @__PURE__ */ jsx91(Check12, { className: "h-3.5 w-3.5" }) }),
|
|
32834
|
+
/* @__PURE__ */ jsx91("span", { className: "flex-1 text-center", children: t("colors.automatic") })
|
|
32702
32835
|
]
|
|
32703
32836
|
}
|
|
32704
32837
|
),
|
|
32705
|
-
/* @__PURE__ */
|
|
32838
|
+
/* @__PURE__ */ jsx91("div", { className: "mt-2 grid grid-cols-8 gap-1", children: paletteColors.map((c) => /* @__PURE__ */ jsx91(Tooltip, { placement: "top", content: /* @__PURE__ */ jsx91("span", { className: "text-xs font-medium", children: c.name }), children: /* @__PURE__ */ jsx91(
|
|
32706
32839
|
"button",
|
|
32707
32840
|
{
|
|
32708
32841
|
type: "button",
|
|
@@ -32714,7 +32847,7 @@ var EditorColorPalette = ({
|
|
|
32714
32847
|
currentColor === c.color ? "border-primary ring-2 ring-primary/25" : "border-border/70"
|
|
32715
32848
|
),
|
|
32716
32849
|
style: { backgroundColor: c.color || "transparent" },
|
|
32717
|
-
children: currentColor === c.color && /* @__PURE__ */
|
|
32850
|
+
children: currentColor === c.color && /* @__PURE__ */ jsx91("span", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx91(Check12, { className: cn("h-3.5 w-3.5", getSwatchCheckClass(c.color)) }) })
|
|
32718
32851
|
}
|
|
32719
32852
|
) }, `${c.name}-${c.color}`)) }),
|
|
32720
32853
|
/* @__PURE__ */ jsxs73(
|
|
@@ -32725,7 +32858,7 @@ var EditorColorPalette = ({
|
|
|
32725
32858
|
onClick: () => colorInputRef.current?.click(),
|
|
32726
32859
|
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",
|
|
32727
32860
|
children: [
|
|
32728
|
-
/* @__PURE__ */
|
|
32861
|
+
/* @__PURE__ */ jsx91(
|
|
32729
32862
|
"span",
|
|
32730
32863
|
{
|
|
32731
32864
|
"aria-hidden": "true",
|
|
@@ -32735,9 +32868,9 @@ var EditorColorPalette = ({
|
|
|
32735
32868
|
}
|
|
32736
32869
|
}
|
|
32737
32870
|
),
|
|
32738
|
-
/* @__PURE__ */
|
|
32739
|
-
/* @__PURE__ */
|
|
32740
|
-
/* @__PURE__ */
|
|
32871
|
+
/* @__PURE__ */ jsx91("span", { className: "flex-1 text-center", children: t("colors.moreColors") }),
|
|
32872
|
+
/* @__PURE__ */ jsx91(Palette2, { className: "h-4 w-4 text-muted-foreground" }),
|
|
32873
|
+
/* @__PURE__ */ jsx91(
|
|
32741
32874
|
"input",
|
|
32742
32875
|
{
|
|
32743
32876
|
ref: colorInputRef,
|
|
@@ -32884,7 +33017,7 @@ function deleteSelectedImage(editor) {
|
|
|
32884
33017
|
// src/components/UEditor/inputs.tsx
|
|
32885
33018
|
import { useEffect as useEffect37, useId as useId16, useRef as useRef33, useState as useState49 } from "react";
|
|
32886
33019
|
import { Check as Check13, X as X19 } from "lucide-react";
|
|
32887
|
-
import { jsx as
|
|
33020
|
+
import { jsx as jsx92, jsxs as jsxs74 } from "react/jsx-runtime";
|
|
32888
33021
|
function normalizeUrl(raw) {
|
|
32889
33022
|
return sanitizeUEditorUrl(raw, "link");
|
|
32890
33023
|
}
|
|
@@ -32914,7 +33047,7 @@ var LinkInput = ({
|
|
|
32914
33047
|
};
|
|
32915
33048
|
return /* @__PURE__ */ jsxs74("form", { onSubmit: handleSubmit, className: "p-2", children: [
|
|
32916
33049
|
/* @__PURE__ */ jsxs74("div", { className: "flex items-center gap-2", children: [
|
|
32917
|
-
/* @__PURE__ */
|
|
33050
|
+
/* @__PURE__ */ jsx92(
|
|
32918
33051
|
"input",
|
|
32919
33052
|
{
|
|
32920
33053
|
ref: inputRef,
|
|
@@ -32930,10 +33063,10 @@ var LinkInput = ({
|
|
|
32930
33063
|
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"
|
|
32931
33064
|
}
|
|
32932
33065
|
),
|
|
32933
|
-
/* @__PURE__ */
|
|
32934
|
-
/* @__PURE__ */
|
|
33066
|
+
/* @__PURE__ */ jsx92("button", { type: "submit", className: "p-2 rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors", children: /* @__PURE__ */ jsx92(Check13, { className: "w-4 h-4" }) }),
|
|
33067
|
+
/* @__PURE__ */ jsx92("button", { type: "button", onClick: onCancel, className: "p-2 rounded-lg hover:bg-muted transition-colors text-muted-foreground", children: /* @__PURE__ */ jsx92(X19, { className: "w-4 h-4" }) })
|
|
32935
33068
|
] }),
|
|
32936
|
-
error ? /* @__PURE__ */
|
|
33069
|
+
error ? /* @__PURE__ */ jsx92("p", { id: errorId, role: "alert", className: "mt-1.5 px-1 text-xs text-destructive", children: error }) : null
|
|
32937
33070
|
] });
|
|
32938
33071
|
};
|
|
32939
33072
|
var ImageInput = ({ onSubmit, onCancel }) => {
|
|
@@ -32953,8 +33086,8 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
32953
33086
|
};
|
|
32954
33087
|
return /* @__PURE__ */ jsxs74("form", { onSubmit: handleSubmit, className: "p-3 space-y-3", children: [
|
|
32955
33088
|
/* @__PURE__ */ jsxs74("div", { children: [
|
|
32956
|
-
/* @__PURE__ */
|
|
32957
|
-
/* @__PURE__ */
|
|
33089
|
+
/* @__PURE__ */ jsx92("label", { className: "text-xs font-medium text-muted-foreground", children: t("imageInput.urlLabel") }),
|
|
33090
|
+
/* @__PURE__ */ jsx92(
|
|
32958
33091
|
"input",
|
|
32959
33092
|
{
|
|
32960
33093
|
ref: inputRef,
|
|
@@ -32967,8 +33100,8 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
32967
33100
|
)
|
|
32968
33101
|
] }),
|
|
32969
33102
|
/* @__PURE__ */ jsxs74("div", { children: [
|
|
32970
|
-
/* @__PURE__ */
|
|
32971
|
-
/* @__PURE__ */
|
|
33103
|
+
/* @__PURE__ */ jsx92("label", { className: "text-xs font-medium text-muted-foreground", children: t("imageInput.altLabel") }),
|
|
33104
|
+
/* @__PURE__ */ jsx92(
|
|
32972
33105
|
"input",
|
|
32973
33106
|
{
|
|
32974
33107
|
type: "text",
|
|
@@ -32980,7 +33113,7 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
32980
33113
|
)
|
|
32981
33114
|
] }),
|
|
32982
33115
|
/* @__PURE__ */ jsxs74("div", { className: "flex gap-2", children: [
|
|
32983
|
-
/* @__PURE__ */
|
|
33116
|
+
/* @__PURE__ */ jsx92(
|
|
32984
33117
|
"button",
|
|
32985
33118
|
{
|
|
32986
33119
|
type: "submit",
|
|
@@ -32989,7 +33122,7 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
32989
33122
|
children: t("imageInput.addBtn")
|
|
32990
33123
|
}
|
|
32991
33124
|
),
|
|
32992
|
-
/* @__PURE__ */
|
|
33125
|
+
/* @__PURE__ */ jsx92("button", { type: "button", onClick: onCancel, className: "px-4 py-2 rounded-lg hover:bg-muted transition-colors text-muted-foreground", children: t("imageInput.cancelBtn") })
|
|
32993
33126
|
] })
|
|
32994
33127
|
] });
|
|
32995
33128
|
};
|
|
@@ -33305,6 +33438,7 @@ function normalizeStyleValue(value) {
|
|
|
33305
33438
|
}
|
|
33306
33439
|
function getDefaultFontFamilies(t) {
|
|
33307
33440
|
return [
|
|
33441
|
+
{ label: "Inter", value: '"Inter", "Noto Sans", "Noto Sans CJK KR", "Noto Sans CJK JP", "Segoe UI", sans-serif' },
|
|
33308
33442
|
{ label: "\uAD74\uB9BC", value: '"Gulim", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif' },
|
|
33309
33443
|
{ label: "\uAD74\uB9BC\uCCB4", value: '"GulimChe", "Gulim", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif' },
|
|
33310
33444
|
{ label: "\uAD81\uC11C", value: '"Gungsuh", "Nanum Myeongjo", serif' },
|
|
@@ -33315,7 +33449,6 @@ function getDefaultFontFamilies(t) {
|
|
|
33315
33449
|
{ label: "\uBC14\uD0D5\uCCB4", value: '"BatangChe", "Batang", "Nanum Myeongjo", serif' },
|
|
33316
33450
|
{ label: "\uB9D1\uC740\uACE0\uB515", value: '"Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif' },
|
|
33317
33451
|
{ label: "\uB098\uB214\uBA85\uC870", value: '"Nanum Myeongjo", "Batang", serif' },
|
|
33318
|
-
{ label: "Inter", value: '"Inter", "Noto Sans", "Noto Sans CJK KR", "Noto Sans CJK JP", "Segoe UI", sans-serif' },
|
|
33319
33452
|
{ label: "System UI", value: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif' },
|
|
33320
33453
|
{ label: "Roboto", value: '"Roboto", "Noto Sans", "Apple SD Gothic Neo", "Hiragino Kaku Gothic ProN", sans-serif' },
|
|
33321
33454
|
{ label: "Lexend", value: '"Lexend", "Be Vietnam Pro", "Segoe UI", sans-serif' },
|
|
@@ -33377,7 +33510,7 @@ function getDefaultLetterSpacings() {
|
|
|
33377
33510
|
}
|
|
33378
33511
|
|
|
33379
33512
|
// src/components/UEditor/toolbar.tsx
|
|
33380
|
-
import { Fragment as Fragment30, jsx as
|
|
33513
|
+
import { Fragment as Fragment30, jsx as jsx93, jsxs as jsxs75 } from "react/jsx-runtime";
|
|
33381
33514
|
function getTableAnchorPos(editor) {
|
|
33382
33515
|
const tableInfo = findTableNodeInfoFromState(editor.state);
|
|
33383
33516
|
if (tableInfo) return editor.state.selection.from;
|
|
@@ -33407,8 +33540,8 @@ function fileToDataUrl2(file) {
|
|
|
33407
33540
|
function formatTableInsertLabel(template, rows, cols) {
|
|
33408
33541
|
return template.replace("{rows}", String(rows)).replace("{cols}", String(cols));
|
|
33409
33542
|
}
|
|
33410
|
-
var ToolbarButton =
|
|
33411
|
-
const button = /* @__PURE__ */
|
|
33543
|
+
var ToolbarButton = React84.forwardRef(({ onClick, onMouseDown, active, disabled, children, title, className }, ref) => {
|
|
33544
|
+
const button = /* @__PURE__ */ jsx93(
|
|
33412
33545
|
"button",
|
|
33413
33546
|
{
|
|
33414
33547
|
ref,
|
|
@@ -33421,40 +33554,40 @@ var ToolbarButton = React83.forwardRef(({ onClick, onMouseDown, active, disabled
|
|
|
33421
33554
|
onClick,
|
|
33422
33555
|
disabled,
|
|
33423
33556
|
className: cn(
|
|
33424
|
-
"flex items-center justify-center
|
|
33557
|
+
"flex h-8 w-8 shrink-0 items-center justify-center rounded-md transition-colors duration-150 cursor-pointer",
|
|
33425
33558
|
"gap-0.5 [&_svg+svg]:-ml-1",
|
|
33426
33559
|
"hover:bg-accent",
|
|
33427
33560
|
"focus:outline-none focus:ring-2 focus:ring-primary/20",
|
|
33428
33561
|
"disabled:opacity-40 disabled:cursor-not-allowed",
|
|
33429
|
-
active ? "bg-primary/10 text-primary shadow-sm" : "text-
|
|
33562
|
+
active ? "bg-primary/10 text-primary shadow-sm" : "text-[#7B8184] hover:text-foreground dark:text-muted-foreground",
|
|
33430
33563
|
className
|
|
33431
33564
|
),
|
|
33432
33565
|
children
|
|
33433
33566
|
}
|
|
33434
33567
|
);
|
|
33435
33568
|
if (title) {
|
|
33436
|
-
return /* @__PURE__ */
|
|
33569
|
+
return /* @__PURE__ */ jsx93(Tooltip, { content: title, placement: "top", delay: { open: 200, close: 0 }, children: button });
|
|
33437
33570
|
}
|
|
33438
33571
|
return button;
|
|
33439
33572
|
});
|
|
33440
33573
|
ToolbarButton.displayName = "ToolbarButton";
|
|
33441
|
-
var ToolbarDivider = () => /* @__PURE__ */
|
|
33574
|
+
var ToolbarDivider = () => /* @__PURE__ */ jsx93("div", { "aria-hidden": "true", className: "mx-2 h-9 w-px shrink-0 bg-[rgba(123,129,132,0.24)]" });
|
|
33442
33575
|
var TableInsertGrid = ({
|
|
33443
33576
|
insertLabel,
|
|
33444
33577
|
previewTemplate,
|
|
33445
33578
|
onInsert
|
|
33446
33579
|
}) => {
|
|
33447
|
-
const [selection, setSelection] =
|
|
33580
|
+
const [selection, setSelection] = React84.useState({ rows: 3, cols: 3 });
|
|
33448
33581
|
const maxRows = 8;
|
|
33449
33582
|
const maxCols = 8;
|
|
33450
33583
|
return /* @__PURE__ */ jsxs75("div", { className: "mb-2 rounded-xl border border-border/60 bg-muted/20 p-2", children: [
|
|
33451
|
-
/* @__PURE__ */
|
|
33452
|
-
/* @__PURE__ */
|
|
33584
|
+
/* @__PURE__ */ jsx93("div", { className: "mb-2 text-sm font-medium text-foreground", children: formatTableInsertLabel(previewTemplate, selection.rows, selection.cols) }),
|
|
33585
|
+
/* @__PURE__ */ jsx93("div", { className: "grid grid-cols-8 gap-1", onMouseLeave: () => setSelection((prev) => prev), children: Array.from({ length: maxRows }).map(
|
|
33453
33586
|
(_, rowIndex) => Array.from({ length: maxCols }).map((__, colIndex) => {
|
|
33454
33587
|
const rows = rowIndex + 1;
|
|
33455
33588
|
const cols = colIndex + 1;
|
|
33456
33589
|
const active = rows <= selection.rows && cols <= selection.cols;
|
|
33457
|
-
return /* @__PURE__ */
|
|
33590
|
+
return /* @__PURE__ */ jsx93(
|
|
33458
33591
|
"button",
|
|
33459
33592
|
{
|
|
33460
33593
|
type: "button",
|
|
@@ -33472,7 +33605,7 @@ var TableInsertGrid = ({
|
|
|
33472
33605
|
);
|
|
33473
33606
|
})
|
|
33474
33607
|
) }),
|
|
33475
|
-
/* @__PURE__ */
|
|
33608
|
+
/* @__PURE__ */ jsx93("div", { className: "mt-2 text-xs text-muted-foreground", children: insertLabel })
|
|
33476
33609
|
] });
|
|
33477
33610
|
};
|
|
33478
33611
|
function applyTableCellAttribute(editor, name, value) {
|
|
@@ -33531,10 +33664,10 @@ var EditorToolbar = ({
|
|
|
33531
33664
|
const currentHighlightColor = normalizeStyleValue(editor.getAttributes("highlight").color) || "";
|
|
33532
33665
|
const currentLineHeight = normalizeStyleValue(textStyleAttrs.lineHeight);
|
|
33533
33666
|
const currentLetterSpacing = normalizeStyleValue(textStyleAttrs.letterSpacing);
|
|
33534
|
-
const availableFontFamilies =
|
|
33535
|
-
const availableFontSizes =
|
|
33536
|
-
const availableLineHeights =
|
|
33537
|
-
const availableLetterSpacings =
|
|
33667
|
+
const availableFontFamilies = React84.useMemo(() => fontFamilies ?? getDefaultFontFamilies(t), [fontFamilies, t]);
|
|
33668
|
+
const availableFontSizes = React84.useMemo(() => fontSizes ?? getDefaultFontSizes(), [fontSizes]);
|
|
33669
|
+
const availableLineHeights = React84.useMemo(() => lineHeights ?? getDefaultLineHeights(), [lineHeights]);
|
|
33670
|
+
const availableLetterSpacings = React84.useMemo(() => letterSpacings ?? getDefaultLetterSpacings(), [letterSpacings]);
|
|
33538
33671
|
const currentFontFamilyDisplayValue = currentFontFamily.split(",")[0]?.trim() ?? currentFontFamily;
|
|
33539
33672
|
const currentFontFamilyLabel = availableFontFamilies.find((option) => normalizeStyleValue(option.value) === currentFontFamily)?.label ?? (currentFontFamilyDisplayValue || t("toolbar.fontDefault"));
|
|
33540
33673
|
const currentFontSizeLabel = availableFontSizes.find((option) => normalizeStyleValue(option.value) === currentFontSize)?.label ?? "13";
|
|
@@ -33572,18 +33705,18 @@ var EditorToolbar = ({
|
|
|
33572
33705
|
};
|
|
33573
33706
|
if (variant === "minimal") {
|
|
33574
33707
|
return /* @__PURE__ */ jsxs75("div", { className: "flex flex-wrap items-center gap-0.5 border-b border-border/35 bg-muted/30 p-1.5", children: [
|
|
33575
|
-
/* @__PURE__ */
|
|
33576
|
-
/* @__PURE__ */
|
|
33577
|
-
/* @__PURE__ */
|
|
33578
|
-
/* @__PURE__ */
|
|
33579
|
-
/* @__PURE__ */
|
|
33580
|
-
/* @__PURE__ */
|
|
33708
|
+
/* @__PURE__ */ jsx93(ToolbarButton, { onClick: () => editor.chain().focus().undo().run(), disabled: !editor.can().undo(), title: t("toolbar.undo"), children: /* @__PURE__ */ jsx93(FigmaUndoIcon, { className: "h-4 w-4" }) }),
|
|
33709
|
+
/* @__PURE__ */ jsx93(ToolbarButton, { onClick: () => editor.chain().focus().redo().run(), disabled: !editor.can().redo(), title: t("toolbar.redo"), children: /* @__PURE__ */ jsx93(FigmaRedoIcon, { className: "h-4 w-4" }) }),
|
|
33710
|
+
/* @__PURE__ */ jsx93(ToolbarDivider, {}),
|
|
33711
|
+
/* @__PURE__ */ jsx93(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ jsx93(FigmaBoldIcon, { className: "h-4 w-4" }) }),
|
|
33712
|
+
/* @__PURE__ */ jsx93(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ jsx93(FigmaItalicIcon, { className: "h-4 w-4" }) }),
|
|
33713
|
+
/* @__PURE__ */ jsx93(
|
|
33581
33714
|
ToolbarButton,
|
|
33582
33715
|
{
|
|
33583
33716
|
onClick: () => editor.chain().focus().toggleBulletList().run(),
|
|
33584
33717
|
active: editor.isActive("bulletList"),
|
|
33585
33718
|
title: t("toolbar.bulletList"),
|
|
33586
|
-
children: /* @__PURE__ */
|
|
33719
|
+
children: /* @__PURE__ */ jsx93(FigmaListIcon, { className: "h-4 w-4" })
|
|
33587
33720
|
}
|
|
33588
33721
|
),
|
|
33589
33722
|
/* @__PURE__ */ jsxs75(
|
|
@@ -33591,11 +33724,11 @@ var EditorToolbar = ({
|
|
|
33591
33724
|
{
|
|
33592
33725
|
trigger: /* @__PURE__ */ jsxs75(ToolbarButton, { onClick: () => {
|
|
33593
33726
|
}, active: editor.isActive("formCheckbox"), title: t("slashCommand.formCheckbox"), children: [
|
|
33594
|
-
/* @__PURE__ */
|
|
33595
|
-
/* @__PURE__ */
|
|
33727
|
+
/* @__PURE__ */ jsx93(SquareCheckBig, { className: "w-4 h-4" }),
|
|
33728
|
+
/* @__PURE__ */ jsx93(ChevronDown8, { className: "w-3 h-3" })
|
|
33596
33729
|
] }),
|
|
33597
33730
|
children: [
|
|
33598
|
-
/* @__PURE__ */
|
|
33731
|
+
/* @__PURE__ */ jsx93(
|
|
33599
33732
|
DropdownMenuItem,
|
|
33600
33733
|
{
|
|
33601
33734
|
icon: SquareCheckBig,
|
|
@@ -33603,7 +33736,7 @@ var EditorToolbar = ({
|
|
|
33603
33736
|
onClick: () => editor.chain().focus().setFormCheckbox().run()
|
|
33604
33737
|
}
|
|
33605
33738
|
),
|
|
33606
|
-
/* @__PURE__ */
|
|
33739
|
+
/* @__PURE__ */ jsx93(
|
|
33607
33740
|
DropdownMenuItem,
|
|
33608
33741
|
{
|
|
33609
33742
|
icon: CircleCheckBig2,
|
|
@@ -33614,12 +33747,12 @@ var EditorToolbar = ({
|
|
|
33614
33747
|
]
|
|
33615
33748
|
}
|
|
33616
33749
|
),
|
|
33617
|
-
/* @__PURE__ */
|
|
33750
|
+
/* @__PURE__ */ jsx93(
|
|
33618
33751
|
DropdownMenu,
|
|
33619
33752
|
{
|
|
33620
33753
|
contentClassName: "min-w-72",
|
|
33621
|
-
trigger: /* @__PURE__ */
|
|
33622
|
-
children: showLinkInput ? /* @__PURE__ */
|
|
33754
|
+
trigger: /* @__PURE__ */ jsx93(ToolbarButton, { onClick: () => setShowLinkInput(!editor.isActive("link")), active: editor.isActive("link"), title: t("toolbar.link"), children: /* @__PURE__ */ jsx93(FigmaLinkIcon, { className: "h-4 w-4" }) }),
|
|
33755
|
+
children: showLinkInput ? /* @__PURE__ */ jsx93(
|
|
33623
33756
|
LinkInput,
|
|
33624
33757
|
{
|
|
33625
33758
|
initialUrl: String(editor.getAttributes("link").href ?? ""),
|
|
@@ -33630,7 +33763,7 @@ var EditorToolbar = ({
|
|
|
33630
33763
|
onCancel: () => setShowLinkInput(false)
|
|
33631
33764
|
}
|
|
33632
33765
|
) : /* @__PURE__ */ jsxs75(Fragment30, { children: [
|
|
33633
|
-
/* @__PURE__ */
|
|
33766
|
+
/* @__PURE__ */ jsx93(
|
|
33634
33767
|
DropdownMenuItem,
|
|
33635
33768
|
{
|
|
33636
33769
|
icon: LinkIcon,
|
|
@@ -33640,7 +33773,7 @@ var EditorToolbar = ({
|
|
|
33640
33773
|
closeOnSelect: false
|
|
33641
33774
|
}
|
|
33642
33775
|
),
|
|
33643
|
-
/* @__PURE__ */
|
|
33776
|
+
/* @__PURE__ */ jsx93(
|
|
33644
33777
|
DropdownMenuItem,
|
|
33645
33778
|
{
|
|
33646
33779
|
icon: Trash22,
|
|
@@ -33656,856 +33789,870 @@ var EditorToolbar = ({
|
|
|
33656
33789
|
] });
|
|
33657
33790
|
}
|
|
33658
33791
|
const VerticalAlignActiveIcon = currentCellVerticalAlign === "middle" ? AlignCenterVertical : currentCellVerticalAlign === "bottom" ? AlignEndVertical : AlignStartVertical;
|
|
33659
|
-
return /* @__PURE__ */ jsxs75(
|
|
33660
|
-
|
|
33661
|
-
|
|
33662
|
-
|
|
33663
|
-
|
|
33664
|
-
|
|
33665
|
-
|
|
33666
|
-
|
|
33667
|
-
] }),
|
|
33668
|
-
contentClassName: "max-h-80 overflow-y-auto min-w-56 p-2",
|
|
33669
|
-
children: availableFontFamilies.map((option) => /* @__PURE__ */ jsx92(
|
|
33670
|
-
DropdownMenuItem,
|
|
33671
|
-
{
|
|
33672
|
-
label: option.label,
|
|
33673
|
-
onClick: () => editor.chain().focus().setFontFamily(option.value).run(),
|
|
33674
|
-
active: normalizeStyleValue(option.value) === (currentFontFamily || normalizeStyleValue(defaultFontFamilyValue)),
|
|
33675
|
-
className: "font-medium"
|
|
33676
|
-
},
|
|
33677
|
-
option.value
|
|
33678
|
-
))
|
|
33679
|
-
}
|
|
33680
|
-
),
|
|
33681
|
-
(isMediumFull || isFull) && /* @__PURE__ */ jsx92(
|
|
33682
|
-
DropdownMenu,
|
|
33683
|
-
{
|
|
33684
|
-
trigger: /* @__PURE__ */ jsxs75(ToolbarButton, { onClick: () => {
|
|
33685
|
-
}, title: t("toolbar.fontSize"), className: "px-1.5 w-auto gap-1", children: [
|
|
33686
|
-
/* @__PURE__ */ jsxs75("div", { className: "flex items-center gap-0.5", children: [
|
|
33687
|
-
/* @__PURE__ */ jsx92(ChevronsUpDown, { className: "h-3 w-3 text-muted-foreground", strokeWidth: 2.5 }),
|
|
33688
|
-
/* @__PURE__ */ jsx92("span", { className: "min-w-4 text-center text-xs font-semibold leading-none", children: displayedFontSizeLabel })
|
|
33689
|
-
] }),
|
|
33690
|
-
/* @__PURE__ */ jsx92(ChevronDown8, { className: "h-3 w-3 text-muted-foreground" })
|
|
33691
|
-
] }),
|
|
33692
|
-
contentClassName: "max-h-80 overflow-y-auto min-w-32 p-2",
|
|
33693
|
-
children: availableFontSizes.map((option) => /* @__PURE__ */ jsx92(
|
|
33694
|
-
DropdownMenuItem,
|
|
33792
|
+
return /* @__PURE__ */ jsxs75(
|
|
33793
|
+
"div",
|
|
33794
|
+
{
|
|
33795
|
+
role: "toolbar",
|
|
33796
|
+
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",
|
|
33797
|
+
children: [
|
|
33798
|
+
isFull && /* @__PURE__ */ jsx93(
|
|
33799
|
+
DropdownMenu,
|
|
33695
33800
|
{
|
|
33696
|
-
|
|
33697
|
-
|
|
33698
|
-
active: normalizeStyleValue(option.value) === activeFontSize
|
|
33699
|
-
},
|
|
33700
|
-
option.value
|
|
33701
|
-
))
|
|
33702
|
-
}
|
|
33703
|
-
),
|
|
33704
|
-
/* @__PURE__ */ jsxs75(
|
|
33705
|
-
DropdownMenu,
|
|
33706
|
-
{
|
|
33707
|
-
contentClassName: "p-1",
|
|
33708
|
-
trigger: /* @__PURE__ */ jsxs75(ToolbarButton, { onClick: () => {
|
|
33709
|
-
}, title: t("toolbar.textStyle"), className: "px-1.5 w-auto gap-0.5", children: [
|
|
33710
|
-
/* @__PURE__ */ jsx92(Type2, { className: "w-4 h-4" }),
|
|
33711
|
-
/* @__PURE__ */ jsx92(ChevronDown8, { className: "h-3 w-3 text-muted-foreground" })
|
|
33712
|
-
] }),
|
|
33713
|
-
children: [
|
|
33714
|
-
/* @__PURE__ */ jsx92(
|
|
33715
|
-
DropdownMenuItem,
|
|
33716
|
-
{
|
|
33717
|
-
icon: Type2,
|
|
33718
|
-
label: t("toolbar.normal"),
|
|
33719
|
-
onClick: () => editor.chain().focus().setParagraph().run(),
|
|
33720
|
-
active: editor.isActive("paragraph")
|
|
33721
|
-
}
|
|
33722
|
-
),
|
|
33723
|
-
/* @__PURE__ */ jsx92(
|
|
33724
|
-
DropdownMenuItem,
|
|
33725
|
-
{
|
|
33726
|
-
icon: Heading1Icon,
|
|
33727
|
-
label: t("toolbar.heading1"),
|
|
33728
|
-
onClick: () => editor.chain().focus().toggleHeading({ level: 1 }).run(),
|
|
33729
|
-
active: editor.isActive("heading", { level: 1 }),
|
|
33730
|
-
shortcut: "Ctrl+Alt+1"
|
|
33731
|
-
}
|
|
33732
|
-
),
|
|
33733
|
-
/* @__PURE__ */ jsx92(
|
|
33734
|
-
DropdownMenuItem,
|
|
33735
|
-
{
|
|
33736
|
-
icon: Heading2Icon,
|
|
33737
|
-
label: t("toolbar.heading2"),
|
|
33738
|
-
onClick: () => editor.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
33739
|
-
active: editor.isActive("heading", { level: 2 }),
|
|
33740
|
-
shortcut: "Ctrl+Alt+2"
|
|
33741
|
-
}
|
|
33742
|
-
),
|
|
33743
|
-
/* @__PURE__ */ jsx92(
|
|
33744
|
-
DropdownMenuItem,
|
|
33745
|
-
{
|
|
33746
|
-
icon: Heading3Icon,
|
|
33747
|
-
label: t("toolbar.heading3"),
|
|
33748
|
-
onClick: () => editor.chain().focus().toggleHeading({ level: 3 }).run(),
|
|
33749
|
-
active: editor.isActive("heading", { level: 3 }),
|
|
33750
|
-
shortcut: "Ctrl+Alt+3"
|
|
33751
|
-
}
|
|
33752
|
-
)
|
|
33753
|
-
]
|
|
33754
|
-
}
|
|
33755
|
-
),
|
|
33756
|
-
isFull && /* @__PURE__ */ jsxs75(Fragment30, { children: [
|
|
33757
|
-
/* @__PURE__ */ jsxs75(
|
|
33758
|
-
DropdownMenu,
|
|
33759
|
-
{
|
|
33760
|
-
trigger: /* @__PURE__ */ jsxs75(ToolbarButton, { onClick: () => {
|
|
33761
|
-
}, title: t("toolbar.lineHeight"), className: "gap-0.5", children: [
|
|
33762
|
-
/* @__PURE__ */ jsx92(ArrowUp, { className: "w-3 h-3" }),
|
|
33763
|
-
/* @__PURE__ */ jsx92(ArrowDown, { className: "w-3 h-3" })
|
|
33764
|
-
] }),
|
|
33765
|
-
contentClassName: "max-h-72 overflow-y-auto p-1",
|
|
33766
|
-
children: [
|
|
33767
|
-
/* @__PURE__ */ jsx92(
|
|
33768
|
-
DropdownMenuItem,
|
|
33801
|
+
trigger: /* @__PURE__ */ jsxs75(
|
|
33802
|
+
ToolbarButton,
|
|
33769
33803
|
{
|
|
33770
|
-
|
|
33771
|
-
|
|
33772
|
-
|
|
33773
|
-
|
|
33804
|
+
onClick: () => {
|
|
33805
|
+
},
|
|
33806
|
+
title: t("toolbar.fontFamily"),
|
|
33807
|
+
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",
|
|
33808
|
+
children: [
|
|
33809
|
+
/* @__PURE__ */ jsx93("span", { className: "min-w-0 flex-1 truncate text-left text-sm font-normal", style: { fontFamily: displayedFontFamilyValue || void 0 }, children: displayedFontFamilyLabel }),
|
|
33810
|
+
/* @__PURE__ */ jsx93(FigmaChevronDownIcon, { className: "h-3 w-3 shrink-0 text-[#7B8184]" })
|
|
33811
|
+
]
|
|
33774
33812
|
}
|
|
33775
33813
|
),
|
|
33776
|
-
|
|
33814
|
+
contentClassName: "max-h-80 overflow-y-auto min-w-56 p-2",
|
|
33815
|
+
children: availableFontFamilies.map((option) => /* @__PURE__ */ jsx93(
|
|
33777
33816
|
DropdownMenuItem,
|
|
33778
33817
|
{
|
|
33779
33818
|
label: option.label,
|
|
33780
|
-
onClick: () => editor.chain().focus().
|
|
33781
|
-
active: normalizeStyleValue(option.value) ===
|
|
33819
|
+
onClick: () => editor.chain().focus().setFontFamily(option.value).run(),
|
|
33820
|
+
active: normalizeStyleValue(option.value) === (currentFontFamily || normalizeStyleValue(defaultFontFamilyValue)),
|
|
33821
|
+
className: "font-medium"
|
|
33782
33822
|
},
|
|
33783
33823
|
option.value
|
|
33784
33824
|
))
|
|
33785
|
-
|
|
33786
|
-
|
|
33787
|
-
|
|
33788
|
-
|
|
33789
|
-
|
|
33790
|
-
|
|
33791
|
-
|
|
33792
|
-
}, title: t("toolbar.letterSpacing"), className: "gap-0.5", children: [
|
|
33793
|
-
/* @__PURE__ */ jsx92(ArrowLeft, { className: "w-3 h-3" }),
|
|
33794
|
-
/* @__PURE__ */ jsx92(ArrowRight, { className: "w-3 h-3" })
|
|
33795
|
-
] }),
|
|
33796
|
-
contentClassName: "max-h-72 overflow-y-auto p-1",
|
|
33797
|
-
children: [
|
|
33798
|
-
/* @__PURE__ */ jsx92(
|
|
33799
|
-
DropdownMenuItem,
|
|
33825
|
+
}
|
|
33826
|
+
),
|
|
33827
|
+
(isMediumFull || isFull) && /* @__PURE__ */ jsx93(
|
|
33828
|
+
DropdownMenu,
|
|
33829
|
+
{
|
|
33830
|
+
trigger: /* @__PURE__ */ jsxs75(
|
|
33831
|
+
ToolbarButton,
|
|
33800
33832
|
{
|
|
33801
|
-
|
|
33802
|
-
|
|
33803
|
-
|
|
33804
|
-
|
|
33833
|
+
onClick: () => {
|
|
33834
|
+
},
|
|
33835
|
+
title: t("toolbar.fontSize"),
|
|
33836
|
+
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",
|
|
33837
|
+
children: [
|
|
33838
|
+
/* @__PURE__ */ jsx93("span", { className: "text-sm font-normal leading-none", children: displayedFontSizeLabel }),
|
|
33839
|
+
/* @__PURE__ */ jsx93(FigmaChevronDownIcon, { className: "h-3 w-3 shrink-0 text-[#7B8184]" })
|
|
33840
|
+
]
|
|
33805
33841
|
}
|
|
33806
33842
|
),
|
|
33807
|
-
|
|
33843
|
+
contentClassName: "max-h-80 overflow-y-auto min-w-32 p-2",
|
|
33844
|
+
children: availableFontSizes.map((option) => /* @__PURE__ */ jsx93(
|
|
33808
33845
|
DropdownMenuItem,
|
|
33809
33846
|
{
|
|
33810
33847
|
label: option.label,
|
|
33811
|
-
onClick: () => editor.chain().focus().
|
|
33812
|
-
active: normalizeStyleValue(option.value) ===
|
|
33848
|
+
onClick: () => editor.chain().focus().setFontSize(option.value).run(),
|
|
33849
|
+
active: normalizeStyleValue(option.value) === activeFontSize
|
|
33813
33850
|
},
|
|
33814
33851
|
option.value
|
|
33815
33852
|
))
|
|
33816
|
-
|
|
33817
|
-
|
|
33818
|
-
|
|
33819
|
-
|
|
33820
|
-
/* @__PURE__ */ jsx92(ToolbarDivider, {}),
|
|
33821
|
-
/* @__PURE__ */ jsx92(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ jsx92(BoldIcon, { className: "w-4 h-4" }) }),
|
|
33822
|
-
/* @__PURE__ */ jsx92(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ jsx92(ItalicIcon, { className: "w-4 h-4" }) }),
|
|
33823
|
-
/* @__PURE__ */ jsx92(
|
|
33824
|
-
ToolbarButton,
|
|
33825
|
-
{
|
|
33826
|
-
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
33827
|
-
active: editor.isActive("underline"),
|
|
33828
|
-
title: t("toolbar.underline"),
|
|
33829
|
-
children: /* @__PURE__ */ jsx92(UnderlineIcon, { className: "w-4 h-4" })
|
|
33830
|
-
}
|
|
33831
|
-
),
|
|
33832
|
-
/* @__PURE__ */ jsx92(ToolbarButton, { onClick: () => editor.chain().focus().toggleStrike().run(), active: editor.isActive("strike"), title: t("toolbar.strike"), children: /* @__PURE__ */ jsx92(StrikethroughIcon, { className: "w-4 h-4" }) }),
|
|
33833
|
-
(isMediumFull || isFull) && /* @__PURE__ */ jsx92(ToolbarButton, { onClick: () => editor.chain().focus().toggleCode().run(), active: editor.isActive("code"), title: t("toolbar.code"), children: /* @__PURE__ */ jsx92(CodeIcon, { className: "w-4 h-4" }) }),
|
|
33834
|
-
isFull && /* @__PURE__ */ jsxs75(Fragment30, { children: [
|
|
33835
|
-
/* @__PURE__ */ jsx92(
|
|
33836
|
-
ToolbarButton,
|
|
33837
|
-
{
|
|
33838
|
-
onClick: () => editor.chain().focus().toggleSubscript().run(),
|
|
33839
|
-
active: editor.isActive("subscript"),
|
|
33840
|
-
title: t("toolbar.subscript"),
|
|
33841
|
-
children: /* @__PURE__ */ jsx92(SubscriptIcon, { className: "w-4 h-4" })
|
|
33842
|
-
}
|
|
33843
|
-
),
|
|
33844
|
-
/* @__PURE__ */ jsx92(
|
|
33845
|
-
ToolbarButton,
|
|
33846
|
-
{
|
|
33847
|
-
onClick: () => editor.chain().focus().toggleSuperscript().run(),
|
|
33848
|
-
active: editor.isActive("superscript"),
|
|
33849
|
-
title: t("toolbar.superscript"),
|
|
33850
|
-
children: /* @__PURE__ */ jsx92(SuperscriptIcon, { className: "w-4 h-4" })
|
|
33851
|
-
}
|
|
33852
|
-
)
|
|
33853
|
-
] }),
|
|
33854
|
-
/* @__PURE__ */ jsx92(
|
|
33855
|
-
DropdownMenu,
|
|
33856
|
-
{
|
|
33857
|
-
contentClassName: "min-w-72",
|
|
33858
|
-
trigger: /* @__PURE__ */ jsx92(ToolbarButton, { onClick: () => setShowLinkInput(!editor.isActive("link")), active: editor.isActive("link"), title: t("toolbar.link"), children: /* @__PURE__ */ jsx92(LinkIcon, { className: "w-4 h-4" }) }),
|
|
33859
|
-
children: showLinkInput ? /* @__PURE__ */ jsx92(
|
|
33860
|
-
LinkInput,
|
|
33853
|
+
}
|
|
33854
|
+
),
|
|
33855
|
+
/* @__PURE__ */ jsxs75(
|
|
33856
|
+
DropdownMenu,
|
|
33861
33857
|
{
|
|
33862
|
-
|
|
33863
|
-
|
|
33864
|
-
|
|
33865
|
-
|
|
33866
|
-
|
|
33867
|
-
|
|
33858
|
+
contentClassName: "p-1",
|
|
33859
|
+
trigger: /* @__PURE__ */ jsxs75(ToolbarButton, { onClick: () => {
|
|
33860
|
+
}, title: t("toolbar.textStyle"), className: "px-1.5 w-auto gap-0.5", children: [
|
|
33861
|
+
/* @__PURE__ */ jsx93(FigmaTextStyleIcon, { className: "h-4 w-4" }),
|
|
33862
|
+
/* @__PURE__ */ jsx93(FigmaChevronDownIcon, { className: "h-2.5 w-2.5" })
|
|
33863
|
+
] }),
|
|
33864
|
+
children: [
|
|
33865
|
+
/* @__PURE__ */ jsx93(
|
|
33866
|
+
DropdownMenuItem,
|
|
33867
|
+
{
|
|
33868
|
+
icon: Type2,
|
|
33869
|
+
label: t("toolbar.normal"),
|
|
33870
|
+
onClick: () => editor.chain().focus().setParagraph().run(),
|
|
33871
|
+
active: editor.isActive("paragraph")
|
|
33872
|
+
}
|
|
33873
|
+
),
|
|
33874
|
+
/* @__PURE__ */ jsx93(
|
|
33875
|
+
DropdownMenuItem,
|
|
33876
|
+
{
|
|
33877
|
+
icon: Heading1Icon,
|
|
33878
|
+
label: t("toolbar.heading1"),
|
|
33879
|
+
onClick: () => editor.chain().focus().toggleHeading({ level: 1 }).run(),
|
|
33880
|
+
active: editor.isActive("heading", { level: 1 }),
|
|
33881
|
+
shortcut: "Ctrl+Alt+1"
|
|
33882
|
+
}
|
|
33883
|
+
),
|
|
33884
|
+
/* @__PURE__ */ jsx93(
|
|
33885
|
+
DropdownMenuItem,
|
|
33886
|
+
{
|
|
33887
|
+
icon: Heading2Icon,
|
|
33888
|
+
label: t("toolbar.heading2"),
|
|
33889
|
+
onClick: () => editor.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
33890
|
+
active: editor.isActive("heading", { level: 2 }),
|
|
33891
|
+
shortcut: "Ctrl+Alt+2"
|
|
33892
|
+
}
|
|
33893
|
+
),
|
|
33894
|
+
/* @__PURE__ */ jsx93(
|
|
33895
|
+
DropdownMenuItem,
|
|
33896
|
+
{
|
|
33897
|
+
icon: Heading3Icon,
|
|
33898
|
+
label: t("toolbar.heading3"),
|
|
33899
|
+
onClick: () => editor.chain().focus().toggleHeading({ level: 3 }).run(),
|
|
33900
|
+
active: editor.isActive("heading", { level: 3 }),
|
|
33901
|
+
shortcut: "Ctrl+Alt+3"
|
|
33902
|
+
}
|
|
33903
|
+
)
|
|
33904
|
+
]
|
|
33868
33905
|
}
|
|
33869
|
-
)
|
|
33870
|
-
|
|
33871
|
-
|
|
33906
|
+
),
|
|
33907
|
+
isFull && /* @__PURE__ */ jsxs75(Fragment30, { children: [
|
|
33908
|
+
/* @__PURE__ */ jsxs75(
|
|
33909
|
+
DropdownMenu,
|
|
33872
33910
|
{
|
|
33873
|
-
|
|
33874
|
-
|
|
33875
|
-
|
|
33876
|
-
|
|
33877
|
-
|
|
33911
|
+
trigger: /* @__PURE__ */ jsx93(ToolbarButton, { onClick: () => {
|
|
33912
|
+
}, title: t("toolbar.lineHeight"), className: "gap-0.5", children: /* @__PURE__ */ jsx93(FigmaLineHeightIcon, { className: "h-4 w-4" }) }),
|
|
33913
|
+
contentClassName: "max-h-72 overflow-y-auto p-1",
|
|
33914
|
+
children: [
|
|
33915
|
+
/* @__PURE__ */ jsx93(
|
|
33916
|
+
DropdownMenuItem,
|
|
33917
|
+
{
|
|
33918
|
+
icon: Type2,
|
|
33919
|
+
label: t("toolbar.lineHeightDefault"),
|
|
33920
|
+
onClick: () => editor.chain().focus().unsetLineHeight().run(),
|
|
33921
|
+
active: !currentLineHeight
|
|
33922
|
+
}
|
|
33923
|
+
),
|
|
33924
|
+
availableLineHeights.map((option) => /* @__PURE__ */ jsx93(
|
|
33925
|
+
DropdownMenuItem,
|
|
33926
|
+
{
|
|
33927
|
+
label: option.label,
|
|
33928
|
+
onClick: () => editor.chain().focus().setLineHeight(option.value).run(),
|
|
33929
|
+
active: normalizeStyleValue(option.value) === currentLineHeight
|
|
33930
|
+
},
|
|
33931
|
+
option.value
|
|
33932
|
+
))
|
|
33933
|
+
]
|
|
33878
33934
|
}
|
|
33879
33935
|
),
|
|
33880
|
-
/* @__PURE__ */
|
|
33881
|
-
|
|
33936
|
+
/* @__PURE__ */ jsxs75(
|
|
33937
|
+
DropdownMenu,
|
|
33882
33938
|
{
|
|
33883
|
-
|
|
33884
|
-
|
|
33885
|
-
|
|
33886
|
-
|
|
33887
|
-
|
|
33939
|
+
trigger: /* @__PURE__ */ jsx93(ToolbarButton, { onClick: () => {
|
|
33940
|
+
}, title: t("toolbar.letterSpacing"), className: "gap-0.5", children: /* @__PURE__ */ jsx93(FigmaLetterSpacingIcon, { className: "h-4 w-4" }) }),
|
|
33941
|
+
contentClassName: "max-h-72 overflow-y-auto p-1",
|
|
33942
|
+
children: [
|
|
33943
|
+
/* @__PURE__ */ jsx93(
|
|
33944
|
+
DropdownMenuItem,
|
|
33945
|
+
{
|
|
33946
|
+
icon: Type2,
|
|
33947
|
+
label: t("toolbar.letterSpacingDefault"),
|
|
33948
|
+
onClick: () => editor.chain().focus().unsetLetterSpacing().run(),
|
|
33949
|
+
active: !currentLetterSpacing
|
|
33950
|
+
}
|
|
33951
|
+
),
|
|
33952
|
+
availableLetterSpacings.map((option) => /* @__PURE__ */ jsx93(
|
|
33953
|
+
DropdownMenuItem,
|
|
33954
|
+
{
|
|
33955
|
+
label: option.label,
|
|
33956
|
+
onClick: () => editor.chain().focus().setLetterSpacing(option.value).run(),
|
|
33957
|
+
active: normalizeStyleValue(option.value) === currentLetterSpacing
|
|
33958
|
+
},
|
|
33959
|
+
option.value
|
|
33960
|
+
))
|
|
33961
|
+
]
|
|
33888
33962
|
}
|
|
33889
33963
|
)
|
|
33890
|
-
] })
|
|
33891
|
-
}
|
|
33892
|
-
),
|
|
33893
|
-
/* @__PURE__ */ jsx92(ToolbarDivider, {}),
|
|
33894
|
-
/* @__PURE__ */ jsx92(
|
|
33895
|
-
DropdownMenu,
|
|
33896
|
-
{
|
|
33897
|
-
trigger: /* @__PURE__ */ jsxs75(ToolbarButton, { onClick: () => {
|
|
33898
|
-
}, title: t("colors.textColor"), children: [
|
|
33899
|
-
/* @__PURE__ */ jsx92(TextColorIcon, { color: currentTextColor }),
|
|
33900
|
-
/* @__PURE__ */ jsx92(ChevronDown8, { className: "w-3 h-3" })
|
|
33901
33964
|
] }),
|
|
33902
|
-
|
|
33903
|
-
|
|
33904
|
-
|
|
33905
|
-
|
|
33906
|
-
|
|
33907
|
-
onSelect: (color) => {
|
|
33908
|
-
if (color === "inherit") {
|
|
33909
|
-
editor.chain().focus().unsetColor().run();
|
|
33910
|
-
} else {
|
|
33911
|
-
editor.chain().focus().setColor(color).run();
|
|
33912
|
-
}
|
|
33913
|
-
},
|
|
33914
|
-
label: t("colors.textColor")
|
|
33915
|
-
}
|
|
33916
|
-
)
|
|
33917
|
-
}
|
|
33918
|
-
),
|
|
33919
|
-
/* @__PURE__ */ jsx92(
|
|
33920
|
-
DropdownMenu,
|
|
33921
|
-
{
|
|
33922
|
-
trigger: /* @__PURE__ */ jsxs75(ToolbarButton, { onClick: () => {
|
|
33923
|
-
}, active: editor.isActive("highlight"), title: t("colors.highlight"), children: [
|
|
33924
|
-
/* @__PURE__ */ jsx92(HighlightColorIcon, { color: currentHighlightColor }),
|
|
33925
|
-
/* @__PURE__ */ jsx92(ChevronDown8, { className: "w-3 h-3" })
|
|
33926
|
-
] }),
|
|
33927
|
-
children: /* @__PURE__ */ jsx92(
|
|
33928
|
-
EditorColorPalette,
|
|
33965
|
+
/* @__PURE__ */ jsx93(ToolbarDivider, {}),
|
|
33966
|
+
/* @__PURE__ */ jsx93(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ jsx93(FigmaBoldIcon, { className: "h-4 w-4" }) }),
|
|
33967
|
+
/* @__PURE__ */ jsx93(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ jsx93(FigmaItalicIcon, { className: "h-4 w-4" }) }),
|
|
33968
|
+
/* @__PURE__ */ jsx93(
|
|
33969
|
+
ToolbarButton,
|
|
33929
33970
|
{
|
|
33930
|
-
|
|
33931
|
-
|
|
33932
|
-
|
|
33933
|
-
|
|
33934
|
-
editor.chain().focus().unsetHighlight().run();
|
|
33935
|
-
} else {
|
|
33936
|
-
editor.chain().focus().toggleHighlight({ color }).run();
|
|
33937
|
-
}
|
|
33938
|
-
},
|
|
33939
|
-
label: t("colors.highlight")
|
|
33971
|
+
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
33972
|
+
active: editor.isActive("underline"),
|
|
33973
|
+
title: t("toolbar.underline"),
|
|
33974
|
+
children: /* @__PURE__ */ jsx93(FigmaUnderlineIcon, { className: "h-4 w-4" })
|
|
33940
33975
|
}
|
|
33941
|
-
)
|
|
33942
|
-
|
|
33943
|
-
|
|
33944
|
-
|
|
33945
|
-
|
|
33946
|
-
|
|
33947
|
-
DropdownMenu,
|
|
33948
|
-
{
|
|
33949
|
-
contentClassName: "p-0 overflow-hidden",
|
|
33950
|
-
trigger: /* @__PURE__ */ jsx92(ToolbarButton, { onClick: () => {
|
|
33951
|
-
}, title: t("toolbar.emoji"), children: /* @__PURE__ */ jsx92(Smile3, { className: "w-4 h-4" }) }),
|
|
33952
|
-
children: /* @__PURE__ */ jsx92(
|
|
33953
|
-
EmojiPicker2,
|
|
33976
|
+
),
|
|
33977
|
+
/* @__PURE__ */ jsx93(ToolbarButton, { onClick: () => editor.chain().focus().toggleStrike().run(), active: editor.isActive("strike"), title: t("toolbar.strike"), children: /* @__PURE__ */ jsx93(FigmaStrikeIcon, { className: "h-4 w-4" }) }),
|
|
33978
|
+
(isMediumFull || isFull) && /* @__PURE__ */ jsx93(ToolbarButton, { onClick: () => editor.chain().focus().toggleCode().run(), active: editor.isActive("code"), title: t("toolbar.code"), children: /* @__PURE__ */ jsx93(FigmaCodeIcon, { className: "h-4 w-4" }) }),
|
|
33979
|
+
isFull && /* @__PURE__ */ jsxs75(Fragment30, { children: [
|
|
33980
|
+
/* @__PURE__ */ jsx93(
|
|
33981
|
+
ToolbarButton,
|
|
33954
33982
|
{
|
|
33955
|
-
|
|
33956
|
-
|
|
33957
|
-
|
|
33983
|
+
onClick: () => editor.chain().focus().toggleSubscript().run(),
|
|
33984
|
+
active: editor.isActive("subscript"),
|
|
33985
|
+
title: t("toolbar.subscript"),
|
|
33986
|
+
children: /* @__PURE__ */ jsx93(FigmaSubscriptIcon, { className: "h-4 w-4" })
|
|
33987
|
+
}
|
|
33988
|
+
),
|
|
33989
|
+
/* @__PURE__ */ jsx93(
|
|
33990
|
+
ToolbarButton,
|
|
33991
|
+
{
|
|
33992
|
+
onClick: () => editor.chain().focus().toggleSuperscript().run(),
|
|
33993
|
+
active: editor.isActive("superscript"),
|
|
33994
|
+
title: t("toolbar.superscript"),
|
|
33995
|
+
children: /* @__PURE__ */ jsx93(FigmaSuperscriptIcon, { className: "h-4 w-4" })
|
|
33958
33996
|
}
|
|
33959
33997
|
)
|
|
33960
|
-
}
|
|
33961
|
-
|
|
33962
|
-
|
|
33963
|
-
|
|
33964
|
-
|
|
33965
|
-
|
|
33966
|
-
|
|
33967
|
-
|
|
33968
|
-
trigger: /* @__PURE__ */ jsxs75(ToolbarButton, { onClick: () => {
|
|
33969
|
-
}, title: t("toolbar.alignment"), children: [
|
|
33970
|
-
/* @__PURE__ */ jsx92(AlignLeft, { className: "w-4 h-4" }),
|
|
33971
|
-
/* @__PURE__ */ jsx92(ChevronDown8, { className: "w-3 h-3" })
|
|
33972
|
-
] }),
|
|
33973
|
-
children: [
|
|
33974
|
-
/* @__PURE__ */ jsx92(
|
|
33975
|
-
DropdownMenuItem,
|
|
33976
|
-
{
|
|
33977
|
-
icon: AlignLeft,
|
|
33978
|
-
label: t("toolbar.alignLeft"),
|
|
33979
|
-
onClick: () => editor.chain().focus().setTextAlign("left").run(),
|
|
33980
|
-
active: editor.isActive({ textAlign: "left" })
|
|
33981
|
-
}
|
|
33982
|
-
),
|
|
33983
|
-
/* @__PURE__ */ jsx92(
|
|
33984
|
-
DropdownMenuItem,
|
|
33985
|
-
{
|
|
33986
|
-
icon: AlignCenter,
|
|
33987
|
-
label: t("toolbar.alignCenter"),
|
|
33988
|
-
onClick: () => editor.chain().focus().setTextAlign("center").run(),
|
|
33989
|
-
active: editor.isActive({ textAlign: "center" })
|
|
33990
|
-
}
|
|
33991
|
-
),
|
|
33992
|
-
/* @__PURE__ */ jsx92(
|
|
33993
|
-
DropdownMenuItem,
|
|
33994
|
-
{
|
|
33995
|
-
icon: AlignRight,
|
|
33996
|
-
label: t("toolbar.alignRight"),
|
|
33997
|
-
onClick: () => editor.chain().focus().setTextAlign("right").run(),
|
|
33998
|
-
active: editor.isActive({ textAlign: "right" })
|
|
33999
|
-
}
|
|
34000
|
-
),
|
|
34001
|
-
/* @__PURE__ */ jsx92(
|
|
34002
|
-
DropdownMenuItem,
|
|
33998
|
+
] }),
|
|
33999
|
+
/* @__PURE__ */ jsx93(
|
|
34000
|
+
DropdownMenu,
|
|
34001
|
+
{
|
|
34002
|
+
contentClassName: "min-w-72",
|
|
34003
|
+
trigger: /* @__PURE__ */ jsx93(ToolbarButton, { onClick: () => setShowLinkInput(!editor.isActive("link")), active: editor.isActive("link"), title: t("toolbar.link"), children: /* @__PURE__ */ jsx93(FigmaLinkIcon, { className: "h-4 w-4" }) }),
|
|
34004
|
+
children: showLinkInput ? /* @__PURE__ */ jsx93(
|
|
34005
|
+
LinkInput,
|
|
34003
34006
|
{
|
|
34004
|
-
|
|
34005
|
-
|
|
34006
|
-
|
|
34007
|
-
|
|
34007
|
+
initialUrl: String(editor.getAttributes("link").href ?? ""),
|
|
34008
|
+
onSubmit: (url) => {
|
|
34009
|
+
applyEditorLink(editor, url);
|
|
34010
|
+
setShowLinkInput(false);
|
|
34011
|
+
},
|
|
34012
|
+
onCancel: () => setShowLinkInput(false)
|
|
34008
34013
|
}
|
|
34009
|
-
),
|
|
34010
|
-
|
|
34011
|
-
/* @__PURE__ */ jsx92("div", { className: "my-1 border-t" }),
|
|
34012
|
-
/* @__PURE__ */ jsx92(
|
|
34013
|
-
DropdownMenuItem,
|
|
34014
|
-
{
|
|
34015
|
-
icon: AlignStartVertical,
|
|
34016
|
-
label: t("tableMenu.alignVerticalTop") || "Align top",
|
|
34017
|
-
onClick: () => applyTableCellAttribute(editor, "verticalAlign", "top"),
|
|
34018
|
-
active: currentCellVerticalAlign === "top"
|
|
34019
|
-
}
|
|
34020
|
-
),
|
|
34021
|
-
/* @__PURE__ */ jsx92(
|
|
34014
|
+
) : /* @__PURE__ */ jsxs75(Fragment30, { children: [
|
|
34015
|
+
/* @__PURE__ */ jsx93(
|
|
34022
34016
|
DropdownMenuItem,
|
|
34023
34017
|
{
|
|
34024
|
-
icon:
|
|
34025
|
-
label: t("
|
|
34026
|
-
onClick: () =>
|
|
34027
|
-
active:
|
|
34018
|
+
icon: LinkIcon,
|
|
34019
|
+
label: t("toolbar.link"),
|
|
34020
|
+
onClick: () => setShowLinkInput(true),
|
|
34021
|
+
active: editor.isActive("link"),
|
|
34022
|
+
closeOnSelect: false
|
|
34028
34023
|
}
|
|
34029
34024
|
),
|
|
34030
|
-
/* @__PURE__ */
|
|
34025
|
+
/* @__PURE__ */ jsx93(
|
|
34031
34026
|
DropdownMenuItem,
|
|
34032
34027
|
{
|
|
34033
|
-
icon:
|
|
34034
|
-
label: t("
|
|
34035
|
-
onClick: () =>
|
|
34036
|
-
|
|
34028
|
+
icon: Trash22,
|
|
34029
|
+
label: t("toolbar.removeLink"),
|
|
34030
|
+
onClick: () => editor.chain().focus().extendMarkRange("link").unsetLink().run(),
|
|
34031
|
+
disabled: !editor.isActive("link"),
|
|
34032
|
+
destructive: true
|
|
34037
34033
|
}
|
|
34038
34034
|
)
|
|
34039
34035
|
] })
|
|
34040
|
-
|
|
34041
|
-
|
|
34042
|
-
|
|
34043
|
-
|
|
34044
|
-
|
|
34045
|
-
|
|
34046
|
-
|
|
34047
|
-
|
|
34048
|
-
|
|
34049
|
-
|
|
34050
|
-
|
|
34051
|
-
|
|
34052
|
-
|
|
34053
|
-
DropdownMenuItem,
|
|
34036
|
+
}
|
|
34037
|
+
),
|
|
34038
|
+
/* @__PURE__ */ jsx93(ToolbarDivider, {}),
|
|
34039
|
+
/* @__PURE__ */ jsx93(
|
|
34040
|
+
DropdownMenu,
|
|
34041
|
+
{
|
|
34042
|
+
trigger: /* @__PURE__ */ jsxs75(ToolbarButton, { onClick: () => {
|
|
34043
|
+
}, title: t("colors.textColor"), children: [
|
|
34044
|
+
/* @__PURE__ */ jsx93(TextColorIcon, { color: currentTextColor }),
|
|
34045
|
+
/* @__PURE__ */ jsx93(FigmaChevronDownIcon, { className: "h-2.5 w-2.5" })
|
|
34046
|
+
] }),
|
|
34047
|
+
children: /* @__PURE__ */ jsx93(
|
|
34048
|
+
EditorColorPalette,
|
|
34054
34049
|
{
|
|
34055
|
-
|
|
34056
|
-
|
|
34057
|
-
|
|
34058
|
-
|
|
34050
|
+
colors: textColors,
|
|
34051
|
+
currentColor: currentTextColor,
|
|
34052
|
+
onSelect: (color) => {
|
|
34053
|
+
if (color === "inherit") {
|
|
34054
|
+
editor.chain().focus().unsetColor().run();
|
|
34055
|
+
} else {
|
|
34056
|
+
editor.chain().focus().setColor(color).run();
|
|
34057
|
+
}
|
|
34058
|
+
},
|
|
34059
|
+
label: t("colors.textColor")
|
|
34059
34060
|
}
|
|
34060
|
-
)
|
|
34061
|
-
|
|
34062
|
-
|
|
34061
|
+
)
|
|
34062
|
+
}
|
|
34063
|
+
),
|
|
34064
|
+
/* @__PURE__ */ jsx93(
|
|
34065
|
+
DropdownMenu,
|
|
34066
|
+
{
|
|
34067
|
+
trigger: /* @__PURE__ */ jsxs75(ToolbarButton, { onClick: () => {
|
|
34068
|
+
}, active: editor.isActive("highlight"), title: t("colors.highlight"), children: [
|
|
34069
|
+
/* @__PURE__ */ jsx93(HighlightColorIcon, { color: currentHighlightColor }),
|
|
34070
|
+
/* @__PURE__ */ jsx93(FigmaChevronDownIcon, { className: "h-2.5 w-2.5" })
|
|
34071
|
+
] }),
|
|
34072
|
+
children: /* @__PURE__ */ jsx93(
|
|
34073
|
+
EditorColorPalette,
|
|
34063
34074
|
{
|
|
34064
|
-
|
|
34065
|
-
|
|
34066
|
-
|
|
34067
|
-
|
|
34075
|
+
colors: highlightColors,
|
|
34076
|
+
currentColor: currentHighlightColor,
|
|
34077
|
+
onSelect: (color) => {
|
|
34078
|
+
if (color === "") {
|
|
34079
|
+
editor.chain().focus().unsetHighlight().run();
|
|
34080
|
+
} else {
|
|
34081
|
+
editor.chain().focus().toggleHighlight({ color }).run();
|
|
34082
|
+
}
|
|
34083
|
+
},
|
|
34084
|
+
label: t("colors.highlight")
|
|
34068
34085
|
}
|
|
34069
34086
|
)
|
|
34070
|
-
|
|
34071
|
-
|
|
34072
|
-
|
|
34073
|
-
|
|
34074
|
-
|
|
34075
|
-
|
|
34076
|
-
DropdownMenu,
|
|
34077
|
-
{
|
|
34078
|
-
trigger: /* @__PURE__ */ jsxs75(ToolbarButton, { onClick: () => {
|
|
34079
|
-
}, title: t("toolbar.bulletList"), children: [
|
|
34080
|
-
/* @__PURE__ */ jsx92(ListIcon, { className: "w-4 h-4" }),
|
|
34081
|
-
/* @__PURE__ */ jsx92(ChevronDown8, { className: "w-3 h-3" })
|
|
34082
|
-
] }),
|
|
34083
|
-
children: [
|
|
34084
|
-
/* @__PURE__ */ jsx92(
|
|
34085
|
-
DropdownMenuItem,
|
|
34086
|
-
{
|
|
34087
|
-
icon: ListIcon,
|
|
34088
|
-
label: t("toolbar.bulletList"),
|
|
34089
|
-
onClick: () => editor.chain().focus().toggleBulletList().run(),
|
|
34090
|
-
active: editor.isActive("bulletList"),
|
|
34091
|
-
shortcut: "Ctrl+Shift+8"
|
|
34092
|
-
}
|
|
34093
|
-
),
|
|
34094
|
-
/* @__PURE__ */ jsx92(
|
|
34095
|
-
DropdownMenuItem,
|
|
34096
|
-
{
|
|
34097
|
-
icon: ListOrderedIcon,
|
|
34098
|
-
label: t("toolbar.orderedList"),
|
|
34099
|
-
onClick: () => editor.chain().focus().toggleOrderedList().run(),
|
|
34100
|
-
active: editor.isActive("orderedList"),
|
|
34101
|
-
shortcut: "Ctrl+Shift+7"
|
|
34102
|
-
}
|
|
34103
|
-
),
|
|
34104
|
-
/* @__PURE__ */ jsx92(
|
|
34105
|
-
DropdownMenuItem,
|
|
34106
|
-
{
|
|
34107
|
-
icon: ListTodo2,
|
|
34108
|
-
label: t("toolbar.taskList"),
|
|
34109
|
-
onClick: () => editor.chain().focus().toggleTaskList().run(),
|
|
34110
|
-
active: editor.isActive("taskList"),
|
|
34111
|
-
shortcut: "Ctrl+Shift+9"
|
|
34112
|
-
}
|
|
34113
|
-
)
|
|
34114
|
-
]
|
|
34115
|
-
}
|
|
34116
|
-
),
|
|
34117
|
-
/* @__PURE__ */ jsxs75(
|
|
34118
|
-
DropdownMenu,
|
|
34119
|
-
{
|
|
34120
|
-
trigger: /* @__PURE__ */ jsxs75(ToolbarButton, { onClick: () => {
|
|
34121
|
-
}, active: editor.isActive("formCheckbox"), title: t("slashCommand.formCheckbox"), children: [
|
|
34122
|
-
/* @__PURE__ */ jsx92(SquareCheckBig, { className: "w-4 h-4" }),
|
|
34123
|
-
/* @__PURE__ */ jsx92(ChevronDown8, { className: "w-3 h-3" })
|
|
34124
|
-
] }),
|
|
34125
|
-
children: [
|
|
34126
|
-
/* @__PURE__ */ jsx92(
|
|
34127
|
-
DropdownMenuItem,
|
|
34128
|
-
{
|
|
34129
|
-
icon: SquareCheckBig,
|
|
34130
|
-
label: t("slashCommand.formCheckbox"),
|
|
34131
|
-
onClick: () => editor.chain().focus().setFormCheckbox().run()
|
|
34132
|
-
}
|
|
34133
|
-
),
|
|
34134
|
-
/* @__PURE__ */ jsx92(
|
|
34135
|
-
DropdownMenuItem,
|
|
34087
|
+
}
|
|
34088
|
+
),
|
|
34089
|
+
(isMediumFull || isFull) && /* @__PURE__ */ jsxs75(Fragment30, { children: [
|
|
34090
|
+
/* @__PURE__ */ jsx93(ToolbarDivider, {}),
|
|
34091
|
+
/* @__PURE__ */ jsx93(
|
|
34092
|
+
DropdownMenu,
|
|
34136
34093
|
{
|
|
34137
|
-
|
|
34138
|
-
|
|
34139
|
-
|
|
34094
|
+
contentClassName: "p-0 overflow-hidden",
|
|
34095
|
+
trigger: /* @__PURE__ */ jsx93(ToolbarButton, { onClick: () => {
|
|
34096
|
+
}, title: t("toolbar.emoji"), children: /* @__PURE__ */ jsx93(FigmaSmileIcon, { className: "h-4 w-4" }) }),
|
|
34097
|
+
children: /* @__PURE__ */ jsx93(
|
|
34098
|
+
EmojiPicker2,
|
|
34099
|
+
{
|
|
34100
|
+
onSelect: (emoji) => {
|
|
34101
|
+
editor.chain().focus().insertContent(emoji).run();
|
|
34102
|
+
}
|
|
34103
|
+
}
|
|
34104
|
+
)
|
|
34140
34105
|
}
|
|
34141
34106
|
)
|
|
34142
|
-
]
|
|
34143
|
-
}
|
|
34144
|
-
),
|
|
34145
|
-
isMediumFull && /* @__PURE__ */ jsx92(ToolbarButton, { onClick: () => editor.chain().focus().toggleBlockquote().run(), active: editor.isActive("blockquote"), title: t("toolbar.quote"), children: /* @__PURE__ */ jsx92(QuoteIcon, { className: "w-4 h-4" }) }),
|
|
34146
|
-
isFull && /* @__PURE__ */ jsxs75(
|
|
34147
|
-
DropdownMenu,
|
|
34148
|
-
{
|
|
34149
|
-
trigger: /* @__PURE__ */ jsxs75(ToolbarButton, { onClick: () => {
|
|
34150
|
-
}, title: t("toolbar.quote"), children: [
|
|
34151
|
-
/* @__PURE__ */ jsx92(QuoteIcon, { className: "w-4 h-4" }),
|
|
34152
|
-
/* @__PURE__ */ jsx92(ChevronDown8, { className: "w-3 h-3" })
|
|
34153
34107
|
] }),
|
|
34154
|
-
children: [
|
|
34155
|
-
/* @__PURE__ */
|
|
34156
|
-
|
|
34108
|
+
(isMediumFull || isFull) && /* @__PURE__ */ jsxs75(Fragment30, { children: [
|
|
34109
|
+
/* @__PURE__ */ jsx93(ToolbarDivider, {}),
|
|
34110
|
+
/* @__PURE__ */ jsxs75(
|
|
34111
|
+
DropdownMenu,
|
|
34157
34112
|
{
|
|
34158
|
-
|
|
34159
|
-
|
|
34160
|
-
|
|
34161
|
-
|
|
34162
|
-
|
|
34113
|
+
trigger: /* @__PURE__ */ jsxs75(ToolbarButton, { onClick: () => {
|
|
34114
|
+
}, title: t("toolbar.alignment"), children: [
|
|
34115
|
+
/* @__PURE__ */ jsx93(FigmaAlignLeftIcon, { className: "h-4 w-4" }),
|
|
34116
|
+
/* @__PURE__ */ jsx93(FigmaChevronDownIcon, { className: "h-2.5 w-2.5" })
|
|
34117
|
+
] }),
|
|
34118
|
+
children: [
|
|
34119
|
+
/* @__PURE__ */ jsx93(
|
|
34120
|
+
DropdownMenuItem,
|
|
34121
|
+
{
|
|
34122
|
+
icon: AlignLeft,
|
|
34123
|
+
label: t("toolbar.alignLeft"),
|
|
34124
|
+
onClick: () => editor.chain().focus().setTextAlign("left").run(),
|
|
34125
|
+
active: editor.isActive({ textAlign: "left" })
|
|
34126
|
+
}
|
|
34127
|
+
),
|
|
34128
|
+
/* @__PURE__ */ jsx93(
|
|
34129
|
+
DropdownMenuItem,
|
|
34130
|
+
{
|
|
34131
|
+
icon: AlignCenter,
|
|
34132
|
+
label: t("toolbar.alignCenter"),
|
|
34133
|
+
onClick: () => editor.chain().focus().setTextAlign("center").run(),
|
|
34134
|
+
active: editor.isActive({ textAlign: "center" })
|
|
34135
|
+
}
|
|
34136
|
+
),
|
|
34137
|
+
/* @__PURE__ */ jsx93(
|
|
34138
|
+
DropdownMenuItem,
|
|
34139
|
+
{
|
|
34140
|
+
icon: AlignRight,
|
|
34141
|
+
label: t("toolbar.alignRight"),
|
|
34142
|
+
onClick: () => editor.chain().focus().setTextAlign("right").run(),
|
|
34143
|
+
active: editor.isActive({ textAlign: "right" })
|
|
34144
|
+
}
|
|
34145
|
+
),
|
|
34146
|
+
/* @__PURE__ */ jsx93(
|
|
34147
|
+
DropdownMenuItem,
|
|
34148
|
+
{
|
|
34149
|
+
icon: AlignJustify,
|
|
34150
|
+
label: t("toolbar.justify"),
|
|
34151
|
+
onClick: () => editor.chain().focus().setTextAlign("justify").run(),
|
|
34152
|
+
active: editor.isActive({ textAlign: "justify" })
|
|
34153
|
+
}
|
|
34154
|
+
),
|
|
34155
|
+
hasTableContext && /* @__PURE__ */ jsxs75(Fragment30, { children: [
|
|
34156
|
+
/* @__PURE__ */ jsx93("div", { className: "my-1 border-t" }),
|
|
34157
|
+
/* @__PURE__ */ jsx93(
|
|
34158
|
+
DropdownMenuItem,
|
|
34159
|
+
{
|
|
34160
|
+
icon: AlignStartVertical,
|
|
34161
|
+
label: t("tableMenu.alignVerticalTop") || "Align top",
|
|
34162
|
+
onClick: () => applyTableCellAttribute(editor, "verticalAlign", "top"),
|
|
34163
|
+
active: currentCellVerticalAlign === "top"
|
|
34164
|
+
}
|
|
34165
|
+
),
|
|
34166
|
+
/* @__PURE__ */ jsx93(
|
|
34167
|
+
DropdownMenuItem,
|
|
34168
|
+
{
|
|
34169
|
+
icon: AlignCenterVertical,
|
|
34170
|
+
label: t("tableMenu.alignVerticalMiddle") || "Align middle",
|
|
34171
|
+
onClick: () => applyTableCellAttribute(editor, "verticalAlign", "middle"),
|
|
34172
|
+
active: currentCellVerticalAlign === "middle"
|
|
34173
|
+
}
|
|
34174
|
+
),
|
|
34175
|
+
/* @__PURE__ */ jsx93(
|
|
34176
|
+
DropdownMenuItem,
|
|
34177
|
+
{
|
|
34178
|
+
icon: AlignEndVertical,
|
|
34179
|
+
label: t("tableMenu.alignVerticalBottom") || "Align bottom",
|
|
34180
|
+
onClick: () => applyTableCellAttribute(editor, "verticalAlign", "bottom"),
|
|
34181
|
+
active: currentCellVerticalAlign === "bottom"
|
|
34182
|
+
}
|
|
34183
|
+
)
|
|
34184
|
+
] })
|
|
34185
|
+
]
|
|
34163
34186
|
}
|
|
34164
34187
|
),
|
|
34165
|
-
/* @__PURE__ */
|
|
34166
|
-
|
|
34188
|
+
hasTableContext && /* @__PURE__ */ jsxs75(
|
|
34189
|
+
DropdownMenu,
|
|
34167
34190
|
{
|
|
34168
|
-
|
|
34169
|
-
|
|
34170
|
-
|
|
34171
|
-
|
|
34172
|
-
|
|
34191
|
+
trigger: /* @__PURE__ */ jsxs75(ToolbarButton, { onClick: () => {
|
|
34192
|
+
}, title: t("tableMenu.textDirection"), children: [
|
|
34193
|
+
currentCellTextDirection === "vertical" ? /* @__PURE__ */ jsx93(ArrowDown, { className: "w-4 h-4" }) : /* @__PURE__ */ jsx93(ArrowRight, { className: "w-4 h-4" }),
|
|
34194
|
+
/* @__PURE__ */ jsx93(ChevronDown8, { className: "w-3 h-3" })
|
|
34195
|
+
] }),
|
|
34196
|
+
children: [
|
|
34197
|
+
/* @__PURE__ */ jsx93(
|
|
34198
|
+
DropdownMenuItem,
|
|
34199
|
+
{
|
|
34200
|
+
icon: ArrowRight,
|
|
34201
|
+
label: t("tableMenu.horizontalText"),
|
|
34202
|
+
onClick: () => applyTableCellAttribute(editor, "textDirection", null),
|
|
34203
|
+
active: currentCellTextDirection === "horizontal"
|
|
34204
|
+
}
|
|
34205
|
+
),
|
|
34206
|
+
/* @__PURE__ */ jsx93(
|
|
34207
|
+
DropdownMenuItem,
|
|
34208
|
+
{
|
|
34209
|
+
icon: ArrowDown,
|
|
34210
|
+
label: t("tableMenu.verticalText"),
|
|
34211
|
+
onClick: () => applyTableCellAttribute(editor, "textDirection", "vertical"),
|
|
34212
|
+
active: currentCellTextDirection === "vertical"
|
|
34213
|
+
}
|
|
34214
|
+
)
|
|
34215
|
+
]
|
|
34173
34216
|
}
|
|
34174
34217
|
)
|
|
34175
|
-
]
|
|
34176
|
-
}
|
|
34177
|
-
),
|
|
34178
|
-
(isMediumFull || isFull) && /* @__PURE__ */ jsx92(
|
|
34179
|
-
DropdownMenu,
|
|
34180
|
-
{
|
|
34181
|
-
trigger: /* @__PURE__ */ jsxs75(ToolbarButton, { onClick: () => {
|
|
34182
|
-
}, title: t("toolbar.image"), children: [
|
|
34183
|
-
/* @__PURE__ */ jsx92(ImageIcon2, { className: "w-4 h-4" }),
|
|
34184
|
-
/* @__PURE__ */ jsx92(ChevronDown8, { className: "w-3 h-3" })
|
|
34185
34218
|
] }),
|
|
34186
|
-
|
|
34187
|
-
|
|
34219
|
+
/* @__PURE__ */ jsx93(ToolbarDivider, {}),
|
|
34220
|
+
/* @__PURE__ */ jsxs75(
|
|
34221
|
+
DropdownMenu,
|
|
34222
|
+
{
|
|
34223
|
+
trigger: /* @__PURE__ */ jsxs75(ToolbarButton, { onClick: () => {
|
|
34224
|
+
}, title: t("toolbar.bulletList"), children: [
|
|
34225
|
+
/* @__PURE__ */ jsx93(FigmaListIcon, { className: "h-4 w-4" }),
|
|
34226
|
+
/* @__PURE__ */ jsx93(FigmaChevronDownIcon, { className: "h-2.5 w-2.5" })
|
|
34227
|
+
] }),
|
|
34228
|
+
children: [
|
|
34229
|
+
/* @__PURE__ */ jsx93(
|
|
34230
|
+
DropdownMenuItem,
|
|
34231
|
+
{
|
|
34232
|
+
icon: ListIcon,
|
|
34233
|
+
label: t("toolbar.bulletList"),
|
|
34234
|
+
onClick: () => editor.chain().focus().toggleBulletList().run(),
|
|
34235
|
+
active: editor.isActive("bulletList"),
|
|
34236
|
+
shortcut: "Ctrl+Shift+8"
|
|
34237
|
+
}
|
|
34238
|
+
),
|
|
34239
|
+
/* @__PURE__ */ jsx93(
|
|
34240
|
+
DropdownMenuItem,
|
|
34241
|
+
{
|
|
34242
|
+
icon: ListOrderedIcon,
|
|
34243
|
+
label: t("toolbar.orderedList"),
|
|
34244
|
+
onClick: () => editor.chain().focus().toggleOrderedList().run(),
|
|
34245
|
+
active: editor.isActive("orderedList"),
|
|
34246
|
+
shortcut: "Ctrl+Shift+7"
|
|
34247
|
+
}
|
|
34248
|
+
),
|
|
34249
|
+
/* @__PURE__ */ jsx93(
|
|
34250
|
+
DropdownMenuItem,
|
|
34251
|
+
{
|
|
34252
|
+
icon: ListTodo2,
|
|
34253
|
+
label: t("toolbar.taskList"),
|
|
34254
|
+
onClick: () => editor.chain().focus().toggleTaskList().run(),
|
|
34255
|
+
active: editor.isActive("taskList"),
|
|
34256
|
+
shortcut: "Ctrl+Shift+9"
|
|
34257
|
+
}
|
|
34258
|
+
)
|
|
34259
|
+
]
|
|
34260
|
+
}
|
|
34261
|
+
),
|
|
34262
|
+
/* @__PURE__ */ jsxs75(
|
|
34263
|
+
DropdownMenu,
|
|
34264
|
+
{
|
|
34265
|
+
trigger: /* @__PURE__ */ jsxs75(ToolbarButton, { onClick: () => {
|
|
34266
|
+
}, active: editor.isActive("formCheckbox"), title: t("slashCommand.formCheckbox"), children: [
|
|
34267
|
+
/* @__PURE__ */ jsx93(SquareCheckBig, { className: "w-4 h-4" }),
|
|
34268
|
+
/* @__PURE__ */ jsx93(ChevronDown8, { className: "w-3 h-3" })
|
|
34269
|
+
] }),
|
|
34270
|
+
children: [
|
|
34271
|
+
/* @__PURE__ */ jsx93(
|
|
34272
|
+
DropdownMenuItem,
|
|
34273
|
+
{
|
|
34274
|
+
icon: SquareCheckBig,
|
|
34275
|
+
label: t("slashCommand.formCheckbox"),
|
|
34276
|
+
onClick: () => editor.chain().focus().setFormCheckbox().run()
|
|
34277
|
+
}
|
|
34278
|
+
),
|
|
34279
|
+
/* @__PURE__ */ jsx93(
|
|
34280
|
+
DropdownMenuItem,
|
|
34281
|
+
{
|
|
34282
|
+
icon: CircleCheckBig2,
|
|
34283
|
+
label: t("slashCommand.roundCheckbox"),
|
|
34284
|
+
onClick: () => editor.chain().focus().setFormCheckbox({ variant: "circle" }).run()
|
|
34285
|
+
}
|
|
34286
|
+
)
|
|
34287
|
+
]
|
|
34288
|
+
}
|
|
34289
|
+
),
|
|
34290
|
+
isMediumFull && /* @__PURE__ */ jsx93(ToolbarButton, { onClick: () => editor.chain().focus().toggleBlockquote().run(), active: editor.isActive("blockquote"), title: t("toolbar.quote"), children: /* @__PURE__ */ jsx93(FigmaQuoteIcon, { className: "h-4 w-4" }) }),
|
|
34291
|
+
isFull && /* @__PURE__ */ jsxs75(
|
|
34292
|
+
DropdownMenu,
|
|
34293
|
+
{
|
|
34294
|
+
trigger: /* @__PURE__ */ jsxs75(ToolbarButton, { onClick: () => {
|
|
34295
|
+
}, title: t("toolbar.quote"), children: [
|
|
34296
|
+
/* @__PURE__ */ jsx93(FigmaQuoteIcon, { className: "h-4 w-4" }),
|
|
34297
|
+
/* @__PURE__ */ jsx93(FigmaChevronDownIcon, { className: "h-2.5 w-2.5" })
|
|
34298
|
+
] }),
|
|
34299
|
+
children: [
|
|
34300
|
+
/* @__PURE__ */ jsx93(
|
|
34301
|
+
DropdownMenuItem,
|
|
34302
|
+
{
|
|
34303
|
+
icon: QuoteIcon,
|
|
34304
|
+
label: t("toolbar.quote"),
|
|
34305
|
+
onClick: () => editor.chain().focus().toggleBlockquote().run(),
|
|
34306
|
+
active: editor.isActive("blockquote"),
|
|
34307
|
+
shortcut: "Ctrl+Shift+B"
|
|
34308
|
+
}
|
|
34309
|
+
),
|
|
34310
|
+
/* @__PURE__ */ jsx93(
|
|
34311
|
+
DropdownMenuItem,
|
|
34312
|
+
{
|
|
34313
|
+
icon: FileCode3,
|
|
34314
|
+
label: t("toolbar.codeBlock"),
|
|
34315
|
+
onClick: () => editor.chain().focus().toggleCodeBlock().run(),
|
|
34316
|
+
active: editor.isActive("codeBlock"),
|
|
34317
|
+
shortcut: "Ctrl+Alt+C"
|
|
34318
|
+
}
|
|
34319
|
+
)
|
|
34320
|
+
]
|
|
34321
|
+
}
|
|
34322
|
+
),
|
|
34323
|
+
(isMediumFull || isFull) && /* @__PURE__ */ jsx93(
|
|
34324
|
+
DropdownMenu,
|
|
34325
|
+
{
|
|
34326
|
+
trigger: /* @__PURE__ */ jsxs75(ToolbarButton, { onClick: () => {
|
|
34327
|
+
}, title: t("toolbar.image"), children: [
|
|
34328
|
+
/* @__PURE__ */ jsx93(FigmaImageIcon, { className: "h-4 w-4" }),
|
|
34329
|
+
/* @__PURE__ */ jsx93(FigmaChevronDownIcon, { className: "h-2.5 w-2.5" })
|
|
34330
|
+
] }),
|
|
34331
|
+
children: showImageInput ? /* @__PURE__ */ jsx93(
|
|
34332
|
+
ImageInput,
|
|
34333
|
+
{
|
|
34334
|
+
onSubmit: (url, alt) => {
|
|
34335
|
+
editor.chain().focus().setImage({ src: url, alt }).run();
|
|
34336
|
+
setShowImageInput(false);
|
|
34337
|
+
},
|
|
34338
|
+
onCancel: () => setShowImageInput(false)
|
|
34339
|
+
}
|
|
34340
|
+
) : /* @__PURE__ */ jsxs75(Fragment30, { children: [
|
|
34341
|
+
/* @__PURE__ */ jsx93(DropdownMenuItem, { icon: LinkIcon, label: t("imageInput.addFromUrl"), onClick: () => setShowImageInput(true), closeOnSelect: false }),
|
|
34342
|
+
/* @__PURE__ */ jsx93(
|
|
34343
|
+
DropdownMenuItem,
|
|
34344
|
+
{
|
|
34345
|
+
icon: Upload3,
|
|
34346
|
+
label: isUploadingImage ? t("imageInput.uploading") : t("imageInput.uploadTab"),
|
|
34347
|
+
disabled: isUploadingImage,
|
|
34348
|
+
onClick: () => fileInputRef.current?.click(),
|
|
34349
|
+
closeOnSelect: false
|
|
34350
|
+
}
|
|
34351
|
+
),
|
|
34352
|
+
imageUploadError && /* @__PURE__ */ jsx93(DropdownMenuItem, { label: imageUploadError, disabled: true, destructive: true }),
|
|
34353
|
+
/* @__PURE__ */ jsx93(
|
|
34354
|
+
"input",
|
|
34355
|
+
{
|
|
34356
|
+
ref: fileInputRef,
|
|
34357
|
+
type: "file",
|
|
34358
|
+
accept: "image/*",
|
|
34359
|
+
multiple: true,
|
|
34360
|
+
className: "hidden",
|
|
34361
|
+
onChange: (e) => {
|
|
34362
|
+
const files = Array.from(e.target.files ?? []);
|
|
34363
|
+
e.target.value = "";
|
|
34364
|
+
void insertImageFiles(files);
|
|
34365
|
+
}
|
|
34366
|
+
}
|
|
34367
|
+
),
|
|
34368
|
+
/* @__PURE__ */ jsx93("div", { className: "my-1 border-t" }),
|
|
34369
|
+
/* @__PURE__ */ jsx93(
|
|
34370
|
+
DropdownMenuItem,
|
|
34371
|
+
{
|
|
34372
|
+
icon: AlignCenter,
|
|
34373
|
+
label: t("toolbar.imageLayoutBlock"),
|
|
34374
|
+
onClick: () => applyImageLayout(editor, "block"),
|
|
34375
|
+
active: isImageSelected && imageLayout === "block",
|
|
34376
|
+
disabled: !isImageSelected
|
|
34377
|
+
}
|
|
34378
|
+
),
|
|
34379
|
+
/* @__PURE__ */ jsx93(
|
|
34380
|
+
DropdownMenuItem,
|
|
34381
|
+
{
|
|
34382
|
+
icon: AlignLeft,
|
|
34383
|
+
label: t("toolbar.imageLayoutLeft"),
|
|
34384
|
+
onClick: () => applyImageLayout(editor, "left"),
|
|
34385
|
+
active: isImageSelected && imageLayout === "left",
|
|
34386
|
+
disabled: !isImageSelected
|
|
34387
|
+
}
|
|
34388
|
+
),
|
|
34389
|
+
/* @__PURE__ */ jsx93(
|
|
34390
|
+
DropdownMenuItem,
|
|
34391
|
+
{
|
|
34392
|
+
icon: AlignRight,
|
|
34393
|
+
label: t("toolbar.imageLayoutRight"),
|
|
34394
|
+
onClick: () => applyImageLayout(editor, "right"),
|
|
34395
|
+
active: isImageSelected && imageLayout === "right",
|
|
34396
|
+
disabled: !isImageSelected
|
|
34397
|
+
}
|
|
34398
|
+
),
|
|
34399
|
+
/* @__PURE__ */ jsx93("div", { className: "my-1 border-t" }),
|
|
34400
|
+
/* @__PURE__ */ jsx93(
|
|
34401
|
+
DropdownMenuItem,
|
|
34402
|
+
{
|
|
34403
|
+
label: t("toolbar.imageWidthSm"),
|
|
34404
|
+
onClick: () => applyImageWidthPreset(editor, "sm"),
|
|
34405
|
+
active: isImageSelected && imageWidthPreset === "sm",
|
|
34406
|
+
disabled: !isImageSelected
|
|
34407
|
+
}
|
|
34408
|
+
),
|
|
34409
|
+
/* @__PURE__ */ jsx93(
|
|
34410
|
+
DropdownMenuItem,
|
|
34411
|
+
{
|
|
34412
|
+
label: t("toolbar.imageWidthMd"),
|
|
34413
|
+
onClick: () => applyImageWidthPreset(editor, "md"),
|
|
34414
|
+
active: isImageSelected && imageWidthPreset === "md",
|
|
34415
|
+
disabled: !isImageSelected
|
|
34416
|
+
}
|
|
34417
|
+
),
|
|
34418
|
+
/* @__PURE__ */ jsx93(
|
|
34419
|
+
DropdownMenuItem,
|
|
34420
|
+
{
|
|
34421
|
+
label: t("toolbar.imageWidthLg"),
|
|
34422
|
+
onClick: () => applyImageWidthPreset(editor, "lg"),
|
|
34423
|
+
active: isImageSelected && imageWidthPreset === "lg",
|
|
34424
|
+
disabled: !isImageSelected
|
|
34425
|
+
}
|
|
34426
|
+
),
|
|
34427
|
+
/* @__PURE__ */ jsx93("div", { className: "my-1 border-t" }),
|
|
34428
|
+
/* @__PURE__ */ jsx93(
|
|
34429
|
+
DropdownMenuItem,
|
|
34430
|
+
{
|
|
34431
|
+
icon: RotateCcw2,
|
|
34432
|
+
label: t("toolbar.imageResetSize"),
|
|
34433
|
+
onClick: () => resetImageSize(editor),
|
|
34434
|
+
disabled: !isImageSelected
|
|
34435
|
+
}
|
|
34436
|
+
),
|
|
34437
|
+
/* @__PURE__ */ jsx93(
|
|
34438
|
+
DropdownMenuItem,
|
|
34439
|
+
{
|
|
34440
|
+
icon: Trash22,
|
|
34441
|
+
label: t("toolbar.imageDelete"),
|
|
34442
|
+
onClick: () => deleteSelectedImage(editor),
|
|
34443
|
+
disabled: !isImageSelected,
|
|
34444
|
+
destructive: true
|
|
34445
|
+
}
|
|
34446
|
+
)
|
|
34447
|
+
] })
|
|
34448
|
+
}
|
|
34449
|
+
),
|
|
34450
|
+
(isMediumFull || isFull) && /* @__PURE__ */ jsxs75(
|
|
34451
|
+
DropdownMenu,
|
|
34188
34452
|
{
|
|
34189
|
-
|
|
34190
|
-
|
|
34191
|
-
|
|
34453
|
+
isOpen: isTableMenuOpen,
|
|
34454
|
+
onOpenChange: (open) => {
|
|
34455
|
+
setIsTableMenuOpen(open);
|
|
34456
|
+
setPreservedTableAnchorPos(open ? getTableAnchorPos(editor) : null);
|
|
34192
34457
|
},
|
|
34193
|
-
|
|
34458
|
+
trigger: /* @__PURE__ */ jsxs75(ToolbarButton, { onClick: () => {
|
|
34459
|
+
}, title: t("toolbar.table"), children: [
|
|
34460
|
+
/* @__PURE__ */ jsx93(FigmaTableIcon, { className: "h-4 w-4" }),
|
|
34461
|
+
/* @__PURE__ */ jsx93(FigmaChevronDownIcon, { className: "h-2.5 w-2.5" })
|
|
34462
|
+
] }),
|
|
34463
|
+
contentClassName: "p-2 min-w-56",
|
|
34464
|
+
children: [
|
|
34465
|
+
/* @__PURE__ */ jsx93(
|
|
34466
|
+
TableInsertGrid,
|
|
34467
|
+
{
|
|
34468
|
+
insertLabel: t("tableMenu.insertTable"),
|
|
34469
|
+
previewTemplate: t("tableMenu.gridPreview"),
|
|
34470
|
+
onInsert: (rows, cols) => {
|
|
34471
|
+
editor.chain().focus().insertTable({ rows, cols, withHeaderRow: true }).run();
|
|
34472
|
+
setIsTableMenuOpen(false);
|
|
34473
|
+
setPreservedTableAnchorPos(null);
|
|
34474
|
+
}
|
|
34475
|
+
}
|
|
34476
|
+
),
|
|
34477
|
+
/* @__PURE__ */ jsx93("div", { className: "my-1 border-t" }),
|
|
34478
|
+
/* @__PURE__ */ jsx93(
|
|
34479
|
+
DropdownMenuItem,
|
|
34480
|
+
{
|
|
34481
|
+
icon: AlignLeft,
|
|
34482
|
+
label: t("tableMenu.alignLeft"),
|
|
34483
|
+
onClick: () => applyTableAlignment(editor, "left", tableCommandAnchorPos),
|
|
34484
|
+
active: hasTableContext && currentTableAlign === "left",
|
|
34485
|
+
disabled: !hasTableContext
|
|
34486
|
+
}
|
|
34487
|
+
),
|
|
34488
|
+
/* @__PURE__ */ jsx93(
|
|
34489
|
+
DropdownMenuItem,
|
|
34490
|
+
{
|
|
34491
|
+
icon: AlignCenter,
|
|
34492
|
+
label: t("tableMenu.alignCenter"),
|
|
34493
|
+
onClick: () => applyTableAlignment(editor, "center", tableCommandAnchorPos),
|
|
34494
|
+
active: hasTableContext && currentTableAlign === "center",
|
|
34495
|
+
disabled: !hasTableContext
|
|
34496
|
+
}
|
|
34497
|
+
),
|
|
34498
|
+
/* @__PURE__ */ jsx93(
|
|
34499
|
+
DropdownMenuItem,
|
|
34500
|
+
{
|
|
34501
|
+
icon: AlignRight,
|
|
34502
|
+
label: t("tableMenu.alignRight"),
|
|
34503
|
+
onClick: () => applyTableAlignment(editor, "right", tableCommandAnchorPos),
|
|
34504
|
+
active: hasTableContext && currentTableAlign === "right",
|
|
34505
|
+
disabled: !hasTableContext
|
|
34506
|
+
}
|
|
34507
|
+
),
|
|
34508
|
+
/* @__PURE__ */ jsx93("div", { className: "my-1 border-t" }),
|
|
34509
|
+
/* @__PURE__ */ jsx93(
|
|
34510
|
+
DropdownMenuItem,
|
|
34511
|
+
{
|
|
34512
|
+
icon: ArrowLeft,
|
|
34513
|
+
label: t("tableMenu.addColumnBefore"),
|
|
34514
|
+
onClick: () => editor.chain().focus().addColumnBefore().run(),
|
|
34515
|
+
disabled: !hasTableContext || !editor.can().addColumnBefore()
|
|
34516
|
+
}
|
|
34517
|
+
),
|
|
34518
|
+
/* @__PURE__ */ jsx93(
|
|
34519
|
+
DropdownMenuItem,
|
|
34520
|
+
{
|
|
34521
|
+
icon: ArrowDown,
|
|
34522
|
+
label: t("tableMenu.addColumnAfter"),
|
|
34523
|
+
onClick: () => editor.chain().focus().addColumnAfter().run(),
|
|
34524
|
+
disabled: !hasTableContext || !editor.can().addColumnAfter()
|
|
34525
|
+
}
|
|
34526
|
+
),
|
|
34527
|
+
/* @__PURE__ */ jsx93(
|
|
34528
|
+
DropdownMenuItem,
|
|
34529
|
+
{
|
|
34530
|
+
icon: ArrowUp,
|
|
34531
|
+
label: t("tableMenu.addRowBefore"),
|
|
34532
|
+
onClick: () => editor.chain().focus().addRowBefore().run(),
|
|
34533
|
+
disabled: !hasTableContext || !editor.can().addRowBefore()
|
|
34534
|
+
}
|
|
34535
|
+
),
|
|
34536
|
+
/* @__PURE__ */ jsx93(
|
|
34537
|
+
DropdownMenuItem,
|
|
34538
|
+
{
|
|
34539
|
+
icon: ArrowRight,
|
|
34540
|
+
label: t("tableMenu.addRowAfter"),
|
|
34541
|
+
onClick: () => editor.chain().focus().addRowAfter().run(),
|
|
34542
|
+
disabled: !hasTableContext || !editor.can().addRowAfter()
|
|
34543
|
+
}
|
|
34544
|
+
),
|
|
34545
|
+
/* @__PURE__ */ jsx93("div", { className: "my-1 border-t" }),
|
|
34546
|
+
/* @__PURE__ */ jsx93(
|
|
34547
|
+
DropdownMenuItem,
|
|
34548
|
+
{
|
|
34549
|
+
icon: TableIcon,
|
|
34550
|
+
label: t("tableMenu.toggleHeaderRow"),
|
|
34551
|
+
onClick: () => editor.chain().focus().toggleHeaderRow().run(),
|
|
34552
|
+
disabled: !hasTableContext || !editor.can().toggleHeaderRow()
|
|
34553
|
+
}
|
|
34554
|
+
),
|
|
34555
|
+
/* @__PURE__ */ jsx93(
|
|
34556
|
+
DropdownMenuItem,
|
|
34557
|
+
{
|
|
34558
|
+
icon: TableIcon,
|
|
34559
|
+
label: t("tableMenu.toggleHeaderColumn"),
|
|
34560
|
+
onClick: () => editor.chain().focus().toggleHeaderColumn().run(),
|
|
34561
|
+
disabled: !hasTableContext || !editor.can().toggleHeaderColumn()
|
|
34562
|
+
}
|
|
34563
|
+
),
|
|
34564
|
+
/* @__PURE__ */ jsx93("div", { className: "my-1 border-t" }),
|
|
34565
|
+
/* @__PURE__ */ jsx93(
|
|
34566
|
+
DropdownMenuItem,
|
|
34567
|
+
{
|
|
34568
|
+
icon: Trash22,
|
|
34569
|
+
label: t("tableMenu.deleteColumn"),
|
|
34570
|
+
onClick: () => editor.chain().focus().deleteColumn().run(),
|
|
34571
|
+
disabled: !hasTableContext || !editor.can().deleteColumn()
|
|
34572
|
+
}
|
|
34573
|
+
),
|
|
34574
|
+
/* @__PURE__ */ jsx93(
|
|
34575
|
+
DropdownMenuItem,
|
|
34576
|
+
{
|
|
34577
|
+
icon: Trash22,
|
|
34578
|
+
label: t("tableMenu.deleteRow"),
|
|
34579
|
+
onClick: () => editor.chain().focus().deleteRow().run(),
|
|
34580
|
+
disabled: !hasTableContext || !editor.can().deleteRow()
|
|
34581
|
+
}
|
|
34582
|
+
),
|
|
34583
|
+
/* @__PURE__ */ jsx93(
|
|
34584
|
+
DropdownMenuItem,
|
|
34585
|
+
{
|
|
34586
|
+
icon: Trash22,
|
|
34587
|
+
label: t("tableMenu.deleteTable"),
|
|
34588
|
+
onClick: () => editor.chain().focus().deleteTable().run(),
|
|
34589
|
+
disabled: !hasTableContext || !editor.can().deleteTable()
|
|
34590
|
+
}
|
|
34591
|
+
)
|
|
34592
|
+
]
|
|
34194
34593
|
}
|
|
34195
|
-
)
|
|
34196
|
-
|
|
34197
|
-
|
|
34198
|
-
|
|
34199
|
-
|
|
34200
|
-
|
|
34201
|
-
|
|
34202
|
-
|
|
34203
|
-
onClick: () => fileInputRef.current?.click(),
|
|
34204
|
-
closeOnSelect: false
|
|
34205
|
-
}
|
|
34206
|
-
),
|
|
34207
|
-
imageUploadError && /* @__PURE__ */ jsx92(DropdownMenuItem, { label: imageUploadError, disabled: true, destructive: true }),
|
|
34208
|
-
/* @__PURE__ */ jsx92(
|
|
34209
|
-
"input",
|
|
34210
|
-
{
|
|
34211
|
-
ref: fileInputRef,
|
|
34212
|
-
type: "file",
|
|
34213
|
-
accept: "image/*",
|
|
34214
|
-
multiple: true,
|
|
34215
|
-
className: "hidden",
|
|
34216
|
-
onChange: (e) => {
|
|
34217
|
-
const files = Array.from(e.target.files ?? []);
|
|
34218
|
-
e.target.value = "";
|
|
34219
|
-
void insertImageFiles(files);
|
|
34220
|
-
}
|
|
34221
|
-
}
|
|
34222
|
-
),
|
|
34223
|
-
/* @__PURE__ */ jsx92("div", { className: "my-1 border-t" }),
|
|
34224
|
-
/* @__PURE__ */ jsx92(
|
|
34225
|
-
DropdownMenuItem,
|
|
34226
|
-
{
|
|
34227
|
-
icon: AlignCenter,
|
|
34228
|
-
label: t("toolbar.imageLayoutBlock"),
|
|
34229
|
-
onClick: () => applyImageLayout(editor, "block"),
|
|
34230
|
-
active: isImageSelected && imageLayout === "block",
|
|
34231
|
-
disabled: !isImageSelected
|
|
34232
|
-
}
|
|
34233
|
-
),
|
|
34234
|
-
/* @__PURE__ */ jsx92(
|
|
34235
|
-
DropdownMenuItem,
|
|
34236
|
-
{
|
|
34237
|
-
icon: AlignLeft,
|
|
34238
|
-
label: t("toolbar.imageLayoutLeft"),
|
|
34239
|
-
onClick: () => applyImageLayout(editor, "left"),
|
|
34240
|
-
active: isImageSelected && imageLayout === "left",
|
|
34241
|
-
disabled: !isImageSelected
|
|
34242
|
-
}
|
|
34243
|
-
),
|
|
34244
|
-
/* @__PURE__ */ jsx92(
|
|
34245
|
-
DropdownMenuItem,
|
|
34246
|
-
{
|
|
34247
|
-
icon: AlignRight,
|
|
34248
|
-
label: t("toolbar.imageLayoutRight"),
|
|
34249
|
-
onClick: () => applyImageLayout(editor, "right"),
|
|
34250
|
-
active: isImageSelected && imageLayout === "right",
|
|
34251
|
-
disabled: !isImageSelected
|
|
34252
|
-
}
|
|
34253
|
-
),
|
|
34254
|
-
/* @__PURE__ */ jsx92("div", { className: "my-1 border-t" }),
|
|
34255
|
-
/* @__PURE__ */ jsx92(
|
|
34256
|
-
DropdownMenuItem,
|
|
34257
|
-
{
|
|
34258
|
-
label: t("toolbar.imageWidthSm"),
|
|
34259
|
-
onClick: () => applyImageWidthPreset(editor, "sm"),
|
|
34260
|
-
active: isImageSelected && imageWidthPreset === "sm",
|
|
34261
|
-
disabled: !isImageSelected
|
|
34262
|
-
}
|
|
34263
|
-
),
|
|
34264
|
-
/* @__PURE__ */ jsx92(
|
|
34265
|
-
DropdownMenuItem,
|
|
34266
|
-
{
|
|
34267
|
-
label: t("toolbar.imageWidthMd"),
|
|
34268
|
-
onClick: () => applyImageWidthPreset(editor, "md"),
|
|
34269
|
-
active: isImageSelected && imageWidthPreset === "md",
|
|
34270
|
-
disabled: !isImageSelected
|
|
34271
|
-
}
|
|
34272
|
-
),
|
|
34273
|
-
/* @__PURE__ */ jsx92(
|
|
34274
|
-
DropdownMenuItem,
|
|
34275
|
-
{
|
|
34276
|
-
label: t("toolbar.imageWidthLg"),
|
|
34277
|
-
onClick: () => applyImageWidthPreset(editor, "lg"),
|
|
34278
|
-
active: isImageSelected && imageWidthPreset === "lg",
|
|
34279
|
-
disabled: !isImageSelected
|
|
34280
|
-
}
|
|
34281
|
-
),
|
|
34282
|
-
/* @__PURE__ */ jsx92("div", { className: "my-1 border-t" }),
|
|
34283
|
-
/* @__PURE__ */ jsx92(
|
|
34284
|
-
DropdownMenuItem,
|
|
34285
|
-
{
|
|
34286
|
-
icon: RotateCcw2,
|
|
34287
|
-
label: t("toolbar.imageResetSize"),
|
|
34288
|
-
onClick: () => resetImageSize(editor),
|
|
34289
|
-
disabled: !isImageSelected
|
|
34290
|
-
}
|
|
34291
|
-
),
|
|
34292
|
-
/* @__PURE__ */ jsx92(
|
|
34293
|
-
DropdownMenuItem,
|
|
34294
|
-
{
|
|
34295
|
-
icon: Trash22,
|
|
34296
|
-
label: t("toolbar.imageDelete"),
|
|
34297
|
-
onClick: () => deleteSelectedImage(editor),
|
|
34298
|
-
disabled: !isImageSelected,
|
|
34299
|
-
destructive: true
|
|
34300
|
-
}
|
|
34301
|
-
)
|
|
34302
|
-
] })
|
|
34303
|
-
}
|
|
34304
|
-
),
|
|
34305
|
-
(isMediumFull || isFull) && /* @__PURE__ */ jsxs75(
|
|
34306
|
-
DropdownMenu,
|
|
34307
|
-
{
|
|
34308
|
-
isOpen: isTableMenuOpen,
|
|
34309
|
-
onOpenChange: (open) => {
|
|
34310
|
-
setIsTableMenuOpen(open);
|
|
34311
|
-
setPreservedTableAnchorPos(open ? getTableAnchorPos(editor) : null);
|
|
34312
|
-
},
|
|
34313
|
-
trigger: /* @__PURE__ */ jsxs75(ToolbarButton, { onClick: () => {
|
|
34314
|
-
}, title: t("toolbar.table"), children: [
|
|
34315
|
-
/* @__PURE__ */ jsx92(TableIcon, { className: "w-4 h-4" }),
|
|
34316
|
-
/* @__PURE__ */ jsx92(ChevronDown8, { className: "w-3 h-3" })
|
|
34317
|
-
] }),
|
|
34318
|
-
contentClassName: "p-2 min-w-56",
|
|
34319
|
-
children: [
|
|
34320
|
-
/* @__PURE__ */ jsx92(
|
|
34321
|
-
TableInsertGrid,
|
|
34322
|
-
{
|
|
34323
|
-
insertLabel: t("tableMenu.insertTable"),
|
|
34324
|
-
previewTemplate: t("tableMenu.gridPreview"),
|
|
34325
|
-
onInsert: (rows, cols) => {
|
|
34326
|
-
editor.chain().focus().insertTable({ rows, cols, withHeaderRow: true }).run();
|
|
34327
|
-
setIsTableMenuOpen(false);
|
|
34328
|
-
setPreservedTableAnchorPos(null);
|
|
34329
|
-
}
|
|
34330
|
-
}
|
|
34331
|
-
),
|
|
34332
|
-
/* @__PURE__ */ jsx92("div", { className: "my-1 border-t" }),
|
|
34333
|
-
/* @__PURE__ */ jsx92(
|
|
34334
|
-
DropdownMenuItem,
|
|
34335
|
-
{
|
|
34336
|
-
icon: AlignLeft,
|
|
34337
|
-
label: t("tableMenu.alignLeft"),
|
|
34338
|
-
onClick: () => applyTableAlignment(editor, "left", tableCommandAnchorPos),
|
|
34339
|
-
active: hasTableContext && currentTableAlign === "left",
|
|
34340
|
-
disabled: !hasTableContext
|
|
34341
|
-
}
|
|
34342
|
-
),
|
|
34343
|
-
/* @__PURE__ */ jsx92(
|
|
34344
|
-
DropdownMenuItem,
|
|
34345
|
-
{
|
|
34346
|
-
icon: AlignCenter,
|
|
34347
|
-
label: t("tableMenu.alignCenter"),
|
|
34348
|
-
onClick: () => applyTableAlignment(editor, "center", tableCommandAnchorPos),
|
|
34349
|
-
active: hasTableContext && currentTableAlign === "center",
|
|
34350
|
-
disabled: !hasTableContext
|
|
34351
|
-
}
|
|
34352
|
-
),
|
|
34353
|
-
/* @__PURE__ */ jsx92(
|
|
34354
|
-
DropdownMenuItem,
|
|
34355
|
-
{
|
|
34356
|
-
icon: AlignRight,
|
|
34357
|
-
label: t("tableMenu.alignRight"),
|
|
34358
|
-
onClick: () => applyTableAlignment(editor, "right", tableCommandAnchorPos),
|
|
34359
|
-
active: hasTableContext && currentTableAlign === "right",
|
|
34360
|
-
disabled: !hasTableContext
|
|
34361
|
-
}
|
|
34362
|
-
),
|
|
34363
|
-
/* @__PURE__ */ jsx92("div", { className: "my-1 border-t" }),
|
|
34364
|
-
/* @__PURE__ */ jsx92(
|
|
34365
|
-
DropdownMenuItem,
|
|
34594
|
+
),
|
|
34595
|
+
/* @__PURE__ */ jsx93(ToolbarDivider, {}),
|
|
34596
|
+
/* @__PURE__ */ jsx93(ToolbarButton, { onClick: () => editor.chain().focus().undo().run(), disabled: !editor.can().undo(), title: t("toolbar.undo"), children: /* @__PURE__ */ jsx93(FigmaUndoIcon, { className: "h-4 w-4" }) }),
|
|
34597
|
+
/* @__PURE__ */ jsx93(ToolbarButton, { onClick: () => editor.chain().focus().redo().run(), disabled: !editor.can().redo(), title: t("toolbar.redo"), children: /* @__PURE__ */ jsx93(FigmaRedoIcon, { className: "h-4 w-4" }) }),
|
|
34598
|
+
hasTableContext && /* @__PURE__ */ jsxs75(Fragment30, { children: [
|
|
34599
|
+
/* @__PURE__ */ jsx93(ToolbarDivider, {}),
|
|
34600
|
+
/* @__PURE__ */ jsx93(
|
|
34601
|
+
ToolbarButton,
|
|
34366
34602
|
{
|
|
34367
|
-
icon: ArrowLeft,
|
|
34368
|
-
label: t("tableMenu.addColumnBefore"),
|
|
34369
34603
|
onClick: () => editor.chain().focus().addColumnBefore().run(),
|
|
34370
|
-
disabled: !
|
|
34604
|
+
disabled: !editor.can().addColumnBefore(),
|
|
34605
|
+
title: t("tableMenu.addColumnBefore"),
|
|
34606
|
+
children: /* @__PURE__ */ jsx93(ArrowLeft, { className: "w-4 h-4" })
|
|
34371
34607
|
}
|
|
34372
34608
|
),
|
|
34373
|
-
/* @__PURE__ */
|
|
34374
|
-
|
|
34609
|
+
/* @__PURE__ */ jsx93(
|
|
34610
|
+
ToolbarButton,
|
|
34375
34611
|
{
|
|
34376
|
-
icon: ArrowDown,
|
|
34377
|
-
label: t("tableMenu.addColumnAfter"),
|
|
34378
34612
|
onClick: () => editor.chain().focus().addColumnAfter().run(),
|
|
34379
|
-
disabled: !
|
|
34613
|
+
disabled: !editor.can().addColumnAfter(),
|
|
34614
|
+
title: t("tableMenu.addColumnAfter"),
|
|
34615
|
+
children: /* @__PURE__ */ jsx93(ArrowRight, { className: "w-4 h-4" })
|
|
34380
34616
|
}
|
|
34381
34617
|
),
|
|
34382
|
-
/* @__PURE__ */
|
|
34383
|
-
|
|
34618
|
+
/* @__PURE__ */ jsx93(
|
|
34619
|
+
ToolbarButton,
|
|
34384
34620
|
{
|
|
34385
|
-
icon: ArrowUp,
|
|
34386
|
-
label: t("tableMenu.addRowBefore"),
|
|
34387
34621
|
onClick: () => editor.chain().focus().addRowBefore().run(),
|
|
34388
|
-
disabled: !
|
|
34622
|
+
disabled: !editor.can().addRowBefore(),
|
|
34623
|
+
title: t("tableMenu.addRowBefore"),
|
|
34624
|
+
children: /* @__PURE__ */ jsx93(ArrowUp, { className: "w-4 h-4" })
|
|
34389
34625
|
}
|
|
34390
34626
|
),
|
|
34391
|
-
/* @__PURE__ */
|
|
34392
|
-
|
|
34627
|
+
/* @__PURE__ */ jsx93(
|
|
34628
|
+
ToolbarButton,
|
|
34393
34629
|
{
|
|
34394
|
-
icon: ArrowRight,
|
|
34395
|
-
label: t("tableMenu.addRowAfter"),
|
|
34396
34630
|
onClick: () => editor.chain().focus().addRowAfter().run(),
|
|
34397
|
-
disabled: !
|
|
34398
|
-
|
|
34399
|
-
|
|
34400
|
-
/* @__PURE__ */ jsx92("div", { className: "my-1 border-t" }),
|
|
34401
|
-
/* @__PURE__ */ jsx92(
|
|
34402
|
-
DropdownMenuItem,
|
|
34403
|
-
{
|
|
34404
|
-
icon: TableIcon,
|
|
34405
|
-
label: t("tableMenu.toggleHeaderRow"),
|
|
34406
|
-
onClick: () => editor.chain().focus().toggleHeaderRow().run(),
|
|
34407
|
-
disabled: !hasTableContext || !editor.can().toggleHeaderRow()
|
|
34408
|
-
}
|
|
34409
|
-
),
|
|
34410
|
-
/* @__PURE__ */ jsx92(
|
|
34411
|
-
DropdownMenuItem,
|
|
34412
|
-
{
|
|
34413
|
-
icon: TableIcon,
|
|
34414
|
-
label: t("tableMenu.toggleHeaderColumn"),
|
|
34415
|
-
onClick: () => editor.chain().focus().toggleHeaderColumn().run(),
|
|
34416
|
-
disabled: !hasTableContext || !editor.can().toggleHeaderColumn()
|
|
34417
|
-
}
|
|
34418
|
-
),
|
|
34419
|
-
/* @__PURE__ */ jsx92("div", { className: "my-1 border-t" }),
|
|
34420
|
-
/* @__PURE__ */ jsx92(
|
|
34421
|
-
DropdownMenuItem,
|
|
34422
|
-
{
|
|
34423
|
-
icon: Trash22,
|
|
34424
|
-
label: t("tableMenu.deleteColumn"),
|
|
34425
|
-
onClick: () => editor.chain().focus().deleteColumn().run(),
|
|
34426
|
-
disabled: !hasTableContext || !editor.can().deleteColumn()
|
|
34427
|
-
}
|
|
34428
|
-
),
|
|
34429
|
-
/* @__PURE__ */ jsx92(
|
|
34430
|
-
DropdownMenuItem,
|
|
34431
|
-
{
|
|
34432
|
-
icon: Trash22,
|
|
34433
|
-
label: t("tableMenu.deleteRow"),
|
|
34434
|
-
onClick: () => editor.chain().focus().deleteRow().run(),
|
|
34435
|
-
disabled: !hasTableContext || !editor.can().deleteRow()
|
|
34631
|
+
disabled: !editor.can().addRowAfter(),
|
|
34632
|
+
title: t("tableMenu.addRowAfter"),
|
|
34633
|
+
children: /* @__PURE__ */ jsx93(ArrowDown, { className: "w-4 h-4" })
|
|
34436
34634
|
}
|
|
34437
34635
|
),
|
|
34438
|
-
/* @__PURE__ */
|
|
34439
|
-
|
|
34636
|
+
/* @__PURE__ */ jsx93(
|
|
34637
|
+
ToolbarButton,
|
|
34440
34638
|
{
|
|
34441
|
-
|
|
34442
|
-
|
|
34443
|
-
|
|
34444
|
-
|
|
34639
|
+
onClick: () => {
|
|
34640
|
+
if (canSplitCell) {
|
|
34641
|
+
editor.chain().focus().splitCell().run();
|
|
34642
|
+
return;
|
|
34643
|
+
}
|
|
34644
|
+
mergeTableCellsPreservingColumnWidths(editor);
|
|
34645
|
+
},
|
|
34646
|
+
active: canSplitCell,
|
|
34647
|
+
disabled: !canMergeCells && !canSplitCell,
|
|
34648
|
+
title: canSplitCell ? t("tableMenu.splitCell") : t("tableMenu.mergeCells"),
|
|
34649
|
+
children: /* @__PURE__ */ jsx93(TableCellsMerge, { className: "w-4 h-4" })
|
|
34445
34650
|
}
|
|
34446
34651
|
)
|
|
34447
|
-
]
|
|
34448
|
-
|
|
34449
|
-
|
|
34450
|
-
|
|
34451
|
-
/* @__PURE__ */ jsx92(ToolbarButton, { onClick: () => editor.chain().focus().undo().run(), disabled: !editor.can().undo(), title: t("toolbar.undo"), children: /* @__PURE__ */ jsx92(UndoIcon, { className: "w-4 h-4" }) }),
|
|
34452
|
-
/* @__PURE__ */ jsx92(ToolbarButton, { onClick: () => editor.chain().focus().redo().run(), disabled: !editor.can().redo(), title: t("toolbar.redo"), children: /* @__PURE__ */ jsx92(RedoIcon, { className: "w-4 h-4" }) }),
|
|
34453
|
-
hasTableContext && /* @__PURE__ */ jsxs75(Fragment30, { children: [
|
|
34454
|
-
/* @__PURE__ */ jsx92(ToolbarDivider, {}),
|
|
34455
|
-
/* @__PURE__ */ jsx92(
|
|
34456
|
-
ToolbarButton,
|
|
34457
|
-
{
|
|
34458
|
-
onClick: () => editor.chain().focus().addColumnBefore().run(),
|
|
34459
|
-
disabled: !editor.can().addColumnBefore(),
|
|
34460
|
-
title: t("tableMenu.addColumnBefore"),
|
|
34461
|
-
children: /* @__PURE__ */ jsx92(ArrowLeft, { className: "w-4 h-4" })
|
|
34462
|
-
}
|
|
34463
|
-
),
|
|
34464
|
-
/* @__PURE__ */ jsx92(
|
|
34465
|
-
ToolbarButton,
|
|
34466
|
-
{
|
|
34467
|
-
onClick: () => editor.chain().focus().addColumnAfter().run(),
|
|
34468
|
-
disabled: !editor.can().addColumnAfter(),
|
|
34469
|
-
title: t("tableMenu.addColumnAfter"),
|
|
34470
|
-
children: /* @__PURE__ */ jsx92(ArrowRight, { className: "w-4 h-4" })
|
|
34471
|
-
}
|
|
34472
|
-
),
|
|
34473
|
-
/* @__PURE__ */ jsx92(
|
|
34474
|
-
ToolbarButton,
|
|
34475
|
-
{
|
|
34476
|
-
onClick: () => editor.chain().focus().addRowBefore().run(),
|
|
34477
|
-
disabled: !editor.can().addRowBefore(),
|
|
34478
|
-
title: t("tableMenu.addRowBefore"),
|
|
34479
|
-
children: /* @__PURE__ */ jsx92(ArrowUp, { className: "w-4 h-4" })
|
|
34480
|
-
}
|
|
34481
|
-
),
|
|
34482
|
-
/* @__PURE__ */ jsx92(
|
|
34483
|
-
ToolbarButton,
|
|
34484
|
-
{
|
|
34485
|
-
onClick: () => editor.chain().focus().addRowAfter().run(),
|
|
34486
|
-
disabled: !editor.can().addRowAfter(),
|
|
34487
|
-
title: t("tableMenu.addRowAfter"),
|
|
34488
|
-
children: /* @__PURE__ */ jsx92(ArrowDown, { className: "w-4 h-4" })
|
|
34489
|
-
}
|
|
34490
|
-
),
|
|
34491
|
-
/* @__PURE__ */ jsx92(
|
|
34492
|
-
ToolbarButton,
|
|
34493
|
-
{
|
|
34494
|
-
onClick: () => {
|
|
34495
|
-
if (canSplitCell) {
|
|
34496
|
-
editor.chain().focus().splitCell().run();
|
|
34497
|
-
return;
|
|
34498
|
-
}
|
|
34499
|
-
mergeTableCellsPreservingColumnWidths(editor);
|
|
34500
|
-
},
|
|
34501
|
-
active: canSplitCell,
|
|
34502
|
-
disabled: !canMergeCells && !canSplitCell,
|
|
34503
|
-
title: canSplitCell ? t("tableMenu.splitCell") : t("tableMenu.mergeCells"),
|
|
34504
|
-
children: /* @__PURE__ */ jsx92(TableCellsMerge, { className: "w-4 h-4" })
|
|
34505
|
-
}
|
|
34506
|
-
)
|
|
34507
|
-
] })
|
|
34508
|
-
] });
|
|
34652
|
+
] })
|
|
34653
|
+
]
|
|
34654
|
+
}
|
|
34655
|
+
);
|
|
34509
34656
|
};
|
|
34510
34657
|
|
|
34511
34658
|
// src/components/UEditor/menus.tsx
|
|
@@ -34517,20 +34664,20 @@ import {
|
|
|
34517
34664
|
AlignCenter as AlignCenter2,
|
|
34518
34665
|
AlignLeft as AlignLeft2,
|
|
34519
34666
|
AlignRight as AlignRight2,
|
|
34520
|
-
Bold as
|
|
34667
|
+
Bold as BoldIcon,
|
|
34521
34668
|
ChevronDown as ChevronDown9,
|
|
34522
|
-
Code as
|
|
34523
|
-
Italic as
|
|
34669
|
+
Code as CodeIcon,
|
|
34670
|
+
Italic as ItalicIcon,
|
|
34524
34671
|
Link as LinkIcon2,
|
|
34525
34672
|
Plus as Plus3,
|
|
34526
34673
|
RotateCcw as RotateCcw3,
|
|
34527
|
-
Subscript as
|
|
34528
|
-
Superscript as
|
|
34674
|
+
Subscript as SubscriptIcon,
|
|
34675
|
+
Superscript as SuperscriptIcon,
|
|
34529
34676
|
TableCellsMerge as TableCellsMerge2,
|
|
34530
34677
|
Trash2 as Trash23,
|
|
34531
34678
|
Type as Type3,
|
|
34532
|
-
Underline as
|
|
34533
|
-
Strikethrough as
|
|
34679
|
+
Underline as UnderlineIcon,
|
|
34680
|
+
Strikethrough as StrikethroughIcon,
|
|
34534
34681
|
Edit2,
|
|
34535
34682
|
Eraser,
|
|
34536
34683
|
Unlink,
|
|
@@ -35613,7 +35760,7 @@ function recalculateAllTableFormulas(editor) {
|
|
|
35613
35760
|
}
|
|
35614
35761
|
|
|
35615
35762
|
// src/components/UEditor/menus.tsx
|
|
35616
|
-
import { Fragment as Fragment31, jsx as
|
|
35763
|
+
import { Fragment as Fragment31, jsx as jsx94, jsxs as jsxs76 } from "react/jsx-runtime";
|
|
35617
35764
|
var FloatingSlashCommandMenu = ({ editor, onClose }) => {
|
|
35618
35765
|
const t = useSmartTranslations("UEditor");
|
|
35619
35766
|
const messages = useMemo25(() => buildSlashCommandMessages(t), [t]);
|
|
@@ -35634,7 +35781,7 @@ var FloatingSlashCommandMenu = ({ editor, onClose }) => {
|
|
|
35634
35781
|
document.addEventListener("keydown", handleKeyDown2);
|
|
35635
35782
|
return () => document.removeEventListener("keydown", handleKeyDown2);
|
|
35636
35783
|
}, [onClose]);
|
|
35637
|
-
return /* @__PURE__ */
|
|
35784
|
+
return /* @__PURE__ */ jsx94(
|
|
35638
35785
|
SlashCommandList,
|
|
35639
35786
|
{
|
|
35640
35787
|
ref: listRef,
|
|
@@ -35651,7 +35798,7 @@ var FloatingMenuContent = ({ editor }) => {
|
|
|
35651
35798
|
const t = useSmartTranslations("UEditor");
|
|
35652
35799
|
const [showCommands, setShowCommands] = useState51(false);
|
|
35653
35800
|
if (showCommands) {
|
|
35654
|
-
return /* @__PURE__ */
|
|
35801
|
+
return /* @__PURE__ */ jsx94(FloatingSlashCommandMenu, { editor, onClose: () => setShowCommands(false) });
|
|
35655
35802
|
}
|
|
35656
35803
|
return /* @__PURE__ */ jsxs76(
|
|
35657
35804
|
"button",
|
|
@@ -35660,8 +35807,8 @@ var FloatingMenuContent = ({ editor }) => {
|
|
|
35660
35807
|
onClick: () => setShowCommands(true),
|
|
35661
35808
|
className: "flex items-center gap-1 px-2 py-1.5 rounded-lg hover:bg-accent transition-all group",
|
|
35662
35809
|
children: [
|
|
35663
|
-
/* @__PURE__ */
|
|
35664
|
-
/* @__PURE__ */
|
|
35810
|
+
/* @__PURE__ */ jsx94(Plus3, { className: "w-4 h-4 text-muted-foreground group-hover:text-foreground" }),
|
|
35811
|
+
/* @__PURE__ */ jsx94("span", { className: "text-sm text-muted-foreground group-hover:text-foreground", children: t("floatingMenu.addBlock") })
|
|
35665
35812
|
]
|
|
35666
35813
|
}
|
|
35667
35814
|
);
|
|
@@ -35690,7 +35837,7 @@ function applyTableCellAttribute2(editor, name, value, options = {}) {
|
|
|
35690
35837
|
}
|
|
35691
35838
|
function BorderStylePreviewIcon({ style }) {
|
|
35692
35839
|
const isNone = style === "none";
|
|
35693
|
-
return /* @__PURE__ */
|
|
35840
|
+
return /* @__PURE__ */ jsx94(
|
|
35694
35841
|
"span",
|
|
35695
35842
|
{
|
|
35696
35843
|
"aria-hidden": "true",
|
|
@@ -35702,7 +35849,7 @@ function BorderStylePreviewIcon({ style }) {
|
|
|
35702
35849
|
borderStyle: style,
|
|
35703
35850
|
borderWidth: style === "double" ? 3 : 2
|
|
35704
35851
|
},
|
|
35705
|
-
children: isNone && /* @__PURE__ */
|
|
35852
|
+
children: isNone && /* @__PURE__ */ jsx94("span", { className: "absolute left-1/2 top-0 h-full w-px -translate-x-1/2 rotate-45 bg-muted-foreground/70" })
|
|
35706
35853
|
}
|
|
35707
35854
|
);
|
|
35708
35855
|
}
|
|
@@ -35714,7 +35861,7 @@ function BorderPositionPreviewIcon({ position }) {
|
|
|
35714
35861
|
const showHorizontal = position === "all" || position === "inner" || position === "horizontal";
|
|
35715
35862
|
const showVertical = position === "all" || position === "inner" || position === "vertical";
|
|
35716
35863
|
return /* @__PURE__ */ jsxs76("svg", { "aria-hidden": "true", viewBox: "0 0 20 20", className: "h-5 w-5 fill-none stroke-current", children: [
|
|
35717
|
-
/* @__PURE__ */
|
|
35864
|
+
/* @__PURE__ */ jsx94(
|
|
35718
35865
|
"path",
|
|
35719
35866
|
{
|
|
35720
35867
|
d: "M2 2H18V18H2Z M2 10H18 M10 2V18",
|
|
@@ -35724,12 +35871,12 @@ function BorderPositionPreviewIcon({ position }) {
|
|
|
35724
35871
|
strokeWidth: "1.25"
|
|
35725
35872
|
}
|
|
35726
35873
|
),
|
|
35727
|
-
showTop && /* @__PURE__ */
|
|
35728
|
-
showRight && /* @__PURE__ */
|
|
35729
|
-
showBottom && /* @__PURE__ */
|
|
35730
|
-
showLeft && /* @__PURE__ */
|
|
35731
|
-
showHorizontal && /* @__PURE__ */
|
|
35732
|
-
showVertical && /* @__PURE__ */
|
|
35874
|
+
showTop && /* @__PURE__ */ jsx94("path", { d: "M2 2H18", strokeWidth: "2" }),
|
|
35875
|
+
showRight && /* @__PURE__ */ jsx94("path", { d: "M18 2V18", strokeWidth: "2" }),
|
|
35876
|
+
showBottom && /* @__PURE__ */ jsx94("path", { d: "M2 18H18", strokeWidth: "2" }),
|
|
35877
|
+
showLeft && /* @__PURE__ */ jsx94("path", { d: "M2 2V18", strokeWidth: "2" }),
|
|
35878
|
+
showHorizontal && /* @__PURE__ */ jsx94("path", { d: "M2 10H18", strokeWidth: "2" }),
|
|
35879
|
+
showVertical && /* @__PURE__ */ jsx94("path", { d: "M10 2V18", strokeWidth: "2" })
|
|
35733
35880
|
] });
|
|
35734
35881
|
}
|
|
35735
35882
|
var BubbleMenuContent = ({
|
|
@@ -35926,7 +36073,7 @@ var BubbleMenuContent = ({
|
|
|
35926
36073
|
};
|
|
35927
36074
|
}, [editor, showLinkInput]);
|
|
35928
36075
|
if (showLinkInput) {
|
|
35929
|
-
return /* @__PURE__ */
|
|
36076
|
+
return /* @__PURE__ */ jsx94(
|
|
35930
36077
|
LinkInput,
|
|
35931
36078
|
{
|
|
35932
36079
|
initialUrl: editor.getAttributes("link").href || "",
|
|
@@ -35947,10 +36094,10 @@ var BubbleMenuContent = ({
|
|
|
35947
36094
|
const isHighlightPalette = activeColorPalette === "highlight";
|
|
35948
36095
|
if (activeColorPalette === "cell-border") {
|
|
35949
36096
|
return /* @__PURE__ */ jsxs76("div", { className: "flex w-72 flex-col gap-2 p-2 text-sm", "data-ueditor-keep-open": true, children: [
|
|
35950
|
-
/* @__PURE__ */
|
|
36097
|
+
/* @__PURE__ */ jsx94("div", { className: "font-semibold text-xs text-muted-foreground uppercase tracking-wider mb-1", children: t("tableMenu.cellBorder") || "Cell Borders" }),
|
|
35951
36098
|
/* @__PURE__ */ jsxs76("div", { className: "flex gap-2", children: [
|
|
35952
36099
|
/* @__PURE__ */ jsxs76("div", { className: "min-w-0 flex-1", children: [
|
|
35953
|
-
/* @__PURE__ */
|
|
36100
|
+
/* @__PURE__ */ jsx94("label", { className: "mb-1 block text-xs text-muted-foreground", children: t("tableMenu.borderPosition") || "Border placement" }),
|
|
35954
36101
|
/* @__PURE__ */ jsxs76("div", { className: "grid grid-cols-5 gap-1", role: "group", "aria-label": t("tableMenu.borderPosition") || "Border placement", children: [
|
|
35955
36102
|
[
|
|
35956
36103
|
["all", "borderAll"],
|
|
@@ -35964,7 +36111,7 @@ var BubbleMenuContent = ({
|
|
|
35964
36111
|
["left", "borderLeft"]
|
|
35965
36112
|
].map(([position, labelKey]) => {
|
|
35966
36113
|
const label = t(`tableMenu.${labelKey}`) || position;
|
|
35967
|
-
return /* @__PURE__ */
|
|
36114
|
+
return /* @__PURE__ */ jsx94(
|
|
35968
36115
|
"button",
|
|
35969
36116
|
{
|
|
35970
36117
|
type: "button",
|
|
@@ -35976,12 +36123,12 @@ var BubbleMenuContent = ({
|
|
|
35976
36123
|
"inline-flex h-8 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted hover:text-primary",
|
|
35977
36124
|
activeBorderPosition === position ? "bg-primary/10 text-primary" : "bg-muted/40"
|
|
35978
36125
|
),
|
|
35979
|
-
children: /* @__PURE__ */
|
|
36126
|
+
children: /* @__PURE__ */ jsx94(BorderPositionPreviewIcon, { position })
|
|
35980
36127
|
},
|
|
35981
36128
|
position
|
|
35982
36129
|
);
|
|
35983
36130
|
}),
|
|
35984
|
-
/* @__PURE__ */
|
|
36131
|
+
/* @__PURE__ */ jsx94(
|
|
35985
36132
|
"button",
|
|
35986
36133
|
{
|
|
35987
36134
|
type: "button",
|
|
@@ -35990,13 +36137,13 @@ var BubbleMenuContent = ({
|
|
|
35990
36137
|
onMouseDown: (event) => event.preventDefault(),
|
|
35991
36138
|
onClick: clearTableCellBorders,
|
|
35992
36139
|
className: "inline-flex h-8 items-center justify-center rounded-md bg-muted/40 text-destructive transition-colors hover:bg-destructive/10",
|
|
35993
|
-
children: /* @__PURE__ */
|
|
36140
|
+
children: /* @__PURE__ */ jsx94(BorderStylePreviewIcon, { style: "none" })
|
|
35994
36141
|
}
|
|
35995
36142
|
)
|
|
35996
36143
|
] })
|
|
35997
36144
|
] }),
|
|
35998
36145
|
/* @__PURE__ */ jsxs76("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: [
|
|
35999
|
-
/* @__PURE__ */
|
|
36146
|
+
/* @__PURE__ */ jsx94(
|
|
36000
36147
|
"button",
|
|
36001
36148
|
{
|
|
36002
36149
|
type: "button",
|
|
@@ -36008,10 +36155,10 @@ var BubbleMenuContent = ({
|
|
|
36008
36155
|
"inline-flex h-8 w-8 items-center justify-center rounded-md transition-colors hover:bg-muted",
|
|
36009
36156
|
borderEditMode === "draw" ? "bg-primary/10 text-primary" : "text-muted-foreground"
|
|
36010
36157
|
),
|
|
36011
|
-
children: /* @__PURE__ */
|
|
36158
|
+
children: /* @__PURE__ */ jsx94(Edit2, { className: "h-4 w-4" })
|
|
36012
36159
|
}
|
|
36013
36160
|
),
|
|
36014
|
-
/* @__PURE__ */
|
|
36161
|
+
/* @__PURE__ */ jsx94(
|
|
36015
36162
|
"button",
|
|
36016
36163
|
{
|
|
36017
36164
|
type: "button",
|
|
@@ -36023,14 +36170,14 @@ var BubbleMenuContent = ({
|
|
|
36023
36170
|
"inline-flex h-8 w-8 items-center justify-center rounded-md transition-colors hover:bg-muted",
|
|
36024
36171
|
borderEditMode === "erase" ? "bg-destructive/10 text-destructive" : "text-muted-foreground"
|
|
36025
36172
|
),
|
|
36026
|
-
children: /* @__PURE__ */
|
|
36173
|
+
children: /* @__PURE__ */ jsx94(Eraser, { className: "h-4 w-4" })
|
|
36027
36174
|
}
|
|
36028
36175
|
)
|
|
36029
36176
|
] })
|
|
36030
36177
|
] }),
|
|
36031
36178
|
/* @__PURE__ */ jsxs76("div", { className: "flex flex-col gap-1", children: [
|
|
36032
|
-
/* @__PURE__ */
|
|
36033
|
-
/* @__PURE__ */
|
|
36179
|
+
/* @__PURE__ */ jsx94("label", { className: "text-xs text-muted-foreground", children: t("tableMenu.borderStyle") || "Border Style" }),
|
|
36180
|
+
/* @__PURE__ */ jsx94("div", { className: "grid grid-cols-4 gap-1.5", role: "group", "aria-label": t("tableMenu.borderStyle") || "Border Style", children: [
|
|
36034
36181
|
["solid", "Solid"],
|
|
36035
36182
|
["dashed", "Dashed"],
|
|
36036
36183
|
["dotted", "Dotted"],
|
|
@@ -36046,16 +36193,16 @@ var BubbleMenuContent = ({
|
|
|
36046
36193
|
borderStyleDraft === style ? "bg-primary/10 text-primary" : "bg-muted/40 text-foreground"
|
|
36047
36194
|
),
|
|
36048
36195
|
children: [
|
|
36049
|
-
/* @__PURE__ */
|
|
36050
|
-
/* @__PURE__ */
|
|
36196
|
+
/* @__PURE__ */ jsx94(BorderStylePreviewIcon, { style }),
|
|
36197
|
+
/* @__PURE__ */ jsx94("span", { children: label })
|
|
36051
36198
|
]
|
|
36052
36199
|
},
|
|
36053
36200
|
style
|
|
36054
36201
|
)) })
|
|
36055
36202
|
] }),
|
|
36056
36203
|
/* @__PURE__ */ jsxs76("div", { className: "flex flex-col gap-1", children: [
|
|
36057
|
-
/* @__PURE__ */
|
|
36058
|
-
/* @__PURE__ */
|
|
36204
|
+
/* @__PURE__ */ jsx94("label", { className: "text-xs text-muted-foreground", children: t("tableMenu.borderWidth") || "Border Width" }),
|
|
36205
|
+
/* @__PURE__ */ jsx94("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__ */ jsx94(
|
|
36059
36206
|
"button",
|
|
36060
36207
|
{
|
|
36061
36208
|
type: "button",
|
|
@@ -36077,8 +36224,8 @@ var BubbleMenuContent = ({
|
|
|
36077
36224
|
onClick: () => setActiveColorPalette("cell-border-color"),
|
|
36078
36225
|
className: "flex items-center justify-between w-full h-8 px-2 rounded-md border border-input hover:bg-accent text-xs",
|
|
36079
36226
|
children: [
|
|
36080
|
-
/* @__PURE__ */
|
|
36081
|
-
/* @__PURE__ */
|
|
36227
|
+
/* @__PURE__ */ jsx94("span", { children: t("tableMenu.borderColor") || "Border Color" }),
|
|
36228
|
+
/* @__PURE__ */ jsx94(
|
|
36082
36229
|
"span",
|
|
36083
36230
|
{
|
|
36084
36231
|
className: "w-4 h-4 rounded-full border border-border",
|
|
@@ -36093,7 +36240,7 @@ var BubbleMenuContent = ({
|
|
|
36093
36240
|
] });
|
|
36094
36241
|
}
|
|
36095
36242
|
if (activeColorPalette === "cell-border-color") {
|
|
36096
|
-
return /* @__PURE__ */
|
|
36243
|
+
return /* @__PURE__ */ jsx94("div", { className: "w-56", "data-ueditor-keep-open": true, children: /* @__PURE__ */ jsx94(
|
|
36097
36244
|
EditorColorPalette,
|
|
36098
36245
|
{
|
|
36099
36246
|
colors: borderColors,
|
|
@@ -36103,7 +36250,7 @@ var BubbleMenuContent = ({
|
|
|
36103
36250
|
}
|
|
36104
36251
|
) });
|
|
36105
36252
|
}
|
|
36106
|
-
return /* @__PURE__ */
|
|
36253
|
+
return /* @__PURE__ */ jsx94("div", { className: "w-56", "data-ueditor-keep-open": true, children: /* @__PURE__ */ jsx94(
|
|
36107
36254
|
EditorColorPalette,
|
|
36108
36255
|
{
|
|
36109
36256
|
colors: isTextPalette ? textColors : highlightColors,
|
|
@@ -36115,22 +36262,22 @@ var BubbleMenuContent = ({
|
|
|
36115
36262
|
}
|
|
36116
36263
|
if (isImageSelected) {
|
|
36117
36264
|
return /* @__PURE__ */ jsxs76("div", { className: "flex items-center gap-0.5 p-1", children: [
|
|
36118
|
-
/* @__PURE__ */
|
|
36119
|
-
/* @__PURE__ */
|
|
36120
|
-
/* @__PURE__ */
|
|
36121
|
-
/* @__PURE__ */
|
|
36122
|
-
/* @__PURE__ */
|
|
36123
|
-
/* @__PURE__ */
|
|
36124
|
-
/* @__PURE__ */
|
|
36125
|
-
/* @__PURE__ */
|
|
36126
|
-
/* @__PURE__ */
|
|
36127
|
-
/* @__PURE__ */
|
|
36265
|
+
/* @__PURE__ */ jsx94(ToolbarButton, { onClick: () => applyImageLayout(editor, "block"), active: imageLayout === "block", title: t("toolbar.imageLayoutBlock"), children: /* @__PURE__ */ jsx94(AlignCenter2, { className: "w-4 h-4" }) }),
|
|
36266
|
+
/* @__PURE__ */ jsx94(ToolbarButton, { onClick: () => applyImageLayout(editor, "left"), active: imageLayout === "left", title: t("toolbar.imageLayoutLeft"), children: /* @__PURE__ */ jsx94(AlignLeft2, { className: "w-4 h-4" }) }),
|
|
36267
|
+
/* @__PURE__ */ jsx94(ToolbarButton, { onClick: () => applyImageLayout(editor, "right"), active: imageLayout === "right", title: t("toolbar.imageLayoutRight"), children: /* @__PURE__ */ jsx94(AlignRight2, { className: "w-4 h-4" }) }),
|
|
36268
|
+
/* @__PURE__ */ jsx94("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
36269
|
+
/* @__PURE__ */ jsx94(ToolbarButton, { onClick: () => applyImageWidthPreset(editor, "sm"), active: imageWidthPreset === "sm", title: t("toolbar.imageWidthSm"), children: /* @__PURE__ */ jsx94("span", { className: "text-[10px] font-semibold", children: "S" }) }),
|
|
36270
|
+
/* @__PURE__ */ jsx94(ToolbarButton, { onClick: () => applyImageWidthPreset(editor, "md"), active: imageWidthPreset === "md", title: t("toolbar.imageWidthMd"), children: /* @__PURE__ */ jsx94("span", { className: "text-[10px] font-semibold", children: "M" }) }),
|
|
36271
|
+
/* @__PURE__ */ jsx94(ToolbarButton, { onClick: () => applyImageWidthPreset(editor, "lg"), active: imageWidthPreset === "lg", title: t("toolbar.imageWidthLg"), children: /* @__PURE__ */ jsx94("span", { className: "text-[10px] font-semibold", children: "L" }) }),
|
|
36272
|
+
/* @__PURE__ */ jsx94("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
36273
|
+
/* @__PURE__ */ jsx94(ToolbarButton, { onClick: () => resetImageSize(editor), title: t("toolbar.imageResetSize"), children: /* @__PURE__ */ jsx94(RotateCcw3, { className: "w-4 h-4" }) }),
|
|
36274
|
+
/* @__PURE__ */ jsx94(
|
|
36128
36275
|
ToolbarButton,
|
|
36129
36276
|
{
|
|
36130
36277
|
onClick: () => deleteSelectedImage(editor),
|
|
36131
36278
|
title: t("toolbar.imageDelete"),
|
|
36132
36279
|
className: "text-destructive hover:text-destructive",
|
|
36133
|
-
children: /* @__PURE__ */
|
|
36280
|
+
children: /* @__PURE__ */ jsx94(Trash23, { className: "w-4 h-4" })
|
|
36134
36281
|
}
|
|
36135
36282
|
)
|
|
36136
36283
|
] });
|
|
@@ -36138,8 +36285,8 @@ var BubbleMenuContent = ({
|
|
|
36138
36285
|
if (showFormulaPanel && isInTable2) {
|
|
36139
36286
|
return /* @__PURE__ */ jsxs76("div", { className: "w-72 p-2", children: [
|
|
36140
36287
|
/* @__PURE__ */ jsxs76("div", { className: "mb-2 flex items-center justify-between gap-2", children: [
|
|
36141
|
-
/* @__PURE__ */
|
|
36142
|
-
/* @__PURE__ */
|
|
36288
|
+
/* @__PURE__ */ jsx94("span", { className: "px-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: t("tableMenu.formula") || "Formula" }),
|
|
36289
|
+
/* @__PURE__ */ jsx94(
|
|
36143
36290
|
"button",
|
|
36144
36291
|
{
|
|
36145
36292
|
type: "button",
|
|
@@ -36152,7 +36299,7 @@ var BubbleMenuContent = ({
|
|
|
36152
36299
|
}
|
|
36153
36300
|
)
|
|
36154
36301
|
] }),
|
|
36155
|
-
/* @__PURE__ */
|
|
36302
|
+
/* @__PURE__ */ jsx94("div", { className: "flex h-9 items-center overflow-hidden rounded-md border border-border/60 bg-muted/40", children: /* @__PURE__ */ jsx94(
|
|
36156
36303
|
"input",
|
|
36157
36304
|
{
|
|
36158
36305
|
value: formulaDraft,
|
|
@@ -36174,14 +36321,14 @@ var BubbleMenuContent = ({
|
|
|
36174
36321
|
}
|
|
36175
36322
|
) }),
|
|
36176
36323
|
/* @__PURE__ */ jsxs76("div", { className: "mt-2", children: [
|
|
36177
|
-
/* @__PURE__ */
|
|
36178
|
-
/* @__PURE__ */
|
|
36324
|
+
/* @__PURE__ */ jsx94("div", { className: "mb-1 px-1 text-[11px] font-medium text-muted-foreground", children: t("tableMenu.numberFormat") || "Number format" }),
|
|
36325
|
+
/* @__PURE__ */ jsx94("div", { className: "grid grid-cols-5 gap-1", children: [
|
|
36179
36326
|
["text", "Text"],
|
|
36180
36327
|
["number", "123"],
|
|
36181
36328
|
["currency", "$"],
|
|
36182
36329
|
["percent", "%"],
|
|
36183
36330
|
["date", "Date"]
|
|
36184
|
-
].map(([format, label]) => /* @__PURE__ */
|
|
36331
|
+
].map(([format, label]) => /* @__PURE__ */ jsx94(
|
|
36185
36332
|
"button",
|
|
36186
36333
|
{
|
|
36187
36334
|
type: "button",
|
|
@@ -36196,7 +36343,7 @@ var BubbleMenuContent = ({
|
|
|
36196
36343
|
)) })
|
|
36197
36344
|
] }),
|
|
36198
36345
|
/* @__PURE__ */ jsxs76("div", { className: "mt-2 grid grid-cols-3 gap-1", children: [
|
|
36199
|
-
/* @__PURE__ */
|
|
36346
|
+
/* @__PURE__ */ jsx94(
|
|
36200
36347
|
"button",
|
|
36201
36348
|
{
|
|
36202
36349
|
type: "button",
|
|
@@ -36209,7 +36356,7 @@ var BubbleMenuContent = ({
|
|
|
36209
36356
|
children: t("tableMenu.apply") || "Apply"
|
|
36210
36357
|
}
|
|
36211
36358
|
),
|
|
36212
|
-
/* @__PURE__ */
|
|
36359
|
+
/* @__PURE__ */ jsx94(
|
|
36213
36360
|
"button",
|
|
36214
36361
|
{
|
|
36215
36362
|
type: "button",
|
|
@@ -36221,7 +36368,7 @@ var BubbleMenuContent = ({
|
|
|
36221
36368
|
children: t("tableMenu.clear") || "Clear"
|
|
36222
36369
|
}
|
|
36223
36370
|
),
|
|
36224
|
-
/* @__PURE__ */
|
|
36371
|
+
/* @__PURE__ */ jsx94(
|
|
36225
36372
|
"button",
|
|
36226
36373
|
{
|
|
36227
36374
|
type: "button",
|
|
@@ -36236,8 +36383,8 @@ var BubbleMenuContent = ({
|
|
|
36236
36383
|
if (showTypographyPanel) {
|
|
36237
36384
|
return /* @__PURE__ */ jsxs76("div", { className: "w-72 p-2", children: [
|
|
36238
36385
|
/* @__PURE__ */ jsxs76("div", { className: "mb-2 flex items-center justify-between gap-2", children: [
|
|
36239
|
-
/* @__PURE__ */
|
|
36240
|
-
/* @__PURE__ */
|
|
36386
|
+
/* @__PURE__ */ jsx94("span", { className: "px-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: t("toolbar.textStyle") }),
|
|
36387
|
+
/* @__PURE__ */ jsx94(
|
|
36241
36388
|
"button",
|
|
36242
36389
|
{
|
|
36243
36390
|
type: "button",
|
|
@@ -36249,9 +36396,9 @@ var BubbleMenuContent = ({
|
|
|
36249
36396
|
] }),
|
|
36250
36397
|
/* @__PURE__ */ jsxs76("div", { className: "space-y-2", children: [
|
|
36251
36398
|
/* @__PURE__ */ jsxs76("div", { children: [
|
|
36252
|
-
/* @__PURE__ */
|
|
36399
|
+
/* @__PURE__ */ jsx94("div", { className: "mb-1 px-1 text-[11px] font-medium text-muted-foreground", children: t("toolbar.fontSize") }),
|
|
36253
36400
|
/* @__PURE__ */ jsxs76("div", { className: "flex h-9 items-center overflow-hidden rounded-md border border-border/60 bg-muted/40", children: [
|
|
36254
|
-
/* @__PURE__ */
|
|
36401
|
+
/* @__PURE__ */ jsx94(
|
|
36255
36402
|
"input",
|
|
36256
36403
|
{
|
|
36257
36404
|
type: "number",
|
|
@@ -36275,8 +36422,8 @@ var BubbleMenuContent = ({
|
|
|
36275
36422
|
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"
|
|
36276
36423
|
}
|
|
36277
36424
|
),
|
|
36278
|
-
/* @__PURE__ */
|
|
36279
|
-
/* @__PURE__ */
|
|
36425
|
+
/* @__PURE__ */ jsx94("span", { className: "border-l border-border/50 px-2 text-[11px] text-muted-foreground", children: "px" }),
|
|
36426
|
+
/* @__PURE__ */ jsx94(
|
|
36280
36427
|
"button",
|
|
36281
36428
|
{
|
|
36282
36429
|
type: "button",
|
|
@@ -36286,12 +36433,12 @@ var BubbleMenuContent = ({
|
|
|
36286
36433
|
"flex h-full w-9 items-center justify-center border-l border-border/50 transition-colors hover:bg-muted",
|
|
36287
36434
|
showFontSizeOptions && "bg-primary/10 text-primary"
|
|
36288
36435
|
),
|
|
36289
|
-
children: /* @__PURE__ */
|
|
36436
|
+
children: /* @__PURE__ */ jsx94(ChevronDown9, { className: "h-4 w-4" })
|
|
36290
36437
|
}
|
|
36291
36438
|
)
|
|
36292
36439
|
] }),
|
|
36293
36440
|
showFontSizeOptions && /* @__PURE__ */ jsxs76("div", { className: "mt-1 grid grid-cols-4 gap-1", children: [
|
|
36294
|
-
/* @__PURE__ */
|
|
36441
|
+
/* @__PURE__ */ jsx94(
|
|
36295
36442
|
"button",
|
|
36296
36443
|
{
|
|
36297
36444
|
type: "button",
|
|
@@ -36306,7 +36453,7 @@ var BubbleMenuContent = ({
|
|
|
36306
36453
|
children: "A"
|
|
36307
36454
|
}
|
|
36308
36455
|
),
|
|
36309
|
-
quickFontSizes.map((option) => /* @__PURE__ */
|
|
36456
|
+
quickFontSizes.map((option) => /* @__PURE__ */ jsx94(
|
|
36310
36457
|
"button",
|
|
36311
36458
|
{
|
|
36312
36459
|
type: "button",
|
|
@@ -36325,9 +36472,9 @@ var BubbleMenuContent = ({
|
|
|
36325
36472
|
] })
|
|
36326
36473
|
] }),
|
|
36327
36474
|
/* @__PURE__ */ jsxs76("div", { children: [
|
|
36328
|
-
/* @__PURE__ */
|
|
36475
|
+
/* @__PURE__ */ jsx94("div", { className: "mb-1 px-1 text-[11px] font-medium text-muted-foreground", children: t("toolbar.lineHeight") }),
|
|
36329
36476
|
/* @__PURE__ */ jsxs76("div", { className: "grid grid-cols-4 gap-1", children: [
|
|
36330
|
-
/* @__PURE__ */
|
|
36477
|
+
/* @__PURE__ */ jsx94(
|
|
36331
36478
|
"button",
|
|
36332
36479
|
{
|
|
36333
36480
|
type: "button",
|
|
@@ -36339,7 +36486,7 @@ var BubbleMenuContent = ({
|
|
|
36339
36486
|
children: "LH"
|
|
36340
36487
|
}
|
|
36341
36488
|
),
|
|
36342
|
-
quickLineHeights.map((option) => /* @__PURE__ */
|
|
36489
|
+
quickLineHeights.map((option) => /* @__PURE__ */ jsx94(
|
|
36343
36490
|
"button",
|
|
36344
36491
|
{
|
|
36345
36492
|
type: "button",
|
|
@@ -36365,7 +36512,7 @@ var BubbleMenuContent = ({
|
|
|
36365
36512
|
editor.isActive("subscript") ? "bg-primary/10 text-primary" : "bg-muted/40 text-foreground"
|
|
36366
36513
|
),
|
|
36367
36514
|
children: [
|
|
36368
|
-
/* @__PURE__ */
|
|
36515
|
+
/* @__PURE__ */ jsx94(SubscriptIcon, { className: "h-4 w-4" }),
|
|
36369
36516
|
t("toolbar.subscript")
|
|
36370
36517
|
]
|
|
36371
36518
|
}
|
|
@@ -36380,7 +36527,7 @@ var BubbleMenuContent = ({
|
|
|
36380
36527
|
editor.isActive("superscript") ? "bg-primary/10 text-primary" : "bg-muted/40 text-foreground"
|
|
36381
36528
|
),
|
|
36382
36529
|
children: [
|
|
36383
|
-
/* @__PURE__ */
|
|
36530
|
+
/* @__PURE__ */ jsx94(SuperscriptIcon, { className: "h-4 w-4" }),
|
|
36384
36531
|
t("toolbar.superscript")
|
|
36385
36532
|
]
|
|
36386
36533
|
}
|
|
@@ -36391,21 +36538,21 @@ var BubbleMenuContent = ({
|
|
|
36391
36538
|
}
|
|
36392
36539
|
const VerticalAlignActiveIcon = currentCellVerticalAlign === "middle" ? AlignCenterVertical2 : currentCellVerticalAlign === "bottom" ? AlignEndVertical2 : AlignStartVertical2;
|
|
36393
36540
|
return /* @__PURE__ */ jsxs76("div", { className: "flex items-center gap-0.5 p-1", children: [
|
|
36394
|
-
/* @__PURE__ */
|
|
36395
|
-
/* @__PURE__ */
|
|
36396
|
-
/* @__PURE__ */
|
|
36541
|
+
/* @__PURE__ */ jsx94(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ jsx94(BoldIcon, { className: "w-4 h-4" }) }),
|
|
36542
|
+
/* @__PURE__ */ jsx94(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ jsx94(ItalicIcon, { className: "w-4 h-4" }) }),
|
|
36543
|
+
/* @__PURE__ */ jsx94(
|
|
36397
36544
|
ToolbarButton,
|
|
36398
36545
|
{
|
|
36399
36546
|
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
36400
36547
|
active: editor.isActive("underline"),
|
|
36401
36548
|
title: t("toolbar.underline"),
|
|
36402
|
-
children: /* @__PURE__ */
|
|
36549
|
+
children: /* @__PURE__ */ jsx94(UnderlineIcon, { className: "w-4 h-4" })
|
|
36403
36550
|
}
|
|
36404
36551
|
),
|
|
36405
|
-
/* @__PURE__ */
|
|
36406
|
-
/* @__PURE__ */
|
|
36407
|
-
/* @__PURE__ */
|
|
36408
|
-
/* @__PURE__ */
|
|
36552
|
+
/* @__PURE__ */ jsx94(ToolbarButton, { onClick: () => editor.chain().focus().toggleStrike().run(), active: editor.isActive("strike"), title: t("toolbar.strike"), children: /* @__PURE__ */ jsx94(StrikethroughIcon, { className: "w-4 h-4" }) }),
|
|
36553
|
+
/* @__PURE__ */ jsx94(ToolbarButton, { onClick: () => editor.chain().focus().toggleCode().run(), active: editor.isActive("code"), title: t("toolbar.code"), children: /* @__PURE__ */ jsx94(CodeIcon, { className: "w-4 h-4" }) }),
|
|
36554
|
+
/* @__PURE__ */ jsx94("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
36555
|
+
/* @__PURE__ */ jsx94(
|
|
36409
36556
|
ToolbarButton,
|
|
36410
36557
|
{
|
|
36411
36558
|
onMouseDown: () => {
|
|
@@ -36416,22 +36563,22 @@ var BubbleMenuContent = ({
|
|
|
36416
36563
|
},
|
|
36417
36564
|
active: editor.isActive("link"),
|
|
36418
36565
|
title: t("toolbar.link"),
|
|
36419
|
-
children: /* @__PURE__ */
|
|
36566
|
+
children: /* @__PURE__ */ jsx94(LinkIcon2, { className: "w-4 h-4" })
|
|
36420
36567
|
}
|
|
36421
36568
|
),
|
|
36422
|
-
/* @__PURE__ */
|
|
36423
|
-
/* @__PURE__ */
|
|
36569
|
+
/* @__PURE__ */ jsx94(ToolbarButton, { onClick: () => setActiveColorPalette("text"), title: t("colors.textColor"), children: /* @__PURE__ */ jsx94(TextColorIcon, { color: currentTextColor }) }),
|
|
36570
|
+
/* @__PURE__ */ jsx94(ToolbarButton, { onClick: () => setActiveColorPalette("highlight"), active: editor.isActive("highlight"), title: t("colors.highlight"), children: /* @__PURE__ */ jsx94(HighlightColorIcon, { color: currentHighlightColor }) }),
|
|
36424
36571
|
isInTable2 && /* @__PURE__ */ jsxs76(Fragment31, { children: [
|
|
36425
|
-
/* @__PURE__ */
|
|
36572
|
+
/* @__PURE__ */ jsx94(
|
|
36426
36573
|
ToolbarButton,
|
|
36427
36574
|
{
|
|
36428
36575
|
onClick: () => setActiveColorPalette("cell-bg"),
|
|
36429
36576
|
active: Boolean(currentCellBgColor),
|
|
36430
36577
|
title: t("tableMenu.cellBackground") || "Cell background",
|
|
36431
|
-
children: /* @__PURE__ */
|
|
36578
|
+
children: /* @__PURE__ */ jsx94(CellBgColorIcon, { color: currentCellBgColor })
|
|
36432
36579
|
}
|
|
36433
36580
|
),
|
|
36434
|
-
/* @__PURE__ */
|
|
36581
|
+
/* @__PURE__ */ jsx94(
|
|
36435
36582
|
ToolbarButton,
|
|
36436
36583
|
{
|
|
36437
36584
|
onMouseDown: () => {
|
|
@@ -36442,7 +36589,7 @@ var BubbleMenuContent = ({
|
|
|
36442
36589
|
editor.getAttributes("tableCell").borderColor || editor.getAttributes("tableHeader").borderColor || editor.getAttributes("tableCell").borderStyle || editor.getAttributes("tableHeader").borderStyle || editor.getAttributes("tableCell").borderWidth || editor.getAttributes("tableHeader").borderWidth
|
|
36443
36590
|
),
|
|
36444
36591
|
title: t("tableMenu.cellBorder") || "Cell border",
|
|
36445
|
-
children: /* @__PURE__ */
|
|
36592
|
+
children: /* @__PURE__ */ jsx94(
|
|
36446
36593
|
CellBorderIcon,
|
|
36447
36594
|
{
|
|
36448
36595
|
color: editor.getAttributes("tableCell").borderColor || editor.getAttributes("tableHeader").borderColor
|
|
@@ -36450,7 +36597,7 @@ var BubbleMenuContent = ({
|
|
|
36450
36597
|
)
|
|
36451
36598
|
}
|
|
36452
36599
|
),
|
|
36453
|
-
/* @__PURE__ */
|
|
36600
|
+
/* @__PURE__ */ jsx94(
|
|
36454
36601
|
ToolbarButton,
|
|
36455
36602
|
{
|
|
36456
36603
|
onMouseDown: () => {
|
|
@@ -36462,10 +36609,10 @@ var BubbleMenuContent = ({
|
|
|
36462
36609
|
},
|
|
36463
36610
|
active: Boolean(currentCellFormula),
|
|
36464
36611
|
title: t("tableMenu.formula") || "Formula",
|
|
36465
|
-
children: /* @__PURE__ */
|
|
36612
|
+
children: /* @__PURE__ */ jsx94(Sigma2, { className: "w-4 h-4" })
|
|
36466
36613
|
}
|
|
36467
36614
|
),
|
|
36468
|
-
/* @__PURE__ */
|
|
36615
|
+
/* @__PURE__ */ jsx94(
|
|
36469
36616
|
ToolbarButton,
|
|
36470
36617
|
{
|
|
36471
36618
|
onClick: () => {
|
|
@@ -36478,7 +36625,7 @@ var BubbleMenuContent = ({
|
|
|
36478
36625
|
active: canSplitCell,
|
|
36479
36626
|
disabled: !canMergeCells && !canSplitCell,
|
|
36480
36627
|
title: canSplitCell ? t("tableMenu.splitCell") || "Split cell" : t("tableMenu.mergeCells") || "Merge cells",
|
|
36481
|
-
children: /* @__PURE__ */
|
|
36628
|
+
children: /* @__PURE__ */ jsx94(TableCellsMerge2, { className: "w-4 h-4" })
|
|
36482
36629
|
}
|
|
36483
36630
|
),
|
|
36484
36631
|
/* @__PURE__ */ jsxs76(
|
|
@@ -36497,13 +36644,13 @@ var BubbleMenuContent = ({
|
|
|
36497
36644
|
},
|
|
36498
36645
|
title: t("tableMenu.alignVertical") || "Vertical alignment",
|
|
36499
36646
|
children: [
|
|
36500
|
-
/* @__PURE__ */
|
|
36501
|
-
/* @__PURE__ */
|
|
36647
|
+
/* @__PURE__ */ jsx94(VerticalAlignActiveIcon, { className: "w-4 h-4" }),
|
|
36648
|
+
/* @__PURE__ */ jsx94(ChevronDown9, { className: "w-3 h-3" })
|
|
36502
36649
|
]
|
|
36503
36650
|
}
|
|
36504
36651
|
),
|
|
36505
36652
|
children: [
|
|
36506
|
-
/* @__PURE__ */
|
|
36653
|
+
/* @__PURE__ */ jsx94(
|
|
36507
36654
|
DropdownMenuItem,
|
|
36508
36655
|
{
|
|
36509
36656
|
icon: AlignStartVertical2,
|
|
@@ -36512,7 +36659,7 @@ var BubbleMenuContent = ({
|
|
|
36512
36659
|
active: currentCellVerticalAlign === "top"
|
|
36513
36660
|
}
|
|
36514
36661
|
),
|
|
36515
|
-
/* @__PURE__ */
|
|
36662
|
+
/* @__PURE__ */ jsx94(
|
|
36516
36663
|
DropdownMenuItem,
|
|
36517
36664
|
{
|
|
36518
36665
|
icon: AlignCenterVertical2,
|
|
@@ -36521,7 +36668,7 @@ var BubbleMenuContent = ({
|
|
|
36521
36668
|
active: currentCellVerticalAlign === "middle"
|
|
36522
36669
|
}
|
|
36523
36670
|
),
|
|
36524
|
-
/* @__PURE__ */
|
|
36671
|
+
/* @__PURE__ */ jsx94(
|
|
36525
36672
|
DropdownMenuItem,
|
|
36526
36673
|
{
|
|
36527
36674
|
icon: AlignEndVertical2,
|
|
@@ -36549,13 +36696,13 @@ var BubbleMenuContent = ({
|
|
|
36549
36696
|
},
|
|
36550
36697
|
title: t("tableMenu.textDirection"),
|
|
36551
36698
|
children: [
|
|
36552
|
-
currentCellTextDirection === "vertical" ? /* @__PURE__ */
|
|
36553
|
-
/* @__PURE__ */
|
|
36699
|
+
currentCellTextDirection === "vertical" ? /* @__PURE__ */ jsx94(ArrowDown2, { className: "w-4 h-4" }) : /* @__PURE__ */ jsx94(ArrowRight2, { className: "w-4 h-4" }),
|
|
36700
|
+
/* @__PURE__ */ jsx94(ChevronDown9, { className: "w-3 h-3" })
|
|
36554
36701
|
]
|
|
36555
36702
|
}
|
|
36556
36703
|
),
|
|
36557
36704
|
children: [
|
|
36558
|
-
/* @__PURE__ */
|
|
36705
|
+
/* @__PURE__ */ jsx94(
|
|
36559
36706
|
DropdownMenuItem,
|
|
36560
36707
|
{
|
|
36561
36708
|
icon: ArrowRight2,
|
|
@@ -36564,7 +36711,7 @@ var BubbleMenuContent = ({
|
|
|
36564
36711
|
active: currentCellTextDirection === "horizontal"
|
|
36565
36712
|
}
|
|
36566
36713
|
),
|
|
36567
|
-
/* @__PURE__ */
|
|
36714
|
+
/* @__PURE__ */ jsx94(
|
|
36568
36715
|
DropdownMenuItem,
|
|
36569
36716
|
{
|
|
36570
36717
|
icon: ArrowDown2,
|
|
@@ -36577,13 +36724,13 @@ var BubbleMenuContent = ({
|
|
|
36577
36724
|
}
|
|
36578
36725
|
)
|
|
36579
36726
|
] }),
|
|
36580
|
-
/* @__PURE__ */
|
|
36727
|
+
/* @__PURE__ */ jsx94(
|
|
36581
36728
|
ToolbarButton,
|
|
36582
36729
|
{
|
|
36583
36730
|
onClick: () => setShowTypographyPanel(true),
|
|
36584
36731
|
active: Boolean(currentFontSize || currentLineHeight || editor.isActive("subscript") || editor.isActive("superscript")),
|
|
36585
36732
|
title: t("toolbar.textStyle"),
|
|
36586
|
-
children: /* @__PURE__ */
|
|
36733
|
+
children: /* @__PURE__ */ jsx94(Type3, { className: "w-4 h-4" })
|
|
36587
36734
|
}
|
|
36588
36735
|
)
|
|
36589
36736
|
] });
|
|
@@ -36599,11 +36746,11 @@ var LinkPreviewContent = ({ editor, onEdit }) => {
|
|
|
36599
36746
|
editor.chain().focus().unsetLink().run();
|
|
36600
36747
|
};
|
|
36601
36748
|
return /* @__PURE__ */ jsxs76("div", { className: "flex items-center gap-1 p-1 max-w-sm", children: [
|
|
36602
|
-
/* @__PURE__ */
|
|
36603
|
-
/* @__PURE__ */
|
|
36604
|
-
/* @__PURE__ */
|
|
36605
|
-
/* @__PURE__ */
|
|
36606
|
-
/* @__PURE__ */
|
|
36749
|
+
/* @__PURE__ */ jsx94("span", { className: "text-xs text-muted-foreground font-mono px-2 truncate max-w-45", children: url }),
|
|
36750
|
+
/* @__PURE__ */ jsx94("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
36751
|
+
/* @__PURE__ */ jsx94(ToolbarButton, { onClick: handleOpen, title: t("linkPreview.open") || "Open link", children: /* @__PURE__ */ jsx94(ExternalLink3, { className: "w-4 h-4" }) }),
|
|
36752
|
+
/* @__PURE__ */ jsx94(ToolbarButton, { onClick: onEdit, title: t("linkPreview.edit") || "Edit link", children: /* @__PURE__ */ jsx94(Edit2, { className: "w-4 h-4" }) }),
|
|
36753
|
+
/* @__PURE__ */ jsx94(ToolbarButton, { onClick: handleUnlink, title: t("linkPreview.unlink") || "Remove link", className: "text-destructive hover:text-destructive", children: /* @__PURE__ */ jsx94(Unlink, { className: "w-4 h-4" }) })
|
|
36607
36754
|
] });
|
|
36608
36755
|
};
|
|
36609
36756
|
var CustomBubbleMenu = ({
|
|
@@ -36763,7 +36910,7 @@ var CustomBubbleMenu = ({
|
|
|
36763
36910
|
}, [editor]);
|
|
36764
36911
|
if (!isVisible) return null;
|
|
36765
36912
|
return createPortal8(
|
|
36766
|
-
/* @__PURE__ */
|
|
36913
|
+
/* @__PURE__ */ jsx94(
|
|
36767
36914
|
"div",
|
|
36768
36915
|
{
|
|
36769
36916
|
ref: menuRef,
|
|
@@ -36783,7 +36930,7 @@ var CustomBubbleMenu = ({
|
|
|
36783
36930
|
}
|
|
36784
36931
|
e.preventDefault();
|
|
36785
36932
|
},
|
|
36786
|
-
children: editor.isActive("link") && !keepOpen && !linkInputOpen ? /* @__PURE__ */
|
|
36933
|
+
children: editor.isActive("link") && !keepOpen && !linkInputOpen ? /* @__PURE__ */ jsx94(
|
|
36787
36934
|
LinkPreviewContent,
|
|
36788
36935
|
{
|
|
36789
36936
|
editor,
|
|
@@ -36792,7 +36939,7 @@ var CustomBubbleMenu = ({
|
|
|
36792
36939
|
setKeepOpen(true);
|
|
36793
36940
|
}
|
|
36794
36941
|
}
|
|
36795
|
-
) : /* @__PURE__ */
|
|
36942
|
+
) : /* @__PURE__ */ jsx94(
|
|
36796
36943
|
BubbleMenuContent,
|
|
36797
36944
|
{
|
|
36798
36945
|
editor,
|
|
@@ -36841,7 +36988,7 @@ var CustomFloatingMenu = ({ editor }) => {
|
|
|
36841
36988
|
}, [editor]);
|
|
36842
36989
|
if (!isVisible) return null;
|
|
36843
36990
|
return createPortal8(
|
|
36844
|
-
/* @__PURE__ */
|
|
36991
|
+
/* @__PURE__ */ jsx94(
|
|
36845
36992
|
"div",
|
|
36846
36993
|
{
|
|
36847
36994
|
"data-popover": true,
|
|
@@ -36852,7 +36999,7 @@ var CustomFloatingMenu = ({ editor }) => {
|
|
|
36852
36999
|
transform: "translate(-50%, -100%)"
|
|
36853
37000
|
},
|
|
36854
37001
|
onMouseDown: (e) => e.preventDefault(),
|
|
36855
|
-
children: /* @__PURE__ */
|
|
37002
|
+
children: /* @__PURE__ */ jsx94(FloatingMenuContent, { editor })
|
|
36856
37003
|
}
|
|
36857
37004
|
),
|
|
36858
37005
|
document.body
|
|
@@ -37299,7 +37446,7 @@ async function prepareUEditorContentForSave({
|
|
|
37299
37446
|
}
|
|
37300
37447
|
|
|
37301
37448
|
// src/components/UEditor/table-controls.tsx
|
|
37302
|
-
import
|
|
37449
|
+
import React86 from "react";
|
|
37303
37450
|
|
|
37304
37451
|
// node_modules/prosemirror-model/dist/index.js
|
|
37305
37452
|
function findDiffStart(a, b, pos) {
|
|
@@ -41784,7 +41931,7 @@ function buildTableHoverState({
|
|
|
41784
41931
|
}
|
|
41785
41932
|
|
|
41786
41933
|
// src/components/UEditor/table-drag-preview.tsx
|
|
41787
|
-
import { Fragment as Fragment33, jsx as
|
|
41934
|
+
import { Fragment as Fragment33, jsx as jsx95, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
41788
41935
|
function TableDragPreview({
|
|
41789
41936
|
columnDragLabel,
|
|
41790
41937
|
dragPreview,
|
|
@@ -41797,7 +41944,7 @@ function TableDragPreview({
|
|
|
41797
41944
|
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`;
|
|
41798
41945
|
return /* @__PURE__ */ jsxs78(Fragment33, { children: [
|
|
41799
41946
|
dragPreview.kind === "row" && /* @__PURE__ */ jsxs78(Fragment33, { children: [
|
|
41800
|
-
/* @__PURE__ */
|
|
41947
|
+
/* @__PURE__ */ jsx95(
|
|
41801
41948
|
"div",
|
|
41802
41949
|
{
|
|
41803
41950
|
"aria-hidden": "true",
|
|
@@ -41810,7 +41957,7 @@ function TableDragPreview({
|
|
|
41810
41957
|
}
|
|
41811
41958
|
}
|
|
41812
41959
|
),
|
|
41813
|
-
/* @__PURE__ */
|
|
41960
|
+
/* @__PURE__ */ jsx95(
|
|
41814
41961
|
"div",
|
|
41815
41962
|
{
|
|
41816
41963
|
"aria-hidden": "true",
|
|
@@ -41825,7 +41972,7 @@ function TableDragPreview({
|
|
|
41825
41972
|
)
|
|
41826
41973
|
] }),
|
|
41827
41974
|
dragPreview.kind === "column" && /* @__PURE__ */ jsxs78(Fragment33, { children: [
|
|
41828
|
-
/* @__PURE__ */
|
|
41975
|
+
/* @__PURE__ */ jsx95(
|
|
41829
41976
|
"div",
|
|
41830
41977
|
{
|
|
41831
41978
|
"aria-hidden": "true",
|
|
@@ -41838,7 +41985,7 @@ function TableDragPreview({
|
|
|
41838
41985
|
}
|
|
41839
41986
|
}
|
|
41840
41987
|
),
|
|
41841
|
-
/* @__PURE__ */
|
|
41988
|
+
/* @__PURE__ */ jsx95(
|
|
41842
41989
|
"div",
|
|
41843
41990
|
{
|
|
41844
41991
|
"aria-hidden": "true",
|
|
@@ -41852,7 +41999,7 @@ function TableDragPreview({
|
|
|
41852
41999
|
}
|
|
41853
42000
|
)
|
|
41854
42001
|
] }),
|
|
41855
|
-
(dragPreview.kind === "add-row" || dragPreview.kind === "add-column") && /* @__PURE__ */
|
|
42002
|
+
(dragPreview.kind === "add-row" || dragPreview.kind === "add-column") && /* @__PURE__ */ jsx95(
|
|
41856
42003
|
"div",
|
|
41857
42004
|
{
|
|
41858
42005
|
"aria-hidden": "true",
|
|
@@ -41865,7 +42012,7 @@ function TableDragPreview({
|
|
|
41865
42012
|
}
|
|
41866
42013
|
}
|
|
41867
42014
|
),
|
|
41868
|
-
/* @__PURE__ */
|
|
42015
|
+
/* @__PURE__ */ jsx95(
|
|
41869
42016
|
"div",
|
|
41870
42017
|
{
|
|
41871
42018
|
role: "status",
|
|
@@ -41881,7 +42028,7 @@ function TableDragPreview({
|
|
|
41881
42028
|
}
|
|
41882
42029
|
|
|
41883
42030
|
// src/components/UEditor/table-add-rails.tsx
|
|
41884
|
-
import { Fragment as Fragment34, jsx as
|
|
42031
|
+
import { Fragment as Fragment34, jsx as jsx96, jsxs as jsxs79 } from "react/jsx-runtime";
|
|
41885
42032
|
var ADD_COLUMN_RAIL_GAP = 4;
|
|
41886
42033
|
var ADD_ROW_RAIL_GAP = 4;
|
|
41887
42034
|
function TableAddRails({
|
|
@@ -41903,12 +42050,12 @@ function TableAddRails({
|
|
|
41903
42050
|
const showColumnRail = controlsVisible || addColumnVisible;
|
|
41904
42051
|
const showRowRail = controlsVisible || addRowVisible;
|
|
41905
42052
|
return /* @__PURE__ */ jsxs79(Fragment34, { children: [
|
|
41906
|
-
/* @__PURE__ */
|
|
42053
|
+
/* @__PURE__ */ jsx96(
|
|
41907
42054
|
Tooltip,
|
|
41908
42055
|
{
|
|
41909
42056
|
placement: "right",
|
|
41910
|
-
content: /* @__PURE__ */
|
|
41911
|
-
children: /* @__PURE__ */
|
|
42057
|
+
content: /* @__PURE__ */ jsx96("span", { className: "text-xs font-medium", children: quickAddColumnLabel }),
|
|
42058
|
+
children: /* @__PURE__ */ jsx96(
|
|
41912
42059
|
"button",
|
|
41913
42060
|
{
|
|
41914
42061
|
type: "button",
|
|
@@ -41935,17 +42082,17 @@ function TableAddRails({
|
|
|
41935
42082
|
transform: showColumnRail ? "scale(1)" : "scale(0.92)",
|
|
41936
42083
|
pointerEvents: showColumnRail ? "auto" : "none"
|
|
41937
42084
|
},
|
|
41938
|
-
children: /* @__PURE__ */
|
|
42085
|
+
children: /* @__PURE__ */ jsx96("span", { className: "text-sm font-medium leading-none", children: "+" })
|
|
41939
42086
|
}
|
|
41940
42087
|
)
|
|
41941
42088
|
}
|
|
41942
42089
|
),
|
|
41943
|
-
/* @__PURE__ */
|
|
42090
|
+
/* @__PURE__ */ jsx96(
|
|
41944
42091
|
Tooltip,
|
|
41945
42092
|
{
|
|
41946
42093
|
placement: "bottom",
|
|
41947
|
-
content: /* @__PURE__ */
|
|
41948
|
-
children: /* @__PURE__ */
|
|
42094
|
+
content: /* @__PURE__ */ jsx96("span", { className: "text-xs font-medium", children: quickAddRowLabel }),
|
|
42095
|
+
children: /* @__PURE__ */ jsx96(
|
|
41949
42096
|
"button",
|
|
41950
42097
|
{
|
|
41951
42098
|
type: "button",
|
|
@@ -41972,7 +42119,7 @@ function TableAddRails({
|
|
|
41972
42119
|
transform: showRowRail ? "scale(1)" : "scale(0.92)",
|
|
41973
42120
|
pointerEvents: showRowRail ? "auto" : "none"
|
|
41974
42121
|
},
|
|
41975
|
-
children: /* @__PURE__ */
|
|
42122
|
+
children: /* @__PURE__ */ jsx96("span", { className: "text-sm font-medium leading-none", children: "+" })
|
|
41976
42123
|
}
|
|
41977
42124
|
)
|
|
41978
42125
|
}
|
|
@@ -41982,7 +42129,7 @@ function TableAddRails({
|
|
|
41982
42129
|
|
|
41983
42130
|
// src/components/UEditor/table-control-menu.tsx
|
|
41984
42131
|
import { MoreHorizontal as MoreHorizontal2 } from "lucide-react";
|
|
41985
|
-
import { jsx as
|
|
42132
|
+
import { jsx as jsx97 } from "react/jsx-runtime";
|
|
41986
42133
|
function TableControlMenu({
|
|
41987
42134
|
controlsVisible,
|
|
41988
42135
|
isOpen,
|
|
@@ -41994,7 +42141,7 @@ function TableControlMenu({
|
|
|
41994
42141
|
top
|
|
41995
42142
|
}) {
|
|
41996
42143
|
const shown = controlsVisible || menuVisible || isOpen;
|
|
41997
|
-
return /* @__PURE__ */
|
|
42144
|
+
return /* @__PURE__ */ jsx97(
|
|
41998
42145
|
"div",
|
|
41999
42146
|
{
|
|
42000
42147
|
className: "absolute z-30",
|
|
@@ -42003,13 +42150,13 @@ function TableControlMenu({
|
|
|
42003
42150
|
top,
|
|
42004
42151
|
left
|
|
42005
42152
|
},
|
|
42006
|
-
children: /* @__PURE__ */
|
|
42153
|
+
children: /* @__PURE__ */ jsx97(
|
|
42007
42154
|
Tooltip,
|
|
42008
42155
|
{
|
|
42009
42156
|
placement: "top",
|
|
42010
42157
|
disabled: isOpen,
|
|
42011
|
-
content: /* @__PURE__ */
|
|
42012
|
-
children: /* @__PURE__ */
|
|
42158
|
+
content: /* @__PURE__ */ jsx97("span", { className: "text-xs font-medium", children: label }),
|
|
42159
|
+
children: /* @__PURE__ */ jsx97("span", { className: "inline-flex", children: /* @__PURE__ */ jsx97(
|
|
42013
42160
|
DropdownMenu,
|
|
42014
42161
|
{
|
|
42015
42162
|
placement: "bottom-start",
|
|
@@ -42017,7 +42164,7 @@ function TableControlMenu({
|
|
|
42017
42164
|
onOpenChange,
|
|
42018
42165
|
contentClassName: "p-2",
|
|
42019
42166
|
items,
|
|
42020
|
-
trigger: /* @__PURE__ */
|
|
42167
|
+
trigger: /* @__PURE__ */ jsx97(
|
|
42021
42168
|
"button",
|
|
42022
42169
|
{
|
|
42023
42170
|
type: "button",
|
|
@@ -42033,7 +42180,7 @@ function TableControlMenu({
|
|
|
42033
42180
|
transform: shown ? "scale(1)" : "scale(0.82)",
|
|
42034
42181
|
pointerEvents: shown ? "auto" : "none"
|
|
42035
42182
|
},
|
|
42036
|
-
children: /* @__PURE__ */
|
|
42183
|
+
children: /* @__PURE__ */ jsx97(MoreHorizontal2, { className: "h-4 w-4" })
|
|
42037
42184
|
}
|
|
42038
42185
|
)
|
|
42039
42186
|
}
|
|
@@ -42046,7 +42193,7 @@ function TableControlMenu({
|
|
|
42046
42193
|
|
|
42047
42194
|
// src/components/UEditor/table-axis-handles.tsx
|
|
42048
42195
|
import { GripHorizontal, GripVertical as GripVertical3 } from "lucide-react";
|
|
42049
|
-
import { Fragment as Fragment35, jsx as
|
|
42196
|
+
import { Fragment as Fragment35, jsx as jsx98 } from "react/jsx-runtime";
|
|
42050
42197
|
var IDLE_HANDLE_SCALE = "0.78";
|
|
42051
42198
|
function TableRowHandles({
|
|
42052
42199
|
activeRowIndex,
|
|
@@ -42060,12 +42207,12 @@ function TableRowHandles({
|
|
|
42060
42207
|
rowHandleLeft,
|
|
42061
42208
|
rowHandles
|
|
42062
42209
|
}) {
|
|
42063
|
-
return /* @__PURE__ */
|
|
42210
|
+
return /* @__PURE__ */ jsx98(Fragment35, { children: rowHandles.map((rowHandle) => {
|
|
42064
42211
|
const menuKey = `row:${rowHandle.index}`;
|
|
42065
42212
|
const isActive = rowHandle.index === activeRowIndex;
|
|
42066
42213
|
const visible = controlsVisible || hoverRowHandleIndex === rowHandle.index || openMenuKey === menuKey;
|
|
42067
42214
|
const isShown = visible || isActive;
|
|
42068
|
-
return /* @__PURE__ */
|
|
42215
|
+
return /* @__PURE__ */ jsx98(
|
|
42069
42216
|
"div",
|
|
42070
42217
|
{
|
|
42071
42218
|
className: "absolute z-30",
|
|
@@ -42074,13 +42221,13 @@ function TableRowHandles({
|
|
|
42074
42221
|
top: Math.max(8, rowHandle.center - 12),
|
|
42075
42222
|
left: rowHandleLeft
|
|
42076
42223
|
},
|
|
42077
|
-
children: /* @__PURE__ */
|
|
42224
|
+
children: /* @__PURE__ */ jsx98(
|
|
42078
42225
|
Tooltip,
|
|
42079
42226
|
{
|
|
42080
42227
|
placement: "right",
|
|
42081
42228
|
disabled: openMenuKey === menuKey || !visible && isActive,
|
|
42082
|
-
content: /* @__PURE__ */
|
|
42083
|
-
children: /* @__PURE__ */
|
|
42229
|
+
content: /* @__PURE__ */ jsx98("span", { className: "text-xs font-medium", children: `${rowDragLabel} ${rowHandle.index + 1}` }),
|
|
42230
|
+
children: /* @__PURE__ */ jsx98("span", { className: "inline-flex", children: /* @__PURE__ */ jsx98(
|
|
42084
42231
|
DropdownMenu,
|
|
42085
42232
|
{
|
|
42086
42233
|
placement: "right",
|
|
@@ -42088,7 +42235,7 @@ function TableRowHandles({
|
|
|
42088
42235
|
onOpenChange: (open) => onOpenMenuChange(menuKey, open),
|
|
42089
42236
|
contentClassName: "p-2",
|
|
42090
42237
|
items: getMenuItems(rowHandle),
|
|
42091
|
-
trigger: /* @__PURE__ */
|
|
42238
|
+
trigger: /* @__PURE__ */ jsx98(
|
|
42092
42239
|
"button",
|
|
42093
42240
|
{
|
|
42094
42241
|
type: "button",
|
|
@@ -42107,7 +42254,7 @@ function TableRowHandles({
|
|
|
42107
42254
|
transform: isShown ? "scale(1)" : `scale(${IDLE_HANDLE_SCALE})`,
|
|
42108
42255
|
pointerEvents: isShown ? "auto" : "none"
|
|
42109
42256
|
},
|
|
42110
|
-
children: visible ? /* @__PURE__ */
|
|
42257
|
+
children: visible ? /* @__PURE__ */ jsx98(GripVertical3, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx98("div", { className: "h-3 w-1 rounded-full bg-muted-foreground/50 hover:bg-muted-foreground" })
|
|
42111
42258
|
}
|
|
42112
42259
|
)
|
|
42113
42260
|
}
|
|
@@ -42131,12 +42278,12 @@ function TableColumnHandles({
|
|
|
42131
42278
|
onStartDrag,
|
|
42132
42279
|
openMenuKey
|
|
42133
42280
|
}) {
|
|
42134
|
-
return /* @__PURE__ */
|
|
42281
|
+
return /* @__PURE__ */ jsx98(Fragment35, { children: columnHandles.map((columnHandle) => {
|
|
42135
42282
|
const menuKey = `column:${columnHandle.index}`;
|
|
42136
42283
|
const isActive = columnHandle.index === activeColumnIndex;
|
|
42137
42284
|
const visible = controlsVisible || hoverColumnHandleIndex === columnHandle.index || openMenuKey === menuKey;
|
|
42138
42285
|
const isShown = visible || isActive;
|
|
42139
|
-
return /* @__PURE__ */
|
|
42286
|
+
return /* @__PURE__ */ jsx98(
|
|
42140
42287
|
"div",
|
|
42141
42288
|
{
|
|
42142
42289
|
className: "absolute z-30",
|
|
@@ -42145,13 +42292,13 @@ function TableColumnHandles({
|
|
|
42145
42292
|
top: columnHandleTop,
|
|
42146
42293
|
left: Math.max(8, columnHandle.center - 12)
|
|
42147
42294
|
},
|
|
42148
|
-
children: /* @__PURE__ */
|
|
42295
|
+
children: /* @__PURE__ */ jsx98(
|
|
42149
42296
|
Tooltip,
|
|
42150
42297
|
{
|
|
42151
42298
|
placement: "top",
|
|
42152
42299
|
disabled: openMenuKey === menuKey || !visible && isActive,
|
|
42153
|
-
content: /* @__PURE__ */
|
|
42154
|
-
children: /* @__PURE__ */
|
|
42300
|
+
content: /* @__PURE__ */ jsx98("span", { className: "text-xs font-medium", children: `${columnDragLabel} ${columnHandle.index + 1}` }),
|
|
42301
|
+
children: /* @__PURE__ */ jsx98("span", { className: "inline-flex", children: /* @__PURE__ */ jsx98(
|
|
42155
42302
|
DropdownMenu,
|
|
42156
42303
|
{
|
|
42157
42304
|
placement: "bottom-start",
|
|
@@ -42159,7 +42306,7 @@ function TableColumnHandles({
|
|
|
42159
42306
|
onOpenChange: (open) => onOpenMenuChange(menuKey, open),
|
|
42160
42307
|
contentClassName: "p-2",
|
|
42161
42308
|
items: getMenuItems(columnHandle),
|
|
42162
|
-
trigger: /* @__PURE__ */
|
|
42309
|
+
trigger: /* @__PURE__ */ jsx98(
|
|
42163
42310
|
"button",
|
|
42164
42311
|
{
|
|
42165
42312
|
type: "button",
|
|
@@ -42178,7 +42325,7 @@ function TableColumnHandles({
|
|
|
42178
42325
|
transform: isShown ? "scale(1)" : `scale(${IDLE_HANDLE_SCALE})`,
|
|
42179
42326
|
pointerEvents: isShown ? "auto" : "none"
|
|
42180
42327
|
},
|
|
42181
|
-
children: visible ? /* @__PURE__ */
|
|
42328
|
+
children: visible ? /* @__PURE__ */ jsx98(GripHorizontal, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx98("div", { className: "h-1 w-3 rounded-full bg-muted-foreground/50 hover:bg-muted-foreground" })
|
|
42182
42329
|
}
|
|
42183
42330
|
)
|
|
42184
42331
|
}
|
|
@@ -42192,7 +42339,7 @@ function TableColumnHandles({
|
|
|
42192
42339
|
}
|
|
42193
42340
|
|
|
42194
42341
|
// src/components/UEditor/table-controls.tsx
|
|
42195
|
-
import { Fragment as Fragment36, jsx as
|
|
42342
|
+
import { Fragment as Fragment36, jsx as jsx99, jsxs as jsxs80 } from "react/jsx-runtime";
|
|
42196
42343
|
var TABLE_MENU_TOP_OFFSET = 10;
|
|
42197
42344
|
function nearestIndex(centers, position) {
|
|
42198
42345
|
let bestIndex = 0;
|
|
@@ -42218,17 +42365,17 @@ function getSelectedCell(editor) {
|
|
|
42218
42365
|
}
|
|
42219
42366
|
function TableControls({ editor, containerRef }) {
|
|
42220
42367
|
const t = useSmartTranslations("UEditor");
|
|
42221
|
-
const [layout, setLayout] =
|
|
42222
|
-
const [dragPreview, setDragPreview] =
|
|
42223
|
-
const [hoverState, setHoverState] =
|
|
42224
|
-
const [openMenuKey, setOpenMenuKey] =
|
|
42225
|
-
const layoutRef =
|
|
42226
|
-
const dragStateRef =
|
|
42227
|
-
const syncFrameRef =
|
|
42228
|
-
|
|
42368
|
+
const [layout, setLayout] = React86.useState(null);
|
|
42369
|
+
const [dragPreview, setDragPreview] = React86.useState(null);
|
|
42370
|
+
const [hoverState, setHoverState] = React86.useState(DEFAULT_TABLE_HOVER_STATE);
|
|
42371
|
+
const [openMenuKey, setOpenMenuKey] = React86.useState(null);
|
|
42372
|
+
const layoutRef = React86.useRef(null);
|
|
42373
|
+
const dragStateRef = React86.useRef(null);
|
|
42374
|
+
const syncFrameRef = React86.useRef(null);
|
|
42375
|
+
React86.useEffect(() => {
|
|
42229
42376
|
layoutRef.current = layout;
|
|
42230
42377
|
}, [layout]);
|
|
42231
|
-
const syncFromCell =
|
|
42378
|
+
const syncFromCell = React86.useCallback((cell) => {
|
|
42232
42379
|
const surface = containerRef.current;
|
|
42233
42380
|
if (!surface || !cell) {
|
|
42234
42381
|
setLayout(null);
|
|
@@ -42236,23 +42383,23 @@ function TableControls({ editor, containerRef }) {
|
|
|
42236
42383
|
}
|
|
42237
42384
|
setLayout(buildTableControlLayout(editor, surface, cell));
|
|
42238
42385
|
}, [containerRef, editor]);
|
|
42239
|
-
const syncFromSelection =
|
|
42386
|
+
const syncFromSelection = React86.useCallback(() => {
|
|
42240
42387
|
syncFromCell(getSelectedCell(editor));
|
|
42241
42388
|
}, [editor, syncFromCell]);
|
|
42242
|
-
const scheduleSyncFromSelection =
|
|
42389
|
+
const scheduleSyncFromSelection = React86.useCallback(() => {
|
|
42243
42390
|
if (syncFrameRef.current !== null) return;
|
|
42244
42391
|
syncFrameRef.current = window.requestAnimationFrame(() => {
|
|
42245
42392
|
syncFrameRef.current = null;
|
|
42246
42393
|
syncFromSelection();
|
|
42247
42394
|
});
|
|
42248
42395
|
}, [syncFromSelection]);
|
|
42249
|
-
|
|
42396
|
+
React86.useEffect(() => () => {
|
|
42250
42397
|
if (syncFrameRef.current !== null) {
|
|
42251
42398
|
window.cancelAnimationFrame(syncFrameRef.current);
|
|
42252
42399
|
syncFrameRef.current = null;
|
|
42253
42400
|
}
|
|
42254
42401
|
}, []);
|
|
42255
|
-
const refreshCurrentLayout =
|
|
42402
|
+
const refreshCurrentLayout = React86.useCallback(() => {
|
|
42256
42403
|
setLayout((prev) => {
|
|
42257
42404
|
if (!prev) return prev;
|
|
42258
42405
|
const surface = containerRef.current;
|
|
@@ -42262,12 +42409,12 @@ function TableControls({ editor, containerRef }) {
|
|
|
42262
42409
|
return cell ? buildTableControlLayout(editor, surface, cell) : null;
|
|
42263
42410
|
});
|
|
42264
42411
|
}, [containerRef, editor]);
|
|
42265
|
-
const clearDrag =
|
|
42412
|
+
const clearDrag = React86.useCallback(() => {
|
|
42266
42413
|
dragStateRef.current = null;
|
|
42267
42414
|
setDragPreview(null);
|
|
42268
42415
|
document.body.style.cursor = "";
|
|
42269
42416
|
}, []);
|
|
42270
|
-
const updateHoverState =
|
|
42417
|
+
const updateHoverState = React86.useCallback((event) => {
|
|
42271
42418
|
const activeLayout = layoutRef.current;
|
|
42272
42419
|
const surface = containerRef.current;
|
|
42273
42420
|
if (!activeLayout || !surface || dragStateRef.current) {
|
|
@@ -42283,7 +42430,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42283
42430
|
return areTableHoverStatesEqual(prev, nextState) ? prev : nextState;
|
|
42284
42431
|
});
|
|
42285
42432
|
}, [containerRef]);
|
|
42286
|
-
|
|
42433
|
+
React86.useEffect(() => {
|
|
42287
42434
|
const proseMirror = editor.view.dom;
|
|
42288
42435
|
const surface = containerRef.current;
|
|
42289
42436
|
if (!surface) return void 0;
|
|
@@ -42334,37 +42481,37 @@ function TableControls({ editor, containerRef }) {
|
|
|
42334
42481
|
editor.off("update", refreshCurrentLayout);
|
|
42335
42482
|
};
|
|
42336
42483
|
}, [clearDrag, containerRef, editor, refreshCurrentLayout, syncFromCell, syncFromSelection, updateHoverState]);
|
|
42337
|
-
const runAtCellPos =
|
|
42484
|
+
const runAtCellPos = React86.useCallback((cellPos, command, options) => {
|
|
42338
42485
|
const result = runTableCommandAtCellPos(editor, cellPos, command);
|
|
42339
42486
|
if (options?.sync !== false) {
|
|
42340
42487
|
scheduleSyncFromSelection();
|
|
42341
42488
|
}
|
|
42342
42489
|
return result;
|
|
42343
42490
|
}, [editor, scheduleSyncFromSelection]);
|
|
42344
|
-
const runAtActiveCell =
|
|
42491
|
+
const runAtActiveCell = React86.useCallback((command, options) => {
|
|
42345
42492
|
return runAtCellPos(layoutRef.current?.cellPos ?? null, command, options);
|
|
42346
42493
|
}, [runAtCellPos]);
|
|
42347
|
-
const duplicateRowAt =
|
|
42494
|
+
const duplicateRowAt = React86.useCallback((rowIndex, cellPos) => {
|
|
42348
42495
|
const result = duplicateTableRowAt(editor, rowIndex, cellPos);
|
|
42349
42496
|
scheduleSyncFromSelection();
|
|
42350
42497
|
return result;
|
|
42351
42498
|
}, [editor, scheduleSyncFromSelection]);
|
|
42352
|
-
const clearRowAt =
|
|
42499
|
+
const clearRowAt = React86.useCallback((rowIndex, cellPos) => {
|
|
42353
42500
|
const result = clearTableRowAt(editor, rowIndex, cellPos);
|
|
42354
42501
|
scheduleSyncFromSelection();
|
|
42355
42502
|
return result;
|
|
42356
42503
|
}, [editor, scheduleSyncFromSelection]);
|
|
42357
|
-
const duplicateColumnAt =
|
|
42504
|
+
const duplicateColumnAt = React86.useCallback((columnIndex, cellPos) => {
|
|
42358
42505
|
const result = duplicateTableColumnAt(editor, columnIndex, cellPos);
|
|
42359
42506
|
scheduleSyncFromSelection();
|
|
42360
42507
|
return result;
|
|
42361
42508
|
}, [editor, scheduleSyncFromSelection]);
|
|
42362
|
-
const clearColumnAt =
|
|
42509
|
+
const clearColumnAt = React86.useCallback((columnIndex, cellPos) => {
|
|
42363
42510
|
const result = clearTableColumnAt(editor, columnIndex, cellPos);
|
|
42364
42511
|
scheduleSyncFromSelection();
|
|
42365
42512
|
return result;
|
|
42366
42513
|
}, [editor, scheduleSyncFromSelection]);
|
|
42367
|
-
const expandTableBy =
|
|
42514
|
+
const expandTableBy = React86.useCallback((rows, cols) => {
|
|
42368
42515
|
const activeCellPos = layoutRef.current?.cellPos ?? editor.state.selection.from;
|
|
42369
42516
|
const result = expandTableFromCell(editor, activeCellPos, rows, cols);
|
|
42370
42517
|
scheduleSyncFromSelection();
|
|
@@ -42373,19 +42520,19 @@ function TableControls({ editor, containerRef }) {
|
|
|
42373
42520
|
const canExpandTable = Boolean(layout);
|
|
42374
42521
|
const controlsVisible = dragPreview !== null;
|
|
42375
42522
|
const tableMenuOpen = openMenuKey === "table";
|
|
42376
|
-
const startAddColumnDrag =
|
|
42523
|
+
const startAddColumnDrag = React86.useCallback(() => {
|
|
42377
42524
|
setOpenMenuKey(null);
|
|
42378
42525
|
dragStateRef.current = { kind: "add-column", previewCols: 1 };
|
|
42379
42526
|
setDragPreview({ kind: "add-column", previewCols: 1 });
|
|
42380
42527
|
document.body.style.cursor = "ew-resize";
|
|
42381
42528
|
}, []);
|
|
42382
|
-
const startAddRowDrag =
|
|
42529
|
+
const startAddRowDrag = React86.useCallback(() => {
|
|
42383
42530
|
setOpenMenuKey(null);
|
|
42384
42531
|
dragStateRef.current = { kind: "add-row", previewRows: 1 };
|
|
42385
42532
|
setDragPreview({ kind: "add-row", previewRows: 1 });
|
|
42386
42533
|
document.body.style.cursor = "ns-resize";
|
|
42387
42534
|
}, []);
|
|
42388
|
-
const startRowDrag =
|
|
42535
|
+
const startRowDrag = React86.useCallback((rowHandle) => {
|
|
42389
42536
|
setOpenMenuKey(null);
|
|
42390
42537
|
dragStateRef.current = {
|
|
42391
42538
|
kind: "row",
|
|
@@ -42402,7 +42549,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42402
42549
|
});
|
|
42403
42550
|
document.body.style.cursor = "grabbing";
|
|
42404
42551
|
}, []);
|
|
42405
|
-
const startColumnDrag =
|
|
42552
|
+
const startColumnDrag = React86.useCallback((columnHandle) => {
|
|
42406
42553
|
setOpenMenuKey(null);
|
|
42407
42554
|
dragStateRef.current = {
|
|
42408
42555
|
kind: "column",
|
|
@@ -42419,7 +42566,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42419
42566
|
});
|
|
42420
42567
|
document.body.style.cursor = "grabbing";
|
|
42421
42568
|
}, []);
|
|
42422
|
-
|
|
42569
|
+
React86.useEffect(() => {
|
|
42423
42570
|
const handleMouseMove2 = (event) => {
|
|
42424
42571
|
const dragState = dragStateRef.current;
|
|
42425
42572
|
const activeLayout = layoutRef.current;
|
|
@@ -42508,7 +42655,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42508
42655
|
window.removeEventListener("blur", clearDrag);
|
|
42509
42656
|
};
|
|
42510
42657
|
}, [clearDrag, containerRef, editor, expandTableBy, scheduleSyncFromSelection]);
|
|
42511
|
-
const menuItems =
|
|
42658
|
+
const menuItems = React86.useMemo(() => {
|
|
42512
42659
|
if (!layout) return [];
|
|
42513
42660
|
return [
|
|
42514
42661
|
{
|
|
@@ -42576,7 +42723,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42576
42723
|
}
|
|
42577
42724
|
];
|
|
42578
42725
|
}, [editor, layout, runAtActiveCell, t]);
|
|
42579
|
-
const getRowHandleMenuItems =
|
|
42726
|
+
const getRowHandleMenuItems = React86.useCallback((rowHandle) => [
|
|
42580
42727
|
{
|
|
42581
42728
|
label: t("tableMenu.addRowBefore"),
|
|
42582
42729
|
icon: ArrowUp2,
|
|
@@ -42604,7 +42751,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42604
42751
|
destructive: true
|
|
42605
42752
|
}
|
|
42606
42753
|
], [clearRowAt, duplicateRowAt, runAtCellPos, t]);
|
|
42607
|
-
const getColumnHandleMenuItems =
|
|
42754
|
+
const getColumnHandleMenuItems = React86.useCallback((columnHandle) => [
|
|
42608
42755
|
{
|
|
42609
42756
|
label: t("tableMenu.addColumnBefore"),
|
|
42610
42757
|
icon: ArrowLeft2,
|
|
@@ -42640,7 +42787,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42640
42787
|
const rowHandleLeft = layout.tableLeft - 12;
|
|
42641
42788
|
const columnHandleTop = layout.tableTop - 12;
|
|
42642
42789
|
return /* @__PURE__ */ jsxs80(Fragment36, { children: [
|
|
42643
|
-
/* @__PURE__ */
|
|
42790
|
+
/* @__PURE__ */ jsx99(
|
|
42644
42791
|
TableRowHandles,
|
|
42645
42792
|
{
|
|
42646
42793
|
activeRowIndex: layout.activeRowIndex,
|
|
@@ -42657,7 +42804,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42657
42804
|
rowHandles: layout.rowHandles
|
|
42658
42805
|
}
|
|
42659
42806
|
),
|
|
42660
|
-
/* @__PURE__ */
|
|
42807
|
+
/* @__PURE__ */ jsx99(
|
|
42661
42808
|
TableColumnHandles,
|
|
42662
42809
|
{
|
|
42663
42810
|
activeColumnIndex: layout.activeColumnIndex,
|
|
@@ -42674,7 +42821,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42674
42821
|
openMenuKey
|
|
42675
42822
|
}
|
|
42676
42823
|
),
|
|
42677
|
-
/* @__PURE__ */
|
|
42824
|
+
/* @__PURE__ */ jsx99(
|
|
42678
42825
|
TableControlMenu,
|
|
42679
42826
|
{
|
|
42680
42827
|
controlsVisible,
|
|
@@ -42689,7 +42836,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42689
42836
|
top: menuTop
|
|
42690
42837
|
}
|
|
42691
42838
|
),
|
|
42692
|
-
/* @__PURE__ */
|
|
42839
|
+
/* @__PURE__ */ jsx99(
|
|
42693
42840
|
TableAddRails,
|
|
42694
42841
|
{
|
|
42695
42842
|
addColumnVisible: hoverState.addColumnVisible,
|
|
@@ -42703,7 +42850,7 @@ function TableControls({ editor, containerRef }) {
|
|
|
42703
42850
|
quickAddRowLabel: t("tableMenu.quickAddRowAfter")
|
|
42704
42851
|
}
|
|
42705
42852
|
),
|
|
42706
|
-
/* @__PURE__ */
|
|
42853
|
+
/* @__PURE__ */ jsx99(
|
|
42707
42854
|
TableDragPreview,
|
|
42708
42855
|
{
|
|
42709
42856
|
columnDragLabel: t("tableMenu.dragColumn"),
|
|
@@ -42921,10 +43068,10 @@ var UEDITOR_PROSEMIRROR_CLASS_NAME = cn(
|
|
|
42921
43068
|
);
|
|
42922
43069
|
|
|
42923
43070
|
// src/components/UEditor/use-table-interactions.ts
|
|
42924
|
-
import
|
|
43071
|
+
import React88, { useEffect as useEffect39, useRef as useRef37 } from "react";
|
|
42925
43072
|
|
|
42926
43073
|
// src/components/UEditor/use-table-row-resize.ts
|
|
42927
|
-
import
|
|
43074
|
+
import React87, { useRef as useRef36 } from "react";
|
|
42928
43075
|
function useTableRowResize({
|
|
42929
43076
|
editor,
|
|
42930
43077
|
setHoveredTableCell,
|
|
@@ -42934,15 +43081,15 @@ function useTableRowResize({
|
|
|
42934
43081
|
scheduleTableLayoutSync
|
|
42935
43082
|
}) {
|
|
42936
43083
|
const stateRef = useRef36(null);
|
|
42937
|
-
const syncActiveGuide =
|
|
43084
|
+
const syncActiveGuide = React87.useCallback(() => {
|
|
42938
43085
|
const state = stateRef.current;
|
|
42939
43086
|
if (!state) return false;
|
|
42940
43087
|
setHoveredTableCell(state.cellElement);
|
|
42941
43088
|
showRowGuide(state.tableElement, state.rowElement, state.cellElement, state.pendingHeight);
|
|
42942
43089
|
return true;
|
|
42943
43090
|
}, [setHoveredTableCell, showRowGuide]);
|
|
42944
|
-
const isResizing =
|
|
42945
|
-
const beginResize =
|
|
43091
|
+
const isResizing = React87.useCallback(() => stateRef.current !== null, []);
|
|
43092
|
+
const beginResize = React87.useCallback((event, table, row, cell) => {
|
|
42946
43093
|
if (!editor || !isRowResizeHotspot(cell, event.clientX, event.clientY)) {
|
|
42947
43094
|
return false;
|
|
42948
43095
|
}
|
|
@@ -42968,7 +43115,7 @@ function useTableRowResize({
|
|
|
42968
43115
|
event.stopPropagation();
|
|
42969
43116
|
return true;
|
|
42970
43117
|
}, [editor, setHoveredTableCell, showRowGuide]);
|
|
42971
|
-
const handlePointerMove =
|
|
43118
|
+
const handlePointerMove = React87.useCallback((event) => {
|
|
42972
43119
|
const state = stateRef.current;
|
|
42973
43120
|
if (!state) return;
|
|
42974
43121
|
const nextHeight = Math.max(
|
|
@@ -42985,7 +43132,7 @@ function useTableRowResize({
|
|
|
42985
43132
|
document.body.style.cursor = "row-resize";
|
|
42986
43133
|
showRowGuide(state.tableElement, state.rowElement, state.cellElement, nextHeight);
|
|
42987
43134
|
}, [showRowGuide]);
|
|
42988
|
-
const handlePointerUp =
|
|
43135
|
+
const handlePointerUp = React87.useCallback((event) => {
|
|
42989
43136
|
if (!editor) return;
|
|
42990
43137
|
const state = stateRef.current;
|
|
42991
43138
|
if (!state) return;
|
|
@@ -43009,7 +43156,7 @@ function useTableRowResize({
|
|
|
43009
43156
|
clearAllTableResizeHover();
|
|
43010
43157
|
scheduleTableLayoutSync();
|
|
43011
43158
|
}, [clearAllTableResizeHover, clearHoveredTableCell, editor, scheduleTableLayoutSync]);
|
|
43012
|
-
const cancelResize =
|
|
43159
|
+
const cancelResize = React87.useCallback(() => {
|
|
43013
43160
|
if (!stateRef.current) return;
|
|
43014
43161
|
stateRef.current = null;
|
|
43015
43162
|
document.body.style.cursor = "";
|
|
@@ -43017,7 +43164,7 @@ function useTableRowResize({
|
|
|
43017
43164
|
clearAllTableResizeHover();
|
|
43018
43165
|
scheduleTableLayoutSync();
|
|
43019
43166
|
}, [clearAllTableResizeHover, clearHoveredTableCell, scheduleTableLayoutSync]);
|
|
43020
|
-
const cleanup =
|
|
43167
|
+
const cleanup = React87.useCallback(() => {
|
|
43021
43168
|
stateRef.current = null;
|
|
43022
43169
|
document.body.style.cursor = "";
|
|
43023
43170
|
}, []);
|
|
@@ -43042,16 +43189,16 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
43042
43189
|
const activeTableCellRef = useRef37(null);
|
|
43043
43190
|
const suppressActiveCellHighlightRef = useRef37(false);
|
|
43044
43191
|
const tableLayoutSyncFrameRef = useRef37(null);
|
|
43045
|
-
const getProseMirrorElement =
|
|
43192
|
+
const getProseMirrorElement = React88.useCallback(() => {
|
|
43046
43193
|
return editorContentRef.current?.querySelector(".ProseMirror");
|
|
43047
43194
|
}, []);
|
|
43048
|
-
const setEditorResizeCursor =
|
|
43195
|
+
const setEditorResizeCursor = React88.useCallback((cursor) => {
|
|
43049
43196
|
const proseMirror = getProseMirrorElement();
|
|
43050
43197
|
if (proseMirror) {
|
|
43051
43198
|
proseMirror.style.cursor = cursor;
|
|
43052
43199
|
}
|
|
43053
43200
|
}, [getProseMirrorElement]);
|
|
43054
|
-
const hideColumnGuide =
|
|
43201
|
+
const hideColumnGuide = React88.useCallback(() => {
|
|
43055
43202
|
editorContentRef.current?.classList.remove("resize-cursor");
|
|
43056
43203
|
getProseMirrorElement()?.classList.remove("resize-cursor");
|
|
43057
43204
|
const guide = tableColumnGuideRef.current;
|
|
@@ -43059,7 +43206,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
43059
43206
|
guide.style.opacity = "0";
|
|
43060
43207
|
}
|
|
43061
43208
|
}, [getProseMirrorElement]);
|
|
43062
|
-
const hideRowGuide =
|
|
43209
|
+
const hideRowGuide = React88.useCallback(() => {
|
|
43063
43210
|
editorContentRef.current?.classList.remove("resize-row-cursor");
|
|
43064
43211
|
getProseMirrorElement()?.classList.remove("resize-row-cursor");
|
|
43065
43212
|
const guide = tableRowGuideRef.current;
|
|
@@ -43067,12 +43214,12 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
43067
43214
|
guide.style.opacity = "0";
|
|
43068
43215
|
}
|
|
43069
43216
|
}, [getProseMirrorElement]);
|
|
43070
|
-
const clearAllTableResizeHover =
|
|
43217
|
+
const clearAllTableResizeHover = React88.useCallback(() => {
|
|
43071
43218
|
setEditorResizeCursor("");
|
|
43072
43219
|
hideColumnGuide();
|
|
43073
43220
|
hideRowGuide();
|
|
43074
43221
|
}, [hideColumnGuide, hideRowGuide, setEditorResizeCursor]);
|
|
43075
|
-
const updateActiveCellHighlight =
|
|
43222
|
+
const updateActiveCellHighlight = React88.useCallback((cell) => {
|
|
43076
43223
|
const surface = editorContentRef.current;
|
|
43077
43224
|
const highlight = activeTableCellHighlightRef.current;
|
|
43078
43225
|
if (!highlight) return;
|
|
@@ -43087,7 +43234,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
43087
43234
|
highlight.style.width = `${metrics.width}px`;
|
|
43088
43235
|
highlight.style.height = `${metrics.height}px`;
|
|
43089
43236
|
}, []);
|
|
43090
|
-
const scheduleTableLayoutSync =
|
|
43237
|
+
const scheduleTableLayoutSync = React88.useCallback(() => {
|
|
43091
43238
|
if (tableLayoutSyncFrameRef.current !== null) return;
|
|
43092
43239
|
tableLayoutSyncFrameRef.current = window.requestAnimationFrame(() => {
|
|
43093
43240
|
tableLayoutSyncFrameRef.current = null;
|
|
@@ -43095,7 +43242,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
43095
43242
|
editorContentRef.current?.dispatchEvent(new CustomEvent(UEDITOR_TABLE_LAYOUT_CHANGE_EVENT));
|
|
43096
43243
|
});
|
|
43097
43244
|
}, [updateActiveCellHighlight]);
|
|
43098
|
-
const setActiveTableCell =
|
|
43245
|
+
const setActiveTableCell = React88.useCallback((cell) => {
|
|
43099
43246
|
if (activeTableCellRef.current === cell) {
|
|
43100
43247
|
updateActiveCellHighlight(cell);
|
|
43101
43248
|
return;
|
|
@@ -43103,17 +43250,17 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
43103
43250
|
activeTableCellRef.current = cell;
|
|
43104
43251
|
updateActiveCellHighlight(activeTableCellRef.current);
|
|
43105
43252
|
}, [updateActiveCellHighlight]);
|
|
43106
|
-
const clearActiveTableCell =
|
|
43253
|
+
const clearActiveTableCell = React88.useCallback(() => {
|
|
43107
43254
|
activeTableCellRef.current = null;
|
|
43108
43255
|
updateActiveCellHighlight(null);
|
|
43109
43256
|
}, [updateActiveCellHighlight]);
|
|
43110
|
-
const setHoveredTableCell =
|
|
43257
|
+
const setHoveredTableCell = React88.useCallback((cell) => {
|
|
43111
43258
|
hoveredTableCellRef.current = cell;
|
|
43112
43259
|
}, []);
|
|
43113
|
-
const clearHoveredTableCell =
|
|
43260
|
+
const clearHoveredTableCell = React88.useCallback(() => {
|
|
43114
43261
|
hoveredTableCellRef.current = null;
|
|
43115
43262
|
}, []);
|
|
43116
|
-
const showColumnGuide =
|
|
43263
|
+
const showColumnGuide = React88.useCallback((table, row, cell) => {
|
|
43117
43264
|
const surface = editorContentRef.current;
|
|
43118
43265
|
const guide = tableColumnGuideRef.current;
|
|
43119
43266
|
if (!surface || !guide) return;
|
|
@@ -43127,7 +43274,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
43127
43274
|
getProseMirrorElement()?.classList.add("resize-cursor");
|
|
43128
43275
|
setEditorResizeCursor("col-resize");
|
|
43129
43276
|
}, [getProseMirrorElement, setEditorResizeCursor]);
|
|
43130
|
-
const showRowGuide =
|
|
43277
|
+
const showRowGuide = React88.useCallback((table, row, cell, previewHeight) => {
|
|
43131
43278
|
const surface = editorContentRef.current;
|
|
43132
43279
|
const guide = tableRowGuideRef.current;
|
|
43133
43280
|
if (!surface || !guide) return;
|
|
@@ -43159,7 +43306,7 @@ function useUEditorTableInteractions(editor, editable = true) {
|
|
|
43159
43306
|
clearAllTableResizeHover,
|
|
43160
43307
|
scheduleTableLayoutSync
|
|
43161
43308
|
});
|
|
43162
|
-
const syncActiveTableCellFromSelection =
|
|
43309
|
+
const syncActiveTableCellFromSelection = React88.useCallback(() => {
|
|
43163
43310
|
if (!editor) return;
|
|
43164
43311
|
if (!editor.isFocused) {
|
|
43165
43312
|
clearActiveTableCell();
|
|
@@ -43820,35 +43967,35 @@ function useFormulaCoordinateOverlay(editor, containerRef, labels) {
|
|
|
43820
43967
|
}
|
|
43821
43968
|
|
|
43822
43969
|
// src/components/UEditor/menu-bar.tsx
|
|
43823
|
-
import
|
|
43970
|
+
import React89, { useMemo as useMemo26, useRef as useRef39, useState as useState52 } from "react";
|
|
43824
43971
|
import { useEditorState as useEditorState3 } from "@tiptap/react";
|
|
43825
43972
|
import {
|
|
43826
43973
|
AlignCenter as AlignCenter4,
|
|
43827
43974
|
AlignJustify as AlignJustify2,
|
|
43828
43975
|
AlignLeft as AlignLeft4,
|
|
43829
43976
|
AlignRight as AlignRight4,
|
|
43830
|
-
Bold as
|
|
43831
|
-
Code as
|
|
43977
|
+
Bold as BoldIcon2,
|
|
43978
|
+
Code as CodeIcon2,
|
|
43832
43979
|
Eye as Eye3,
|
|
43833
43980
|
FileCode as FileCode4,
|
|
43834
43981
|
Heading1 as Heading1Icon2,
|
|
43835
43982
|
Heading2 as Heading2Icon2,
|
|
43836
43983
|
Heading3 as Heading3Icon2,
|
|
43837
|
-
Image as
|
|
43838
|
-
Italic as
|
|
43984
|
+
Image as ImageIcon2,
|
|
43985
|
+
Italic as ItalicIcon2,
|
|
43839
43986
|
Link as LinkIcon3,
|
|
43840
43987
|
ListTodo as ListTodo3,
|
|
43841
43988
|
Maximize2 as Maximize22,
|
|
43842
43989
|
Quote as QuoteIcon2,
|
|
43843
|
-
Redo as
|
|
43990
|
+
Redo as RedoIcon,
|
|
43844
43991
|
Scissors,
|
|
43845
|
-
Strikethrough as
|
|
43846
|
-
Subscript as
|
|
43847
|
-
Superscript as
|
|
43992
|
+
Strikethrough as StrikethroughIcon2,
|
|
43993
|
+
Subscript as SubscriptIcon2,
|
|
43994
|
+
Superscript as SuperscriptIcon2,
|
|
43848
43995
|
Table as TableIcon3,
|
|
43849
43996
|
Trash2 as Trash25,
|
|
43850
|
-
Underline as
|
|
43851
|
-
Undo as
|
|
43997
|
+
Underline as UnderlineIcon2,
|
|
43998
|
+
Undo as UndoIcon,
|
|
43852
43999
|
Square,
|
|
43853
44000
|
CircleDot as CircleDot2,
|
|
43854
44001
|
CircleCheckBig as CircleCheckBig3,
|
|
@@ -43992,14 +44139,14 @@ function prepareUEditorPreviewHtml(html) {
|
|
|
43992
44139
|
}
|
|
43993
44140
|
|
|
43994
44141
|
// src/components/UEditor/menu-bar.tsx
|
|
43995
|
-
import { Fragment as Fragment37, jsx as
|
|
44142
|
+
import { Fragment as Fragment37, jsx as jsx100, jsxs as jsxs81 } from "react/jsx-runtime";
|
|
43996
44143
|
function MenuTableInsertGrid({
|
|
43997
44144
|
insertLabel,
|
|
43998
44145
|
previewTemplate,
|
|
43999
44146
|
onInsert
|
|
44000
44147
|
}) {
|
|
44001
44148
|
const closeMenu = useDropdownMenuClose();
|
|
44002
|
-
return /* @__PURE__ */
|
|
44149
|
+
return /* @__PURE__ */ jsx100(
|
|
44003
44150
|
TableInsertGrid,
|
|
44004
44151
|
{
|
|
44005
44152
|
insertLabel,
|
|
@@ -44015,9 +44162,9 @@ function renderMenuItems(items) {
|
|
|
44015
44162
|
return items.map((item, i) => {
|
|
44016
44163
|
switch (item.type) {
|
|
44017
44164
|
case "separator":
|
|
44018
|
-
return /* @__PURE__ */
|
|
44165
|
+
return /* @__PURE__ */ jsx100(DropdownMenuSeparator, {}, i);
|
|
44019
44166
|
case "action":
|
|
44020
|
-
return /* @__PURE__ */
|
|
44167
|
+
return /* @__PURE__ */ jsx100(
|
|
44021
44168
|
DropdownMenuItem,
|
|
44022
44169
|
{
|
|
44023
44170
|
label: item.label,
|
|
@@ -44031,9 +44178,9 @@ function renderMenuItems(items) {
|
|
|
44031
44178
|
i
|
|
44032
44179
|
);
|
|
44033
44180
|
case "sub":
|
|
44034
|
-
return /* @__PURE__ */
|
|
44181
|
+
return /* @__PURE__ */ jsx100(DropdownMenuSub, { label: item.label, icon: item.icon, disabled: item.disabled, children: renderMenuItems(item.items) }, i);
|
|
44035
44182
|
case "custom":
|
|
44036
|
-
return /* @__PURE__ */
|
|
44183
|
+
return /* @__PURE__ */ jsx100(React89.Fragment, { children: item.render() }, item.key);
|
|
44037
44184
|
}
|
|
44038
44185
|
});
|
|
44039
44186
|
}
|
|
@@ -44071,7 +44218,7 @@ function buildEditMenuItems(t, editor) {
|
|
|
44071
44218
|
{
|
|
44072
44219
|
type: "action",
|
|
44073
44220
|
label: t("menubar.undo"),
|
|
44074
|
-
icon:
|
|
44221
|
+
icon: UndoIcon,
|
|
44075
44222
|
shortcut: t("menubar.undoShortcut"),
|
|
44076
44223
|
onClick: () => editor.chain().focus().undo().run(),
|
|
44077
44224
|
disabled: !editor.can().undo()
|
|
@@ -44079,7 +44226,7 @@ function buildEditMenuItems(t, editor) {
|
|
|
44079
44226
|
{
|
|
44080
44227
|
type: "action",
|
|
44081
44228
|
label: t("menubar.redo"),
|
|
44082
|
-
icon:
|
|
44229
|
+
icon: RedoIcon,
|
|
44083
44230
|
shortcut: t("menubar.redoShortcut"),
|
|
44084
44231
|
onClick: () => editor.chain().focus().redo().run(),
|
|
44085
44232
|
disabled: !editor.can().redo()
|
|
@@ -44167,7 +44314,7 @@ function buildFormatMenuItems(t, editor) {
|
|
|
44167
44314
|
{
|
|
44168
44315
|
type: "action",
|
|
44169
44316
|
label: t("menubar.bold"),
|
|
44170
|
-
icon:
|
|
44317
|
+
icon: BoldIcon2,
|
|
44171
44318
|
shortcut: t("menubar.boldShortcut"),
|
|
44172
44319
|
active: editor.isActive("bold"),
|
|
44173
44320
|
onClick: () => editor.chain().focus().toggleBold().run()
|
|
@@ -44175,7 +44322,7 @@ function buildFormatMenuItems(t, editor) {
|
|
|
44175
44322
|
{
|
|
44176
44323
|
type: "action",
|
|
44177
44324
|
label: t("menubar.italic"),
|
|
44178
|
-
icon:
|
|
44325
|
+
icon: ItalicIcon2,
|
|
44179
44326
|
shortcut: t("menubar.italicShortcut"),
|
|
44180
44327
|
active: editor.isActive("italic"),
|
|
44181
44328
|
onClick: () => editor.chain().focus().toggleItalic().run()
|
|
@@ -44183,7 +44330,7 @@ function buildFormatMenuItems(t, editor) {
|
|
|
44183
44330
|
{
|
|
44184
44331
|
type: "action",
|
|
44185
44332
|
label: t("menubar.underline"),
|
|
44186
|
-
icon:
|
|
44333
|
+
icon: UnderlineIcon2,
|
|
44187
44334
|
shortcut: t("menubar.underlineShortcut"),
|
|
44188
44335
|
active: editor.isActive("underline"),
|
|
44189
44336
|
onClick: () => editor.chain().focus().toggleUnderline().run()
|
|
@@ -44191,28 +44338,28 @@ function buildFormatMenuItems(t, editor) {
|
|
|
44191
44338
|
{
|
|
44192
44339
|
type: "action",
|
|
44193
44340
|
label: t("menubar.strike"),
|
|
44194
|
-
icon:
|
|
44341
|
+
icon: StrikethroughIcon2,
|
|
44195
44342
|
active: editor.isActive("strike"),
|
|
44196
44343
|
onClick: () => editor.chain().focus().toggleStrike().run()
|
|
44197
44344
|
},
|
|
44198
44345
|
{
|
|
44199
44346
|
type: "action",
|
|
44200
44347
|
label: t("menubar.superscript"),
|
|
44201
|
-
icon:
|
|
44348
|
+
icon: SuperscriptIcon2,
|
|
44202
44349
|
active: editor.isActive("superscript"),
|
|
44203
44350
|
onClick: () => editor.chain().focus().toggleSuperscript().run()
|
|
44204
44351
|
},
|
|
44205
44352
|
{
|
|
44206
44353
|
type: "action",
|
|
44207
44354
|
label: t("menubar.subscript"),
|
|
44208
|
-
icon:
|
|
44355
|
+
icon: SubscriptIcon2,
|
|
44209
44356
|
active: editor.isActive("subscript"),
|
|
44210
44357
|
onClick: () => editor.chain().focus().toggleSubscript().run()
|
|
44211
44358
|
},
|
|
44212
44359
|
{
|
|
44213
44360
|
type: "action",
|
|
44214
44361
|
label: t("menubar.code"),
|
|
44215
|
-
icon:
|
|
44362
|
+
icon: CodeIcon2,
|
|
44216
44363
|
active: editor.isActive("code"),
|
|
44217
44364
|
onClick: () => editor.chain().focus().toggleCode().run()
|
|
44218
44365
|
},
|
|
@@ -44335,7 +44482,7 @@ function buildTableMenuItems(t, editor, onInsertTable) {
|
|
|
44335
44482
|
{
|
|
44336
44483
|
type: "custom",
|
|
44337
44484
|
key: "table-insert-grid",
|
|
44338
|
-
render: () => /* @__PURE__ */
|
|
44485
|
+
render: () => /* @__PURE__ */ jsx100(
|
|
44339
44486
|
MenuTableInsertGrid,
|
|
44340
44487
|
{
|
|
44341
44488
|
insertLabel: t("tableMenu.insertTable"),
|
|
@@ -44409,8 +44556,8 @@ function buildTableMenuItems(t, editor, onInsertTable) {
|
|
|
44409
44556
|
}
|
|
44410
44557
|
];
|
|
44411
44558
|
}
|
|
44412
|
-
var MenuBarTrigger =
|
|
44413
|
-
({ children, className, ...props }, ref) => /* @__PURE__ */
|
|
44559
|
+
var MenuBarTrigger = React89.forwardRef(
|
|
44560
|
+
({ children, className, ...props }, ref) => /* @__PURE__ */ jsx100(
|
|
44414
44561
|
"button",
|
|
44415
44562
|
{
|
|
44416
44563
|
ref,
|
|
@@ -44513,9 +44660,9 @@ var MenuBar = ({
|
|
|
44513
44660
|
{
|
|
44514
44661
|
type: "custom",
|
|
44515
44662
|
key: "image",
|
|
44516
|
-
render: () => showImageInput ? /* @__PURE__ */
|
|
44517
|
-
/* @__PURE__ */
|
|
44518
|
-
/* @__PURE__ */
|
|
44663
|
+
render: () => showImageInput ? /* @__PURE__ */ jsx100(ImageInput, { onSubmit: handleImageUrl, onCancel: () => setShowImageInput(false) }) : /* @__PURE__ */ jsxs81(Fragment37, { children: [
|
|
44664
|
+
/* @__PURE__ */ jsx100(DropdownMenuItem, { label: t("menubar.image"), icon: ImageIcon2, onClick: () => setShowImageInput(true), closeOnSelect: false }),
|
|
44665
|
+
/* @__PURE__ */ jsx100(
|
|
44519
44666
|
DropdownMenuItem,
|
|
44520
44667
|
{
|
|
44521
44668
|
label: t("menubar.imageUpload"),
|
|
@@ -44530,7 +44677,7 @@ var MenuBar = ({
|
|
|
44530
44677
|
{
|
|
44531
44678
|
type: "custom",
|
|
44532
44679
|
key: "link",
|
|
44533
|
-
render: () => showLinkInput ? /* @__PURE__ */
|
|
44680
|
+
render: () => showLinkInput ? /* @__PURE__ */ jsx100(LinkInput, { onSubmit: handleLinkSubmit, onCancel: () => setShowLinkInput(false), initialUrl: editor.getAttributes("link").href ?? "" }) : /* @__PURE__ */ jsx100(
|
|
44534
44681
|
DropdownMenuItem,
|
|
44535
44682
|
{
|
|
44536
44683
|
label: t("menubar.link"),
|
|
@@ -44550,7 +44697,7 @@ var MenuBar = ({
|
|
|
44550
44697
|
{
|
|
44551
44698
|
type: "custom",
|
|
44552
44699
|
key: "table-grid",
|
|
44553
|
-
render: () => /* @__PURE__ */
|
|
44700
|
+
render: () => /* @__PURE__ */ jsx100(
|
|
44554
44701
|
MenuTableInsertGrid,
|
|
44555
44702
|
{
|
|
44556
44703
|
insertLabel: t("tableMenu.insertTable"),
|
|
@@ -44630,7 +44777,7 @@ var MenuBar = ({
|
|
|
44630
44777
|
{ label: t("menubar.table"), items: buildTableMenuItems(t, editor, handleInsertTable), open: void 0, onOpenChange: void 0 }
|
|
44631
44778
|
];
|
|
44632
44779
|
return /* @__PURE__ */ jsxs81(Fragment37, { children: [
|
|
44633
|
-
/* @__PURE__ */
|
|
44780
|
+
/* @__PURE__ */ jsx100(
|
|
44634
44781
|
"input",
|
|
44635
44782
|
{
|
|
44636
44783
|
ref: fileInputRef,
|
|
@@ -44642,10 +44789,10 @@ var MenuBar = ({
|
|
|
44642
44789
|
}
|
|
44643
44790
|
),
|
|
44644
44791
|
/* @__PURE__ */ jsxs81("div", { className: "flex items-center gap-0.5 border-b border-border/35 bg-muted/20 px-1.5 py-0.5", children: [
|
|
44645
|
-
menus.map(({ label, items, open, onOpenChange }) => /* @__PURE__ */
|
|
44792
|
+
menus.map(({ label, items, open, onOpenChange }) => /* @__PURE__ */ jsx100(
|
|
44646
44793
|
DropdownMenu,
|
|
44647
44794
|
{
|
|
44648
|
-
trigger: /* @__PURE__ */
|
|
44795
|
+
trigger: /* @__PURE__ */ jsx100(MenuBarTrigger, { children: label }),
|
|
44649
44796
|
placement: "bottom-start",
|
|
44650
44797
|
isOpen: open,
|
|
44651
44798
|
onOpenChange,
|
|
@@ -44653,7 +44800,7 @@ var MenuBar = ({
|
|
|
44653
44800
|
},
|
|
44654
44801
|
label
|
|
44655
44802
|
)),
|
|
44656
|
-
/* @__PURE__ */
|
|
44803
|
+
/* @__PURE__ */ jsx100(
|
|
44657
44804
|
"button",
|
|
44658
44805
|
{
|
|
44659
44806
|
type: "button",
|
|
@@ -44664,11 +44811,11 @@ var MenuBar = ({
|
|
|
44664
44811
|
"ml-auto inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors",
|
|
44665
44812
|
"hover:bg-accent hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1"
|
|
44666
44813
|
),
|
|
44667
|
-
children: /* @__PURE__ */
|
|
44814
|
+
children: /* @__PURE__ */ jsx100(Eye3, { className: "h-4 w-4", "aria-hidden": "true" })
|
|
44668
44815
|
}
|
|
44669
44816
|
)
|
|
44670
44817
|
] }),
|
|
44671
|
-
/* @__PURE__ */
|
|
44818
|
+
/* @__PURE__ */ jsx100(
|
|
44672
44819
|
Modal_default,
|
|
44673
44820
|
{
|
|
44674
44821
|
isOpen: showSourceDialog,
|
|
@@ -44676,8 +44823,8 @@ var MenuBar = ({
|
|
|
44676
44823
|
title: t("menubar.sourceCode"),
|
|
44677
44824
|
size: "lg",
|
|
44678
44825
|
children: /* @__PURE__ */ jsxs81("div", { className: "space-y-3", children: [
|
|
44679
|
-
/* @__PURE__ */
|
|
44680
|
-
/* @__PURE__ */
|
|
44826
|
+
/* @__PURE__ */ jsx100("p", { className: "text-xs text-muted-foreground", children: t("menubar.sourceCodeHint") }),
|
|
44827
|
+
/* @__PURE__ */ jsx100(
|
|
44681
44828
|
"textarea",
|
|
44682
44829
|
{
|
|
44683
44830
|
"data-testid": "source-code-textarea",
|
|
@@ -44688,7 +44835,7 @@ var MenuBar = ({
|
|
|
44688
44835
|
}
|
|
44689
44836
|
),
|
|
44690
44837
|
/* @__PURE__ */ jsxs81("div", { className: "flex gap-2 justify-end", children: [
|
|
44691
|
-
/* @__PURE__ */
|
|
44838
|
+
/* @__PURE__ */ jsx100(
|
|
44692
44839
|
"button",
|
|
44693
44840
|
{
|
|
44694
44841
|
type: "button",
|
|
@@ -44697,7 +44844,7 @@ var MenuBar = ({
|
|
|
44697
44844
|
children: t("menubar.applySource")
|
|
44698
44845
|
}
|
|
44699
44846
|
),
|
|
44700
|
-
/* @__PURE__ */
|
|
44847
|
+
/* @__PURE__ */ jsx100(
|
|
44701
44848
|
"button",
|
|
44702
44849
|
{
|
|
44703
44850
|
type: "button",
|
|
@@ -44710,7 +44857,7 @@ var MenuBar = ({
|
|
|
44710
44857
|
] })
|
|
44711
44858
|
}
|
|
44712
44859
|
),
|
|
44713
|
-
/* @__PURE__ */
|
|
44860
|
+
/* @__PURE__ */ jsx100(
|
|
44714
44861
|
Modal_default,
|
|
44715
44862
|
{
|
|
44716
44863
|
isOpen: showPreviewDialog,
|
|
@@ -44721,12 +44868,12 @@ var MenuBar = ({
|
|
|
44721
44868
|
height: "min(860px, calc(100vh - 2rem))",
|
|
44722
44869
|
className: "flex flex-col overflow-hidden rounded-xl md:rounded-2xl",
|
|
44723
44870
|
contentClassName: "flex min-h-0 flex-1 overflow-hidden p-0",
|
|
44724
|
-
children: /* @__PURE__ */
|
|
44871
|
+
children: /* @__PURE__ */ jsx100(
|
|
44725
44872
|
"div",
|
|
44726
44873
|
{
|
|
44727
44874
|
"data-testid": "preview-content",
|
|
44728
44875
|
className: "min-h-0 flex-1 overflow-y-auto overscroll-contain",
|
|
44729
|
-
children: editor.isEmpty ? /* @__PURE__ */
|
|
44876
|
+
children: editor.isEmpty ? /* @__PURE__ */ jsx100("p", { className: "text-muted-foreground text-sm", children: t("menubar.previewEmpty") }) : /* @__PURE__ */ jsx100(
|
|
44730
44877
|
"div",
|
|
44731
44878
|
{
|
|
44732
44879
|
className: UEDITOR_PROSEMIRROR_CLASS_NAME,
|
|
@@ -44744,7 +44891,7 @@ var MenuBar = ({
|
|
|
44744
44891
|
import { useEffect as useEffect41, useRef as useRef40, useState as useState53 } from "react";
|
|
44745
44892
|
import { useEditorState as useEditorState4 } from "@tiptap/react";
|
|
44746
44893
|
import { AlertCircle as AlertCircle5, Check as Check14, Hash as Hash2, Sigma as Sigma3, Trash2 as Trash26 } from "lucide-react";
|
|
44747
|
-
import { jsx as
|
|
44894
|
+
import { jsx as jsx101, jsxs as jsxs82 } from "react/jsx-runtime";
|
|
44748
44895
|
function TableFormulaBar({ editor }) {
|
|
44749
44896
|
const t = useSmartTranslations("UEditor");
|
|
44750
44897
|
const inputRef = useRef40(null);
|
|
@@ -44802,7 +44949,7 @@ function TableFormulaBar({ editor }) {
|
|
|
44802
44949
|
"aria-label": t("tableMenu.formulaBar"),
|
|
44803
44950
|
className: "flex min-h-10 items-center gap-2 border-b border-border/60 bg-muted/25 px-2 py-1.5",
|
|
44804
44951
|
children: [
|
|
44805
|
-
/* @__PURE__ */
|
|
44952
|
+
/* @__PURE__ */ jsx101(
|
|
44806
44953
|
"span",
|
|
44807
44954
|
{
|
|
44808
44955
|
"data-ueditor-formula-cell-label": "",
|
|
@@ -44810,8 +44957,8 @@ function TableFormulaBar({ editor }) {
|
|
|
44810
44957
|
children: selectedCell.label
|
|
44811
44958
|
}
|
|
44812
44959
|
),
|
|
44813
|
-
/* @__PURE__ */
|
|
44814
|
-
/* @__PURE__ */
|
|
44960
|
+
/* @__PURE__ */ jsx101(Sigma3, { "aria-hidden": "true", className: "h-4 w-4 shrink-0 text-primary" }),
|
|
44961
|
+
/* @__PURE__ */ jsx101(
|
|
44815
44962
|
"input",
|
|
44816
44963
|
{
|
|
44817
44964
|
ref: inputRef,
|
|
@@ -44838,12 +44985,12 @@ function TableFormulaBar({ editor }) {
|
|
|
44838
44985
|
role: "status",
|
|
44839
44986
|
className: "hidden shrink-0 items-center gap-1 text-xs font-medium text-destructive sm:inline-flex",
|
|
44840
44987
|
children: [
|
|
44841
|
-
/* @__PURE__ */
|
|
44988
|
+
/* @__PURE__ */ jsx101(AlertCircle5, { "aria-hidden": "true", className: "h-3.5 w-3.5" }),
|
|
44842
44989
|
t("tableMenu.formulaError")
|
|
44843
44990
|
]
|
|
44844
44991
|
}
|
|
44845
44992
|
),
|
|
44846
|
-
/* @__PURE__ */
|
|
44993
|
+
/* @__PURE__ */ jsx101(
|
|
44847
44994
|
"button",
|
|
44848
44995
|
{
|
|
44849
44996
|
type: "button",
|
|
@@ -44851,10 +44998,10 @@ function TableFormulaBar({ editor }) {
|
|
|
44851
44998
|
"aria-label": t("tableMenu.apply"),
|
|
44852
44999
|
title: t("tableMenu.apply"),
|
|
44853
45000
|
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",
|
|
44854
|
-
children: /* @__PURE__ */
|
|
45001
|
+
children: /* @__PURE__ */ jsx101(Check14, { "aria-hidden": "true", className: "h-4 w-4" })
|
|
44855
45002
|
}
|
|
44856
45003
|
),
|
|
44857
|
-
/* @__PURE__ */
|
|
45004
|
+
/* @__PURE__ */ jsx101(
|
|
44858
45005
|
"button",
|
|
44859
45006
|
{
|
|
44860
45007
|
type: "button",
|
|
@@ -44865,10 +45012,10 @@ function TableFormulaBar({ editor }) {
|
|
|
44865
45012
|
"aria-label": t("tableMenu.convertToValue"),
|
|
44866
45013
|
title: t("tableMenu.convertToValue"),
|
|
44867
45014
|
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",
|
|
44868
|
-
children: /* @__PURE__ */
|
|
45015
|
+
children: /* @__PURE__ */ jsx101(Hash2, { "aria-hidden": "true", className: "h-4 w-4" })
|
|
44869
45016
|
}
|
|
44870
45017
|
),
|
|
44871
|
-
/* @__PURE__ */
|
|
45018
|
+
/* @__PURE__ */ jsx101(
|
|
44872
45019
|
"button",
|
|
44873
45020
|
{
|
|
44874
45021
|
type: "button",
|
|
@@ -44879,7 +45026,7 @@ function TableFormulaBar({ editor }) {
|
|
|
44879
45026
|
"aria-label": t("tableMenu.clearCell"),
|
|
44880
45027
|
title: t("tableMenu.clearCell"),
|
|
44881
45028
|
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",
|
|
44882
|
-
children: /* @__PURE__ */
|
|
45029
|
+
children: /* @__PURE__ */ jsx101(Trash26, { "aria-hidden": "true", className: "h-4 w-4" })
|
|
44883
45030
|
}
|
|
44884
45031
|
)
|
|
44885
45032
|
]
|
|
@@ -44888,8 +45035,8 @@ function TableFormulaBar({ editor }) {
|
|
|
44888
45035
|
}
|
|
44889
45036
|
|
|
44890
45037
|
// src/components/UEditor/UEditor.tsx
|
|
44891
|
-
import { jsx as
|
|
44892
|
-
var UEditor =
|
|
45038
|
+
import { jsx as jsx102, jsxs as jsxs83 } from "react/jsx-runtime";
|
|
45039
|
+
var UEditor = React91.forwardRef(({
|
|
44893
45040
|
content = "",
|
|
44894
45041
|
onChange,
|
|
44895
45042
|
onHtmlChange,
|
|
@@ -44937,8 +45084,8 @@ var UEditor = React90.forwardRef(({
|
|
|
44937
45084
|
const editorInstanceRef = useRef41(null);
|
|
44938
45085
|
const formulaRangePickRef = useRef41(null);
|
|
44939
45086
|
const formulaRangeSurfaceRef = useRef41(null);
|
|
44940
|
-
const [formulaRangeHighlight, setFormulaRangeHighlight] =
|
|
44941
|
-
const scheduleFormulaRecalculate =
|
|
45087
|
+
const [formulaRangeHighlight, setFormulaRangeHighlight] = React91.useState(null);
|
|
45088
|
+
const scheduleFormulaRecalculate = React91.useCallback((editor2, options) => {
|
|
44942
45089
|
if (editor2.isDestroyed || scheduledFormulaRecalculateRef.current) return;
|
|
44943
45090
|
if (!options?.force && isEditingTableFormulaText(editor2)) return;
|
|
44944
45091
|
scheduledFormulaRecalculateRef.current = true;
|
|
@@ -44978,7 +45125,7 @@ var UEditor = React90.forwardRef(({
|
|
|
44978
45125
|
],
|
|
44979
45126
|
[effectivePlaceholder, t, maxCharacters, uploadImage, resolvedUploadFile, imageInsertMode, maxImageFileSize, allowedImageMimeTypes, fallbackToDataUrl, editable, fetchMetadata, extraExtensions]
|
|
44980
45127
|
);
|
|
44981
|
-
const syncFormulaRangeHighlight =
|
|
45128
|
+
const syncFormulaRangeHighlight = React91.useCallback((pickState) => {
|
|
44982
45129
|
const container = formulaRangeSurfaceRef.current;
|
|
44983
45130
|
setFormulaRangeHighlight(container && pickState ? getFormulaRangePickHighlight(container, pickState) : null);
|
|
44984
45131
|
}, []);
|
|
@@ -45156,7 +45303,7 @@ var UEditor = React90.forwardRef(({
|
|
|
45156
45303
|
}
|
|
45157
45304
|
}, [content, editor]);
|
|
45158
45305
|
if (!editor) {
|
|
45159
|
-
return /* @__PURE__ */
|
|
45306
|
+
return /* @__PURE__ */ jsx102(
|
|
45160
45307
|
"div",
|
|
45161
45308
|
{
|
|
45162
45309
|
className: cn("w-full border bg-background flex items-center justify-center text-muted-foreground", className),
|
|
@@ -45181,7 +45328,7 @@ var UEditor = React90.forwardRef(({
|
|
|
45181
45328
|
className
|
|
45182
45329
|
),
|
|
45183
45330
|
children: [
|
|
45184
|
-
editable && showMenuBar && /* @__PURE__ */
|
|
45331
|
+
editable && showMenuBar && /* @__PURE__ */ jsx102(
|
|
45185
45332
|
MenuBar,
|
|
45186
45333
|
{
|
|
45187
45334
|
editor,
|
|
@@ -45196,7 +45343,7 @@ var UEditor = React90.forwardRef(({
|
|
|
45196
45343
|
onPreview
|
|
45197
45344
|
}
|
|
45198
45345
|
),
|
|
45199
|
-
editable && showToolbar && /* @__PURE__ */
|
|
45346
|
+
editable && showToolbar && /* @__PURE__ */ jsx102(
|
|
45200
45347
|
EditorToolbar,
|
|
45201
45348
|
{
|
|
45202
45349
|
editor,
|
|
@@ -45211,8 +45358,8 @@ var UEditor = React90.forwardRef(({
|
|
|
45211
45358
|
letterSpacings
|
|
45212
45359
|
}
|
|
45213
45360
|
),
|
|
45214
|
-
editable && /* @__PURE__ */
|
|
45215
|
-
editable && showBubbleMenu && /* @__PURE__ */
|
|
45361
|
+
editable && /* @__PURE__ */ jsx102(TableFormulaBar, { editor }),
|
|
45362
|
+
editable && showBubbleMenu && /* @__PURE__ */ jsx102(
|
|
45216
45363
|
CustomBubbleMenu,
|
|
45217
45364
|
{
|
|
45218
45365
|
editor,
|
|
@@ -45220,7 +45367,7 @@ var UEditor = React90.forwardRef(({
|
|
|
45220
45367
|
lineHeights
|
|
45221
45368
|
}
|
|
45222
45369
|
),
|
|
45223
|
-
editable && showFloatingMenu && /* @__PURE__ */
|
|
45370
|
+
editable && showFloatingMenu && /* @__PURE__ */ jsx102(CustomFloatingMenu, { editor }),
|
|
45224
45371
|
/* @__PURE__ */ jsxs83(
|
|
45225
45372
|
"div",
|
|
45226
45373
|
{
|
|
@@ -45234,7 +45381,7 @@ var UEditor = React90.forwardRef(({
|
|
|
45234
45381
|
maxHeight
|
|
45235
45382
|
},
|
|
45236
45383
|
children: [
|
|
45237
|
-
/* @__PURE__ */
|
|
45384
|
+
/* @__PURE__ */ jsx102(
|
|
45238
45385
|
"span",
|
|
45239
45386
|
{
|
|
45240
45387
|
ref: tableColumnGuideRef,
|
|
@@ -45242,7 +45389,7 @@ var UEditor = React90.forwardRef(({
|
|
|
45242
45389
|
className: "pointer-events-none absolute z-20 bg-primary opacity-0 transition-opacity duration-100"
|
|
45243
45390
|
}
|
|
45244
45391
|
),
|
|
45245
|
-
/* @__PURE__ */
|
|
45392
|
+
/* @__PURE__ */ jsx102(
|
|
45246
45393
|
"span",
|
|
45247
45394
|
{
|
|
45248
45395
|
ref: tableRowGuideRef,
|
|
@@ -45250,7 +45397,7 @@ var UEditor = React90.forwardRef(({
|
|
|
45250
45397
|
className: "pointer-events-none absolute z-20 bg-primary opacity-0 transition-opacity duration-100"
|
|
45251
45398
|
}
|
|
45252
45399
|
),
|
|
45253
|
-
/* @__PURE__ */
|
|
45400
|
+
/* @__PURE__ */ jsx102(
|
|
45254
45401
|
"span",
|
|
45255
45402
|
{
|
|
45256
45403
|
ref: activeTableCellHighlightRef,
|
|
@@ -45259,7 +45406,7 @@ var UEditor = React90.forwardRef(({
|
|
|
45259
45406
|
className: "pointer-events-none hidden absolute z-20 rounded-[2px] border-2 border-primary bg-primary/10"
|
|
45260
45407
|
}
|
|
45261
45408
|
),
|
|
45262
|
-
/* @__PURE__ */
|
|
45409
|
+
/* @__PURE__ */ jsx102(
|
|
45263
45410
|
"div",
|
|
45264
45411
|
{
|
|
45265
45412
|
ref: formulaCoordinateOverlayRef,
|
|
@@ -45267,7 +45414,7 @@ var UEditor = React90.forwardRef(({
|
|
|
45267
45414
|
className: "pointer-events-none absolute inset-0 z-[35] hidden overflow-visible"
|
|
45268
45415
|
}
|
|
45269
45416
|
),
|
|
45270
|
-
formulaRangeHighlight && /* @__PURE__ */
|
|
45417
|
+
formulaRangeHighlight && /* @__PURE__ */ jsx102(
|
|
45271
45418
|
"span",
|
|
45272
45419
|
{
|
|
45273
45420
|
"aria-hidden": "true",
|
|
@@ -45285,8 +45432,8 @@ var UEditor = React90.forwardRef(({
|
|
|
45285
45432
|
}
|
|
45286
45433
|
}
|
|
45287
45434
|
),
|
|
45288
|
-
editable && /* @__PURE__ */
|
|
45289
|
-
/* @__PURE__ */
|
|
45435
|
+
editable && /* @__PURE__ */ jsx102(TableControls, { editor, containerRef: editorContentRef }),
|
|
45436
|
+
/* @__PURE__ */ jsx102(
|
|
45290
45437
|
EditorContent,
|
|
45291
45438
|
{
|
|
45292
45439
|
editor,
|
|
@@ -45296,7 +45443,7 @@ var UEditor = React90.forwardRef(({
|
|
|
45296
45443
|
]
|
|
45297
45444
|
}
|
|
45298
45445
|
),
|
|
45299
|
-
showFooter && showCharacterCount && /* @__PURE__ */
|
|
45446
|
+
showFooter && showCharacterCount && /* @__PURE__ */ jsx102(CharacterCountDisplay, { editor, maxCharacters })
|
|
45300
45447
|
]
|
|
45301
45448
|
}
|
|
45302
45449
|
);
|