@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.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// src/rte-text-editor.tsx
|
|
2
|
-
import { Tooltip as TooltipPrimitive2 } from "@base-ui/react/tooltip";
|
|
3
2
|
import { useEffect as useEffect6, useMemo as useMemo2, useState as useState8 } from "react";
|
|
4
3
|
|
|
5
4
|
// src/bubble-menu/index.tsx
|
|
@@ -234,12 +233,12 @@ var PopoverContent = ({
|
|
|
234
233
|
import * as React4 from "react";
|
|
235
234
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
236
235
|
var RteButton = React4.forwardRef(
|
|
237
|
-
({ className
|
|
238
|
-
const cls =
|
|
239
|
-
"rte-bubble-btn",
|
|
240
|
-
active
|
|
236
|
+
({ className, active = false, ...props }, ref) => {
|
|
237
|
+
const cls = cn(
|
|
238
|
+
"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",
|
|
239
|
+
active && "rte-bubble-btn--active bg-muted text-foreground",
|
|
241
240
|
className
|
|
242
|
-
|
|
241
|
+
);
|
|
243
242
|
return /* @__PURE__ */ jsx5("button", { ref, type: "button", className: cls, ...props });
|
|
244
243
|
}
|
|
245
244
|
);
|
|
@@ -249,11 +248,11 @@ RteButton.displayName = "RteButton";
|
|
|
249
248
|
import * as React5 from "react";
|
|
250
249
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
251
250
|
var RteButtonGroup = React5.forwardRef(
|
|
252
|
-
({ className
|
|
251
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx6(
|
|
253
252
|
"div",
|
|
254
253
|
{
|
|
255
254
|
ref,
|
|
256
|
-
className:
|
|
255
|
+
className: cn("rte-bubble-group flex items-center gap-0.5", className),
|
|
257
256
|
...props
|
|
258
257
|
}
|
|
259
258
|
)
|
|
@@ -264,11 +263,14 @@ RteButtonGroup.displayName = "RteButtonGroup";
|
|
|
264
263
|
import * as React6 from "react";
|
|
265
264
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
266
265
|
var RteIcon = React6.forwardRef(
|
|
267
|
-
({ className
|
|
266
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
|
|
268
267
|
"span",
|
|
269
268
|
{
|
|
270
269
|
ref,
|
|
271
|
-
className:
|
|
270
|
+
className: cn(
|
|
271
|
+
"rte-bubble-btn-icon flex size-4 shrink-0 items-center justify-center [&_svg]:size-full",
|
|
272
|
+
className
|
|
273
|
+
),
|
|
272
274
|
...props
|
|
273
275
|
}
|
|
274
276
|
)
|
|
@@ -279,11 +281,14 @@ RteIcon.displayName = "RteIcon";
|
|
|
279
281
|
import * as React7 from "react";
|
|
280
282
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
281
283
|
var RteSeparator = React7.forwardRef(
|
|
282
|
-
({ className
|
|
284
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
|
|
283
285
|
"div",
|
|
284
286
|
{
|
|
285
287
|
ref,
|
|
286
|
-
className:
|
|
288
|
+
className: cn(
|
|
289
|
+
"rte-bubble-separator mx-0.5 h-4 w-px shrink-0 bg-border",
|
|
290
|
+
className
|
|
291
|
+
),
|
|
287
292
|
...props
|
|
288
293
|
}
|
|
289
294
|
)
|
|
@@ -294,12 +299,12 @@ RteSeparator.displayName = "RteSeparator";
|
|
|
294
299
|
import * as React8 from "react";
|
|
295
300
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
296
301
|
var RteOverlay = React8.forwardRef(
|
|
297
|
-
({ className
|
|
302
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx9(
|
|
298
303
|
"div",
|
|
299
304
|
{
|
|
300
305
|
ref,
|
|
301
306
|
role: "presentation",
|
|
302
|
-
className:
|
|
307
|
+
className: cn("rte-bubble-overlay fixed inset-0 z-999", className),
|
|
303
308
|
...props
|
|
304
309
|
}
|
|
305
310
|
)
|
|
@@ -311,12 +316,12 @@ import * as React9 from "react";
|
|
|
311
316
|
import { useCallback, useRef, useState } from "react";
|
|
312
317
|
import { jsx as jsx10, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
313
318
|
var variantClass = {
|
|
314
|
-
color: "rte-bubble-dropdown--color",
|
|
319
|
+
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",
|
|
315
320
|
default: "",
|
|
316
|
-
language: "rte-bubble-dropdown--language"
|
|
321
|
+
language: "rte-bubble-dropdown--language max-h-80 min-w-40 overflow-y-auto [scrollbar-width:thin]"
|
|
317
322
|
};
|
|
318
323
|
var RteDropdown = React9.forwardRef(
|
|
319
|
-
({ className
|
|
324
|
+
({ className, variant = "default", children, onMouseLeave, ...props }, ref) => {
|
|
320
325
|
const containerRef = useRef(null);
|
|
321
326
|
const [pill, setPill] = useState(null);
|
|
322
327
|
const handleItemEnter = useCallback((target) => {
|
|
@@ -352,7 +357,11 @@ var RteDropdown = React9.forwardRef(
|
|
|
352
357
|
},
|
|
353
358
|
[onMouseLeave]
|
|
354
359
|
);
|
|
355
|
-
const cls =
|
|
360
|
+
const cls = cn(
|
|
361
|
+
"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)]",
|
|
362
|
+
variantClass[variant],
|
|
363
|
+
className
|
|
364
|
+
);
|
|
356
365
|
return /* @__PURE__ */ jsxs2(
|
|
357
366
|
"div",
|
|
358
367
|
{
|
|
@@ -374,10 +383,10 @@ var RteDropdown = React9.forwardRef(
|
|
|
374
383
|
"div",
|
|
375
384
|
{
|
|
376
385
|
"aria-hidden": "true",
|
|
377
|
-
className:
|
|
378
|
-
"rte-bubble-dropdown-pill",
|
|
379
|
-
pill
|
|
380
|
-
|
|
386
|
+
className: cn(
|
|
387
|
+
"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]",
|
|
388
|
+
pill && "rte-bubble-dropdown-pill--visible opacity-100"
|
|
389
|
+
),
|
|
381
390
|
style: pill ? {
|
|
382
391
|
height: pill.height,
|
|
383
392
|
left: pill.left,
|
|
@@ -416,11 +425,13 @@ var RteColorSwatch = React10.forwardRef(
|
|
|
416
425
|
"aria-pressed": active,
|
|
417
426
|
"aria-label": label,
|
|
418
427
|
title: label,
|
|
419
|
-
className:
|
|
420
|
-
"rte-bubble-color-swatch",
|
|
421
|
-
variant === "text" ? "rte-bubble-color-swatch--text" : "rte-bubble-color-swatch--highlight",
|
|
422
|
-
active
|
|
423
|
-
|
|
428
|
+
className: cn(
|
|
429
|
+
"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)]",
|
|
430
|
+
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)",
|
|
431
|
+
active && "rte-bubble-color-swatch--active",
|
|
432
|
+
active && variant === "text" && "border-(--swatch-color) bg-(--swatch-color) text-(--swatch-check)",
|
|
433
|
+
active && variant === "highlight" && "shadow-[0_0_0_2px_color-mix(in_srgb,var(--swatch-color)_55%,var(--popover-foreground))]"
|
|
434
|
+
),
|
|
424
435
|
style: {
|
|
425
436
|
"--swatch-check": checkColor,
|
|
426
437
|
"--swatch-color": color
|
|
@@ -428,20 +439,34 @@ var RteColorSwatch = React10.forwardRef(
|
|
|
428
439
|
onMouseDown: (e) => e.preventDefault(),
|
|
429
440
|
onClick: () => onSelect(color),
|
|
430
441
|
children: [
|
|
431
|
-
variant === "text" && !active ? /* @__PURE__ */ jsx11(
|
|
432
|
-
|
|
433
|
-
"svg",
|
|
442
|
+
variant === "text" && !active ? /* @__PURE__ */ jsx11(
|
|
443
|
+
"span",
|
|
434
444
|
{
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
stroke: "currentColor",
|
|
439
|
-
strokeWidth: 3,
|
|
440
|
-
strokeLinecap: "round",
|
|
441
|
-
strokeLinejoin: "round",
|
|
442
|
-
children: /* @__PURE__ */ jsx11("path", { d: "M20 6 9 17l-5-5" })
|
|
445
|
+
className: "rte-bubble-color-glyph text-[0.6875rem] leading-none font-semibold",
|
|
446
|
+
"aria-hidden": "true",
|
|
447
|
+
children: "A"
|
|
443
448
|
}
|
|
444
|
-
)
|
|
449
|
+
) : null,
|
|
450
|
+
active ? /* @__PURE__ */ jsx11(
|
|
451
|
+
"span",
|
|
452
|
+
{
|
|
453
|
+
className: "rte-bubble-color-check flex size-3 items-center justify-center text-(--swatch-check) [&_svg]:size-full",
|
|
454
|
+
"aria-hidden": "true",
|
|
455
|
+
children: /* @__PURE__ */ jsx11(
|
|
456
|
+
"svg",
|
|
457
|
+
{
|
|
458
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
459
|
+
viewBox: "0 0 24 24",
|
|
460
|
+
fill: "none",
|
|
461
|
+
stroke: "currentColor",
|
|
462
|
+
strokeWidth: 3,
|
|
463
|
+
strokeLinecap: "round",
|
|
464
|
+
strokeLinejoin: "round",
|
|
465
|
+
children: /* @__PURE__ */ jsx11("path", { d: "M20 6 9 17l-5-5" })
|
|
466
|
+
}
|
|
467
|
+
)
|
|
468
|
+
}
|
|
469
|
+
) : null
|
|
445
470
|
]
|
|
446
471
|
}
|
|
447
472
|
);
|
|
@@ -452,12 +477,12 @@ RteColorSwatch.displayName = "RteColorSwatch";
|
|
|
452
477
|
// src/ui/rte-dropdown-item.tsx
|
|
453
478
|
import * as React11 from "react";
|
|
454
479
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
455
|
-
var RteDropdownItem = React11.forwardRef(({ className
|
|
456
|
-
const cls =
|
|
457
|
-
"rte-bubble-dropdown-item",
|
|
458
|
-
active
|
|
480
|
+
var RteDropdownItem = React11.forwardRef(({ className, active = false, ...props }, ref) => {
|
|
481
|
+
const cls = cn(
|
|
482
|
+
"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",
|
|
483
|
+
active && "rte-bubble-dropdown-item--active bg-muted font-medium text-foreground [&_.rte-bubble-dropdown-icon]:text-foreground",
|
|
459
484
|
className
|
|
460
|
-
|
|
485
|
+
);
|
|
461
486
|
return /* @__PURE__ */ jsx12(
|
|
462
487
|
"button",
|
|
463
488
|
{
|
|
@@ -474,11 +499,14 @@ RteDropdownItem.displayName = "RteDropdownItem";
|
|
|
474
499
|
// src/ui/rte-dropdown-divider.tsx
|
|
475
500
|
import * as React12 from "react";
|
|
476
501
|
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
477
|
-
var RteDropdownDivider = React12.forwardRef(({ className
|
|
502
|
+
var RteDropdownDivider = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx13(
|
|
478
503
|
"div",
|
|
479
504
|
{
|
|
480
505
|
ref,
|
|
481
|
-
className:
|
|
506
|
+
className: cn(
|
|
507
|
+
"rte-bubble-dropdown-divider -mx-1 my-1 h-px bg-[color-mix(in_srgb,var(--border)_60%,transparent)]",
|
|
508
|
+
className
|
|
509
|
+
),
|
|
482
510
|
...props
|
|
483
511
|
}
|
|
484
512
|
));
|
|
@@ -488,11 +516,14 @@ RteDropdownDivider.displayName = "RteDropdownDivider";
|
|
|
488
516
|
import * as React13 from "react";
|
|
489
517
|
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
490
518
|
var RteDropdownIcon = React13.forwardRef(
|
|
491
|
-
({ className
|
|
519
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx14(
|
|
492
520
|
"span",
|
|
493
521
|
{
|
|
494
522
|
ref,
|
|
495
|
-
className:
|
|
523
|
+
className: cn(
|
|
524
|
+
"rte-bubble-dropdown-icon flex size-4 shrink-0 items-center justify-center text-muted-foreground [&_svg]:size-full",
|
|
525
|
+
className
|
|
526
|
+
),
|
|
496
527
|
...props
|
|
497
528
|
}
|
|
498
529
|
)
|
|
@@ -502,6 +533,7 @@ RteDropdownIcon.displayName = "RteDropdownIcon";
|
|
|
502
533
|
// src/ui/toggle.tsx
|
|
503
534
|
import { Toggle as TogglePrimitive } from "@base-ui/react/toggle";
|
|
504
535
|
import { cva as cva2 } from "class-variance-authority";
|
|
536
|
+
import { forwardRef as forwardRef11 } from "react";
|
|
505
537
|
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
506
538
|
var toggleVariants = cva2(
|
|
507
539
|
"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",
|
|
@@ -523,23 +555,20 @@ var toggleVariants = cva2(
|
|
|
523
555
|
}
|
|
524
556
|
}
|
|
525
557
|
);
|
|
526
|
-
var Toggle = ({
|
|
527
|
-
className,
|
|
528
|
-
variant = "default",
|
|
529
|
-
size = "default",
|
|
530
|
-
...props
|
|
531
|
-
}) => /* @__PURE__ */ jsx15(
|
|
558
|
+
var Toggle = forwardRef11(({ className, variant = "default", size = "default", ...props }, ref) => /* @__PURE__ */ jsx15(
|
|
532
559
|
TogglePrimitive,
|
|
533
560
|
{
|
|
561
|
+
ref,
|
|
534
562
|
"data-slot": "toggle",
|
|
535
563
|
className: cn(toggleVariants({ className, size, variant })),
|
|
536
564
|
...props
|
|
537
565
|
}
|
|
538
|
-
);
|
|
566
|
+
));
|
|
567
|
+
Toggle.displayName = "Toggle";
|
|
539
568
|
|
|
540
569
|
// src/ui/tooltip.tsx
|
|
541
570
|
import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip";
|
|
542
|
-
import { jsx as jsx16, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
571
|
+
import { Fragment, jsx as jsx16, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
543
572
|
var TooltipProvider = ({
|
|
544
573
|
delay = 0,
|
|
545
574
|
...props
|
|
@@ -586,6 +615,15 @@ var TooltipContent = ({
|
|
|
586
615
|
)
|
|
587
616
|
}
|
|
588
617
|
) });
|
|
618
|
+
var createTooltipHandle = () => TooltipPrimitive.createHandle();
|
|
619
|
+
var TooltipHost = ({
|
|
620
|
+
handle,
|
|
621
|
+
children,
|
|
622
|
+
...props
|
|
623
|
+
}) => /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
624
|
+
children,
|
|
625
|
+
/* @__PURE__ */ jsx16(Tooltip, { handle, children: ({ payload }) => /* @__PURE__ */ jsx16(TooltipContent, { ...props, children: payload }) })
|
|
626
|
+
] });
|
|
589
627
|
|
|
590
628
|
// src/bubble-menu/color-selector.tsx
|
|
591
629
|
import { useState as useState2 } from "react";
|
|
@@ -651,7 +689,7 @@ var useEditorState = (editor, selector, isEqual = defaultEqual) => {
|
|
|
651
689
|
};
|
|
652
690
|
|
|
653
691
|
// src/bubble-menu/color-selector.tsx
|
|
654
|
-
import { Fragment, jsx as jsx17, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
692
|
+
import { Fragment as Fragment2, jsx as jsx17, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
655
693
|
var RECENT_KEY = "editorcn-editor-recent-colors";
|
|
656
694
|
var RECENT_LIMIT = 10;
|
|
657
695
|
var readRecentColors = () => {
|
|
@@ -773,7 +811,7 @@ var ColorSelector = ({ editor }) => {
|
|
|
773
811
|
) })
|
|
774
812
|
}
|
|
775
813
|
),
|
|
776
|
-
open && /* @__PURE__ */ jsxs5(
|
|
814
|
+
open && /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
777
815
|
/* @__PURE__ */ jsx17(
|
|
778
816
|
RteOverlay,
|
|
779
817
|
{
|
|
@@ -786,9 +824,9 @@ var ColorSelector = ({ editor }) => {
|
|
|
786
824
|
}
|
|
787
825
|
),
|
|
788
826
|
/* @__PURE__ */ jsxs5(RteDropdown, { variant: "color", children: [
|
|
789
|
-
recent.length > 0 ? /* @__PURE__ */ jsxs5("div", { className: "rte-bubble-color-section", children: [
|
|
790
|
-
/* @__PURE__ */ jsx17("span", { className: "rte-bubble-color-label", children: "Recently Used" }),
|
|
791
|
-
/* @__PURE__ */ jsx17("div", { className: "rte-bubble-color-recent", children: recent.map((item) => /* @__PURE__ */ jsx17(
|
|
827
|
+
recent.length > 0 ? /* @__PURE__ */ jsxs5("div", { className: "rte-bubble-color-section flex flex-col gap-2", children: [
|
|
828
|
+
/* @__PURE__ */ jsx17("span", { className: "rte-bubble-color-label px-0.5 text-[0.75rem] leading-none font-medium text-muted-foreground", children: "Recently Used" }),
|
|
829
|
+
/* @__PURE__ */ jsx17("div", { className: "rte-bubble-color-recent flex flex-wrap justify-center gap-1.5", children: recent.map((item) => /* @__PURE__ */ jsx17(
|
|
792
830
|
RteColorSwatch,
|
|
793
831
|
{
|
|
794
832
|
variant: item.type,
|
|
@@ -800,11 +838,11 @@ var ColorSelector = ({ editor }) => {
|
|
|
800
838
|
`${item.type}-${item.color}`
|
|
801
839
|
)) })
|
|
802
840
|
] }) : null,
|
|
803
|
-
hasColor ? /* @__PURE__ */ jsxs5(
|
|
841
|
+
hasColor ? /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
804
842
|
recent.length > 0 && /* @__PURE__ */ jsx17(RteDropdownDivider, {}),
|
|
805
|
-
/* @__PURE__ */ jsxs5("div", { className: "rte-bubble-color-section", children: [
|
|
806
|
-
/* @__PURE__ */ jsx17("span", { className: "rte-bubble-color-label", children: "Text Color" }),
|
|
807
|
-
/* @__PURE__ */ jsx17("div", { className: "rte-bubble-color-grid", children: TEXT_COLORS.map((item) => /* @__PURE__ */ jsx17(
|
|
843
|
+
/* @__PURE__ */ jsxs5("div", { className: "rte-bubble-color-section flex flex-col gap-2", children: [
|
|
844
|
+
/* @__PURE__ */ jsx17("span", { className: "rte-bubble-color-label px-0.5 text-[0.75rem] leading-none font-medium text-muted-foreground", children: "Text Color" }),
|
|
845
|
+
/* @__PURE__ */ jsx17("div", { className: "rte-bubble-color-grid grid grid-cols-[repeat(5,1.5rem)] justify-center gap-1.5", children: TEXT_COLORS.map((item) => /* @__PURE__ */ jsx17(
|
|
808
846
|
RteColorSwatch,
|
|
809
847
|
{
|
|
810
848
|
variant: "text",
|
|
@@ -817,11 +855,11 @@ var ColorSelector = ({ editor }) => {
|
|
|
817
855
|
)) })
|
|
818
856
|
] })
|
|
819
857
|
] }) : null,
|
|
820
|
-
hasHighlight ? /* @__PURE__ */ jsxs5(
|
|
858
|
+
hasHighlight ? /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
821
859
|
(recent.length > 0 || hasColor) && /* @__PURE__ */ jsx17(RteDropdownDivider, {}),
|
|
822
|
-
/* @__PURE__ */ jsxs5("div", { className: "rte-bubble-color-section", children: [
|
|
823
|
-
/* @__PURE__ */ jsx17("span", { className: "rte-bubble-color-label", children: "Highlight Color" }),
|
|
824
|
-
/* @__PURE__ */ jsx17("div", { className: "rte-bubble-color-grid", children: HIGHLIGHT_COLORS.map((item) => /* @__PURE__ */ jsx17(
|
|
860
|
+
/* @__PURE__ */ jsxs5("div", { className: "rte-bubble-color-section flex flex-col gap-2", children: [
|
|
861
|
+
/* @__PURE__ */ jsx17("span", { className: "rte-bubble-color-label px-0.5 text-[0.75rem] leading-none font-medium text-muted-foreground", children: "Highlight Color" }),
|
|
862
|
+
/* @__PURE__ */ jsx17("div", { className: "rte-bubble-color-grid grid grid-cols-[repeat(5,1.5rem)] justify-center gap-1.5", children: HIGHLIGHT_COLORS.map((item) => /* @__PURE__ */ jsx17(
|
|
825
863
|
RteColorSwatch,
|
|
826
864
|
{
|
|
827
865
|
variant: "highlight",
|
|
@@ -971,7 +1009,7 @@ var BubbleMenu = ({ editor }) => {
|
|
|
971
1009
|
editor,
|
|
972
1010
|
options: { offset: 8, placement: "top" },
|
|
973
1011
|
shouldShow,
|
|
974
|
-
children: /* @__PURE__ */ jsxs7("div", { className: "rte-bubble-menu", children: [
|
|
1012
|
+
children: /* @__PURE__ */ jsxs7("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: [
|
|
975
1013
|
hasText && /* @__PURE__ */ jsx19(TextButtons, { editor }),
|
|
976
1014
|
hasText && hasColor && /* @__PURE__ */ jsx19(RteSeparator, {}),
|
|
977
1015
|
hasColor && /* @__PURE__ */ jsx19(ColorSelector, { editor })
|
|
@@ -982,7 +1020,7 @@ var BubbleMenu = ({ editor }) => {
|
|
|
982
1020
|
|
|
983
1021
|
// src/controls/rte-control.tsx
|
|
984
1022
|
import { useEditorState as useEditorState2 } from "@tiptap/react";
|
|
985
|
-
import { useContext as useContext2 } from "react";
|
|
1023
|
+
import { cloneElement, forwardRef as forwardRef12, useContext as useContext2 } from "react";
|
|
986
1024
|
|
|
987
1025
|
// src/rte-context.ts
|
|
988
1026
|
import { createContext, useContext } from "react";
|
|
@@ -1001,42 +1039,69 @@ var useRichTextEditorContext = () => {
|
|
|
1001
1039
|
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
1002
1040
|
var RichTextEditorTooltip = ({
|
|
1003
1041
|
children,
|
|
1042
|
+
id,
|
|
1004
1043
|
label
|
|
1005
1044
|
}) => {
|
|
1006
1045
|
const tooltip = useContext2(RichTextEditorContext)?.tooltip;
|
|
1007
1046
|
if (!tooltip) {
|
|
1008
|
-
return children;
|
|
1047
|
+
return id ? cloneElement(children, { id }) : children;
|
|
1009
1048
|
}
|
|
1010
|
-
return /* @__PURE__ */ jsx20(
|
|
1011
|
-
|
|
1012
|
-
var RichTextEditorControl = ({
|
|
1013
|
-
active = false,
|
|
1014
|
-
interactive: _interactive = true,
|
|
1015
|
-
className,
|
|
1016
|
-
children,
|
|
1017
|
-
onMouseDown,
|
|
1018
|
-
onClick,
|
|
1019
|
-
disabled,
|
|
1020
|
-
...props
|
|
1021
|
-
}) => {
|
|
1022
|
-
const toggle = /* @__PURE__ */ jsx20(
|
|
1023
|
-
Toggle,
|
|
1049
|
+
return /* @__PURE__ */ jsx20(
|
|
1050
|
+
TooltipTrigger,
|
|
1024
1051
|
{
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
className: cn("rte-control-button", className),
|
|
1030
|
-
onMouseDown: (e) => {
|
|
1031
|
-
e.preventDefault();
|
|
1032
|
-
onMouseDown?.(e);
|
|
1033
|
-
},
|
|
1034
|
-
onPressedChange: () => onClick?.({}),
|
|
1035
|
-
children
|
|
1052
|
+
handle: tooltip,
|
|
1053
|
+
payload: label,
|
|
1054
|
+
render: children,
|
|
1055
|
+
...id && { id }
|
|
1036
1056
|
}
|
|
1037
1057
|
);
|
|
1038
|
-
return props.title ? /* @__PURE__ */ jsx20(RichTextEditorTooltip, { label: props.title, children: toggle }) : toggle;
|
|
1039
1058
|
};
|
|
1059
|
+
var triggerKeys = [
|
|
1060
|
+
"aria-controls",
|
|
1061
|
+
"aria-expanded",
|
|
1062
|
+
"aria-haspopup"
|
|
1063
|
+
];
|
|
1064
|
+
var triggerProps = (props) => Object.fromEntries(
|
|
1065
|
+
triggerKeys.flatMap(
|
|
1066
|
+
(key) => props[key] === void 0 ? [] : [[key, props[key]]]
|
|
1067
|
+
)
|
|
1068
|
+
);
|
|
1069
|
+
var RichTextEditorControl = forwardRef12(
|
|
1070
|
+
({
|
|
1071
|
+
active = false,
|
|
1072
|
+
interactive: _interactive = true,
|
|
1073
|
+
className,
|
|
1074
|
+
children,
|
|
1075
|
+
onMouseDown,
|
|
1076
|
+
onClick,
|
|
1077
|
+
disabled,
|
|
1078
|
+
...props
|
|
1079
|
+
}, ref) => {
|
|
1080
|
+
const toggle = /* @__PURE__ */ jsx20(
|
|
1081
|
+
Toggle,
|
|
1082
|
+
{
|
|
1083
|
+
ref,
|
|
1084
|
+
...triggerProps(props),
|
|
1085
|
+
...!props.title && props.id && { id: props.id },
|
|
1086
|
+
size: "sm",
|
|
1087
|
+
pressed: active,
|
|
1088
|
+
disabled,
|
|
1089
|
+
"aria-label": props["aria-label"],
|
|
1090
|
+
className: cn(
|
|
1091
|
+
"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",
|
|
1092
|
+
className
|
|
1093
|
+
),
|
|
1094
|
+
onMouseDown: (e) => {
|
|
1095
|
+
e.preventDefault();
|
|
1096
|
+
onMouseDown?.(e);
|
|
1097
|
+
},
|
|
1098
|
+
onClick,
|
|
1099
|
+
children
|
|
1100
|
+
}
|
|
1101
|
+
);
|
|
1102
|
+
return props.title ? /* @__PURE__ */ jsx20(RichTextEditorTooltip, { id: props.id, label: props.title, children: toggle }) : toggle;
|
|
1103
|
+
}
|
|
1104
|
+
);
|
|
1040
1105
|
var resolveIsActive = (editor, config) => {
|
|
1041
1106
|
if (!editor || !config) {
|
|
1042
1107
|
return false;
|
|
@@ -1322,7 +1387,7 @@ var LinkControl = () => {
|
|
|
1322
1387
|
)
|
|
1323
1388
|
}
|
|
1324
1389
|
),
|
|
1325
|
-
/* @__PURE__ */ jsx21(PopoverContent, { className: "w-72 p-3", children: /* @__PURE__ */ jsxs8("div", { className: "rte-link-editor", children: [
|
|
1390
|
+
/* @__PURE__ */ jsx21(PopoverContent, { className: "w-72 p-3", children: /* @__PURE__ */ jsxs8("div", { className: "rte-link-editor flex items-center gap-1", children: [
|
|
1326
1391
|
/* @__PURE__ */ jsx21(
|
|
1327
1392
|
Input,
|
|
1328
1393
|
{
|
|
@@ -1332,7 +1397,7 @@ var LinkControl = () => {
|
|
|
1332
1397
|
value: url,
|
|
1333
1398
|
onChange: (e) => setUrl(e.target.value),
|
|
1334
1399
|
onKeyDown: handleKeyDown,
|
|
1335
|
-
className: "rte-link-editor-input h-8 text-sm"
|
|
1400
|
+
className: "rte-link-editor-input h-8 min-w-[200px] flex-1 text-sm"
|
|
1336
1401
|
}
|
|
1337
1402
|
),
|
|
1338
1403
|
/* @__PURE__ */ jsx21(
|
|
@@ -1341,7 +1406,7 @@ var LinkControl = () => {
|
|
|
1341
1406
|
size: "sm",
|
|
1342
1407
|
variant: "default",
|
|
1343
1408
|
onClick: handleSave,
|
|
1344
|
-
className: "rte-link-editor-save h-8",
|
|
1409
|
+
className: "rte-link-editor-save h-8 rounded-ss-none rounded-es-none",
|
|
1345
1410
|
children: labels.linkEditorSave
|
|
1346
1411
|
}
|
|
1347
1412
|
)
|
|
@@ -1364,7 +1429,14 @@ import { NodeViewWrapper } from "@tiptap/react";
|
|
|
1364
1429
|
import { useCallback as useCallback5, useEffect as useEffect3, useRef as useRef3, useState as useState4 } from "react";
|
|
1365
1430
|
|
|
1366
1431
|
// src/icons.tsx
|
|
1432
|
+
import "react";
|
|
1433
|
+
|
|
1434
|
+
// src/icon-placeholder.tsx
|
|
1367
1435
|
import {
|
|
1436
|
+
AlignCenter,
|
|
1437
|
+
AlignJustify,
|
|
1438
|
+
AlignLeft,
|
|
1439
|
+
AlignRight,
|
|
1368
1440
|
Bold,
|
|
1369
1441
|
Code,
|
|
1370
1442
|
Heading1,
|
|
@@ -1386,23 +1458,60 @@ import {
|
|
|
1386
1458
|
Strikethrough,
|
|
1387
1459
|
Subscript,
|
|
1388
1460
|
Superscript,
|
|
1389
|
-
TextAlignCenter,
|
|
1390
|
-
TextAlignEnd,
|
|
1391
|
-
TextAlignJustify,
|
|
1392
|
-
TextAlignStart,
|
|
1393
1461
|
TextQuote,
|
|
1394
1462
|
Underline,
|
|
1395
1463
|
Undo2
|
|
1396
1464
|
} from "lucide-react";
|
|
1397
|
-
import "react";
|
|
1465
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
1466
|
+
var ICONS = {
|
|
1467
|
+
AlignCenter,
|
|
1468
|
+
AlignJustify,
|
|
1469
|
+
AlignLeft,
|
|
1470
|
+
AlignRight,
|
|
1471
|
+
Bold,
|
|
1472
|
+
Code,
|
|
1473
|
+
Heading1,
|
|
1474
|
+
Heading2,
|
|
1475
|
+
Heading3,
|
|
1476
|
+
Heading4,
|
|
1477
|
+
Heading5,
|
|
1478
|
+
Heading6,
|
|
1479
|
+
Highlighter,
|
|
1480
|
+
Italic,
|
|
1481
|
+
Link,
|
|
1482
|
+
Link2Off,
|
|
1483
|
+
List,
|
|
1484
|
+
ListOrdered,
|
|
1485
|
+
Minus,
|
|
1486
|
+
Redo2,
|
|
1487
|
+
RemoveFormatting,
|
|
1488
|
+
SquareCode,
|
|
1489
|
+
Strikethrough,
|
|
1490
|
+
Subscript,
|
|
1491
|
+
Superscript,
|
|
1492
|
+
TextQuote,
|
|
1493
|
+
Underline,
|
|
1494
|
+
Undo2
|
|
1495
|
+
};
|
|
1496
|
+
var IconPlaceholder = ({
|
|
1497
|
+
lucide,
|
|
1498
|
+
tabler: _tabler,
|
|
1499
|
+
hugeicons: _hugeicons,
|
|
1500
|
+
phosphor: _phosphor,
|
|
1501
|
+
remixicon: _remixicon,
|
|
1502
|
+
...props
|
|
1503
|
+
}) => {
|
|
1504
|
+
const Icon2 = ICONS[lucide];
|
|
1505
|
+
return /* @__PURE__ */ jsx22(Icon2, { ...props });
|
|
1506
|
+
};
|
|
1398
1507
|
|
|
1399
1508
|
// src/language-icons.tsx
|
|
1400
1509
|
import "react";
|
|
1401
|
-
import { jsx as
|
|
1510
|
+
import { jsx as jsx23, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1402
1511
|
var LangIcon = ({
|
|
1403
1512
|
children,
|
|
1404
1513
|
className
|
|
1405
|
-
}) => /* @__PURE__ */
|
|
1514
|
+
}) => /* @__PURE__ */ jsx23(
|
|
1406
1515
|
"svg",
|
|
1407
1516
|
{
|
|
1408
1517
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1418,139 +1527,139 @@ var LangIcon = ({
|
|
|
1418
1527
|
);
|
|
1419
1528
|
var DEFAULT_LANGUAGE_ICONS = {
|
|
1420
1529
|
bash: /* @__PURE__ */ jsxs9(LangIcon, { children: [
|
|
1421
|
-
/* @__PURE__ */
|
|
1422
|
-
/* @__PURE__ */
|
|
1423
|
-
/* @__PURE__ */
|
|
1530
|
+
/* @__PURE__ */ jsx23("rect", { x: "2.5", y: "4", width: "19", height: "16", rx: "2" }),
|
|
1531
|
+
/* @__PURE__ */ jsx23("path", { d: "M6.5 9.5l3.5 3-3.5 3" }),
|
|
1532
|
+
/* @__PURE__ */ jsx23("path", { d: "M12 15.5h5.5" })
|
|
1424
1533
|
] }),
|
|
1425
1534
|
c: /* @__PURE__ */ jsxs9(LangIcon, { children: [
|
|
1426
|
-
/* @__PURE__ */
|
|
1427
|
-
/* @__PURE__ */
|
|
1535
|
+
/* @__PURE__ */ jsx23("circle", { cx: "12", cy: "12", r: "8.5" }),
|
|
1536
|
+
/* @__PURE__ */ jsx23("path", { d: "M15.6 9.3a4.5 4.5 0 1 0 0 5.4" })
|
|
1428
1537
|
] }),
|
|
1429
1538
|
cpp: /* @__PURE__ */ jsxs9(LangIcon, { children: [
|
|
1430
|
-
/* @__PURE__ */
|
|
1431
|
-
/* @__PURE__ */
|
|
1432
|
-
/* @__PURE__ */
|
|
1433
|
-
/* @__PURE__ */
|
|
1539
|
+
/* @__PURE__ */ jsx23("circle", { cx: "9.5", cy: "12", r: "6.5" }),
|
|
1540
|
+
/* @__PURE__ */ jsx23("path", { d: "M12.3 9.7a3.3 3.3 0 1 0 0 4.6" }),
|
|
1541
|
+
/* @__PURE__ */ jsx23("path", { d: "M15.7 10.5v3M14.2 12h3" }),
|
|
1542
|
+
/* @__PURE__ */ jsx23("path", { d: "M19.3 10.5v3M17.8 12h3" })
|
|
1434
1543
|
] }),
|
|
1435
1544
|
css: /* @__PURE__ */ jsxs9(LangIcon, { children: [
|
|
1436
|
-
/* @__PURE__ */
|
|
1437
|
-
/* @__PURE__ */
|
|
1438
|
-
/* @__PURE__ */
|
|
1439
|
-
/* @__PURE__ */
|
|
1440
|
-
/* @__PURE__ */
|
|
1545
|
+
/* @__PURE__ */ jsx23("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1546
|
+
/* @__PURE__ */ jsx23("path", { d: "M9.7 7.5l-1 9" }),
|
|
1547
|
+
/* @__PURE__ */ jsx23("path", { d: "M15.3 7.5l-1 9" }),
|
|
1548
|
+
/* @__PURE__ */ jsx23("path", { d: "M7 10.3h11" }),
|
|
1549
|
+
/* @__PURE__ */ jsx23("path", { d: "M6.5 14.3h11" })
|
|
1441
1550
|
] }),
|
|
1442
1551
|
go: /* @__PURE__ */ jsxs9(LangIcon, { children: [
|
|
1443
|
-
/* @__PURE__ */
|
|
1444
|
-
/* @__PURE__ */
|
|
1445
|
-
/* @__PURE__ */
|
|
1446
|
-
/* @__PURE__ */
|
|
1552
|
+
/* @__PURE__ */ jsx23("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1553
|
+
/* @__PURE__ */ jsx23("path", { d: "M12.6 9.7A3.3 3.3 0 1 0 12.6 14.3" }),
|
|
1554
|
+
/* @__PURE__ */ jsx23("path", { d: "M12.6 12h-1.9" }),
|
|
1555
|
+
/* @__PURE__ */ jsx23("circle", { cx: "17", cy: "12", r: "2.9" })
|
|
1447
1556
|
] }),
|
|
1448
1557
|
html: /* @__PURE__ */ jsxs9(LangIcon, { children: [
|
|
1449
|
-
/* @__PURE__ */
|
|
1450
|
-
/* @__PURE__ */
|
|
1451
|
-
/* @__PURE__ */
|
|
1452
|
-
/* @__PURE__ */
|
|
1558
|
+
/* @__PURE__ */ jsx23("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1559
|
+
/* @__PURE__ */ jsx23("path", { d: "M9.5 8.5L6.5 12l3 3.5" }),
|
|
1560
|
+
/* @__PURE__ */ jsx23("path", { d: "M14.5 8.5L17.5 12l-3 3.5" }),
|
|
1561
|
+
/* @__PURE__ */ jsx23("path", { d: "M13 7.3l-2 9.4" })
|
|
1453
1562
|
] }),
|
|
1454
1563
|
java: /* @__PURE__ */ jsxs9(LangIcon, { children: [
|
|
1455
|
-
/* @__PURE__ */
|
|
1456
|
-
/* @__PURE__ */
|
|
1457
|
-
/* @__PURE__ */
|
|
1458
|
-
/* @__PURE__ */
|
|
1564
|
+
/* @__PURE__ */ jsx23("path", { d: "M6 10h10v5a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3v-5z" }),
|
|
1565
|
+
/* @__PURE__ */ jsx23("path", { d: "M16 12h1.3a1.8 1.8 0 0 1 0 3.6H16" }),
|
|
1566
|
+
/* @__PURE__ */ jsx23("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" }),
|
|
1567
|
+
/* @__PURE__ */ jsx23("path", { d: "M6 19.3h10" })
|
|
1459
1568
|
] }),
|
|
1460
1569
|
javascript: /* @__PURE__ */ jsxs9(LangIcon, { children: [
|
|
1461
|
-
/* @__PURE__ */
|
|
1462
|
-
/* @__PURE__ */
|
|
1463
|
-
/* @__PURE__ */
|
|
1570
|
+
/* @__PURE__ */ jsx23("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1571
|
+
/* @__PURE__ */ jsx23("path", { d: "M10.5 8v6.5a2 2 0 0 1-3.5 1.3" }),
|
|
1572
|
+
/* @__PURE__ */ jsx23("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" })
|
|
1464
1573
|
] }),
|
|
1465
1574
|
json: /* @__PURE__ */ jsxs9(LangIcon, { children: [
|
|
1466
|
-
/* @__PURE__ */
|
|
1467
|
-
/* @__PURE__ */
|
|
1575
|
+
/* @__PURE__ */ jsx23("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" }),
|
|
1576
|
+
/* @__PURE__ */ jsx23("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" })
|
|
1468
1577
|
] }),
|
|
1469
1578
|
kotlin: /* @__PURE__ */ jsxs9(LangIcon, { children: [
|
|
1470
|
-
/* @__PURE__ */
|
|
1471
|
-
/* @__PURE__ */
|
|
1472
|
-
/* @__PURE__ */
|
|
1473
|
-
/* @__PURE__ */
|
|
1579
|
+
/* @__PURE__ */ jsx23("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1580
|
+
/* @__PURE__ */ jsx23("path", { d: "M9 7.5v9" }),
|
|
1581
|
+
/* @__PURE__ */ jsx23("path", { d: "M9 12l6-4.5" }),
|
|
1582
|
+
/* @__PURE__ */ jsx23("path", { d: "M9 12l6 4.5" })
|
|
1474
1583
|
] }),
|
|
1475
1584
|
markdown: /* @__PURE__ */ jsxs9(LangIcon, { children: [
|
|
1476
|
-
/* @__PURE__ */
|
|
1477
|
-
/* @__PURE__ */
|
|
1478
|
-
/* @__PURE__ */
|
|
1479
|
-
/* @__PURE__ */
|
|
1585
|
+
/* @__PURE__ */ jsx23("rect", { x: "2", y: "5", width: "20", height: "14", rx: "2" }),
|
|
1586
|
+
/* @__PURE__ */ jsx23("path", { d: "M6 15V9l3 4 3-4v6" }),
|
|
1587
|
+
/* @__PURE__ */ jsx23("path", { d: "M16.5 9v6" }),
|
|
1588
|
+
/* @__PURE__ */ jsx23("path", { d: "M14.5 13l2 2 2-2" })
|
|
1480
1589
|
] }),
|
|
1481
1590
|
php: /* @__PURE__ */ jsxs9(LangIcon, { children: [
|
|
1482
|
-
/* @__PURE__ */
|
|
1483
|
-
/* @__PURE__ */
|
|
1484
|
-
/* @__PURE__ */
|
|
1485
|
-
/* @__PURE__ */
|
|
1591
|
+
/* @__PURE__ */ jsx23("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1592
|
+
/* @__PURE__ */ jsx23("path", { d: "M11.5 8.5L7.5 12l4 3.5" }),
|
|
1593
|
+
/* @__PURE__ */ jsx23("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" }),
|
|
1594
|
+
/* @__PURE__ */ jsx23("circle", { cx: "14.3", cy: "16.2", r: ".5", fill: "currentColor", stroke: "none" })
|
|
1486
1595
|
] }),
|
|
1487
1596
|
plaintext: /* @__PURE__ */ jsxs9(LangIcon, { children: [
|
|
1488
|
-
/* @__PURE__ */
|
|
1489
|
-
/* @__PURE__ */
|
|
1490
|
-
/* @__PURE__ */
|
|
1491
|
-
/* @__PURE__ */
|
|
1597
|
+
/* @__PURE__ */ jsx23("rect", { x: "4", y: "2.5", width: "16", height: "19", rx: "2" }),
|
|
1598
|
+
/* @__PURE__ */ jsx23("line", { x1: "7.5", y1: "7.5", x2: "16.5", y2: "7.5" }),
|
|
1599
|
+
/* @__PURE__ */ jsx23("line", { x1: "7.5", y1: "11.5", x2: "16.5", y2: "11.5" }),
|
|
1600
|
+
/* @__PURE__ */ jsx23("line", { x1: "7.5", y1: "15.5", x2: "13.5", y2: "15.5" })
|
|
1492
1601
|
] }),
|
|
1493
1602
|
python: /* @__PURE__ */ jsxs9(LangIcon, { children: [
|
|
1494
|
-
/* @__PURE__ */
|
|
1495
|
-
/* @__PURE__ */
|
|
1496
|
-
/* @__PURE__ */
|
|
1497
|
-
/* @__PURE__ */
|
|
1603
|
+
/* @__PURE__ */ jsx23("path", { d: "M4.5 15c0-3 2.5-4.7 5.7-4.7h1.6c2.8 0 5-2 5-4.5" }),
|
|
1604
|
+
/* @__PURE__ */ jsx23("path", { d: "M9.5 3.3c1.3-.3 2.6 0 3.3 1-.7 1-2 1.3-3.3 1" }),
|
|
1605
|
+
/* @__PURE__ */ jsx23("circle", { cx: "15.5", cy: "4.3", r: ".55", fill: "currentColor", stroke: "none" }),
|
|
1606
|
+
/* @__PURE__ */ jsx23("path", { d: "M17.8 4.5l1.4-.6M17.8 4.9l1.4.6" })
|
|
1498
1607
|
] }),
|
|
1499
1608
|
ruby: /* @__PURE__ */ jsxs9(LangIcon, { children: [
|
|
1500
|
-
/* @__PURE__ */
|
|
1501
|
-
/* @__PURE__ */
|
|
1502
|
-
/* @__PURE__ */
|
|
1609
|
+
/* @__PURE__ */ jsx23("polygon", { points: "12 2.5 19.5 8 12 21.5 4.5 8" }),
|
|
1610
|
+
/* @__PURE__ */ jsx23("path", { d: "M4.5 8h15" }),
|
|
1611
|
+
/* @__PURE__ */ jsx23("path", { d: "M12 2.5v19" })
|
|
1503
1612
|
] }),
|
|
1504
1613
|
rust: /* @__PURE__ */ jsxs9(LangIcon, { children: [
|
|
1505
|
-
/* @__PURE__ */
|
|
1506
|
-
/* @__PURE__ */
|
|
1507
|
-
/* @__PURE__ */
|
|
1508
|
-
/* @__PURE__ */
|
|
1614
|
+
/* @__PURE__ */ jsx23("circle", { cx: "12", cy: "12", r: "7" }),
|
|
1615
|
+
/* @__PURE__ */ jsx23("circle", { cx: "12", cy: "12", r: "2.3" }),
|
|
1616
|
+
/* @__PURE__ */ jsx23("path", { d: "M12 2.5v3M12 18.5v3M2.5 12h3M18.5 12h3" }),
|
|
1617
|
+
/* @__PURE__ */ jsx23("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" })
|
|
1509
1618
|
] }),
|
|
1510
1619
|
sql: /* @__PURE__ */ jsxs9(LangIcon, { children: [
|
|
1511
|
-
/* @__PURE__ */
|
|
1512
|
-
/* @__PURE__ */
|
|
1513
|
-
/* @__PURE__ */
|
|
1620
|
+
/* @__PURE__ */ jsx23("ellipse", { cx: "12", cy: "6", rx: "8", ry: "3" }),
|
|
1621
|
+
/* @__PURE__ */ jsx23("path", { d: "M4 6v6c0 1.7 3.6 3 8 3s8-1.3 8-3V6" }),
|
|
1622
|
+
/* @__PURE__ */ jsx23("path", { d: "M4 12v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6" })
|
|
1514
1623
|
] }),
|
|
1515
|
-
swift: /* @__PURE__ */
|
|
1624
|
+
swift: /* @__PURE__ */ jsx23(LangIcon, { children: /* @__PURE__ */ jsx23("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" }) }),
|
|
1516
1625
|
typescript: /* @__PURE__ */ jsxs9(LangIcon, { children: [
|
|
1517
|
-
/* @__PURE__ */
|
|
1518
|
-
/* @__PURE__ */
|
|
1519
|
-
/* @__PURE__ */
|
|
1626
|
+
/* @__PURE__ */ jsx23("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1627
|
+
/* @__PURE__ */ jsx23("path", { d: "M7.3 8.2h5M9.8 8.2v7.6" }),
|
|
1628
|
+
/* @__PURE__ */ jsx23("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" })
|
|
1520
1629
|
] }),
|
|
1521
1630
|
xml: /* @__PURE__ */ jsxs9(LangIcon, { children: [
|
|
1522
|
-
/* @__PURE__ */
|
|
1523
|
-
/* @__PURE__ */
|
|
1524
|
-
/* @__PURE__ */
|
|
1631
|
+
/* @__PURE__ */ jsx23("path", { d: "M8 7l-4.5 5 4.5 5" }),
|
|
1632
|
+
/* @__PURE__ */ jsx23("path", { d: "M16 7l4.5 5-4.5 5" }),
|
|
1633
|
+
/* @__PURE__ */ jsx23("path", { d: "M12 8v8" })
|
|
1525
1634
|
] }),
|
|
1526
1635
|
yaml: /* @__PURE__ */ jsxs9(LangIcon, { children: [
|
|
1527
|
-
/* @__PURE__ */
|
|
1528
|
-
/* @__PURE__ */
|
|
1529
|
-
/* @__PURE__ */
|
|
1530
|
-
/* @__PURE__ */
|
|
1636
|
+
/* @__PURE__ */ jsx23("rect", { x: "2.5", y: "3", width: "19", height: "18", rx: "2" }),
|
|
1637
|
+
/* @__PURE__ */ jsx23("path", { d: "M6.5 8h2M9.5 8h8" }),
|
|
1638
|
+
/* @__PURE__ */ jsx23("path", { d: "M6.5 12h2M9.5 12h6" }),
|
|
1639
|
+
/* @__PURE__ */ jsx23("path", { d: "M6.5 16h2M9.5 16h7" })
|
|
1531
1640
|
] })
|
|
1532
1641
|
};
|
|
1533
1642
|
|
|
1534
1643
|
// src/icons.tsx
|
|
1535
|
-
import { Fragment as
|
|
1644
|
+
import { Fragment as Fragment3, jsx as jsx24, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1536
1645
|
var ALIGN_PATHS = {
|
|
1537
|
-
center: /* @__PURE__ */ jsxs10(
|
|
1538
|
-
/* @__PURE__ */
|
|
1539
|
-
/* @__PURE__ */
|
|
1540
|
-
/* @__PURE__ */
|
|
1646
|
+
center: /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
1647
|
+
/* @__PURE__ */ jsx24("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
1648
|
+
/* @__PURE__ */ jsx24("line", { x1: "17", y1: "12", x2: "7", y2: "12" }),
|
|
1649
|
+
/* @__PURE__ */ jsx24("line", { x1: "19", y1: "18", x2: "5", y2: "18" })
|
|
1541
1650
|
] }),
|
|
1542
|
-
left: /* @__PURE__ */ jsxs10(
|
|
1543
|
-
/* @__PURE__ */
|
|
1544
|
-
/* @__PURE__ */
|
|
1545
|
-
/* @__PURE__ */
|
|
1651
|
+
left: /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
1652
|
+
/* @__PURE__ */ jsx24("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
1653
|
+
/* @__PURE__ */ jsx24("line", { x1: "15", y1: "12", x2: "3", y2: "12" }),
|
|
1654
|
+
/* @__PURE__ */ jsx24("line", { x1: "17", y1: "18", x2: "3", y2: "18" })
|
|
1546
1655
|
] }),
|
|
1547
|
-
right: /* @__PURE__ */ jsxs10(
|
|
1548
|
-
/* @__PURE__ */
|
|
1549
|
-
/* @__PURE__ */
|
|
1550
|
-
/* @__PURE__ */
|
|
1656
|
+
right: /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
1657
|
+
/* @__PURE__ */ jsx24("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
1658
|
+
/* @__PURE__ */ jsx24("line", { x1: "21", y1: "12", x2: "9", y2: "12" }),
|
|
1659
|
+
/* @__PURE__ */ jsx24("line", { x1: "21", y1: "18", x2: "7", y2: "18" })
|
|
1551
1660
|
] })
|
|
1552
1661
|
};
|
|
1553
|
-
var AlignIcon = ({ dir }) => /* @__PURE__ */
|
|
1662
|
+
var AlignIcon = ({ dir }) => /* @__PURE__ */ jsx24(
|
|
1554
1663
|
"svg",
|
|
1555
1664
|
{
|
|
1556
1665
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1576,8 +1685,8 @@ var EditUrlIcon = () => /* @__PURE__ */ jsxs10(
|
|
|
1576
1685
|
strokeLinejoin: "round",
|
|
1577
1686
|
className: "rte-editor-icon",
|
|
1578
1687
|
children: [
|
|
1579
|
-
/* @__PURE__ */
|
|
1580
|
-
/* @__PURE__ */
|
|
1688
|
+
/* @__PURE__ */ jsx24("path", { d: "M12 20h9" }),
|
|
1689
|
+
/* @__PURE__ */ jsx24("path", { d: "M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z" })
|
|
1581
1690
|
]
|
|
1582
1691
|
}
|
|
1583
1692
|
);
|
|
@@ -1593,9 +1702,9 @@ var OpenInYouTubeIcon = () => /* @__PURE__ */ jsxs10(
|
|
|
1593
1702
|
strokeLinejoin: "round",
|
|
1594
1703
|
className: "rte-editor-icon",
|
|
1595
1704
|
children: [
|
|
1596
|
-
/* @__PURE__ */
|
|
1597
|
-
/* @__PURE__ */
|
|
1598
|
-
/* @__PURE__ */
|
|
1705
|
+
/* @__PURE__ */ jsx24("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }),
|
|
1706
|
+
/* @__PURE__ */ jsx24("polyline", { points: "15 3 21 3 21 9" }),
|
|
1707
|
+
/* @__PURE__ */ jsx24("line", { x1: "10", y1: "14", x2: "21", y2: "3" })
|
|
1599
1708
|
]
|
|
1600
1709
|
}
|
|
1601
1710
|
);
|
|
@@ -1611,46 +1720,333 @@ var DeleteEmbedIcon = () => /* @__PURE__ */ jsxs10(
|
|
|
1611
1720
|
strokeLinejoin: "round",
|
|
1612
1721
|
className: "rte-editor-icon",
|
|
1613
1722
|
children: [
|
|
1614
|
-
/* @__PURE__ */
|
|
1615
|
-
/* @__PURE__ */
|
|
1723
|
+
/* @__PURE__ */ jsx24("polyline", { points: "3 6 5 6 21 6" }),
|
|
1724
|
+
/* @__PURE__ */ jsx24("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" })
|
|
1616
1725
|
]
|
|
1617
1726
|
}
|
|
1618
1727
|
);
|
|
1619
1728
|
var iconProps = { className: "rte-editor-icon" };
|
|
1620
1729
|
var DEFAULT_ICONS = {
|
|
1621
|
-
alignCenterControlIcon: /* @__PURE__ */
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1730
|
+
alignCenterControlIcon: /* @__PURE__ */ jsx24(
|
|
1731
|
+
IconPlaceholder,
|
|
1732
|
+
{
|
|
1733
|
+
lucide: "AlignCenter",
|
|
1734
|
+
tabler: "IconAlignCenter",
|
|
1735
|
+
hugeicons: "TextAlignCenterIcon",
|
|
1736
|
+
phosphor: "TextAlignCenterIcon",
|
|
1737
|
+
remixicon: "RiAlignCenter",
|
|
1738
|
+
...iconProps
|
|
1739
|
+
}
|
|
1740
|
+
),
|
|
1741
|
+
alignJustifyControlIcon: /* @__PURE__ */ jsx24(
|
|
1742
|
+
IconPlaceholder,
|
|
1743
|
+
{
|
|
1744
|
+
lucide: "AlignJustify",
|
|
1745
|
+
tabler: "IconAlignJustified",
|
|
1746
|
+
hugeicons: "TextAlignJustifyCenterIcon",
|
|
1747
|
+
phosphor: "TextAlignJustifyIcon",
|
|
1748
|
+
remixicon: "RiAlignJustify",
|
|
1749
|
+
...iconProps
|
|
1750
|
+
}
|
|
1751
|
+
),
|
|
1752
|
+
alignLeftControlIcon: /* @__PURE__ */ jsx24(
|
|
1753
|
+
IconPlaceholder,
|
|
1754
|
+
{
|
|
1755
|
+
lucide: "AlignLeft",
|
|
1756
|
+
tabler: "IconAlignLeft",
|
|
1757
|
+
hugeicons: "TextAlignLeftIcon",
|
|
1758
|
+
phosphor: "TextAlignLeftIcon",
|
|
1759
|
+
remixicon: "RiAlignLeft",
|
|
1760
|
+
...iconProps
|
|
1761
|
+
}
|
|
1762
|
+
),
|
|
1763
|
+
alignRightControlIcon: /* @__PURE__ */ jsx24(
|
|
1764
|
+
IconPlaceholder,
|
|
1765
|
+
{
|
|
1766
|
+
lucide: "AlignRight",
|
|
1767
|
+
tabler: "IconAlignRight",
|
|
1768
|
+
hugeicons: "TextAlignRightIcon",
|
|
1769
|
+
phosphor: "TextAlignRightIcon",
|
|
1770
|
+
remixicon: "RiAlignRight",
|
|
1771
|
+
...iconProps
|
|
1772
|
+
}
|
|
1773
|
+
),
|
|
1774
|
+
blockquoteControlIcon: /* @__PURE__ */ jsx24(
|
|
1775
|
+
IconPlaceholder,
|
|
1776
|
+
{
|
|
1777
|
+
lucide: "TextQuote",
|
|
1778
|
+
tabler: "IconQuote",
|
|
1779
|
+
hugeicons: "LeftToRightBlockQuoteIcon",
|
|
1780
|
+
phosphor: "QuotesIcon",
|
|
1781
|
+
remixicon: "RiQuoteText",
|
|
1782
|
+
...iconProps
|
|
1783
|
+
}
|
|
1784
|
+
),
|
|
1785
|
+
boldControlIcon: /* @__PURE__ */ jsx24(
|
|
1786
|
+
IconPlaceholder,
|
|
1787
|
+
{
|
|
1788
|
+
lucide: "Bold",
|
|
1789
|
+
tabler: "IconBold",
|
|
1790
|
+
hugeicons: "BoldIcon",
|
|
1791
|
+
phosphor: "TextBIcon",
|
|
1792
|
+
remixicon: "RiBold",
|
|
1793
|
+
...iconProps
|
|
1794
|
+
}
|
|
1795
|
+
),
|
|
1796
|
+
bulletListControlIcon: /* @__PURE__ */ jsx24(
|
|
1797
|
+
IconPlaceholder,
|
|
1798
|
+
{
|
|
1799
|
+
lucide: "List",
|
|
1800
|
+
tabler: "IconList",
|
|
1801
|
+
hugeicons: "LeftToRightListBulletIcon",
|
|
1802
|
+
phosphor: "ListBulletsIcon",
|
|
1803
|
+
remixicon: "RiListUnordered",
|
|
1804
|
+
...iconProps
|
|
1805
|
+
}
|
|
1806
|
+
),
|
|
1807
|
+
clearFormattingControlIcon: /* @__PURE__ */ jsx24(
|
|
1808
|
+
IconPlaceholder,
|
|
1809
|
+
{
|
|
1810
|
+
lucide: "RemoveFormatting",
|
|
1811
|
+
tabler: "IconEraser",
|
|
1812
|
+
hugeicons: "TextClearIcon",
|
|
1813
|
+
phosphor: "EraserIcon",
|
|
1814
|
+
remixicon: "RiFormatClear",
|
|
1815
|
+
...iconProps
|
|
1816
|
+
}
|
|
1817
|
+
),
|
|
1818
|
+
codeBlockControlIcon: /* @__PURE__ */ jsx24(
|
|
1819
|
+
IconPlaceholder,
|
|
1820
|
+
{
|
|
1821
|
+
lucide: "SquareCode",
|
|
1822
|
+
tabler: "IconSourceCode",
|
|
1823
|
+
hugeicons: "SourceCodeSquareIcon",
|
|
1824
|
+
phosphor: "CodeBlockIcon",
|
|
1825
|
+
remixicon: "RiCodeBoxLine",
|
|
1826
|
+
...iconProps
|
|
1827
|
+
}
|
|
1828
|
+
),
|
|
1829
|
+
codeControlIcon: /* @__PURE__ */ jsx24(
|
|
1830
|
+
IconPlaceholder,
|
|
1831
|
+
{
|
|
1832
|
+
lucide: "Code",
|
|
1833
|
+
tabler: "IconCode",
|
|
1834
|
+
hugeicons: "SourceCodeIcon",
|
|
1835
|
+
phosphor: "CodeIcon",
|
|
1836
|
+
remixicon: "RiCodeLine",
|
|
1837
|
+
...iconProps
|
|
1838
|
+
}
|
|
1839
|
+
),
|
|
1840
|
+
h1ControlIcon: /* @__PURE__ */ jsx24(
|
|
1841
|
+
IconPlaceholder,
|
|
1842
|
+
{
|
|
1843
|
+
lucide: "Heading1",
|
|
1844
|
+
tabler: "IconH1",
|
|
1845
|
+
hugeicons: "Heading01Icon",
|
|
1846
|
+
phosphor: "TextHOneIcon",
|
|
1847
|
+
remixicon: "RiH1",
|
|
1848
|
+
...iconProps
|
|
1849
|
+
}
|
|
1850
|
+
),
|
|
1851
|
+
h2ControlIcon: /* @__PURE__ */ jsx24(
|
|
1852
|
+
IconPlaceholder,
|
|
1853
|
+
{
|
|
1854
|
+
lucide: "Heading2",
|
|
1855
|
+
tabler: "IconH2",
|
|
1856
|
+
hugeicons: "Heading02Icon",
|
|
1857
|
+
phosphor: "TextHTwoIcon",
|
|
1858
|
+
remixicon: "RiH2",
|
|
1859
|
+
...iconProps
|
|
1860
|
+
}
|
|
1861
|
+
),
|
|
1862
|
+
h3ControlIcon: /* @__PURE__ */ jsx24(
|
|
1863
|
+
IconPlaceholder,
|
|
1864
|
+
{
|
|
1865
|
+
lucide: "Heading3",
|
|
1866
|
+
tabler: "IconH3",
|
|
1867
|
+
hugeicons: "Heading03Icon",
|
|
1868
|
+
phosphor: "TextHThreeIcon",
|
|
1869
|
+
remixicon: "RiH3",
|
|
1870
|
+
...iconProps
|
|
1871
|
+
}
|
|
1872
|
+
),
|
|
1873
|
+
h4ControlIcon: /* @__PURE__ */ jsx24(
|
|
1874
|
+
IconPlaceholder,
|
|
1875
|
+
{
|
|
1876
|
+
lucide: "Heading4",
|
|
1877
|
+
tabler: "IconH4",
|
|
1878
|
+
hugeicons: "Heading04Icon",
|
|
1879
|
+
phosphor: "TextHFourIcon",
|
|
1880
|
+
remixicon: "RiH4",
|
|
1881
|
+
...iconProps
|
|
1882
|
+
}
|
|
1883
|
+
),
|
|
1884
|
+
h5ControlIcon: /* @__PURE__ */ jsx24(
|
|
1885
|
+
IconPlaceholder,
|
|
1886
|
+
{
|
|
1887
|
+
lucide: "Heading5",
|
|
1888
|
+
tabler: "IconH5",
|
|
1889
|
+
hugeicons: "Heading05Icon",
|
|
1890
|
+
phosphor: "TextHFiveIcon",
|
|
1891
|
+
remixicon: "RiH5",
|
|
1892
|
+
...iconProps
|
|
1893
|
+
}
|
|
1894
|
+
),
|
|
1895
|
+
h6ControlIcon: /* @__PURE__ */ jsx24(
|
|
1896
|
+
IconPlaceholder,
|
|
1897
|
+
{
|
|
1898
|
+
lucide: "Heading6",
|
|
1899
|
+
tabler: "IconH6",
|
|
1900
|
+
hugeicons: "Heading06Icon",
|
|
1901
|
+
phosphor: "TextHSixIcon",
|
|
1902
|
+
remixicon: "RiH6",
|
|
1903
|
+
...iconProps
|
|
1904
|
+
}
|
|
1905
|
+
),
|
|
1906
|
+
highlightControlIcon: /* @__PURE__ */ jsx24(
|
|
1907
|
+
IconPlaceholder,
|
|
1908
|
+
{
|
|
1909
|
+
lucide: "Highlighter",
|
|
1910
|
+
tabler: "IconHighlight",
|
|
1911
|
+
hugeicons: "HighlighterIcon",
|
|
1912
|
+
phosphor: "HighlighterIcon",
|
|
1913
|
+
remixicon: "RiMarkPenLine",
|
|
1914
|
+
...iconProps
|
|
1915
|
+
}
|
|
1916
|
+
),
|
|
1917
|
+
hrControlIcon: /* @__PURE__ */ jsx24(
|
|
1918
|
+
IconPlaceholder,
|
|
1919
|
+
{
|
|
1920
|
+
lucide: "Minus",
|
|
1921
|
+
tabler: "IconMinus",
|
|
1922
|
+
hugeicons: "MinusSignIcon",
|
|
1923
|
+
phosphor: "MinusIcon",
|
|
1924
|
+
remixicon: "RiSeparator",
|
|
1925
|
+
...iconProps
|
|
1926
|
+
}
|
|
1927
|
+
),
|
|
1928
|
+
italicControlIcon: /* @__PURE__ */ jsx24(
|
|
1929
|
+
IconPlaceholder,
|
|
1930
|
+
{
|
|
1931
|
+
lucide: "Italic",
|
|
1932
|
+
tabler: "IconItalic",
|
|
1933
|
+
hugeicons: "ItalicIcon",
|
|
1934
|
+
phosphor: "TextItalicIcon",
|
|
1935
|
+
remixicon: "RiItalic",
|
|
1936
|
+
...iconProps
|
|
1937
|
+
}
|
|
1938
|
+
),
|
|
1640
1939
|
languageIcons: DEFAULT_LANGUAGE_ICONS,
|
|
1641
|
-
linkControlIcon: /* @__PURE__ */
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1940
|
+
linkControlIcon: /* @__PURE__ */ jsx24(
|
|
1941
|
+
IconPlaceholder,
|
|
1942
|
+
{
|
|
1943
|
+
lucide: "Link",
|
|
1944
|
+
tabler: "IconLink",
|
|
1945
|
+
hugeicons: "Link01Icon",
|
|
1946
|
+
phosphor: "LinkIcon",
|
|
1947
|
+
remixicon: "RiLink",
|
|
1948
|
+
...iconProps
|
|
1949
|
+
}
|
|
1950
|
+
),
|
|
1951
|
+
orderedListControlIcon: /* @__PURE__ */ jsx24(
|
|
1952
|
+
IconPlaceholder,
|
|
1953
|
+
{
|
|
1954
|
+
lucide: "ListOrdered",
|
|
1955
|
+
tabler: "IconListNumbers",
|
|
1956
|
+
hugeicons: "LeftToRightListNumberIcon",
|
|
1957
|
+
phosphor: "ListNumbersIcon",
|
|
1958
|
+
remixicon: "RiListOrdered",
|
|
1959
|
+
...iconProps
|
|
1960
|
+
}
|
|
1961
|
+
),
|
|
1962
|
+
redoControlIcon: /* @__PURE__ */ jsx24(
|
|
1963
|
+
IconPlaceholder,
|
|
1964
|
+
{
|
|
1965
|
+
lucide: "Redo2",
|
|
1966
|
+
tabler: "IconArrowForwardUp",
|
|
1967
|
+
hugeicons: "RedoIcon",
|
|
1968
|
+
phosphor: "ArrowClockwiseIcon",
|
|
1969
|
+
remixicon: "RiArrowGoForwardLine",
|
|
1970
|
+
...iconProps
|
|
1971
|
+
}
|
|
1972
|
+
),
|
|
1973
|
+
strikeControlIcon: /* @__PURE__ */ jsx24(
|
|
1974
|
+
IconPlaceholder,
|
|
1975
|
+
{
|
|
1976
|
+
lucide: "Strikethrough",
|
|
1977
|
+
tabler: "IconStrikethrough",
|
|
1978
|
+
hugeicons: "StrikethroughIcon",
|
|
1979
|
+
phosphor: "TextStrikethroughIcon",
|
|
1980
|
+
remixicon: "RiStrikethrough",
|
|
1981
|
+
...iconProps
|
|
1982
|
+
}
|
|
1983
|
+
),
|
|
1984
|
+
subscriptControlIcon: /* @__PURE__ */ jsx24(
|
|
1985
|
+
IconPlaceholder,
|
|
1986
|
+
{
|
|
1987
|
+
lucide: "Subscript",
|
|
1988
|
+
tabler: "IconSubscript",
|
|
1989
|
+
hugeicons: "SubscriptIcon",
|
|
1990
|
+
phosphor: "TextSubscriptIcon",
|
|
1991
|
+
remixicon: "RiSubscript",
|
|
1992
|
+
...iconProps
|
|
1993
|
+
}
|
|
1994
|
+
),
|
|
1995
|
+
superscriptControlIcon: /* @__PURE__ */ jsx24(
|
|
1996
|
+
IconPlaceholder,
|
|
1997
|
+
{
|
|
1998
|
+
lucide: "Superscript",
|
|
1999
|
+
tabler: "IconSuperscript",
|
|
2000
|
+
hugeicons: "SuperscriptIcon",
|
|
2001
|
+
phosphor: "TextSuperscriptIcon",
|
|
2002
|
+
remixicon: "RiSuperscript",
|
|
2003
|
+
...iconProps
|
|
2004
|
+
}
|
|
2005
|
+
),
|
|
2006
|
+
underlineControlIcon: /* @__PURE__ */ jsx24(
|
|
2007
|
+
IconPlaceholder,
|
|
2008
|
+
{
|
|
2009
|
+
lucide: "Underline",
|
|
2010
|
+
tabler: "IconUnderline",
|
|
2011
|
+
hugeicons: "UnderlineIcon",
|
|
2012
|
+
phosphor: "TextUnderlineIcon",
|
|
2013
|
+
remixicon: "RiUnderline",
|
|
2014
|
+
...iconProps
|
|
2015
|
+
}
|
|
2016
|
+
),
|
|
2017
|
+
undoControlIcon: /* @__PURE__ */ jsx24(
|
|
2018
|
+
IconPlaceholder,
|
|
2019
|
+
{
|
|
2020
|
+
lucide: "Undo2",
|
|
2021
|
+
tabler: "IconArrowBackUp",
|
|
2022
|
+
hugeicons: "UndoIcon",
|
|
2023
|
+
phosphor: "ArrowCounterClockwiseIcon",
|
|
2024
|
+
remixicon: "RiArrowGoBackLine",
|
|
2025
|
+
...iconProps
|
|
2026
|
+
}
|
|
2027
|
+
),
|
|
2028
|
+
unlinkControlIcon: /* @__PURE__ */ jsx24(
|
|
2029
|
+
IconPlaceholder,
|
|
2030
|
+
{
|
|
2031
|
+
lucide: "Link2Off",
|
|
2032
|
+
tabler: "IconUnlink",
|
|
2033
|
+
hugeicons: "UnlinkIcon",
|
|
2034
|
+
phosphor: "LinkBreakIcon",
|
|
2035
|
+
remixicon: "RiLinkUnlink",
|
|
2036
|
+
...iconProps
|
|
2037
|
+
}
|
|
2038
|
+
)
|
|
1650
2039
|
};
|
|
1651
2040
|
|
|
1652
2041
|
// src/extensions/resizable-node-view.tsx
|
|
1653
|
-
import { Fragment as
|
|
2042
|
+
import { Fragment as Fragment4, jsx as jsx25, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2043
|
+
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";
|
|
2044
|
+
var SELECTOR_GROUP = "rte-embed-selector-group flex items-center gap-0.5";
|
|
2045
|
+
var SELECTOR_DIVIDER = "rte-embed-selector-divider mx-0.5 h-4 w-px shrink-0 bg-border";
|
|
2046
|
+
var HANDLE = "rte-resize-handle absolute z-10 opacity-0 group-data-selected/embed:opacity-100";
|
|
2047
|
+
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-['']`;
|
|
2048
|
+
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`;
|
|
2049
|
+
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)]`;
|
|
1654
2050
|
var EmbedToolbar = ({
|
|
1655
2051
|
align,
|
|
1656
2052
|
videoSrc,
|
|
@@ -1667,8 +2063,8 @@ var EmbedToolbar = ({
|
|
|
1667
2063
|
nodeSrc
|
|
1668
2064
|
}) => {
|
|
1669
2065
|
if (isEditingUrl) {
|
|
1670
|
-
return /* @__PURE__ */ jsxs11("div", { className: "rte-embed-selector-edit-form", children: [
|
|
1671
|
-
/* @__PURE__ */
|
|
2066
|
+
return /* @__PURE__ */ jsxs11("div", { className: "rte-embed-selector-edit-form flex items-center gap-1.5", children: [
|
|
2067
|
+
/* @__PURE__ */ jsx25(
|
|
1672
2068
|
"input",
|
|
1673
2069
|
{
|
|
1674
2070
|
ref: inputRef,
|
|
@@ -1676,7 +2072,7 @@ var EmbedToolbar = ({
|
|
|
1676
2072
|
value: urlInput,
|
|
1677
2073
|
onChange: (e) => setUrlInput(e.target.value),
|
|
1678
2074
|
placeholder: "Paste YouTube URL or video ID...",
|
|
1679
|
-
className: "rte-embed-selector-input",
|
|
2075
|
+
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)]",
|
|
1680
2076
|
onKeyDown: (e) => {
|
|
1681
2077
|
if (e.key === "Enter") {
|
|
1682
2078
|
handleSaveUrl();
|
|
@@ -1686,46 +2082,55 @@ var EmbedToolbar = ({
|
|
|
1686
2082
|
}
|
|
1687
2083
|
}
|
|
1688
2084
|
),
|
|
1689
|
-
/* @__PURE__ */
|
|
2085
|
+
/* @__PURE__ */ jsx25(
|
|
1690
2086
|
"button",
|
|
1691
2087
|
{
|
|
1692
2088
|
type: "button",
|
|
1693
2089
|
onClick: handleSaveUrl,
|
|
1694
|
-
className:
|
|
2090
|
+
className: cn(
|
|
2091
|
+
SELECTOR_BUTTON,
|
|
2092
|
+
"rte-embed-selector-btn--save bg-primary px-2 text-primary-foreground hover:bg-primary/85 hover:text-primary-foreground"
|
|
2093
|
+
),
|
|
1695
2094
|
children: "Save"
|
|
1696
2095
|
}
|
|
1697
2096
|
),
|
|
1698
|
-
/* @__PURE__ */
|
|
2097
|
+
/* @__PURE__ */ jsx25(
|
|
1699
2098
|
"button",
|
|
1700
2099
|
{
|
|
1701
2100
|
type: "button",
|
|
1702
2101
|
onClick: () => setIsEditingUrl(false),
|
|
1703
|
-
className:
|
|
2102
|
+
className: SELECTOR_BUTTON,
|
|
1704
2103
|
children: "Cancel"
|
|
1705
2104
|
}
|
|
1706
2105
|
)
|
|
1707
2106
|
] });
|
|
1708
2107
|
}
|
|
1709
|
-
return /* @__PURE__ */ jsxs11(
|
|
1710
|
-
/* @__PURE__ */
|
|
2108
|
+
return /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
2109
|
+
/* @__PURE__ */ jsx25("div", { className: SELECTOR_GROUP, children: ["left", "center", "right"].map((dir) => /* @__PURE__ */ jsx25(
|
|
1711
2110
|
"button",
|
|
1712
2111
|
{
|
|
1713
2112
|
type: "button",
|
|
1714
2113
|
title: `Align ${dir.charAt(0).toUpperCase()}${dir.slice(1)}`,
|
|
1715
2114
|
"aria-label": `Align ${dir.charAt(0).toUpperCase()}${dir.slice(1)}`,
|
|
1716
|
-
className:
|
|
2115
|
+
className: cn(
|
|
2116
|
+
SELECTOR_BUTTON,
|
|
2117
|
+
align === dir && "rte-embed-selector-btn--active bg-muted text-foreground"
|
|
2118
|
+
),
|
|
1717
2119
|
onClick: () => updateAttributes({ align: dir }),
|
|
1718
|
-
children: /* @__PURE__ */
|
|
2120
|
+
children: /* @__PURE__ */ jsx25(AlignIcon, { dir })
|
|
1719
2121
|
},
|
|
1720
2122
|
dir
|
|
1721
2123
|
)) }),
|
|
1722
|
-
/* @__PURE__ */
|
|
1723
|
-
/* @__PURE__ */
|
|
2124
|
+
/* @__PURE__ */ jsx25("div", { className: SELECTOR_DIVIDER }),
|
|
2125
|
+
/* @__PURE__ */ jsx25("div", { className: SELECTOR_GROUP, children: [25, 50, 75, 100].map((pct) => /* @__PURE__ */ jsxs11(
|
|
1724
2126
|
"button",
|
|
1725
2127
|
{
|
|
1726
2128
|
type: "button",
|
|
1727
2129
|
title: `${pct}%`,
|
|
1728
|
-
className:
|
|
2130
|
+
className: cn(
|
|
2131
|
+
SELECTOR_BUTTON,
|
|
2132
|
+
"rte-embed-selector-btn--preset text-[0.75rem] font-medium tabular-nums"
|
|
2133
|
+
),
|
|
1729
2134
|
onClick: () => handleApplyPreset(pct),
|
|
1730
2135
|
children: [
|
|
1731
2136
|
pct,
|
|
@@ -1734,42 +2139,45 @@ var EmbedToolbar = ({
|
|
|
1734
2139
|
},
|
|
1735
2140
|
pct
|
|
1736
2141
|
)) }),
|
|
1737
|
-
/* @__PURE__ */
|
|
1738
|
-
/* @__PURE__ */ jsxs11("div", { className:
|
|
1739
|
-
(videoSrc || nodeSrc) && /* @__PURE__ */
|
|
2142
|
+
/* @__PURE__ */ jsx25("div", { className: SELECTOR_DIVIDER }),
|
|
2143
|
+
/* @__PURE__ */ jsxs11("div", { className: SELECTOR_GROUP, children: [
|
|
2144
|
+
(videoSrc || nodeSrc) && /* @__PURE__ */ jsx25(
|
|
1740
2145
|
"button",
|
|
1741
2146
|
{
|
|
1742
2147
|
type: "button",
|
|
1743
2148
|
title: "Edit URL",
|
|
1744
2149
|
"aria-label": "Edit URL",
|
|
1745
|
-
className:
|
|
2150
|
+
className: SELECTOR_BUTTON,
|
|
1746
2151
|
onClick: () => {
|
|
1747
2152
|
setUrlInput(videoSrc || nodeSrc || "");
|
|
1748
2153
|
setIsEditingUrl(true);
|
|
1749
2154
|
},
|
|
1750
|
-
children: /* @__PURE__ */
|
|
2155
|
+
children: /* @__PURE__ */ jsx25(EditUrlIcon, {})
|
|
1751
2156
|
}
|
|
1752
2157
|
),
|
|
1753
|
-
watchUrl && /* @__PURE__ */
|
|
2158
|
+
watchUrl && /* @__PURE__ */ jsx25(
|
|
1754
2159
|
"button",
|
|
1755
2160
|
{
|
|
1756
2161
|
type: "button",
|
|
1757
2162
|
title: "Open video in YouTube",
|
|
1758
2163
|
"aria-label": "Open video in YouTube",
|
|
1759
|
-
className:
|
|
2164
|
+
className: SELECTOR_BUTTON,
|
|
1760
2165
|
onClick: () => window.open(watchUrl, "_blank"),
|
|
1761
|
-
children: /* @__PURE__ */
|
|
2166
|
+
children: /* @__PURE__ */ jsx25(OpenInYouTubeIcon, {})
|
|
1762
2167
|
}
|
|
1763
2168
|
),
|
|
1764
|
-
deleteNode && /* @__PURE__ */
|
|
2169
|
+
deleteNode && /* @__PURE__ */ jsx25(
|
|
1765
2170
|
"button",
|
|
1766
2171
|
{
|
|
1767
2172
|
type: "button",
|
|
1768
2173
|
title: "Delete Embed",
|
|
1769
2174
|
"aria-label": "Delete Embed",
|
|
1770
|
-
className:
|
|
2175
|
+
className: cn(
|
|
2176
|
+
SELECTOR_BUTTON,
|
|
2177
|
+
"rte-embed-selector-btn--danger hover:bg-destructive/15 hover:text-destructive"
|
|
2178
|
+
),
|
|
1771
2179
|
onClick: () => deleteNode(),
|
|
1772
|
-
children: /* @__PURE__ */
|
|
2180
|
+
children: /* @__PURE__ */ jsx25(DeleteEmbedIcon, {})
|
|
1773
2181
|
}
|
|
1774
2182
|
)
|
|
1775
2183
|
] })
|
|
@@ -1940,10 +2348,10 @@ var ResizableNodeView = ({
|
|
|
1940
2348
|
setIsEditingUrl(false);
|
|
1941
2349
|
};
|
|
1942
2350
|
const isEditable = editor ? editor.isEditable : true;
|
|
1943
|
-
return /* @__PURE__ */
|
|
2351
|
+
return /* @__PURE__ */ jsx25(
|
|
1944
2352
|
NodeViewWrapper,
|
|
1945
2353
|
{
|
|
1946
|
-
className: "rte-embed-wrapper",
|
|
2354
|
+
className: "rte-embed-wrapper group/embed",
|
|
1947
2355
|
"data-selected": selected || void 0,
|
|
1948
2356
|
"data-align": align,
|
|
1949
2357
|
children: /* @__PURE__ */ jsxs11(
|
|
@@ -1959,67 +2367,74 @@ var ResizableNodeView = ({
|
|
|
1959
2367
|
},
|
|
1960
2368
|
children: [
|
|
1961
2369
|
children,
|
|
1962
|
-
selected && isEditable && /* @__PURE__ */
|
|
1963
|
-
|
|
2370
|
+
selected && isEditable && /* @__PURE__ */ jsx25(
|
|
2371
|
+
"div",
|
|
1964
2372
|
{
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
2373
|
+
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%)]",
|
|
2374
|
+
contentEditable: false,
|
|
2375
|
+
children: /* @__PURE__ */ jsx25(
|
|
2376
|
+
EmbedToolbar,
|
|
2377
|
+
{
|
|
2378
|
+
align,
|
|
2379
|
+
videoSrc,
|
|
2380
|
+
watchUrl,
|
|
2381
|
+
deleteNode,
|
|
2382
|
+
inputRef,
|
|
2383
|
+
isEditingUrl,
|
|
2384
|
+
urlInput,
|
|
2385
|
+
setUrlInput,
|
|
2386
|
+
setIsEditingUrl,
|
|
2387
|
+
handleSaveUrl,
|
|
2388
|
+
handleApplyPreset,
|
|
2389
|
+
updateAttributes,
|
|
2390
|
+
nodeSrc: node.attrs.src
|
|
2391
|
+
}
|
|
2392
|
+
)
|
|
1978
2393
|
}
|
|
1979
|
-
)
|
|
1980
|
-
isResizing && currentDimensions && /* @__PURE__ */ jsxs11("div", { className: "rte-embed-resize-badge", children: [
|
|
2394
|
+
),
|
|
2395
|
+
isResizing && currentDimensions && /* @__PURE__ */ jsxs11("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: [
|
|
1981
2396
|
currentDimensions.w,
|
|
1982
2397
|
" \xD7 ",
|
|
1983
2398
|
currentDimensions.h,
|
|
1984
2399
|
" px"
|
|
1985
2400
|
] }),
|
|
1986
|
-
selected && isEditable && /* @__PURE__ */ jsxs11(
|
|
1987
|
-
/* @__PURE__ */
|
|
2401
|
+
selected && isEditable && /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
2402
|
+
/* @__PURE__ */ jsx25(
|
|
1988
2403
|
"div",
|
|
1989
2404
|
{
|
|
1990
|
-
className:
|
|
2405
|
+
className: `${SIDE_HANDLE} rte-resize-handle--left -left-[3px]`,
|
|
1991
2406
|
onMouseDown: (e) => handleMouseDown(e, "left"),
|
|
1992
2407
|
role: "presentation"
|
|
1993
2408
|
}
|
|
1994
2409
|
),
|
|
1995
|
-
/* @__PURE__ */
|
|
2410
|
+
/* @__PURE__ */ jsx25(
|
|
1996
2411
|
"div",
|
|
1997
2412
|
{
|
|
1998
|
-
className:
|
|
2413
|
+
className: `${SIDE_HANDLE} rte-resize-handle--right -right-[3px]`,
|
|
1999
2414
|
onMouseDown: (e) => handleMouseDown(e, "right"),
|
|
2000
2415
|
role: "presentation"
|
|
2001
2416
|
}
|
|
2002
2417
|
),
|
|
2003
|
-
/* @__PURE__ */
|
|
2418
|
+
/* @__PURE__ */ jsx25(
|
|
2004
2419
|
"div",
|
|
2005
2420
|
{
|
|
2006
|
-
className:
|
|
2421
|
+
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`,
|
|
2007
2422
|
onMouseDown: (e) => handleMouseDown(e, "bottom"),
|
|
2008
2423
|
role: "presentation"
|
|
2009
2424
|
}
|
|
2010
2425
|
),
|
|
2011
|
-
/* @__PURE__ */
|
|
2426
|
+
/* @__PURE__ */ jsx25(
|
|
2012
2427
|
"div",
|
|
2013
2428
|
{
|
|
2014
|
-
className:
|
|
2429
|
+
className: `${CORNER_HANDLE} rte-resize-handle--corner-bl -bottom-[5px] -left-[5px] cursor-nesw-resize`,
|
|
2015
2430
|
onMouseDown: (e) => handleMouseDown(e, "corner-bl"),
|
|
2016
2431
|
role: "presentation"
|
|
2017
2432
|
}
|
|
2018
2433
|
),
|
|
2019
|
-
/* @__PURE__ */
|
|
2434
|
+
/* @__PURE__ */ jsx25(
|
|
2020
2435
|
"div",
|
|
2021
2436
|
{
|
|
2022
|
-
className:
|
|
2437
|
+
className: `${CORNER_HANDLE} rte-resize-handle--corner-br -right-[5px] -bottom-[5px] cursor-nwse-resize`,
|
|
2023
2438
|
onMouseDown: (e) => handleMouseDown(e, "corner-br"),
|
|
2024
2439
|
role: "presentation"
|
|
2025
2440
|
}
|
|
@@ -2033,7 +2448,7 @@ var ResizableNodeView = ({
|
|
|
2033
2448
|
};
|
|
2034
2449
|
|
|
2035
2450
|
// src/controls/rte-twitter-control.tsx
|
|
2036
|
-
import { jsx as
|
|
2451
|
+
import { jsx as jsx26, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2037
2452
|
var WIDGET_SCRIPT_URL = "https://platform.twitter.com/widgets.js";
|
|
2038
2453
|
var SCRIPT_LOAD_TIMEOUT_MS = 8e3;
|
|
2039
2454
|
var READY_POLL_INTERVAL_MS = 50;
|
|
@@ -2188,12 +2603,12 @@ var TwitterNodeView = (props) => {
|
|
|
2188
2603
|
minWidth: 300,
|
|
2189
2604
|
maxWidth: 1200,
|
|
2190
2605
|
children: [
|
|
2191
|
-
loading && /* @__PURE__ */
|
|
2606
|
+
loading && /* @__PURE__ */ jsx26("div", { className: "rte-embed-loading animate-pulse", children: "Loading tweet..." }),
|
|
2192
2607
|
!loading && failed && /* @__PURE__ */ jsxs12("div", { className: "rte-embed-error", children: [
|
|
2193
|
-
/* @__PURE__ */
|
|
2194
|
-
/* @__PURE__ */
|
|
2608
|
+
/* @__PURE__ */ jsx26("p", { children: "Couldn't load this tweet." }),
|
|
2609
|
+
/* @__PURE__ */ jsx26("button", { type: "button", onClick: handleRetry, children: "Retry" })
|
|
2195
2610
|
] }),
|
|
2196
|
-
/* @__PURE__ */
|
|
2611
|
+
/* @__PURE__ */ jsx26("div", { ref: containerRef })
|
|
2197
2612
|
]
|
|
2198
2613
|
}
|
|
2199
2614
|
);
|
|
@@ -2332,24 +2747,24 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2332
2747
|
}
|
|
2333
2748
|
},
|
|
2334
2749
|
children: [
|
|
2335
|
-
/* @__PURE__ */
|
|
2750
|
+
/* @__PURE__ */ jsx26(
|
|
2336
2751
|
DialogTrigger,
|
|
2337
2752
|
{
|
|
2338
|
-
render: /* @__PURE__ */
|
|
2753
|
+
render: /* @__PURE__ */ jsx26(
|
|
2339
2754
|
RichTextEditorControl,
|
|
2340
2755
|
{
|
|
2341
2756
|
active,
|
|
2342
2757
|
className,
|
|
2343
2758
|
title: "Embed Tweet",
|
|
2344
2759
|
"aria-label": "Embed Tweet",
|
|
2345
|
-
children: /* @__PURE__ */
|
|
2760
|
+
children: /* @__PURE__ */ jsx26(
|
|
2346
2761
|
"svg",
|
|
2347
2762
|
{
|
|
2348
2763
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2349
2764
|
viewBox: "0 0 24 24",
|
|
2350
2765
|
fill: "currentColor",
|
|
2351
2766
|
className: "rte-editor-icon",
|
|
2352
|
-
children: /* @__PURE__ */
|
|
2767
|
+
children: /* @__PURE__ */ jsx26("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" })
|
|
2353
2768
|
}
|
|
2354
2769
|
)
|
|
2355
2770
|
}
|
|
@@ -2358,10 +2773,10 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2358
2773
|
),
|
|
2359
2774
|
/* @__PURE__ */ jsxs12(DialogContent, { children: [
|
|
2360
2775
|
/* @__PURE__ */ jsxs12(DialogHeader, { children: [
|
|
2361
|
-
/* @__PURE__ */
|
|
2362
|
-
/* @__PURE__ */
|
|
2776
|
+
/* @__PURE__ */ jsx26(DialogTitle, { children: "Embed Tweet" }),
|
|
2777
|
+
/* @__PURE__ */ jsx26(DialogDescription, { children: "Paste a tweet URL or ID." })
|
|
2363
2778
|
] }),
|
|
2364
|
-
/* @__PURE__ */
|
|
2779
|
+
/* @__PURE__ */ jsx26(
|
|
2365
2780
|
Input,
|
|
2366
2781
|
{
|
|
2367
2782
|
value: url,
|
|
@@ -2381,10 +2796,10 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2381
2796
|
}
|
|
2382
2797
|
}
|
|
2383
2798
|
),
|
|
2384
|
-
showError && /* @__PURE__ */
|
|
2799
|
+
showError && /* @__PURE__ */ jsx26("p", { className: "rte-input-error", role: "alert", children: "That doesn't look like a valid tweet URL or ID." }),
|
|
2385
2800
|
/* @__PURE__ */ jsxs12(DialogFooter, { children: [
|
|
2386
|
-
/* @__PURE__ */
|
|
2387
|
-
/* @__PURE__ */
|
|
2801
|
+
/* @__PURE__ */ jsx26(DialogClose, { children: "Cancel" }),
|
|
2802
|
+
/* @__PURE__ */ jsx26(
|
|
2388
2803
|
"button",
|
|
2389
2804
|
{
|
|
2390
2805
|
type: "button",
|
|
@@ -2414,7 +2829,7 @@ import {
|
|
|
2414
2829
|
} from "@tiptap/core";
|
|
2415
2830
|
import { ReactNodeViewRenderer as ReactNodeViewRenderer2, useEditorState as useEditorState5 } from "@tiptap/react";
|
|
2416
2831
|
import { useState as useState6, useCallback as useCallback7 } from "react";
|
|
2417
|
-
import { jsx as
|
|
2832
|
+
import { jsx as jsx27, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2418
2833
|
var getYouTubeId = (url) => {
|
|
2419
2834
|
const clean = url.trim();
|
|
2420
2835
|
const patterns = [
|
|
@@ -2442,7 +2857,7 @@ var YouTubeNodeView = (props) => {
|
|
|
2442
2857
|
if (videoId) {
|
|
2443
2858
|
watchUrl = videoId.startsWith("http") ? videoId : `https://www.youtube.com/watch?v=${videoId}`;
|
|
2444
2859
|
}
|
|
2445
|
-
return /* @__PURE__ */
|
|
2860
|
+
return /* @__PURE__ */ jsx27(
|
|
2446
2861
|
ResizableNodeView,
|
|
2447
2862
|
{
|
|
2448
2863
|
...props,
|
|
@@ -2453,7 +2868,7 @@ var YouTubeNodeView = (props) => {
|
|
|
2453
2868
|
videoSrc: rawSrc,
|
|
2454
2869
|
watchUrl,
|
|
2455
2870
|
onSrcChange: (newSrc) => updateAttributes({ src: newSrc }),
|
|
2456
|
-
children: /* @__PURE__ */
|
|
2871
|
+
children: /* @__PURE__ */ jsx27(
|
|
2457
2872
|
"iframe",
|
|
2458
2873
|
{
|
|
2459
2874
|
src: `https://www.youtube-nocookie.com/embed/${videoId}`,
|
|
@@ -2570,10 +2985,10 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
2570
2985
|
}
|
|
2571
2986
|
}, [url, editor]);
|
|
2572
2987
|
return /* @__PURE__ */ jsxs13(Dialog, { open, onOpenChange: setOpen, children: [
|
|
2573
|
-
/* @__PURE__ */
|
|
2988
|
+
/* @__PURE__ */ jsx27(
|
|
2574
2989
|
DialogTrigger,
|
|
2575
2990
|
{
|
|
2576
|
-
render: /* @__PURE__ */
|
|
2991
|
+
render: /* @__PURE__ */ jsx27(
|
|
2577
2992
|
RichTextEditorControl,
|
|
2578
2993
|
{
|
|
2579
2994
|
active,
|
|
@@ -2592,8 +3007,8 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
2592
3007
|
strokeLinejoin: "round",
|
|
2593
3008
|
className: "rte-editor-icon",
|
|
2594
3009
|
children: [
|
|
2595
|
-
/* @__PURE__ */
|
|
2596
|
-
/* @__PURE__ */
|
|
3010
|
+
/* @__PURE__ */ jsx27("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" }),
|
|
3011
|
+
/* @__PURE__ */ jsx27("path", { d: "M9.5 15.5V8.5l6.2 3.5z" })
|
|
2597
3012
|
]
|
|
2598
3013
|
}
|
|
2599
3014
|
)
|
|
@@ -2603,10 +3018,10 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
2603
3018
|
),
|
|
2604
3019
|
/* @__PURE__ */ jsxs13(DialogContent, { showCloseButton: false, children: [
|
|
2605
3020
|
/* @__PURE__ */ jsxs13(DialogHeader, { children: [
|
|
2606
|
-
/* @__PURE__ */
|
|
2607
|
-
/* @__PURE__ */
|
|
3021
|
+
/* @__PURE__ */ jsx27(DialogTitle, { children: "Embed YouTube video" }),
|
|
3022
|
+
/* @__PURE__ */ jsx27(DialogDescription, { children: "Paste a YouTube video URL or ID." })
|
|
2608
3023
|
] }),
|
|
2609
|
-
/* @__PURE__ */
|
|
3024
|
+
/* @__PURE__ */ jsx27(
|
|
2610
3025
|
Input,
|
|
2611
3026
|
{
|
|
2612
3027
|
value: url,
|
|
@@ -2621,8 +3036,8 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
2621
3036
|
}
|
|
2622
3037
|
),
|
|
2623
3038
|
/* @__PURE__ */ jsxs13(DialogFooter, { children: [
|
|
2624
|
-
/* @__PURE__ */
|
|
2625
|
-
/* @__PURE__ */
|
|
3039
|
+
/* @__PURE__ */ jsx27(DialogClose, { children: "Cancel" }),
|
|
3040
|
+
/* @__PURE__ */ jsx27(
|
|
2626
3041
|
DialogClose,
|
|
2627
3042
|
{
|
|
2628
3043
|
disabled: !url,
|
|
@@ -2679,18 +3094,23 @@ var DEFAULT_LABELS = {
|
|
|
2679
3094
|
|
|
2680
3095
|
// src/rte-content.tsx
|
|
2681
3096
|
import { EditorContent } from "@tiptap/react";
|
|
2682
|
-
import { jsx as
|
|
3097
|
+
import { jsx as jsx28, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2683
3098
|
var Content = ({
|
|
2684
3099
|
children,
|
|
2685
3100
|
className
|
|
2686
3101
|
}) => {
|
|
2687
|
-
const { editor } = useRichTextEditorContext();
|
|
3102
|
+
const { editor, preset, variant } = useRichTextEditorContext();
|
|
2688
3103
|
return /* @__PURE__ */ jsxs14("div", { className: "relative", children: [
|
|
2689
|
-
/* @__PURE__ */
|
|
3104
|
+
/* @__PURE__ */ jsx28(
|
|
2690
3105
|
EditorContent,
|
|
2691
3106
|
{
|
|
2692
3107
|
editor,
|
|
2693
|
-
className: cn(
|
|
3108
|
+
className: cn(
|
|
3109
|
+
"rte-content editorcn-content w-full",
|
|
3110
|
+
variant === "default" && "rounded-lg border border-(--rte-hairline) bg-[var(--card,var(--background))]",
|
|
3111
|
+
className
|
|
3112
|
+
),
|
|
3113
|
+
"data-preset": preset,
|
|
2694
3114
|
spellCheck: false
|
|
2695
3115
|
}
|
|
2696
3116
|
),
|
|
@@ -2699,15 +3119,36 @@ var Content = ({
|
|
|
2699
3119
|
};
|
|
2700
3120
|
|
|
2701
3121
|
// src/rte-controls-group.tsx
|
|
2702
|
-
import {
|
|
3122
|
+
import { useContext as useContext3 } from "react";
|
|
3123
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
3124
|
+
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-['']";
|
|
3125
|
+
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";
|
|
3126
|
+
var variantClasses = {
|
|
3127
|
+
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`,
|
|
3128
|
+
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`,
|
|
3129
|
+
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`
|
|
3130
|
+
};
|
|
2703
3131
|
var ControlsGroup = ({
|
|
2704
3132
|
children,
|
|
2705
3133
|
className
|
|
2706
|
-
}) =>
|
|
3134
|
+
}) => {
|
|
3135
|
+
const variant = useContext3(RichTextEditorContext)?.variant;
|
|
3136
|
+
return /* @__PURE__ */ jsx29(
|
|
3137
|
+
"div",
|
|
3138
|
+
{
|
|
3139
|
+
className: cn(
|
|
3140
|
+
"rte-controls-group flex items-center empty:hidden",
|
|
3141
|
+
variant && variantClasses[variant],
|
|
3142
|
+
className
|
|
3143
|
+
),
|
|
3144
|
+
children
|
|
3145
|
+
}
|
|
3146
|
+
);
|
|
3147
|
+
};
|
|
2707
3148
|
|
|
2708
3149
|
// src/rte-footer.tsx
|
|
2709
3150
|
import { useEffect as useEffect5, useMemo, useRef as useRef5, useState as useState7 } from "react";
|
|
2710
|
-
import { Fragment as
|
|
3151
|
+
import { Fragment as Fragment5, jsx as jsx30, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2711
3152
|
var Footer = ({
|
|
2712
3153
|
children,
|
|
2713
3154
|
className,
|
|
@@ -2770,31 +3211,42 @@ var Footer = ({
|
|
|
2770
3211
|
"div",
|
|
2771
3212
|
{
|
|
2772
3213
|
className: cn(
|
|
2773
|
-
"rte-footer",
|
|
3214
|
+
"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",
|
|
2774
3215
|
variant !== "default" && `rte-footer--${variant}`,
|
|
2775
|
-
|
|
3216
|
+
variant === "default" && "min-h-8 rounded-none border-t-0 bg-transparent px-2 pt-1 pb-0",
|
|
3217
|
+
variant === "compact" && "rounded-none last:rounded-es-[calc(var(--radius)-1px)] last:rounded-ee-[calc(var(--radius)-1px)]",
|
|
3218
|
+
sticky && "sticky bottom-0 bg-[color-mix(in_srgb,var(--rte-strip)_80%,transparent)] backdrop-blur-lg",
|
|
2776
3219
|
className
|
|
2777
3220
|
),
|
|
2778
3221
|
"data-sticky": sticky ? "" : void 0,
|
|
2779
3222
|
style: sticky ? { bottom: stickyOffset } : void 0,
|
|
2780
3223
|
children: [
|
|
2781
|
-
showWordCount && wordCount && /* @__PURE__ */
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
{
|
|
2789
|
-
className: "rte-footer-word-count-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
3224
|
+
showWordCount && wordCount && /* @__PURE__ */ jsx30(
|
|
3225
|
+
"span",
|
|
3226
|
+
{
|
|
3227
|
+
className: cn(
|
|
3228
|
+
"rte-footer-word-count inline-flex items-center gap-1.5 text-[0.75rem] whitespace-nowrap",
|
|
3229
|
+
wordCountClassName
|
|
3230
|
+
),
|
|
3231
|
+
children: wordCountFormatter ? wordCountFormatter(wordCount) : /* @__PURE__ */ jsxs15(Fragment5, { children: [
|
|
3232
|
+
/* @__PURE__ */ jsxs15("span", { className: "rte-footer-word-count-stat inline-flex items-baseline gap-1", children: [
|
|
3233
|
+
/* @__PURE__ */ jsx30("span", { className: "rte-footer-word-count-number font-medium text-foreground tabular-nums", children: wordCount.words }),
|
|
3234
|
+
/* @__PURE__ */ jsx30("span", { className: "rte-footer-word-count-unit text-muted-foreground", children: "words" })
|
|
3235
|
+
] }),
|
|
3236
|
+
/* @__PURE__ */ jsx30(
|
|
3237
|
+
"span",
|
|
3238
|
+
{
|
|
3239
|
+
className: "rte-footer-word-count-separator size-[3px] shrink-0 rounded-full bg-[color-mix(in_srgb,var(--muted-foreground)_45%,transparent)]",
|
|
3240
|
+
"aria-hidden": "true"
|
|
3241
|
+
}
|
|
3242
|
+
),
|
|
3243
|
+
/* @__PURE__ */ jsxs15("span", { className: "rte-footer-word-count-stat inline-flex items-baseline gap-1", children: [
|
|
3244
|
+
/* @__PURE__ */ jsx30("span", { className: "rte-footer-word-count-number font-medium text-foreground tabular-nums", children: wordCount.characters }),
|
|
3245
|
+
/* @__PURE__ */ jsx30("span", { className: "rte-footer-word-count-unit text-muted-foreground", children: "characters" })
|
|
3246
|
+
] })
|
|
3247
|
+
] })
|
|
3248
|
+
}
|
|
3249
|
+
),
|
|
2798
3250
|
children
|
|
2799
3251
|
]
|
|
2800
3252
|
}
|
|
@@ -2802,7 +3254,7 @@ var Footer = ({
|
|
|
2802
3254
|
};
|
|
2803
3255
|
|
|
2804
3256
|
// src/rte-toolbar.tsx
|
|
2805
|
-
import { jsx as
|
|
3257
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
2806
3258
|
var Toolbar = ({
|
|
2807
3259
|
children,
|
|
2808
3260
|
className,
|
|
@@ -2813,13 +3265,18 @@ var Toolbar = ({
|
|
|
2813
3265
|
if (!editable) {
|
|
2814
3266
|
return null;
|
|
2815
3267
|
}
|
|
2816
|
-
return /* @__PURE__ */
|
|
3268
|
+
return /* @__PURE__ */ jsx31(
|
|
2817
3269
|
"div",
|
|
2818
3270
|
{
|
|
2819
3271
|
className: cn(
|
|
2820
|
-
"rte-toolbar",
|
|
3272
|
+
"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]",
|
|
3273
|
+
"[@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)]",
|
|
2821
3274
|
variant !== "default" && `rte-toolbar--${variant}`,
|
|
2822
|
-
|
|
3275
|
+
variant === "default" && "gap-1 rounded-none border-b-0 bg-transparent px-0 pt-0 pb-1",
|
|
3276
|
+
variant === "subtle" && "gap-1 px-1.5 py-1",
|
|
3277
|
+
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)]",
|
|
3278
|
+
sticky && "sticky bg-[color-mix(in_srgb,var(--rte-strip)_80%,transparent)] backdrop-blur-lg",
|
|
3279
|
+
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",
|
|
2823
3280
|
className
|
|
2824
3281
|
),
|
|
2825
3282
|
"data-sticky": sticky ? "" : void 0,
|
|
@@ -2830,7 +3287,7 @@ var Toolbar = ({
|
|
|
2830
3287
|
};
|
|
2831
3288
|
|
|
2832
3289
|
// src/rte-text-editor.tsx
|
|
2833
|
-
import { jsx as
|
|
3290
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
2834
3291
|
var RichTextEditorRoot = ({
|
|
2835
3292
|
editor,
|
|
2836
3293
|
children,
|
|
@@ -2838,6 +3295,7 @@ var RichTextEditorRoot = ({
|
|
|
2838
3295
|
labels,
|
|
2839
3296
|
icons,
|
|
2840
3297
|
variant = "default",
|
|
3298
|
+
preset = "document",
|
|
2841
3299
|
editable = true
|
|
2842
3300
|
}) => {
|
|
2843
3301
|
const mergedLabels = useMemo2(
|
|
@@ -2845,13 +3303,13 @@ var RichTextEditorRoot = ({
|
|
|
2845
3303
|
[labels]
|
|
2846
3304
|
);
|
|
2847
3305
|
const mergedIcons = useMemo2(() => ({ ...DEFAULT_ICONS, ...icons }), [icons]);
|
|
2848
|
-
const [tooltip] = useState8(
|
|
3306
|
+
const [tooltip] = useState8(createTooltipHandle);
|
|
2849
3307
|
useEffect6(() => {
|
|
2850
3308
|
if (editor && editor.isEditable !== editable) {
|
|
2851
3309
|
editor.setEditable(editable);
|
|
2852
3310
|
}
|
|
2853
3311
|
}, [editor, editable]);
|
|
2854
|
-
return /* @__PURE__ */
|
|
3312
|
+
return /* @__PURE__ */ jsx32(
|
|
2855
3313
|
RichTextEditorContext.Provider,
|
|
2856
3314
|
{
|
|
2857
3315
|
value: {
|
|
@@ -2859,22 +3317,22 @@ var RichTextEditorRoot = ({
|
|
|
2859
3317
|
editor,
|
|
2860
3318
|
icons: mergedIcons,
|
|
2861
3319
|
labels: mergedLabels,
|
|
3320
|
+
preset,
|
|
2862
3321
|
tooltip,
|
|
2863
3322
|
variant
|
|
2864
3323
|
},
|
|
2865
|
-
children: /* @__PURE__ */
|
|
3324
|
+
children: /* @__PURE__ */ jsx32(
|
|
2866
3325
|
"div",
|
|
2867
3326
|
{
|
|
2868
3327
|
className: cn(
|
|
2869
|
-
"rte-root",
|
|
3328
|
+
"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",
|
|
3329
|
+
variant === "default" && "bg-(--rte-strip) p-1",
|
|
2870
3330
|
variant !== "default" && `rte-root--${variant}`,
|
|
3331
|
+
variant === "compact" && "rounded-lg data-[variant=compact]:[&_.rte-editor-icon]:size-3.5",
|
|
2871
3332
|
className
|
|
2872
3333
|
),
|
|
2873
3334
|
"data-variant": variant,
|
|
2874
|
-
children: /* @__PURE__ */
|
|
2875
|
-
children,
|
|
2876
|
-
/* @__PURE__ */ jsx31(Tooltip, { handle: tooltip, children: ({ payload }) => /* @__PURE__ */ jsx31(TooltipContent, { side: "bottom", children: payload }) })
|
|
2877
|
-
] })
|
|
3335
|
+
children: /* @__PURE__ */ jsx32(TooltipProvider, { children: /* @__PURE__ */ jsx32(TooltipHost, { handle: tooltip, side: "bottom", children }) })
|
|
2878
3336
|
}
|
|
2879
3337
|
)
|
|
2880
3338
|
}
|