@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.cjs CHANGED
@@ -44,28 +44,545 @@ __export(index_exports, {
44
44
  module.exports = __toCommonJS(index_exports);
45
45
 
46
46
  // src/rte-text-editor.tsx
47
- var import_react18 = require("react");
47
+ var import_react21 = require("react");
48
48
 
49
49
  // src/bubble-menu/index.tsx
50
50
  var import_core = require("@tiptap/core");
51
51
  var import_menus = require("@tiptap/react/menus");
52
- var import_react4 = require("react");
52
+ var import_react6 = require("react");
53
53
 
54
- // src/bubble-menu/language-selector.tsx
55
- var import_react3 = require("react");
54
+ // src/ui/button.tsx
55
+ var import_button = require("@base-ui/react/button");
56
+ var import_class_variance_authority = require("class-variance-authority");
56
57
 
57
- // src/rte-context.ts
58
+ // src/ui/utils.ts
59
+ var import_clsx = require("clsx");
60
+ var import_tailwind_merge = require("tailwind-merge");
61
+ var cn = (...inputs) => (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
62
+
63
+ // src/ui/button.tsx
64
+ var import_jsx_runtime = require("react/jsx-runtime");
65
+ var buttonVariants = (0, import_class_variance_authority.cva)(
66
+ "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",
67
+ {
68
+ defaultVariants: {
69
+ size: "default",
70
+ variant: "default"
71
+ },
72
+ variants: {
73
+ size: {
74
+ default: "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
75
+ icon: "size-8",
76
+ "icon-lg": "size-9",
77
+ "icon-sm": "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
78
+ "icon-xs": "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
79
+ lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
80
+ 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",
81
+ 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"
82
+ },
83
+ variant: {
84
+ default: "bg-primary text-primary-foreground hover:bg-primary/80",
85
+ 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",
86
+ ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
87
+ link: "text-primary underline-offset-4 hover:underline",
88
+ 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",
89
+ 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"
90
+ }
91
+ }
92
+ }
93
+ );
94
+ var Button = ({
95
+ className,
96
+ variant = "default",
97
+ size = "default",
98
+ ...props
99
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
100
+ import_button.Button,
101
+ {
102
+ "data-slot": "button",
103
+ className: cn(buttonVariants({ className, size, variant })),
104
+ ...props
105
+ }
106
+ );
107
+
108
+ // src/ui/dialog.tsx
109
+ var import_dialog = require("@base-ui/react/dialog");
110
+ var React = require("react");
111
+ var import_jsx_runtime2 = require("react/jsx-runtime");
112
+ var Dialog = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dialog.Dialog.Root, { "data-slot": "dialog", ...props });
113
+ var DialogTrigger = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dialog.Dialog.Trigger, { "data-slot": "dialog-trigger", ...props });
114
+ var DialogPortal = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dialog.Dialog.Portal, { "data-slot": "dialog-portal", ...props });
115
+ var DialogClose = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dialog.Dialog.Close, { "data-slot": "dialog-close", ...props });
116
+ var DialogOverlay = ({
117
+ className,
118
+ ...props
119
+ }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
120
+ import_dialog.Dialog.Backdrop,
121
+ {
122
+ "data-slot": "dialog-overlay",
123
+ className: cn(
124
+ "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",
125
+ className
126
+ ),
127
+ ...props
128
+ }
129
+ );
130
+ var DialogContent = ({
131
+ className,
132
+ children,
133
+ showCloseButton = true,
134
+ ...props
135
+ }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(DialogPortal, { children: [
136
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DialogOverlay, {}),
137
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
138
+ import_dialog.Dialog.Popup,
139
+ {
140
+ "data-slot": "dialog-content",
141
+ className: cn(
142
+ "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",
143
+ className
144
+ ),
145
+ ...props,
146
+ children: [
147
+ children,
148
+ showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
149
+ import_dialog.Dialog.Close,
150
+ {
151
+ "data-slot": "dialog-close",
152
+ render: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
153
+ Button,
154
+ {
155
+ variant: "ghost",
156
+ className: "absolute top-2 right-2",
157
+ size: "icon-sm"
158
+ }
159
+ ),
160
+ children: [
161
+ "X",
162
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "sr-only", children: "Close" })
163
+ ]
164
+ }
165
+ )
166
+ ]
167
+ }
168
+ )
169
+ ] });
170
+ var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
171
+ "div",
172
+ {
173
+ "data-slot": "dialog-header",
174
+ className: cn("flex flex-col gap-1 text-left", className),
175
+ ...props
176
+ }
177
+ );
178
+ var DialogFooter = ({
179
+ className,
180
+ showCloseButton = false,
181
+ children,
182
+ ...props
183
+ }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
184
+ "div",
185
+ {
186
+ "data-slot": "dialog-footer",
187
+ className: cn(
188
+ "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
189
+ className
190
+ ),
191
+ ...props,
192
+ children: [
193
+ children,
194
+ showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dialog.Dialog.Close, { render: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Button, { variant: "outline" }), children: "Close" })
195
+ ]
196
+ }
197
+ );
198
+ var DialogTitle = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
199
+ import_dialog.Dialog.Title,
200
+ {
201
+ "data-slot": "dialog-title",
202
+ className: cn("text-sm font-medium", className),
203
+ ...props
204
+ }
205
+ );
206
+ var DialogDescription = ({
207
+ className,
208
+ ...props
209
+ }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
210
+ import_dialog.Dialog.Description,
211
+ {
212
+ "data-slot": "dialog-description",
213
+ className: cn(
214
+ "text-xs/relaxed text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",
215
+ className
216
+ ),
217
+ ...props
218
+ }
219
+ );
220
+
221
+ // src/ui/input.tsx
222
+ var import_input = require("@base-ui/react/input");
223
+ var React2 = require("react");
224
+ var import_jsx_runtime3 = require("react/jsx-runtime");
225
+ var Input = ({
226
+ className,
227
+ type,
228
+ ...props
229
+ }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
230
+ import_input.Input,
231
+ {
232
+ type,
233
+ "data-slot": "input",
234
+ className: cn(
235
+ "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",
236
+ className
237
+ ),
238
+ ...props
239
+ }
240
+ );
241
+
242
+ // src/ui/popover.tsx
243
+ var import_popover = require("@base-ui/react/popover");
244
+ var React3 = require("react");
245
+ var import_jsx_runtime4 = require("react/jsx-runtime");
246
+ var Popover = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_popover.Popover.Root, { "data-slot": "popover", ...props });
247
+ var PopoverTrigger = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_popover.Popover.Trigger, { "data-slot": "popover-trigger", ...props });
248
+ var PopoverContent = ({
249
+ className,
250
+ align = "center",
251
+ alignOffset = 0,
252
+ side = "bottom",
253
+ sideOffset = 4,
254
+ ...props
255
+ }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_popover.Popover.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
256
+ import_popover.Popover.Positioner,
257
+ {
258
+ align,
259
+ alignOffset,
260
+ side,
261
+ sideOffset,
262
+ className: "isolate z-50",
263
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
264
+ import_popover.Popover.Popup,
265
+ {
266
+ "data-slot": "popover-content",
267
+ className: cn(
268
+ "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",
269
+ className
270
+ ),
271
+ ...props
272
+ }
273
+ )
274
+ }
275
+ ) });
276
+
277
+ // src/ui/rte-button.tsx
278
+ var React4 = __toESM(require("react"), 1);
279
+ var import_jsx_runtime5 = require("react/jsx-runtime");
280
+ var RteButton = React4.forwardRef(
281
+ ({ className = "", active = false, ...props }, ref) => {
282
+ const cls = [
283
+ "rte-bubble-btn",
284
+ active ? "rte-bubble-btn--active" : "",
285
+ className
286
+ ].filter(Boolean).join(" ");
287
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { ref, type: "button", className: cls, ...props });
288
+ }
289
+ );
290
+ RteButton.displayName = "RteButton";
291
+
292
+ // src/ui/rte-button-group.tsx
293
+ var React5 = __toESM(require("react"), 1);
294
+ var import_jsx_runtime6 = require("react/jsx-runtime");
295
+ var RteButtonGroup = React5.forwardRef(
296
+ ({ className = "", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
297
+ "div",
298
+ {
299
+ ref,
300
+ className: `rte-bubble-group ${className}`.trim(),
301
+ ...props
302
+ }
303
+ )
304
+ );
305
+ RteButtonGroup.displayName = "RteButtonGroup";
306
+
307
+ // src/ui/rte-icon.tsx
308
+ var React6 = __toESM(require("react"), 1);
309
+ var import_jsx_runtime7 = require("react/jsx-runtime");
310
+ var RteIcon = React6.forwardRef(
311
+ ({ className = "", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
312
+ "span",
313
+ {
314
+ ref,
315
+ className: `rte-bubble-btn-icon ${className}`.trim(),
316
+ ...props
317
+ }
318
+ )
319
+ );
320
+ RteIcon.displayName = "RteIcon";
321
+
322
+ // src/ui/rte-separator.tsx
323
+ var React7 = __toESM(require("react"), 1);
324
+ var import_jsx_runtime8 = require("react/jsx-runtime");
325
+ var RteSeparator = React7.forwardRef(
326
+ ({ className = "", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
327
+ "div",
328
+ {
329
+ ref,
330
+ className: `rte-bubble-separator ${className}`.trim(),
331
+ ...props
332
+ }
333
+ )
334
+ );
335
+ RteSeparator.displayName = "RteSeparator";
336
+
337
+ // src/ui/rte-overlay.tsx
338
+ var React8 = __toESM(require("react"), 1);
339
+ var import_jsx_runtime9 = require("react/jsx-runtime");
340
+ var RteOverlay = React8.forwardRef(
341
+ ({ className = "", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
342
+ "div",
343
+ {
344
+ ref,
345
+ role: "presentation",
346
+ className: `rte-bubble-overlay ${className}`.trim(),
347
+ ...props
348
+ }
349
+ )
350
+ );
351
+ RteOverlay.displayName = "RteOverlay";
352
+
353
+ // src/ui/rte-dropdown.tsx
354
+ var React9 = __toESM(require("react"), 1);
58
355
  var import_react = require("react");
59
- var RichTextEditorContext = (0, import_react.createContext)(null);
60
- var useRichTextEditorContext = () => {
61
- const context = (0, import_react.useContext)(RichTextEditorContext);
62
- if (!context) {
63
- throw new Error(
64
- "useRichTextEditorContext must be used within RichTextEditor"
356
+ var import_jsx_runtime10 = require("react/jsx-runtime");
357
+ var variantClass = {
358
+ color: "rte-bubble-dropdown--color",
359
+ default: "",
360
+ language: "rte-bubble-dropdown--language"
361
+ };
362
+ var RteDropdown = React9.forwardRef(
363
+ ({ className = "", variant = "default", children, onMouseLeave, ...props }, ref) => {
364
+ const containerRef = (0, import_react.useRef)(null);
365
+ const [pill, setPill] = (0, import_react.useState)(null);
366
+ const handleItemEnter = (0, import_react.useCallback)((target) => {
367
+ const item = target.closest(
368
+ "[data-dropdown-item]"
369
+ );
370
+ if (!item) {
371
+ return;
372
+ }
373
+ setPill({
374
+ height: item.offsetHeight,
375
+ left: item.offsetLeft,
376
+ top: item.offsetTop,
377
+ width: item.offsetWidth
378
+ });
379
+ }, []);
380
+ const handleMouseOver = (0, import_react.useCallback)(
381
+ (event) => {
382
+ handleItemEnter(event.target);
383
+ },
384
+ [handleItemEnter]
385
+ );
386
+ const handleFocus = (0, import_react.useCallback)(
387
+ (event) => {
388
+ handleItemEnter(event.target);
389
+ },
390
+ [handleItemEnter]
391
+ );
392
+ const handleMouseLeaveFn = (0, import_react.useCallback)(
393
+ (event) => {
394
+ setPill(null);
395
+ onMouseLeave?.(event);
396
+ },
397
+ [onMouseLeave]
398
+ );
399
+ const cls = ["rte-bubble-dropdown", variantClass[variant], className].filter(Boolean).join(" ");
400
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
401
+ "div",
402
+ {
403
+ ref: (node) => {
404
+ containerRef.current = node;
405
+ if (typeof ref === "function") {
406
+ ref(node);
407
+ } else if (ref) {
408
+ ref.current = node;
409
+ }
410
+ },
411
+ className: cls,
412
+ onFocus: handleFocus,
413
+ onMouseLeave: handleMouseLeaveFn,
414
+ onMouseOver: handleMouseOver,
415
+ ...props,
416
+ children: [
417
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
418
+ "div",
419
+ {
420
+ "aria-hidden": "true",
421
+ className: [
422
+ "rte-bubble-dropdown-pill",
423
+ pill ? "rte-bubble-dropdown-pill--visible" : ""
424
+ ].filter(Boolean).join(" "),
425
+ style: pill ? {
426
+ height: pill.height,
427
+ left: pill.left,
428
+ top: pill.top,
429
+ width: pill.width
430
+ } : void 0
431
+ }
432
+ ),
433
+ children
434
+ ]
435
+ }
65
436
  );
66
437
  }
67
- return context;
438
+ );
439
+ RteDropdown.displayName = "RteDropdown";
440
+
441
+ // src/ui/rte-color-swatch.tsx
442
+ var React10 = __toESM(require("react"), 1);
443
+ var import_jsx_runtime11 = require("react/jsx-runtime");
444
+ var getCheckColor = (hex) => {
445
+ const value = hex.replace("#", "");
446
+ const r = Number.parseInt(value.slice(0, 2), 16) / 255;
447
+ const g = Number.parseInt(value.slice(2, 4), 16) / 255;
448
+ const b = Number.parseInt(value.slice(4, 6), 16) / 255;
449
+ const luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b;
450
+ return luminance > 0.5 ? "#18181b" : "#ffffff";
68
451
  };
452
+ var RteColorSwatch = React10.forwardRef(
453
+ ({ color, label, variant, active = false, onSelect }, ref) => {
454
+ const checkColor = getCheckColor(color);
455
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
456
+ "button",
457
+ {
458
+ ref,
459
+ type: "button",
460
+ "aria-pressed": active,
461
+ "aria-label": label,
462
+ title: label,
463
+ className: [
464
+ "rte-bubble-color-swatch",
465
+ variant === "text" ? "rte-bubble-color-swatch--text" : "rte-bubble-color-swatch--highlight",
466
+ active ? "rte-bubble-color-swatch--active" : ""
467
+ ].filter(Boolean).join(" "),
468
+ style: {
469
+ "--swatch-check": checkColor,
470
+ "--swatch-color": color
471
+ },
472
+ onMouseDown: (e) => e.preventDefault(),
473
+ onClick: () => onSelect(color),
474
+ children: [
475
+ variant === "text" && !active ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "rte-bubble-color-glyph", "aria-hidden": "true", children: "A" }) : null,
476
+ active ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "rte-bubble-color-check", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
477
+ "svg",
478
+ {
479
+ xmlns: "http://www.w3.org/2000/svg",
480
+ viewBox: "0 0 24 24",
481
+ fill: "none",
482
+ stroke: "currentColor",
483
+ strokeWidth: 3,
484
+ strokeLinecap: "round",
485
+ strokeLinejoin: "round",
486
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M20 6 9 17l-5-5" })
487
+ }
488
+ ) }) : null
489
+ ]
490
+ }
491
+ );
492
+ }
493
+ );
494
+ RteColorSwatch.displayName = "RteColorSwatch";
495
+
496
+ // src/ui/rte-dropdown-item.tsx
497
+ var React11 = __toESM(require("react"), 1);
498
+ var import_jsx_runtime12 = require("react/jsx-runtime");
499
+ var RteDropdownItem = React11.forwardRef(({ className = "", active = false, ...props }, ref) => {
500
+ const cls = [
501
+ "rte-bubble-dropdown-item",
502
+ active ? "rte-bubble-dropdown-item--active" : "",
503
+ className
504
+ ].filter(Boolean).join(" ");
505
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
506
+ "button",
507
+ {
508
+ ref,
509
+ type: "button",
510
+ "data-dropdown-item": true,
511
+ className: cls,
512
+ ...props
513
+ }
514
+ );
515
+ });
516
+ RteDropdownItem.displayName = "RteDropdownItem";
517
+
518
+ // src/ui/rte-dropdown-divider.tsx
519
+ var React12 = __toESM(require("react"), 1);
520
+ var import_jsx_runtime13 = require("react/jsx-runtime");
521
+ var RteDropdownDivider = React12.forwardRef(({ className = "", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
522
+ "div",
523
+ {
524
+ ref,
525
+ className: `rte-bubble-dropdown-divider ${className}`.trim(),
526
+ ...props
527
+ }
528
+ ));
529
+ RteDropdownDivider.displayName = "RteDropdownDivider";
530
+
531
+ // src/ui/rte-dropdown-icon.tsx
532
+ var React13 = __toESM(require("react"), 1);
533
+ var import_jsx_runtime14 = require("react/jsx-runtime");
534
+ var RteDropdownIcon = React13.forwardRef(
535
+ ({ className = "", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
536
+ "span",
537
+ {
538
+ ref,
539
+ className: `rte-bubble-dropdown-icon ${className}`.trim(),
540
+ ...props
541
+ }
542
+ )
543
+ );
544
+ RteDropdownIcon.displayName = "RteDropdownIcon";
545
+
546
+ // src/ui/toggle.tsx
547
+ var import_toggle = require("@base-ui/react/toggle");
548
+ var import_class_variance_authority2 = require("class-variance-authority");
549
+ var import_jsx_runtime15 = require("react/jsx-runtime");
550
+ var toggleVariants = (0, import_class_variance_authority2.cva)(
551
+ "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",
552
+ {
553
+ defaultVariants: {
554
+ size: "default",
555
+ variant: "default"
556
+ },
557
+ variants: {
558
+ size: {
559
+ default: "h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
560
+ lg: "h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
561
+ 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"
562
+ },
563
+ variant: {
564
+ default: "bg-transparent",
565
+ outline: "border border-input bg-transparent hover:bg-muted"
566
+ }
567
+ }
568
+ }
569
+ );
570
+ var Toggle = ({
571
+ className,
572
+ variant = "default",
573
+ size = "default",
574
+ ...props
575
+ }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
576
+ import_toggle.Toggle,
577
+ {
578
+ "data-slot": "toggle",
579
+ className: cn(toggleVariants({ className, size, variant })),
580
+ ...props
581
+ }
582
+ );
583
+
584
+ // src/bubble-menu/color-selector.tsx
585
+ var import_react3 = require("react");
69
586
 
70
587
  // src/bubble-menu/utils.ts
71
588
  var import_react2 = require("react");
@@ -172,11 +689,216 @@ var CODE_BLOCK_LANGUAGE_LABELS = {
172
689
  xml: "XML",
173
690
  yaml: "YAML"
174
691
  };
175
- var getLanguageLabel = (lang) => CODE_BLOCK_LANGUAGE_LABELS[lang] ?? lang;
692
+ var getLanguageLabel = (lang) => CODE_BLOCK_LANGUAGE_LABELS[lang] ?? lang;
693
+
694
+ // src/bubble-menu/color-selector.tsx
695
+ var import_jsx_runtime16 = require("react/jsx-runtime");
696
+ var RECENT_KEY = "editorcn-editor-recent-colors";
697
+ var RECENT_LIMIT = 10;
698
+ var readRecentColors = () => {
699
+ if (typeof window === "undefined") {
700
+ return [];
701
+ }
702
+ try {
703
+ const raw = window.localStorage.getItem(RECENT_KEY);
704
+ if (!raw) {
705
+ return [];
706
+ }
707
+ const parsed = JSON.parse(raw);
708
+ return Array.isArray(parsed) ? parsed.slice(0, RECENT_LIMIT) : [];
709
+ } catch {
710
+ return [];
711
+ }
712
+ };
713
+ var persistRecentColors = (recent) => {
714
+ try {
715
+ window.localStorage.setItem(RECENT_KEY, JSON.stringify(recent));
716
+ } catch {
717
+ }
718
+ };
719
+ var TEXT_COLORS = [
720
+ { color: "#0f172a", label: "Foreground" },
721
+ { color: "#ef4444", label: "Red" },
722
+ { color: "#f97316", label: "Orange" },
723
+ { color: "#f59e0b", label: "Amber" },
724
+ { color: "#22c55e", label: "Green" },
725
+ { color: "#0ea5e9", label: "Sky" },
726
+ { color: "#3b82f6", label: "Blue" },
727
+ { color: "#6366f1", label: "Indigo" },
728
+ { color: "#a855f7", label: "Purple" },
729
+ { color: "#ec4899", label: "Pink" }
730
+ ];
731
+ var HIGHLIGHT_COLORS = [
732
+ { color: "#fef08a", label: "Yellow" },
733
+ { color: "#fed7aa", label: "Orange" },
734
+ { color: "#fecaca", label: "Red" },
735
+ { color: "#fbcfe8", label: "Pink" },
736
+ { color: "#e9d5ff", label: "Purple" },
737
+ { color: "#ddd6fe", label: "Violet" },
738
+ { color: "#bfdbfe", label: "Blue" },
739
+ { color: "#a5f3fc", label: "Cyan" },
740
+ { color: "#99f6e4", label: "Teal" },
741
+ { color: "#bbf7d0", label: "Green" }
742
+ ];
743
+ var ColorSelector = ({ editor }) => {
744
+ const [open, setOpen] = (0, import_react3.useState)(false);
745
+ const [recent, setRecent] = (0, import_react3.useState)(() => readRecentColors());
746
+ const { highlightColor, textColor } = useEditorState(
747
+ editor,
748
+ (ed) => ({
749
+ highlightColor: ed.isActive("highlight") ? ed.getAttributes("highlight").color : void 0,
750
+ textColor: ed.isActive("textStyle") ? ed.getAttributes("textStyle").color : void 0
751
+ }),
752
+ shallowEqual
753
+ );
754
+ const hasColor = editor.extensionManager.extensions.some(
755
+ (ext) => ext.name === "color"
756
+ );
757
+ const hasHighlight = editor.extensionManager.extensions.some(
758
+ (ext) => ext.name === "highlight"
759
+ );
760
+ const remember = (type, color, label) => {
761
+ setRecent((prev) => {
762
+ const next = [
763
+ { color, label, type },
764
+ ...prev.filter((item) => !(item.type === type && item.color === color))
765
+ ].slice(0, RECENT_LIMIT);
766
+ persistRecentColors(next);
767
+ return next;
768
+ });
769
+ };
770
+ const selectText = (color, label) => {
771
+ remember("text", color, label);
772
+ if (textColor === color) {
773
+ editor.chain().focus().unsetColor().run();
774
+ } else {
775
+ editor.chain().focus().setColor(color).run();
776
+ }
777
+ };
778
+ const selectHighlight = (color, label) => {
779
+ remember("highlight", color, label);
780
+ if (highlightColor === color) {
781
+ editor.chain().focus().unsetHighlight().run();
782
+ } else {
783
+ editor.chain().focus().setHighlight({ color }).run();
784
+ }
785
+ };
786
+ if (!hasColor && !hasHighlight) {
787
+ return null;
788
+ }
789
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { position: "relative" }, children: [
790
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
791
+ RteButton,
792
+ {
793
+ active: Boolean(textColor || highlightColor),
794
+ onMouseDown: (e) => e.preventDefault(),
795
+ onClick: () => setOpen(!open),
796
+ title: "Text color",
797
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(RteIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
798
+ "svg",
799
+ {
800
+ xmlns: "http://www.w3.org/2000/svg",
801
+ viewBox: "0 0 24 24",
802
+ fill: "none",
803
+ stroke: "currentColor",
804
+ strokeWidth: 2,
805
+ strokeLinecap: "round",
806
+ strokeLinejoin: "round",
807
+ className: "rte-editor-icon",
808
+ children: [
809
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M4 20h16" }),
810
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "m6 16 6-12 6 12" }),
811
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M8 12h8" })
812
+ ]
813
+ }
814
+ ) })
815
+ }
816
+ ),
817
+ open && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
818
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
819
+ RteOverlay,
820
+ {
821
+ onClick: () => setOpen(false),
822
+ onKeyDown: (e) => {
823
+ if (e.key === "Escape") {
824
+ setOpen(false);
825
+ }
826
+ }
827
+ }
828
+ ),
829
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(RteDropdown, { variant: "color", children: [
830
+ recent.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "rte-bubble-color-section", children: [
831
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "rte-bubble-color-label", children: "Recently Used" }),
832
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "rte-bubble-color-recent", children: recent.map((item) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
833
+ RteColorSwatch,
834
+ {
835
+ variant: item.type,
836
+ color: item.color,
837
+ label: item.label,
838
+ active: item.type === "text" ? textColor === item.color : highlightColor === item.color,
839
+ onSelect: () => item.type === "text" ? selectText(item.color, item.label) : selectHighlight(item.color, item.label)
840
+ },
841
+ `${item.type}-${item.color}`
842
+ )) })
843
+ ] }) : null,
844
+ hasColor ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
845
+ recent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(RteDropdownDivider, {}),
846
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "rte-bubble-color-section", children: [
847
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "rte-bubble-color-label", children: "Text Color" }),
848
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "rte-bubble-color-grid", children: TEXT_COLORS.map((item) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
849
+ RteColorSwatch,
850
+ {
851
+ variant: "text",
852
+ color: item.color,
853
+ label: item.label,
854
+ active: textColor === item.color,
855
+ onSelect: () => selectText(item.color, item.label)
856
+ },
857
+ item.color
858
+ )) })
859
+ ] })
860
+ ] }) : null,
861
+ hasHighlight ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
862
+ (recent.length > 0 || hasColor) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(RteDropdownDivider, {}),
863
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "rte-bubble-color-section", children: [
864
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "rte-bubble-color-label", children: "Highlight Color" }),
865
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "rte-bubble-color-grid", children: HIGHLIGHT_COLORS.map((item) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
866
+ RteColorSwatch,
867
+ {
868
+ variant: "highlight",
869
+ color: item.color,
870
+ label: item.label,
871
+ active: highlightColor === item.color,
872
+ onSelect: () => selectHighlight(item.color, item.label)
873
+ },
874
+ item.color
875
+ )) })
876
+ ] })
877
+ ] }) : null
878
+ ] })
879
+ ] })
880
+ ] });
881
+ };
882
+
883
+ // src/bubble-menu/language-selector.tsx
884
+ var import_react5 = require("react");
885
+
886
+ // src/rte-context.ts
887
+ var import_react4 = require("react");
888
+ var RichTextEditorContext = (0, import_react4.createContext)(null);
889
+ var useRichTextEditorContext = () => {
890
+ const context = (0, import_react4.useContext)(RichTextEditorContext);
891
+ if (!context) {
892
+ throw new Error(
893
+ "useRichTextEditorContext must be used within RichTextEditor"
894
+ );
895
+ }
896
+ return context;
897
+ };
176
898
 
177
899
  // src/bubble-menu/language-selector.tsx
178
- var import_jsx_runtime = require("react/jsx-runtime");
179
- var FallbackIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
900
+ var import_jsx_runtime17 = require("react/jsx-runtime");
901
+ var FallbackIcon = () => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
180
902
  "svg",
181
903
  {
182
904
  xmlns: "http://www.w3.org/2000/svg",
@@ -188,14 +910,13 @@ var FallbackIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
188
910
  strokeLinejoin: "round",
189
911
  className: "rte-editor-icon",
190
912
  children: [
191
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("polyline", { points: "16 18 22 12 16 6" }),
192
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("polyline", { points: "8 6 2 12 8 18" })
913
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("polyline", { points: "16 18 22 12 16 6" }),
914
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("polyline", { points: "8 6 2 12 8 18" })
193
915
  ]
194
916
  }
195
917
  );
196
918
  var LanguageSelector = ({ editor }) => {
197
- const [open, setOpen] = (0, import_react3.useState)(false);
198
- const [pill, setPill] = (0, import_react3.useState)(null);
919
+ const [open, setOpen] = (0, import_react5.useState)(false);
199
920
  const { icons } = useRichTextEditorContext();
200
921
  const { currentLanguage } = useEditorState(
201
922
  editor,
@@ -204,45 +925,17 @@ var LanguageSelector = ({ editor }) => {
204
925
  }),
205
926
  shallowEqual
206
927
  );
207
- const langIcon = icons.languageIcons[currentLanguage] ?? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FallbackIcon, {});
208
- const handleItemEnter = (0, import_react3.useCallback)((target) => {
209
- const item = target.closest(
210
- "[data-dropdown-item]"
211
- );
212
- if (!item) {
213
- return;
214
- }
215
- setPill({
216
- height: item.offsetHeight,
217
- left: item.offsetLeft,
218
- top: item.offsetTop,
219
- width: item.offsetWidth
220
- });
221
- }, []);
222
- const handleMouseOver = (0, import_react3.useCallback)(
223
- (event) => {
224
- handleItemEnter(event.target);
225
- },
226
- [handleItemEnter]
227
- );
228
- const handleFocus = (0, import_react3.useCallback)(
229
- (event) => {
230
- handleItemEnter(event.target);
231
- },
232
- [handleItemEnter]
233
- );
234
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { position: "relative" }, children: [
235
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
236
- "button",
928
+ const langIcon = icons.languageIcons[currentLanguage] ?? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FallbackIcon, {});
929
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { position: "relative" }, children: [
930
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
931
+ RteButton,
237
932
  {
238
- type: "button",
239
- className: "rte-bubble-btn",
240
933
  onMouseDown: (e) => e.preventDefault(),
241
934
  onClick: () => setOpen(!open),
242
935
  children: [
243
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "rte-bubble-btn-icon", children: langIcon }),
244
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "rte-bubble-btn-text", children: getLanguageLabel(currentLanguage) }),
245
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "rte-bubble-btn-icon", style: { height: 12, width: 12 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
936
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RteIcon, { children: langIcon }),
937
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rte-bubble-btn-text", children: getLanguageLabel(currentLanguage) }),
938
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RteIcon, { style: { height: 12, width: 12 }, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
246
939
  "svg",
247
940
  {
248
941
  xmlns: "http://www.w3.org/2000/svg",
@@ -252,18 +945,16 @@ var LanguageSelector = ({ editor }) => {
252
945
  strokeWidth: 2,
253
946
  strokeLinecap: "round",
254
947
  strokeLinejoin: "round",
255
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m6 9 6 6 6-6" })
948
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "m6 9 6 6 6-6" })
256
949
  }
257
950
  ) })
258
951
  ]
259
952
  }
260
953
  ),
261
- open && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
262
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
263
- "div",
954
+ open && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
955
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
956
+ RteOverlay,
264
957
  {
265
- className: "rte-bubble-overlay",
266
- role: "presentation",
267
958
  onClick: () => setOpen(false),
268
959
  onKeyDown: (e) => {
269
960
  if (e.key === "Escape") {
@@ -272,61 +963,32 @@ var LanguageSelector = ({ editor }) => {
272
963
  }
273
964
  }
274
965
  ),
275
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
276
- "div",
966
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RteDropdown, { variant: "language", children: CODE_BLOCK_LANGUAGES.map((lang) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
967
+ RteDropdownItem,
277
968
  {
278
- className: "rte-bubble-dropdown rte-bubble-dropdown--language",
279
- onFocus: handleFocus,
280
- onMouseLeave: () => setPill(null),
281
- onMouseOver: handleMouseOver,
969
+ active: currentLanguage === lang,
970
+ onMouseDown: (e) => e.preventDefault(),
971
+ onClick: () => {
972
+ editor.chain().focus().updateAttributes("codeBlock", { language: lang }).run();
973
+ setOpen(false);
974
+ },
282
975
  children: [
283
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
284
- "div",
285
- {
286
- "aria-hidden": "true",
287
- className: [
288
- "rte-bubble-dropdown-pill",
289
- pill ? "rte-bubble-dropdown-pill--visible" : ""
290
- ].filter(Boolean).join(" "),
291
- style: pill ? {
292
- height: pill.height,
293
- left: pill.left,
294
- top: pill.top,
295
- width: pill.width
296
- } : void 0
297
- }
298
- ),
299
- CODE_BLOCK_LANGUAGES.map((lang) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
300
- "button",
301
- {
302
- type: "button",
303
- "data-dropdown-item": true,
304
- className: `rte-bubble-dropdown-item${currentLanguage === lang ? " rte-bubble-dropdown-item--active" : ""}`,
305
- onMouseDown: (e) => e.preventDefault(),
306
- onClick: () => {
307
- editor.chain().focus().updateAttributes("codeBlock", { language: lang }).run();
308
- setOpen(false);
309
- },
310
- children: [
311
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "rte-bubble-dropdown-icon", children: icons.languageIcons[lang] ?? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FallbackIcon, {}) }),
312
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: getLanguageLabel(lang) })
313
- ]
314
- },
315
- lang
316
- ))
976
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RteDropdownIcon, { children: icons.languageIcons[lang] ?? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FallbackIcon, {}) }),
977
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: getLanguageLabel(lang) })
317
978
  ]
318
- }
319
- )
979
+ },
980
+ lang
981
+ )) })
320
982
  ] })
321
983
  ] });
322
984
  };
323
985
 
324
986
  // src/bubble-menu/text-buttons.tsx
325
- var import_jsx_runtime2 = require("react/jsx-runtime");
987
+ var import_jsx_runtime18 = require("react/jsx-runtime");
326
988
  var Svg = ({
327
989
  children,
328
990
  strokeWidth = 2
329
- }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
991
+ }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
330
992
  "svg",
331
993
  {
332
994
  xmlns: "http://www.w3.org/2000/svg",
@@ -340,47 +1002,48 @@ var Svg = ({
340
1002
  children
341
1003
  }
342
1004
  );
1005
+ var Icon = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RteIcon, { children });
343
1006
  var textItems = [
344
1007
  {
345
1008
  command: (e) => e.chain().focus().toggleBold().run(),
346
- icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Svg, { children: [
347
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" }),
348
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" })
349
- ] }),
1009
+ icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Svg, { children: [
1010
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" }),
1011
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" })
1012
+ ] }) }),
350
1013
  isActive: (s) => s.isBold
351
1014
  },
352
1015
  {
353
1016
  command: (e) => e.chain().focus().toggleItalic().run(),
354
- icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Svg, { children: [
355
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "19", y1: "4", x2: "10", y2: "4" }),
356
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "14", y1: "20", x2: "5", y2: "20" }),
357
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "15", y1: "4", x2: "9", y2: "20" })
358
- ] }),
1017
+ icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Svg, { children: [
1018
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("line", { x1: "19", y1: "4", x2: "10", y2: "4" }),
1019
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("line", { x1: "14", y1: "20", x2: "5", y2: "20" }),
1020
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("line", { x1: "15", y1: "4", x2: "9", y2: "20" })
1021
+ ] }) }),
359
1022
  isActive: (s) => s.isItalic
360
1023
  },
361
1024
  {
362
1025
  command: (e) => e.chain().focus().toggleUnderline().run(),
363
- icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Svg, { children: [
364
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M6 4v6a6 6 0 0 0 12 0V4" }),
365
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "4", y1: "20", x2: "20", y2: "20" })
366
- ] }),
1026
+ icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Svg, { children: [
1027
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M6 4v6a6 6 0 0 0 12 0V4" }),
1028
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("line", { x1: "4", y1: "20", x2: "20", y2: "20" })
1029
+ ] }) }),
367
1030
  isActive: (s) => s.isUnderline
368
1031
  },
369
1032
  {
370
1033
  command: (e) => e.chain().focus().toggleStrike().run(),
371
- icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Svg, { children: [
372
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M16 4H9.5a3.5 3.5 0 0 0-2.9 5.4" }),
373
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M14.5 14.6a3.5 3.5 0 0 1-2.9 5.4H8" }),
374
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "4", y1: "12", x2: "20", y2: "12" })
375
- ] }),
1034
+ icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Svg, { children: [
1035
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M16 4H9.5a3.5 3.5 0 0 0-2.9 5.4" }),
1036
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M14.5 14.6a3.5 3.5 0 0 1-2.9 5.4H8" }),
1037
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("line", { x1: "4", y1: "12", x2: "20", y2: "12" })
1038
+ ] }) }),
376
1039
  isActive: (s) => s.isStrike
377
1040
  },
378
1041
  {
379
1042
  command: (e) => e.chain().focus().toggleCode().run(),
380
- icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Svg, { children: [
381
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("polyline", { points: "16 18 22 12 16 6" }),
382
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("polyline", { points: "8 6 2 12 8 18" })
383
- ] }),
1043
+ icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Svg, { children: [
1044
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("polyline", { points: "16 18 22 12 16 6" }),
1045
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("polyline", { points: "8 6 2 12 8 18" })
1046
+ ] }) }),
384
1047
  isActive: (s) => s.isCode
385
1048
  }
386
1049
  ];
@@ -396,11 +1059,10 @@ var TextButtons = ({ editor }) => {
396
1059
  }),
397
1060
  shallowEqual
398
1061
  );
399
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "rte-bubble-group", children: textItems.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
400
- "button",
1062
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RteButtonGroup, { children: textItems.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1063
+ RteButton,
401
1064
  {
402
- type: "button",
403
- className: `rte-bubble-btn${item.isActive(editorState) ? " rte-bubble-btn--active" : ""}`,
1065
+ active: item.isActive(editorState),
404
1066
  onMouseDown: (e) => e.preventDefault(),
405
1067
  onClick: () => item.command(editor),
406
1068
  children: item.icon
@@ -410,7 +1072,7 @@ var TextButtons = ({ editor }) => {
410
1072
  };
411
1073
 
412
1074
  // src/bubble-menu/index.tsx
413
- var import_jsx_runtime3 = require("react/jsx-runtime");
1075
+ var import_jsx_runtime19 = require("react/jsx-runtime");
414
1076
  var BubbleMenu = ({ editor }) => {
415
1077
  const editorState = useEditorState(
416
1078
  editor,
@@ -419,7 +1081,7 @@ var BubbleMenu = ({ editor }) => {
419
1081
  }),
420
1082
  shallowEqual
421
1083
  );
422
- const shouldShow = (0, import_react4.useCallback)(
1084
+ const shouldShow = (0, import_react6.useCallback)(
423
1085
  ({
424
1086
  editor: ed,
425
1087
  state
@@ -442,68 +1104,25 @@ var BubbleMenu = ({ editor }) => {
442
1104
  return null;
443
1105
  }
444
1106
  const isCodeBlockActive = editorState?.isCodeBlock ?? false;
445
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1107
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
446
1108
  import_menus.BubbleMenu,
447
1109
  {
448
1110
  editor,
449
1111
  options: { offset: 8, placement: "top" },
450
1112
  shouldShow,
451
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "rte-bubble-menu", children: isCodeBlockActive ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(LanguageSelector, { editor }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TextButtons, { editor }) })
1113
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "rte-bubble-menu", children: isCodeBlockActive ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(LanguageSelector, { editor }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
1114
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TextButtons, { editor }),
1115
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(RteSeparator, {}),
1116
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ColorSelector, { editor })
1117
+ ] }) })
452
1118
  }
453
1119
  );
454
1120
  };
455
1121
 
456
1122
  // src/controls/rte-control.tsx
457
- var import_react5 = require("@tiptap/react");
458
- var import_react6 = require("react");
459
-
460
- // src/ui/toggle.tsx
461
- var import_toggle = require("@base-ui/react/toggle");
462
- var import_class_variance_authority = require("class-variance-authority");
463
-
464
- // src/ui/utils.ts
465
- var import_clsx = require("clsx");
466
- var import_tailwind_merge = require("tailwind-merge");
467
- var cn = (...inputs) => (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
468
-
469
- // src/ui/toggle.tsx
470
- var import_jsx_runtime4 = require("react/jsx-runtime");
471
- var toggleVariants = (0, import_class_variance_authority.cva)(
472
- "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",
473
- {
474
- defaultVariants: {
475
- size: "default",
476
- variant: "default"
477
- },
478
- variants: {
479
- size: {
480
- default: "h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
481
- lg: "h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
482
- 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"
483
- },
484
- variant: {
485
- default: "bg-transparent",
486
- outline: "border border-input bg-transparent hover:bg-muted"
487
- }
488
- }
489
- }
490
- );
491
- var Toggle = ({
492
- className,
493
- variant = "default",
494
- size = "default",
495
- ...props
496
- }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
497
- import_toggle.Toggle,
498
- {
499
- "data-slot": "toggle",
500
- className: cn(toggleVariants({ className, size, variant })),
501
- ...props
502
- }
503
- );
504
-
505
- // src/controls/rte-control.tsx
506
- var import_jsx_runtime5 = require("react/jsx-runtime");
1123
+ var import_react7 = require("@tiptap/react");
1124
+ var import_react8 = require("react");
1125
+ var import_jsx_runtime20 = require("react/jsx-runtime");
507
1126
  var RichTextEditorControl = ({
508
1127
  active,
509
1128
  interactive: _interactive = true,
@@ -513,7 +1132,7 @@ var RichTextEditorControl = ({
513
1132
  onClick,
514
1133
  disabled,
515
1134
  ...props
516
- }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1135
+ }) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
517
1136
  Toggle,
518
1137
  {
519
1138
  size: "sm",
@@ -556,13 +1175,13 @@ var createControl = ({
556
1175
  const Control = ({ className }) => {
557
1176
  const { editor, labels, icons } = useRichTextEditorContext();
558
1177
  const ariaLabel = labels[label];
559
- const editorState = (0, import_react5.useEditorState)({
1178
+ const editorState = (0, import_react7.useEditorState)({
560
1179
  editor: editor ?? null,
561
1180
  selector: createSelector(isActive, isDisabled)
562
1181
  });
563
1182
  const active = editorState?.active ?? false;
564
1183
  const disabled = editorState?.disabled ?? true;
565
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1184
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
566
1185
  RichTextEditorControl,
567
1186
  {
568
1187
  active,
@@ -687,184 +1306,79 @@ var UndoControl = createControl({
687
1306
  });
688
1307
  var RedoControl = createControl({
689
1308
  iconKey: "redoControlIcon",
690
- isDisabled: (editor) => !editor.can().redo(),
691
- label: "redoControlLabel",
692
- operation: { name: "redo" }
693
- });
694
- var H5Control = createControl({
695
- iconKey: "h5ControlIcon",
696
- isActive: { attributes: { level: 5 }, name: "heading" },
697
- label: "h5ControlLabel",
698
- operation: { attributes: { level: 5 }, name: "toggleHeading" }
699
- });
700
- var H6Control = createControl({
701
- iconKey: "h6ControlIcon",
702
- isActive: { attributes: { level: 6 }, name: "heading" },
703
- label: "h6ControlLabel",
704
- operation: { attributes: { level: 6 }, name: "toggleHeading" }
705
- });
706
- var AlignLeftControl = createControl({
707
- iconKey: "alignLeftControlIcon",
708
- isActive: { attrs: { textAlign: "left" } },
709
- label: "alignLeftControlLabel",
710
- operation: { attributes: "left", name: "setTextAlign" }
711
- });
712
- var AlignCenterControl = createControl({
713
- iconKey: "alignCenterControlIcon",
714
- isActive: { attrs: { textAlign: "center" } },
715
- label: "alignCenterControlLabel",
716
- operation: { attributes: "center", name: "setTextAlign" }
717
- });
718
- var AlignRightControl = createControl({
719
- iconKey: "alignRightControlIcon",
720
- isActive: { attrs: { textAlign: "right" } },
721
- label: "alignRightControlLabel",
722
- operation: { attributes: "right", name: "setTextAlign" }
723
- });
724
- var AlignJustifyControl = createControl({
725
- iconKey: "alignJustifyControlIcon",
726
- isActive: { attrs: { textAlign: "justify" } },
727
- label: "alignJustifyControlLabel",
728
- operation: { attributes: "justify", name: "setTextAlign" }
729
- });
730
- var HighlightControl = createControl({
731
- iconKey: "highlightControlIcon",
732
- isActive: { name: "highlight" },
733
- label: "highlightControlLabel",
734
- operation: { name: "toggleHighlight" }
735
- });
736
- var SubscriptControl = createControl({
737
- iconKey: "subscriptControlIcon",
738
- isActive: { name: "subscript" },
739
- label: "subscriptControlLabel",
740
- operation: { name: "toggleSubscript" }
741
- });
742
- var SuperscriptControl = createControl({
743
- iconKey: "superscriptControlIcon",
744
- isActive: { name: "superscript" },
745
- label: "superscriptControlLabel",
746
- operation: { name: "toggleSuperscript" }
747
- });
748
-
749
- // src/controls/rte-link-control.tsx
750
- var import_react7 = require("@tiptap/react");
751
- var React4 = __toESM(require("react"), 1);
752
- var import_react8 = require("react");
753
-
754
- // src/ui/button.tsx
755
- var import_button = require("@base-ui/react/button");
756
- var import_class_variance_authority2 = require("class-variance-authority");
757
- var import_jsx_runtime6 = require("react/jsx-runtime");
758
- var buttonVariants = (0, import_class_variance_authority2.cva)(
759
- "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",
760
- {
761
- defaultVariants: {
762
- size: "default",
763
- variant: "default"
764
- },
765
- variants: {
766
- size: {
767
- default: "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
768
- icon: "size-8",
769
- "icon-lg": "size-9",
770
- "icon-sm": "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
771
- "icon-xs": "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
772
- lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
773
- 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",
774
- 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"
775
- },
776
- variant: {
777
- default: "bg-primary text-primary-foreground hover:bg-primary/80",
778
- 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",
779
- ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
780
- link: "text-primary underline-offset-4 hover:underline",
781
- 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",
782
- 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"
783
- }
784
- }
785
- }
786
- );
787
- var Button = ({
788
- className,
789
- variant = "default",
790
- size = "default",
791
- ...props
792
- }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
793
- import_button.Button,
794
- {
795
- "data-slot": "button",
796
- className: cn(buttonVariants({ className, size, variant })),
797
- ...props
798
- }
799
- );
800
-
801
- // src/ui/input.tsx
802
- var import_input = require("@base-ui/react/input");
803
- var React2 = require("react");
804
- var import_jsx_runtime7 = require("react/jsx-runtime");
805
- var Input = ({
806
- className,
807
- type,
808
- ...props
809
- }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
810
- import_input.Input,
811
- {
812
- type,
813
- "data-slot": "input",
814
- className: cn(
815
- "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",
816
- className
817
- ),
818
- ...props
819
- }
820
- );
821
-
822
- // src/ui/popover.tsx
823
- var import_popover = require("@base-ui/react/popover");
824
- var React3 = require("react");
825
- var import_jsx_runtime8 = require("react/jsx-runtime");
826
- var Popover = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_popover.Popover.Root, { "data-slot": "popover", ...props });
827
- var PopoverTrigger = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_popover.Popover.Trigger, { "data-slot": "popover-trigger", ...props });
828
- var PopoverContent = ({
829
- className,
830
- align = "center",
831
- alignOffset = 0,
832
- side = "bottom",
833
- sideOffset = 4,
834
- ...props
835
- }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_popover.Popover.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
836
- import_popover.Popover.Positioner,
837
- {
838
- align,
839
- alignOffset,
840
- side,
841
- sideOffset,
842
- className: "isolate z-50",
843
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
844
- import_popover.Popover.Popup,
845
- {
846
- "data-slot": "popover-content",
847
- className: cn(
848
- "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",
849
- className
850
- ),
851
- ...props
852
- }
853
- )
854
- }
855
- ) });
1309
+ isDisabled: (editor) => !editor.can().redo(),
1310
+ label: "redoControlLabel",
1311
+ operation: { name: "redo" }
1312
+ });
1313
+ var H5Control = createControl({
1314
+ iconKey: "h5ControlIcon",
1315
+ isActive: { attributes: { level: 5 }, name: "heading" },
1316
+ label: "h5ControlLabel",
1317
+ operation: { attributes: { level: 5 }, name: "toggleHeading" }
1318
+ });
1319
+ var H6Control = createControl({
1320
+ iconKey: "h6ControlIcon",
1321
+ isActive: { attributes: { level: 6 }, name: "heading" },
1322
+ label: "h6ControlLabel",
1323
+ operation: { attributes: { level: 6 }, name: "toggleHeading" }
1324
+ });
1325
+ var AlignLeftControl = createControl({
1326
+ iconKey: "alignLeftControlIcon",
1327
+ isActive: { attrs: { textAlign: "left" } },
1328
+ label: "alignLeftControlLabel",
1329
+ operation: { attributes: "left", name: "setTextAlign" }
1330
+ });
1331
+ var AlignCenterControl = createControl({
1332
+ iconKey: "alignCenterControlIcon",
1333
+ isActive: { attrs: { textAlign: "center" } },
1334
+ label: "alignCenterControlLabel",
1335
+ operation: { attributes: "center", name: "setTextAlign" }
1336
+ });
1337
+ var AlignRightControl = createControl({
1338
+ iconKey: "alignRightControlIcon",
1339
+ isActive: { attrs: { textAlign: "right" } },
1340
+ label: "alignRightControlLabel",
1341
+ operation: { attributes: "right", name: "setTextAlign" }
1342
+ });
1343
+ var AlignJustifyControl = createControl({
1344
+ iconKey: "alignJustifyControlIcon",
1345
+ isActive: { attrs: { textAlign: "justify" } },
1346
+ label: "alignJustifyControlLabel",
1347
+ operation: { attributes: "justify", name: "setTextAlign" }
1348
+ });
1349
+ var HighlightControl = createControl({
1350
+ iconKey: "highlightControlIcon",
1351
+ isActive: { name: "highlight" },
1352
+ label: "highlightControlLabel",
1353
+ operation: { name: "toggleHighlight" }
1354
+ });
1355
+ var SubscriptControl = createControl({
1356
+ iconKey: "subscriptControlIcon",
1357
+ isActive: { name: "subscript" },
1358
+ label: "subscriptControlLabel",
1359
+ operation: { name: "toggleSubscript" }
1360
+ });
1361
+ var SuperscriptControl = createControl({
1362
+ iconKey: "superscriptControlIcon",
1363
+ isActive: { name: "superscript" },
1364
+ label: "superscriptControlLabel",
1365
+ operation: { name: "toggleSuperscript" }
1366
+ });
856
1367
 
857
1368
  // src/controls/rte-link-control.tsx
858
- var import_jsx_runtime9 = require("react/jsx-runtime");
1369
+ var import_react9 = require("@tiptap/react");
1370
+ var React15 = __toESM(require("react"), 1);
1371
+ var import_react10 = require("react");
1372
+ var import_jsx_runtime21 = require("react/jsx-runtime");
859
1373
  var LinkControl = () => {
860
1374
  const { editor, labels, icons } = useRichTextEditorContext();
861
- const [url, setUrl] = (0, import_react8.useState)("");
862
- const [open, setOpen] = (0, import_react8.useState)(false);
863
- const active = (0, import_react7.useEditorState)({
1375
+ const [url, setUrl] = (0, import_react10.useState)("");
1376
+ const [open, setOpen] = (0, import_react10.useState)(false);
1377
+ const active = (0, import_react9.useEditorState)({
864
1378
  editor: editor ?? null,
865
1379
  selector: (ctx) => ctx.editor && !ctx.editor.isDestroyed ? ctx.editor.isActive("link") : false
866
1380
  });
867
- const handleOpen = (0, import_react8.useCallback)(
1381
+ const handleOpen = (0, import_react10.useCallback)(
868
1382
  (isOpen) => {
869
1383
  if (isOpen) {
870
1384
  const linkData = editor?.getAttributes("link");
@@ -894,16 +1408,16 @@ var LinkControl = () => {
894
1408
  handleSave();
895
1409
  }
896
1410
  };
897
- React4.useEffect(() => {
1411
+ React15.useEffect(() => {
898
1412
  const handler = () => handleOpen(true);
899
1413
  window.addEventListener("edit-link", handler);
900
1414
  return () => window.removeEventListener("edit-link", handler);
901
1415
  }, [handleOpen]);
902
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Popover, { open, onOpenChange: handleOpen, children: [
903
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1416
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Popover, { open, onOpenChange: handleOpen, children: [
1417
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
904
1418
  PopoverTrigger,
905
1419
  {
906
- render: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1420
+ render: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
907
1421
  Toggle,
908
1422
  {
909
1423
  size: "sm",
@@ -917,8 +1431,8 @@ var LinkControl = () => {
917
1431
  children: icons.linkControlIcon
918
1432
  }
919
1433
  ),
920
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PopoverContent, { className: "w-72 p-3", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "rte-link-editor", children: [
921
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1434
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PopoverContent, { className: "w-72 p-3", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "rte-link-editor", children: [
1435
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
922
1436
  Input,
923
1437
  {
924
1438
  type: "url",
@@ -930,7 +1444,7 @@ var LinkControl = () => {
930
1444
  className: "rte-link-editor-input h-8 text-sm"
931
1445
  }
932
1446
  ),
933
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1447
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
934
1448
  Button,
935
1449
  {
936
1450
  size: "sm",
@@ -946,35 +1460,172 @@ var LinkControl = () => {
946
1460
 
947
1461
  // src/controls/rte-twitter-control.tsx
948
1462
  var import_core2 = require("@tiptap/core");
949
- var import_react12 = require("@tiptap/react");
950
- var import_react13 = require("react");
1463
+ var import_react15 = require("@tiptap/react");
1464
+ var import_react16 = require("react");
951
1465
 
952
1466
  // src/extensions/resizable-node-view.tsx
953
- var import_react10 = require("@tiptap/react");
954
- var import_react11 = require("react");
1467
+ var import_react13 = require("@tiptap/react");
1468
+ var import_react14 = require("react");
955
1469
 
956
1470
  // src/icons.tsx
957
1471
  var import_lucide_react = require("lucide-react");
958
- var import_react9 = require("react");
959
- var import_jsx_runtime10 = require("react/jsx-runtime");
1472
+ var import_react12 = require("react");
1473
+
1474
+ // src/language-icons.tsx
1475
+ var import_react11 = require("react");
1476
+ var import_jsx_runtime22 = require("react/jsx-runtime");
1477
+ var LangIcon = ({
1478
+ children,
1479
+ className
1480
+ }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1481
+ "svg",
1482
+ {
1483
+ xmlns: "http://www.w3.org/2000/svg",
1484
+ viewBox: "0 0 24 24",
1485
+ fill: "none",
1486
+ stroke: "currentColor",
1487
+ strokeWidth: 1.5,
1488
+ strokeLinecap: "round",
1489
+ strokeLinejoin: "round",
1490
+ className,
1491
+ children
1492
+ }
1493
+ );
1494
+ var DEFAULT_LANGUAGE_ICONS = {
1495
+ bash: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
1496
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "2.5", y: "4", width: "19", height: "16", rx: "2" }),
1497
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6.5 9.5l3.5 3-3.5 3" }),
1498
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M12 15.5h5.5" })
1499
+ ] }),
1500
+ c: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
1501
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "12", cy: "12", r: "8.5" }),
1502
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M15.6 9.3a4.5 4.5 0 1 0 0 5.4" })
1503
+ ] }),
1504
+ cpp: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
1505
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "9.5", cy: "12", r: "6.5" }),
1506
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M12.3 9.7a3.3 3.3 0 1 0 0 4.6" }),
1507
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M15.7 10.5v3M14.2 12h3" }),
1508
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M19.3 10.5v3M17.8 12h3" })
1509
+ ] }),
1510
+ css: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
1511
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1512
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M9.7 7.5l-1 9" }),
1513
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M15.3 7.5l-1 9" }),
1514
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M7 10.3h11" }),
1515
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6.5 14.3h11" })
1516
+ ] }),
1517
+ go: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
1518
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1519
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M12.6 9.7A3.3 3.3 0 1 0 12.6 14.3" }),
1520
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M12.6 12h-1.9" }),
1521
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "17", cy: "12", r: "2.9" })
1522
+ ] }),
1523
+ html: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
1524
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1525
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M9.5 8.5L6.5 12l3 3.5" }),
1526
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M14.5 8.5L17.5 12l-3 3.5" }),
1527
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M13 7.3l-2 9.4" })
1528
+ ] }),
1529
+ java: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
1530
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6 10h10v5a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3v-5z" }),
1531
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M16 12h1.3a1.8 1.8 0 0 1 0 3.6H16" }),
1532
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M9.3 3.8c-.9.8-.9 1.6 0 2.4M13.3 3.8c-.9.8-.9 1.6 0 2.4" }),
1533
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6 19.3h10" })
1534
+ ] }),
1535
+ javascript: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
1536
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1537
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M10.5 8v6.5a2 2 0 0 1-3.5 1.3" }),
1538
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M17 8.8a2 2 0 0 0-2-.8c-1.1 0-2.2.6-2.2 1.7 0 1 .9 1.4 2.2 1.7 1.3.3 2.3.7 2.3 1.9 0 1.1-1 1.8-2.3 1.8a2.4 2.4 0 0 1-2.3-1.4" })
1539
+ ] }),
1540
+ json: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
1541
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M8 3H7a2 2 0 0 0-2 2v4a2 2 0 0 1-2 2 2 2 0 0 1 2 2v4a2 2 0 0 0 2 2" }),
1542
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M16 3h1a2 2 0 0 1 2 2v4a2 2 0 0 0 2 2 2 2 0 0 0-2 2v4a2 2 0 0 1-2 2" })
1543
+ ] }),
1544
+ kotlin: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
1545
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1546
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M9 7.5v9" }),
1547
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M9 12l6-4.5" }),
1548
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M9 12l6 4.5" })
1549
+ ] }),
1550
+ markdown: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
1551
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "2", y: "5", width: "20", height: "14", rx: "2" }),
1552
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6 15V9l3 4 3-4v6" }),
1553
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M16.5 9v6" }),
1554
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M14.5 13l2 2 2-2" })
1555
+ ] }),
1556
+ php: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
1557
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1558
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M11.5 8.5L7.5 12l4 3.5" }),
1559
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M15.2 8.2c1.1 0 1.9.6 1.9 1.6 0 1.1-.9 1.5-1.8 1.8-.6.2-1 .5-1 1.1" }),
1560
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "14.3", cy: "16.2", r: ".5", fill: "currentColor", stroke: "none" })
1561
+ ] }),
1562
+ plaintext: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
1563
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "4", y: "2.5", width: "16", height: "19", rx: "2" }),
1564
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "7.5", y1: "7.5", x2: "16.5", y2: "7.5" }),
1565
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "7.5", y1: "11.5", x2: "16.5", y2: "11.5" }),
1566
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "7.5", y1: "15.5", x2: "13.5", y2: "15.5" })
1567
+ ] }),
1568
+ python: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
1569
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M4.5 15c0-3 2.5-4.7 5.7-4.7h1.6c2.8 0 5-2 5-4.5" }),
1570
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M9.5 3.3c1.3-.3 2.6 0 3.3 1-.7 1-2 1.3-3.3 1" }),
1571
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "15.5", cy: "4.3", r: ".55", fill: "currentColor", stroke: "none" }),
1572
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M17.8 4.5l1.4-.6M17.8 4.9l1.4.6" })
1573
+ ] }),
1574
+ ruby: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
1575
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("polygon", { points: "12 2.5 19.5 8 12 21.5 4.5 8" }),
1576
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M4.5 8h15" }),
1577
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M12 2.5v19" })
1578
+ ] }),
1579
+ rust: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
1580
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "12", cy: "12", r: "7" }),
1581
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "12", cy: "12", r: "2.3" }),
1582
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M12 2.5v3M12 18.5v3M2.5 12h3M18.5 12h3" }),
1583
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5.6 5.6l2.1 2.1M16.3 16.3l2.1 2.1M5.6 18.4l2.1-2.1M16.3 7.7l2.1-2.1" })
1584
+ ] }),
1585
+ sql: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
1586
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("ellipse", { cx: "12", cy: "6", rx: "8", ry: "3" }),
1587
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M4 6v6c0 1.7 3.6 3 8 3s8-1.3 8-3V6" }),
1588
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M4 12v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6" })
1589
+ ] }),
1590
+ swift: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(LangIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M19 4.5c-2.6 4-5.5 7-8.3 9 2-.2 3.7-1 4.8-2.6-.7 2.8-2.8 5-5.3 6.1 3 .5 5.6-.5 7.2-2.4.4 2-.4 3.9-1.9 4.9 3.7-1.3 6-4.2 6.6-7.6-1 2.6-2.8 4.6-4.6 5.8" }) }),
1591
+ typescript: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
1592
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1593
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M7.3 8.2h5M9.8 8.2v7.6" }),
1594
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M17 8.8a2 2 0 0 0-2-.8c-1.1 0-2.2.6-2.2 1.7 0 1 .9 1.4 2.2 1.7 1.3.3 2.3.7 2.3 1.9 0 1.1-1 1.8-2.3 1.8a2.4 2.4 0 0 1-2.3-1.4" })
1595
+ ] }),
1596
+ xml: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
1597
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M8 7l-4.5 5 4.5 5" }),
1598
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M16 7l4.5 5-4.5 5" }),
1599
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M12 8v8" })
1600
+ ] }),
1601
+ yaml: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
1602
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "2.5", y: "3", width: "19", height: "18", rx: "2" }),
1603
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6.5 8h2M9.5 8h8" }),
1604
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6.5 12h2M9.5 12h6" }),
1605
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6.5 16h2M9.5 16h7" })
1606
+ ] })
1607
+ };
1608
+
1609
+ // src/icons.tsx
1610
+ var import_jsx_runtime23 = require("react/jsx-runtime");
960
1611
  var ALIGN_PATHS = {
961
- center: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
962
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
963
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "17", y1: "12", x2: "7", y2: "12" }),
964
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "19", y1: "18", x2: "5", y2: "18" })
1612
+ center: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
1613
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
1614
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "17", y1: "12", x2: "7", y2: "12" }),
1615
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "19", y1: "18", x2: "5", y2: "18" })
965
1616
  ] }),
966
- left: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
967
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
968
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "15", y1: "12", x2: "3", y2: "12" }),
969
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "17", y1: "18", x2: "3", y2: "18" })
1617
+ left: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
1618
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
1619
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "15", y1: "12", x2: "3", y2: "12" }),
1620
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "17", y1: "18", x2: "3", y2: "18" })
970
1621
  ] }),
971
- right: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
972
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
973
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "21", y1: "12", x2: "9", y2: "12" }),
974
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "21", y1: "18", x2: "7", y2: "18" })
1622
+ right: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
1623
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
1624
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "21", y1: "12", x2: "9", y2: "12" }),
1625
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "21", y1: "18", x2: "7", y2: "18" })
975
1626
  ] })
976
1627
  };
977
- var AlignIcon = ({ dir }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1628
+ var AlignIcon = ({ dir }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
978
1629
  "svg",
979
1630
  {
980
1631
  xmlns: "http://www.w3.org/2000/svg",
@@ -988,7 +1639,7 @@ var AlignIcon = ({ dir }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
988
1639
  children: ALIGN_PATHS[dir]
989
1640
  }
990
1641
  );
991
- var EditUrlIcon = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1642
+ var EditUrlIcon = () => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
992
1643
  "svg",
993
1644
  {
994
1645
  xmlns: "http://www.w3.org/2000/svg",
@@ -1000,12 +1651,12 @@ var EditUrlIcon = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1000
1651
  strokeLinejoin: "round",
1001
1652
  className: "rte-editor-icon",
1002
1653
  children: [
1003
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M12 20h9" }),
1004
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z" })
1654
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M12 20h9" }),
1655
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z" })
1005
1656
  ]
1006
1657
  }
1007
1658
  );
1008
- var OpenInYouTubeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1659
+ var OpenInYouTubeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
1009
1660
  "svg",
1010
1661
  {
1011
1662
  xmlns: "http://www.w3.org/2000/svg",
@@ -1017,13 +1668,13 @@ var OpenInYouTubeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1017
1668
  strokeLinejoin: "round",
1018
1669
  className: "rte-editor-icon",
1019
1670
  children: [
1020
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }),
1021
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("polyline", { points: "15 3 21 3 21 9" }),
1022
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "10", y1: "14", x2: "21", y2: "3" })
1671
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }),
1672
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("polyline", { points: "15 3 21 3 21 9" }),
1673
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "10", y1: "14", x2: "21", y2: "3" })
1023
1674
  ]
1024
1675
  }
1025
1676
  );
1026
- var DeleteEmbedIcon = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1677
+ var DeleteEmbedIcon = () => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
1027
1678
  "svg",
1028
1679
  {
1029
1680
  xmlns: "http://www.w3.org/2000/svg",
@@ -1035,177 +1686,46 @@ var DeleteEmbedIcon = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1035
1686
  strokeLinejoin: "round",
1036
1687
  className: "rte-editor-icon",
1037
1688
  children: [
1038
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("polyline", { points: "3 6 5 6 21 6" }),
1039
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })
1689
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("polyline", { points: "3 6 5 6 21 6" }),
1690
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })
1040
1691
  ]
1041
1692
  }
1042
1693
  );
1043
1694
  var iconProps = { className: "rte-editor-icon" };
1044
- var LangIcon = ({
1045
- children,
1046
- className
1047
- }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1048
- "svg",
1049
- {
1050
- xmlns: "http://www.w3.org/2000/svg",
1051
- viewBox: "0 0 24 24",
1052
- fill: "none",
1053
- stroke: "currentColor",
1054
- strokeWidth: 1.5,
1055
- strokeLinecap: "round",
1056
- strokeLinejoin: "round",
1057
- className,
1058
- children
1059
- }
1060
- );
1061
- var DEFAULT_LANGUAGE_ICONS = {
1062
- bash: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1063
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: "2.5", y: "4", width: "19", height: "16", rx: "2" }),
1064
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M6.5 9.5l3.5 3-3.5 3" }),
1065
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M12 15.5h5.5" })
1066
- ] }),
1067
- c: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1068
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: "12", cy: "12", r: "8.5" }),
1069
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M15.6 9.3a4.5 4.5 0 1 0 0 5.4" })
1070
- ] }),
1071
- cpp: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1072
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: "9.5", cy: "12", r: "6.5" }),
1073
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M12.3 9.7a3.3 3.3 0 1 0 0 4.6" }),
1074
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M15.7 10.5v3M14.2 12h3" }),
1075
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M19.3 10.5v3M17.8 12h3" })
1076
- ] }),
1077
- css: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1078
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1079
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M9.7 7.5l-1 9" }),
1080
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M15.3 7.5l-1 9" }),
1081
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M7 10.3h11" }),
1082
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M6.5 14.3h11" })
1083
- ] }),
1084
- go: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1085
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1086
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M12.6 9.7A3.3 3.3 0 1 0 12.6 14.3" }),
1087
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M12.6 12h-1.9" }),
1088
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: "17", cy: "12", r: "2.9" })
1089
- ] }),
1090
- html: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1091
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1092
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M9.5 8.5L6.5 12l3 3.5" }),
1093
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M14.5 8.5L17.5 12l-3 3.5" }),
1094
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M13 7.3l-2 9.4" })
1095
- ] }),
1096
- java: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1097
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M6 10h10v5a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3v-5z" }),
1098
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M16 12h1.3a1.8 1.8 0 0 1 0 3.6H16" }),
1099
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M9.3 3.8c-.9.8-.9 1.6 0 2.4M13.3 3.8c-.9.8-.9 1.6 0 2.4" }),
1100
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M6 19.3h10" })
1101
- ] }),
1102
- javascript: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1103
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1104
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M10.5 8v6.5a2 2 0 0 1-3.5 1.3" }),
1105
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M17 8.8a2 2 0 0 0-2-.8c-1.1 0-2.2.6-2.2 1.7 0 1 .9 1.4 2.2 1.7 1.3.3 2.3.7 2.3 1.9 0 1.1-1 1.8-2.3 1.8a2.4 2.4 0 0 1-2.3-1.4" })
1106
- ] }),
1107
- json: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1108
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M8 3H7a2 2 0 0 0-2 2v4a2 2 0 0 1-2 2 2 2 0 0 1 2 2v4a2 2 0 0 0 2 2" }),
1109
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M16 3h1a2 2 0 0 1 2 2v4a2 2 0 0 0 2 2 2 2 0 0 0-2 2v4a2 2 0 0 1-2 2" })
1110
- ] }),
1111
- kotlin: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1112
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1113
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M9 7.5v9" }),
1114
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M9 12l6-4.5" }),
1115
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M9 12l6 4.5" })
1116
- ] }),
1117
- markdown: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1118
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: "2", y: "5", width: "20", height: "14", rx: "2" }),
1119
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M6 15V9l3 4 3-4v6" }),
1120
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M16.5 9v6" }),
1121
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M14.5 13l2 2 2-2" })
1122
- ] }),
1123
- php: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1124
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1125
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M11.5 8.5L7.5 12l4 3.5" }),
1126
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M15.2 8.2c1.1 0 1.9.6 1.9 1.6 0 1.1-.9 1.5-1.8 1.8-.6.2-1 .5-1 1.1" }),
1127
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: "14.3", cy: "16.2", r: ".5", fill: "currentColor", stroke: "none" })
1128
- ] }),
1129
- plaintext: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1130
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: "4", y: "2.5", width: "16", height: "19", rx: "2" }),
1131
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "7.5", y1: "7.5", x2: "16.5", y2: "7.5" }),
1132
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "7.5", y1: "11.5", x2: "16.5", y2: "11.5" }),
1133
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "7.5", y1: "15.5", x2: "13.5", y2: "15.5" })
1134
- ] }),
1135
- python: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1136
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M4.5 15c0-3 2.5-4.7 5.7-4.7h1.6c2.8 0 5-2 5-4.5" }),
1137
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M9.5 3.3c1.3-.3 2.6 0 3.3 1-.7 1-2 1.3-3.3 1" }),
1138
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: "15.5", cy: "4.3", r: ".55", fill: "currentColor", stroke: "none" }),
1139
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M17.8 4.5l1.4-.6M17.8 4.9l1.4.6" })
1140
- ] }),
1141
- ruby: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1142
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("polygon", { points: "12 2.5 19.5 8 12 21.5 4.5 8" }),
1143
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M4.5 8h15" }),
1144
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M12 2.5v19" })
1145
- ] }),
1146
- rust: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1147
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: "12", cy: "12", r: "7" }),
1148
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: "12", cy: "12", r: "2.3" }),
1149
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M12 2.5v3M12 18.5v3M2.5 12h3M18.5 12h3" }),
1150
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M5.6 5.6l2.1 2.1M16.3 16.3l2.1 2.1M5.6 18.4l2.1-2.1M16.3 7.7l2.1-2.1" })
1151
- ] }),
1152
- sql: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1153
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ellipse", { cx: "12", cy: "6", rx: "8", ry: "3" }),
1154
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M4 6v6c0 1.7 3.6 3 8 3s8-1.3 8-3V6" }),
1155
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M4 12v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6" })
1156
- ] }),
1157
- swift: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(LangIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M19 4.5c-2.6 4-5.5 7-8.3 9 2-.2 3.7-1 4.8-2.6-.7 2.8-2.8 5-5.3 6.1 3 .5 5.6-.5 7.2-2.4.4 2-.4 3.9-1.9 4.9 3.7-1.3 6-4.2 6.6-7.6-1 2.6-2.8 4.6-4.6 5.8" }) }),
1158
- typescript: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1159
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1160
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M7.3 8.2h5M9.8 8.2v7.6" }),
1161
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M17 8.8a2 2 0 0 0-2-.8c-1.1 0-2.2.6-2.2 1.7 0 1 .9 1.4 2.2 1.7 1.3.3 2.3.7 2.3 1.9 0 1.1-1 1.8-2.3 1.8a2.4 2.4 0 0 1-2.3-1.4" })
1162
- ] }),
1163
- xml: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1164
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M8 7l-4.5 5 4.5 5" }),
1165
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M16 7l4.5 5-4.5 5" }),
1166
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M12 8v8" })
1167
- ] }),
1168
- yaml: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1169
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: "2.5", y: "3", width: "19", height: "18", rx: "2" }),
1170
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M6.5 8h2M9.5 8h8" }),
1171
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M6.5 12h2M9.5 12h6" }),
1172
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M6.5 16h2M9.5 16h7" })
1173
- ] })
1174
- };
1175
1695
  var DEFAULT_ICONS = {
1176
- alignCenterControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.TextAlignCenter, { ...iconProps }),
1177
- alignJustifyControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.TextAlignJustify, { ...iconProps }),
1178
- alignLeftControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.TextAlignStart, { ...iconProps }),
1179
- alignRightControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.TextAlignEnd, { ...iconProps }),
1180
- blockquoteControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.TextQuote, { ...iconProps }),
1181
- boldControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Bold, { ...iconProps }),
1182
- bulletListControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.List, { ...iconProps }),
1183
- clearFormattingControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.RemoveFormatting, { ...iconProps }),
1184
- codeBlockControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.SquareCode, { ...iconProps }),
1185
- codeControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Code, { ...iconProps }),
1186
- h1ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Heading1, { ...iconProps }),
1187
- h2ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Heading2, { ...iconProps }),
1188
- h3ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Heading3, { ...iconProps }),
1189
- h4ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Heading4, { ...iconProps }),
1190
- h5ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Heading5, { ...iconProps }),
1191
- h6ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Heading6, { ...iconProps }),
1192
- highlightControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Highlighter, { ...iconProps }),
1193
- hrControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Minus, { ...iconProps }),
1194
- italicControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Italic, { ...iconProps }),
1696
+ alignCenterControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.TextAlignCenter, { ...iconProps }),
1697
+ alignJustifyControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.TextAlignJustify, { ...iconProps }),
1698
+ alignLeftControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.TextAlignStart, { ...iconProps }),
1699
+ alignRightControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.TextAlignEnd, { ...iconProps }),
1700
+ blockquoteControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.TextQuote, { ...iconProps }),
1701
+ boldControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Bold, { ...iconProps }),
1702
+ bulletListControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.List, { ...iconProps }),
1703
+ clearFormattingControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.RemoveFormatting, { ...iconProps }),
1704
+ codeBlockControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.SquareCode, { ...iconProps }),
1705
+ codeControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Code, { ...iconProps }),
1706
+ h1ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Heading1, { ...iconProps }),
1707
+ h2ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Heading2, { ...iconProps }),
1708
+ h3ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Heading3, { ...iconProps }),
1709
+ h4ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Heading4, { ...iconProps }),
1710
+ h5ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Heading5, { ...iconProps }),
1711
+ h6ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Heading6, { ...iconProps }),
1712
+ highlightControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Highlighter, { ...iconProps }),
1713
+ hrControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Minus, { ...iconProps }),
1714
+ italicControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Italic, { ...iconProps }),
1195
1715
  languageIcons: DEFAULT_LANGUAGE_ICONS,
1196
- linkControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Link, { ...iconProps }),
1197
- orderedListControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.ListOrdered, { ...iconProps }),
1198
- redoControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Redo2, { ...iconProps }),
1199
- strikeControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Strikethrough, { ...iconProps }),
1200
- subscriptControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Subscript, { ...iconProps }),
1201
- superscriptControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Superscript, { ...iconProps }),
1202
- underlineControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Underline, { ...iconProps }),
1203
- undoControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Undo2, { ...iconProps }),
1204
- unlinkControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Link2Off, { ...iconProps })
1716
+ linkControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Link, { ...iconProps }),
1717
+ orderedListControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.ListOrdered, { ...iconProps }),
1718
+ redoControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Redo2, { ...iconProps }),
1719
+ strikeControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Strikethrough, { ...iconProps }),
1720
+ subscriptControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Subscript, { ...iconProps }),
1721
+ superscriptControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Superscript, { ...iconProps }),
1722
+ underlineControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Underline, { ...iconProps }),
1723
+ undoControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Undo2, { ...iconProps }),
1724
+ unlinkControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Link2Off, { ...iconProps })
1205
1725
  };
1206
1726
 
1207
1727
  // src/extensions/resizable-node-view.tsx
1208
- var import_jsx_runtime11 = require("react/jsx-runtime");
1728
+ var import_jsx_runtime24 = require("react/jsx-runtime");
1209
1729
  var EmbedToolbar = ({
1210
1730
  align,
1211
1731
  videoSrc,
@@ -1222,8 +1742,8 @@ var EmbedToolbar = ({
1222
1742
  nodeSrc
1223
1743
  }) => {
1224
1744
  if (isEditingUrl) {
1225
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "rte-embed-selector-edit-form", children: [
1226
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1745
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "rte-embed-selector-edit-form", children: [
1746
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1227
1747
  "input",
1228
1748
  {
1229
1749
  ref: inputRef,
@@ -1241,7 +1761,7 @@ var EmbedToolbar = ({
1241
1761
  }
1242
1762
  }
1243
1763
  ),
1244
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1764
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1245
1765
  "button",
1246
1766
  {
1247
1767
  type: "button",
@@ -1250,7 +1770,7 @@ var EmbedToolbar = ({
1250
1770
  children: "Save"
1251
1771
  }
1252
1772
  ),
1253
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1773
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1254
1774
  "button",
1255
1775
  {
1256
1776
  type: "button",
@@ -1261,8 +1781,8 @@ var EmbedToolbar = ({
1261
1781
  )
1262
1782
  ] });
1263
1783
  }
1264
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
1265
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "rte-embed-selector-group", children: ["left", "center", "right"].map((dir) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1784
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
1785
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "rte-embed-selector-group", children: ["left", "center", "right"].map((dir) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1266
1786
  "button",
1267
1787
  {
1268
1788
  type: "button",
@@ -1270,12 +1790,12 @@ var EmbedToolbar = ({
1270
1790
  "aria-label": `Align ${dir.charAt(0).toUpperCase()}${dir.slice(1)}`,
1271
1791
  className: `rte-embed-selector-btn ${align === dir ? "rte-embed-selector-btn--active" : ""}`,
1272
1792
  onClick: () => updateAttributes({ align: dir }),
1273
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AlignIcon, { dir })
1793
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(AlignIcon, { dir })
1274
1794
  },
1275
1795
  dir
1276
1796
  )) }),
1277
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "rte-embed-selector-divider" }),
1278
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "rte-embed-selector-group", children: [25, 50, 75, 100].map((pct) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1797
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "rte-embed-selector-divider" }),
1798
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "rte-embed-selector-group", children: [25, 50, 75, 100].map((pct) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
1279
1799
  "button",
1280
1800
  {
1281
1801
  type: "button",
@@ -1289,9 +1809,9 @@ var EmbedToolbar = ({
1289
1809
  },
1290
1810
  pct
1291
1811
  )) }),
1292
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "rte-embed-selector-divider" }),
1293
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "rte-embed-selector-group", children: [
1294
- (videoSrc || nodeSrc) && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1812
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "rte-embed-selector-divider" }),
1813
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "rte-embed-selector-group", children: [
1814
+ (videoSrc || nodeSrc) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1295
1815
  "button",
1296
1816
  {
1297
1817
  type: "button",
@@ -1302,10 +1822,10 @@ var EmbedToolbar = ({
1302
1822
  setUrlInput(videoSrc || nodeSrc || "");
1303
1823
  setIsEditingUrl(true);
1304
1824
  },
1305
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(EditUrlIcon, {})
1825
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(EditUrlIcon, {})
1306
1826
  }
1307
1827
  ),
1308
- watchUrl && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1828
+ watchUrl && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1309
1829
  "button",
1310
1830
  {
1311
1831
  type: "button",
@@ -1313,10 +1833,10 @@ var EmbedToolbar = ({
1313
1833
  "aria-label": "Open video in YouTube",
1314
1834
  className: "rte-embed-selector-btn",
1315
1835
  onClick: () => window.open(watchUrl, "_blank"),
1316
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(OpenInYouTubeIcon, {})
1836
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(OpenInYouTubeIcon, {})
1317
1837
  }
1318
1838
  ),
1319
- deleteNode && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1839
+ deleteNode && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1320
1840
  "button",
1321
1841
  {
1322
1842
  type: "button",
@@ -1324,7 +1844,7 @@ var EmbedToolbar = ({
1324
1844
  "aria-label": "Delete Embed",
1325
1845
  className: "rte-embed-selector-btn rte-embed-selector-btn--danger",
1326
1846
  onClick: () => deleteNode(),
1327
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DeleteEmbedIcon, {})
1847
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DeleteEmbedIcon, {})
1328
1848
  }
1329
1849
  )
1330
1850
  ] })
@@ -1346,26 +1866,26 @@ var ResizableNodeView = ({
1346
1866
  watchUrl,
1347
1867
  onSrcChange
1348
1868
  }) => {
1349
- const containerRef = (0, import_react11.useRef)(null);
1350
- const [isEditingUrl, setIsEditingUrl] = (0, import_react11.useState)(false);
1351
- const [urlInput, setUrlInput] = (0, import_react11.useState)(videoSrc || "");
1352
- const [isResizing, setIsResizing] = (0, import_react11.useState)(false);
1353
- const [currentDimensions, setCurrentDimensions] = (0, import_react11.useState)(null);
1354
- const resizingRef = (0, import_react11.useRef)(null);
1869
+ const containerRef = (0, import_react14.useRef)(null);
1870
+ const [isEditingUrl, setIsEditingUrl] = (0, import_react14.useState)(false);
1871
+ const [urlInput, setUrlInput] = (0, import_react14.useState)(videoSrc || "");
1872
+ const [isResizing, setIsResizing] = (0, import_react14.useState)(false);
1873
+ const [currentDimensions, setCurrentDimensions] = (0, import_react14.useState)(null);
1874
+ const resizingRef = (0, import_react14.useRef)(null);
1355
1875
  const width = node.attrs.width;
1356
1876
  const height = node.attrs.height;
1357
1877
  const align = node.attrs.align || "center";
1358
- const getEditorWidth = (0, import_react11.useCallback)(
1878
+ const getEditorWidth = (0, import_react14.useCallback)(
1359
1879
  () => view?.dom?.parentElement?.offsetWidth ?? 800,
1360
1880
  [view]
1361
1881
  );
1362
- const inputRef = (0, import_react11.useRef)(null);
1363
- (0, import_react11.useEffect)(() => {
1882
+ const inputRef = (0, import_react14.useRef)(null);
1883
+ (0, import_react14.useEffect)(() => {
1364
1884
  if (isEditingUrl) {
1365
1885
  inputRef.current?.focus();
1366
1886
  }
1367
1887
  }, [isEditingUrl]);
1368
- const handleMouseMove = (0, import_react11.useCallback)(
1888
+ const handleMouseMove = (0, import_react14.useCallback)(
1369
1889
  (e) => {
1370
1890
  const resize = resizingRef.current;
1371
1891
  if (!resize) {
@@ -1415,7 +1935,7 @@ var ResizableNodeView = ({
1415
1935
  },
1416
1936
  [lockAspect, aspectRatio, minWidth, maxWidth]
1417
1937
  );
1418
- const handleMouseUp = (0, import_react11.useCallback)(
1938
+ const handleMouseUp = (0, import_react14.useCallback)(
1419
1939
  function handleMouseUp2() {
1420
1940
  const resize = resizingRef.current;
1421
1941
  if (!resize) {
@@ -1436,7 +1956,7 @@ var ResizableNodeView = ({
1436
1956
  },
1437
1957
  [handleMouseMove, updateAttributes]
1438
1958
  );
1439
- const handleMouseDown = (0, import_react11.useCallback)(
1959
+ const handleMouseDown = (0, import_react14.useCallback)(
1440
1960
  (e, direction) => {
1441
1961
  e.preventDefault();
1442
1962
  e.stopPropagation();
@@ -1467,7 +1987,7 @@ var ResizableNodeView = ({
1467
1987
  },
1468
1988
  [width, height, getEditorWidth, handleMouseMove, handleMouseUp]
1469
1989
  );
1470
- (0, import_react11.useEffect)(
1990
+ (0, import_react14.useEffect)(
1471
1991
  () => () => {
1472
1992
  document.removeEventListener("mousemove", handleMouseMove);
1473
1993
  document.removeEventListener("mouseup", handleMouseUp);
@@ -1495,13 +2015,13 @@ var ResizableNodeView = ({
1495
2015
  setIsEditingUrl(false);
1496
2016
  };
1497
2017
  const isEditable = editor ? editor.isEditable : true;
1498
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1499
- import_react10.NodeViewWrapper,
2018
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2019
+ import_react13.NodeViewWrapper,
1500
2020
  {
1501
2021
  className: "rte-embed-wrapper",
1502
2022
  "data-selected": selected || void 0,
1503
2023
  "data-align": align,
1504
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2024
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
1505
2025
  "div",
1506
2026
  {
1507
2027
  ref: containerRef,
@@ -1514,7 +2034,7 @@ var ResizableNodeView = ({
1514
2034
  },
1515
2035
  children: [
1516
2036
  children,
1517
- selected && isEditable && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "rte-embed-selector", contentEditable: false, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2037
+ selected && isEditable && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "rte-embed-selector", contentEditable: false, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1518
2038
  EmbedToolbar,
1519
2039
  {
1520
2040
  align,
@@ -1532,14 +2052,14 @@ var ResizableNodeView = ({
1532
2052
  nodeSrc: node.attrs.src
1533
2053
  }
1534
2054
  ) }),
1535
- isResizing && currentDimensions && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "rte-embed-resize-badge", children: [
2055
+ isResizing && currentDimensions && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "rte-embed-resize-badge", children: [
1536
2056
  currentDimensions.w,
1537
2057
  " \xD7 ",
1538
2058
  currentDimensions.h,
1539
2059
  " px"
1540
2060
  ] }),
1541
- selected && isEditable && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
1542
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2061
+ selected && isEditable && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
2062
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1543
2063
  "div",
1544
2064
  {
1545
2065
  className: "rte-resize-handle rte-resize-handle--left",
@@ -1547,7 +2067,7 @@ var ResizableNodeView = ({
1547
2067
  role: "presentation"
1548
2068
  }
1549
2069
  ),
1550
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2070
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1551
2071
  "div",
1552
2072
  {
1553
2073
  className: "rte-resize-handle rte-resize-handle--right",
@@ -1555,7 +2075,7 @@ var ResizableNodeView = ({
1555
2075
  role: "presentation"
1556
2076
  }
1557
2077
  ),
1558
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2078
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1559
2079
  "div",
1560
2080
  {
1561
2081
  className: "rte-resize-handle rte-resize-handle--bottom",
@@ -1563,7 +2083,7 @@ var ResizableNodeView = ({
1563
2083
  role: "presentation"
1564
2084
  }
1565
2085
  ),
1566
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2086
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1567
2087
  "div",
1568
2088
  {
1569
2089
  className: "rte-resize-handle rte-resize-handle--corner rte-resize-handle--corner-bl",
@@ -1571,7 +2091,7 @@ var ResizableNodeView = ({
1571
2091
  role: "presentation"
1572
2092
  }
1573
2093
  ),
1574
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2094
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1575
2095
  "div",
1576
2096
  {
1577
2097
  className: "rte-resize-handle rte-resize-handle--corner rte-resize-handle--corner-br",
@@ -1587,121 +2107,8 @@ var ResizableNodeView = ({
1587
2107
  );
1588
2108
  };
1589
2109
 
1590
- // src/ui/dialog.tsx
1591
- var import_dialog = require("@base-ui/react/dialog");
1592
- var React6 = require("react");
1593
- var import_jsx_runtime12 = require("react/jsx-runtime");
1594
- var Dialog = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_dialog.Dialog.Root, { "data-slot": "dialog", ...props });
1595
- var DialogTrigger = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_dialog.Dialog.Trigger, { "data-slot": "dialog-trigger", ...props });
1596
- var DialogPortal = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_dialog.Dialog.Portal, { "data-slot": "dialog-portal", ...props });
1597
- var DialogClose = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_dialog.Dialog.Close, { "data-slot": "dialog-close", ...props });
1598
- var DialogOverlay = ({
1599
- className,
1600
- ...props
1601
- }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1602
- import_dialog.Dialog.Backdrop,
1603
- {
1604
- "data-slot": "dialog-overlay",
1605
- className: cn(
1606
- "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",
1607
- className
1608
- ),
1609
- ...props
1610
- }
1611
- );
1612
- var DialogContent = ({
1613
- className,
1614
- children,
1615
- showCloseButton = true,
1616
- ...props
1617
- }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(DialogPortal, { children: [
1618
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DialogOverlay, {}),
1619
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1620
- import_dialog.Dialog.Popup,
1621
- {
1622
- "data-slot": "dialog-content",
1623
- className: cn(
1624
- "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",
1625
- className
1626
- ),
1627
- ...props,
1628
- children: [
1629
- children,
1630
- showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1631
- import_dialog.Dialog.Close,
1632
- {
1633
- "data-slot": "dialog-close",
1634
- render: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1635
- Button,
1636
- {
1637
- variant: "ghost",
1638
- className: "absolute top-2 right-2",
1639
- size: "icon-sm"
1640
- }
1641
- ),
1642
- children: [
1643
- "X",
1644
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "sr-only", children: "Close" })
1645
- ]
1646
- }
1647
- )
1648
- ]
1649
- }
1650
- )
1651
- ] });
1652
- var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1653
- "div",
1654
- {
1655
- "data-slot": "dialog-header",
1656
- className: cn("flex flex-col gap-1 text-left", className),
1657
- ...props
1658
- }
1659
- );
1660
- var DialogFooter = ({
1661
- className,
1662
- showCloseButton = false,
1663
- children,
1664
- ...props
1665
- }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1666
- "div",
1667
- {
1668
- "data-slot": "dialog-footer",
1669
- className: cn(
1670
- "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
1671
- className
1672
- ),
1673
- ...props,
1674
- children: [
1675
- children,
1676
- showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_dialog.Dialog.Close, { render: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Button, { variant: "outline" }), children: "Close" })
1677
- ]
1678
- }
1679
- );
1680
- var DialogTitle = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1681
- import_dialog.Dialog.Title,
1682
- {
1683
- "data-slot": "dialog-title",
1684
- className: cn("text-sm font-medium", className),
1685
- ...props
1686
- }
1687
- );
1688
- var DialogDescription = ({
1689
- className,
1690
- ...props
1691
- }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1692
- import_dialog.Dialog.Description,
1693
- {
1694
- "data-slot": "dialog-description",
1695
- className: cn(
1696
- "text-xs/relaxed text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",
1697
- className
1698
- ),
1699
- ...props
1700
- }
1701
- );
1702
-
1703
2110
  // src/controls/rte-twitter-control.tsx
1704
- var import_jsx_runtime13 = require("react/jsx-runtime");
2111
+ var import_jsx_runtime25 = require("react/jsx-runtime");
1705
2112
  var WIDGET_SCRIPT_URL = "https://platform.twitter.com/widgets.js";
1706
2113
  var SCRIPT_LOAD_TIMEOUT_MS = 8e3;
1707
2114
  var READY_POLL_INTERVAL_MS = 50;
@@ -1728,18 +2135,23 @@ var loadTwitterScript = () => {
1728
2135
  document.body.append(script);
1729
2136
  }
1730
2137
  let settled = false;
2138
+ const timers = {};
1731
2139
  const cleanup = () => {
1732
- clearInterval(pollId);
1733
- clearTimeout(timeoutId);
2140
+ clearInterval(timers.poll);
2141
+ clearTimeout(timers.timeout);
1734
2142
  };
1735
2143
  const succeed = () => {
1736
- if (settled) return;
2144
+ if (settled) {
2145
+ return;
2146
+ }
1737
2147
  settled = true;
1738
2148
  cleanup();
1739
2149
  resolve();
1740
2150
  };
1741
2151
  const fail = () => {
1742
- if (settled) return;
2152
+ if (settled) {
2153
+ return;
2154
+ }
1743
2155
  settled = true;
1744
2156
  cleanup();
1745
2157
  twitterScriptPromise = null;
@@ -1749,12 +2161,12 @@ var loadTwitterScript = () => {
1749
2161
  succeed();
1750
2162
  return;
1751
2163
  }
1752
- const pollId = setInterval(() => {
2164
+ timers.poll = setInterval(() => {
1753
2165
  if (window.twttr?.widgets) {
1754
2166
  succeed();
1755
2167
  }
1756
2168
  }, READY_POLL_INTERVAL_MS);
1757
- const timeoutId = setTimeout(fail, SCRIPT_LOAD_TIMEOUT_MS);
2169
+ timers.timeout = setTimeout(fail, SCRIPT_LOAD_TIMEOUT_MS);
1758
2170
  if (isNewScript) {
1759
2171
  script.addEventListener(
1760
2172
  "load",
@@ -1772,15 +2184,15 @@ var loadTwitterScript = () => {
1772
2184
  };
1773
2185
  var TwitterNodeView = (props) => {
1774
2186
  const { node } = props;
1775
- const containerRef = (0, import_react13.useRef)(null);
1776
- const [loading, setLoading] = (0, import_react13.useState)(true);
1777
- const [failed, setFailed] = (0, import_react13.useState)(false);
2187
+ const containerRef = (0, import_react16.useRef)(null);
2188
+ const [loading, setLoading] = (0, import_react16.useState)(true);
2189
+ const [failed, setFailed] = (0, import_react16.useState)(false);
1778
2190
  const { tweetId } = node.attrs;
1779
- const renderedTweetIdRef = (0, import_react13.useRef)(null);
1780
- const activeRenderIdRef = (0, import_react13.useRef)(0);
1781
- const retryToken = (0, import_react13.useRef)(0);
1782
- const [retryCount, setRetryCount] = (0, import_react13.useState)(0);
1783
- (0, import_react13.useEffect)(() => {
2191
+ const renderedTweetIdRef = (0, import_react16.useRef)(null);
2192
+ const activeRenderIdRef = (0, import_react16.useRef)(0);
2193
+ const retryToken = (0, import_react16.useRef)(0);
2194
+ const [retryCount, setRetryCount] = (0, import_react16.useState)(0);
2195
+ (0, import_react16.useEffect)(() => {
1784
2196
  if (!containerRef.current || !tweetId) {
1785
2197
  return;
1786
2198
  }
@@ -1839,11 +2251,11 @@ var TwitterNodeView = (props) => {
1839
2251
  isCancelled = true;
1840
2252
  };
1841
2253
  }, [tweetId, retryCount, failed]);
1842
- const handleRetry = (0, import_react13.useCallback)(() => {
2254
+ const handleRetry = (0, import_react16.useCallback)(() => {
1843
2255
  retryToken.current += 1;
1844
2256
  setRetryCount(retryToken.current);
1845
2257
  }, []);
1846
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2258
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
1847
2259
  ResizableNodeView,
1848
2260
  {
1849
2261
  ...props,
@@ -1851,12 +2263,12 @@ var TwitterNodeView = (props) => {
1851
2263
  minWidth: 300,
1852
2264
  maxWidth: 1200,
1853
2265
  children: [
1854
- loading && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "rte-embed-loading", children: "Loading tweet..." }),
1855
- !loading && failed && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "rte-embed-error", children: [
1856
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { children: "Couldn't load this tweet." }),
1857
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", onClick: handleRetry, children: "Retry" })
2266
+ loading && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "rte-embed-loading", children: "Loading tweet..." }),
2267
+ !loading && failed && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "rte-embed-error", children: [
2268
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { children: "Couldn't load this tweet." }),
2269
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", onClick: handleRetry, children: "Retry" })
1858
2270
  ] }),
1859
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { ref: containerRef })
2271
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref: containerRef })
1860
2272
  ]
1861
2273
  }
1862
2274
  );
@@ -1912,7 +2324,7 @@ var TwitterEmbed = import_core2.Node.create({
1912
2324
  ];
1913
2325
  },
1914
2326
  addNodeView() {
1915
- return (0, import_react12.ReactNodeViewRenderer)(TwitterNodeView);
2327
+ return (0, import_react15.ReactNodeViewRenderer)(TwitterNodeView);
1916
2328
  },
1917
2329
  atom: true,
1918
2330
  draggable: true,
@@ -1946,10 +2358,10 @@ var extractTweetId = (input) => {
1946
2358
  };
1947
2359
  var TwitterEmbedControl = ({ className }) => {
1948
2360
  const { editor } = useRichTextEditorContext();
1949
- const [open, setOpen] = (0, import_react13.useState)(false);
1950
- const [url, setUrl] = (0, import_react13.useState)("");
1951
- const [touched, setTouched] = (0, import_react13.useState)(false);
1952
- const { active } = (0, import_react12.useEditorState)({
2361
+ const [open, setOpen] = (0, import_react16.useState)(false);
2362
+ const [url, setUrl] = (0, import_react16.useState)("");
2363
+ const [touched, setTouched] = (0, import_react16.useState)(false);
2364
+ const { active } = (0, import_react15.useEditorState)({
1953
2365
  editor: editor ?? null,
1954
2366
  selector: (ctx) => ({
1955
2367
  active: ctx.editor && !ctx.editor.isDestroyed ? ctx.editor.isActive("twitter") : false
@@ -1957,11 +2369,11 @@ var TwitterEmbedControl = ({ className }) => {
1957
2369
  }) ?? { active: false };
1958
2370
  const tweetId = url ? extractTweetId(url) : null;
1959
2371
  const showError = touched && url.length > 0 && !tweetId;
1960
- const resetState = (0, import_react13.useCallback)(() => {
2372
+ const resetState = (0, import_react16.useCallback)(() => {
1961
2373
  setUrl("");
1962
2374
  setTouched(false);
1963
2375
  }, []);
1964
- const handleInsert = (0, import_react13.useCallback)(() => {
2376
+ const handleInsert = (0, import_react16.useCallback)(() => {
1965
2377
  setTouched(true);
1966
2378
  if (!tweetId || !editor) {
1967
2379
  return false;
@@ -1970,7 +2382,7 @@ var TwitterEmbedControl = ({ className }) => {
1970
2382
  resetState();
1971
2383
  return true;
1972
2384
  }, [tweetId, editor, resetState]);
1973
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2385
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
1974
2386
  Dialog,
1975
2387
  {
1976
2388
  open,
@@ -1981,59 +2393,59 @@ var TwitterEmbedControl = ({ className }) => {
1981
2393
  }
1982
2394
  },
1983
2395
  children: [
1984
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2396
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1985
2397
  DialogTrigger,
1986
2398
  {
1987
- render: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2399
+ render: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1988
2400
  RichTextEditorControl,
1989
2401
  {
1990
2402
  active,
1991
2403
  className,
1992
2404
  title: "Embed Tweet",
1993
2405
  "aria-label": "Embed Tweet",
1994
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2406
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1995
2407
  "svg",
1996
2408
  {
1997
2409
  xmlns: "http://www.w3.org/2000/svg",
1998
2410
  viewBox: "0 0 24 24",
1999
2411
  fill: "currentColor",
2000
2412
  className: "rte-editor-icon",
2001
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M18.2 3.2h3.3l-7.2 8.2 8.5 11.2h-6.6l-5.2-6.8-6 6.8H2.7l7.7-8.8L2.3 3.2h6.8l4.7 6.2 5.4-6.2zm-1.2 17.3h1.8L7 4.8H5.1l11.9 15.7z" })
2413
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "M18.2 3.2h3.3l-7.2 8.2 8.5 11.2h-6.6l-5.2-6.8-6 6.8H2.7l7.7-8.8L2.3 3.2h6.8l4.7 6.2 5.4-6.2zm-1.2 17.3h1.8L7 4.8H5.1l11.9 15.7z" })
2002
2414
  }
2003
2415
  )
2004
2416
  }
2005
2417
  )
2006
2418
  }
2007
2419
  ),
2008
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(DialogContent, { children: [
2009
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(DialogHeader, { children: [
2010
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DialogTitle, { children: "Embed Tweet" }),
2011
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DialogDescription, { children: "Paste a tweet URL or ID." })
2420
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DialogContent, { children: [
2421
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DialogHeader, { children: [
2422
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DialogTitle, { children: "Embed Tweet" }),
2423
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DialogDescription, { children: "Paste a tweet URL or ID." })
2012
2424
  ] }),
2013
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2425
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2014
2426
  Input,
2015
2427
  {
2016
2428
  value: url,
2017
2429
  onChange: (e) => {
2018
2430
  setUrl(e.target.value);
2019
- if (touched) setTouched(false);
2431
+ if (touched) {
2432
+ setTouched(false);
2433
+ }
2020
2434
  },
2021
2435
  onBlur: () => setTouched(true),
2022
2436
  placeholder: "https://x.com/user/status/...",
2023
2437
  "aria-invalid": showError,
2024
2438
  onKeyDown: (e) => {
2025
- if (e.key === "Enter" && url) {
2026
- if (handleInsert()) {
2027
- setOpen(false);
2028
- }
2439
+ if (e.key === "Enter" && url && handleInsert()) {
2440
+ setOpen(false);
2029
2441
  }
2030
2442
  }
2031
2443
  }
2032
2444
  ),
2033
- showError && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "rte-input-error", role: "alert", children: "That doesn't look like a valid tweet URL or ID." }),
2034
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(DialogFooter, { children: [
2035
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DialogClose, { children: "Cancel" }),
2036
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2445
+ showError && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "rte-input-error", role: "alert", children: "That doesn't look like a valid tweet URL or ID." }),
2446
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DialogFooter, { children: [
2447
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DialogClose, { children: "Cancel" }),
2448
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2037
2449
  "button",
2038
2450
  {
2039
2451
  type: "button",
@@ -2056,9 +2468,9 @@ var TwitterEmbedControl = ({ className }) => {
2056
2468
 
2057
2469
  // src/controls/rte-youtube-control.tsx
2058
2470
  var import_core3 = require("@tiptap/core");
2059
- var import_react14 = require("@tiptap/react");
2060
- var import_react15 = require("react");
2061
- var import_jsx_runtime14 = require("react/jsx-runtime");
2471
+ var import_react17 = require("@tiptap/react");
2472
+ var import_react18 = require("react");
2473
+ var import_jsx_runtime26 = require("react/jsx-runtime");
2062
2474
  var getYouTubeId = (url) => {
2063
2475
  const clean = url.trim();
2064
2476
  const patterns = [
@@ -2086,7 +2498,7 @@ var YouTubeNodeView = (props) => {
2086
2498
  if (videoId) {
2087
2499
  watchUrl = videoId.startsWith("http") ? videoId : `https://www.youtube.com/watch?v=${videoId}`;
2088
2500
  }
2089
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2501
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2090
2502
  ResizableNodeView,
2091
2503
  {
2092
2504
  ...props,
@@ -2097,7 +2509,7 @@ var YouTubeNodeView = (props) => {
2097
2509
  videoSrc: rawSrc,
2098
2510
  watchUrl,
2099
2511
  onSrcChange: (newSrc) => updateAttributes({ src: newSrc }),
2100
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2512
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2101
2513
  "iframe",
2102
2514
  {
2103
2515
  src: `https://www.youtube-nocookie.com/embed/${videoId}`,
@@ -2161,7 +2573,7 @@ var YouTubeEmbed = import_core3.Node.create({
2161
2573
  ];
2162
2574
  },
2163
2575
  addNodeView() {
2164
- return (0, import_react14.ReactNodeViewRenderer)(YouTubeNodeView);
2576
+ return (0, import_react17.ReactNodeViewRenderer)(YouTubeNodeView);
2165
2577
  },
2166
2578
  atom: true,
2167
2579
  draggable: true,
@@ -2185,32 +2597,32 @@ var YouTubeEmbed = import_core3.Node.create({
2185
2597
  });
2186
2598
  var YouTubeEmbedControl = ({ className }) => {
2187
2599
  const { editor } = useRichTextEditorContext();
2188
- const [open, setOpen] = (0, import_react15.useState)(false);
2189
- const [url, setUrl] = (0, import_react15.useState)("");
2190
- const { active } = (0, import_react14.useEditorState)({
2600
+ const [open, setOpen] = (0, import_react18.useState)(false);
2601
+ const [url, setUrl] = (0, import_react18.useState)("");
2602
+ const { active } = (0, import_react17.useEditorState)({
2191
2603
  editor: editor ?? null,
2192
2604
  selector: (ctx) => ({
2193
2605
  active: ctx.editor && !ctx.editor.isDestroyed ? ctx.editor.isActive("youtube") : false
2194
2606
  })
2195
2607
  }) ?? { active: false };
2196
- const handleInsert = (0, import_react15.useCallback)(() => {
2608
+ const handleInsert = (0, import_react18.useCallback)(() => {
2197
2609
  if (url && editor) {
2198
2610
  editor.chain().focus().setYouTubeEmbed(url).run();
2199
2611
  setUrl("");
2200
2612
  }
2201
2613
  }, [url, editor]);
2202
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Dialog, { open, onOpenChange: setOpen, children: [
2203
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2614
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Dialog, { open, onOpenChange: setOpen, children: [
2615
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2204
2616
  DialogTrigger,
2205
2617
  {
2206
- render: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2618
+ render: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2207
2619
  RichTextEditorControl,
2208
2620
  {
2209
2621
  active,
2210
2622
  className,
2211
2623
  title: "Embed YouTube video",
2212
2624
  "aria-label": "Embed YouTube video",
2213
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2625
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
2214
2626
  "svg",
2215
2627
  {
2216
2628
  xmlns: "http://www.w3.org/2000/svg",
@@ -2222,8 +2634,8 @@ var YouTubeEmbedControl = ({ className }) => {
2222
2634
  strokeLinejoin: "round",
2223
2635
  className: "rte-editor-icon",
2224
2636
  children: [
2225
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M23.5 6.2a3 3 0 0 0-2.1-2.1C19.5 3.5 12 3.5 12 3.5s-7.5 0-9.4.6a3 3 0 0 0-2.1 2.1C0 8.1 0 12 0 12s0 3.9.5 5.8a3 3 0 0 0 2.1 2.1c1.9.6 9.4.6 9.4.6s7.5 0 9.4-.6a3 3 0 0 0 2.1-2.1c.5-1.9.5-5.8.5-5.8s0-3.9-.5-5.8z" }),
2226
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M9.5 15.5V8.5l6.2 3.5z" })
2637
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("path", { d: "M23.5 6.2a3 3 0 0 0-2.1-2.1C19.5 3.5 12 3.5 12 3.5s-7.5 0-9.4.6a3 3 0 0 0-2.1 2.1C0 8.1 0 12 0 12s0 3.9.5 5.8a3 3 0 0 0 2.1 2.1c1.9.6 9.4.6 9.4.6s7.5 0 9.4-.6a3 3 0 0 0 2.1-2.1c.5-1.9.5-5.8.5-5.8s0-3.9-.5-5.8z" }),
2638
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("path", { d: "M9.5 15.5V8.5l6.2 3.5z" })
2227
2639
  ]
2228
2640
  }
2229
2641
  )
@@ -2231,12 +2643,12 @@ var YouTubeEmbedControl = ({ className }) => {
2231
2643
  )
2232
2644
  }
2233
2645
  ),
2234
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(DialogContent, { showCloseButton: false, children: [
2235
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(DialogHeader, { children: [
2236
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DialogTitle, { children: "Embed YouTube video" }),
2237
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DialogDescription, { children: "Paste a YouTube video URL or ID." })
2646
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(DialogContent, { showCloseButton: false, children: [
2647
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(DialogHeader, { children: [
2648
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DialogTitle, { children: "Embed YouTube video" }),
2649
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DialogDescription, { children: "Paste a YouTube video URL or ID." })
2238
2650
  ] }),
2239
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2651
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2240
2652
  Input,
2241
2653
  {
2242
2654
  value: url,
@@ -2250,9 +2662,9 @@ var YouTubeEmbedControl = ({ className }) => {
2250
2662
  }
2251
2663
  }
2252
2664
  ),
2253
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(DialogFooter, { children: [
2254
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DialogClose, { children: "Cancel" }),
2255
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2665
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(DialogFooter, { children: [
2666
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DialogClose, { children: "Cancel" }),
2667
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2256
2668
  DialogClose,
2257
2669
  {
2258
2670
  disabled: !url,
@@ -2308,16 +2720,16 @@ var DEFAULT_LABELS = {
2308
2720
  };
2309
2721
 
2310
2722
  // src/rte-content.tsx
2311
- var import_react16 = require("@tiptap/react");
2312
- var import_jsx_runtime15 = require("react/jsx-runtime");
2723
+ var import_react19 = require("@tiptap/react");
2724
+ var import_jsx_runtime27 = require("react/jsx-runtime");
2313
2725
  var Content = ({
2314
2726
  children,
2315
2727
  className
2316
2728
  }) => {
2317
2729
  const { editor } = useRichTextEditorContext();
2318
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "relative", children: [
2319
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2320
- import_react16.EditorContent,
2730
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "relative", children: [
2731
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2732
+ import_react19.EditorContent,
2321
2733
  {
2322
2734
  editor,
2323
2735
  className: cn("rte-content w-full", className)
@@ -2328,15 +2740,15 @@ var Content = ({
2328
2740
  };
2329
2741
 
2330
2742
  // src/rte-controls-group.tsx
2331
- var import_jsx_runtime16 = require("react/jsx-runtime");
2743
+ var import_jsx_runtime28 = require("react/jsx-runtime");
2332
2744
  var ControlsGroup = ({
2333
2745
  children,
2334
2746
  className
2335
- }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: cn("rte-controls-group", className), children });
2747
+ }) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: cn("rte-controls-group", className), children });
2336
2748
 
2337
2749
  // src/rte-footer.tsx
2338
- var import_react17 = require("react");
2339
- var import_jsx_runtime17 = require("react/jsx-runtime");
2750
+ var import_react20 = require("react");
2751
+ var import_jsx_runtime29 = require("react/jsx-runtime");
2340
2752
  var Footer = ({
2341
2753
  children,
2342
2754
  className,
@@ -2347,9 +2759,9 @@ var Footer = ({
2347
2759
  wordCountFormatter
2348
2760
  }) => {
2349
2761
  const { editor, variant } = useRichTextEditorContext();
2350
- const [, forceUpdate] = (0, import_react17.useState)(0);
2351
- const rafRef = (0, import_react17.useRef)(null);
2352
- (0, import_react17.useEffect)(() => {
2762
+ const [, forceUpdate] = (0, import_react20.useState)(0);
2763
+ const rafRef = (0, import_react20.useRef)(null);
2764
+ (0, import_react20.useEffect)(() => {
2353
2765
  if (!editor || !showWordCount) {
2354
2766
  return;
2355
2767
  }
@@ -2378,7 +2790,7 @@ var Footer = ({
2378
2790
  }
2379
2791
  };
2380
2792
  }, [editor, showWordCount]);
2381
- const wordCount = (0, import_react17.useMemo)(() => {
2793
+ const wordCount = (0, import_react20.useMemo)(() => {
2382
2794
  if (!editor || !showWordCount) {
2383
2795
  return null;
2384
2796
  }
@@ -2395,7 +2807,7 @@ var Footer = ({
2395
2807
  if (!showWordCount && !children) {
2396
2808
  return null;
2397
2809
  }
2398
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2810
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
2399
2811
  "div",
2400
2812
  {
2401
2813
  className: cn(
@@ -2407,21 +2819,21 @@ var Footer = ({
2407
2819
  "data-sticky": sticky ? "" : void 0,
2408
2820
  style: sticky ? { bottom: stickyOffset } : void 0,
2409
2821
  children: [
2410
- showWordCount && wordCount && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: cn("rte-footer-word-count", wordCountClassName), children: wordCountFormatter ? wordCountFormatter(wordCount) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
2411
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "rte-footer-word-count-stat", children: [
2412
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rte-footer-word-count-number", children: wordCount.words }),
2413
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rte-footer-word-count-unit", children: "words" })
2822
+ showWordCount && wordCount && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: cn("rte-footer-word-count", wordCountClassName), children: wordCountFormatter ? wordCountFormatter(wordCount) : /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
2823
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "rte-footer-word-count-stat", children: [
2824
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "rte-footer-word-count-number", children: wordCount.words }),
2825
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "rte-footer-word-count-unit", children: "words" })
2414
2826
  ] }),
2415
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2827
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2416
2828
  "span",
2417
2829
  {
2418
2830
  className: "rte-footer-word-count-separator",
2419
2831
  "aria-hidden": "true"
2420
2832
  }
2421
2833
  ),
2422
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "rte-footer-word-count-stat", children: [
2423
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rte-footer-word-count-number", children: wordCount.characters }),
2424
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rte-footer-word-count-unit", children: "characters" })
2834
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "rte-footer-word-count-stat", children: [
2835
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "rte-footer-word-count-number", children: wordCount.characters }),
2836
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "rte-footer-word-count-unit", children: "characters" })
2425
2837
  ] })
2426
2838
  ] }) }),
2427
2839
  children
@@ -2431,7 +2843,7 @@ var Footer = ({
2431
2843
  };
2432
2844
 
2433
2845
  // src/rte-toolbar.tsx
2434
- var import_jsx_runtime18 = require("react/jsx-runtime");
2846
+ var import_jsx_runtime30 = require("react/jsx-runtime");
2435
2847
  var Toolbar = ({
2436
2848
  children,
2437
2849
  className,
@@ -2442,7 +2854,7 @@ var Toolbar = ({
2442
2854
  if (!editable) {
2443
2855
  return null;
2444
2856
  }
2445
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2857
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
2446
2858
  "div",
2447
2859
  {
2448
2860
  className: cn(
@@ -2459,7 +2871,7 @@ var Toolbar = ({
2459
2871
  };
2460
2872
 
2461
2873
  // src/rte-text-editor.tsx
2462
- var import_jsx_runtime19 = require("react/jsx-runtime");
2874
+ var import_jsx_runtime31 = require("react/jsx-runtime");
2463
2875
  var RichTextEditorRoot = ({
2464
2876
  editor,
2465
2877
  children,
@@ -2469,17 +2881,17 @@ var RichTextEditorRoot = ({
2469
2881
  variant = "default",
2470
2882
  editable = true
2471
2883
  }) => {
2472
- const mergedLabels = (0, import_react18.useMemo)(
2884
+ const mergedLabels = (0, import_react21.useMemo)(
2473
2885
  () => ({ ...DEFAULT_LABELS, ...labels }),
2474
2886
  [labels]
2475
2887
  );
2476
- const mergedIcons = (0, import_react18.useMemo)(() => ({ ...DEFAULT_ICONS, ...icons }), [icons]);
2477
- (0, import_react18.useEffect)(() => {
2888
+ const mergedIcons = (0, import_react21.useMemo)(() => ({ ...DEFAULT_ICONS, ...icons }), [icons]);
2889
+ (0, import_react21.useEffect)(() => {
2478
2890
  if (editor && editor.isEditable !== editable) {
2479
2891
  editor.setEditable(editable);
2480
2892
  }
2481
2893
  }, [editor, editable]);
2482
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2894
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2483
2895
  RichTextEditorContext.Provider,
2484
2896
  {
2485
2897
  value: {
@@ -2489,7 +2901,7 @@ var RichTextEditorRoot = ({
2489
2901
  labels: mergedLabels,
2490
2902
  variant
2491
2903
  },
2492
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2904
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
2493
2905
  "div",
2494
2906
  {
2495
2907
  className: cn(