@editorcn/editor 0.4.2 → 0.5.1
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/CHANGELOG.md +40 -0
- package/README.md +9 -0
- package/dist/index.cjs +916 -458
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -6
- package/dist/index.d.ts +14 -6
- package/dist/index.js +809 -351
- package/dist/index.js.map +1 -1
- package/dist/style.css +115 -1077
- package/dist/theme.css +43 -0
- package/package.json +15 -7
package/dist/index.cjs
CHANGED
|
@@ -43,13 +43,12 @@ __export(index_exports, {
|
|
|
43
43
|
module.exports = __toCommonJS(index_exports);
|
|
44
44
|
|
|
45
45
|
// src/rte-text-editor.tsx
|
|
46
|
-
var
|
|
47
|
-
var import_react20 = require("react");
|
|
46
|
+
var import_react22 = require("react");
|
|
48
47
|
|
|
49
48
|
// src/bubble-menu/index.tsx
|
|
50
49
|
var import_core = require("@tiptap/core");
|
|
51
50
|
var import_menus = require("@tiptap/react/menus");
|
|
52
|
-
var
|
|
51
|
+
var import_react5 = require("react");
|
|
53
52
|
|
|
54
53
|
// src/ui/button.tsx
|
|
55
54
|
var import_button = require("@base-ui/react/button");
|
|
@@ -278,12 +277,12 @@ var PopoverContent = ({
|
|
|
278
277
|
var React4 = __toESM(require("react"), 1);
|
|
279
278
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
280
279
|
var RteButton = React4.forwardRef(
|
|
281
|
-
({ className
|
|
282
|
-
const cls =
|
|
283
|
-
"rte-bubble-btn",
|
|
284
|
-
active
|
|
280
|
+
({ className, active = false, ...props }, ref) => {
|
|
281
|
+
const cls = cn(
|
|
282
|
+
"rte-bubble-btn flex h-8 min-w-8 cursor-pointer items-center justify-center gap-1 rounded-md border-none bg-transparent px-2 text-[0.8125rem] font-medium whitespace-nowrap text-popover-foreground [transition:background-color_150ms_ease-out,color_150ms_ease-out,scale_100ms_ease-out] hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-ring/50 focus-visible:-outline-offset-2 active:scale-96",
|
|
283
|
+
active && "rte-bubble-btn--active bg-muted text-foreground",
|
|
285
284
|
className
|
|
286
|
-
|
|
285
|
+
);
|
|
287
286
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { ref, type: "button", className: cls, ...props });
|
|
288
287
|
}
|
|
289
288
|
);
|
|
@@ -293,11 +292,11 @@ RteButton.displayName = "RteButton";
|
|
|
293
292
|
var React5 = __toESM(require("react"), 1);
|
|
294
293
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
295
294
|
var RteButtonGroup = React5.forwardRef(
|
|
296
|
-
({ className
|
|
295
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
297
296
|
"div",
|
|
298
297
|
{
|
|
299
298
|
ref,
|
|
300
|
-
className:
|
|
299
|
+
className: cn("rte-bubble-group flex items-center gap-0.5", className),
|
|
301
300
|
...props
|
|
302
301
|
}
|
|
303
302
|
)
|
|
@@ -308,11 +307,14 @@ RteButtonGroup.displayName = "RteButtonGroup";
|
|
|
308
307
|
var React6 = __toESM(require("react"), 1);
|
|
309
308
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
310
309
|
var RteIcon = React6.forwardRef(
|
|
311
|
-
({ className
|
|
310
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
312
311
|
"span",
|
|
313
312
|
{
|
|
314
313
|
ref,
|
|
315
|
-
className:
|
|
314
|
+
className: cn(
|
|
315
|
+
"rte-bubble-btn-icon flex size-4 shrink-0 items-center justify-center [&_svg]:size-full",
|
|
316
|
+
className
|
|
317
|
+
),
|
|
316
318
|
...props
|
|
317
319
|
}
|
|
318
320
|
)
|
|
@@ -323,11 +325,14 @@ RteIcon.displayName = "RteIcon";
|
|
|
323
325
|
var React7 = __toESM(require("react"), 1);
|
|
324
326
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
325
327
|
var RteSeparator = React7.forwardRef(
|
|
326
|
-
({ className
|
|
328
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
327
329
|
"div",
|
|
328
330
|
{
|
|
329
331
|
ref,
|
|
330
|
-
className:
|
|
332
|
+
className: cn(
|
|
333
|
+
"rte-bubble-separator mx-0.5 h-4 w-px shrink-0 bg-border",
|
|
334
|
+
className
|
|
335
|
+
),
|
|
331
336
|
...props
|
|
332
337
|
}
|
|
333
338
|
)
|
|
@@ -338,12 +343,12 @@ RteSeparator.displayName = "RteSeparator";
|
|
|
338
343
|
var React8 = __toESM(require("react"), 1);
|
|
339
344
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
340
345
|
var RteOverlay = React8.forwardRef(
|
|
341
|
-
({ className
|
|
346
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
342
347
|
"div",
|
|
343
348
|
{
|
|
344
349
|
ref,
|
|
345
350
|
role: "presentation",
|
|
346
|
-
className:
|
|
351
|
+
className: cn("rte-bubble-overlay fixed inset-0 z-999", className),
|
|
347
352
|
...props
|
|
348
353
|
}
|
|
349
354
|
)
|
|
@@ -355,12 +360,12 @@ var React9 = __toESM(require("react"), 1);
|
|
|
355
360
|
var import_react = require("react");
|
|
356
361
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
357
362
|
var variantClass = {
|
|
358
|
-
color: "rte-bubble-dropdown--color",
|
|
363
|
+
color: "rte-bubble-dropdown--color min-w-auto p-2 [&_.rte-bubble-dropdown-divider]:mx-[-0.5rem] [&_.rte-bubble-dropdown-divider]:mt-2.5 [&_.rte-bubble-dropdown-divider]:mb-2",
|
|
359
364
|
default: "",
|
|
360
|
-
language: "rte-bubble-dropdown--language"
|
|
365
|
+
language: "rte-bubble-dropdown--language max-h-80 min-w-40 overflow-y-auto [scrollbar-width:thin]"
|
|
361
366
|
};
|
|
362
367
|
var RteDropdown = React9.forwardRef(
|
|
363
|
-
({ className
|
|
368
|
+
({ className, variant = "default", children, onMouseLeave, ...props }, ref) => {
|
|
364
369
|
const containerRef = (0, import_react.useRef)(null);
|
|
365
370
|
const [pill, setPill] = (0, import_react.useState)(null);
|
|
366
371
|
const handleItemEnter = (0, import_react.useCallback)((target) => {
|
|
@@ -396,7 +401,11 @@ var RteDropdown = React9.forwardRef(
|
|
|
396
401
|
},
|
|
397
402
|
[onMouseLeave]
|
|
398
403
|
);
|
|
399
|
-
const cls =
|
|
404
|
+
const cls = cn(
|
|
405
|
+
"rte-bubble-dropdown absolute top-full left-0 z-1000 mt-1.5 min-w-40 origin-top-left animate-rte-bubble-pop-in rounded-lg border border-[color-mix(in_srgb,var(--border)_60%,transparent)] bg-popover p-1 text-popover-foreground shadow-[0_8px_30px_-12px_rgb(0_0_0/0.15)]",
|
|
406
|
+
variantClass[variant],
|
|
407
|
+
className
|
|
408
|
+
);
|
|
400
409
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
401
410
|
"div",
|
|
402
411
|
{
|
|
@@ -418,10 +427,10 @@ var RteDropdown = React9.forwardRef(
|
|
|
418
427
|
"div",
|
|
419
428
|
{
|
|
420
429
|
"aria-hidden": "true",
|
|
421
|
-
className:
|
|
422
|
-
"rte-bubble-dropdown-pill",
|
|
423
|
-
pill
|
|
424
|
-
|
|
430
|
+
className: cn(
|
|
431
|
+
"rte-bubble-dropdown-pill pointer-events-none absolute top-0 left-0 z-0 rounded-sm bg-muted opacity-0 [transition:top_180ms_ease-out,left_180ms_ease-out,width_180ms_ease-out,height_180ms_ease-out,opacity_150ms_ease-out]",
|
|
432
|
+
pill && "rte-bubble-dropdown-pill--visible opacity-100"
|
|
433
|
+
),
|
|
425
434
|
style: pill ? {
|
|
426
435
|
height: pill.height,
|
|
427
436
|
left: pill.left,
|
|
@@ -460,11 +469,13 @@ var RteColorSwatch = React10.forwardRef(
|
|
|
460
469
|
"aria-pressed": active,
|
|
461
470
|
"aria-label": label,
|
|
462
471
|
title: label,
|
|
463
|
-
className:
|
|
464
|
-
"rte-bubble-color-swatch",
|
|
465
|
-
variant === "text" ? "rte-bubble-color-swatch--text" : "rte-bubble-color-swatch--highlight",
|
|
466
|
-
active
|
|
467
|
-
|
|
472
|
+
className: cn(
|
|
473
|
+
"rte-bubble-color-swatch inline-flex size-6 cursor-pointer items-center justify-center rounded-sm border border-transparent p-0 [transition:transform_150ms_ease-out,opacity_150ms_ease-out] hover:opacity-85 focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-ring/50 focus-visible:outline-offset-1 active:[transform:scale(0.96)]",
|
|
474
|
+
variant === "text" ? "rte-bubble-color-swatch--text border-(--swatch-color) bg-transparent text-(--swatch-color)" : "rte-bubble-color-swatch--highlight border-transparent bg-(--swatch-color) text-(--swatch-check)",
|
|
475
|
+
active && "rte-bubble-color-swatch--active",
|
|
476
|
+
active && variant === "text" && "border-(--swatch-color) bg-(--swatch-color) text-(--swatch-check)",
|
|
477
|
+
active && variant === "highlight" && "shadow-[0_0_0_2px_color-mix(in_srgb,var(--swatch-color)_55%,var(--popover-foreground))]"
|
|
478
|
+
),
|
|
468
479
|
style: {
|
|
469
480
|
"--swatch-check": checkColor,
|
|
470
481
|
"--swatch-color": color
|
|
@@ -472,20 +483,34 @@ var RteColorSwatch = React10.forwardRef(
|
|
|
472
483
|
onMouseDown: (e) => e.preventDefault(),
|
|
473
484
|
onClick: () => onSelect(color),
|
|
474
485
|
children: [
|
|
475
|
-
variant === "text" && !active ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
476
|
-
|
|
477
|
-
"svg",
|
|
486
|
+
variant === "text" && !active ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
487
|
+
"span",
|
|
478
488
|
{
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
stroke: "currentColor",
|
|
483
|
-
strokeWidth: 3,
|
|
484
|
-
strokeLinecap: "round",
|
|
485
|
-
strokeLinejoin: "round",
|
|
486
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M20 6 9 17l-5-5" })
|
|
489
|
+
className: "rte-bubble-color-glyph text-[0.6875rem] leading-none font-semibold",
|
|
490
|
+
"aria-hidden": "true",
|
|
491
|
+
children: "A"
|
|
487
492
|
}
|
|
488
|
-
)
|
|
493
|
+
) : null,
|
|
494
|
+
active ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
495
|
+
"span",
|
|
496
|
+
{
|
|
497
|
+
className: "rte-bubble-color-check flex size-3 items-center justify-center text-(--swatch-check) [&_svg]:size-full",
|
|
498
|
+
"aria-hidden": "true",
|
|
499
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
500
|
+
"svg",
|
|
501
|
+
{
|
|
502
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
503
|
+
viewBox: "0 0 24 24",
|
|
504
|
+
fill: "none",
|
|
505
|
+
stroke: "currentColor",
|
|
506
|
+
strokeWidth: 3,
|
|
507
|
+
strokeLinecap: "round",
|
|
508
|
+
strokeLinejoin: "round",
|
|
509
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M20 6 9 17l-5-5" })
|
|
510
|
+
}
|
|
511
|
+
)
|
|
512
|
+
}
|
|
513
|
+
) : null
|
|
489
514
|
]
|
|
490
515
|
}
|
|
491
516
|
);
|
|
@@ -496,12 +521,12 @@ RteColorSwatch.displayName = "RteColorSwatch";
|
|
|
496
521
|
// src/ui/rte-dropdown-item.tsx
|
|
497
522
|
var React11 = __toESM(require("react"), 1);
|
|
498
523
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
499
|
-
var RteDropdownItem = React11.forwardRef(({ className
|
|
500
|
-
const cls =
|
|
501
|
-
"rte-bubble-dropdown-item",
|
|
502
|
-
active
|
|
524
|
+
var RteDropdownItem = React11.forwardRef(({ className, active = false, ...props }, ref) => {
|
|
525
|
+
const cls = cn(
|
|
526
|
+
"rte-bubble-dropdown-item relative z-1 flex h-8 w-full cursor-pointer items-center justify-start gap-2 rounded-sm border-none bg-transparent px-2 text-left text-[0.8125rem] text-muted-foreground outline-none [transition:background-color_150ms_ease-out,color_150ms_ease-out] hover:text-foreground focus-visible:text-foreground hover:[&_.rte-bubble-dropdown-icon]:text-foreground",
|
|
527
|
+
active && "rte-bubble-dropdown-item--active bg-muted font-medium text-foreground [&_.rte-bubble-dropdown-icon]:text-foreground",
|
|
503
528
|
className
|
|
504
|
-
|
|
529
|
+
);
|
|
505
530
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
506
531
|
"button",
|
|
507
532
|
{
|
|
@@ -518,11 +543,14 @@ RteDropdownItem.displayName = "RteDropdownItem";
|
|
|
518
543
|
// src/ui/rte-dropdown-divider.tsx
|
|
519
544
|
var React12 = __toESM(require("react"), 1);
|
|
520
545
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
521
|
-
var RteDropdownDivider = React12.forwardRef(({ className
|
|
546
|
+
var RteDropdownDivider = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
522
547
|
"div",
|
|
523
548
|
{
|
|
524
549
|
ref,
|
|
525
|
-
className:
|
|
550
|
+
className: cn(
|
|
551
|
+
"rte-bubble-dropdown-divider -mx-1 my-1 h-px bg-[color-mix(in_srgb,var(--border)_60%,transparent)]",
|
|
552
|
+
className
|
|
553
|
+
),
|
|
526
554
|
...props
|
|
527
555
|
}
|
|
528
556
|
));
|
|
@@ -532,11 +560,14 @@ RteDropdownDivider.displayName = "RteDropdownDivider";
|
|
|
532
560
|
var React13 = __toESM(require("react"), 1);
|
|
533
561
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
534
562
|
var RteDropdownIcon = React13.forwardRef(
|
|
535
|
-
({ className
|
|
563
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
536
564
|
"span",
|
|
537
565
|
{
|
|
538
566
|
ref,
|
|
539
|
-
className:
|
|
567
|
+
className: cn(
|
|
568
|
+
"rte-bubble-dropdown-icon flex size-4 shrink-0 items-center justify-center text-muted-foreground [&_svg]:size-full",
|
|
569
|
+
className
|
|
570
|
+
),
|
|
540
571
|
...props
|
|
541
572
|
}
|
|
542
573
|
)
|
|
@@ -546,6 +577,7 @@ RteDropdownIcon.displayName = "RteDropdownIcon";
|
|
|
546
577
|
// src/ui/toggle.tsx
|
|
547
578
|
var import_toggle = require("@base-ui/react/toggle");
|
|
548
579
|
var import_class_variance_authority2 = require("class-variance-authority");
|
|
580
|
+
var import_react2 = require("react");
|
|
549
581
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
550
582
|
var toggleVariants = (0, import_class_variance_authority2.cva)(
|
|
551
583
|
"group/toggle inline-flex items-center justify-center gap-1 rounded-md text-xs font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
@@ -567,19 +599,16 @@ var toggleVariants = (0, import_class_variance_authority2.cva)(
|
|
|
567
599
|
}
|
|
568
600
|
}
|
|
569
601
|
);
|
|
570
|
-
var Toggle = ({
|
|
571
|
-
className,
|
|
572
|
-
variant = "default",
|
|
573
|
-
size = "default",
|
|
574
|
-
...props
|
|
575
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
602
|
+
var Toggle = (0, import_react2.forwardRef)(({ className, variant = "default", size = "default", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
576
603
|
import_toggle.Toggle,
|
|
577
604
|
{
|
|
605
|
+
ref,
|
|
578
606
|
"data-slot": "toggle",
|
|
579
607
|
className: cn(toggleVariants({ className, size, variant })),
|
|
580
608
|
...props
|
|
581
609
|
}
|
|
582
|
-
);
|
|
610
|
+
));
|
|
611
|
+
Toggle.displayName = "Toggle";
|
|
583
612
|
|
|
584
613
|
// src/ui/tooltip.tsx
|
|
585
614
|
var import_tooltip = require("@base-ui/react/tooltip");
|
|
@@ -630,12 +659,21 @@ var TooltipContent = ({
|
|
|
630
659
|
)
|
|
631
660
|
}
|
|
632
661
|
) });
|
|
662
|
+
var createTooltipHandle = () => import_tooltip.Tooltip.createHandle();
|
|
663
|
+
var TooltipHost = ({
|
|
664
|
+
handle,
|
|
665
|
+
children,
|
|
666
|
+
...props
|
|
667
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
668
|
+
children,
|
|
669
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Tooltip, { handle, children: ({ payload }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TooltipContent, { ...props, children: payload }) })
|
|
670
|
+
] });
|
|
633
671
|
|
|
634
672
|
// src/bubble-menu/color-selector.tsx
|
|
635
|
-
var
|
|
673
|
+
var import_react4 = require("react");
|
|
636
674
|
|
|
637
675
|
// src/bubble-menu/utils.ts
|
|
638
|
-
var
|
|
676
|
+
var import_react3 = require("react");
|
|
639
677
|
var defaultEqual = (a, b) => a === b;
|
|
640
678
|
var shallowEqual = (a, b) => {
|
|
641
679
|
if (a === b) {
|
|
@@ -652,16 +690,16 @@ var shallowEqual = (a, b) => {
|
|
|
652
690
|
return ak.every((k) => a[k] === b[k]);
|
|
653
691
|
};
|
|
654
692
|
var useEditorState = (editor, selector, isEqual = defaultEqual) => {
|
|
655
|
-
const selectorRef = (0,
|
|
656
|
-
const isEqualRef = (0,
|
|
657
|
-
(0,
|
|
693
|
+
const selectorRef = (0, import_react3.useRef)(selector);
|
|
694
|
+
const isEqualRef = (0, import_react3.useRef)(isEqual);
|
|
695
|
+
(0, import_react3.useEffect)(() => {
|
|
658
696
|
selectorRef.current = selector;
|
|
659
697
|
isEqualRef.current = isEqual;
|
|
660
698
|
});
|
|
661
|
-
const snapshotRef = (0,
|
|
699
|
+
const snapshotRef = (0, import_react3.useRef)({
|
|
662
700
|
value: editor ? selector(editor) : void 0
|
|
663
701
|
});
|
|
664
|
-
const updateSnapshot = (0,
|
|
702
|
+
const updateSnapshot = (0, import_react3.useCallback)(() => {
|
|
665
703
|
if (!editor) {
|
|
666
704
|
return;
|
|
667
705
|
}
|
|
@@ -671,7 +709,7 @@ var useEditorState = (editor, selector, isEqual = defaultEqual) => {
|
|
|
671
709
|
}
|
|
672
710
|
snapshotRef.current = { value: next };
|
|
673
711
|
}, [editor]);
|
|
674
|
-
const subscribe = (0,
|
|
712
|
+
const subscribe = (0, import_react3.useCallback)(
|
|
675
713
|
(onStoreChange) => {
|
|
676
714
|
if (!editor) {
|
|
677
715
|
return () => {
|
|
@@ -690,8 +728,8 @@ var useEditorState = (editor, selector, isEqual = defaultEqual) => {
|
|
|
690
728
|
},
|
|
691
729
|
[editor, updateSnapshot]
|
|
692
730
|
);
|
|
693
|
-
const getSnapshot = (0,
|
|
694
|
-
return (0,
|
|
731
|
+
const getSnapshot = (0, import_react3.useCallback)(() => snapshotRef.current.value, []);
|
|
732
|
+
return (0, import_react3.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
|
|
695
733
|
};
|
|
696
734
|
|
|
697
735
|
// src/bubble-menu/color-selector.tsx
|
|
@@ -744,8 +782,8 @@ var HIGHLIGHT_COLORS = [
|
|
|
744
782
|
{ color: "#bbf7d0", label: "Green" }
|
|
745
783
|
];
|
|
746
784
|
var ColorSelector = ({ editor }) => {
|
|
747
|
-
const [open, setOpen] = (0,
|
|
748
|
-
const [recent, setRecent] = (0,
|
|
785
|
+
const [open, setOpen] = (0, import_react4.useState)(false);
|
|
786
|
+
const [recent, setRecent] = (0, import_react4.useState)(() => readRecentColors());
|
|
749
787
|
const { highlightColor, textColor } = useEditorState(
|
|
750
788
|
editor,
|
|
751
789
|
(ed) => ({
|
|
@@ -830,9 +868,9 @@ var ColorSelector = ({ editor }) => {
|
|
|
830
868
|
}
|
|
831
869
|
),
|
|
832
870
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(RteDropdown, { variant: "color", children: [
|
|
833
|
-
recent.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "rte-bubble-color-section", children: [
|
|
834
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rte-bubble-color-label", children: "Recently Used" }),
|
|
835
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "rte-bubble-color-recent", children: recent.map((item) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
871
|
+
recent.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "rte-bubble-color-section flex flex-col gap-2", children: [
|
|
872
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rte-bubble-color-label px-0.5 text-[0.75rem] leading-none font-medium text-muted-foreground", children: "Recently Used" }),
|
|
873
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "rte-bubble-color-recent flex flex-wrap justify-center gap-1.5", children: recent.map((item) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
836
874
|
RteColorSwatch,
|
|
837
875
|
{
|
|
838
876
|
variant: item.type,
|
|
@@ -846,9 +884,9 @@ var ColorSelector = ({ editor }) => {
|
|
|
846
884
|
] }) : null,
|
|
847
885
|
hasColor ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
848
886
|
recent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RteDropdownDivider, {}),
|
|
849
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "rte-bubble-color-section", children: [
|
|
850
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rte-bubble-color-label", children: "Text Color" }),
|
|
851
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "rte-bubble-color-grid", children: TEXT_COLORS.map((item) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
887
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "rte-bubble-color-section flex flex-col gap-2", children: [
|
|
888
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rte-bubble-color-label px-0.5 text-[0.75rem] leading-none font-medium text-muted-foreground", children: "Text Color" }),
|
|
889
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "rte-bubble-color-grid grid grid-cols-[repeat(5,1.5rem)] justify-center gap-1.5", children: TEXT_COLORS.map((item) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
852
890
|
RteColorSwatch,
|
|
853
891
|
{
|
|
854
892
|
variant: "text",
|
|
@@ -863,9 +901,9 @@ var ColorSelector = ({ editor }) => {
|
|
|
863
901
|
] }) : null,
|
|
864
902
|
hasHighlight ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
865
903
|
(recent.length > 0 || hasColor) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RteDropdownDivider, {}),
|
|
866
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "rte-bubble-color-section", children: [
|
|
867
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rte-bubble-color-label", children: "Highlight Color" }),
|
|
868
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "rte-bubble-color-grid", children: HIGHLIGHT_COLORS.map((item) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
904
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "rte-bubble-color-section flex flex-col gap-2", children: [
|
|
905
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rte-bubble-color-label px-0.5 text-[0.75rem] leading-none font-medium text-muted-foreground", children: "Highlight Color" }),
|
|
906
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "rte-bubble-color-grid grid grid-cols-[repeat(5,1.5rem)] justify-center gap-1.5", children: HIGHLIGHT_COLORS.map((item) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
869
907
|
RteColorSwatch,
|
|
870
908
|
{
|
|
871
909
|
variant: "highlight",
|
|
@@ -980,7 +1018,7 @@ var TextButtons = ({ editor }) => {
|
|
|
980
1018
|
// src/bubble-menu/index.tsx
|
|
981
1019
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
982
1020
|
var BubbleMenu = ({ editor }) => {
|
|
983
|
-
const shouldShow = (0,
|
|
1021
|
+
const shouldShow = (0, import_react5.useCallback)(
|
|
984
1022
|
({
|
|
985
1023
|
editor: ed,
|
|
986
1024
|
state
|
|
@@ -1015,7 +1053,7 @@ var BubbleMenu = ({ editor }) => {
|
|
|
1015
1053
|
editor,
|
|
1016
1054
|
options: { offset: 8, placement: "top" },
|
|
1017
1055
|
shouldShow,
|
|
1018
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "rte-bubble-menu", children: [
|
|
1056
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "rte-bubble-menu flex h-10 animate-rte-bubble-pop-in items-center rounded-lg border border-[color-mix(in_srgb,var(--border)_60%,transparent)] bg-popover px-1 text-popover-foreground shadow-[0_8px_30px_-12px_rgb(0_0_0/0.15)]", children: [
|
|
1019
1057
|
hasText && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TextButtons, { editor }),
|
|
1020
1058
|
hasText && hasColor && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(RteSeparator, {}),
|
|
1021
1059
|
hasColor && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ColorSelector, { editor })
|
|
@@ -1025,14 +1063,14 @@ var BubbleMenu = ({ editor }) => {
|
|
|
1025
1063
|
};
|
|
1026
1064
|
|
|
1027
1065
|
// src/controls/rte-control.tsx
|
|
1028
|
-
var
|
|
1029
|
-
var
|
|
1066
|
+
var import_react7 = require("@tiptap/react");
|
|
1067
|
+
var import_react8 = require("react");
|
|
1030
1068
|
|
|
1031
1069
|
// src/rte-context.ts
|
|
1032
|
-
var
|
|
1033
|
-
var RichTextEditorContext = (0,
|
|
1070
|
+
var import_react6 = require("react");
|
|
1071
|
+
var RichTextEditorContext = (0, import_react6.createContext)(null);
|
|
1034
1072
|
var useRichTextEditorContext = () => {
|
|
1035
|
-
const context = (0,
|
|
1073
|
+
const context = (0, import_react6.useContext)(RichTextEditorContext);
|
|
1036
1074
|
if (!context) {
|
|
1037
1075
|
throw new Error(
|
|
1038
1076
|
"useRichTextEditorContext must be used within RichTextEditor"
|
|
@@ -1045,42 +1083,69 @@ var useRichTextEditorContext = () => {
|
|
|
1045
1083
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1046
1084
|
var RichTextEditorTooltip = ({
|
|
1047
1085
|
children,
|
|
1086
|
+
id,
|
|
1048
1087
|
label
|
|
1049
1088
|
}) => {
|
|
1050
|
-
const tooltip = (0,
|
|
1089
|
+
const tooltip = (0, import_react8.useContext)(RichTextEditorContext)?.tooltip;
|
|
1051
1090
|
if (!tooltip) {
|
|
1052
|
-
return children;
|
|
1091
|
+
return id ? (0, import_react8.cloneElement)(children, { id }) : children;
|
|
1053
1092
|
}
|
|
1054
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1055
|
-
|
|
1056
|
-
var RichTextEditorControl = ({
|
|
1057
|
-
active = false,
|
|
1058
|
-
interactive: _interactive = true,
|
|
1059
|
-
className,
|
|
1060
|
-
children,
|
|
1061
|
-
onMouseDown,
|
|
1062
|
-
onClick,
|
|
1063
|
-
disabled,
|
|
1064
|
-
...props
|
|
1065
|
-
}) => {
|
|
1066
|
-
const toggle = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1067
|
-
Toggle,
|
|
1093
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1094
|
+
TooltipTrigger,
|
|
1068
1095
|
{
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
className: cn("rte-control-button", className),
|
|
1074
|
-
onMouseDown: (e) => {
|
|
1075
|
-
e.preventDefault();
|
|
1076
|
-
onMouseDown?.(e);
|
|
1077
|
-
},
|
|
1078
|
-
onPressedChange: () => onClick?.({}),
|
|
1079
|
-
children
|
|
1096
|
+
handle: tooltip,
|
|
1097
|
+
payload: label,
|
|
1098
|
+
render: children,
|
|
1099
|
+
...id && { id }
|
|
1080
1100
|
}
|
|
1081
1101
|
);
|
|
1082
|
-
return props.title ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(RichTextEditorTooltip, { label: props.title, children: toggle }) : toggle;
|
|
1083
1102
|
};
|
|
1103
|
+
var triggerKeys = [
|
|
1104
|
+
"aria-controls",
|
|
1105
|
+
"aria-expanded",
|
|
1106
|
+
"aria-haspopup"
|
|
1107
|
+
];
|
|
1108
|
+
var triggerProps = (props) => Object.fromEntries(
|
|
1109
|
+
triggerKeys.flatMap(
|
|
1110
|
+
(key) => props[key] === void 0 ? [] : [[key, props[key]]]
|
|
1111
|
+
)
|
|
1112
|
+
);
|
|
1113
|
+
var RichTextEditorControl = (0, import_react8.forwardRef)(
|
|
1114
|
+
({
|
|
1115
|
+
active = false,
|
|
1116
|
+
interactive: _interactive = true,
|
|
1117
|
+
className,
|
|
1118
|
+
children,
|
|
1119
|
+
onMouseDown,
|
|
1120
|
+
onClick,
|
|
1121
|
+
disabled,
|
|
1122
|
+
...props
|
|
1123
|
+
}, ref) => {
|
|
1124
|
+
const toggle = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1125
|
+
Toggle,
|
|
1126
|
+
{
|
|
1127
|
+
ref,
|
|
1128
|
+
...triggerProps(props),
|
|
1129
|
+
...!props.title && props.id && { id: props.id },
|
|
1130
|
+
size: "sm",
|
|
1131
|
+
pressed: active,
|
|
1132
|
+
disabled,
|
|
1133
|
+
"aria-label": props["aria-label"],
|
|
1134
|
+
className: cn(
|
|
1135
|
+
"rte-control-button inline-flex h-8 min-w-8 items-center justify-center rounded-md p-0 transition-[background-color,color,scale] duration-[150ms,150ms,100ms] ease-[ease-out] active:scale-96",
|
|
1136
|
+
className
|
|
1137
|
+
),
|
|
1138
|
+
onMouseDown: (e) => {
|
|
1139
|
+
e.preventDefault();
|
|
1140
|
+
onMouseDown?.(e);
|
|
1141
|
+
},
|
|
1142
|
+
onClick,
|
|
1143
|
+
children
|
|
1144
|
+
}
|
|
1145
|
+
);
|
|
1146
|
+
return props.title ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(RichTextEditorTooltip, { id: props.id, label: props.title, children: toggle }) : toggle;
|
|
1147
|
+
}
|
|
1148
|
+
);
|
|
1084
1149
|
var resolveIsActive = (editor, config) => {
|
|
1085
1150
|
if (!editor || !config) {
|
|
1086
1151
|
return false;
|
|
@@ -1108,7 +1173,7 @@ var createControl = ({
|
|
|
1108
1173
|
const { editor, labels, icons } = useRichTextEditorContext();
|
|
1109
1174
|
const ariaLabel = labels[label];
|
|
1110
1175
|
const selector = createSelector(isActive, isDisabled);
|
|
1111
|
-
(0,
|
|
1176
|
+
(0, import_react7.useEditorState)({ editor: editor ?? null, selector });
|
|
1112
1177
|
const { active, disabled } = selector({ editor: editor ?? null });
|
|
1113
1178
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1114
1179
|
RichTextEditorControl,
|
|
@@ -1295,19 +1360,19 @@ var SuperscriptControl = createControl({
|
|
|
1295
1360
|
});
|
|
1296
1361
|
|
|
1297
1362
|
// src/controls/rte-link-control.tsx
|
|
1298
|
-
var
|
|
1363
|
+
var import_react9 = require("@tiptap/react");
|
|
1299
1364
|
var React15 = __toESM(require("react"), 1);
|
|
1300
|
-
var
|
|
1365
|
+
var import_react10 = require("react");
|
|
1301
1366
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1302
1367
|
var LinkControl = () => {
|
|
1303
1368
|
const { editor, icons, labels, tooltip } = useRichTextEditorContext();
|
|
1304
|
-
const [url, setUrl] = (0,
|
|
1305
|
-
const [open, setOpen] = (0,
|
|
1306
|
-
const active = (0,
|
|
1369
|
+
const [url, setUrl] = (0, import_react10.useState)("");
|
|
1370
|
+
const [open, setOpen] = (0, import_react10.useState)(false);
|
|
1371
|
+
const active = (0, import_react9.useEditorState)({
|
|
1307
1372
|
editor: editor ?? null,
|
|
1308
1373
|
selector: (ctx) => ctx.editor && !ctx.editor.isDestroyed ? ctx.editor.isActive("link") : false
|
|
1309
1374
|
});
|
|
1310
|
-
const handleOpen = (0,
|
|
1375
|
+
const handleOpen = (0, import_react10.useCallback)(
|
|
1311
1376
|
(isOpen) => {
|
|
1312
1377
|
if (isOpen) {
|
|
1313
1378
|
const linkData = editor?.getAttributes("link");
|
|
@@ -1366,7 +1431,7 @@ var LinkControl = () => {
|
|
|
1366
1431
|
)
|
|
1367
1432
|
}
|
|
1368
1433
|
),
|
|
1369
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PopoverContent, { className: "w-72 p-3", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "rte-link-editor", children: [
|
|
1434
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PopoverContent, { className: "w-72 p-3", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "rte-link-editor flex items-center gap-1", children: [
|
|
1370
1435
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1371
1436
|
Input,
|
|
1372
1437
|
{
|
|
@@ -1376,7 +1441,7 @@ var LinkControl = () => {
|
|
|
1376
1441
|
value: url,
|
|
1377
1442
|
onChange: (e) => setUrl(e.target.value),
|
|
1378
1443
|
onKeyDown: handleKeyDown,
|
|
1379
|
-
className: "rte-link-editor-input h-8 text-sm"
|
|
1444
|
+
className: "rte-link-editor-input h-8 min-w-[200px] flex-1 text-sm"
|
|
1380
1445
|
}
|
|
1381
1446
|
),
|
|
1382
1447
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
@@ -1385,7 +1450,7 @@ var LinkControl = () => {
|
|
|
1385
1450
|
size: "sm",
|
|
1386
1451
|
variant: "default",
|
|
1387
1452
|
onClick: handleSave,
|
|
1388
|
-
className: "rte-link-editor-save h-8",
|
|
1453
|
+
className: "rte-link-editor-save h-8 rounded-ss-none rounded-es-none",
|
|
1389
1454
|
children: labels.linkEditorSave
|
|
1390
1455
|
}
|
|
1391
1456
|
)
|
|
@@ -1395,24 +1460,68 @@ var LinkControl = () => {
|
|
|
1395
1460
|
|
|
1396
1461
|
// src/controls/rte-twitter-control.tsx
|
|
1397
1462
|
var import_core2 = require("@tiptap/core");
|
|
1398
|
-
var
|
|
1399
|
-
var
|
|
1463
|
+
var import_react15 = require("@tiptap/react");
|
|
1464
|
+
var import_react16 = require("react");
|
|
1400
1465
|
|
|
1401
1466
|
// src/extensions/resizable-node-view.tsx
|
|
1402
|
-
var
|
|
1403
|
-
var
|
|
1467
|
+
var import_react13 = require("@tiptap/react");
|
|
1468
|
+
var import_react14 = require("react");
|
|
1404
1469
|
|
|
1405
1470
|
// src/icons.tsx
|
|
1471
|
+
var import_react12 = require("react");
|
|
1472
|
+
|
|
1473
|
+
// src/icon-placeholder.tsx
|
|
1406
1474
|
var import_lucide_react = require("lucide-react");
|
|
1407
|
-
var
|
|
1475
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1476
|
+
var ICONS = {
|
|
1477
|
+
AlignCenter: import_lucide_react.AlignCenter,
|
|
1478
|
+
AlignJustify: import_lucide_react.AlignJustify,
|
|
1479
|
+
AlignLeft: import_lucide_react.AlignLeft,
|
|
1480
|
+
AlignRight: import_lucide_react.AlignRight,
|
|
1481
|
+
Bold: import_lucide_react.Bold,
|
|
1482
|
+
Code: import_lucide_react.Code,
|
|
1483
|
+
Heading1: import_lucide_react.Heading1,
|
|
1484
|
+
Heading2: import_lucide_react.Heading2,
|
|
1485
|
+
Heading3: import_lucide_react.Heading3,
|
|
1486
|
+
Heading4: import_lucide_react.Heading4,
|
|
1487
|
+
Heading5: import_lucide_react.Heading5,
|
|
1488
|
+
Heading6: import_lucide_react.Heading6,
|
|
1489
|
+
Highlighter: import_lucide_react.Highlighter,
|
|
1490
|
+
Italic: import_lucide_react.Italic,
|
|
1491
|
+
Link: import_lucide_react.Link,
|
|
1492
|
+
Link2Off: import_lucide_react.Link2Off,
|
|
1493
|
+
List: import_lucide_react.List,
|
|
1494
|
+
ListOrdered: import_lucide_react.ListOrdered,
|
|
1495
|
+
Minus: import_lucide_react.Minus,
|
|
1496
|
+
Redo2: import_lucide_react.Redo2,
|
|
1497
|
+
RemoveFormatting: import_lucide_react.RemoveFormatting,
|
|
1498
|
+
SquareCode: import_lucide_react.SquareCode,
|
|
1499
|
+
Strikethrough: import_lucide_react.Strikethrough,
|
|
1500
|
+
Subscript: import_lucide_react.Subscript,
|
|
1501
|
+
Superscript: import_lucide_react.Superscript,
|
|
1502
|
+
TextQuote: import_lucide_react.TextQuote,
|
|
1503
|
+
Underline: import_lucide_react.Underline,
|
|
1504
|
+
Undo2: import_lucide_react.Undo2
|
|
1505
|
+
};
|
|
1506
|
+
var IconPlaceholder = ({
|
|
1507
|
+
lucide,
|
|
1508
|
+
tabler: _tabler,
|
|
1509
|
+
hugeicons: _hugeicons,
|
|
1510
|
+
phosphor: _phosphor,
|
|
1511
|
+
remixicon: _remixicon,
|
|
1512
|
+
...props
|
|
1513
|
+
}) => {
|
|
1514
|
+
const Icon2 = ICONS[lucide];
|
|
1515
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon2, { ...props });
|
|
1516
|
+
};
|
|
1408
1517
|
|
|
1409
1518
|
// src/language-icons.tsx
|
|
1410
|
-
var
|
|
1411
|
-
var
|
|
1519
|
+
var import_react11 = require("react");
|
|
1520
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1412
1521
|
var LangIcon = ({
|
|
1413
1522
|
children,
|
|
1414
1523
|
className
|
|
1415
|
-
}) => /* @__PURE__ */ (0,
|
|
1524
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1416
1525
|
"svg",
|
|
1417
1526
|
{
|
|
1418
1527
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1427,140 +1536,140 @@ var LangIcon = ({
|
|
|
1427
1536
|
}
|
|
1428
1537
|
);
|
|
1429
1538
|
var DEFAULT_LANGUAGE_ICONS = {
|
|
1430
|
-
bash: /* @__PURE__ */ (0,
|
|
1431
|
-
/* @__PURE__ */ (0,
|
|
1432
|
-
/* @__PURE__ */ (0,
|
|
1433
|
-
/* @__PURE__ */ (0,
|
|
1539
|
+
bash: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1540
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("rect", { x: "2.5", y: "4", width: "19", height: "16", rx: "2" }),
|
|
1541
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M6.5 9.5l3.5 3-3.5 3" }),
|
|
1542
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M12 15.5h5.5" })
|
|
1434
1543
|
] }),
|
|
1435
|
-
c: /* @__PURE__ */ (0,
|
|
1436
|
-
/* @__PURE__ */ (0,
|
|
1437
|
-
/* @__PURE__ */ (0,
|
|
1544
|
+
c: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1545
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("circle", { cx: "12", cy: "12", r: "8.5" }),
|
|
1546
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M15.6 9.3a4.5 4.5 0 1 0 0 5.4" })
|
|
1438
1547
|
] }),
|
|
1439
|
-
cpp: /* @__PURE__ */ (0,
|
|
1440
|
-
/* @__PURE__ */ (0,
|
|
1441
|
-
/* @__PURE__ */ (0,
|
|
1442
|
-
/* @__PURE__ */ (0,
|
|
1443
|
-
/* @__PURE__ */ (0,
|
|
1548
|
+
cpp: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1549
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("circle", { cx: "9.5", cy: "12", r: "6.5" }),
|
|
1550
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M12.3 9.7a3.3 3.3 0 1 0 0 4.6" }),
|
|
1551
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M15.7 10.5v3M14.2 12h3" }),
|
|
1552
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M19.3 10.5v3M17.8 12h3" })
|
|
1444
1553
|
] }),
|
|
1445
|
-
css: /* @__PURE__ */ (0,
|
|
1446
|
-
/* @__PURE__ */ (0,
|
|
1447
|
-
/* @__PURE__ */ (0,
|
|
1448
|
-
/* @__PURE__ */ (0,
|
|
1449
|
-
/* @__PURE__ */ (0,
|
|
1450
|
-
/* @__PURE__ */ (0,
|
|
1554
|
+
css: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1555
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1556
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M9.7 7.5l-1 9" }),
|
|
1557
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M15.3 7.5l-1 9" }),
|
|
1558
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M7 10.3h11" }),
|
|
1559
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M6.5 14.3h11" })
|
|
1451
1560
|
] }),
|
|
1452
|
-
go: /* @__PURE__ */ (0,
|
|
1453
|
-
/* @__PURE__ */ (0,
|
|
1454
|
-
/* @__PURE__ */ (0,
|
|
1455
|
-
/* @__PURE__ */ (0,
|
|
1456
|
-
/* @__PURE__ */ (0,
|
|
1561
|
+
go: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1562
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1563
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M12.6 9.7A3.3 3.3 0 1 0 12.6 14.3" }),
|
|
1564
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M12.6 12h-1.9" }),
|
|
1565
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("circle", { cx: "17", cy: "12", r: "2.9" })
|
|
1457
1566
|
] }),
|
|
1458
|
-
html: /* @__PURE__ */ (0,
|
|
1459
|
-
/* @__PURE__ */ (0,
|
|
1460
|
-
/* @__PURE__ */ (0,
|
|
1461
|
-
/* @__PURE__ */ (0,
|
|
1462
|
-
/* @__PURE__ */ (0,
|
|
1567
|
+
html: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1568
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1569
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M9.5 8.5L6.5 12l3 3.5" }),
|
|
1570
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M14.5 8.5L17.5 12l-3 3.5" }),
|
|
1571
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M13 7.3l-2 9.4" })
|
|
1463
1572
|
] }),
|
|
1464
|
-
java: /* @__PURE__ */ (0,
|
|
1465
|
-
/* @__PURE__ */ (0,
|
|
1466
|
-
/* @__PURE__ */ (0,
|
|
1467
|
-
/* @__PURE__ */ (0,
|
|
1468
|
-
/* @__PURE__ */ (0,
|
|
1573
|
+
java: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1574
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M6 10h10v5a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3v-5z" }),
|
|
1575
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M16 12h1.3a1.8 1.8 0 0 1 0 3.6H16" }),
|
|
1576
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M9.3 3.8c-.9.8-.9 1.6 0 2.4M13.3 3.8c-.9.8-.9 1.6 0 2.4" }),
|
|
1577
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M6 19.3h10" })
|
|
1469
1578
|
] }),
|
|
1470
|
-
javascript: /* @__PURE__ */ (0,
|
|
1471
|
-
/* @__PURE__ */ (0,
|
|
1472
|
-
/* @__PURE__ */ (0,
|
|
1473
|
-
/* @__PURE__ */ (0,
|
|
1579
|
+
javascript: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1580
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1581
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M10.5 8v6.5a2 2 0 0 1-3.5 1.3" }),
|
|
1582
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M17 8.8a2 2 0 0 0-2-.8c-1.1 0-2.2.6-2.2 1.7 0 1 .9 1.4 2.2 1.7 1.3.3 2.3.7 2.3 1.9 0 1.1-1 1.8-2.3 1.8a2.4 2.4 0 0 1-2.3-1.4" })
|
|
1474
1583
|
] }),
|
|
1475
|
-
json: /* @__PURE__ */ (0,
|
|
1476
|
-
/* @__PURE__ */ (0,
|
|
1477
|
-
/* @__PURE__ */ (0,
|
|
1584
|
+
json: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1585
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M8 3H7a2 2 0 0 0-2 2v4a2 2 0 0 1-2 2 2 2 0 0 1 2 2v4a2 2 0 0 0 2 2" }),
|
|
1586
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M16 3h1a2 2 0 0 1 2 2v4a2 2 0 0 0 2 2 2 2 0 0 0-2 2v4a2 2 0 0 1-2 2" })
|
|
1478
1587
|
] }),
|
|
1479
|
-
kotlin: /* @__PURE__ */ (0,
|
|
1480
|
-
/* @__PURE__ */ (0,
|
|
1481
|
-
/* @__PURE__ */ (0,
|
|
1482
|
-
/* @__PURE__ */ (0,
|
|
1483
|
-
/* @__PURE__ */ (0,
|
|
1588
|
+
kotlin: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1589
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1590
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M9 7.5v9" }),
|
|
1591
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M9 12l6-4.5" }),
|
|
1592
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M9 12l6 4.5" })
|
|
1484
1593
|
] }),
|
|
1485
|
-
markdown: /* @__PURE__ */ (0,
|
|
1486
|
-
/* @__PURE__ */ (0,
|
|
1487
|
-
/* @__PURE__ */ (0,
|
|
1488
|
-
/* @__PURE__ */ (0,
|
|
1489
|
-
/* @__PURE__ */ (0,
|
|
1594
|
+
markdown: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1595
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("rect", { x: "2", y: "5", width: "20", height: "14", rx: "2" }),
|
|
1596
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M6 15V9l3 4 3-4v6" }),
|
|
1597
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M16.5 9v6" }),
|
|
1598
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M14.5 13l2 2 2-2" })
|
|
1490
1599
|
] }),
|
|
1491
|
-
php: /* @__PURE__ */ (0,
|
|
1492
|
-
/* @__PURE__ */ (0,
|
|
1493
|
-
/* @__PURE__ */ (0,
|
|
1494
|
-
/* @__PURE__ */ (0,
|
|
1495
|
-
/* @__PURE__ */ (0,
|
|
1600
|
+
php: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1601
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1602
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M11.5 8.5L7.5 12l4 3.5" }),
|
|
1603
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M15.2 8.2c1.1 0 1.9.6 1.9 1.6 0 1.1-.9 1.5-1.8 1.8-.6.2-1 .5-1 1.1" }),
|
|
1604
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("circle", { cx: "14.3", cy: "16.2", r: ".5", fill: "currentColor", stroke: "none" })
|
|
1496
1605
|
] }),
|
|
1497
|
-
plaintext: /* @__PURE__ */ (0,
|
|
1498
|
-
/* @__PURE__ */ (0,
|
|
1499
|
-
/* @__PURE__ */ (0,
|
|
1500
|
-
/* @__PURE__ */ (0,
|
|
1501
|
-
/* @__PURE__ */ (0,
|
|
1606
|
+
plaintext: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1607
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("rect", { x: "4", y: "2.5", width: "16", height: "19", rx: "2" }),
|
|
1608
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "7.5", y1: "7.5", x2: "16.5", y2: "7.5" }),
|
|
1609
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "7.5", y1: "11.5", x2: "16.5", y2: "11.5" }),
|
|
1610
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "7.5", y1: "15.5", x2: "13.5", y2: "15.5" })
|
|
1502
1611
|
] }),
|
|
1503
|
-
python: /* @__PURE__ */ (0,
|
|
1504
|
-
/* @__PURE__ */ (0,
|
|
1505
|
-
/* @__PURE__ */ (0,
|
|
1506
|
-
/* @__PURE__ */ (0,
|
|
1507
|
-
/* @__PURE__ */ (0,
|
|
1612
|
+
python: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1613
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M4.5 15c0-3 2.5-4.7 5.7-4.7h1.6c2.8 0 5-2 5-4.5" }),
|
|
1614
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M9.5 3.3c1.3-.3 2.6 0 3.3 1-.7 1-2 1.3-3.3 1" }),
|
|
1615
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("circle", { cx: "15.5", cy: "4.3", r: ".55", fill: "currentColor", stroke: "none" }),
|
|
1616
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M17.8 4.5l1.4-.6M17.8 4.9l1.4.6" })
|
|
1508
1617
|
] }),
|
|
1509
|
-
ruby: /* @__PURE__ */ (0,
|
|
1510
|
-
/* @__PURE__ */ (0,
|
|
1511
|
-
/* @__PURE__ */ (0,
|
|
1512
|
-
/* @__PURE__ */ (0,
|
|
1618
|
+
ruby: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1619
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("polygon", { points: "12 2.5 19.5 8 12 21.5 4.5 8" }),
|
|
1620
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M4.5 8h15" }),
|
|
1621
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M12 2.5v19" })
|
|
1513
1622
|
] }),
|
|
1514
|
-
rust: /* @__PURE__ */ (0,
|
|
1515
|
-
/* @__PURE__ */ (0,
|
|
1516
|
-
/* @__PURE__ */ (0,
|
|
1517
|
-
/* @__PURE__ */ (0,
|
|
1518
|
-
/* @__PURE__ */ (0,
|
|
1623
|
+
rust: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1624
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("circle", { cx: "12", cy: "12", r: "7" }),
|
|
1625
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("circle", { cx: "12", cy: "12", r: "2.3" }),
|
|
1626
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M12 2.5v3M12 18.5v3M2.5 12h3M18.5 12h3" }),
|
|
1627
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M5.6 5.6l2.1 2.1M16.3 16.3l2.1 2.1M5.6 18.4l2.1-2.1M16.3 7.7l2.1-2.1" })
|
|
1519
1628
|
] }),
|
|
1520
|
-
sql: /* @__PURE__ */ (0,
|
|
1521
|
-
/* @__PURE__ */ (0,
|
|
1522
|
-
/* @__PURE__ */ (0,
|
|
1523
|
-
/* @__PURE__ */ (0,
|
|
1629
|
+
sql: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1630
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("ellipse", { cx: "12", cy: "6", rx: "8", ry: "3" }),
|
|
1631
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M4 6v6c0 1.7 3.6 3 8 3s8-1.3 8-3V6" }),
|
|
1632
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M4 12v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6" })
|
|
1524
1633
|
] }),
|
|
1525
|
-
swift: /* @__PURE__ */ (0,
|
|
1526
|
-
typescript: /* @__PURE__ */ (0,
|
|
1527
|
-
/* @__PURE__ */ (0,
|
|
1528
|
-
/* @__PURE__ */ (0,
|
|
1529
|
-
/* @__PURE__ */ (0,
|
|
1634
|
+
swift: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(LangIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M19 4.5c-2.6 4-5.5 7-8.3 9 2-.2 3.7-1 4.8-2.6-.7 2.8-2.8 5-5.3 6.1 3 .5 5.6-.5 7.2-2.4.4 2-.4 3.9-1.9 4.9 3.7-1.3 6-4.2 6.6-7.6-1 2.6-2.8 4.6-4.6 5.8" }) }),
|
|
1635
|
+
typescript: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1636
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1637
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M7.3 8.2h5M9.8 8.2v7.6" }),
|
|
1638
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M17 8.8a2 2 0 0 0-2-.8c-1.1 0-2.2.6-2.2 1.7 0 1 .9 1.4 2.2 1.7 1.3.3 2.3.7 2.3 1.9 0 1.1-1 1.8-2.3 1.8a2.4 2.4 0 0 1-2.3-1.4" })
|
|
1530
1639
|
] }),
|
|
1531
|
-
xml: /* @__PURE__ */ (0,
|
|
1532
|
-
/* @__PURE__ */ (0,
|
|
1533
|
-
/* @__PURE__ */ (0,
|
|
1534
|
-
/* @__PURE__ */ (0,
|
|
1640
|
+
xml: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1641
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M8 7l-4.5 5 4.5 5" }),
|
|
1642
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M16 7l4.5 5-4.5 5" }),
|
|
1643
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M12 8v8" })
|
|
1535
1644
|
] }),
|
|
1536
|
-
yaml: /* @__PURE__ */ (0,
|
|
1537
|
-
/* @__PURE__ */ (0,
|
|
1538
|
-
/* @__PURE__ */ (0,
|
|
1539
|
-
/* @__PURE__ */ (0,
|
|
1540
|
-
/* @__PURE__ */ (0,
|
|
1645
|
+
yaml: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1646
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("rect", { x: "2.5", y: "3", width: "19", height: "18", rx: "2" }),
|
|
1647
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M6.5 8h2M9.5 8h8" }),
|
|
1648
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M6.5 12h2M9.5 12h6" }),
|
|
1649
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M6.5 16h2M9.5 16h7" })
|
|
1541
1650
|
] })
|
|
1542
1651
|
};
|
|
1543
1652
|
|
|
1544
1653
|
// src/icons.tsx
|
|
1545
|
-
var
|
|
1654
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1546
1655
|
var ALIGN_PATHS = {
|
|
1547
|
-
center: /* @__PURE__ */ (0,
|
|
1548
|
-
/* @__PURE__ */ (0,
|
|
1549
|
-
/* @__PURE__ */ (0,
|
|
1550
|
-
/* @__PURE__ */ (0,
|
|
1656
|
+
center: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
1657
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
1658
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("line", { x1: "17", y1: "12", x2: "7", y2: "12" }),
|
|
1659
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("line", { x1: "19", y1: "18", x2: "5", y2: "18" })
|
|
1551
1660
|
] }),
|
|
1552
|
-
left: /* @__PURE__ */ (0,
|
|
1553
|
-
/* @__PURE__ */ (0,
|
|
1554
|
-
/* @__PURE__ */ (0,
|
|
1555
|
-
/* @__PURE__ */ (0,
|
|
1661
|
+
left: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
1662
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
1663
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("line", { x1: "15", y1: "12", x2: "3", y2: "12" }),
|
|
1664
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("line", { x1: "17", y1: "18", x2: "3", y2: "18" })
|
|
1556
1665
|
] }),
|
|
1557
|
-
right: /* @__PURE__ */ (0,
|
|
1558
|
-
/* @__PURE__ */ (0,
|
|
1559
|
-
/* @__PURE__ */ (0,
|
|
1560
|
-
/* @__PURE__ */ (0,
|
|
1666
|
+
right: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
1667
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
1668
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("line", { x1: "21", y1: "12", x2: "9", y2: "12" }),
|
|
1669
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("line", { x1: "21", y1: "18", x2: "7", y2: "18" })
|
|
1561
1670
|
] })
|
|
1562
1671
|
};
|
|
1563
|
-
var AlignIcon = ({ dir }) => /* @__PURE__ */ (0,
|
|
1672
|
+
var AlignIcon = ({ dir }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1564
1673
|
"svg",
|
|
1565
1674
|
{
|
|
1566
1675
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1574,7 +1683,7 @@ var AlignIcon = ({ dir }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
|
1574
1683
|
children: ALIGN_PATHS[dir]
|
|
1575
1684
|
}
|
|
1576
1685
|
);
|
|
1577
|
-
var EditUrlIcon = () => /* @__PURE__ */ (0,
|
|
1686
|
+
var EditUrlIcon = () => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
1578
1687
|
"svg",
|
|
1579
1688
|
{
|
|
1580
1689
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1586,12 +1695,12 @@ var EditUrlIcon = () => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
|
1586
1695
|
strokeLinejoin: "round",
|
|
1587
1696
|
className: "rte-editor-icon",
|
|
1588
1697
|
children: [
|
|
1589
|
-
/* @__PURE__ */ (0,
|
|
1590
|
-
/* @__PURE__ */ (0,
|
|
1698
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("path", { d: "M12 20h9" }),
|
|
1699
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("path", { d: "M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z" })
|
|
1591
1700
|
]
|
|
1592
1701
|
}
|
|
1593
1702
|
);
|
|
1594
|
-
var OpenInYouTubeIcon = () => /* @__PURE__ */ (0,
|
|
1703
|
+
var OpenInYouTubeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
1595
1704
|
"svg",
|
|
1596
1705
|
{
|
|
1597
1706
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1603,13 +1712,13 @@ var OpenInYouTubeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
|
1603
1712
|
strokeLinejoin: "round",
|
|
1604
1713
|
className: "rte-editor-icon",
|
|
1605
1714
|
children: [
|
|
1606
|
-
/* @__PURE__ */ (0,
|
|
1607
|
-
/* @__PURE__ */ (0,
|
|
1608
|
-
/* @__PURE__ */ (0,
|
|
1715
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }),
|
|
1716
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("polyline", { points: "15 3 21 3 21 9" }),
|
|
1717
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("line", { x1: "10", y1: "14", x2: "21", y2: "3" })
|
|
1609
1718
|
]
|
|
1610
1719
|
}
|
|
1611
1720
|
);
|
|
1612
|
-
var DeleteEmbedIcon = () => /* @__PURE__ */ (0,
|
|
1721
|
+
var DeleteEmbedIcon = () => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
1613
1722
|
"svg",
|
|
1614
1723
|
{
|
|
1615
1724
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1621,46 +1730,333 @@ var DeleteEmbedIcon = () => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
|
1621
1730
|
strokeLinejoin: "round",
|
|
1622
1731
|
className: "rte-editor-icon",
|
|
1623
1732
|
children: [
|
|
1624
|
-
/* @__PURE__ */ (0,
|
|
1625
|
-
/* @__PURE__ */ (0,
|
|
1733
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("polyline", { points: "3 6 5 6 21 6" }),
|
|
1734
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })
|
|
1626
1735
|
]
|
|
1627
1736
|
}
|
|
1628
1737
|
);
|
|
1629
1738
|
var iconProps = { className: "rte-editor-icon" };
|
|
1630
1739
|
var DEFAULT_ICONS = {
|
|
1631
|
-
alignCenterControlIcon: /* @__PURE__ */ (0,
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1740
|
+
alignCenterControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1741
|
+
IconPlaceholder,
|
|
1742
|
+
{
|
|
1743
|
+
lucide: "AlignCenter",
|
|
1744
|
+
tabler: "IconAlignCenter",
|
|
1745
|
+
hugeicons: "TextAlignCenterIcon",
|
|
1746
|
+
phosphor: "TextAlignCenterIcon",
|
|
1747
|
+
remixicon: "RiAlignCenter",
|
|
1748
|
+
...iconProps
|
|
1749
|
+
}
|
|
1750
|
+
),
|
|
1751
|
+
alignJustifyControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1752
|
+
IconPlaceholder,
|
|
1753
|
+
{
|
|
1754
|
+
lucide: "AlignJustify",
|
|
1755
|
+
tabler: "IconAlignJustified",
|
|
1756
|
+
hugeicons: "TextAlignJustifyCenterIcon",
|
|
1757
|
+
phosphor: "TextAlignJustifyIcon",
|
|
1758
|
+
remixicon: "RiAlignJustify",
|
|
1759
|
+
...iconProps
|
|
1760
|
+
}
|
|
1761
|
+
),
|
|
1762
|
+
alignLeftControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1763
|
+
IconPlaceholder,
|
|
1764
|
+
{
|
|
1765
|
+
lucide: "AlignLeft",
|
|
1766
|
+
tabler: "IconAlignLeft",
|
|
1767
|
+
hugeicons: "TextAlignLeftIcon",
|
|
1768
|
+
phosphor: "TextAlignLeftIcon",
|
|
1769
|
+
remixicon: "RiAlignLeft",
|
|
1770
|
+
...iconProps
|
|
1771
|
+
}
|
|
1772
|
+
),
|
|
1773
|
+
alignRightControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1774
|
+
IconPlaceholder,
|
|
1775
|
+
{
|
|
1776
|
+
lucide: "AlignRight",
|
|
1777
|
+
tabler: "IconAlignRight",
|
|
1778
|
+
hugeicons: "TextAlignRightIcon",
|
|
1779
|
+
phosphor: "TextAlignRightIcon",
|
|
1780
|
+
remixicon: "RiAlignRight",
|
|
1781
|
+
...iconProps
|
|
1782
|
+
}
|
|
1783
|
+
),
|
|
1784
|
+
blockquoteControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1785
|
+
IconPlaceholder,
|
|
1786
|
+
{
|
|
1787
|
+
lucide: "TextQuote",
|
|
1788
|
+
tabler: "IconQuote",
|
|
1789
|
+
hugeicons: "LeftToRightBlockQuoteIcon",
|
|
1790
|
+
phosphor: "QuotesIcon",
|
|
1791
|
+
remixicon: "RiQuoteText",
|
|
1792
|
+
...iconProps
|
|
1793
|
+
}
|
|
1794
|
+
),
|
|
1795
|
+
boldControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1796
|
+
IconPlaceholder,
|
|
1797
|
+
{
|
|
1798
|
+
lucide: "Bold",
|
|
1799
|
+
tabler: "IconBold",
|
|
1800
|
+
hugeicons: "BoldIcon",
|
|
1801
|
+
phosphor: "TextBIcon",
|
|
1802
|
+
remixicon: "RiBold",
|
|
1803
|
+
...iconProps
|
|
1804
|
+
}
|
|
1805
|
+
),
|
|
1806
|
+
bulletListControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1807
|
+
IconPlaceholder,
|
|
1808
|
+
{
|
|
1809
|
+
lucide: "List",
|
|
1810
|
+
tabler: "IconList",
|
|
1811
|
+
hugeicons: "LeftToRightListBulletIcon",
|
|
1812
|
+
phosphor: "ListBulletsIcon",
|
|
1813
|
+
remixicon: "RiListUnordered",
|
|
1814
|
+
...iconProps
|
|
1815
|
+
}
|
|
1816
|
+
),
|
|
1817
|
+
clearFormattingControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1818
|
+
IconPlaceholder,
|
|
1819
|
+
{
|
|
1820
|
+
lucide: "RemoveFormatting",
|
|
1821
|
+
tabler: "IconEraser",
|
|
1822
|
+
hugeicons: "TextClearIcon",
|
|
1823
|
+
phosphor: "EraserIcon",
|
|
1824
|
+
remixicon: "RiFormatClear",
|
|
1825
|
+
...iconProps
|
|
1826
|
+
}
|
|
1827
|
+
),
|
|
1828
|
+
codeBlockControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1829
|
+
IconPlaceholder,
|
|
1830
|
+
{
|
|
1831
|
+
lucide: "SquareCode",
|
|
1832
|
+
tabler: "IconSourceCode",
|
|
1833
|
+
hugeicons: "SourceCodeSquareIcon",
|
|
1834
|
+
phosphor: "CodeBlockIcon",
|
|
1835
|
+
remixicon: "RiCodeBoxLine",
|
|
1836
|
+
...iconProps
|
|
1837
|
+
}
|
|
1838
|
+
),
|
|
1839
|
+
codeControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1840
|
+
IconPlaceholder,
|
|
1841
|
+
{
|
|
1842
|
+
lucide: "Code",
|
|
1843
|
+
tabler: "IconCode",
|
|
1844
|
+
hugeicons: "SourceCodeIcon",
|
|
1845
|
+
phosphor: "CodeIcon",
|
|
1846
|
+
remixicon: "RiCodeLine",
|
|
1847
|
+
...iconProps
|
|
1848
|
+
}
|
|
1849
|
+
),
|
|
1850
|
+
h1ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1851
|
+
IconPlaceholder,
|
|
1852
|
+
{
|
|
1853
|
+
lucide: "Heading1",
|
|
1854
|
+
tabler: "IconH1",
|
|
1855
|
+
hugeicons: "Heading01Icon",
|
|
1856
|
+
phosphor: "TextHOneIcon",
|
|
1857
|
+
remixicon: "RiH1",
|
|
1858
|
+
...iconProps
|
|
1859
|
+
}
|
|
1860
|
+
),
|
|
1861
|
+
h2ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1862
|
+
IconPlaceholder,
|
|
1863
|
+
{
|
|
1864
|
+
lucide: "Heading2",
|
|
1865
|
+
tabler: "IconH2",
|
|
1866
|
+
hugeicons: "Heading02Icon",
|
|
1867
|
+
phosphor: "TextHTwoIcon",
|
|
1868
|
+
remixicon: "RiH2",
|
|
1869
|
+
...iconProps
|
|
1870
|
+
}
|
|
1871
|
+
),
|
|
1872
|
+
h3ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1873
|
+
IconPlaceholder,
|
|
1874
|
+
{
|
|
1875
|
+
lucide: "Heading3",
|
|
1876
|
+
tabler: "IconH3",
|
|
1877
|
+
hugeicons: "Heading03Icon",
|
|
1878
|
+
phosphor: "TextHThreeIcon",
|
|
1879
|
+
remixicon: "RiH3",
|
|
1880
|
+
...iconProps
|
|
1881
|
+
}
|
|
1882
|
+
),
|
|
1883
|
+
h4ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1884
|
+
IconPlaceholder,
|
|
1885
|
+
{
|
|
1886
|
+
lucide: "Heading4",
|
|
1887
|
+
tabler: "IconH4",
|
|
1888
|
+
hugeicons: "Heading04Icon",
|
|
1889
|
+
phosphor: "TextHFourIcon",
|
|
1890
|
+
remixicon: "RiH4",
|
|
1891
|
+
...iconProps
|
|
1892
|
+
}
|
|
1893
|
+
),
|
|
1894
|
+
h5ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1895
|
+
IconPlaceholder,
|
|
1896
|
+
{
|
|
1897
|
+
lucide: "Heading5",
|
|
1898
|
+
tabler: "IconH5",
|
|
1899
|
+
hugeicons: "Heading05Icon",
|
|
1900
|
+
phosphor: "TextHFiveIcon",
|
|
1901
|
+
remixicon: "RiH5",
|
|
1902
|
+
...iconProps
|
|
1903
|
+
}
|
|
1904
|
+
),
|
|
1905
|
+
h6ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1906
|
+
IconPlaceholder,
|
|
1907
|
+
{
|
|
1908
|
+
lucide: "Heading6",
|
|
1909
|
+
tabler: "IconH6",
|
|
1910
|
+
hugeicons: "Heading06Icon",
|
|
1911
|
+
phosphor: "TextHSixIcon",
|
|
1912
|
+
remixicon: "RiH6",
|
|
1913
|
+
...iconProps
|
|
1914
|
+
}
|
|
1915
|
+
),
|
|
1916
|
+
highlightControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1917
|
+
IconPlaceholder,
|
|
1918
|
+
{
|
|
1919
|
+
lucide: "Highlighter",
|
|
1920
|
+
tabler: "IconHighlight",
|
|
1921
|
+
hugeicons: "HighlighterIcon",
|
|
1922
|
+
phosphor: "HighlighterIcon",
|
|
1923
|
+
remixicon: "RiMarkPenLine",
|
|
1924
|
+
...iconProps
|
|
1925
|
+
}
|
|
1926
|
+
),
|
|
1927
|
+
hrControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1928
|
+
IconPlaceholder,
|
|
1929
|
+
{
|
|
1930
|
+
lucide: "Minus",
|
|
1931
|
+
tabler: "IconMinus",
|
|
1932
|
+
hugeicons: "MinusSignIcon",
|
|
1933
|
+
phosphor: "MinusIcon",
|
|
1934
|
+
remixicon: "RiSeparator",
|
|
1935
|
+
...iconProps
|
|
1936
|
+
}
|
|
1937
|
+
),
|
|
1938
|
+
italicControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1939
|
+
IconPlaceholder,
|
|
1940
|
+
{
|
|
1941
|
+
lucide: "Italic",
|
|
1942
|
+
tabler: "IconItalic",
|
|
1943
|
+
hugeicons: "ItalicIcon",
|
|
1944
|
+
phosphor: "TextItalicIcon",
|
|
1945
|
+
remixicon: "RiItalic",
|
|
1946
|
+
...iconProps
|
|
1947
|
+
}
|
|
1948
|
+
),
|
|
1650
1949
|
languageIcons: DEFAULT_LANGUAGE_ICONS,
|
|
1651
|
-
linkControlIcon: /* @__PURE__ */ (0,
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1950
|
+
linkControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1951
|
+
IconPlaceholder,
|
|
1952
|
+
{
|
|
1953
|
+
lucide: "Link",
|
|
1954
|
+
tabler: "IconLink",
|
|
1955
|
+
hugeicons: "Link01Icon",
|
|
1956
|
+
phosphor: "LinkIcon",
|
|
1957
|
+
remixicon: "RiLink",
|
|
1958
|
+
...iconProps
|
|
1959
|
+
}
|
|
1960
|
+
),
|
|
1961
|
+
orderedListControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1962
|
+
IconPlaceholder,
|
|
1963
|
+
{
|
|
1964
|
+
lucide: "ListOrdered",
|
|
1965
|
+
tabler: "IconListNumbers",
|
|
1966
|
+
hugeicons: "LeftToRightListNumberIcon",
|
|
1967
|
+
phosphor: "ListNumbersIcon",
|
|
1968
|
+
remixicon: "RiListOrdered",
|
|
1969
|
+
...iconProps
|
|
1970
|
+
}
|
|
1971
|
+
),
|
|
1972
|
+
redoControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1973
|
+
IconPlaceholder,
|
|
1974
|
+
{
|
|
1975
|
+
lucide: "Redo2",
|
|
1976
|
+
tabler: "IconArrowForwardUp",
|
|
1977
|
+
hugeicons: "RedoIcon",
|
|
1978
|
+
phosphor: "ArrowClockwiseIcon",
|
|
1979
|
+
remixicon: "RiArrowGoForwardLine",
|
|
1980
|
+
...iconProps
|
|
1981
|
+
}
|
|
1982
|
+
),
|
|
1983
|
+
strikeControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1984
|
+
IconPlaceholder,
|
|
1985
|
+
{
|
|
1986
|
+
lucide: "Strikethrough",
|
|
1987
|
+
tabler: "IconStrikethrough",
|
|
1988
|
+
hugeicons: "StrikethroughIcon",
|
|
1989
|
+
phosphor: "TextStrikethroughIcon",
|
|
1990
|
+
remixicon: "RiStrikethrough",
|
|
1991
|
+
...iconProps
|
|
1992
|
+
}
|
|
1993
|
+
),
|
|
1994
|
+
subscriptControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1995
|
+
IconPlaceholder,
|
|
1996
|
+
{
|
|
1997
|
+
lucide: "Subscript",
|
|
1998
|
+
tabler: "IconSubscript",
|
|
1999
|
+
hugeicons: "SubscriptIcon",
|
|
2000
|
+
phosphor: "TextSubscriptIcon",
|
|
2001
|
+
remixicon: "RiSubscript",
|
|
2002
|
+
...iconProps
|
|
2003
|
+
}
|
|
2004
|
+
),
|
|
2005
|
+
superscriptControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2006
|
+
IconPlaceholder,
|
|
2007
|
+
{
|
|
2008
|
+
lucide: "Superscript",
|
|
2009
|
+
tabler: "IconSuperscript",
|
|
2010
|
+
hugeicons: "SuperscriptIcon",
|
|
2011
|
+
phosphor: "TextSuperscriptIcon",
|
|
2012
|
+
remixicon: "RiSuperscript",
|
|
2013
|
+
...iconProps
|
|
2014
|
+
}
|
|
2015
|
+
),
|
|
2016
|
+
underlineControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2017
|
+
IconPlaceholder,
|
|
2018
|
+
{
|
|
2019
|
+
lucide: "Underline",
|
|
2020
|
+
tabler: "IconUnderline",
|
|
2021
|
+
hugeicons: "UnderlineIcon",
|
|
2022
|
+
phosphor: "TextUnderlineIcon",
|
|
2023
|
+
remixicon: "RiUnderline",
|
|
2024
|
+
...iconProps
|
|
2025
|
+
}
|
|
2026
|
+
),
|
|
2027
|
+
undoControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2028
|
+
IconPlaceholder,
|
|
2029
|
+
{
|
|
2030
|
+
lucide: "Undo2",
|
|
2031
|
+
tabler: "IconArrowBackUp",
|
|
2032
|
+
hugeicons: "UndoIcon",
|
|
2033
|
+
phosphor: "ArrowCounterClockwiseIcon",
|
|
2034
|
+
remixicon: "RiArrowGoBackLine",
|
|
2035
|
+
...iconProps
|
|
2036
|
+
}
|
|
2037
|
+
),
|
|
2038
|
+
unlinkControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2039
|
+
IconPlaceholder,
|
|
2040
|
+
{
|
|
2041
|
+
lucide: "Link2Off",
|
|
2042
|
+
tabler: "IconUnlink",
|
|
2043
|
+
hugeicons: "UnlinkIcon",
|
|
2044
|
+
phosphor: "LinkBreakIcon",
|
|
2045
|
+
remixicon: "RiLinkUnlink",
|
|
2046
|
+
...iconProps
|
|
2047
|
+
}
|
|
2048
|
+
)
|
|
1660
2049
|
};
|
|
1661
2050
|
|
|
1662
2051
|
// src/extensions/resizable-node-view.tsx
|
|
1663
|
-
var
|
|
2052
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2053
|
+
var SELECTOR_BUTTON = "rte-embed-selector-btn inline-flex h-8 min-w-8 cursor-pointer items-center justify-center rounded-sm border-none bg-transparent px-2 text-[0.75rem] font-medium text-popover-foreground [transition:background-color_150ms_ease-out,color_150ms_ease-out,scale_100ms_ease-out] hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-ring/50 focus-visible:-outline-offset-2 active:scale-96";
|
|
2054
|
+
var SELECTOR_GROUP = "rte-embed-selector-group flex items-center gap-0.5";
|
|
2055
|
+
var SELECTOR_DIVIDER = "rte-embed-selector-divider mx-0.5 h-4 w-px shrink-0 bg-border";
|
|
2056
|
+
var HANDLE = "rte-resize-handle absolute z-10 opacity-0 group-data-selected/embed:opacity-100";
|
|
2057
|
+
var EDGE_HANDLE = `${HANDLE} bg-transparent [transition:opacity_150ms_ease-out,background-color_150ms_ease-out] after:absolute after:rounded-[1px] after:bg-primary after:content-['']`;
|
|
2058
|
+
var SIDE_HANDLE = `${EDGE_HANDLE} inset-y-0 w-1.5 cursor-ew-resize after:inset-x-px after:inset-y-1 after:w-0.5 after:[transition:width_150ms_ease-out,inset_150ms_ease-out] hover:after:inset-x-0 hover:after:w-1`;
|
|
2059
|
+
var CORNER_HANDLE = `${HANDLE} rte-resize-handle--corner size-3 rounded-[3px] border-2 border-background bg-primary [transition:transform_150ms_ease-out] hover:[transform:scale(1.1)]`;
|
|
1664
2060
|
var EmbedToolbar = ({
|
|
1665
2061
|
align,
|
|
1666
2062
|
videoSrc,
|
|
@@ -1677,8 +2073,8 @@ var EmbedToolbar = ({
|
|
|
1677
2073
|
nodeSrc
|
|
1678
2074
|
}) => {
|
|
1679
2075
|
if (isEditingUrl) {
|
|
1680
|
-
return /* @__PURE__ */ (0,
|
|
1681
|
-
/* @__PURE__ */ (0,
|
|
2076
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "rte-embed-selector-edit-form flex items-center gap-1.5", children: [
|
|
2077
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1682
2078
|
"input",
|
|
1683
2079
|
{
|
|
1684
2080
|
ref: inputRef,
|
|
@@ -1686,7 +2082,7 @@ var EmbedToolbar = ({
|
|
|
1686
2082
|
value: urlInput,
|
|
1687
2083
|
onChange: (e) => setUrlInput(e.target.value),
|
|
1688
2084
|
placeholder: "Paste YouTube URL or video ID...",
|
|
1689
|
-
className: "rte-embed-selector-input",
|
|
2085
|
+
className: "rte-embed-selector-input h-8 w-[220px] rounded-md border border-[color:var(--input,var(--border))] bg-background px-2.5 text-[0.8125rem] text-foreground outline-none [transition:border-color_150ms_ease-out,box-shadow_150ms_ease-out] focus:border-ring focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_50%,transparent)]",
|
|
1690
2086
|
onKeyDown: (e) => {
|
|
1691
2087
|
if (e.key === "Enter") {
|
|
1692
2088
|
handleSaveUrl();
|
|
@@ -1696,46 +2092,55 @@ var EmbedToolbar = ({
|
|
|
1696
2092
|
}
|
|
1697
2093
|
}
|
|
1698
2094
|
),
|
|
1699
|
-
/* @__PURE__ */ (0,
|
|
2095
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1700
2096
|
"button",
|
|
1701
2097
|
{
|
|
1702
2098
|
type: "button",
|
|
1703
2099
|
onClick: handleSaveUrl,
|
|
1704
|
-
className:
|
|
2100
|
+
className: cn(
|
|
2101
|
+
SELECTOR_BUTTON,
|
|
2102
|
+
"rte-embed-selector-btn--save bg-primary px-2 text-primary-foreground hover:bg-primary/85 hover:text-primary-foreground"
|
|
2103
|
+
),
|
|
1705
2104
|
children: "Save"
|
|
1706
2105
|
}
|
|
1707
2106
|
),
|
|
1708
|
-
/* @__PURE__ */ (0,
|
|
2107
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1709
2108
|
"button",
|
|
1710
2109
|
{
|
|
1711
2110
|
type: "button",
|
|
1712
2111
|
onClick: () => setIsEditingUrl(false),
|
|
1713
|
-
className:
|
|
2112
|
+
className: SELECTOR_BUTTON,
|
|
1714
2113
|
children: "Cancel"
|
|
1715
2114
|
}
|
|
1716
2115
|
)
|
|
1717
2116
|
] });
|
|
1718
2117
|
}
|
|
1719
|
-
return /* @__PURE__ */ (0,
|
|
1720
|
-
/* @__PURE__ */ (0,
|
|
2118
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
2119
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: SELECTOR_GROUP, children: ["left", "center", "right"].map((dir) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1721
2120
|
"button",
|
|
1722
2121
|
{
|
|
1723
2122
|
type: "button",
|
|
1724
2123
|
title: `Align ${dir.charAt(0).toUpperCase()}${dir.slice(1)}`,
|
|
1725
2124
|
"aria-label": `Align ${dir.charAt(0).toUpperCase()}${dir.slice(1)}`,
|
|
1726
|
-
className:
|
|
2125
|
+
className: cn(
|
|
2126
|
+
SELECTOR_BUTTON,
|
|
2127
|
+
align === dir && "rte-embed-selector-btn--active bg-muted text-foreground"
|
|
2128
|
+
),
|
|
1727
2129
|
onClick: () => updateAttributes({ align: dir }),
|
|
1728
|
-
children: /* @__PURE__ */ (0,
|
|
2130
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AlignIcon, { dir })
|
|
1729
2131
|
},
|
|
1730
2132
|
dir
|
|
1731
2133
|
)) }),
|
|
1732
|
-
/* @__PURE__ */ (0,
|
|
1733
|
-
/* @__PURE__ */ (0,
|
|
2134
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: SELECTOR_DIVIDER }),
|
|
2135
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: SELECTOR_GROUP, children: [25, 50, 75, 100].map((pct) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1734
2136
|
"button",
|
|
1735
2137
|
{
|
|
1736
2138
|
type: "button",
|
|
1737
2139
|
title: `${pct}%`,
|
|
1738
|
-
className:
|
|
2140
|
+
className: cn(
|
|
2141
|
+
SELECTOR_BUTTON,
|
|
2142
|
+
"rte-embed-selector-btn--preset text-[0.75rem] font-medium tabular-nums"
|
|
2143
|
+
),
|
|
1739
2144
|
onClick: () => handleApplyPreset(pct),
|
|
1740
2145
|
children: [
|
|
1741
2146
|
pct,
|
|
@@ -1744,42 +2149,45 @@ var EmbedToolbar = ({
|
|
|
1744
2149
|
},
|
|
1745
2150
|
pct
|
|
1746
2151
|
)) }),
|
|
1747
|
-
/* @__PURE__ */ (0,
|
|
1748
|
-
/* @__PURE__ */ (0,
|
|
1749
|
-
(videoSrc || nodeSrc) && /* @__PURE__ */ (0,
|
|
2152
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: SELECTOR_DIVIDER }),
|
|
2153
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: SELECTOR_GROUP, children: [
|
|
2154
|
+
(videoSrc || nodeSrc) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1750
2155
|
"button",
|
|
1751
2156
|
{
|
|
1752
2157
|
type: "button",
|
|
1753
2158
|
title: "Edit URL",
|
|
1754
2159
|
"aria-label": "Edit URL",
|
|
1755
|
-
className:
|
|
2160
|
+
className: SELECTOR_BUTTON,
|
|
1756
2161
|
onClick: () => {
|
|
1757
2162
|
setUrlInput(videoSrc || nodeSrc || "");
|
|
1758
2163
|
setIsEditingUrl(true);
|
|
1759
2164
|
},
|
|
1760
|
-
children: /* @__PURE__ */ (0,
|
|
2165
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(EditUrlIcon, {})
|
|
1761
2166
|
}
|
|
1762
2167
|
),
|
|
1763
|
-
watchUrl && /* @__PURE__ */ (0,
|
|
2168
|
+
watchUrl && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1764
2169
|
"button",
|
|
1765
2170
|
{
|
|
1766
2171
|
type: "button",
|
|
1767
2172
|
title: "Open video in YouTube",
|
|
1768
2173
|
"aria-label": "Open video in YouTube",
|
|
1769
|
-
className:
|
|
2174
|
+
className: SELECTOR_BUTTON,
|
|
1770
2175
|
onClick: () => window.open(watchUrl, "_blank"),
|
|
1771
|
-
children: /* @__PURE__ */ (0,
|
|
2176
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(OpenInYouTubeIcon, {})
|
|
1772
2177
|
}
|
|
1773
2178
|
),
|
|
1774
|
-
deleteNode && /* @__PURE__ */ (0,
|
|
2179
|
+
deleteNode && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1775
2180
|
"button",
|
|
1776
2181
|
{
|
|
1777
2182
|
type: "button",
|
|
1778
2183
|
title: "Delete Embed",
|
|
1779
2184
|
"aria-label": "Delete Embed",
|
|
1780
|
-
className:
|
|
2185
|
+
className: cn(
|
|
2186
|
+
SELECTOR_BUTTON,
|
|
2187
|
+
"rte-embed-selector-btn--danger hover:bg-destructive/15 hover:text-destructive"
|
|
2188
|
+
),
|
|
1781
2189
|
onClick: () => deleteNode(),
|
|
1782
|
-
children: /* @__PURE__ */ (0,
|
|
2190
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DeleteEmbedIcon, {})
|
|
1783
2191
|
}
|
|
1784
2192
|
)
|
|
1785
2193
|
] })
|
|
@@ -1801,26 +2209,26 @@ var ResizableNodeView = ({
|
|
|
1801
2209
|
watchUrl,
|
|
1802
2210
|
onSrcChange
|
|
1803
2211
|
}) => {
|
|
1804
|
-
const containerRef = (0,
|
|
1805
|
-
const [isEditingUrl, setIsEditingUrl] = (0,
|
|
1806
|
-
const [urlInput, setUrlInput] = (0,
|
|
1807
|
-
const [isResizing, setIsResizing] = (0,
|
|
1808
|
-
const [currentDimensions, setCurrentDimensions] = (0,
|
|
1809
|
-
const resizingRef = (0,
|
|
2212
|
+
const containerRef = (0, import_react14.useRef)(null);
|
|
2213
|
+
const [isEditingUrl, setIsEditingUrl] = (0, import_react14.useState)(false);
|
|
2214
|
+
const [urlInput, setUrlInput] = (0, import_react14.useState)(videoSrc || "");
|
|
2215
|
+
const [isResizing, setIsResizing] = (0, import_react14.useState)(false);
|
|
2216
|
+
const [currentDimensions, setCurrentDimensions] = (0, import_react14.useState)(null);
|
|
2217
|
+
const resizingRef = (0, import_react14.useRef)(null);
|
|
1810
2218
|
const width = node.attrs.width;
|
|
1811
2219
|
const height = node.attrs.height;
|
|
1812
2220
|
const align = node.attrs.align || "center";
|
|
1813
|
-
const getEditorWidth = (0,
|
|
2221
|
+
const getEditorWidth = (0, import_react14.useCallback)(
|
|
1814
2222
|
() => view?.dom?.parentElement?.offsetWidth ?? 800,
|
|
1815
2223
|
[view]
|
|
1816
2224
|
);
|
|
1817
|
-
const inputRef = (0,
|
|
1818
|
-
(0,
|
|
2225
|
+
const inputRef = (0, import_react14.useRef)(null);
|
|
2226
|
+
(0, import_react14.useEffect)(() => {
|
|
1819
2227
|
if (isEditingUrl) {
|
|
1820
2228
|
inputRef.current?.focus();
|
|
1821
2229
|
}
|
|
1822
2230
|
}, [isEditingUrl]);
|
|
1823
|
-
const handleMouseMove = (0,
|
|
2231
|
+
const handleMouseMove = (0, import_react14.useCallback)(
|
|
1824
2232
|
(e) => {
|
|
1825
2233
|
const resize = resizingRef.current;
|
|
1826
2234
|
if (!resize) {
|
|
@@ -1870,7 +2278,7 @@ var ResizableNodeView = ({
|
|
|
1870
2278
|
},
|
|
1871
2279
|
[lockAspect, aspectRatio, minWidth, maxWidth]
|
|
1872
2280
|
);
|
|
1873
|
-
const handleMouseUp = (0,
|
|
2281
|
+
const handleMouseUp = (0, import_react14.useCallback)(
|
|
1874
2282
|
function handleMouseUp2() {
|
|
1875
2283
|
const resize = resizingRef.current;
|
|
1876
2284
|
if (!resize) {
|
|
@@ -1891,7 +2299,7 @@ var ResizableNodeView = ({
|
|
|
1891
2299
|
},
|
|
1892
2300
|
[handleMouseMove, updateAttributes]
|
|
1893
2301
|
);
|
|
1894
|
-
const handleMouseDown = (0,
|
|
2302
|
+
const handleMouseDown = (0, import_react14.useCallback)(
|
|
1895
2303
|
(e, direction) => {
|
|
1896
2304
|
e.preventDefault();
|
|
1897
2305
|
e.stopPropagation();
|
|
@@ -1922,7 +2330,7 @@ var ResizableNodeView = ({
|
|
|
1922
2330
|
},
|
|
1923
2331
|
[width, height, getEditorWidth, handleMouseMove, handleMouseUp]
|
|
1924
2332
|
);
|
|
1925
|
-
(0,
|
|
2333
|
+
(0, import_react14.useEffect)(
|
|
1926
2334
|
() => () => {
|
|
1927
2335
|
document.removeEventListener("mousemove", handleMouseMove);
|
|
1928
2336
|
document.removeEventListener("mouseup", handleMouseUp);
|
|
@@ -1950,13 +2358,13 @@ var ResizableNodeView = ({
|
|
|
1950
2358
|
setIsEditingUrl(false);
|
|
1951
2359
|
};
|
|
1952
2360
|
const isEditable = editor ? editor.isEditable : true;
|
|
1953
|
-
return /* @__PURE__ */ (0,
|
|
1954
|
-
|
|
2361
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2362
|
+
import_react13.NodeViewWrapper,
|
|
1955
2363
|
{
|
|
1956
|
-
className: "rte-embed-wrapper",
|
|
2364
|
+
className: "rte-embed-wrapper group/embed",
|
|
1957
2365
|
"data-selected": selected || void 0,
|
|
1958
2366
|
"data-align": align,
|
|
1959
|
-
children: /* @__PURE__ */ (0,
|
|
2367
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1960
2368
|
"div",
|
|
1961
2369
|
{
|
|
1962
2370
|
ref: containerRef,
|
|
@@ -1969,67 +2377,74 @@ var ResizableNodeView = ({
|
|
|
1969
2377
|
},
|
|
1970
2378
|
children: [
|
|
1971
2379
|
children,
|
|
1972
|
-
selected && isEditable && /* @__PURE__ */ (0,
|
|
1973
|
-
|
|
2380
|
+
selected && isEditable && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2381
|
+
"div",
|
|
1974
2382
|
{
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
2383
|
+
className: "rte-embed-selector pointer-events-auto absolute top-[-46px] left-1/2 z-50 flex h-10 animate-rte-bubble-pop-in items-center gap-1 rounded-lg border border-[color-mix(in_srgb,var(--border)_60%,transparent)] bg-popover px-1 whitespace-nowrap shadow-[0_8px_30px_-12px_rgb(0_0_0/0.15)] [transform:translateX(-50%)]",
|
|
2384
|
+
contentEditable: false,
|
|
2385
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2386
|
+
EmbedToolbar,
|
|
2387
|
+
{
|
|
2388
|
+
align,
|
|
2389
|
+
videoSrc,
|
|
2390
|
+
watchUrl,
|
|
2391
|
+
deleteNode,
|
|
2392
|
+
inputRef,
|
|
2393
|
+
isEditingUrl,
|
|
2394
|
+
urlInput,
|
|
2395
|
+
setUrlInput,
|
|
2396
|
+
setIsEditingUrl,
|
|
2397
|
+
handleSaveUrl,
|
|
2398
|
+
handleApplyPreset,
|
|
2399
|
+
updateAttributes,
|
|
2400
|
+
nodeSrc: node.attrs.src
|
|
2401
|
+
}
|
|
2402
|
+
)
|
|
1988
2403
|
}
|
|
1989
|
-
)
|
|
1990
|
-
isResizing && currentDimensions && /* @__PURE__ */ (0,
|
|
2404
|
+
),
|
|
2405
|
+
isResizing && currentDimensions && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "rte-embed-resize-badge pointer-events-none absolute right-2 bottom-2 z-40 rounded-sm bg-foreground/85 px-1.5 py-0.5 font-[family-name:var(--font-mono,monospace)] text-[0.75rem] font-medium text-background tabular-nums backdrop-blur-xs", children: [
|
|
1991
2406
|
currentDimensions.w,
|
|
1992
2407
|
" \xD7 ",
|
|
1993
2408
|
currentDimensions.h,
|
|
1994
2409
|
" px"
|
|
1995
2410
|
] }),
|
|
1996
|
-
selected && isEditable && /* @__PURE__ */ (0,
|
|
1997
|
-
/* @__PURE__ */ (0,
|
|
2411
|
+
selected && isEditable && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
2412
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1998
2413
|
"div",
|
|
1999
2414
|
{
|
|
2000
|
-
className:
|
|
2415
|
+
className: `${SIDE_HANDLE} rte-resize-handle--left -left-[3px]`,
|
|
2001
2416
|
onMouseDown: (e) => handleMouseDown(e, "left"),
|
|
2002
2417
|
role: "presentation"
|
|
2003
2418
|
}
|
|
2004
2419
|
),
|
|
2005
|
-
/* @__PURE__ */ (0,
|
|
2420
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2006
2421
|
"div",
|
|
2007
2422
|
{
|
|
2008
|
-
className:
|
|
2423
|
+
className: `${SIDE_HANDLE} rte-resize-handle--right -right-[3px]`,
|
|
2009
2424
|
onMouseDown: (e) => handleMouseDown(e, "right"),
|
|
2010
2425
|
role: "presentation"
|
|
2011
2426
|
}
|
|
2012
2427
|
),
|
|
2013
|
-
/* @__PURE__ */ (0,
|
|
2428
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2014
2429
|
"div",
|
|
2015
2430
|
{
|
|
2016
|
-
className:
|
|
2431
|
+
className: `${EDGE_HANDLE} rte-resize-handle--bottom inset-x-0 -bottom-[3px] h-1.5 cursor-ns-resize after:inset-x-1 after:bottom-px after:h-0.5 after:[transition:height_150ms_ease-out,bottom_150ms_ease-out] hover:after:bottom-0 hover:after:h-1`,
|
|
2017
2432
|
onMouseDown: (e) => handleMouseDown(e, "bottom"),
|
|
2018
2433
|
role: "presentation"
|
|
2019
2434
|
}
|
|
2020
2435
|
),
|
|
2021
|
-
/* @__PURE__ */ (0,
|
|
2436
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2022
2437
|
"div",
|
|
2023
2438
|
{
|
|
2024
|
-
className:
|
|
2439
|
+
className: `${CORNER_HANDLE} rte-resize-handle--corner-bl -bottom-[5px] -left-[5px] cursor-nesw-resize`,
|
|
2025
2440
|
onMouseDown: (e) => handleMouseDown(e, "corner-bl"),
|
|
2026
2441
|
role: "presentation"
|
|
2027
2442
|
}
|
|
2028
2443
|
),
|
|
2029
|
-
/* @__PURE__ */ (0,
|
|
2444
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2030
2445
|
"div",
|
|
2031
2446
|
{
|
|
2032
|
-
className:
|
|
2447
|
+
className: `${CORNER_HANDLE} rte-resize-handle--corner-br -right-[5px] -bottom-[5px] cursor-nwse-resize`,
|
|
2033
2448
|
onMouseDown: (e) => handleMouseDown(e, "corner-br"),
|
|
2034
2449
|
role: "presentation"
|
|
2035
2450
|
}
|
|
@@ -2043,7 +2458,7 @@ var ResizableNodeView = ({
|
|
|
2043
2458
|
};
|
|
2044
2459
|
|
|
2045
2460
|
// src/controls/rte-twitter-control.tsx
|
|
2046
|
-
var
|
|
2461
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2047
2462
|
var WIDGET_SCRIPT_URL = "https://platform.twitter.com/widgets.js";
|
|
2048
2463
|
var SCRIPT_LOAD_TIMEOUT_MS = 8e3;
|
|
2049
2464
|
var READY_POLL_INTERVAL_MS = 50;
|
|
@@ -2119,15 +2534,15 @@ var loadTwitterScript = () => {
|
|
|
2119
2534
|
};
|
|
2120
2535
|
var TwitterNodeView = (props) => {
|
|
2121
2536
|
const { node } = props;
|
|
2122
|
-
const containerRef = (0,
|
|
2123
|
-
const [loading, setLoading] = (0,
|
|
2124
|
-
const [failed, setFailed] = (0,
|
|
2537
|
+
const containerRef = (0, import_react16.useRef)(null);
|
|
2538
|
+
const [loading, setLoading] = (0, import_react16.useState)(true);
|
|
2539
|
+
const [failed, setFailed] = (0, import_react16.useState)(false);
|
|
2125
2540
|
const { tweetId } = node.attrs;
|
|
2126
|
-
const renderedTweetIdRef = (0,
|
|
2127
|
-
const activeRenderIdRef = (0,
|
|
2128
|
-
const retryToken = (0,
|
|
2129
|
-
const [retryCount, setRetryCount] = (0,
|
|
2130
|
-
(0,
|
|
2541
|
+
const renderedTweetIdRef = (0, import_react16.useRef)(null);
|
|
2542
|
+
const activeRenderIdRef = (0, import_react16.useRef)(0);
|
|
2543
|
+
const retryToken = (0, import_react16.useRef)(0);
|
|
2544
|
+
const [retryCount, setRetryCount] = (0, import_react16.useState)(0);
|
|
2545
|
+
(0, import_react16.useEffect)(() => {
|
|
2131
2546
|
if (!containerRef.current || !tweetId) {
|
|
2132
2547
|
return;
|
|
2133
2548
|
}
|
|
@@ -2186,11 +2601,11 @@ var TwitterNodeView = (props) => {
|
|
|
2186
2601
|
isCancelled = true;
|
|
2187
2602
|
};
|
|
2188
2603
|
}, [tweetId, retryCount, failed]);
|
|
2189
|
-
const handleRetry = (0,
|
|
2604
|
+
const handleRetry = (0, import_react16.useCallback)(() => {
|
|
2190
2605
|
retryToken.current += 1;
|
|
2191
2606
|
setRetryCount(retryToken.current);
|
|
2192
2607
|
}, []);
|
|
2193
|
-
return /* @__PURE__ */ (0,
|
|
2608
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
2194
2609
|
ResizableNodeView,
|
|
2195
2610
|
{
|
|
2196
2611
|
...props,
|
|
@@ -2198,12 +2613,12 @@ var TwitterNodeView = (props) => {
|
|
|
2198
2613
|
minWidth: 300,
|
|
2199
2614
|
maxWidth: 1200,
|
|
2200
2615
|
children: [
|
|
2201
|
-
loading && /* @__PURE__ */ (0,
|
|
2202
|
-
!loading && failed && /* @__PURE__ */ (0,
|
|
2203
|
-
/* @__PURE__ */ (0,
|
|
2204
|
-
/* @__PURE__ */ (0,
|
|
2616
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "rte-embed-loading animate-pulse", children: "Loading tweet..." }),
|
|
2617
|
+
!loading && failed && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "rte-embed-error", children: [
|
|
2618
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { children: "Couldn't load this tweet." }),
|
|
2619
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", onClick: handleRetry, children: "Retry" })
|
|
2205
2620
|
] }),
|
|
2206
|
-
/* @__PURE__ */ (0,
|
|
2621
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { ref: containerRef })
|
|
2207
2622
|
]
|
|
2208
2623
|
}
|
|
2209
2624
|
);
|
|
@@ -2273,7 +2688,7 @@ var TwitterEmbed = import_core2.Node.create({
|
|
|
2273
2688
|
];
|
|
2274
2689
|
},
|
|
2275
2690
|
addNodeView() {
|
|
2276
|
-
return (0,
|
|
2691
|
+
return (0, import_react15.ReactNodeViewRenderer)(TwitterNodeView);
|
|
2277
2692
|
},
|
|
2278
2693
|
atom: true,
|
|
2279
2694
|
draggable: true,
|
|
@@ -2307,10 +2722,10 @@ var extractTweetId = (input) => {
|
|
|
2307
2722
|
};
|
|
2308
2723
|
var TwitterEmbedControl = ({ className }) => {
|
|
2309
2724
|
const { editor } = useRichTextEditorContext();
|
|
2310
|
-
const [open, setOpen] = (0,
|
|
2311
|
-
const [url, setUrl] = (0,
|
|
2312
|
-
const [touched, setTouched] = (0,
|
|
2313
|
-
const { active } = (0,
|
|
2725
|
+
const [open, setOpen] = (0, import_react16.useState)(false);
|
|
2726
|
+
const [url, setUrl] = (0, import_react16.useState)("");
|
|
2727
|
+
const [touched, setTouched] = (0, import_react16.useState)(false);
|
|
2728
|
+
const { active } = (0, import_react15.useEditorState)({
|
|
2314
2729
|
editor: editor ?? null,
|
|
2315
2730
|
selector: (ctx) => ({
|
|
2316
2731
|
active: ctx.editor && !ctx.editor.isDestroyed ? ctx.editor.isActive("twitter") : false
|
|
@@ -2318,11 +2733,11 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2318
2733
|
}) ?? { active: false };
|
|
2319
2734
|
const tweetId = url ? extractTweetId(url) : null;
|
|
2320
2735
|
const showError = touched && url.length > 0 && !tweetId;
|
|
2321
|
-
const resetState = (0,
|
|
2736
|
+
const resetState = (0, import_react16.useCallback)(() => {
|
|
2322
2737
|
setUrl("");
|
|
2323
2738
|
setTouched(false);
|
|
2324
2739
|
}, []);
|
|
2325
|
-
const handleInsert = (0,
|
|
2740
|
+
const handleInsert = (0, import_react16.useCallback)(() => {
|
|
2326
2741
|
setTouched(true);
|
|
2327
2742
|
if (!tweetId || !editor) {
|
|
2328
2743
|
return false;
|
|
@@ -2331,7 +2746,7 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2331
2746
|
resetState();
|
|
2332
2747
|
return true;
|
|
2333
2748
|
}, [tweetId, editor, resetState]);
|
|
2334
|
-
return /* @__PURE__ */ (0,
|
|
2749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
2335
2750
|
Dialog,
|
|
2336
2751
|
{
|
|
2337
2752
|
open,
|
|
@@ -2342,36 +2757,36 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2342
2757
|
}
|
|
2343
2758
|
},
|
|
2344
2759
|
children: [
|
|
2345
|
-
/* @__PURE__ */ (0,
|
|
2760
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2346
2761
|
DialogTrigger,
|
|
2347
2762
|
{
|
|
2348
|
-
render: /* @__PURE__ */ (0,
|
|
2763
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2349
2764
|
RichTextEditorControl,
|
|
2350
2765
|
{
|
|
2351
2766
|
active,
|
|
2352
2767
|
className,
|
|
2353
2768
|
title: "Embed Tweet",
|
|
2354
2769
|
"aria-label": "Embed Tweet",
|
|
2355
|
-
children: /* @__PURE__ */ (0,
|
|
2770
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2356
2771
|
"svg",
|
|
2357
2772
|
{
|
|
2358
2773
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2359
2774
|
viewBox: "0 0 24 24",
|
|
2360
2775
|
fill: "currentColor",
|
|
2361
2776
|
className: "rte-editor-icon",
|
|
2362
|
-
children: /* @__PURE__ */ (0,
|
|
2777
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("path", { d: "M18.2 3.2h3.3l-7.2 8.2 8.5 11.2h-6.6l-5.2-6.8-6 6.8H2.7l7.7-8.8L2.3 3.2h6.8l4.7 6.2 5.4-6.2zm-1.2 17.3h1.8L7 4.8H5.1l11.9 15.7z" })
|
|
2363
2778
|
}
|
|
2364
2779
|
)
|
|
2365
2780
|
}
|
|
2366
2781
|
)
|
|
2367
2782
|
}
|
|
2368
2783
|
),
|
|
2369
|
-
/* @__PURE__ */ (0,
|
|
2370
|
-
/* @__PURE__ */ (0,
|
|
2371
|
-
/* @__PURE__ */ (0,
|
|
2372
|
-
/* @__PURE__ */ (0,
|
|
2784
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(DialogContent, { children: [
|
|
2785
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(DialogHeader, { children: [
|
|
2786
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DialogTitle, { children: "Embed Tweet" }),
|
|
2787
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DialogDescription, { children: "Paste a tweet URL or ID." })
|
|
2373
2788
|
] }),
|
|
2374
|
-
/* @__PURE__ */ (0,
|
|
2789
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2375
2790
|
Input,
|
|
2376
2791
|
{
|
|
2377
2792
|
value: url,
|
|
@@ -2391,10 +2806,10 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2391
2806
|
}
|
|
2392
2807
|
}
|
|
2393
2808
|
),
|
|
2394
|
-
showError && /* @__PURE__ */ (0,
|
|
2395
|
-
/* @__PURE__ */ (0,
|
|
2396
|
-
/* @__PURE__ */ (0,
|
|
2397
|
-
/* @__PURE__ */ (0,
|
|
2809
|
+
showError && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "rte-input-error", role: "alert", children: "That doesn't look like a valid tweet URL or ID." }),
|
|
2810
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(DialogFooter, { children: [
|
|
2811
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DialogClose, { children: "Cancel" }),
|
|
2812
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2398
2813
|
"button",
|
|
2399
2814
|
{
|
|
2400
2815
|
type: "button",
|
|
@@ -2417,9 +2832,9 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2417
2832
|
|
|
2418
2833
|
// src/controls/rte-youtube-control.tsx
|
|
2419
2834
|
var import_core3 = require("@tiptap/core");
|
|
2420
|
-
var
|
|
2421
|
-
var
|
|
2422
|
-
var
|
|
2835
|
+
var import_react17 = require("@tiptap/react");
|
|
2836
|
+
var import_react18 = require("react");
|
|
2837
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2423
2838
|
var getYouTubeId = (url) => {
|
|
2424
2839
|
const clean = url.trim();
|
|
2425
2840
|
const patterns = [
|
|
@@ -2447,7 +2862,7 @@ var YouTubeNodeView = (props) => {
|
|
|
2447
2862
|
if (videoId) {
|
|
2448
2863
|
watchUrl = videoId.startsWith("http") ? videoId : `https://www.youtube.com/watch?v=${videoId}`;
|
|
2449
2864
|
}
|
|
2450
|
-
return /* @__PURE__ */ (0,
|
|
2865
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2451
2866
|
ResizableNodeView,
|
|
2452
2867
|
{
|
|
2453
2868
|
...props,
|
|
@@ -2458,7 +2873,7 @@ var YouTubeNodeView = (props) => {
|
|
|
2458
2873
|
videoSrc: rawSrc,
|
|
2459
2874
|
watchUrl,
|
|
2460
2875
|
onSrcChange: (newSrc) => updateAttributes({ src: newSrc }),
|
|
2461
|
-
children: /* @__PURE__ */ (0,
|
|
2876
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2462
2877
|
"iframe",
|
|
2463
2878
|
{
|
|
2464
2879
|
src: `https://www.youtube-nocookie.com/embed/${videoId}`,
|
|
@@ -2536,7 +2951,7 @@ var YouTubeEmbed = import_core3.Node.create({
|
|
|
2536
2951
|
];
|
|
2537
2952
|
},
|
|
2538
2953
|
addNodeView() {
|
|
2539
|
-
return (0,
|
|
2954
|
+
return (0, import_react17.ReactNodeViewRenderer)(YouTubeNodeView);
|
|
2540
2955
|
},
|
|
2541
2956
|
atom: true,
|
|
2542
2957
|
draggable: true,
|
|
@@ -2560,32 +2975,32 @@ var YouTubeEmbed = import_core3.Node.create({
|
|
|
2560
2975
|
});
|
|
2561
2976
|
var YouTubeEmbedControl = ({ className }) => {
|
|
2562
2977
|
const { editor } = useRichTextEditorContext();
|
|
2563
|
-
const [open, setOpen] = (0,
|
|
2564
|
-
const [url, setUrl] = (0,
|
|
2565
|
-
const { active } = (0,
|
|
2978
|
+
const [open, setOpen] = (0, import_react18.useState)(false);
|
|
2979
|
+
const [url, setUrl] = (0, import_react18.useState)("");
|
|
2980
|
+
const { active } = (0, import_react17.useEditorState)({
|
|
2566
2981
|
editor: editor ?? null,
|
|
2567
2982
|
selector: (ctx) => ({
|
|
2568
2983
|
active: ctx.editor && !ctx.editor.isDestroyed ? ctx.editor.isActive("youtube") : false
|
|
2569
2984
|
})
|
|
2570
2985
|
}) ?? { active: false };
|
|
2571
|
-
const handleInsert = (0,
|
|
2986
|
+
const handleInsert = (0, import_react18.useCallback)(() => {
|
|
2572
2987
|
if (url && editor) {
|
|
2573
2988
|
editor.chain().focus().setYouTubeEmbed(url).run();
|
|
2574
2989
|
setUrl("");
|
|
2575
2990
|
}
|
|
2576
2991
|
}, [url, editor]);
|
|
2577
|
-
return /* @__PURE__ */ (0,
|
|
2578
|
-
/* @__PURE__ */ (0,
|
|
2992
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Dialog, { open, onOpenChange: setOpen, children: [
|
|
2993
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2579
2994
|
DialogTrigger,
|
|
2580
2995
|
{
|
|
2581
|
-
render: /* @__PURE__ */ (0,
|
|
2996
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2582
2997
|
RichTextEditorControl,
|
|
2583
2998
|
{
|
|
2584
2999
|
active,
|
|
2585
3000
|
className,
|
|
2586
3001
|
title: "Embed YouTube video",
|
|
2587
3002
|
"aria-label": "Embed YouTube video",
|
|
2588
|
-
children: /* @__PURE__ */ (0,
|
|
3003
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
2589
3004
|
"svg",
|
|
2590
3005
|
{
|
|
2591
3006
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -2597,8 +3012,8 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
2597
3012
|
strokeLinejoin: "round",
|
|
2598
3013
|
className: "rte-editor-icon",
|
|
2599
3014
|
children: [
|
|
2600
|
-
/* @__PURE__ */ (0,
|
|
2601
|
-
/* @__PURE__ */ (0,
|
|
3015
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("path", { d: "M23.5 6.2a3 3 0 0 0-2.1-2.1C19.5 3.5 12 3.5 12 3.5s-7.5 0-9.4.6a3 3 0 0 0-2.1 2.1C0 8.1 0 12 0 12s0 3.9.5 5.8a3 3 0 0 0 2.1 2.1c1.9.6 9.4.6 9.4.6s7.5 0 9.4-.6a3 3 0 0 0 2.1-2.1c.5-1.9.5-5.8.5-5.8s0-3.9-.5-5.8z" }),
|
|
3016
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("path", { d: "M9.5 15.5V8.5l6.2 3.5z" })
|
|
2602
3017
|
]
|
|
2603
3018
|
}
|
|
2604
3019
|
)
|
|
@@ -2606,12 +3021,12 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
2606
3021
|
)
|
|
2607
3022
|
}
|
|
2608
3023
|
),
|
|
2609
|
-
/* @__PURE__ */ (0,
|
|
2610
|
-
/* @__PURE__ */ (0,
|
|
2611
|
-
/* @__PURE__ */ (0,
|
|
2612
|
-
/* @__PURE__ */ (0,
|
|
3024
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(DialogContent, { showCloseButton: false, children: [
|
|
3025
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(DialogHeader, { children: [
|
|
3026
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DialogTitle, { children: "Embed YouTube video" }),
|
|
3027
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DialogDescription, { children: "Paste a YouTube video URL or ID." })
|
|
2613
3028
|
] }),
|
|
2614
|
-
/* @__PURE__ */ (0,
|
|
3029
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2615
3030
|
Input,
|
|
2616
3031
|
{
|
|
2617
3032
|
value: url,
|
|
@@ -2625,9 +3040,9 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
2625
3040
|
}
|
|
2626
3041
|
}
|
|
2627
3042
|
),
|
|
2628
|
-
/* @__PURE__ */ (0,
|
|
2629
|
-
/* @__PURE__ */ (0,
|
|
2630
|
-
/* @__PURE__ */ (0,
|
|
3043
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(DialogFooter, { children: [
|
|
3044
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DialogClose, { children: "Cancel" }),
|
|
3045
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2631
3046
|
DialogClose,
|
|
2632
3047
|
{
|
|
2633
3048
|
disabled: !url,
|
|
@@ -2683,19 +3098,24 @@ var DEFAULT_LABELS = {
|
|
|
2683
3098
|
};
|
|
2684
3099
|
|
|
2685
3100
|
// src/rte-content.tsx
|
|
2686
|
-
var
|
|
2687
|
-
var
|
|
3101
|
+
var import_react19 = require("@tiptap/react");
|
|
3102
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2688
3103
|
var Content = ({
|
|
2689
3104
|
children,
|
|
2690
3105
|
className
|
|
2691
3106
|
}) => {
|
|
2692
|
-
const { editor } = useRichTextEditorContext();
|
|
2693
|
-
return /* @__PURE__ */ (0,
|
|
2694
|
-
/* @__PURE__ */ (0,
|
|
2695
|
-
|
|
3107
|
+
const { editor, preset, variant } = useRichTextEditorContext();
|
|
3108
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "relative", children: [
|
|
3109
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3110
|
+
import_react19.EditorContent,
|
|
2696
3111
|
{
|
|
2697
3112
|
editor,
|
|
2698
|
-
className: cn(
|
|
3113
|
+
className: cn(
|
|
3114
|
+
"rte-content editorcn-content w-full",
|
|
3115
|
+
variant === "default" && "rounded-lg border border-(--rte-hairline) bg-[var(--card,var(--background))]",
|
|
3116
|
+
className
|
|
3117
|
+
),
|
|
3118
|
+
"data-preset": preset,
|
|
2699
3119
|
spellCheck: false
|
|
2700
3120
|
}
|
|
2701
3121
|
),
|
|
@@ -2704,15 +3124,36 @@ var Content = ({
|
|
|
2704
3124
|
};
|
|
2705
3125
|
|
|
2706
3126
|
// src/rte-controls-group.tsx
|
|
2707
|
-
var
|
|
3127
|
+
var import_react20 = require("react");
|
|
3128
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3129
|
+
var SEPARATOR = "[.rte-controls-group+&]:before:w-px [.rte-controls-group+&]:before:shrink-0 [.rte-controls-group+&]:before:bg-border [.rte-controls-group+&]:before:content-['']";
|
|
3130
|
+
var BUTTON = "[&>button]:border-none [&>button]:bg-transparent [&>button]:transition-[background-color,color] [&>button]:duration-150 [&>button]:ease-[ease-out] [&>button:focus-visible]:outline-2 [&>button:focus-visible]:outline-offset-1 [&>button:focus-visible]:outline-ring/50 [&>button:focus-visible]:outline-solid";
|
|
3131
|
+
var variantClasses = {
|
|
3132
|
+
compact: `${SEPARATOR} [.rte-controls-group+&]:before:mx-0.5 [.rte-controls-group+&]:before:h-3.5 ${BUTTON} [&>button]:h-7 [&>button]:min-w-7 [&>button]:rounded-sm [&>button]:text-muted-foreground [&>button:hover]:bg-muted [&>button:hover]:text-foreground [&>button[aria-pressed=true]]:bg-muted [&>button[aria-pressed=true]]:text-foreground [&>button[data-state=on]]:bg-muted [&>button[data-state=on]]:text-foreground`,
|
|
3133
|
+
default: `gap-0.5 ${SEPARATOR} [.rte-controls-group+&]:before:mx-1 [.rte-controls-group+&]:before:h-4 ${BUTTON} [&>button]:h-8 [&>button]:min-w-8 [&>button]:rounded-md [&>button]:text-foreground [&>button:disabled]:cursor-not-allowed [&>button:disabled]:opacity-40 [&>button:hover:not(:disabled)]:bg-foreground/5 [&>button:hover:not(:disabled)]:text-foreground [&>button[aria-pressed=true]]:bg-foreground/8 [&>button[aria-pressed=true]]:text-foreground [&>button[data-state=on]]:bg-foreground/8 [&>button[data-state=on]]:text-foreground`,
|
|
3134
|
+
subtle: `${SEPARATOR} [.rte-controls-group+&]:before:mx-1 [.rte-controls-group+&]:before:h-4 ${BUTTON} [&>button]:h-8 [&>button]:min-w-8 [&>button]:rounded-md [&>button]:text-muted-foreground [&>button:hover]:bg-muted [&>button:hover]:text-foreground [&>button[aria-pressed=true]]:bg-muted [&>button[aria-pressed=true]]:text-foreground [&>button[data-state=on]]:bg-muted [&>button[data-state=on]]:text-foreground`
|
|
3135
|
+
};
|
|
2708
3136
|
var ControlsGroup = ({
|
|
2709
3137
|
children,
|
|
2710
3138
|
className
|
|
2711
|
-
}) =>
|
|
3139
|
+
}) => {
|
|
3140
|
+
const variant = (0, import_react20.useContext)(RichTextEditorContext)?.variant;
|
|
3141
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3142
|
+
"div",
|
|
3143
|
+
{
|
|
3144
|
+
className: cn(
|
|
3145
|
+
"rte-controls-group flex items-center empty:hidden",
|
|
3146
|
+
variant && variantClasses[variant],
|
|
3147
|
+
className
|
|
3148
|
+
),
|
|
3149
|
+
children
|
|
3150
|
+
}
|
|
3151
|
+
);
|
|
3152
|
+
};
|
|
2712
3153
|
|
|
2713
3154
|
// src/rte-footer.tsx
|
|
2714
|
-
var
|
|
2715
|
-
var
|
|
3155
|
+
var import_react21 = require("react");
|
|
3156
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2716
3157
|
var Footer = ({
|
|
2717
3158
|
children,
|
|
2718
3159
|
className,
|
|
@@ -2723,9 +3164,9 @@ var Footer = ({
|
|
|
2723
3164
|
wordCountFormatter
|
|
2724
3165
|
}) => {
|
|
2725
3166
|
const { editor, variant } = useRichTextEditorContext();
|
|
2726
|
-
const [, forceUpdate] = (0,
|
|
2727
|
-
const rafRef = (0,
|
|
2728
|
-
(0,
|
|
3167
|
+
const [, forceUpdate] = (0, import_react21.useState)(0);
|
|
3168
|
+
const rafRef = (0, import_react21.useRef)(null);
|
|
3169
|
+
(0, import_react21.useEffect)(() => {
|
|
2729
3170
|
if (!editor || !showWordCount) {
|
|
2730
3171
|
return;
|
|
2731
3172
|
}
|
|
@@ -2754,7 +3195,7 @@ var Footer = ({
|
|
|
2754
3195
|
}
|
|
2755
3196
|
};
|
|
2756
3197
|
}, [editor, showWordCount]);
|
|
2757
|
-
const wordCount = (0,
|
|
3198
|
+
const wordCount = (0, import_react21.useMemo)(() => {
|
|
2758
3199
|
if (!editor || !showWordCount) {
|
|
2759
3200
|
return null;
|
|
2760
3201
|
}
|
|
@@ -2771,35 +3212,46 @@ var Footer = ({
|
|
|
2771
3212
|
if (!showWordCount && !children) {
|
|
2772
3213
|
return null;
|
|
2773
3214
|
}
|
|
2774
|
-
return /* @__PURE__ */ (0,
|
|
3215
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
2775
3216
|
"div",
|
|
2776
3217
|
{
|
|
2777
3218
|
className: cn(
|
|
2778
|
-
"rte-footer",
|
|
3219
|
+
"rte-footer z-1 flex min-h-9 flex-wrap items-center justify-between gap-2 rounded-es-[calc(var(--radius)+3px)] rounded-ee-[calc(var(--radius)+3px)] border-t border-(--rte-hairline) bg-(--rte-strip) px-3 py-1.5 text-[0.75rem] text-muted-foreground",
|
|
2779
3220
|
variant !== "default" && `rte-footer--${variant}`,
|
|
2780
|
-
|
|
3221
|
+
variant === "default" && "min-h-8 rounded-none border-t-0 bg-transparent px-2 pt-1 pb-0",
|
|
3222
|
+
variant === "compact" && "rounded-none last:rounded-es-[calc(var(--radius)-1px)] last:rounded-ee-[calc(var(--radius)-1px)]",
|
|
3223
|
+
sticky && "sticky bottom-0 bg-[color-mix(in_srgb,var(--rte-strip)_80%,transparent)] backdrop-blur-lg",
|
|
2781
3224
|
className
|
|
2782
3225
|
),
|
|
2783
3226
|
"data-sticky": sticky ? "" : void 0,
|
|
2784
3227
|
style: sticky ? { bottom: stickyOffset } : void 0,
|
|
2785
3228
|
children: [
|
|
2786
|
-
showWordCount && wordCount && /* @__PURE__ */ (0,
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
{
|
|
2794
|
-
className: "rte-footer-word-count-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
3229
|
+
showWordCount && wordCount && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3230
|
+
"span",
|
|
3231
|
+
{
|
|
3232
|
+
className: cn(
|
|
3233
|
+
"rte-footer-word-count inline-flex items-center gap-1.5 text-[0.75rem] whitespace-nowrap",
|
|
3234
|
+
wordCountClassName
|
|
3235
|
+
),
|
|
3236
|
+
children: wordCountFormatter ? wordCountFormatter(wordCount) : /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
3237
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "rte-footer-word-count-stat inline-flex items-baseline gap-1", children: [
|
|
3238
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "rte-footer-word-count-number font-medium text-foreground tabular-nums", children: wordCount.words }),
|
|
3239
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "rte-footer-word-count-unit text-muted-foreground", children: "words" })
|
|
3240
|
+
] }),
|
|
3241
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3242
|
+
"span",
|
|
3243
|
+
{
|
|
3244
|
+
className: "rte-footer-word-count-separator size-[3px] shrink-0 rounded-full bg-[color-mix(in_srgb,var(--muted-foreground)_45%,transparent)]",
|
|
3245
|
+
"aria-hidden": "true"
|
|
3246
|
+
}
|
|
3247
|
+
),
|
|
3248
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "rte-footer-word-count-stat inline-flex items-baseline gap-1", children: [
|
|
3249
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "rte-footer-word-count-number font-medium text-foreground tabular-nums", children: wordCount.characters }),
|
|
3250
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "rte-footer-word-count-unit text-muted-foreground", children: "characters" })
|
|
3251
|
+
] })
|
|
3252
|
+
] })
|
|
3253
|
+
}
|
|
3254
|
+
),
|
|
2803
3255
|
children
|
|
2804
3256
|
]
|
|
2805
3257
|
}
|
|
@@ -2807,7 +3259,7 @@ var Footer = ({
|
|
|
2807
3259
|
};
|
|
2808
3260
|
|
|
2809
3261
|
// src/rte-toolbar.tsx
|
|
2810
|
-
var
|
|
3262
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2811
3263
|
var Toolbar = ({
|
|
2812
3264
|
children,
|
|
2813
3265
|
className,
|
|
@@ -2818,13 +3270,18 @@ var Toolbar = ({
|
|
|
2818
3270
|
if (!editable) {
|
|
2819
3271
|
return null;
|
|
2820
3272
|
}
|
|
2821
|
-
return /* @__PURE__ */ (0,
|
|
3273
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2822
3274
|
"div",
|
|
2823
3275
|
{
|
|
2824
3276
|
className: cn(
|
|
2825
|
-
"rte-toolbar",
|
|
3277
|
+
"rte-toolbar top-[var(--rte-sticky-offset,0px)] z-1 flex flex-wrap items-center justify-center gap-1 rounded-ss-[calc(var(--radius)+3px)] rounded-se-[calc(var(--radius)+3px)] border-b border-(--rte-hairline) bg-(--rte-strip) px-2 py-1.5 [transition:background-color_150ms_ease-out]",
|
|
3278
|
+
"[@media(max-width:640px)]:justify-start [@media(max-width:640px)]:flex-nowrap [@media(max-width:640px)]:overflow-x-auto [@media(max-width:640px)]:[--rte-toolbar-fade-end:1.5rem] [@media(max-width:640px)]:[-ms-overflow-style:none] [@media(max-width:640px)]:[-webkit-overflow-scrolling:touch] [@media(max-width:640px)]:[mask-image:linear-gradient(to_right,transparent,black_var(--rte-toolbar-fade-start),black_calc(100%-var(--rte-toolbar-fade-end)),transparent)] [@media(max-width:640px)]:[scrollbar-width:none] [@media(max-width:640px)]:[&::-webkit-scrollbar]:hidden [@media(max-width:640px)]:supports-[animation-timeline:scroll()]:[--rte-toolbar-fade-end:0px] [@media(max-width:640px)]:supports-[animation-timeline:scroll()]:animate-rte-toolbar-fade [@media(max-width:640px)]:supports-[animation-timeline:scroll()]:[animation-timeline:scroll(self_inline)]",
|
|
2826
3279
|
variant !== "default" && `rte-toolbar--${variant}`,
|
|
2827
|
-
|
|
3280
|
+
variant === "default" && "gap-1 rounded-none border-b-0 bg-transparent px-0 pt-0 pb-1",
|
|
3281
|
+
variant === "subtle" && "gap-1 px-1.5 py-1",
|
|
3282
|
+
variant === "compact" && "gap-0.5 rounded-none px-1.5 py-1 first:rounded-ss-[calc(var(--radius)-1px)] first:rounded-se-[calc(var(--radius)-1px)]",
|
|
3283
|
+
sticky && "sticky bg-[color-mix(in_srgb,var(--rte-strip)_80%,transparent)] backdrop-blur-lg",
|
|
3284
|
+
sticky && variant === "default" && "-mx-1 -mt-1 rounded-ss-[calc(var(--radius)+3px)] rounded-se-[calc(var(--radius)+3px)] bg-[color-mix(in_srgb,var(--rte-strip)_85%,transparent)] p-1",
|
|
2828
3285
|
className
|
|
2829
3286
|
),
|
|
2830
3287
|
"data-sticky": sticky ? "" : void 0,
|
|
@@ -2835,7 +3292,7 @@ var Toolbar = ({
|
|
|
2835
3292
|
};
|
|
2836
3293
|
|
|
2837
3294
|
// src/rte-text-editor.tsx
|
|
2838
|
-
var
|
|
3295
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2839
3296
|
var RichTextEditorRoot = ({
|
|
2840
3297
|
editor,
|
|
2841
3298
|
children,
|
|
@@ -2843,20 +3300,21 @@ var RichTextEditorRoot = ({
|
|
|
2843
3300
|
labels,
|
|
2844
3301
|
icons,
|
|
2845
3302
|
variant = "default",
|
|
3303
|
+
preset = "document",
|
|
2846
3304
|
editable = true
|
|
2847
3305
|
}) => {
|
|
2848
|
-
const mergedLabels = (0,
|
|
3306
|
+
const mergedLabels = (0, import_react22.useMemo)(
|
|
2849
3307
|
() => ({ ...DEFAULT_LABELS, ...labels }),
|
|
2850
3308
|
[labels]
|
|
2851
3309
|
);
|
|
2852
|
-
const mergedIcons = (0,
|
|
2853
|
-
const [tooltip] = (0,
|
|
2854
|
-
(0,
|
|
3310
|
+
const mergedIcons = (0, import_react22.useMemo)(() => ({ ...DEFAULT_ICONS, ...icons }), [icons]);
|
|
3311
|
+
const [tooltip] = (0, import_react22.useState)(createTooltipHandle);
|
|
3312
|
+
(0, import_react22.useEffect)(() => {
|
|
2855
3313
|
if (editor && editor.isEditable !== editable) {
|
|
2856
3314
|
editor.setEditable(editable);
|
|
2857
3315
|
}
|
|
2858
3316
|
}, [editor, editable]);
|
|
2859
|
-
return /* @__PURE__ */ (0,
|
|
3317
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2860
3318
|
RichTextEditorContext.Provider,
|
|
2861
3319
|
{
|
|
2862
3320
|
value: {
|
|
@@ -2864,22 +3322,22 @@ var RichTextEditorRoot = ({
|
|
|
2864
3322
|
editor,
|
|
2865
3323
|
icons: mergedIcons,
|
|
2866
3324
|
labels: mergedLabels,
|
|
3325
|
+
preset,
|
|
2867
3326
|
tooltip,
|
|
2868
3327
|
variant
|
|
2869
3328
|
},
|
|
2870
|
-
children: /* @__PURE__ */ (0,
|
|
3329
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2871
3330
|
"div",
|
|
2872
3331
|
{
|
|
2873
3332
|
className: cn(
|
|
2874
|
-
"rte-root",
|
|
3333
|
+
"rte-root relative rounded-xl border border-(--rte-hairline) bg-background [--rte-float-shadow:0_8px_30px_-12px_rgb(0_0_0/0.15)] [--rte-hairline:color-mix(in_srgb,var(--border)_60%,transparent)] [--rte-strip:color-mix(in_srgb,var(--muted)_50%,var(--background))] [transition:border-color_150ms_ease-out] [&_.rte-editor-icon]:size-4 [&_.rte-editor-icon]:shrink-0",
|
|
3334
|
+
variant === "default" && "bg-(--rte-strip) p-1",
|
|
2875
3335
|
variant !== "default" && `rte-root--${variant}`,
|
|
3336
|
+
variant === "compact" && "rounded-lg data-[variant=compact]:[&_.rte-editor-icon]:size-3.5",
|
|
2876
3337
|
className
|
|
2877
3338
|
),
|
|
2878
3339
|
"data-variant": variant,
|
|
2879
|
-
children: /* @__PURE__ */ (0,
|
|
2880
|
-
children,
|
|
2881
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Tooltip, { handle: tooltip, children: ({ payload }) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TooltipContent, { side: "bottom", children: payload }) })
|
|
2882
|
-
] })
|
|
3340
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipHost, { handle: tooltip, side: "bottom", children }) })
|
|
2883
3341
|
}
|
|
2884
3342
|
)
|
|
2885
3343
|
}
|