@editorcn/editor 0.3.2 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6,24 +6,541 @@ import { isTextSelection } from "@tiptap/core";
6
6
  import { BubbleMenu as TiptapBubbleMenu } from "@tiptap/react/menus";
7
7
  import { useCallback as useCallback3 } from "react";
8
8
 
9
- // src/bubble-menu/language-selector.tsx
10
- import { useCallback as useCallback2, useState } from "react";
9
+ // src/ui/button.tsx
10
+ import { Button as ButtonPrimitive } from "@base-ui/react/button";
11
+ import { cva } from "class-variance-authority";
11
12
 
12
- // src/rte-context.ts
13
- import { createContext, useContext } from "react";
14
- var RichTextEditorContext = createContext(null);
15
- var useRichTextEditorContext = () => {
16
- const context = useContext(RichTextEditorContext);
17
- if (!context) {
18
- throw new Error(
19
- "useRichTextEditorContext must be used within RichTextEditor"
13
+ // src/ui/utils.ts
14
+ import { clsx } from "clsx";
15
+ import { twMerge } from "tailwind-merge";
16
+ var cn = (...inputs) => twMerge(clsx(inputs));
17
+
18
+ // src/ui/button.tsx
19
+ import { jsx } from "react/jsx-runtime";
20
+ var buttonVariants = cva(
21
+ "group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
22
+ {
23
+ defaultVariants: {
24
+ size: "default",
25
+ variant: "default"
26
+ },
27
+ variants: {
28
+ size: {
29
+ default: "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
30
+ icon: "size-8",
31
+ "icon-lg": "size-9",
32
+ "icon-sm": "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
33
+ "icon-xs": "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
34
+ lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
35
+ sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
36
+ xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3"
37
+ },
38
+ variant: {
39
+ default: "bg-primary text-primary-foreground hover:bg-primary/80",
40
+ destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
41
+ ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
42
+ link: "text-primary underline-offset-4 hover:underline",
43
+ outline: "border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
44
+ secondary: "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground"
45
+ }
46
+ }
47
+ }
48
+ );
49
+ var Button = ({
50
+ className,
51
+ variant = "default",
52
+ size = "default",
53
+ ...props
54
+ }) => /* @__PURE__ */ jsx(
55
+ ButtonPrimitive,
56
+ {
57
+ "data-slot": "button",
58
+ className: cn(buttonVariants({ className, size, variant })),
59
+ ...props
60
+ }
61
+ );
62
+
63
+ // src/ui/dialog.tsx
64
+ import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
65
+ import "react";
66
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
67
+ var Dialog = ({ ...props }) => /* @__PURE__ */ jsx2(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
68
+ var DialogTrigger = ({ ...props }) => /* @__PURE__ */ jsx2(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
69
+ var DialogPortal = ({ ...props }) => /* @__PURE__ */ jsx2(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
70
+ var DialogClose = ({ ...props }) => /* @__PURE__ */ jsx2(DialogPrimitive.Close, { "data-slot": "dialog-close", ...props });
71
+ var DialogOverlay = ({
72
+ className,
73
+ ...props
74
+ }) => /* @__PURE__ */ jsx2(
75
+ DialogPrimitive.Backdrop,
76
+ {
77
+ "data-slot": "dialog-overlay",
78
+ className: cn(
79
+ "fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
80
+ className
81
+ ),
82
+ ...props
83
+ }
84
+ );
85
+ var DialogContent = ({
86
+ className,
87
+ children,
88
+ showCloseButton = true,
89
+ ...props
90
+ }) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
91
+ /* @__PURE__ */ jsx2(DialogOverlay, {}),
92
+ /* @__PURE__ */ jsxs(
93
+ DialogPrimitive.Popup,
94
+ {
95
+ "data-slot": "dialog-content",
96
+ className: cn(
97
+ "fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-none bg-popover p-4 text-xs/relaxed text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
98
+ className
99
+ ),
100
+ ...props,
101
+ children: [
102
+ children,
103
+ showCloseButton && /* @__PURE__ */ jsxs(
104
+ DialogPrimitive.Close,
105
+ {
106
+ "data-slot": "dialog-close",
107
+ render: /* @__PURE__ */ jsx2(
108
+ Button,
109
+ {
110
+ variant: "ghost",
111
+ className: "absolute top-2 right-2",
112
+ size: "icon-sm"
113
+ }
114
+ ),
115
+ children: [
116
+ "X",
117
+ /* @__PURE__ */ jsx2("span", { className: "sr-only", children: "Close" })
118
+ ]
119
+ }
120
+ )
121
+ ]
122
+ }
123
+ )
124
+ ] });
125
+ var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx2(
126
+ "div",
127
+ {
128
+ "data-slot": "dialog-header",
129
+ className: cn("flex flex-col gap-1 text-left", className),
130
+ ...props
131
+ }
132
+ );
133
+ var DialogFooter = ({
134
+ className,
135
+ showCloseButton = false,
136
+ children,
137
+ ...props
138
+ }) => /* @__PURE__ */ jsxs(
139
+ "div",
140
+ {
141
+ "data-slot": "dialog-footer",
142
+ className: cn(
143
+ "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
144
+ className
145
+ ),
146
+ ...props,
147
+ children: [
148
+ children,
149
+ showCloseButton && /* @__PURE__ */ jsx2(DialogPrimitive.Close, { render: /* @__PURE__ */ jsx2(Button, { variant: "outline" }), children: "Close" })
150
+ ]
151
+ }
152
+ );
153
+ var DialogTitle = ({ className, ...props }) => /* @__PURE__ */ jsx2(
154
+ DialogPrimitive.Title,
155
+ {
156
+ "data-slot": "dialog-title",
157
+ className: cn("text-sm font-medium", className),
158
+ ...props
159
+ }
160
+ );
161
+ var DialogDescription = ({
162
+ className,
163
+ ...props
164
+ }) => /* @__PURE__ */ jsx2(
165
+ DialogPrimitive.Description,
166
+ {
167
+ "data-slot": "dialog-description",
168
+ className: cn(
169
+ "text-xs/relaxed text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",
170
+ className
171
+ ),
172
+ ...props
173
+ }
174
+ );
175
+
176
+ // src/ui/input.tsx
177
+ import { Input as InputPrimitive } from "@base-ui/react/input";
178
+ import "react";
179
+ import { jsx as jsx3 } from "react/jsx-runtime";
180
+ var Input = ({
181
+ className,
182
+ type,
183
+ ...props
184
+ }) => /* @__PURE__ */ jsx3(
185
+ InputPrimitive,
186
+ {
187
+ type,
188
+ "data-slot": "input",
189
+ className: cn(
190
+ "h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
191
+ className
192
+ ),
193
+ ...props
194
+ }
195
+ );
196
+
197
+ // src/ui/popover.tsx
198
+ import { Popover as PopoverPrimitive } from "@base-ui/react/popover";
199
+ import "react";
200
+ import { jsx as jsx4 } from "react/jsx-runtime";
201
+ var Popover = ({ ...props }) => /* @__PURE__ */ jsx4(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
202
+ var PopoverTrigger = ({ ...props }) => /* @__PURE__ */ jsx4(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
203
+ var PopoverContent = ({
204
+ className,
205
+ align = "center",
206
+ alignOffset = 0,
207
+ side = "bottom",
208
+ sideOffset = 4,
209
+ ...props
210
+ }) => /* @__PURE__ */ jsx4(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx4(
211
+ PopoverPrimitive.Positioner,
212
+ {
213
+ align,
214
+ alignOffset,
215
+ side,
216
+ sideOffset,
217
+ className: "isolate z-50",
218
+ children: /* @__PURE__ */ jsx4(
219
+ PopoverPrimitive.Popup,
220
+ {
221
+ "data-slot": "popover-content",
222
+ className: cn(
223
+ "z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-none bg-popover p-2.5 text-xs text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
224
+ className
225
+ ),
226
+ ...props
227
+ }
228
+ )
229
+ }
230
+ ) });
231
+
232
+ // src/ui/rte-button.tsx
233
+ import * as React4 from "react";
234
+ import { jsx as jsx5 } from "react/jsx-runtime";
235
+ var RteButton = React4.forwardRef(
236
+ ({ className = "", active = false, ...props }, ref) => {
237
+ const cls = [
238
+ "rte-bubble-btn",
239
+ active ? "rte-bubble-btn--active" : "",
240
+ className
241
+ ].filter(Boolean).join(" ");
242
+ return /* @__PURE__ */ jsx5("button", { ref, type: "button", className: cls, ...props });
243
+ }
244
+ );
245
+ RteButton.displayName = "RteButton";
246
+
247
+ // src/ui/rte-button-group.tsx
248
+ import * as React5 from "react";
249
+ import { jsx as jsx6 } from "react/jsx-runtime";
250
+ var RteButtonGroup = React5.forwardRef(
251
+ ({ className = "", ...props }, ref) => /* @__PURE__ */ jsx6(
252
+ "div",
253
+ {
254
+ ref,
255
+ className: `rte-bubble-group ${className}`.trim(),
256
+ ...props
257
+ }
258
+ )
259
+ );
260
+ RteButtonGroup.displayName = "RteButtonGroup";
261
+
262
+ // src/ui/rte-icon.tsx
263
+ import * as React6 from "react";
264
+ import { jsx as jsx7 } from "react/jsx-runtime";
265
+ var RteIcon = React6.forwardRef(
266
+ ({ className = "", ...props }, ref) => /* @__PURE__ */ jsx7(
267
+ "span",
268
+ {
269
+ ref,
270
+ className: `rte-bubble-btn-icon ${className}`.trim(),
271
+ ...props
272
+ }
273
+ )
274
+ );
275
+ RteIcon.displayName = "RteIcon";
276
+
277
+ // src/ui/rte-separator.tsx
278
+ import * as React7 from "react";
279
+ import { jsx as jsx8 } from "react/jsx-runtime";
280
+ var RteSeparator = React7.forwardRef(
281
+ ({ className = "", ...props }, ref) => /* @__PURE__ */ jsx8(
282
+ "div",
283
+ {
284
+ ref,
285
+ className: `rte-bubble-separator ${className}`.trim(),
286
+ ...props
287
+ }
288
+ )
289
+ );
290
+ RteSeparator.displayName = "RteSeparator";
291
+
292
+ // src/ui/rte-overlay.tsx
293
+ import * as React8 from "react";
294
+ import { jsx as jsx9 } from "react/jsx-runtime";
295
+ var RteOverlay = React8.forwardRef(
296
+ ({ className = "", ...props }, ref) => /* @__PURE__ */ jsx9(
297
+ "div",
298
+ {
299
+ ref,
300
+ role: "presentation",
301
+ className: `rte-bubble-overlay ${className}`.trim(),
302
+ ...props
303
+ }
304
+ )
305
+ );
306
+ RteOverlay.displayName = "RteOverlay";
307
+
308
+ // src/ui/rte-dropdown.tsx
309
+ import * as React9 from "react";
310
+ import { useCallback, useRef, useState } from "react";
311
+ import { jsx as jsx10, jsxs as jsxs2 } from "react/jsx-runtime";
312
+ var variantClass = {
313
+ color: "rte-bubble-dropdown--color",
314
+ default: "",
315
+ language: "rte-bubble-dropdown--language"
316
+ };
317
+ var RteDropdown = React9.forwardRef(
318
+ ({ className = "", variant = "default", children, onMouseLeave, ...props }, ref) => {
319
+ const containerRef = useRef(null);
320
+ const [pill, setPill] = useState(null);
321
+ const handleItemEnter = useCallback((target) => {
322
+ const item = target.closest(
323
+ "[data-dropdown-item]"
324
+ );
325
+ if (!item) {
326
+ return;
327
+ }
328
+ setPill({
329
+ height: item.offsetHeight,
330
+ left: item.offsetLeft,
331
+ top: item.offsetTop,
332
+ width: item.offsetWidth
333
+ });
334
+ }, []);
335
+ const handleMouseOver = useCallback(
336
+ (event) => {
337
+ handleItemEnter(event.target);
338
+ },
339
+ [handleItemEnter]
340
+ );
341
+ const handleFocus = useCallback(
342
+ (event) => {
343
+ handleItemEnter(event.target);
344
+ },
345
+ [handleItemEnter]
346
+ );
347
+ const handleMouseLeaveFn = useCallback(
348
+ (event) => {
349
+ setPill(null);
350
+ onMouseLeave?.(event);
351
+ },
352
+ [onMouseLeave]
353
+ );
354
+ const cls = ["rte-bubble-dropdown", variantClass[variant], className].filter(Boolean).join(" ");
355
+ return /* @__PURE__ */ jsxs2(
356
+ "div",
357
+ {
358
+ ref: (node) => {
359
+ containerRef.current = node;
360
+ if (typeof ref === "function") {
361
+ ref(node);
362
+ } else if (ref) {
363
+ ref.current = node;
364
+ }
365
+ },
366
+ className: cls,
367
+ onFocus: handleFocus,
368
+ onMouseLeave: handleMouseLeaveFn,
369
+ onMouseOver: handleMouseOver,
370
+ ...props,
371
+ children: [
372
+ /* @__PURE__ */ jsx10(
373
+ "div",
374
+ {
375
+ "aria-hidden": "true",
376
+ className: [
377
+ "rte-bubble-dropdown-pill",
378
+ pill ? "rte-bubble-dropdown-pill--visible" : ""
379
+ ].filter(Boolean).join(" "),
380
+ style: pill ? {
381
+ height: pill.height,
382
+ left: pill.left,
383
+ top: pill.top,
384
+ width: pill.width
385
+ } : void 0
386
+ }
387
+ ),
388
+ children
389
+ ]
390
+ }
20
391
  );
21
392
  }
22
- return context;
393
+ );
394
+ RteDropdown.displayName = "RteDropdown";
395
+
396
+ // src/ui/rte-color-swatch.tsx
397
+ import * as React10 from "react";
398
+ import { jsx as jsx11, jsxs as jsxs3 } from "react/jsx-runtime";
399
+ var getCheckColor = (hex) => {
400
+ const value = hex.replace("#", "");
401
+ const r = Number.parseInt(value.slice(0, 2), 16) / 255;
402
+ const g = Number.parseInt(value.slice(2, 4), 16) / 255;
403
+ const b = Number.parseInt(value.slice(4, 6), 16) / 255;
404
+ const luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b;
405
+ return luminance > 0.5 ? "#18181b" : "#ffffff";
23
406
  };
407
+ var RteColorSwatch = React10.forwardRef(
408
+ ({ color, label, variant, active = false, onSelect }, ref) => {
409
+ const checkColor = getCheckColor(color);
410
+ return /* @__PURE__ */ jsxs3(
411
+ "button",
412
+ {
413
+ ref,
414
+ type: "button",
415
+ "aria-pressed": active,
416
+ "aria-label": label,
417
+ title: label,
418
+ className: [
419
+ "rte-bubble-color-swatch",
420
+ variant === "text" ? "rte-bubble-color-swatch--text" : "rte-bubble-color-swatch--highlight",
421
+ active ? "rte-bubble-color-swatch--active" : ""
422
+ ].filter(Boolean).join(" "),
423
+ style: {
424
+ "--swatch-check": checkColor,
425
+ "--swatch-color": color
426
+ },
427
+ onMouseDown: (e) => e.preventDefault(),
428
+ onClick: () => onSelect(color),
429
+ children: [
430
+ variant === "text" && !active ? /* @__PURE__ */ jsx11("span", { className: "rte-bubble-color-glyph", "aria-hidden": "true", children: "A" }) : null,
431
+ active ? /* @__PURE__ */ jsx11("span", { className: "rte-bubble-color-check", "aria-hidden": "true", children: /* @__PURE__ */ jsx11(
432
+ "svg",
433
+ {
434
+ xmlns: "http://www.w3.org/2000/svg",
435
+ viewBox: "0 0 24 24",
436
+ fill: "none",
437
+ stroke: "currentColor",
438
+ strokeWidth: 3,
439
+ strokeLinecap: "round",
440
+ strokeLinejoin: "round",
441
+ children: /* @__PURE__ */ jsx11("path", { d: "M20 6 9 17l-5-5" })
442
+ }
443
+ ) }) : null
444
+ ]
445
+ }
446
+ );
447
+ }
448
+ );
449
+ RteColorSwatch.displayName = "RteColorSwatch";
450
+
451
+ // src/ui/rte-dropdown-item.tsx
452
+ import * as React11 from "react";
453
+ import { jsx as jsx12 } from "react/jsx-runtime";
454
+ var RteDropdownItem = React11.forwardRef(({ className = "", active = false, ...props }, ref) => {
455
+ const cls = [
456
+ "rte-bubble-dropdown-item",
457
+ active ? "rte-bubble-dropdown-item--active" : "",
458
+ className
459
+ ].filter(Boolean).join(" ");
460
+ return /* @__PURE__ */ jsx12(
461
+ "button",
462
+ {
463
+ ref,
464
+ type: "button",
465
+ "data-dropdown-item": true,
466
+ className: cls,
467
+ ...props
468
+ }
469
+ );
470
+ });
471
+ RteDropdownItem.displayName = "RteDropdownItem";
472
+
473
+ // src/ui/rte-dropdown-divider.tsx
474
+ import * as React12 from "react";
475
+ import { jsx as jsx13 } from "react/jsx-runtime";
476
+ var RteDropdownDivider = React12.forwardRef(({ className = "", ...props }, ref) => /* @__PURE__ */ jsx13(
477
+ "div",
478
+ {
479
+ ref,
480
+ className: `rte-bubble-dropdown-divider ${className}`.trim(),
481
+ ...props
482
+ }
483
+ ));
484
+ RteDropdownDivider.displayName = "RteDropdownDivider";
485
+
486
+ // src/ui/rte-dropdown-icon.tsx
487
+ import * as React13 from "react";
488
+ import { jsx as jsx14 } from "react/jsx-runtime";
489
+ var RteDropdownIcon = React13.forwardRef(
490
+ ({ className = "", ...props }, ref) => /* @__PURE__ */ jsx14(
491
+ "span",
492
+ {
493
+ ref,
494
+ className: `rte-bubble-dropdown-icon ${className}`.trim(),
495
+ ...props
496
+ }
497
+ )
498
+ );
499
+ RteDropdownIcon.displayName = "RteDropdownIcon";
500
+
501
+ // src/ui/toggle.tsx
502
+ import { Toggle as TogglePrimitive } from "@base-ui/react/toggle";
503
+ import { cva as cva2 } from "class-variance-authority";
504
+ import { jsx as jsx15 } from "react/jsx-runtime";
505
+ var toggleVariants = cva2(
506
+ "group/toggle inline-flex items-center justify-center gap-1 rounded-none text-xs font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] 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",
507
+ {
508
+ defaultVariants: {
509
+ size: "default",
510
+ variant: "default"
511
+ },
512
+ variants: {
513
+ size: {
514
+ default: "h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
515
+ lg: "h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
516
+ sm: "h-7 min-w-7 rounded-none px-2.5 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5"
517
+ },
518
+ variant: {
519
+ default: "bg-transparent",
520
+ outline: "border border-input bg-transparent hover:bg-muted"
521
+ }
522
+ }
523
+ }
524
+ );
525
+ var Toggle = ({
526
+ className,
527
+ variant = "default",
528
+ size = "default",
529
+ ...props
530
+ }) => /* @__PURE__ */ jsx15(
531
+ TogglePrimitive,
532
+ {
533
+ "data-slot": "toggle",
534
+ className: cn(toggleVariants({ className, size, variant })),
535
+ ...props
536
+ }
537
+ );
538
+
539
+ // src/bubble-menu/color-selector.tsx
540
+ import { useState as useState2 } from "react";
24
541
 
25
542
  // src/bubble-menu/utils.ts
26
- import { useCallback, useEffect, useRef, useSyncExternalStore } from "react";
543
+ import { useCallback as useCallback2, useEffect, useRef as useRef2, useSyncExternalStore } from "react";
27
544
  var defaultEqual = (a, b) => a === b;
28
545
  var shallowEqual = (a, b) => {
29
546
  if (a === b) {
@@ -40,16 +557,16 @@ var shallowEqual = (a, b) => {
40
557
  return ak.every((k) => a[k] === b[k]);
41
558
  };
42
559
  var useEditorState = (editor, selector, isEqual = defaultEqual) => {
43
- const selectorRef = useRef(selector);
44
- const isEqualRef = useRef(isEqual);
560
+ const selectorRef = useRef2(selector);
561
+ const isEqualRef = useRef2(isEqual);
45
562
  useEffect(() => {
46
563
  selectorRef.current = selector;
47
564
  isEqualRef.current = isEqual;
48
565
  });
49
- const snapshotRef = useRef({
566
+ const snapshotRef = useRef2({
50
567
  value: editor ? selector(editor) : void 0
51
568
  });
52
- const updateSnapshot = useCallback(() => {
569
+ const updateSnapshot = useCallback2(() => {
53
570
  if (!editor) {
54
571
  return;
55
572
  }
@@ -59,7 +576,7 @@ var useEditorState = (editor, selector, isEqual = defaultEqual) => {
59
576
  }
60
577
  snapshotRef.current = { value: next };
61
578
  }, [editor]);
62
- const subscribe = useCallback(
579
+ const subscribe = useCallback2(
63
580
  (onStoreChange) => {
64
581
  if (!editor) {
65
582
  return () => {
@@ -78,7 +595,7 @@ var useEditorState = (editor, selector, isEqual = defaultEqual) => {
78
595
  },
79
596
  [editor, updateSnapshot]
80
597
  );
81
- const getSnapshot = useCallback(() => snapshotRef.current.value, []);
598
+ const getSnapshot = useCallback2(() => snapshotRef.current.value, []);
82
599
  return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
83
600
  };
84
601
  var CODE_BLOCK_LANGUAGES = [
@@ -127,11 +644,216 @@ var CODE_BLOCK_LANGUAGE_LABELS = {
127
644
  xml: "XML",
128
645
  yaml: "YAML"
129
646
  };
130
- var getLanguageLabel = (lang) => CODE_BLOCK_LANGUAGE_LABELS[lang] ?? lang;
647
+ var getLanguageLabel = (lang) => CODE_BLOCK_LANGUAGE_LABELS[lang] ?? lang;
648
+
649
+ // src/bubble-menu/color-selector.tsx
650
+ import { Fragment, jsx as jsx16, jsxs as jsxs4 } from "react/jsx-runtime";
651
+ var RECENT_KEY = "editorcn-editor-recent-colors";
652
+ var RECENT_LIMIT = 10;
653
+ var readRecentColors = () => {
654
+ if (typeof window === "undefined") {
655
+ return [];
656
+ }
657
+ try {
658
+ const raw = window.localStorage.getItem(RECENT_KEY);
659
+ if (!raw) {
660
+ return [];
661
+ }
662
+ const parsed = JSON.parse(raw);
663
+ return Array.isArray(parsed) ? parsed.slice(0, RECENT_LIMIT) : [];
664
+ } catch {
665
+ return [];
666
+ }
667
+ };
668
+ var persistRecentColors = (recent) => {
669
+ try {
670
+ window.localStorage.setItem(RECENT_KEY, JSON.stringify(recent));
671
+ } catch {
672
+ }
673
+ };
674
+ var TEXT_COLORS = [
675
+ { color: "#0f172a", label: "Foreground" },
676
+ { color: "#ef4444", label: "Red" },
677
+ { color: "#f97316", label: "Orange" },
678
+ { color: "#f59e0b", label: "Amber" },
679
+ { color: "#22c55e", label: "Green" },
680
+ { color: "#0ea5e9", label: "Sky" },
681
+ { color: "#3b82f6", label: "Blue" },
682
+ { color: "#6366f1", label: "Indigo" },
683
+ { color: "#a855f7", label: "Purple" },
684
+ { color: "#ec4899", label: "Pink" }
685
+ ];
686
+ var HIGHLIGHT_COLORS = [
687
+ { color: "#fef08a", label: "Yellow" },
688
+ { color: "#fed7aa", label: "Orange" },
689
+ { color: "#fecaca", label: "Red" },
690
+ { color: "#fbcfe8", label: "Pink" },
691
+ { color: "#e9d5ff", label: "Purple" },
692
+ { color: "#ddd6fe", label: "Violet" },
693
+ { color: "#bfdbfe", label: "Blue" },
694
+ { color: "#a5f3fc", label: "Cyan" },
695
+ { color: "#99f6e4", label: "Teal" },
696
+ { color: "#bbf7d0", label: "Green" }
697
+ ];
698
+ var ColorSelector = ({ editor }) => {
699
+ const [open, setOpen] = useState2(false);
700
+ const [recent, setRecent] = useState2(() => readRecentColors());
701
+ const { highlightColor, textColor } = useEditorState(
702
+ editor,
703
+ (ed) => ({
704
+ highlightColor: ed.isActive("highlight") ? ed.getAttributes("highlight").color : void 0,
705
+ textColor: ed.isActive("textStyle") ? ed.getAttributes("textStyle").color : void 0
706
+ }),
707
+ shallowEqual
708
+ );
709
+ const hasColor = editor.extensionManager.extensions.some(
710
+ (ext) => ext.name === "color"
711
+ );
712
+ const hasHighlight = editor.extensionManager.extensions.some(
713
+ (ext) => ext.name === "highlight"
714
+ );
715
+ const remember = (type, color, label) => {
716
+ setRecent((prev) => {
717
+ const next = [
718
+ { color, label, type },
719
+ ...prev.filter((item) => !(item.type === type && item.color === color))
720
+ ].slice(0, RECENT_LIMIT);
721
+ persistRecentColors(next);
722
+ return next;
723
+ });
724
+ };
725
+ const selectText = (color, label) => {
726
+ remember("text", color, label);
727
+ if (textColor === color) {
728
+ editor.chain().focus().unsetColor().run();
729
+ } else {
730
+ editor.chain().focus().setColor(color).run();
731
+ }
732
+ };
733
+ const selectHighlight = (color, label) => {
734
+ remember("highlight", color, label);
735
+ if (highlightColor === color) {
736
+ editor.chain().focus().unsetHighlight().run();
737
+ } else {
738
+ editor.chain().focus().setHighlight({ color }).run();
739
+ }
740
+ };
741
+ if (!hasColor && !hasHighlight) {
742
+ return null;
743
+ }
744
+ return /* @__PURE__ */ jsxs4("div", { style: { position: "relative" }, children: [
745
+ /* @__PURE__ */ jsx16(
746
+ RteButton,
747
+ {
748
+ active: Boolean(textColor || highlightColor),
749
+ onMouseDown: (e) => e.preventDefault(),
750
+ onClick: () => setOpen(!open),
751
+ title: "Text color",
752
+ children: /* @__PURE__ */ jsx16(RteIcon, { children: /* @__PURE__ */ jsxs4(
753
+ "svg",
754
+ {
755
+ xmlns: "http://www.w3.org/2000/svg",
756
+ viewBox: "0 0 24 24",
757
+ fill: "none",
758
+ stroke: "currentColor",
759
+ strokeWidth: 2,
760
+ strokeLinecap: "round",
761
+ strokeLinejoin: "round",
762
+ className: "rte-editor-icon",
763
+ children: [
764
+ /* @__PURE__ */ jsx16("path", { d: "M4 20h16" }),
765
+ /* @__PURE__ */ jsx16("path", { d: "m6 16 6-12 6 12" }),
766
+ /* @__PURE__ */ jsx16("path", { d: "M8 12h8" })
767
+ ]
768
+ }
769
+ ) })
770
+ }
771
+ ),
772
+ open && /* @__PURE__ */ jsxs4(Fragment, { children: [
773
+ /* @__PURE__ */ jsx16(
774
+ RteOverlay,
775
+ {
776
+ onClick: () => setOpen(false),
777
+ onKeyDown: (e) => {
778
+ if (e.key === "Escape") {
779
+ setOpen(false);
780
+ }
781
+ }
782
+ }
783
+ ),
784
+ /* @__PURE__ */ jsxs4(RteDropdown, { variant: "color", children: [
785
+ recent.length > 0 ? /* @__PURE__ */ jsxs4("div", { className: "rte-bubble-color-section", children: [
786
+ /* @__PURE__ */ jsx16("span", { className: "rte-bubble-color-label", children: "Recently Used" }),
787
+ /* @__PURE__ */ jsx16("div", { className: "rte-bubble-color-recent", children: recent.map((item) => /* @__PURE__ */ jsx16(
788
+ RteColorSwatch,
789
+ {
790
+ variant: item.type,
791
+ color: item.color,
792
+ label: item.label,
793
+ active: item.type === "text" ? textColor === item.color : highlightColor === item.color,
794
+ onSelect: () => item.type === "text" ? selectText(item.color, item.label) : selectHighlight(item.color, item.label)
795
+ },
796
+ `${item.type}-${item.color}`
797
+ )) })
798
+ ] }) : null,
799
+ hasColor ? /* @__PURE__ */ jsxs4(Fragment, { children: [
800
+ recent.length > 0 && /* @__PURE__ */ jsx16(RteDropdownDivider, {}),
801
+ /* @__PURE__ */ jsxs4("div", { className: "rte-bubble-color-section", children: [
802
+ /* @__PURE__ */ jsx16("span", { className: "rte-bubble-color-label", children: "Text Color" }),
803
+ /* @__PURE__ */ jsx16("div", { className: "rte-bubble-color-grid", children: TEXT_COLORS.map((item) => /* @__PURE__ */ jsx16(
804
+ RteColorSwatch,
805
+ {
806
+ variant: "text",
807
+ color: item.color,
808
+ label: item.label,
809
+ active: textColor === item.color,
810
+ onSelect: () => selectText(item.color, item.label)
811
+ },
812
+ item.color
813
+ )) })
814
+ ] })
815
+ ] }) : null,
816
+ hasHighlight ? /* @__PURE__ */ jsxs4(Fragment, { children: [
817
+ (recent.length > 0 || hasColor) && /* @__PURE__ */ jsx16(RteDropdownDivider, {}),
818
+ /* @__PURE__ */ jsxs4("div", { className: "rte-bubble-color-section", children: [
819
+ /* @__PURE__ */ jsx16("span", { className: "rte-bubble-color-label", children: "Highlight Color" }),
820
+ /* @__PURE__ */ jsx16("div", { className: "rte-bubble-color-grid", children: HIGHLIGHT_COLORS.map((item) => /* @__PURE__ */ jsx16(
821
+ RteColorSwatch,
822
+ {
823
+ variant: "highlight",
824
+ color: item.color,
825
+ label: item.label,
826
+ active: highlightColor === item.color,
827
+ onSelect: () => selectHighlight(item.color, item.label)
828
+ },
829
+ item.color
830
+ )) })
831
+ ] })
832
+ ] }) : null
833
+ ] })
834
+ ] })
835
+ ] });
836
+ };
837
+
838
+ // src/bubble-menu/language-selector.tsx
839
+ import { useState as useState3 } from "react";
840
+
841
+ // src/rte-context.ts
842
+ import { createContext, useContext } from "react";
843
+ var RichTextEditorContext = createContext(null);
844
+ var useRichTextEditorContext = () => {
845
+ const context = useContext(RichTextEditorContext);
846
+ if (!context) {
847
+ throw new Error(
848
+ "useRichTextEditorContext must be used within RichTextEditor"
849
+ );
850
+ }
851
+ return context;
852
+ };
131
853
 
132
854
  // src/bubble-menu/language-selector.tsx
133
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
134
- var FallbackIcon = () => /* @__PURE__ */ jsxs(
855
+ import { Fragment as Fragment2, jsx as jsx17, jsxs as jsxs5 } from "react/jsx-runtime";
856
+ var FallbackIcon = () => /* @__PURE__ */ jsxs5(
135
857
  "svg",
136
858
  {
137
859
  xmlns: "http://www.w3.org/2000/svg",
@@ -143,14 +865,13 @@ var FallbackIcon = () => /* @__PURE__ */ jsxs(
143
865
  strokeLinejoin: "round",
144
866
  className: "rte-editor-icon",
145
867
  children: [
146
- /* @__PURE__ */ jsx("polyline", { points: "16 18 22 12 16 6" }),
147
- /* @__PURE__ */ jsx("polyline", { points: "8 6 2 12 8 18" })
868
+ /* @__PURE__ */ jsx17("polyline", { points: "16 18 22 12 16 6" }),
869
+ /* @__PURE__ */ jsx17("polyline", { points: "8 6 2 12 8 18" })
148
870
  ]
149
871
  }
150
872
  );
151
873
  var LanguageSelector = ({ editor }) => {
152
- const [open, setOpen] = useState(false);
153
- const [pill, setPill] = useState(null);
874
+ const [open, setOpen] = useState3(false);
154
875
  const { icons } = useRichTextEditorContext();
155
876
  const { currentLanguage } = useEditorState(
156
877
  editor,
@@ -159,45 +880,17 @@ var LanguageSelector = ({ editor }) => {
159
880
  }),
160
881
  shallowEqual
161
882
  );
162
- const langIcon = icons.languageIcons[currentLanguage] ?? /* @__PURE__ */ jsx(FallbackIcon, {});
163
- const handleItemEnter = useCallback2((target) => {
164
- const item = target.closest(
165
- "[data-dropdown-item]"
166
- );
167
- if (!item) {
168
- return;
169
- }
170
- setPill({
171
- height: item.offsetHeight,
172
- left: item.offsetLeft,
173
- top: item.offsetTop,
174
- width: item.offsetWidth
175
- });
176
- }, []);
177
- const handleMouseOver = useCallback2(
178
- (event) => {
179
- handleItemEnter(event.target);
180
- },
181
- [handleItemEnter]
182
- );
183
- const handleFocus = useCallback2(
184
- (event) => {
185
- handleItemEnter(event.target);
186
- },
187
- [handleItemEnter]
188
- );
189
- return /* @__PURE__ */ jsxs("div", { style: { position: "relative" }, children: [
190
- /* @__PURE__ */ jsxs(
191
- "button",
883
+ const langIcon = icons.languageIcons[currentLanguage] ?? /* @__PURE__ */ jsx17(FallbackIcon, {});
884
+ return /* @__PURE__ */ jsxs5("div", { style: { position: "relative" }, children: [
885
+ /* @__PURE__ */ jsxs5(
886
+ RteButton,
192
887
  {
193
- type: "button",
194
- className: "rte-bubble-btn",
195
888
  onMouseDown: (e) => e.preventDefault(),
196
889
  onClick: () => setOpen(!open),
197
890
  children: [
198
- /* @__PURE__ */ jsx("span", { className: "rte-bubble-btn-icon", children: langIcon }),
199
- /* @__PURE__ */ jsx("span", { className: "rte-bubble-btn-text", children: getLanguageLabel(currentLanguage) }),
200
- /* @__PURE__ */ jsx("span", { className: "rte-bubble-btn-icon", style: { height: 12, width: 12 }, children: /* @__PURE__ */ jsx(
891
+ /* @__PURE__ */ jsx17(RteIcon, { children: langIcon }),
892
+ /* @__PURE__ */ jsx17("span", { className: "rte-bubble-btn-text", children: getLanguageLabel(currentLanguage) }),
893
+ /* @__PURE__ */ jsx17(RteIcon, { style: { height: 12, width: 12 }, children: /* @__PURE__ */ jsx17(
201
894
  "svg",
202
895
  {
203
896
  xmlns: "http://www.w3.org/2000/svg",
@@ -207,18 +900,16 @@ var LanguageSelector = ({ editor }) => {
207
900
  strokeWidth: 2,
208
901
  strokeLinecap: "round",
209
902
  strokeLinejoin: "round",
210
- children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" })
903
+ children: /* @__PURE__ */ jsx17("path", { d: "m6 9 6 6 6-6" })
211
904
  }
212
905
  ) })
213
906
  ]
214
907
  }
215
908
  ),
216
- open && /* @__PURE__ */ jsxs(Fragment, { children: [
217
- /* @__PURE__ */ jsx(
218
- "div",
909
+ open && /* @__PURE__ */ jsxs5(Fragment2, { children: [
910
+ /* @__PURE__ */ jsx17(
911
+ RteOverlay,
219
912
  {
220
- className: "rte-bubble-overlay",
221
- role: "presentation",
222
913
  onClick: () => setOpen(false),
223
914
  onKeyDown: (e) => {
224
915
  if (e.key === "Escape") {
@@ -227,61 +918,32 @@ var LanguageSelector = ({ editor }) => {
227
918
  }
228
919
  }
229
920
  ),
230
- /* @__PURE__ */ jsxs(
231
- "div",
921
+ /* @__PURE__ */ jsx17(RteDropdown, { variant: "language", children: CODE_BLOCK_LANGUAGES.map((lang) => /* @__PURE__ */ jsxs5(
922
+ RteDropdownItem,
232
923
  {
233
- className: "rte-bubble-dropdown rte-bubble-dropdown--language",
234
- onFocus: handleFocus,
235
- onMouseLeave: () => setPill(null),
236
- onMouseOver: handleMouseOver,
924
+ active: currentLanguage === lang,
925
+ onMouseDown: (e) => e.preventDefault(),
926
+ onClick: () => {
927
+ editor.chain().focus().updateAttributes("codeBlock", { language: lang }).run();
928
+ setOpen(false);
929
+ },
237
930
  children: [
238
- /* @__PURE__ */ jsx(
239
- "div",
240
- {
241
- "aria-hidden": "true",
242
- className: [
243
- "rte-bubble-dropdown-pill",
244
- pill ? "rte-bubble-dropdown-pill--visible" : ""
245
- ].filter(Boolean).join(" "),
246
- style: pill ? {
247
- height: pill.height,
248
- left: pill.left,
249
- top: pill.top,
250
- width: pill.width
251
- } : void 0
252
- }
253
- ),
254
- CODE_BLOCK_LANGUAGES.map((lang) => /* @__PURE__ */ jsxs(
255
- "button",
256
- {
257
- type: "button",
258
- "data-dropdown-item": true,
259
- className: `rte-bubble-dropdown-item${currentLanguage === lang ? " rte-bubble-dropdown-item--active" : ""}`,
260
- onMouseDown: (e) => e.preventDefault(),
261
- onClick: () => {
262
- editor.chain().focus().updateAttributes("codeBlock", { language: lang }).run();
263
- setOpen(false);
264
- },
265
- children: [
266
- /* @__PURE__ */ jsx("span", { className: "rte-bubble-dropdown-icon", children: icons.languageIcons[lang] ?? /* @__PURE__ */ jsx(FallbackIcon, {}) }),
267
- /* @__PURE__ */ jsx("span", { children: getLanguageLabel(lang) })
268
- ]
269
- },
270
- lang
271
- ))
931
+ /* @__PURE__ */ jsx17(RteDropdownIcon, { children: icons.languageIcons[lang] ?? /* @__PURE__ */ jsx17(FallbackIcon, {}) }),
932
+ /* @__PURE__ */ jsx17("span", { children: getLanguageLabel(lang) })
272
933
  ]
273
- }
274
- )
934
+ },
935
+ lang
936
+ )) })
275
937
  ] })
276
938
  ] });
277
939
  };
278
940
 
279
941
  // src/bubble-menu/text-buttons.tsx
280
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
942
+ import { jsx as jsx18, jsxs as jsxs6 } from "react/jsx-runtime";
281
943
  var Svg = ({
282
944
  children,
283
945
  strokeWidth = 2
284
- }) => /* @__PURE__ */ jsx2(
946
+ }) => /* @__PURE__ */ jsx18(
285
947
  "svg",
286
948
  {
287
949
  xmlns: "http://www.w3.org/2000/svg",
@@ -295,47 +957,48 @@ var Svg = ({
295
957
  children
296
958
  }
297
959
  );
960
+ var Icon = ({ children }) => /* @__PURE__ */ jsx18(RteIcon, { children });
298
961
  var textItems = [
299
962
  {
300
963
  command: (e) => e.chain().focus().toggleBold().run(),
301
- icon: /* @__PURE__ */ jsxs2(Svg, { children: [
302
- /* @__PURE__ */ jsx2("path", { d: "M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" }),
303
- /* @__PURE__ */ jsx2("path", { d: "M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" })
304
- ] }),
964
+ icon: /* @__PURE__ */ jsx18(Icon, { children: /* @__PURE__ */ jsxs6(Svg, { children: [
965
+ /* @__PURE__ */ jsx18("path", { d: "M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" }),
966
+ /* @__PURE__ */ jsx18("path", { d: "M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" })
967
+ ] }) }),
305
968
  isActive: (s) => s.isBold
306
969
  },
307
970
  {
308
971
  command: (e) => e.chain().focus().toggleItalic().run(),
309
- icon: /* @__PURE__ */ jsxs2(Svg, { children: [
310
- /* @__PURE__ */ jsx2("line", { x1: "19", y1: "4", x2: "10", y2: "4" }),
311
- /* @__PURE__ */ jsx2("line", { x1: "14", y1: "20", x2: "5", y2: "20" }),
312
- /* @__PURE__ */ jsx2("line", { x1: "15", y1: "4", x2: "9", y2: "20" })
313
- ] }),
972
+ icon: /* @__PURE__ */ jsx18(Icon, { children: /* @__PURE__ */ jsxs6(Svg, { children: [
973
+ /* @__PURE__ */ jsx18("line", { x1: "19", y1: "4", x2: "10", y2: "4" }),
974
+ /* @__PURE__ */ jsx18("line", { x1: "14", y1: "20", x2: "5", y2: "20" }),
975
+ /* @__PURE__ */ jsx18("line", { x1: "15", y1: "4", x2: "9", y2: "20" })
976
+ ] }) }),
314
977
  isActive: (s) => s.isItalic
315
978
  },
316
979
  {
317
980
  command: (e) => e.chain().focus().toggleUnderline().run(),
318
- icon: /* @__PURE__ */ jsxs2(Svg, { children: [
319
- /* @__PURE__ */ jsx2("path", { d: "M6 4v6a6 6 0 0 0 12 0V4" }),
320
- /* @__PURE__ */ jsx2("line", { x1: "4", y1: "20", x2: "20", y2: "20" })
321
- ] }),
981
+ icon: /* @__PURE__ */ jsx18(Icon, { children: /* @__PURE__ */ jsxs6(Svg, { children: [
982
+ /* @__PURE__ */ jsx18("path", { d: "M6 4v6a6 6 0 0 0 12 0V4" }),
983
+ /* @__PURE__ */ jsx18("line", { x1: "4", y1: "20", x2: "20", y2: "20" })
984
+ ] }) }),
322
985
  isActive: (s) => s.isUnderline
323
986
  },
324
987
  {
325
988
  command: (e) => e.chain().focus().toggleStrike().run(),
326
- icon: /* @__PURE__ */ jsxs2(Svg, { children: [
327
- /* @__PURE__ */ jsx2("path", { d: "M16 4H9.5a3.5 3.5 0 0 0-2.9 5.4" }),
328
- /* @__PURE__ */ jsx2("path", { d: "M14.5 14.6a3.5 3.5 0 0 1-2.9 5.4H8" }),
329
- /* @__PURE__ */ jsx2("line", { x1: "4", y1: "12", x2: "20", y2: "12" })
330
- ] }),
989
+ icon: /* @__PURE__ */ jsx18(Icon, { children: /* @__PURE__ */ jsxs6(Svg, { children: [
990
+ /* @__PURE__ */ jsx18("path", { d: "M16 4H9.5a3.5 3.5 0 0 0-2.9 5.4" }),
991
+ /* @__PURE__ */ jsx18("path", { d: "M14.5 14.6a3.5 3.5 0 0 1-2.9 5.4H8" }),
992
+ /* @__PURE__ */ jsx18("line", { x1: "4", y1: "12", x2: "20", y2: "12" })
993
+ ] }) }),
331
994
  isActive: (s) => s.isStrike
332
995
  },
333
996
  {
334
997
  command: (e) => e.chain().focus().toggleCode().run(),
335
- icon: /* @__PURE__ */ jsxs2(Svg, { children: [
336
- /* @__PURE__ */ jsx2("polyline", { points: "16 18 22 12 16 6" }),
337
- /* @__PURE__ */ jsx2("polyline", { points: "8 6 2 12 8 18" })
338
- ] }),
998
+ icon: /* @__PURE__ */ jsx18(Icon, { children: /* @__PURE__ */ jsxs6(Svg, { children: [
999
+ /* @__PURE__ */ jsx18("polyline", { points: "16 18 22 12 16 6" }),
1000
+ /* @__PURE__ */ jsx18("polyline", { points: "8 6 2 12 8 18" })
1001
+ ] }) }),
339
1002
  isActive: (s) => s.isCode
340
1003
  }
341
1004
  ];
@@ -351,11 +1014,10 @@ var TextButtons = ({ editor }) => {
351
1014
  }),
352
1015
  shallowEqual
353
1016
  );
354
- return /* @__PURE__ */ jsx2("div", { className: "rte-bubble-group", children: textItems.map((item, i) => /* @__PURE__ */ jsx2(
355
- "button",
1017
+ return /* @__PURE__ */ jsx18(RteButtonGroup, { children: textItems.map((item, i) => /* @__PURE__ */ jsx18(
1018
+ RteButton,
356
1019
  {
357
- type: "button",
358
- className: `rte-bubble-btn${item.isActive(editorState) ? " rte-bubble-btn--active" : ""}`,
1020
+ active: item.isActive(editorState),
359
1021
  onMouseDown: (e) => e.preventDefault(),
360
1022
  onClick: () => item.command(editor),
361
1023
  children: item.icon
@@ -365,7 +1027,7 @@ var TextButtons = ({ editor }) => {
365
1027
  };
366
1028
 
367
1029
  // src/bubble-menu/index.tsx
368
- import { jsx as jsx3 } from "react/jsx-runtime";
1030
+ import { Fragment as Fragment3, jsx as jsx19, jsxs as jsxs7 } from "react/jsx-runtime";
369
1031
  var BubbleMenu = ({ editor }) => {
370
1032
  const editorState = useEditorState(
371
1033
  editor,
@@ -397,13 +1059,17 @@ var BubbleMenu = ({ editor }) => {
397
1059
  return null;
398
1060
  }
399
1061
  const isCodeBlockActive = editorState?.isCodeBlock ?? false;
400
- return /* @__PURE__ */ jsx3(
1062
+ return /* @__PURE__ */ jsx19(
401
1063
  TiptapBubbleMenu,
402
1064
  {
403
1065
  editor,
404
1066
  options: { offset: 8, placement: "top" },
405
1067
  shouldShow,
406
- children: /* @__PURE__ */ jsx3("div", { className: "rte-bubble-menu", children: isCodeBlockActive ? /* @__PURE__ */ jsx3(LanguageSelector, { editor }) : /* @__PURE__ */ jsx3(TextButtons, { editor }) })
1068
+ children: /* @__PURE__ */ jsx19("div", { className: "rte-bubble-menu", children: isCodeBlockActive ? /* @__PURE__ */ jsx19(LanguageSelector, { editor }) : /* @__PURE__ */ jsxs7(Fragment3, { children: [
1069
+ /* @__PURE__ */ jsx19(TextButtons, { editor }),
1070
+ /* @__PURE__ */ jsx19(RteSeparator, {}),
1071
+ /* @__PURE__ */ jsx19(ColorSelector, { editor })
1072
+ ] }) })
407
1073
  }
408
1074
  );
409
1075
  };
@@ -411,54 +1077,7 @@ var BubbleMenu = ({ editor }) => {
411
1077
  // src/controls/rte-control.tsx
412
1078
  import { useEditorState as useEditorState2 } from "@tiptap/react";
413
1079
  import "react";
414
-
415
- // src/ui/toggle.tsx
416
- import { Toggle as TogglePrimitive } from "@base-ui/react/toggle";
417
- import { cva } from "class-variance-authority";
418
-
419
- // src/ui/utils.ts
420
- import { clsx } from "clsx";
421
- import { twMerge } from "tailwind-merge";
422
- var cn = (...inputs) => twMerge(clsx(inputs));
423
-
424
- // src/ui/toggle.tsx
425
- import { jsx as jsx4 } from "react/jsx-runtime";
426
- var toggleVariants = cva(
427
- "group/toggle inline-flex items-center justify-center gap-1 rounded-none text-xs font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] 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",
428
- {
429
- defaultVariants: {
430
- size: "default",
431
- variant: "default"
432
- },
433
- variants: {
434
- size: {
435
- default: "h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
436
- lg: "h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
437
- sm: "h-7 min-w-7 rounded-none px-2.5 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5"
438
- },
439
- variant: {
440
- default: "bg-transparent",
441
- outline: "border border-input bg-transparent hover:bg-muted"
442
- }
443
- }
444
- }
445
- );
446
- var Toggle = ({
447
- className,
448
- variant = "default",
449
- size = "default",
450
- ...props
451
- }) => /* @__PURE__ */ jsx4(
452
- TogglePrimitive,
453
- {
454
- "data-slot": "toggle",
455
- className: cn(toggleVariants({ className, size, variant })),
456
- ...props
457
- }
458
- );
459
-
460
- // src/controls/rte-control.tsx
461
- import { jsx as jsx5 } from "react/jsx-runtime";
1080
+ import { jsx as jsx20 } from "react/jsx-runtime";
462
1081
  var RichTextEditorControl = ({
463
1082
  active,
464
1083
  interactive: _interactive = true,
@@ -468,7 +1087,7 @@ var RichTextEditorControl = ({
468
1087
  onClick,
469
1088
  disabled,
470
1089
  ...props
471
- }) => /* @__PURE__ */ jsx5(
1090
+ }) => /* @__PURE__ */ jsx20(
472
1091
  Toggle,
473
1092
  {
474
1093
  size: "sm",
@@ -517,7 +1136,7 @@ var createControl = ({
517
1136
  });
518
1137
  const active = editorState?.active ?? false;
519
1138
  const disabled = editorState?.disabled ?? true;
520
- return /* @__PURE__ */ jsx5(
1139
+ return /* @__PURE__ */ jsx20(
521
1140
  RichTextEditorControl,
522
1141
  {
523
1142
  active,
@@ -638,183 +1257,78 @@ var UndoControl = createControl({
638
1257
  iconKey: "undoControlIcon",
639
1258
  isDisabled: (editor) => !editor.can().undo(),
640
1259
  label: "undoControlLabel",
641
- operation: { name: "undo" }
642
- });
643
- var RedoControl = createControl({
644
- iconKey: "redoControlIcon",
645
- isDisabled: (editor) => !editor.can().redo(),
646
- label: "redoControlLabel",
647
- operation: { name: "redo" }
648
- });
649
- var H5Control = createControl({
650
- iconKey: "h5ControlIcon",
651
- isActive: { attributes: { level: 5 }, name: "heading" },
652
- label: "h5ControlLabel",
653
- operation: { attributes: { level: 5 }, name: "toggleHeading" }
654
- });
655
- var H6Control = createControl({
656
- iconKey: "h6ControlIcon",
657
- isActive: { attributes: { level: 6 }, name: "heading" },
658
- label: "h6ControlLabel",
659
- operation: { attributes: { level: 6 }, name: "toggleHeading" }
660
- });
661
- var AlignLeftControl = createControl({
662
- iconKey: "alignLeftControlIcon",
663
- isActive: { attrs: { textAlign: "left" } },
664
- label: "alignLeftControlLabel",
665
- operation: { attributes: "left", name: "setTextAlign" }
666
- });
667
- var AlignCenterControl = createControl({
668
- iconKey: "alignCenterControlIcon",
669
- isActive: { attrs: { textAlign: "center" } },
670
- label: "alignCenterControlLabel",
671
- operation: { attributes: "center", name: "setTextAlign" }
672
- });
673
- var AlignRightControl = createControl({
674
- iconKey: "alignRightControlIcon",
675
- isActive: { attrs: { textAlign: "right" } },
676
- label: "alignRightControlLabel",
677
- operation: { attributes: "right", name: "setTextAlign" }
678
- });
679
- var AlignJustifyControl = createControl({
680
- iconKey: "alignJustifyControlIcon",
681
- isActive: { attrs: { textAlign: "justify" } },
682
- label: "alignJustifyControlLabel",
683
- operation: { attributes: "justify", name: "setTextAlign" }
684
- });
685
- var HighlightControl = createControl({
686
- iconKey: "highlightControlIcon",
687
- isActive: { name: "highlight" },
688
- label: "highlightControlLabel",
689
- operation: { name: "toggleHighlight" }
690
- });
691
- var SubscriptControl = createControl({
692
- iconKey: "subscriptControlIcon",
693
- isActive: { name: "subscript" },
694
- label: "subscriptControlLabel",
695
- operation: { name: "toggleSubscript" }
696
- });
697
- var SuperscriptControl = createControl({
698
- iconKey: "superscriptControlIcon",
699
- isActive: { name: "superscript" },
700
- label: "superscriptControlLabel",
701
- operation: { name: "toggleSuperscript" }
702
- });
703
-
704
- // src/controls/rte-link-control.tsx
705
- import { useEditorState as useEditorState3 } from "@tiptap/react";
706
- import * as React4 from "react";
707
- import { useCallback as useCallback4, useState as useState2 } from "react";
708
-
709
- // src/ui/button.tsx
710
- import { Button as ButtonPrimitive } from "@base-ui/react/button";
711
- import { cva as cva2 } from "class-variance-authority";
712
- import { jsx as jsx6 } from "react/jsx-runtime";
713
- var buttonVariants = cva2(
714
- "group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
715
- {
716
- defaultVariants: {
717
- size: "default",
718
- variant: "default"
719
- },
720
- variants: {
721
- size: {
722
- default: "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
723
- icon: "size-8",
724
- "icon-lg": "size-9",
725
- "icon-sm": "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
726
- "icon-xs": "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
727
- lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
728
- sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
729
- xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3"
730
- },
731
- variant: {
732
- default: "bg-primary text-primary-foreground hover:bg-primary/80",
733
- destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
734
- ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
735
- link: "text-primary underline-offset-4 hover:underline",
736
- outline: "border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
737
- secondary: "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground"
738
- }
739
- }
740
- }
741
- );
742
- var Button = ({
743
- className,
744
- variant = "default",
745
- size = "default",
746
- ...props
747
- }) => /* @__PURE__ */ jsx6(
748
- ButtonPrimitive,
749
- {
750
- "data-slot": "button",
751
- className: cn(buttonVariants({ className, size, variant })),
752
- ...props
753
- }
754
- );
755
-
756
- // src/ui/input.tsx
757
- import { Input as InputPrimitive } from "@base-ui/react/input";
758
- import "react";
759
- import { jsx as jsx7 } from "react/jsx-runtime";
760
- var Input = ({
761
- className,
762
- type,
763
- ...props
764
- }) => /* @__PURE__ */ jsx7(
765
- InputPrimitive,
766
- {
767
- type,
768
- "data-slot": "input",
769
- className: cn(
770
- "h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
771
- className
772
- ),
773
- ...props
774
- }
775
- );
776
-
777
- // src/ui/popover.tsx
778
- import { Popover as PopoverPrimitive } from "@base-ui/react/popover";
779
- import "react";
780
- import { jsx as jsx8 } from "react/jsx-runtime";
781
- var Popover = ({ ...props }) => /* @__PURE__ */ jsx8(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
782
- var PopoverTrigger = ({ ...props }) => /* @__PURE__ */ jsx8(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
783
- var PopoverContent = ({
784
- className,
785
- align = "center",
786
- alignOffset = 0,
787
- side = "bottom",
788
- sideOffset = 4,
789
- ...props
790
- }) => /* @__PURE__ */ jsx8(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx8(
791
- PopoverPrimitive.Positioner,
792
- {
793
- align,
794
- alignOffset,
795
- side,
796
- sideOffset,
797
- className: "isolate z-50",
798
- children: /* @__PURE__ */ jsx8(
799
- PopoverPrimitive.Popup,
800
- {
801
- "data-slot": "popover-content",
802
- className: cn(
803
- "z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-none bg-popover p-2.5 text-xs text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
804
- className
805
- ),
806
- ...props
807
- }
808
- )
809
- }
810
- ) });
1260
+ operation: { name: "undo" }
1261
+ });
1262
+ var RedoControl = createControl({
1263
+ iconKey: "redoControlIcon",
1264
+ isDisabled: (editor) => !editor.can().redo(),
1265
+ label: "redoControlLabel",
1266
+ operation: { name: "redo" }
1267
+ });
1268
+ var H5Control = createControl({
1269
+ iconKey: "h5ControlIcon",
1270
+ isActive: { attributes: { level: 5 }, name: "heading" },
1271
+ label: "h5ControlLabel",
1272
+ operation: { attributes: { level: 5 }, name: "toggleHeading" }
1273
+ });
1274
+ var H6Control = createControl({
1275
+ iconKey: "h6ControlIcon",
1276
+ isActive: { attributes: { level: 6 }, name: "heading" },
1277
+ label: "h6ControlLabel",
1278
+ operation: { attributes: { level: 6 }, name: "toggleHeading" }
1279
+ });
1280
+ var AlignLeftControl = createControl({
1281
+ iconKey: "alignLeftControlIcon",
1282
+ isActive: { attrs: { textAlign: "left" } },
1283
+ label: "alignLeftControlLabel",
1284
+ operation: { attributes: "left", name: "setTextAlign" }
1285
+ });
1286
+ var AlignCenterControl = createControl({
1287
+ iconKey: "alignCenterControlIcon",
1288
+ isActive: { attrs: { textAlign: "center" } },
1289
+ label: "alignCenterControlLabel",
1290
+ operation: { attributes: "center", name: "setTextAlign" }
1291
+ });
1292
+ var AlignRightControl = createControl({
1293
+ iconKey: "alignRightControlIcon",
1294
+ isActive: { attrs: { textAlign: "right" } },
1295
+ label: "alignRightControlLabel",
1296
+ operation: { attributes: "right", name: "setTextAlign" }
1297
+ });
1298
+ var AlignJustifyControl = createControl({
1299
+ iconKey: "alignJustifyControlIcon",
1300
+ isActive: { attrs: { textAlign: "justify" } },
1301
+ label: "alignJustifyControlLabel",
1302
+ operation: { attributes: "justify", name: "setTextAlign" }
1303
+ });
1304
+ var HighlightControl = createControl({
1305
+ iconKey: "highlightControlIcon",
1306
+ isActive: { name: "highlight" },
1307
+ label: "highlightControlLabel",
1308
+ operation: { name: "toggleHighlight" }
1309
+ });
1310
+ var SubscriptControl = createControl({
1311
+ iconKey: "subscriptControlIcon",
1312
+ isActive: { name: "subscript" },
1313
+ label: "subscriptControlLabel",
1314
+ operation: { name: "toggleSubscript" }
1315
+ });
1316
+ var SuperscriptControl = createControl({
1317
+ iconKey: "superscriptControlIcon",
1318
+ isActive: { name: "superscript" },
1319
+ label: "superscriptControlLabel",
1320
+ operation: { name: "toggleSuperscript" }
1321
+ });
811
1322
 
812
1323
  // src/controls/rte-link-control.tsx
813
- import { jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
1324
+ import { useEditorState as useEditorState3 } from "@tiptap/react";
1325
+ import * as React15 from "react";
1326
+ import { useCallback as useCallback4, useState as useState4 } from "react";
1327
+ import { jsx as jsx21, jsxs as jsxs8 } from "react/jsx-runtime";
814
1328
  var LinkControl = () => {
815
1329
  const { editor, labels, icons } = useRichTextEditorContext();
816
- const [url, setUrl] = useState2("");
817
- const [open, setOpen] = useState2(false);
1330
+ const [url, setUrl] = useState4("");
1331
+ const [open, setOpen] = useState4(false);
818
1332
  const active = useEditorState3({
819
1333
  editor: editor ?? null,
820
1334
  selector: (ctx) => ctx.editor && !ctx.editor.isDestroyed ? ctx.editor.isActive("link") : false
@@ -849,16 +1363,16 @@ var LinkControl = () => {
849
1363
  handleSave();
850
1364
  }
851
1365
  };
852
- React4.useEffect(() => {
1366
+ React15.useEffect(() => {
853
1367
  const handler = () => handleOpen(true);
854
1368
  window.addEventListener("edit-link", handler);
855
1369
  return () => window.removeEventListener("edit-link", handler);
856
1370
  }, [handleOpen]);
857
- return /* @__PURE__ */ jsxs3(Popover, { open, onOpenChange: handleOpen, children: [
858
- /* @__PURE__ */ jsx9(
1371
+ return /* @__PURE__ */ jsxs8(Popover, { open, onOpenChange: handleOpen, children: [
1372
+ /* @__PURE__ */ jsx21(
859
1373
  PopoverTrigger,
860
1374
  {
861
- render: /* @__PURE__ */ jsx9(
1375
+ render: /* @__PURE__ */ jsx21(
862
1376
  Toggle,
863
1377
  {
864
1378
  size: "sm",
@@ -872,8 +1386,8 @@ var LinkControl = () => {
872
1386
  children: icons.linkControlIcon
873
1387
  }
874
1388
  ),
875
- /* @__PURE__ */ jsx9(PopoverContent, { className: "w-72 p-3", children: /* @__PURE__ */ jsxs3("div", { className: "rte-link-editor", children: [
876
- /* @__PURE__ */ jsx9(
1389
+ /* @__PURE__ */ jsx21(PopoverContent, { className: "w-72 p-3", children: /* @__PURE__ */ jsxs8("div", { className: "rte-link-editor", children: [
1390
+ /* @__PURE__ */ jsx21(
877
1391
  Input,
878
1392
  {
879
1393
  type: "url",
@@ -885,7 +1399,7 @@ var LinkControl = () => {
885
1399
  className: "rte-link-editor-input h-8 text-sm"
886
1400
  }
887
1401
  ),
888
- /* @__PURE__ */ jsx9(
1402
+ /* @__PURE__ */ jsx21(
889
1403
  Button,
890
1404
  {
891
1405
  size: "sm",
@@ -902,11 +1416,11 @@ var LinkControl = () => {
902
1416
  // src/controls/rte-twitter-control.tsx
903
1417
  import { Node, nodeInputRule } from "@tiptap/core";
904
1418
  import { ReactNodeViewRenderer, useEditorState as useEditorState4 } from "@tiptap/react";
905
- import { useState as useState4, useCallback as useCallback6, useEffect as useEffect4, useRef as useRef3 } from "react";
1419
+ import { useState as useState6, useCallback as useCallback6, useEffect as useEffect4, useRef as useRef4 } from "react";
906
1420
 
907
1421
  // src/extensions/resizable-node-view.tsx
908
1422
  import { NodeViewWrapper } from "@tiptap/react";
909
- import { useCallback as useCallback5, useEffect as useEffect3, useRef as useRef2, useState as useState3 } from "react";
1423
+ import { useCallback as useCallback5, useEffect as useEffect3, useRef as useRef3, useState as useState5 } from "react";
910
1424
 
911
1425
  // src/icons.tsx
912
1426
  import {
@@ -940,25 +1454,162 @@ import {
940
1454
  Undo2
941
1455
  } from "lucide-react";
942
1456
  import "react";
943
- import { Fragment as Fragment2, jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
1457
+
1458
+ // src/language-icons.tsx
1459
+ import "react";
1460
+ import { jsx as jsx22, jsxs as jsxs9 } from "react/jsx-runtime";
1461
+ var LangIcon = ({
1462
+ children,
1463
+ className
1464
+ }) => /* @__PURE__ */ jsx22(
1465
+ "svg",
1466
+ {
1467
+ xmlns: "http://www.w3.org/2000/svg",
1468
+ viewBox: "0 0 24 24",
1469
+ fill: "none",
1470
+ stroke: "currentColor",
1471
+ strokeWidth: 1.5,
1472
+ strokeLinecap: "round",
1473
+ strokeLinejoin: "round",
1474
+ className,
1475
+ children
1476
+ }
1477
+ );
1478
+ var DEFAULT_LANGUAGE_ICONS = {
1479
+ bash: /* @__PURE__ */ jsxs9(LangIcon, { children: [
1480
+ /* @__PURE__ */ jsx22("rect", { x: "2.5", y: "4", width: "19", height: "16", rx: "2" }),
1481
+ /* @__PURE__ */ jsx22("path", { d: "M6.5 9.5l3.5 3-3.5 3" }),
1482
+ /* @__PURE__ */ jsx22("path", { d: "M12 15.5h5.5" })
1483
+ ] }),
1484
+ c: /* @__PURE__ */ jsxs9(LangIcon, { children: [
1485
+ /* @__PURE__ */ jsx22("circle", { cx: "12", cy: "12", r: "8.5" }),
1486
+ /* @__PURE__ */ jsx22("path", { d: "M15.6 9.3a4.5 4.5 0 1 0 0 5.4" })
1487
+ ] }),
1488
+ cpp: /* @__PURE__ */ jsxs9(LangIcon, { children: [
1489
+ /* @__PURE__ */ jsx22("circle", { cx: "9.5", cy: "12", r: "6.5" }),
1490
+ /* @__PURE__ */ jsx22("path", { d: "M12.3 9.7a3.3 3.3 0 1 0 0 4.6" }),
1491
+ /* @__PURE__ */ jsx22("path", { d: "M15.7 10.5v3M14.2 12h3" }),
1492
+ /* @__PURE__ */ jsx22("path", { d: "M19.3 10.5v3M17.8 12h3" })
1493
+ ] }),
1494
+ css: /* @__PURE__ */ jsxs9(LangIcon, { children: [
1495
+ /* @__PURE__ */ jsx22("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1496
+ /* @__PURE__ */ jsx22("path", { d: "M9.7 7.5l-1 9" }),
1497
+ /* @__PURE__ */ jsx22("path", { d: "M15.3 7.5l-1 9" }),
1498
+ /* @__PURE__ */ jsx22("path", { d: "M7 10.3h11" }),
1499
+ /* @__PURE__ */ jsx22("path", { d: "M6.5 14.3h11" })
1500
+ ] }),
1501
+ go: /* @__PURE__ */ jsxs9(LangIcon, { children: [
1502
+ /* @__PURE__ */ jsx22("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1503
+ /* @__PURE__ */ jsx22("path", { d: "M12.6 9.7A3.3 3.3 0 1 0 12.6 14.3" }),
1504
+ /* @__PURE__ */ jsx22("path", { d: "M12.6 12h-1.9" }),
1505
+ /* @__PURE__ */ jsx22("circle", { cx: "17", cy: "12", r: "2.9" })
1506
+ ] }),
1507
+ html: /* @__PURE__ */ jsxs9(LangIcon, { children: [
1508
+ /* @__PURE__ */ jsx22("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1509
+ /* @__PURE__ */ jsx22("path", { d: "M9.5 8.5L6.5 12l3 3.5" }),
1510
+ /* @__PURE__ */ jsx22("path", { d: "M14.5 8.5L17.5 12l-3 3.5" }),
1511
+ /* @__PURE__ */ jsx22("path", { d: "M13 7.3l-2 9.4" })
1512
+ ] }),
1513
+ java: /* @__PURE__ */ jsxs9(LangIcon, { children: [
1514
+ /* @__PURE__ */ jsx22("path", { d: "M6 10h10v5a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3v-5z" }),
1515
+ /* @__PURE__ */ jsx22("path", { d: "M16 12h1.3a1.8 1.8 0 0 1 0 3.6H16" }),
1516
+ /* @__PURE__ */ jsx22("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" }),
1517
+ /* @__PURE__ */ jsx22("path", { d: "M6 19.3h10" })
1518
+ ] }),
1519
+ javascript: /* @__PURE__ */ jsxs9(LangIcon, { children: [
1520
+ /* @__PURE__ */ jsx22("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1521
+ /* @__PURE__ */ jsx22("path", { d: "M10.5 8v6.5a2 2 0 0 1-3.5 1.3" }),
1522
+ /* @__PURE__ */ jsx22("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" })
1523
+ ] }),
1524
+ json: /* @__PURE__ */ jsxs9(LangIcon, { children: [
1525
+ /* @__PURE__ */ jsx22("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" }),
1526
+ /* @__PURE__ */ jsx22("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" })
1527
+ ] }),
1528
+ kotlin: /* @__PURE__ */ jsxs9(LangIcon, { children: [
1529
+ /* @__PURE__ */ jsx22("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1530
+ /* @__PURE__ */ jsx22("path", { d: "M9 7.5v9" }),
1531
+ /* @__PURE__ */ jsx22("path", { d: "M9 12l6-4.5" }),
1532
+ /* @__PURE__ */ jsx22("path", { d: "M9 12l6 4.5" })
1533
+ ] }),
1534
+ markdown: /* @__PURE__ */ jsxs9(LangIcon, { children: [
1535
+ /* @__PURE__ */ jsx22("rect", { x: "2", y: "5", width: "20", height: "14", rx: "2" }),
1536
+ /* @__PURE__ */ jsx22("path", { d: "M6 15V9l3 4 3-4v6" }),
1537
+ /* @__PURE__ */ jsx22("path", { d: "M16.5 9v6" }),
1538
+ /* @__PURE__ */ jsx22("path", { d: "M14.5 13l2 2 2-2" })
1539
+ ] }),
1540
+ php: /* @__PURE__ */ jsxs9(LangIcon, { children: [
1541
+ /* @__PURE__ */ jsx22("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1542
+ /* @__PURE__ */ jsx22("path", { d: "M11.5 8.5L7.5 12l4 3.5" }),
1543
+ /* @__PURE__ */ jsx22("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" }),
1544
+ /* @__PURE__ */ jsx22("circle", { cx: "14.3", cy: "16.2", r: ".5", fill: "currentColor", stroke: "none" })
1545
+ ] }),
1546
+ plaintext: /* @__PURE__ */ jsxs9(LangIcon, { children: [
1547
+ /* @__PURE__ */ jsx22("rect", { x: "4", y: "2.5", width: "16", height: "19", rx: "2" }),
1548
+ /* @__PURE__ */ jsx22("line", { x1: "7.5", y1: "7.5", x2: "16.5", y2: "7.5" }),
1549
+ /* @__PURE__ */ jsx22("line", { x1: "7.5", y1: "11.5", x2: "16.5", y2: "11.5" }),
1550
+ /* @__PURE__ */ jsx22("line", { x1: "7.5", y1: "15.5", x2: "13.5", y2: "15.5" })
1551
+ ] }),
1552
+ python: /* @__PURE__ */ jsxs9(LangIcon, { children: [
1553
+ /* @__PURE__ */ jsx22("path", { d: "M4.5 15c0-3 2.5-4.7 5.7-4.7h1.6c2.8 0 5-2 5-4.5" }),
1554
+ /* @__PURE__ */ jsx22("path", { d: "M9.5 3.3c1.3-.3 2.6 0 3.3 1-.7 1-2 1.3-3.3 1" }),
1555
+ /* @__PURE__ */ jsx22("circle", { cx: "15.5", cy: "4.3", r: ".55", fill: "currentColor", stroke: "none" }),
1556
+ /* @__PURE__ */ jsx22("path", { d: "M17.8 4.5l1.4-.6M17.8 4.9l1.4.6" })
1557
+ ] }),
1558
+ ruby: /* @__PURE__ */ jsxs9(LangIcon, { children: [
1559
+ /* @__PURE__ */ jsx22("polygon", { points: "12 2.5 19.5 8 12 21.5 4.5 8" }),
1560
+ /* @__PURE__ */ jsx22("path", { d: "M4.5 8h15" }),
1561
+ /* @__PURE__ */ jsx22("path", { d: "M12 2.5v19" })
1562
+ ] }),
1563
+ rust: /* @__PURE__ */ jsxs9(LangIcon, { children: [
1564
+ /* @__PURE__ */ jsx22("circle", { cx: "12", cy: "12", r: "7" }),
1565
+ /* @__PURE__ */ jsx22("circle", { cx: "12", cy: "12", r: "2.3" }),
1566
+ /* @__PURE__ */ jsx22("path", { d: "M12 2.5v3M12 18.5v3M2.5 12h3M18.5 12h3" }),
1567
+ /* @__PURE__ */ jsx22("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" })
1568
+ ] }),
1569
+ sql: /* @__PURE__ */ jsxs9(LangIcon, { children: [
1570
+ /* @__PURE__ */ jsx22("ellipse", { cx: "12", cy: "6", rx: "8", ry: "3" }),
1571
+ /* @__PURE__ */ jsx22("path", { d: "M4 6v6c0 1.7 3.6 3 8 3s8-1.3 8-3V6" }),
1572
+ /* @__PURE__ */ jsx22("path", { d: "M4 12v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6" })
1573
+ ] }),
1574
+ swift: /* @__PURE__ */ jsx22(LangIcon, { children: /* @__PURE__ */ jsx22("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" }) }),
1575
+ typescript: /* @__PURE__ */ jsxs9(LangIcon, { children: [
1576
+ /* @__PURE__ */ jsx22("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1577
+ /* @__PURE__ */ jsx22("path", { d: "M7.3 8.2h5M9.8 8.2v7.6" }),
1578
+ /* @__PURE__ */ jsx22("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" })
1579
+ ] }),
1580
+ xml: /* @__PURE__ */ jsxs9(LangIcon, { children: [
1581
+ /* @__PURE__ */ jsx22("path", { d: "M8 7l-4.5 5 4.5 5" }),
1582
+ /* @__PURE__ */ jsx22("path", { d: "M16 7l4.5 5-4.5 5" }),
1583
+ /* @__PURE__ */ jsx22("path", { d: "M12 8v8" })
1584
+ ] }),
1585
+ yaml: /* @__PURE__ */ jsxs9(LangIcon, { children: [
1586
+ /* @__PURE__ */ jsx22("rect", { x: "2.5", y: "3", width: "19", height: "18", rx: "2" }),
1587
+ /* @__PURE__ */ jsx22("path", { d: "M6.5 8h2M9.5 8h8" }),
1588
+ /* @__PURE__ */ jsx22("path", { d: "M6.5 12h2M9.5 12h6" }),
1589
+ /* @__PURE__ */ jsx22("path", { d: "M6.5 16h2M9.5 16h7" })
1590
+ ] })
1591
+ };
1592
+
1593
+ // src/icons.tsx
1594
+ import { Fragment as Fragment4, jsx as jsx23, jsxs as jsxs10 } from "react/jsx-runtime";
944
1595
  var ALIGN_PATHS = {
945
- center: /* @__PURE__ */ jsxs4(Fragment2, { children: [
946
- /* @__PURE__ */ jsx10("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
947
- /* @__PURE__ */ jsx10("line", { x1: "17", y1: "12", x2: "7", y2: "12" }),
948
- /* @__PURE__ */ jsx10("line", { x1: "19", y1: "18", x2: "5", y2: "18" })
1596
+ center: /* @__PURE__ */ jsxs10(Fragment4, { children: [
1597
+ /* @__PURE__ */ jsx23("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
1598
+ /* @__PURE__ */ jsx23("line", { x1: "17", y1: "12", x2: "7", y2: "12" }),
1599
+ /* @__PURE__ */ jsx23("line", { x1: "19", y1: "18", x2: "5", y2: "18" })
949
1600
  ] }),
950
- left: /* @__PURE__ */ jsxs4(Fragment2, { children: [
951
- /* @__PURE__ */ jsx10("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
952
- /* @__PURE__ */ jsx10("line", { x1: "15", y1: "12", x2: "3", y2: "12" }),
953
- /* @__PURE__ */ jsx10("line", { x1: "17", y1: "18", x2: "3", y2: "18" })
1601
+ left: /* @__PURE__ */ jsxs10(Fragment4, { children: [
1602
+ /* @__PURE__ */ jsx23("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
1603
+ /* @__PURE__ */ jsx23("line", { x1: "15", y1: "12", x2: "3", y2: "12" }),
1604
+ /* @__PURE__ */ jsx23("line", { x1: "17", y1: "18", x2: "3", y2: "18" })
954
1605
  ] }),
955
- right: /* @__PURE__ */ jsxs4(Fragment2, { children: [
956
- /* @__PURE__ */ jsx10("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
957
- /* @__PURE__ */ jsx10("line", { x1: "21", y1: "12", x2: "9", y2: "12" }),
958
- /* @__PURE__ */ jsx10("line", { x1: "21", y1: "18", x2: "7", y2: "18" })
1606
+ right: /* @__PURE__ */ jsxs10(Fragment4, { children: [
1607
+ /* @__PURE__ */ jsx23("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
1608
+ /* @__PURE__ */ jsx23("line", { x1: "21", y1: "12", x2: "9", y2: "12" }),
1609
+ /* @__PURE__ */ jsx23("line", { x1: "21", y1: "18", x2: "7", y2: "18" })
959
1610
  ] })
960
1611
  };
961
- var AlignIcon = ({ dir }) => /* @__PURE__ */ jsx10(
1612
+ var AlignIcon = ({ dir }) => /* @__PURE__ */ jsx23(
962
1613
  "svg",
963
1614
  {
964
1615
  xmlns: "http://www.w3.org/2000/svg",
@@ -972,7 +1623,7 @@ var AlignIcon = ({ dir }) => /* @__PURE__ */ jsx10(
972
1623
  children: ALIGN_PATHS[dir]
973
1624
  }
974
1625
  );
975
- var EditUrlIcon = () => /* @__PURE__ */ jsxs4(
1626
+ var EditUrlIcon = () => /* @__PURE__ */ jsxs10(
976
1627
  "svg",
977
1628
  {
978
1629
  xmlns: "http://www.w3.org/2000/svg",
@@ -984,12 +1635,12 @@ var EditUrlIcon = () => /* @__PURE__ */ jsxs4(
984
1635
  strokeLinejoin: "round",
985
1636
  className: "rte-editor-icon",
986
1637
  children: [
987
- /* @__PURE__ */ jsx10("path", { d: "M12 20h9" }),
988
- /* @__PURE__ */ jsx10("path", { d: "M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z" })
1638
+ /* @__PURE__ */ jsx23("path", { d: "M12 20h9" }),
1639
+ /* @__PURE__ */ jsx23("path", { d: "M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z" })
989
1640
  ]
990
1641
  }
991
1642
  );
992
- var OpenInYouTubeIcon = () => /* @__PURE__ */ jsxs4(
1643
+ var OpenInYouTubeIcon = () => /* @__PURE__ */ jsxs10(
993
1644
  "svg",
994
1645
  {
995
1646
  xmlns: "http://www.w3.org/2000/svg",
@@ -1001,13 +1652,13 @@ var OpenInYouTubeIcon = () => /* @__PURE__ */ jsxs4(
1001
1652
  strokeLinejoin: "round",
1002
1653
  className: "rte-editor-icon",
1003
1654
  children: [
1004
- /* @__PURE__ */ jsx10("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }),
1005
- /* @__PURE__ */ jsx10("polyline", { points: "15 3 21 3 21 9" }),
1006
- /* @__PURE__ */ jsx10("line", { x1: "10", y1: "14", x2: "21", y2: "3" })
1655
+ /* @__PURE__ */ jsx23("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }),
1656
+ /* @__PURE__ */ jsx23("polyline", { points: "15 3 21 3 21 9" }),
1657
+ /* @__PURE__ */ jsx23("line", { x1: "10", y1: "14", x2: "21", y2: "3" })
1007
1658
  ]
1008
1659
  }
1009
1660
  );
1010
- var DeleteEmbedIcon = () => /* @__PURE__ */ jsxs4(
1661
+ var DeleteEmbedIcon = () => /* @__PURE__ */ jsxs10(
1011
1662
  "svg",
1012
1663
  {
1013
1664
  xmlns: "http://www.w3.org/2000/svg",
@@ -1019,177 +1670,46 @@ var DeleteEmbedIcon = () => /* @__PURE__ */ jsxs4(
1019
1670
  strokeLinejoin: "round",
1020
1671
  className: "rte-editor-icon",
1021
1672
  children: [
1022
- /* @__PURE__ */ jsx10("polyline", { points: "3 6 5 6 21 6" }),
1023
- /* @__PURE__ */ jsx10("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" })
1673
+ /* @__PURE__ */ jsx23("polyline", { points: "3 6 5 6 21 6" }),
1674
+ /* @__PURE__ */ jsx23("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" })
1024
1675
  ]
1025
1676
  }
1026
1677
  );
1027
1678
  var iconProps = { className: "rte-editor-icon" };
1028
- var LangIcon = ({
1029
- children,
1030
- className
1031
- }) => /* @__PURE__ */ jsx10(
1032
- "svg",
1033
- {
1034
- xmlns: "http://www.w3.org/2000/svg",
1035
- viewBox: "0 0 24 24",
1036
- fill: "none",
1037
- stroke: "currentColor",
1038
- strokeWidth: 1.5,
1039
- strokeLinecap: "round",
1040
- strokeLinejoin: "round",
1041
- className,
1042
- children
1043
- }
1044
- );
1045
- var DEFAULT_LANGUAGE_ICONS = {
1046
- bash: /* @__PURE__ */ jsxs4(LangIcon, { children: [
1047
- /* @__PURE__ */ jsx10("rect", { x: "2.5", y: "4", width: "19", height: "16", rx: "2" }),
1048
- /* @__PURE__ */ jsx10("path", { d: "M6.5 9.5l3.5 3-3.5 3" }),
1049
- /* @__PURE__ */ jsx10("path", { d: "M12 15.5h5.5" })
1050
- ] }),
1051
- c: /* @__PURE__ */ jsxs4(LangIcon, { children: [
1052
- /* @__PURE__ */ jsx10("circle", { cx: "12", cy: "12", r: "8.5" }),
1053
- /* @__PURE__ */ jsx10("path", { d: "M15.6 9.3a4.5 4.5 0 1 0 0 5.4" })
1054
- ] }),
1055
- cpp: /* @__PURE__ */ jsxs4(LangIcon, { children: [
1056
- /* @__PURE__ */ jsx10("circle", { cx: "9.5", cy: "12", r: "6.5" }),
1057
- /* @__PURE__ */ jsx10("path", { d: "M12.3 9.7a3.3 3.3 0 1 0 0 4.6" }),
1058
- /* @__PURE__ */ jsx10("path", { d: "M15.7 10.5v3M14.2 12h3" }),
1059
- /* @__PURE__ */ jsx10("path", { d: "M19.3 10.5v3M17.8 12h3" })
1060
- ] }),
1061
- css: /* @__PURE__ */ jsxs4(LangIcon, { children: [
1062
- /* @__PURE__ */ jsx10("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1063
- /* @__PURE__ */ jsx10("path", { d: "M9.7 7.5l-1 9" }),
1064
- /* @__PURE__ */ jsx10("path", { d: "M15.3 7.5l-1 9" }),
1065
- /* @__PURE__ */ jsx10("path", { d: "M7 10.3h11" }),
1066
- /* @__PURE__ */ jsx10("path", { d: "M6.5 14.3h11" })
1067
- ] }),
1068
- go: /* @__PURE__ */ jsxs4(LangIcon, { children: [
1069
- /* @__PURE__ */ jsx10("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1070
- /* @__PURE__ */ jsx10("path", { d: "M12.6 9.7A3.3 3.3 0 1 0 12.6 14.3" }),
1071
- /* @__PURE__ */ jsx10("path", { d: "M12.6 12h-1.9" }),
1072
- /* @__PURE__ */ jsx10("circle", { cx: "17", cy: "12", r: "2.9" })
1073
- ] }),
1074
- html: /* @__PURE__ */ jsxs4(LangIcon, { children: [
1075
- /* @__PURE__ */ jsx10("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1076
- /* @__PURE__ */ jsx10("path", { d: "M9.5 8.5L6.5 12l3 3.5" }),
1077
- /* @__PURE__ */ jsx10("path", { d: "M14.5 8.5L17.5 12l-3 3.5" }),
1078
- /* @__PURE__ */ jsx10("path", { d: "M13 7.3l-2 9.4" })
1079
- ] }),
1080
- java: /* @__PURE__ */ jsxs4(LangIcon, { children: [
1081
- /* @__PURE__ */ jsx10("path", { d: "M6 10h10v5a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3v-5z" }),
1082
- /* @__PURE__ */ jsx10("path", { d: "M16 12h1.3a1.8 1.8 0 0 1 0 3.6H16" }),
1083
- /* @__PURE__ */ jsx10("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" }),
1084
- /* @__PURE__ */ jsx10("path", { d: "M6 19.3h10" })
1085
- ] }),
1086
- javascript: /* @__PURE__ */ jsxs4(LangIcon, { children: [
1087
- /* @__PURE__ */ jsx10("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1088
- /* @__PURE__ */ jsx10("path", { d: "M10.5 8v6.5a2 2 0 0 1-3.5 1.3" }),
1089
- /* @__PURE__ */ jsx10("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" })
1090
- ] }),
1091
- json: /* @__PURE__ */ jsxs4(LangIcon, { children: [
1092
- /* @__PURE__ */ jsx10("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" }),
1093
- /* @__PURE__ */ jsx10("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" })
1094
- ] }),
1095
- kotlin: /* @__PURE__ */ jsxs4(LangIcon, { children: [
1096
- /* @__PURE__ */ jsx10("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1097
- /* @__PURE__ */ jsx10("path", { d: "M9 7.5v9" }),
1098
- /* @__PURE__ */ jsx10("path", { d: "M9 12l6-4.5" }),
1099
- /* @__PURE__ */ jsx10("path", { d: "M9 12l6 4.5" })
1100
- ] }),
1101
- markdown: /* @__PURE__ */ jsxs4(LangIcon, { children: [
1102
- /* @__PURE__ */ jsx10("rect", { x: "2", y: "5", width: "20", height: "14", rx: "2" }),
1103
- /* @__PURE__ */ jsx10("path", { d: "M6 15V9l3 4 3-4v6" }),
1104
- /* @__PURE__ */ jsx10("path", { d: "M16.5 9v6" }),
1105
- /* @__PURE__ */ jsx10("path", { d: "M14.5 13l2 2 2-2" })
1106
- ] }),
1107
- php: /* @__PURE__ */ jsxs4(LangIcon, { children: [
1108
- /* @__PURE__ */ jsx10("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1109
- /* @__PURE__ */ jsx10("path", { d: "M11.5 8.5L7.5 12l4 3.5" }),
1110
- /* @__PURE__ */ jsx10("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" }),
1111
- /* @__PURE__ */ jsx10("circle", { cx: "14.3", cy: "16.2", r: ".5", fill: "currentColor", stroke: "none" })
1112
- ] }),
1113
- plaintext: /* @__PURE__ */ jsxs4(LangIcon, { children: [
1114
- /* @__PURE__ */ jsx10("rect", { x: "4", y: "2.5", width: "16", height: "19", rx: "2" }),
1115
- /* @__PURE__ */ jsx10("line", { x1: "7.5", y1: "7.5", x2: "16.5", y2: "7.5" }),
1116
- /* @__PURE__ */ jsx10("line", { x1: "7.5", y1: "11.5", x2: "16.5", y2: "11.5" }),
1117
- /* @__PURE__ */ jsx10("line", { x1: "7.5", y1: "15.5", x2: "13.5", y2: "15.5" })
1118
- ] }),
1119
- python: /* @__PURE__ */ jsxs4(LangIcon, { children: [
1120
- /* @__PURE__ */ jsx10("path", { d: "M4.5 15c0-3 2.5-4.7 5.7-4.7h1.6c2.8 0 5-2 5-4.5" }),
1121
- /* @__PURE__ */ jsx10("path", { d: "M9.5 3.3c1.3-.3 2.6 0 3.3 1-.7 1-2 1.3-3.3 1" }),
1122
- /* @__PURE__ */ jsx10("circle", { cx: "15.5", cy: "4.3", r: ".55", fill: "currentColor", stroke: "none" }),
1123
- /* @__PURE__ */ jsx10("path", { d: "M17.8 4.5l1.4-.6M17.8 4.9l1.4.6" })
1124
- ] }),
1125
- ruby: /* @__PURE__ */ jsxs4(LangIcon, { children: [
1126
- /* @__PURE__ */ jsx10("polygon", { points: "12 2.5 19.5 8 12 21.5 4.5 8" }),
1127
- /* @__PURE__ */ jsx10("path", { d: "M4.5 8h15" }),
1128
- /* @__PURE__ */ jsx10("path", { d: "M12 2.5v19" })
1129
- ] }),
1130
- rust: /* @__PURE__ */ jsxs4(LangIcon, { children: [
1131
- /* @__PURE__ */ jsx10("circle", { cx: "12", cy: "12", r: "7" }),
1132
- /* @__PURE__ */ jsx10("circle", { cx: "12", cy: "12", r: "2.3" }),
1133
- /* @__PURE__ */ jsx10("path", { d: "M12 2.5v3M12 18.5v3M2.5 12h3M18.5 12h3" }),
1134
- /* @__PURE__ */ jsx10("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" })
1135
- ] }),
1136
- sql: /* @__PURE__ */ jsxs4(LangIcon, { children: [
1137
- /* @__PURE__ */ jsx10("ellipse", { cx: "12", cy: "6", rx: "8", ry: "3" }),
1138
- /* @__PURE__ */ jsx10("path", { d: "M4 6v6c0 1.7 3.6 3 8 3s8-1.3 8-3V6" }),
1139
- /* @__PURE__ */ jsx10("path", { d: "M4 12v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6" })
1140
- ] }),
1141
- swift: /* @__PURE__ */ jsx10(LangIcon, { children: /* @__PURE__ */ jsx10("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" }) }),
1142
- typescript: /* @__PURE__ */ jsxs4(LangIcon, { children: [
1143
- /* @__PURE__ */ jsx10("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1144
- /* @__PURE__ */ jsx10("path", { d: "M7.3 8.2h5M9.8 8.2v7.6" }),
1145
- /* @__PURE__ */ jsx10("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" })
1146
- ] }),
1147
- xml: /* @__PURE__ */ jsxs4(LangIcon, { children: [
1148
- /* @__PURE__ */ jsx10("path", { d: "M8 7l-4.5 5 4.5 5" }),
1149
- /* @__PURE__ */ jsx10("path", { d: "M16 7l4.5 5-4.5 5" }),
1150
- /* @__PURE__ */ jsx10("path", { d: "M12 8v8" })
1151
- ] }),
1152
- yaml: /* @__PURE__ */ jsxs4(LangIcon, { children: [
1153
- /* @__PURE__ */ jsx10("rect", { x: "2.5", y: "3", width: "19", height: "18", rx: "2" }),
1154
- /* @__PURE__ */ jsx10("path", { d: "M6.5 8h2M9.5 8h8" }),
1155
- /* @__PURE__ */ jsx10("path", { d: "M6.5 12h2M9.5 12h6" }),
1156
- /* @__PURE__ */ jsx10("path", { d: "M6.5 16h2M9.5 16h7" })
1157
- ] })
1158
- };
1159
1679
  var DEFAULT_ICONS = {
1160
- alignCenterControlIcon: /* @__PURE__ */ jsx10(TextAlignCenter, { ...iconProps }),
1161
- alignJustifyControlIcon: /* @__PURE__ */ jsx10(TextAlignJustify, { ...iconProps }),
1162
- alignLeftControlIcon: /* @__PURE__ */ jsx10(TextAlignStart, { ...iconProps }),
1163
- alignRightControlIcon: /* @__PURE__ */ jsx10(TextAlignEnd, { ...iconProps }),
1164
- blockquoteControlIcon: /* @__PURE__ */ jsx10(TextQuote, { ...iconProps }),
1165
- boldControlIcon: /* @__PURE__ */ jsx10(Bold, { ...iconProps }),
1166
- bulletListControlIcon: /* @__PURE__ */ jsx10(List, { ...iconProps }),
1167
- clearFormattingControlIcon: /* @__PURE__ */ jsx10(RemoveFormatting, { ...iconProps }),
1168
- codeBlockControlIcon: /* @__PURE__ */ jsx10(SquareCode, { ...iconProps }),
1169
- codeControlIcon: /* @__PURE__ */ jsx10(Code, { ...iconProps }),
1170
- h1ControlIcon: /* @__PURE__ */ jsx10(Heading1, { ...iconProps }),
1171
- h2ControlIcon: /* @__PURE__ */ jsx10(Heading2, { ...iconProps }),
1172
- h3ControlIcon: /* @__PURE__ */ jsx10(Heading3, { ...iconProps }),
1173
- h4ControlIcon: /* @__PURE__ */ jsx10(Heading4, { ...iconProps }),
1174
- h5ControlIcon: /* @__PURE__ */ jsx10(Heading5, { ...iconProps }),
1175
- h6ControlIcon: /* @__PURE__ */ jsx10(Heading6, { ...iconProps }),
1176
- highlightControlIcon: /* @__PURE__ */ jsx10(Highlighter, { ...iconProps }),
1177
- hrControlIcon: /* @__PURE__ */ jsx10(Minus, { ...iconProps }),
1178
- italicControlIcon: /* @__PURE__ */ jsx10(Italic, { ...iconProps }),
1680
+ alignCenterControlIcon: /* @__PURE__ */ jsx23(TextAlignCenter, { ...iconProps }),
1681
+ alignJustifyControlIcon: /* @__PURE__ */ jsx23(TextAlignJustify, { ...iconProps }),
1682
+ alignLeftControlIcon: /* @__PURE__ */ jsx23(TextAlignStart, { ...iconProps }),
1683
+ alignRightControlIcon: /* @__PURE__ */ jsx23(TextAlignEnd, { ...iconProps }),
1684
+ blockquoteControlIcon: /* @__PURE__ */ jsx23(TextQuote, { ...iconProps }),
1685
+ boldControlIcon: /* @__PURE__ */ jsx23(Bold, { ...iconProps }),
1686
+ bulletListControlIcon: /* @__PURE__ */ jsx23(List, { ...iconProps }),
1687
+ clearFormattingControlIcon: /* @__PURE__ */ jsx23(RemoveFormatting, { ...iconProps }),
1688
+ codeBlockControlIcon: /* @__PURE__ */ jsx23(SquareCode, { ...iconProps }),
1689
+ codeControlIcon: /* @__PURE__ */ jsx23(Code, { ...iconProps }),
1690
+ h1ControlIcon: /* @__PURE__ */ jsx23(Heading1, { ...iconProps }),
1691
+ h2ControlIcon: /* @__PURE__ */ jsx23(Heading2, { ...iconProps }),
1692
+ h3ControlIcon: /* @__PURE__ */ jsx23(Heading3, { ...iconProps }),
1693
+ h4ControlIcon: /* @__PURE__ */ jsx23(Heading4, { ...iconProps }),
1694
+ h5ControlIcon: /* @__PURE__ */ jsx23(Heading5, { ...iconProps }),
1695
+ h6ControlIcon: /* @__PURE__ */ jsx23(Heading6, { ...iconProps }),
1696
+ highlightControlIcon: /* @__PURE__ */ jsx23(Highlighter, { ...iconProps }),
1697
+ hrControlIcon: /* @__PURE__ */ jsx23(Minus, { ...iconProps }),
1698
+ italicControlIcon: /* @__PURE__ */ jsx23(Italic, { ...iconProps }),
1179
1699
  languageIcons: DEFAULT_LANGUAGE_ICONS,
1180
- linkControlIcon: /* @__PURE__ */ jsx10(Link, { ...iconProps }),
1181
- orderedListControlIcon: /* @__PURE__ */ jsx10(ListOrdered, { ...iconProps }),
1182
- redoControlIcon: /* @__PURE__ */ jsx10(Redo2, { ...iconProps }),
1183
- strikeControlIcon: /* @__PURE__ */ jsx10(Strikethrough, { ...iconProps }),
1184
- subscriptControlIcon: /* @__PURE__ */ jsx10(Subscript, { ...iconProps }),
1185
- superscriptControlIcon: /* @__PURE__ */ jsx10(Superscript, { ...iconProps }),
1186
- underlineControlIcon: /* @__PURE__ */ jsx10(Underline, { ...iconProps }),
1187
- undoControlIcon: /* @__PURE__ */ jsx10(Undo2, { ...iconProps }),
1188
- unlinkControlIcon: /* @__PURE__ */ jsx10(Link2Off, { ...iconProps })
1700
+ linkControlIcon: /* @__PURE__ */ jsx23(Link, { ...iconProps }),
1701
+ orderedListControlIcon: /* @__PURE__ */ jsx23(ListOrdered, { ...iconProps }),
1702
+ redoControlIcon: /* @__PURE__ */ jsx23(Redo2, { ...iconProps }),
1703
+ strikeControlIcon: /* @__PURE__ */ jsx23(Strikethrough, { ...iconProps }),
1704
+ subscriptControlIcon: /* @__PURE__ */ jsx23(Subscript, { ...iconProps }),
1705
+ superscriptControlIcon: /* @__PURE__ */ jsx23(Superscript, { ...iconProps }),
1706
+ underlineControlIcon: /* @__PURE__ */ jsx23(Underline, { ...iconProps }),
1707
+ undoControlIcon: /* @__PURE__ */ jsx23(Undo2, { ...iconProps }),
1708
+ unlinkControlIcon: /* @__PURE__ */ jsx23(Link2Off, { ...iconProps })
1189
1709
  };
1190
1710
 
1191
1711
  // src/extensions/resizable-node-view.tsx
1192
- import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
1712
+ import { Fragment as Fragment5, jsx as jsx24, jsxs as jsxs11 } from "react/jsx-runtime";
1193
1713
  var EmbedToolbar = ({
1194
1714
  align,
1195
1715
  videoSrc,
@@ -1206,8 +1726,8 @@ var EmbedToolbar = ({
1206
1726
  nodeSrc
1207
1727
  }) => {
1208
1728
  if (isEditingUrl) {
1209
- return /* @__PURE__ */ jsxs5("div", { className: "rte-embed-selector-edit-form", children: [
1210
- /* @__PURE__ */ jsx11(
1729
+ return /* @__PURE__ */ jsxs11("div", { className: "rte-embed-selector-edit-form", children: [
1730
+ /* @__PURE__ */ jsx24(
1211
1731
  "input",
1212
1732
  {
1213
1733
  ref: inputRef,
@@ -1225,7 +1745,7 @@ var EmbedToolbar = ({
1225
1745
  }
1226
1746
  }
1227
1747
  ),
1228
- /* @__PURE__ */ jsx11(
1748
+ /* @__PURE__ */ jsx24(
1229
1749
  "button",
1230
1750
  {
1231
1751
  type: "button",
@@ -1234,7 +1754,7 @@ var EmbedToolbar = ({
1234
1754
  children: "Save"
1235
1755
  }
1236
1756
  ),
1237
- /* @__PURE__ */ jsx11(
1757
+ /* @__PURE__ */ jsx24(
1238
1758
  "button",
1239
1759
  {
1240
1760
  type: "button",
@@ -1245,8 +1765,8 @@ var EmbedToolbar = ({
1245
1765
  )
1246
1766
  ] });
1247
1767
  }
1248
- return /* @__PURE__ */ jsxs5(Fragment3, { children: [
1249
- /* @__PURE__ */ jsx11("div", { className: "rte-embed-selector-group", children: ["left", "center", "right"].map((dir) => /* @__PURE__ */ jsx11(
1768
+ return /* @__PURE__ */ jsxs11(Fragment5, { children: [
1769
+ /* @__PURE__ */ jsx24("div", { className: "rte-embed-selector-group", children: ["left", "center", "right"].map((dir) => /* @__PURE__ */ jsx24(
1250
1770
  "button",
1251
1771
  {
1252
1772
  type: "button",
@@ -1254,12 +1774,12 @@ var EmbedToolbar = ({
1254
1774
  "aria-label": `Align ${dir.charAt(0).toUpperCase()}${dir.slice(1)}`,
1255
1775
  className: `rte-embed-selector-btn ${align === dir ? "rte-embed-selector-btn--active" : ""}`,
1256
1776
  onClick: () => updateAttributes({ align: dir }),
1257
- children: /* @__PURE__ */ jsx11(AlignIcon, { dir })
1777
+ children: /* @__PURE__ */ jsx24(AlignIcon, { dir })
1258
1778
  },
1259
1779
  dir
1260
1780
  )) }),
1261
- /* @__PURE__ */ jsx11("div", { className: "rte-embed-selector-divider" }),
1262
- /* @__PURE__ */ jsx11("div", { className: "rte-embed-selector-group", children: [25, 50, 75, 100].map((pct) => /* @__PURE__ */ jsxs5(
1781
+ /* @__PURE__ */ jsx24("div", { className: "rte-embed-selector-divider" }),
1782
+ /* @__PURE__ */ jsx24("div", { className: "rte-embed-selector-group", children: [25, 50, 75, 100].map((pct) => /* @__PURE__ */ jsxs11(
1263
1783
  "button",
1264
1784
  {
1265
1785
  type: "button",
@@ -1273,9 +1793,9 @@ var EmbedToolbar = ({
1273
1793
  },
1274
1794
  pct
1275
1795
  )) }),
1276
- /* @__PURE__ */ jsx11("div", { className: "rte-embed-selector-divider" }),
1277
- /* @__PURE__ */ jsxs5("div", { className: "rte-embed-selector-group", children: [
1278
- (videoSrc || nodeSrc) && /* @__PURE__ */ jsx11(
1796
+ /* @__PURE__ */ jsx24("div", { className: "rte-embed-selector-divider" }),
1797
+ /* @__PURE__ */ jsxs11("div", { className: "rte-embed-selector-group", children: [
1798
+ (videoSrc || nodeSrc) && /* @__PURE__ */ jsx24(
1279
1799
  "button",
1280
1800
  {
1281
1801
  type: "button",
@@ -1286,10 +1806,10 @@ var EmbedToolbar = ({
1286
1806
  setUrlInput(videoSrc || nodeSrc || "");
1287
1807
  setIsEditingUrl(true);
1288
1808
  },
1289
- children: /* @__PURE__ */ jsx11(EditUrlIcon, {})
1809
+ children: /* @__PURE__ */ jsx24(EditUrlIcon, {})
1290
1810
  }
1291
1811
  ),
1292
- watchUrl && /* @__PURE__ */ jsx11(
1812
+ watchUrl && /* @__PURE__ */ jsx24(
1293
1813
  "button",
1294
1814
  {
1295
1815
  type: "button",
@@ -1297,10 +1817,10 @@ var EmbedToolbar = ({
1297
1817
  "aria-label": "Open video in YouTube",
1298
1818
  className: "rte-embed-selector-btn",
1299
1819
  onClick: () => window.open(watchUrl, "_blank"),
1300
- children: /* @__PURE__ */ jsx11(OpenInYouTubeIcon, {})
1820
+ children: /* @__PURE__ */ jsx24(OpenInYouTubeIcon, {})
1301
1821
  }
1302
1822
  ),
1303
- deleteNode && /* @__PURE__ */ jsx11(
1823
+ deleteNode && /* @__PURE__ */ jsx24(
1304
1824
  "button",
1305
1825
  {
1306
1826
  type: "button",
@@ -1308,7 +1828,7 @@ var EmbedToolbar = ({
1308
1828
  "aria-label": "Delete Embed",
1309
1829
  className: "rte-embed-selector-btn rte-embed-selector-btn--danger",
1310
1830
  onClick: () => deleteNode(),
1311
- children: /* @__PURE__ */ jsx11(DeleteEmbedIcon, {})
1831
+ children: /* @__PURE__ */ jsx24(DeleteEmbedIcon, {})
1312
1832
  }
1313
1833
  )
1314
1834
  ] })
@@ -1330,12 +1850,12 @@ var ResizableNodeView = ({
1330
1850
  watchUrl,
1331
1851
  onSrcChange
1332
1852
  }) => {
1333
- const containerRef = useRef2(null);
1334
- const [isEditingUrl, setIsEditingUrl] = useState3(false);
1335
- const [urlInput, setUrlInput] = useState3(videoSrc || "");
1336
- const [isResizing, setIsResizing] = useState3(false);
1337
- const [currentDimensions, setCurrentDimensions] = useState3(null);
1338
- const resizingRef = useRef2(null);
1853
+ const containerRef = useRef3(null);
1854
+ const [isEditingUrl, setIsEditingUrl] = useState5(false);
1855
+ const [urlInput, setUrlInput] = useState5(videoSrc || "");
1856
+ const [isResizing, setIsResizing] = useState5(false);
1857
+ const [currentDimensions, setCurrentDimensions] = useState5(null);
1858
+ const resizingRef = useRef3(null);
1339
1859
  const width = node.attrs.width;
1340
1860
  const height = node.attrs.height;
1341
1861
  const align = node.attrs.align || "center";
@@ -1343,7 +1863,7 @@ var ResizableNodeView = ({
1343
1863
  () => view?.dom?.parentElement?.offsetWidth ?? 800,
1344
1864
  [view]
1345
1865
  );
1346
- const inputRef = useRef2(null);
1866
+ const inputRef = useRef3(null);
1347
1867
  useEffect3(() => {
1348
1868
  if (isEditingUrl) {
1349
1869
  inputRef.current?.focus();
@@ -1479,13 +1999,13 @@ var ResizableNodeView = ({
1479
1999
  setIsEditingUrl(false);
1480
2000
  };
1481
2001
  const isEditable = editor ? editor.isEditable : true;
1482
- return /* @__PURE__ */ jsx11(
2002
+ return /* @__PURE__ */ jsx24(
1483
2003
  NodeViewWrapper,
1484
2004
  {
1485
2005
  className: "rte-embed-wrapper",
1486
2006
  "data-selected": selected || void 0,
1487
2007
  "data-align": align,
1488
- children: /* @__PURE__ */ jsxs5(
2008
+ children: /* @__PURE__ */ jsxs11(
1489
2009
  "div",
1490
2010
  {
1491
2011
  ref: containerRef,
@@ -1498,7 +2018,7 @@ var ResizableNodeView = ({
1498
2018
  },
1499
2019
  children: [
1500
2020
  children,
1501
- selected && isEditable && /* @__PURE__ */ jsx11("div", { className: "rte-embed-selector", contentEditable: false, children: /* @__PURE__ */ jsx11(
2021
+ selected && isEditable && /* @__PURE__ */ jsx24("div", { className: "rte-embed-selector", contentEditable: false, children: /* @__PURE__ */ jsx24(
1502
2022
  EmbedToolbar,
1503
2023
  {
1504
2024
  align,
@@ -1516,14 +2036,14 @@ var ResizableNodeView = ({
1516
2036
  nodeSrc: node.attrs.src
1517
2037
  }
1518
2038
  ) }),
1519
- isResizing && currentDimensions && /* @__PURE__ */ jsxs5("div", { className: "rte-embed-resize-badge", children: [
2039
+ isResizing && currentDimensions && /* @__PURE__ */ jsxs11("div", { className: "rte-embed-resize-badge", children: [
1520
2040
  currentDimensions.w,
1521
2041
  " \xD7 ",
1522
2042
  currentDimensions.h,
1523
2043
  " px"
1524
2044
  ] }),
1525
- selected && isEditable && /* @__PURE__ */ jsxs5(Fragment3, { children: [
1526
- /* @__PURE__ */ jsx11(
2045
+ selected && isEditable && /* @__PURE__ */ jsxs11(Fragment5, { children: [
2046
+ /* @__PURE__ */ jsx24(
1527
2047
  "div",
1528
2048
  {
1529
2049
  className: "rte-resize-handle rte-resize-handle--left",
@@ -1531,7 +2051,7 @@ var ResizableNodeView = ({
1531
2051
  role: "presentation"
1532
2052
  }
1533
2053
  ),
1534
- /* @__PURE__ */ jsx11(
2054
+ /* @__PURE__ */ jsx24(
1535
2055
  "div",
1536
2056
  {
1537
2057
  className: "rte-resize-handle rte-resize-handle--right",
@@ -1539,7 +2059,7 @@ var ResizableNodeView = ({
1539
2059
  role: "presentation"
1540
2060
  }
1541
2061
  ),
1542
- /* @__PURE__ */ jsx11(
2062
+ /* @__PURE__ */ jsx24(
1543
2063
  "div",
1544
2064
  {
1545
2065
  className: "rte-resize-handle rte-resize-handle--bottom",
@@ -1547,7 +2067,7 @@ var ResizableNodeView = ({
1547
2067
  role: "presentation"
1548
2068
  }
1549
2069
  ),
1550
- /* @__PURE__ */ jsx11(
2070
+ /* @__PURE__ */ jsx24(
1551
2071
  "div",
1552
2072
  {
1553
2073
  className: "rte-resize-handle rte-resize-handle--corner rte-resize-handle--corner-bl",
@@ -1555,7 +2075,7 @@ var ResizableNodeView = ({
1555
2075
  role: "presentation"
1556
2076
  }
1557
2077
  ),
1558
- /* @__PURE__ */ jsx11(
2078
+ /* @__PURE__ */ jsx24(
1559
2079
  "div",
1560
2080
  {
1561
2081
  className: "rte-resize-handle rte-resize-handle--corner rte-resize-handle--corner-br",
@@ -1571,121 +2091,8 @@ var ResizableNodeView = ({
1571
2091
  );
1572
2092
  };
1573
2093
 
1574
- // src/ui/dialog.tsx
1575
- import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
1576
- import "react";
1577
- import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
1578
- var Dialog = ({ ...props }) => /* @__PURE__ */ jsx12(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
1579
- var DialogTrigger = ({ ...props }) => /* @__PURE__ */ jsx12(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
1580
- var DialogPortal = ({ ...props }) => /* @__PURE__ */ jsx12(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
1581
- var DialogClose = ({ ...props }) => /* @__PURE__ */ jsx12(DialogPrimitive.Close, { "data-slot": "dialog-close", ...props });
1582
- var DialogOverlay = ({
1583
- className,
1584
- ...props
1585
- }) => /* @__PURE__ */ jsx12(
1586
- DialogPrimitive.Backdrop,
1587
- {
1588
- "data-slot": "dialog-overlay",
1589
- className: cn(
1590
- "fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
1591
- className
1592
- ),
1593
- ...props
1594
- }
1595
- );
1596
- var DialogContent = ({
1597
- className,
1598
- children,
1599
- showCloseButton = true,
1600
- ...props
1601
- }) => /* @__PURE__ */ jsxs6(DialogPortal, { children: [
1602
- /* @__PURE__ */ jsx12(DialogOverlay, {}),
1603
- /* @__PURE__ */ jsxs6(
1604
- DialogPrimitive.Popup,
1605
- {
1606
- "data-slot": "dialog-content",
1607
- className: cn(
1608
- "fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-none bg-popover p-4 text-xs/relaxed text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
1609
- className
1610
- ),
1611
- ...props,
1612
- children: [
1613
- children,
1614
- showCloseButton && /* @__PURE__ */ jsxs6(
1615
- DialogPrimitive.Close,
1616
- {
1617
- "data-slot": "dialog-close",
1618
- render: /* @__PURE__ */ jsx12(
1619
- Button,
1620
- {
1621
- variant: "ghost",
1622
- className: "absolute top-2 right-2",
1623
- size: "icon-sm"
1624
- }
1625
- ),
1626
- children: [
1627
- "X",
1628
- /* @__PURE__ */ jsx12("span", { className: "sr-only", children: "Close" })
1629
- ]
1630
- }
1631
- )
1632
- ]
1633
- }
1634
- )
1635
- ] });
1636
- var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx12(
1637
- "div",
1638
- {
1639
- "data-slot": "dialog-header",
1640
- className: cn("flex flex-col gap-1 text-left", className),
1641
- ...props
1642
- }
1643
- );
1644
- var DialogFooter = ({
1645
- className,
1646
- showCloseButton = false,
1647
- children,
1648
- ...props
1649
- }) => /* @__PURE__ */ jsxs6(
1650
- "div",
1651
- {
1652
- "data-slot": "dialog-footer",
1653
- className: cn(
1654
- "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
1655
- className
1656
- ),
1657
- ...props,
1658
- children: [
1659
- children,
1660
- showCloseButton && /* @__PURE__ */ jsx12(DialogPrimitive.Close, { render: /* @__PURE__ */ jsx12(Button, { variant: "outline" }), children: "Close" })
1661
- ]
1662
- }
1663
- );
1664
- var DialogTitle = ({ className, ...props }) => /* @__PURE__ */ jsx12(
1665
- DialogPrimitive.Title,
1666
- {
1667
- "data-slot": "dialog-title",
1668
- className: cn("text-sm font-medium", className),
1669
- ...props
1670
- }
1671
- );
1672
- var DialogDescription = ({
1673
- className,
1674
- ...props
1675
- }) => /* @__PURE__ */ jsx12(
1676
- DialogPrimitive.Description,
1677
- {
1678
- "data-slot": "dialog-description",
1679
- className: cn(
1680
- "text-xs/relaxed text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",
1681
- className
1682
- ),
1683
- ...props
1684
- }
1685
- );
1686
-
1687
2094
  // src/controls/rte-twitter-control.tsx
1688
- import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
2095
+ import { jsx as jsx25, jsxs as jsxs12 } from "react/jsx-runtime";
1689
2096
  var WIDGET_SCRIPT_URL = "https://platform.twitter.com/widgets.js";
1690
2097
  var SCRIPT_LOAD_TIMEOUT_MS = 8e3;
1691
2098
  var READY_POLL_INTERVAL_MS = 50;
@@ -1712,18 +2119,23 @@ var loadTwitterScript = () => {
1712
2119
  document.body.append(script);
1713
2120
  }
1714
2121
  let settled = false;
2122
+ const timers = {};
1715
2123
  const cleanup = () => {
1716
- clearInterval(pollId);
1717
- clearTimeout(timeoutId);
2124
+ clearInterval(timers.poll);
2125
+ clearTimeout(timers.timeout);
1718
2126
  };
1719
2127
  const succeed = () => {
1720
- if (settled) return;
2128
+ if (settled) {
2129
+ return;
2130
+ }
1721
2131
  settled = true;
1722
2132
  cleanup();
1723
2133
  resolve();
1724
2134
  };
1725
2135
  const fail = () => {
1726
- if (settled) return;
2136
+ if (settled) {
2137
+ return;
2138
+ }
1727
2139
  settled = true;
1728
2140
  cleanup();
1729
2141
  twitterScriptPromise = null;
@@ -1733,12 +2145,12 @@ var loadTwitterScript = () => {
1733
2145
  succeed();
1734
2146
  return;
1735
2147
  }
1736
- const pollId = setInterval(() => {
2148
+ timers.poll = setInterval(() => {
1737
2149
  if (window.twttr?.widgets) {
1738
2150
  succeed();
1739
2151
  }
1740
2152
  }, READY_POLL_INTERVAL_MS);
1741
- const timeoutId = setTimeout(fail, SCRIPT_LOAD_TIMEOUT_MS);
2153
+ timers.timeout = setTimeout(fail, SCRIPT_LOAD_TIMEOUT_MS);
1742
2154
  if (isNewScript) {
1743
2155
  script.addEventListener(
1744
2156
  "load",
@@ -1756,14 +2168,14 @@ var loadTwitterScript = () => {
1756
2168
  };
1757
2169
  var TwitterNodeView = (props) => {
1758
2170
  const { node } = props;
1759
- const containerRef = useRef3(null);
1760
- const [loading, setLoading] = useState4(true);
1761
- const [failed, setFailed] = useState4(false);
2171
+ const containerRef = useRef4(null);
2172
+ const [loading, setLoading] = useState6(true);
2173
+ const [failed, setFailed] = useState6(false);
1762
2174
  const { tweetId } = node.attrs;
1763
- const renderedTweetIdRef = useRef3(null);
1764
- const activeRenderIdRef = useRef3(0);
1765
- const retryToken = useRef3(0);
1766
- const [retryCount, setRetryCount] = useState4(0);
2175
+ const renderedTweetIdRef = useRef4(null);
2176
+ const activeRenderIdRef = useRef4(0);
2177
+ const retryToken = useRef4(0);
2178
+ const [retryCount, setRetryCount] = useState6(0);
1767
2179
  useEffect4(() => {
1768
2180
  if (!containerRef.current || !tweetId) {
1769
2181
  return;
@@ -1827,7 +2239,7 @@ var TwitterNodeView = (props) => {
1827
2239
  retryToken.current += 1;
1828
2240
  setRetryCount(retryToken.current);
1829
2241
  }, []);
1830
- return /* @__PURE__ */ jsxs7(
2242
+ return /* @__PURE__ */ jsxs12(
1831
2243
  ResizableNodeView,
1832
2244
  {
1833
2245
  ...props,
@@ -1835,12 +2247,12 @@ var TwitterNodeView = (props) => {
1835
2247
  minWidth: 300,
1836
2248
  maxWidth: 1200,
1837
2249
  children: [
1838
- loading && /* @__PURE__ */ jsx13("div", { className: "rte-embed-loading", children: "Loading tweet..." }),
1839
- !loading && failed && /* @__PURE__ */ jsxs7("div", { className: "rte-embed-error", children: [
1840
- /* @__PURE__ */ jsx13("p", { children: "Couldn't load this tweet." }),
1841
- /* @__PURE__ */ jsx13("button", { type: "button", onClick: handleRetry, children: "Retry" })
2250
+ loading && /* @__PURE__ */ jsx25("div", { className: "rte-embed-loading", children: "Loading tweet..." }),
2251
+ !loading && failed && /* @__PURE__ */ jsxs12("div", { className: "rte-embed-error", children: [
2252
+ /* @__PURE__ */ jsx25("p", { children: "Couldn't load this tweet." }),
2253
+ /* @__PURE__ */ jsx25("button", { type: "button", onClick: handleRetry, children: "Retry" })
1842
2254
  ] }),
1843
- /* @__PURE__ */ jsx13("div", { ref: containerRef })
2255
+ /* @__PURE__ */ jsx25("div", { ref: containerRef })
1844
2256
  ]
1845
2257
  }
1846
2258
  );
@@ -1930,9 +2342,9 @@ var extractTweetId = (input) => {
1930
2342
  };
1931
2343
  var TwitterEmbedControl = ({ className }) => {
1932
2344
  const { editor } = useRichTextEditorContext();
1933
- const [open, setOpen] = useState4(false);
1934
- const [url, setUrl] = useState4("");
1935
- const [touched, setTouched] = useState4(false);
2345
+ const [open, setOpen] = useState6(false);
2346
+ const [url, setUrl] = useState6("");
2347
+ const [touched, setTouched] = useState6(false);
1936
2348
  const { active } = useEditorState4({
1937
2349
  editor: editor ?? null,
1938
2350
  selector: (ctx) => ({
@@ -1954,7 +2366,7 @@ var TwitterEmbedControl = ({ className }) => {
1954
2366
  resetState();
1955
2367
  return true;
1956
2368
  }, [tweetId, editor, resetState]);
1957
- return /* @__PURE__ */ jsxs7(
2369
+ return /* @__PURE__ */ jsxs12(
1958
2370
  Dialog,
1959
2371
  {
1960
2372
  open,
@@ -1965,59 +2377,59 @@ var TwitterEmbedControl = ({ className }) => {
1965
2377
  }
1966
2378
  },
1967
2379
  children: [
1968
- /* @__PURE__ */ jsx13(
2380
+ /* @__PURE__ */ jsx25(
1969
2381
  DialogTrigger,
1970
2382
  {
1971
- render: /* @__PURE__ */ jsx13(
2383
+ render: /* @__PURE__ */ jsx25(
1972
2384
  RichTextEditorControl,
1973
2385
  {
1974
2386
  active,
1975
2387
  className,
1976
2388
  title: "Embed Tweet",
1977
2389
  "aria-label": "Embed Tweet",
1978
- children: /* @__PURE__ */ jsx13(
2390
+ children: /* @__PURE__ */ jsx25(
1979
2391
  "svg",
1980
2392
  {
1981
2393
  xmlns: "http://www.w3.org/2000/svg",
1982
2394
  viewBox: "0 0 24 24",
1983
2395
  fill: "currentColor",
1984
2396
  className: "rte-editor-icon",
1985
- children: /* @__PURE__ */ jsx13("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" })
2397
+ children: /* @__PURE__ */ jsx25("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" })
1986
2398
  }
1987
2399
  )
1988
2400
  }
1989
2401
  )
1990
2402
  }
1991
2403
  ),
1992
- /* @__PURE__ */ jsxs7(DialogContent, { children: [
1993
- /* @__PURE__ */ jsxs7(DialogHeader, { children: [
1994
- /* @__PURE__ */ jsx13(DialogTitle, { children: "Embed Tweet" }),
1995
- /* @__PURE__ */ jsx13(DialogDescription, { children: "Paste a tweet URL or ID." })
2404
+ /* @__PURE__ */ jsxs12(DialogContent, { children: [
2405
+ /* @__PURE__ */ jsxs12(DialogHeader, { children: [
2406
+ /* @__PURE__ */ jsx25(DialogTitle, { children: "Embed Tweet" }),
2407
+ /* @__PURE__ */ jsx25(DialogDescription, { children: "Paste a tweet URL or ID." })
1996
2408
  ] }),
1997
- /* @__PURE__ */ jsx13(
2409
+ /* @__PURE__ */ jsx25(
1998
2410
  Input,
1999
2411
  {
2000
2412
  value: url,
2001
2413
  onChange: (e) => {
2002
2414
  setUrl(e.target.value);
2003
- if (touched) setTouched(false);
2415
+ if (touched) {
2416
+ setTouched(false);
2417
+ }
2004
2418
  },
2005
2419
  onBlur: () => setTouched(true),
2006
2420
  placeholder: "https://x.com/user/status/...",
2007
2421
  "aria-invalid": showError,
2008
2422
  onKeyDown: (e) => {
2009
- if (e.key === "Enter" && url) {
2010
- if (handleInsert()) {
2011
- setOpen(false);
2012
- }
2423
+ if (e.key === "Enter" && url && handleInsert()) {
2424
+ setOpen(false);
2013
2425
  }
2014
2426
  }
2015
2427
  }
2016
2428
  ),
2017
- showError && /* @__PURE__ */ jsx13("p", { className: "rte-input-error", role: "alert", children: "That doesn't look like a valid tweet URL or ID." }),
2018
- /* @__PURE__ */ jsxs7(DialogFooter, { children: [
2019
- /* @__PURE__ */ jsx13(DialogClose, { children: "Cancel" }),
2020
- /* @__PURE__ */ jsx13(
2429
+ showError && /* @__PURE__ */ jsx25("p", { className: "rte-input-error", role: "alert", children: "That doesn't look like a valid tweet URL or ID." }),
2430
+ /* @__PURE__ */ jsxs12(DialogFooter, { children: [
2431
+ /* @__PURE__ */ jsx25(DialogClose, { children: "Cancel" }),
2432
+ /* @__PURE__ */ jsx25(
2021
2433
  "button",
2022
2434
  {
2023
2435
  type: "button",
@@ -2041,8 +2453,8 @@ var TwitterEmbedControl = ({ className }) => {
2041
2453
  // src/controls/rte-youtube-control.tsx
2042
2454
  import { Node as Node2, nodeInputRule as nodeInputRule2 } from "@tiptap/core";
2043
2455
  import { ReactNodeViewRenderer as ReactNodeViewRenderer2, useEditorState as useEditorState5 } from "@tiptap/react";
2044
- import { useState as useState5, useCallback as useCallback7 } from "react";
2045
- import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
2456
+ import { useState as useState7, useCallback as useCallback7 } from "react";
2457
+ import { jsx as jsx26, jsxs as jsxs13 } from "react/jsx-runtime";
2046
2458
  var getYouTubeId = (url) => {
2047
2459
  const clean = url.trim();
2048
2460
  const patterns = [
@@ -2070,7 +2482,7 @@ var YouTubeNodeView = (props) => {
2070
2482
  if (videoId) {
2071
2483
  watchUrl = videoId.startsWith("http") ? videoId : `https://www.youtube.com/watch?v=${videoId}`;
2072
2484
  }
2073
- return /* @__PURE__ */ jsx14(
2485
+ return /* @__PURE__ */ jsx26(
2074
2486
  ResizableNodeView,
2075
2487
  {
2076
2488
  ...props,
@@ -2081,7 +2493,7 @@ var YouTubeNodeView = (props) => {
2081
2493
  videoSrc: rawSrc,
2082
2494
  watchUrl,
2083
2495
  onSrcChange: (newSrc) => updateAttributes({ src: newSrc }),
2084
- children: /* @__PURE__ */ jsx14(
2496
+ children: /* @__PURE__ */ jsx26(
2085
2497
  "iframe",
2086
2498
  {
2087
2499
  src: `https://www.youtube-nocookie.com/embed/${videoId}`,
@@ -2169,8 +2581,8 @@ var YouTubeEmbed = Node2.create({
2169
2581
  });
2170
2582
  var YouTubeEmbedControl = ({ className }) => {
2171
2583
  const { editor } = useRichTextEditorContext();
2172
- const [open, setOpen] = useState5(false);
2173
- const [url, setUrl] = useState5("");
2584
+ const [open, setOpen] = useState7(false);
2585
+ const [url, setUrl] = useState7("");
2174
2586
  const { active } = useEditorState5({
2175
2587
  editor: editor ?? null,
2176
2588
  selector: (ctx) => ({
@@ -2183,18 +2595,18 @@ var YouTubeEmbedControl = ({ className }) => {
2183
2595
  setUrl("");
2184
2596
  }
2185
2597
  }, [url, editor]);
2186
- return /* @__PURE__ */ jsxs8(Dialog, { open, onOpenChange: setOpen, children: [
2187
- /* @__PURE__ */ jsx14(
2598
+ return /* @__PURE__ */ jsxs13(Dialog, { open, onOpenChange: setOpen, children: [
2599
+ /* @__PURE__ */ jsx26(
2188
2600
  DialogTrigger,
2189
2601
  {
2190
- render: /* @__PURE__ */ jsx14(
2602
+ render: /* @__PURE__ */ jsx26(
2191
2603
  RichTextEditorControl,
2192
2604
  {
2193
2605
  active,
2194
2606
  className,
2195
2607
  title: "Embed YouTube video",
2196
2608
  "aria-label": "Embed YouTube video",
2197
- children: /* @__PURE__ */ jsxs8(
2609
+ children: /* @__PURE__ */ jsxs13(
2198
2610
  "svg",
2199
2611
  {
2200
2612
  xmlns: "http://www.w3.org/2000/svg",
@@ -2206,8 +2618,8 @@ var YouTubeEmbedControl = ({ className }) => {
2206
2618
  strokeLinejoin: "round",
2207
2619
  className: "rte-editor-icon",
2208
2620
  children: [
2209
- /* @__PURE__ */ jsx14("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" }),
2210
- /* @__PURE__ */ jsx14("path", { d: "M9.5 15.5V8.5l6.2 3.5z" })
2621
+ /* @__PURE__ */ jsx26("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" }),
2622
+ /* @__PURE__ */ jsx26("path", { d: "M9.5 15.5V8.5l6.2 3.5z" })
2211
2623
  ]
2212
2624
  }
2213
2625
  )
@@ -2215,12 +2627,12 @@ var YouTubeEmbedControl = ({ className }) => {
2215
2627
  )
2216
2628
  }
2217
2629
  ),
2218
- /* @__PURE__ */ jsxs8(DialogContent, { showCloseButton: false, children: [
2219
- /* @__PURE__ */ jsxs8(DialogHeader, { children: [
2220
- /* @__PURE__ */ jsx14(DialogTitle, { children: "Embed YouTube video" }),
2221
- /* @__PURE__ */ jsx14(DialogDescription, { children: "Paste a YouTube video URL or ID." })
2630
+ /* @__PURE__ */ jsxs13(DialogContent, { showCloseButton: false, children: [
2631
+ /* @__PURE__ */ jsxs13(DialogHeader, { children: [
2632
+ /* @__PURE__ */ jsx26(DialogTitle, { children: "Embed YouTube video" }),
2633
+ /* @__PURE__ */ jsx26(DialogDescription, { children: "Paste a YouTube video URL or ID." })
2222
2634
  ] }),
2223
- /* @__PURE__ */ jsx14(
2635
+ /* @__PURE__ */ jsx26(
2224
2636
  Input,
2225
2637
  {
2226
2638
  value: url,
@@ -2234,9 +2646,9 @@ var YouTubeEmbedControl = ({ className }) => {
2234
2646
  }
2235
2647
  }
2236
2648
  ),
2237
- /* @__PURE__ */ jsxs8(DialogFooter, { children: [
2238
- /* @__PURE__ */ jsx14(DialogClose, { children: "Cancel" }),
2239
- /* @__PURE__ */ jsx14(
2649
+ /* @__PURE__ */ jsxs13(DialogFooter, { children: [
2650
+ /* @__PURE__ */ jsx26(DialogClose, { children: "Cancel" }),
2651
+ /* @__PURE__ */ jsx26(
2240
2652
  DialogClose,
2241
2653
  {
2242
2654
  disabled: !url,
@@ -2293,14 +2705,14 @@ var DEFAULT_LABELS = {
2293
2705
 
2294
2706
  // src/rte-content.tsx
2295
2707
  import { EditorContent } from "@tiptap/react";
2296
- import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
2708
+ import { jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
2297
2709
  var Content = ({
2298
2710
  children,
2299
2711
  className
2300
2712
  }) => {
2301
2713
  const { editor } = useRichTextEditorContext();
2302
- return /* @__PURE__ */ jsxs9("div", { className: "relative", children: [
2303
- /* @__PURE__ */ jsx15(
2714
+ return /* @__PURE__ */ jsxs14("div", { className: "relative", children: [
2715
+ /* @__PURE__ */ jsx27(
2304
2716
  EditorContent,
2305
2717
  {
2306
2718
  editor,
@@ -2312,15 +2724,15 @@ var Content = ({
2312
2724
  };
2313
2725
 
2314
2726
  // src/rte-controls-group.tsx
2315
- import { jsx as jsx16 } from "react/jsx-runtime";
2727
+ import { jsx as jsx28 } from "react/jsx-runtime";
2316
2728
  var ControlsGroup = ({
2317
2729
  children,
2318
2730
  className
2319
- }) => /* @__PURE__ */ jsx16("div", { className: cn("rte-controls-group", className), children });
2731
+ }) => /* @__PURE__ */ jsx28("div", { className: cn("rte-controls-group", className), children });
2320
2732
 
2321
2733
  // src/rte-footer.tsx
2322
- import { useEffect as useEffect5, useMemo, useRef as useRef4, useState as useState6 } from "react";
2323
- import { Fragment as Fragment4, jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
2734
+ import { useEffect as useEffect5, useMemo, useRef as useRef5, useState as useState8 } from "react";
2735
+ import { Fragment as Fragment6, jsx as jsx29, jsxs as jsxs15 } from "react/jsx-runtime";
2324
2736
  var Footer = ({
2325
2737
  children,
2326
2738
  className,
@@ -2331,8 +2743,8 @@ var Footer = ({
2331
2743
  wordCountFormatter
2332
2744
  }) => {
2333
2745
  const { editor, variant } = useRichTextEditorContext();
2334
- const [, forceUpdate] = useState6(0);
2335
- const rafRef = useRef4(null);
2746
+ const [, forceUpdate] = useState8(0);
2747
+ const rafRef = useRef5(null);
2336
2748
  useEffect5(() => {
2337
2749
  if (!editor || !showWordCount) {
2338
2750
  return;
@@ -2379,7 +2791,7 @@ var Footer = ({
2379
2791
  if (!showWordCount && !children) {
2380
2792
  return null;
2381
2793
  }
2382
- return /* @__PURE__ */ jsxs10(
2794
+ return /* @__PURE__ */ jsxs15(
2383
2795
  "div",
2384
2796
  {
2385
2797
  className: cn(
@@ -2391,21 +2803,21 @@ var Footer = ({
2391
2803
  "data-sticky": sticky ? "" : void 0,
2392
2804
  style: sticky ? { bottom: stickyOffset } : void 0,
2393
2805
  children: [
2394
- showWordCount && wordCount && /* @__PURE__ */ jsx17("span", { className: cn("rte-footer-word-count", wordCountClassName), children: wordCountFormatter ? wordCountFormatter(wordCount) : /* @__PURE__ */ jsxs10(Fragment4, { children: [
2395
- /* @__PURE__ */ jsxs10("span", { className: "rte-footer-word-count-stat", children: [
2396
- /* @__PURE__ */ jsx17("span", { className: "rte-footer-word-count-number", children: wordCount.words }),
2397
- /* @__PURE__ */ jsx17("span", { className: "rte-footer-word-count-unit", children: "words" })
2806
+ showWordCount && wordCount && /* @__PURE__ */ jsx29("span", { className: cn("rte-footer-word-count", wordCountClassName), children: wordCountFormatter ? wordCountFormatter(wordCount) : /* @__PURE__ */ jsxs15(Fragment6, { children: [
2807
+ /* @__PURE__ */ jsxs15("span", { className: "rte-footer-word-count-stat", children: [
2808
+ /* @__PURE__ */ jsx29("span", { className: "rte-footer-word-count-number", children: wordCount.words }),
2809
+ /* @__PURE__ */ jsx29("span", { className: "rte-footer-word-count-unit", children: "words" })
2398
2810
  ] }),
2399
- /* @__PURE__ */ jsx17(
2811
+ /* @__PURE__ */ jsx29(
2400
2812
  "span",
2401
2813
  {
2402
2814
  className: "rte-footer-word-count-separator",
2403
2815
  "aria-hidden": "true"
2404
2816
  }
2405
2817
  ),
2406
- /* @__PURE__ */ jsxs10("span", { className: "rte-footer-word-count-stat", children: [
2407
- /* @__PURE__ */ jsx17("span", { className: "rte-footer-word-count-number", children: wordCount.characters }),
2408
- /* @__PURE__ */ jsx17("span", { className: "rte-footer-word-count-unit", children: "characters" })
2818
+ /* @__PURE__ */ jsxs15("span", { className: "rte-footer-word-count-stat", children: [
2819
+ /* @__PURE__ */ jsx29("span", { className: "rte-footer-word-count-number", children: wordCount.characters }),
2820
+ /* @__PURE__ */ jsx29("span", { className: "rte-footer-word-count-unit", children: "characters" })
2409
2821
  ] })
2410
2822
  ] }) }),
2411
2823
  children
@@ -2415,7 +2827,7 @@ var Footer = ({
2415
2827
  };
2416
2828
 
2417
2829
  // src/rte-toolbar.tsx
2418
- import { jsx as jsx18 } from "react/jsx-runtime";
2830
+ import { jsx as jsx30 } from "react/jsx-runtime";
2419
2831
  var Toolbar = ({
2420
2832
  children,
2421
2833
  className,
@@ -2426,7 +2838,7 @@ var Toolbar = ({
2426
2838
  if (!editable) {
2427
2839
  return null;
2428
2840
  }
2429
- return /* @__PURE__ */ jsx18(
2841
+ return /* @__PURE__ */ jsx30(
2430
2842
  "div",
2431
2843
  {
2432
2844
  className: cn(
@@ -2443,7 +2855,7 @@ var Toolbar = ({
2443
2855
  };
2444
2856
 
2445
2857
  // src/rte-text-editor.tsx
2446
- import { jsx as jsx19 } from "react/jsx-runtime";
2858
+ import { jsx as jsx31 } from "react/jsx-runtime";
2447
2859
  var RichTextEditorRoot = ({
2448
2860
  editor,
2449
2861
  children,
@@ -2463,7 +2875,7 @@ var RichTextEditorRoot = ({
2463
2875
  editor.setEditable(editable);
2464
2876
  }
2465
2877
  }, [editor, editable]);
2466
- return /* @__PURE__ */ jsx19(
2878
+ return /* @__PURE__ */ jsx31(
2467
2879
  RichTextEditorContext.Provider,
2468
2880
  {
2469
2881
  value: {
@@ -2473,7 +2885,7 @@ var RichTextEditorRoot = ({
2473
2885
  labels: mergedLabels,
2474
2886
  variant
2475
2887
  },
2476
- children: /* @__PURE__ */ jsx19(
2888
+ children: /* @__PURE__ */ jsx31(
2477
2889
  "div",
2478
2890
  {
2479
2891
  className: cn(