@editorcn/editor 0.3.2 → 0.3.3
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 +1128 -722
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1119 -713
- package/dist/index.js.map +1 -1
- package/dist/style.css +1362 -1249
- package/package.json +1 -1
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
|
|
47
|
+
var import_react20 = 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
|
|
52
|
+
var import_react6 = require("react");
|
|
53
53
|
|
|
54
|
-
// src/
|
|
55
|
-
var
|
|
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/
|
|
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
|
|
60
|
-
var
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
-
|
|
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");
|
|
@@ -174,9 +691,214 @@ var CODE_BLOCK_LANGUAGE_LABELS = {
|
|
|
174
691
|
};
|
|
175
692
|
var getLanguageLabel = (lang) => CODE_BLOCK_LANGUAGE_LABELS[lang] ?? lang;
|
|
176
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
|
+
|
|
177
883
|
// src/bubble-menu/language-selector.tsx
|
|
178
|
-
var
|
|
179
|
-
|
|
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
|
+
};
|
|
898
|
+
|
|
899
|
+
// src/bubble-menu/language-selector.tsx
|
|
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,
|
|
192
|
-
/* @__PURE__ */ (0,
|
|
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,
|
|
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,
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
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,
|
|
244
|
-
/* @__PURE__ */ (0,
|
|
245
|
-
/* @__PURE__ */ (0,
|
|
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,
|
|
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,
|
|
262
|
-
/* @__PURE__ */ (0,
|
|
263
|
-
|
|
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,
|
|
276
|
-
|
|
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
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
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,
|
|
284
|
-
|
|
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
|
|
987
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
326
988
|
var Svg = ({
|
|
327
989
|
children,
|
|
328
990
|
strokeWidth = 2
|
|
329
|
-
}) => /* @__PURE__ */ (0,
|
|
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,
|
|
347
|
-
/* @__PURE__ */ (0,
|
|
348
|
-
/* @__PURE__ */ (0,
|
|
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,
|
|
355
|
-
/* @__PURE__ */ (0,
|
|
356
|
-
/* @__PURE__ */ (0,
|
|
357
|
-
/* @__PURE__ */ (0,
|
|
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,
|
|
364
|
-
/* @__PURE__ */ (0,
|
|
365
|
-
/* @__PURE__ */ (0,
|
|
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,
|
|
372
|
-
/* @__PURE__ */ (0,
|
|
373
|
-
/* @__PURE__ */ (0,
|
|
374
|
-
/* @__PURE__ */ (0,
|
|
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,
|
|
381
|
-
/* @__PURE__ */ (0,
|
|
382
|
-
/* @__PURE__ */ (0,
|
|
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,
|
|
400
|
-
|
|
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
|
-
|
|
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
|
|
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,
|
|
1084
|
+
const shouldShow = (0, import_react6.useCallback)(
|
|
423
1085
|
({
|
|
424
1086
|
editor: ed,
|
|
425
1087
|
state
|
|
@@ -441,69 +1103,26 @@ var BubbleMenu = ({ editor }) => {
|
|
|
441
1103
|
if (!editor) {
|
|
442
1104
|
return null;
|
|
443
1105
|
}
|
|
444
|
-
const isCodeBlockActive = editorState?.isCodeBlock ?? false;
|
|
445
|
-
return /* @__PURE__ */ (0,
|
|
446
|
-
import_menus.BubbleMenu,
|
|
447
|
-
{
|
|
448
|
-
editor,
|
|
449
|
-
options: { offset: 8, placement: "top" },
|
|
450
|
-
shouldShow,
|
|
451
|
-
children: /* @__PURE__ */ (0,
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
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
|
-
);
|
|
1106
|
+
const isCodeBlockActive = editorState?.isCodeBlock ?? false;
|
|
1107
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1108
|
+
import_menus.BubbleMenu,
|
|
1109
|
+
{
|
|
1110
|
+
editor,
|
|
1111
|
+
options: { offset: 8, placement: "top" },
|
|
1112
|
+
shouldShow,
|
|
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
|
+
] }) })
|
|
1118
|
+
}
|
|
1119
|
+
);
|
|
1120
|
+
};
|
|
504
1121
|
|
|
505
1122
|
// src/controls/rte-control.tsx
|
|
506
|
-
var
|
|
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,
|
|
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,
|
|
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,
|
|
1184
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
566
1185
|
RichTextEditorControl,
|
|
567
1186
|
{
|
|
568
1187
|
active,
|
|
@@ -747,124 +1366,19 @@ var SuperscriptControl = createControl({
|
|
|
747
1366
|
});
|
|
748
1367
|
|
|
749
1368
|
// src/controls/rte-link-control.tsx
|
|
750
|
-
var
|
|
751
|
-
var
|
|
752
|
-
var
|
|
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
|
-
) });
|
|
856
|
-
|
|
857
|
-
// 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,
|
|
862
|
-
const [open, setOpen] = (0,
|
|
863
|
-
const active = (0,
|
|
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,
|
|
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
|
-
|
|
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,
|
|
903
|
-
/* @__PURE__ */ (0,
|
|
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,
|
|
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,
|
|
921
|
-
/* @__PURE__ */ (0,
|
|
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,
|
|
1447
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
934
1448
|
Button,
|
|
935
1449
|
{
|
|
936
1450
|
size: "sm",
|
|
@@ -946,35 +1460,35 @@ var LinkControl = () => {
|
|
|
946
1460
|
|
|
947
1461
|
// src/controls/rte-twitter-control.tsx
|
|
948
1462
|
var import_core2 = require("@tiptap/core");
|
|
949
|
-
var
|
|
950
|
-
var
|
|
1463
|
+
var import_react14 = require("@tiptap/react");
|
|
1464
|
+
var import_react15 = require("react");
|
|
951
1465
|
|
|
952
1466
|
// src/extensions/resizable-node-view.tsx
|
|
953
|
-
var
|
|
954
|
-
var
|
|
1467
|
+
var import_react12 = require("@tiptap/react");
|
|
1468
|
+
var import_react13 = require("react");
|
|
955
1469
|
|
|
956
1470
|
// src/icons.tsx
|
|
957
1471
|
var import_lucide_react = require("lucide-react");
|
|
958
|
-
var
|
|
959
|
-
var
|
|
1472
|
+
var import_react11 = require("react");
|
|
1473
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
960
1474
|
var ALIGN_PATHS = {
|
|
961
|
-
center: /* @__PURE__ */ (0,
|
|
962
|
-
/* @__PURE__ */ (0,
|
|
963
|
-
/* @__PURE__ */ (0,
|
|
964
|
-
/* @__PURE__ */ (0,
|
|
1475
|
+
center: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
1476
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
1477
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "17", y1: "12", x2: "7", y2: "12" }),
|
|
1478
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "19", y1: "18", x2: "5", y2: "18" })
|
|
965
1479
|
] }),
|
|
966
|
-
left: /* @__PURE__ */ (0,
|
|
967
|
-
/* @__PURE__ */ (0,
|
|
968
|
-
/* @__PURE__ */ (0,
|
|
969
|
-
/* @__PURE__ */ (0,
|
|
1480
|
+
left: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
1481
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
1482
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "15", y1: "12", x2: "3", y2: "12" }),
|
|
1483
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "17", y1: "18", x2: "3", y2: "18" })
|
|
970
1484
|
] }),
|
|
971
|
-
right: /* @__PURE__ */ (0,
|
|
972
|
-
/* @__PURE__ */ (0,
|
|
973
|
-
/* @__PURE__ */ (0,
|
|
974
|
-
/* @__PURE__ */ (0,
|
|
1485
|
+
right: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
1486
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
1487
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "21", y1: "12", x2: "9", y2: "12" }),
|
|
1488
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "21", y1: "18", x2: "7", y2: "18" })
|
|
975
1489
|
] })
|
|
976
1490
|
};
|
|
977
|
-
var AlignIcon = ({ dir }) => /* @__PURE__ */ (0,
|
|
1491
|
+
var AlignIcon = ({ dir }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
978
1492
|
"svg",
|
|
979
1493
|
{
|
|
980
1494
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -988,7 +1502,7 @@ var AlignIcon = ({ dir }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
|
988
1502
|
children: ALIGN_PATHS[dir]
|
|
989
1503
|
}
|
|
990
1504
|
);
|
|
991
|
-
var EditUrlIcon = () => /* @__PURE__ */ (0,
|
|
1505
|
+
var EditUrlIcon = () => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
992
1506
|
"svg",
|
|
993
1507
|
{
|
|
994
1508
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1000,12 +1514,12 @@ var EditUrlIcon = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
|
1000
1514
|
strokeLinejoin: "round",
|
|
1001
1515
|
className: "rte-editor-icon",
|
|
1002
1516
|
children: [
|
|
1003
|
-
/* @__PURE__ */ (0,
|
|
1004
|
-
/* @__PURE__ */ (0,
|
|
1517
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M12 20h9" }),
|
|
1518
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z" })
|
|
1005
1519
|
]
|
|
1006
1520
|
}
|
|
1007
1521
|
);
|
|
1008
|
-
var OpenInYouTubeIcon = () => /* @__PURE__ */ (0,
|
|
1522
|
+
var OpenInYouTubeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1009
1523
|
"svg",
|
|
1010
1524
|
{
|
|
1011
1525
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1017,13 +1531,13 @@ var OpenInYouTubeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
|
1017
1531
|
strokeLinejoin: "round",
|
|
1018
1532
|
className: "rte-editor-icon",
|
|
1019
1533
|
children: [
|
|
1020
|
-
/* @__PURE__ */ (0,
|
|
1021
|
-
/* @__PURE__ */ (0,
|
|
1022
|
-
/* @__PURE__ */ (0,
|
|
1534
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }),
|
|
1535
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("polyline", { points: "15 3 21 3 21 9" }),
|
|
1536
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "10", y1: "14", x2: "21", y2: "3" })
|
|
1023
1537
|
]
|
|
1024
1538
|
}
|
|
1025
1539
|
);
|
|
1026
|
-
var DeleteEmbedIcon = () => /* @__PURE__ */ (0,
|
|
1540
|
+
var DeleteEmbedIcon = () => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1027
1541
|
"svg",
|
|
1028
1542
|
{
|
|
1029
1543
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1035,8 +1549,8 @@ var DeleteEmbedIcon = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
|
1035
1549
|
strokeLinejoin: "round",
|
|
1036
1550
|
className: "rte-editor-icon",
|
|
1037
1551
|
children: [
|
|
1038
|
-
/* @__PURE__ */ (0,
|
|
1039
|
-
/* @__PURE__ */ (0,
|
|
1552
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("polyline", { points: "3 6 5 6 21 6" }),
|
|
1553
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.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
1554
|
]
|
|
1041
1555
|
}
|
|
1042
1556
|
);
|
|
@@ -1044,7 +1558,7 @@ var iconProps = { className: "rte-editor-icon" };
|
|
|
1044
1558
|
var LangIcon = ({
|
|
1045
1559
|
children,
|
|
1046
1560
|
className
|
|
1047
|
-
}) => /* @__PURE__ */ (0,
|
|
1561
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1048
1562
|
"svg",
|
|
1049
1563
|
{
|
|
1050
1564
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1059,153 +1573,153 @@ var LangIcon = ({
|
|
|
1059
1573
|
}
|
|
1060
1574
|
);
|
|
1061
1575
|
var DEFAULT_LANGUAGE_ICONS = {
|
|
1062
|
-
bash: /* @__PURE__ */ (0,
|
|
1063
|
-
/* @__PURE__ */ (0,
|
|
1064
|
-
/* @__PURE__ */ (0,
|
|
1065
|
-
/* @__PURE__ */ (0,
|
|
1576
|
+
bash: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1577
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "2.5", y: "4", width: "19", height: "16", rx: "2" }),
|
|
1578
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6.5 9.5l3.5 3-3.5 3" }),
|
|
1579
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M12 15.5h5.5" })
|
|
1066
1580
|
] }),
|
|
1067
|
-
c: /* @__PURE__ */ (0,
|
|
1068
|
-
/* @__PURE__ */ (0,
|
|
1069
|
-
/* @__PURE__ */ (0,
|
|
1581
|
+
c: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1582
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "12", cy: "12", r: "8.5" }),
|
|
1583
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M15.6 9.3a4.5 4.5 0 1 0 0 5.4" })
|
|
1070
1584
|
] }),
|
|
1071
|
-
cpp: /* @__PURE__ */ (0,
|
|
1072
|
-
/* @__PURE__ */ (0,
|
|
1073
|
-
/* @__PURE__ */ (0,
|
|
1074
|
-
/* @__PURE__ */ (0,
|
|
1075
|
-
/* @__PURE__ */ (0,
|
|
1585
|
+
cpp: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1586
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "9.5", cy: "12", r: "6.5" }),
|
|
1587
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M12.3 9.7a3.3 3.3 0 1 0 0 4.6" }),
|
|
1588
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M15.7 10.5v3M14.2 12h3" }),
|
|
1589
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M19.3 10.5v3M17.8 12h3" })
|
|
1076
1590
|
] }),
|
|
1077
|
-
css: /* @__PURE__ */ (0,
|
|
1078
|
-
/* @__PURE__ */ (0,
|
|
1079
|
-
/* @__PURE__ */ (0,
|
|
1080
|
-
/* @__PURE__ */ (0,
|
|
1081
|
-
/* @__PURE__ */ (0,
|
|
1082
|
-
/* @__PURE__ */ (0,
|
|
1591
|
+
css: /* @__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: "M9.7 7.5l-1 9" }),
|
|
1594
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M15.3 7.5l-1 9" }),
|
|
1595
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M7 10.3h11" }),
|
|
1596
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6.5 14.3h11" })
|
|
1083
1597
|
] }),
|
|
1084
|
-
go: /* @__PURE__ */ (0,
|
|
1085
|
-
/* @__PURE__ */ (0,
|
|
1086
|
-
/* @__PURE__ */ (0,
|
|
1087
|
-
/* @__PURE__ */ (0,
|
|
1088
|
-
/* @__PURE__ */ (0,
|
|
1598
|
+
go: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1599
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1600
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M12.6 9.7A3.3 3.3 0 1 0 12.6 14.3" }),
|
|
1601
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M12.6 12h-1.9" }),
|
|
1602
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "17", cy: "12", r: "2.9" })
|
|
1089
1603
|
] }),
|
|
1090
|
-
html: /* @__PURE__ */ (0,
|
|
1091
|
-
/* @__PURE__ */ (0,
|
|
1092
|
-
/* @__PURE__ */ (0,
|
|
1093
|
-
/* @__PURE__ */ (0,
|
|
1094
|
-
/* @__PURE__ */ (0,
|
|
1604
|
+
html: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1605
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1606
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M9.5 8.5L6.5 12l3 3.5" }),
|
|
1607
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M14.5 8.5L17.5 12l-3 3.5" }),
|
|
1608
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M13 7.3l-2 9.4" })
|
|
1095
1609
|
] }),
|
|
1096
|
-
java: /* @__PURE__ */ (0,
|
|
1097
|
-
/* @__PURE__ */ (0,
|
|
1098
|
-
/* @__PURE__ */ (0,
|
|
1099
|
-
/* @__PURE__ */ (0,
|
|
1100
|
-
/* @__PURE__ */ (0,
|
|
1610
|
+
java: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1611
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6 10h10v5a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3v-5z" }),
|
|
1612
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M16 12h1.3a1.8 1.8 0 0 1 0 3.6H16" }),
|
|
1613
|
+
/* @__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" }),
|
|
1614
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6 19.3h10" })
|
|
1101
1615
|
] }),
|
|
1102
|
-
javascript: /* @__PURE__ */ (0,
|
|
1103
|
-
/* @__PURE__ */ (0,
|
|
1104
|
-
/* @__PURE__ */ (0,
|
|
1105
|
-
/* @__PURE__ */ (0,
|
|
1616
|
+
javascript: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1617
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1618
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M10.5 8v6.5a2 2 0 0 1-3.5 1.3" }),
|
|
1619
|
+
/* @__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" })
|
|
1106
1620
|
] }),
|
|
1107
|
-
json: /* @__PURE__ */ (0,
|
|
1108
|
-
/* @__PURE__ */ (0,
|
|
1109
|
-
/* @__PURE__ */ (0,
|
|
1621
|
+
json: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1622
|
+
/* @__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" }),
|
|
1623
|
+
/* @__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" })
|
|
1110
1624
|
] }),
|
|
1111
|
-
kotlin: /* @__PURE__ */ (0,
|
|
1112
|
-
/* @__PURE__ */ (0,
|
|
1113
|
-
/* @__PURE__ */ (0,
|
|
1114
|
-
/* @__PURE__ */ (0,
|
|
1115
|
-
/* @__PURE__ */ (0,
|
|
1625
|
+
kotlin: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1626
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1627
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M9 7.5v9" }),
|
|
1628
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M9 12l6-4.5" }),
|
|
1629
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M9 12l6 4.5" })
|
|
1116
1630
|
] }),
|
|
1117
|
-
markdown: /* @__PURE__ */ (0,
|
|
1118
|
-
/* @__PURE__ */ (0,
|
|
1119
|
-
/* @__PURE__ */ (0,
|
|
1120
|
-
/* @__PURE__ */ (0,
|
|
1121
|
-
/* @__PURE__ */ (0,
|
|
1631
|
+
markdown: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1632
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "2", y: "5", width: "20", height: "14", rx: "2" }),
|
|
1633
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6 15V9l3 4 3-4v6" }),
|
|
1634
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M16.5 9v6" }),
|
|
1635
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M14.5 13l2 2 2-2" })
|
|
1122
1636
|
] }),
|
|
1123
|
-
php: /* @__PURE__ */ (0,
|
|
1124
|
-
/* @__PURE__ */ (0,
|
|
1125
|
-
/* @__PURE__ */ (0,
|
|
1126
|
-
/* @__PURE__ */ (0,
|
|
1127
|
-
/* @__PURE__ */ (0,
|
|
1637
|
+
php: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1638
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1639
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M11.5 8.5L7.5 12l4 3.5" }),
|
|
1640
|
+
/* @__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" }),
|
|
1641
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "14.3", cy: "16.2", r: ".5", fill: "currentColor", stroke: "none" })
|
|
1128
1642
|
] }),
|
|
1129
|
-
plaintext: /* @__PURE__ */ (0,
|
|
1130
|
-
/* @__PURE__ */ (0,
|
|
1131
|
-
/* @__PURE__ */ (0,
|
|
1132
|
-
/* @__PURE__ */ (0,
|
|
1133
|
-
/* @__PURE__ */ (0,
|
|
1643
|
+
plaintext: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1644
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "4", y: "2.5", width: "16", height: "19", rx: "2" }),
|
|
1645
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "7.5", y1: "7.5", x2: "16.5", y2: "7.5" }),
|
|
1646
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "7.5", y1: "11.5", x2: "16.5", y2: "11.5" }),
|
|
1647
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "7.5", y1: "15.5", x2: "13.5", y2: "15.5" })
|
|
1134
1648
|
] }),
|
|
1135
|
-
python: /* @__PURE__ */ (0,
|
|
1136
|
-
/* @__PURE__ */ (0,
|
|
1137
|
-
/* @__PURE__ */ (0,
|
|
1138
|
-
/* @__PURE__ */ (0,
|
|
1139
|
-
/* @__PURE__ */ (0,
|
|
1649
|
+
python: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1650
|
+
/* @__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" }),
|
|
1651
|
+
/* @__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" }),
|
|
1652
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "15.5", cy: "4.3", r: ".55", fill: "currentColor", stroke: "none" }),
|
|
1653
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M17.8 4.5l1.4-.6M17.8 4.9l1.4.6" })
|
|
1140
1654
|
] }),
|
|
1141
|
-
ruby: /* @__PURE__ */ (0,
|
|
1142
|
-
/* @__PURE__ */ (0,
|
|
1143
|
-
/* @__PURE__ */ (0,
|
|
1144
|
-
/* @__PURE__ */ (0,
|
|
1655
|
+
ruby: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1656
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("polygon", { points: "12 2.5 19.5 8 12 21.5 4.5 8" }),
|
|
1657
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M4.5 8h15" }),
|
|
1658
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M12 2.5v19" })
|
|
1145
1659
|
] }),
|
|
1146
|
-
rust: /* @__PURE__ */ (0,
|
|
1147
|
-
/* @__PURE__ */ (0,
|
|
1148
|
-
/* @__PURE__ */ (0,
|
|
1149
|
-
/* @__PURE__ */ (0,
|
|
1150
|
-
/* @__PURE__ */ (0,
|
|
1660
|
+
rust: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1661
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "12", cy: "12", r: "7" }),
|
|
1662
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "12", cy: "12", r: "2.3" }),
|
|
1663
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M12 2.5v3M12 18.5v3M2.5 12h3M18.5 12h3" }),
|
|
1664
|
+
/* @__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" })
|
|
1151
1665
|
] }),
|
|
1152
|
-
sql: /* @__PURE__ */ (0,
|
|
1153
|
-
/* @__PURE__ */ (0,
|
|
1154
|
-
/* @__PURE__ */ (0,
|
|
1155
|
-
/* @__PURE__ */ (0,
|
|
1666
|
+
sql: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1667
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("ellipse", { cx: "12", cy: "6", rx: "8", ry: "3" }),
|
|
1668
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M4 6v6c0 1.7 3.6 3 8 3s8-1.3 8-3V6" }),
|
|
1669
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M4 12v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6" })
|
|
1156
1670
|
] }),
|
|
1157
|
-
swift: /* @__PURE__ */ (0,
|
|
1158
|
-
typescript: /* @__PURE__ */ (0,
|
|
1159
|
-
/* @__PURE__ */ (0,
|
|
1160
|
-
/* @__PURE__ */ (0,
|
|
1161
|
-
/* @__PURE__ */ (0,
|
|
1671
|
+
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" }) }),
|
|
1672
|
+
typescript: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1673
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1674
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M7.3 8.2h5M9.8 8.2v7.6" }),
|
|
1675
|
+
/* @__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" })
|
|
1162
1676
|
] }),
|
|
1163
|
-
xml: /* @__PURE__ */ (0,
|
|
1164
|
-
/* @__PURE__ */ (0,
|
|
1165
|
-
/* @__PURE__ */ (0,
|
|
1166
|
-
/* @__PURE__ */ (0,
|
|
1677
|
+
xml: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1678
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M8 7l-4.5 5 4.5 5" }),
|
|
1679
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M16 7l4.5 5-4.5 5" }),
|
|
1680
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M12 8v8" })
|
|
1167
1681
|
] }),
|
|
1168
|
-
yaml: /* @__PURE__ */ (0,
|
|
1169
|
-
/* @__PURE__ */ (0,
|
|
1170
|
-
/* @__PURE__ */ (0,
|
|
1171
|
-
/* @__PURE__ */ (0,
|
|
1172
|
-
/* @__PURE__ */ (0,
|
|
1682
|
+
yaml: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1683
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "2.5", y: "3", width: "19", height: "18", rx: "2" }),
|
|
1684
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6.5 8h2M9.5 8h8" }),
|
|
1685
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6.5 12h2M9.5 12h6" }),
|
|
1686
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6.5 16h2M9.5 16h7" })
|
|
1173
1687
|
] })
|
|
1174
1688
|
};
|
|
1175
1689
|
var DEFAULT_ICONS = {
|
|
1176
|
-
alignCenterControlIcon: /* @__PURE__ */ (0,
|
|
1177
|
-
alignJustifyControlIcon: /* @__PURE__ */ (0,
|
|
1178
|
-
alignLeftControlIcon: /* @__PURE__ */ (0,
|
|
1179
|
-
alignRightControlIcon: /* @__PURE__ */ (0,
|
|
1180
|
-
blockquoteControlIcon: /* @__PURE__ */ (0,
|
|
1181
|
-
boldControlIcon: /* @__PURE__ */ (0,
|
|
1182
|
-
bulletListControlIcon: /* @__PURE__ */ (0,
|
|
1183
|
-
clearFormattingControlIcon: /* @__PURE__ */ (0,
|
|
1184
|
-
codeBlockControlIcon: /* @__PURE__ */ (0,
|
|
1185
|
-
codeControlIcon: /* @__PURE__ */ (0,
|
|
1186
|
-
h1ControlIcon: /* @__PURE__ */ (0,
|
|
1187
|
-
h2ControlIcon: /* @__PURE__ */ (0,
|
|
1188
|
-
h3ControlIcon: /* @__PURE__ */ (0,
|
|
1189
|
-
h4ControlIcon: /* @__PURE__ */ (0,
|
|
1190
|
-
h5ControlIcon: /* @__PURE__ */ (0,
|
|
1191
|
-
h6ControlIcon: /* @__PURE__ */ (0,
|
|
1192
|
-
highlightControlIcon: /* @__PURE__ */ (0,
|
|
1193
|
-
hrControlIcon: /* @__PURE__ */ (0,
|
|
1194
|
-
italicControlIcon: /* @__PURE__ */ (0,
|
|
1690
|
+
alignCenterControlIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react.TextAlignCenter, { ...iconProps }),
|
|
1691
|
+
alignJustifyControlIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react.TextAlignJustify, { ...iconProps }),
|
|
1692
|
+
alignLeftControlIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react.TextAlignStart, { ...iconProps }),
|
|
1693
|
+
alignRightControlIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react.TextAlignEnd, { ...iconProps }),
|
|
1694
|
+
blockquoteControlIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react.TextQuote, { ...iconProps }),
|
|
1695
|
+
boldControlIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react.Bold, { ...iconProps }),
|
|
1696
|
+
bulletListControlIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react.List, { ...iconProps }),
|
|
1697
|
+
clearFormattingControlIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react.RemoveFormatting, { ...iconProps }),
|
|
1698
|
+
codeBlockControlIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react.SquareCode, { ...iconProps }),
|
|
1699
|
+
codeControlIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react.Code, { ...iconProps }),
|
|
1700
|
+
h1ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react.Heading1, { ...iconProps }),
|
|
1701
|
+
h2ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react.Heading2, { ...iconProps }),
|
|
1702
|
+
h3ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react.Heading3, { ...iconProps }),
|
|
1703
|
+
h4ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react.Heading4, { ...iconProps }),
|
|
1704
|
+
h5ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react.Heading5, { ...iconProps }),
|
|
1705
|
+
h6ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react.Heading6, { ...iconProps }),
|
|
1706
|
+
highlightControlIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react.Highlighter, { ...iconProps }),
|
|
1707
|
+
hrControlIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react.Minus, { ...iconProps }),
|
|
1708
|
+
italicControlIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react.Italic, { ...iconProps }),
|
|
1195
1709
|
languageIcons: DEFAULT_LANGUAGE_ICONS,
|
|
1196
|
-
linkControlIcon: /* @__PURE__ */ (0,
|
|
1197
|
-
orderedListControlIcon: /* @__PURE__ */ (0,
|
|
1198
|
-
redoControlIcon: /* @__PURE__ */ (0,
|
|
1199
|
-
strikeControlIcon: /* @__PURE__ */ (0,
|
|
1200
|
-
subscriptControlIcon: /* @__PURE__ */ (0,
|
|
1201
|
-
superscriptControlIcon: /* @__PURE__ */ (0,
|
|
1202
|
-
underlineControlIcon: /* @__PURE__ */ (0,
|
|
1203
|
-
undoControlIcon: /* @__PURE__ */ (0,
|
|
1204
|
-
unlinkControlIcon: /* @__PURE__ */ (0,
|
|
1710
|
+
linkControlIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react.Link, { ...iconProps }),
|
|
1711
|
+
orderedListControlIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react.ListOrdered, { ...iconProps }),
|
|
1712
|
+
redoControlIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react.Redo2, { ...iconProps }),
|
|
1713
|
+
strikeControlIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react.Strikethrough, { ...iconProps }),
|
|
1714
|
+
subscriptControlIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react.Subscript, { ...iconProps }),
|
|
1715
|
+
superscriptControlIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react.Superscript, { ...iconProps }),
|
|
1716
|
+
underlineControlIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react.Underline, { ...iconProps }),
|
|
1717
|
+
undoControlIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react.Undo2, { ...iconProps }),
|
|
1718
|
+
unlinkControlIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react.Link2Off, { ...iconProps })
|
|
1205
1719
|
};
|
|
1206
1720
|
|
|
1207
1721
|
// src/extensions/resizable-node-view.tsx
|
|
1208
|
-
var
|
|
1722
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1209
1723
|
var EmbedToolbar = ({
|
|
1210
1724
|
align,
|
|
1211
1725
|
videoSrc,
|
|
@@ -1222,8 +1736,8 @@ var EmbedToolbar = ({
|
|
|
1222
1736
|
nodeSrc
|
|
1223
1737
|
}) => {
|
|
1224
1738
|
if (isEditingUrl) {
|
|
1225
|
-
return /* @__PURE__ */ (0,
|
|
1226
|
-
/* @__PURE__ */ (0,
|
|
1739
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "rte-embed-selector-edit-form", children: [
|
|
1740
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1227
1741
|
"input",
|
|
1228
1742
|
{
|
|
1229
1743
|
ref: inputRef,
|
|
@@ -1241,7 +1755,7 @@ var EmbedToolbar = ({
|
|
|
1241
1755
|
}
|
|
1242
1756
|
}
|
|
1243
1757
|
),
|
|
1244
|
-
/* @__PURE__ */ (0,
|
|
1758
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1245
1759
|
"button",
|
|
1246
1760
|
{
|
|
1247
1761
|
type: "button",
|
|
@@ -1250,7 +1764,7 @@ var EmbedToolbar = ({
|
|
|
1250
1764
|
children: "Save"
|
|
1251
1765
|
}
|
|
1252
1766
|
),
|
|
1253
|
-
/* @__PURE__ */ (0,
|
|
1767
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1254
1768
|
"button",
|
|
1255
1769
|
{
|
|
1256
1770
|
type: "button",
|
|
@@ -1261,8 +1775,8 @@ var EmbedToolbar = ({
|
|
|
1261
1775
|
)
|
|
1262
1776
|
] });
|
|
1263
1777
|
}
|
|
1264
|
-
return /* @__PURE__ */ (0,
|
|
1265
|
-
/* @__PURE__ */ (0,
|
|
1778
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
1779
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "rte-embed-selector-group", children: ["left", "center", "right"].map((dir) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1266
1780
|
"button",
|
|
1267
1781
|
{
|
|
1268
1782
|
type: "button",
|
|
@@ -1270,12 +1784,12 @@ var EmbedToolbar = ({
|
|
|
1270
1784
|
"aria-label": `Align ${dir.charAt(0).toUpperCase()}${dir.slice(1)}`,
|
|
1271
1785
|
className: `rte-embed-selector-btn ${align === dir ? "rte-embed-selector-btn--active" : ""}`,
|
|
1272
1786
|
onClick: () => updateAttributes({ align: dir }),
|
|
1273
|
-
children: /* @__PURE__ */ (0,
|
|
1787
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AlignIcon, { dir })
|
|
1274
1788
|
},
|
|
1275
1789
|
dir
|
|
1276
1790
|
)) }),
|
|
1277
|
-
/* @__PURE__ */ (0,
|
|
1278
|
-
/* @__PURE__ */ (0,
|
|
1791
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "rte-embed-selector-divider" }),
|
|
1792
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "rte-embed-selector-group", children: [25, 50, 75, 100].map((pct) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
1279
1793
|
"button",
|
|
1280
1794
|
{
|
|
1281
1795
|
type: "button",
|
|
@@ -1289,9 +1803,9 @@ var EmbedToolbar = ({
|
|
|
1289
1803
|
},
|
|
1290
1804
|
pct
|
|
1291
1805
|
)) }),
|
|
1292
|
-
/* @__PURE__ */ (0,
|
|
1293
|
-
/* @__PURE__ */ (0,
|
|
1294
|
-
(videoSrc || nodeSrc) && /* @__PURE__ */ (0,
|
|
1806
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "rte-embed-selector-divider" }),
|
|
1807
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "rte-embed-selector-group", children: [
|
|
1808
|
+
(videoSrc || nodeSrc) && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1295
1809
|
"button",
|
|
1296
1810
|
{
|
|
1297
1811
|
type: "button",
|
|
@@ -1302,10 +1816,10 @@ var EmbedToolbar = ({
|
|
|
1302
1816
|
setUrlInput(videoSrc || nodeSrc || "");
|
|
1303
1817
|
setIsEditingUrl(true);
|
|
1304
1818
|
},
|
|
1305
|
-
children: /* @__PURE__ */ (0,
|
|
1819
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(EditUrlIcon, {})
|
|
1306
1820
|
}
|
|
1307
1821
|
),
|
|
1308
|
-
watchUrl && /* @__PURE__ */ (0,
|
|
1822
|
+
watchUrl && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1309
1823
|
"button",
|
|
1310
1824
|
{
|
|
1311
1825
|
type: "button",
|
|
@@ -1313,10 +1827,10 @@ var EmbedToolbar = ({
|
|
|
1313
1827
|
"aria-label": "Open video in YouTube",
|
|
1314
1828
|
className: "rte-embed-selector-btn",
|
|
1315
1829
|
onClick: () => window.open(watchUrl, "_blank"),
|
|
1316
|
-
children: /* @__PURE__ */ (0,
|
|
1830
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(OpenInYouTubeIcon, {})
|
|
1317
1831
|
}
|
|
1318
1832
|
),
|
|
1319
|
-
deleteNode && /* @__PURE__ */ (0,
|
|
1833
|
+
deleteNode && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1320
1834
|
"button",
|
|
1321
1835
|
{
|
|
1322
1836
|
type: "button",
|
|
@@ -1324,7 +1838,7 @@ var EmbedToolbar = ({
|
|
|
1324
1838
|
"aria-label": "Delete Embed",
|
|
1325
1839
|
className: "rte-embed-selector-btn rte-embed-selector-btn--danger",
|
|
1326
1840
|
onClick: () => deleteNode(),
|
|
1327
|
-
children: /* @__PURE__ */ (0,
|
|
1841
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DeleteEmbedIcon, {})
|
|
1328
1842
|
}
|
|
1329
1843
|
)
|
|
1330
1844
|
] })
|
|
@@ -1346,26 +1860,26 @@ var ResizableNodeView = ({
|
|
|
1346
1860
|
watchUrl,
|
|
1347
1861
|
onSrcChange
|
|
1348
1862
|
}) => {
|
|
1349
|
-
const containerRef = (0,
|
|
1350
|
-
const [isEditingUrl, setIsEditingUrl] = (0,
|
|
1351
|
-
const [urlInput, setUrlInput] = (0,
|
|
1352
|
-
const [isResizing, setIsResizing] = (0,
|
|
1353
|
-
const [currentDimensions, setCurrentDimensions] = (0,
|
|
1354
|
-
const resizingRef = (0,
|
|
1863
|
+
const containerRef = (0, import_react13.useRef)(null);
|
|
1864
|
+
const [isEditingUrl, setIsEditingUrl] = (0, import_react13.useState)(false);
|
|
1865
|
+
const [urlInput, setUrlInput] = (0, import_react13.useState)(videoSrc || "");
|
|
1866
|
+
const [isResizing, setIsResizing] = (0, import_react13.useState)(false);
|
|
1867
|
+
const [currentDimensions, setCurrentDimensions] = (0, import_react13.useState)(null);
|
|
1868
|
+
const resizingRef = (0, import_react13.useRef)(null);
|
|
1355
1869
|
const width = node.attrs.width;
|
|
1356
1870
|
const height = node.attrs.height;
|
|
1357
1871
|
const align = node.attrs.align || "center";
|
|
1358
|
-
const getEditorWidth = (0,
|
|
1872
|
+
const getEditorWidth = (0, import_react13.useCallback)(
|
|
1359
1873
|
() => view?.dom?.parentElement?.offsetWidth ?? 800,
|
|
1360
1874
|
[view]
|
|
1361
1875
|
);
|
|
1362
|
-
const inputRef = (0,
|
|
1363
|
-
(0,
|
|
1876
|
+
const inputRef = (0, import_react13.useRef)(null);
|
|
1877
|
+
(0, import_react13.useEffect)(() => {
|
|
1364
1878
|
if (isEditingUrl) {
|
|
1365
1879
|
inputRef.current?.focus();
|
|
1366
1880
|
}
|
|
1367
1881
|
}, [isEditingUrl]);
|
|
1368
|
-
const handleMouseMove = (0,
|
|
1882
|
+
const handleMouseMove = (0, import_react13.useCallback)(
|
|
1369
1883
|
(e) => {
|
|
1370
1884
|
const resize = resizingRef.current;
|
|
1371
1885
|
if (!resize) {
|
|
@@ -1415,7 +1929,7 @@ var ResizableNodeView = ({
|
|
|
1415
1929
|
},
|
|
1416
1930
|
[lockAspect, aspectRatio, minWidth, maxWidth]
|
|
1417
1931
|
);
|
|
1418
|
-
const handleMouseUp = (0,
|
|
1932
|
+
const handleMouseUp = (0, import_react13.useCallback)(
|
|
1419
1933
|
function handleMouseUp2() {
|
|
1420
1934
|
const resize = resizingRef.current;
|
|
1421
1935
|
if (!resize) {
|
|
@@ -1436,7 +1950,7 @@ var ResizableNodeView = ({
|
|
|
1436
1950
|
},
|
|
1437
1951
|
[handleMouseMove, updateAttributes]
|
|
1438
1952
|
);
|
|
1439
|
-
const handleMouseDown = (0,
|
|
1953
|
+
const handleMouseDown = (0, import_react13.useCallback)(
|
|
1440
1954
|
(e, direction) => {
|
|
1441
1955
|
e.preventDefault();
|
|
1442
1956
|
e.stopPropagation();
|
|
@@ -1467,7 +1981,7 @@ var ResizableNodeView = ({
|
|
|
1467
1981
|
},
|
|
1468
1982
|
[width, height, getEditorWidth, handleMouseMove, handleMouseUp]
|
|
1469
1983
|
);
|
|
1470
|
-
(0,
|
|
1984
|
+
(0, import_react13.useEffect)(
|
|
1471
1985
|
() => () => {
|
|
1472
1986
|
document.removeEventListener("mousemove", handleMouseMove);
|
|
1473
1987
|
document.removeEventListener("mouseup", handleMouseUp);
|
|
@@ -1495,13 +2009,13 @@ var ResizableNodeView = ({
|
|
|
1495
2009
|
setIsEditingUrl(false);
|
|
1496
2010
|
};
|
|
1497
2011
|
const isEditable = editor ? editor.isEditable : true;
|
|
1498
|
-
return /* @__PURE__ */ (0,
|
|
1499
|
-
|
|
2012
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2013
|
+
import_react12.NodeViewWrapper,
|
|
1500
2014
|
{
|
|
1501
2015
|
className: "rte-embed-wrapper",
|
|
1502
2016
|
"data-selected": selected || void 0,
|
|
1503
2017
|
"data-align": align,
|
|
1504
|
-
children: /* @__PURE__ */ (0,
|
|
2018
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
1505
2019
|
"div",
|
|
1506
2020
|
{
|
|
1507
2021
|
ref: containerRef,
|
|
@@ -1514,7 +2028,7 @@ var ResizableNodeView = ({
|
|
|
1514
2028
|
},
|
|
1515
2029
|
children: [
|
|
1516
2030
|
children,
|
|
1517
|
-
selected && isEditable && /* @__PURE__ */ (0,
|
|
2031
|
+
selected && isEditable && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "rte-embed-selector", contentEditable: false, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1518
2032
|
EmbedToolbar,
|
|
1519
2033
|
{
|
|
1520
2034
|
align,
|
|
@@ -1532,14 +2046,14 @@ var ResizableNodeView = ({
|
|
|
1532
2046
|
nodeSrc: node.attrs.src
|
|
1533
2047
|
}
|
|
1534
2048
|
) }),
|
|
1535
|
-
isResizing && currentDimensions && /* @__PURE__ */ (0,
|
|
2049
|
+
isResizing && currentDimensions && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "rte-embed-resize-badge", children: [
|
|
1536
2050
|
currentDimensions.w,
|
|
1537
2051
|
" \xD7 ",
|
|
1538
2052
|
currentDimensions.h,
|
|
1539
2053
|
" px"
|
|
1540
2054
|
] }),
|
|
1541
|
-
selected && isEditable && /* @__PURE__ */ (0,
|
|
1542
|
-
/* @__PURE__ */ (0,
|
|
2055
|
+
selected && isEditable && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
2056
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1543
2057
|
"div",
|
|
1544
2058
|
{
|
|
1545
2059
|
className: "rte-resize-handle rte-resize-handle--left",
|
|
@@ -1547,7 +2061,7 @@ var ResizableNodeView = ({
|
|
|
1547
2061
|
role: "presentation"
|
|
1548
2062
|
}
|
|
1549
2063
|
),
|
|
1550
|
-
/* @__PURE__ */ (0,
|
|
2064
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1551
2065
|
"div",
|
|
1552
2066
|
{
|
|
1553
2067
|
className: "rte-resize-handle rte-resize-handle--right",
|
|
@@ -1555,7 +2069,7 @@ var ResizableNodeView = ({
|
|
|
1555
2069
|
role: "presentation"
|
|
1556
2070
|
}
|
|
1557
2071
|
),
|
|
1558
|
-
/* @__PURE__ */ (0,
|
|
2072
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1559
2073
|
"div",
|
|
1560
2074
|
{
|
|
1561
2075
|
className: "rte-resize-handle rte-resize-handle--bottom",
|
|
@@ -1563,7 +2077,7 @@ var ResizableNodeView = ({
|
|
|
1563
2077
|
role: "presentation"
|
|
1564
2078
|
}
|
|
1565
2079
|
),
|
|
1566
|
-
/* @__PURE__ */ (0,
|
|
2080
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1567
2081
|
"div",
|
|
1568
2082
|
{
|
|
1569
2083
|
className: "rte-resize-handle rte-resize-handle--corner rte-resize-handle--corner-bl",
|
|
@@ -1571,7 +2085,7 @@ var ResizableNodeView = ({
|
|
|
1571
2085
|
role: "presentation"
|
|
1572
2086
|
}
|
|
1573
2087
|
),
|
|
1574
|
-
/* @__PURE__ */ (0,
|
|
2088
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1575
2089
|
"div",
|
|
1576
2090
|
{
|
|
1577
2091
|
className: "rte-resize-handle rte-resize-handle--corner rte-resize-handle--corner-br",
|
|
@@ -1587,121 +2101,8 @@ var ResizableNodeView = ({
|
|
|
1587
2101
|
);
|
|
1588
2102
|
};
|
|
1589
2103
|
|
|
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
2104
|
// src/controls/rte-twitter-control.tsx
|
|
1704
|
-
var
|
|
2105
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1705
2106
|
var WIDGET_SCRIPT_URL = "https://platform.twitter.com/widgets.js";
|
|
1706
2107
|
var SCRIPT_LOAD_TIMEOUT_MS = 8e3;
|
|
1707
2108
|
var READY_POLL_INTERVAL_MS = 50;
|
|
@@ -1728,18 +2129,23 @@ var loadTwitterScript = () => {
|
|
|
1728
2129
|
document.body.append(script);
|
|
1729
2130
|
}
|
|
1730
2131
|
let settled = false;
|
|
2132
|
+
const timers = {};
|
|
1731
2133
|
const cleanup = () => {
|
|
1732
|
-
clearInterval(
|
|
1733
|
-
clearTimeout(
|
|
2134
|
+
clearInterval(timers.poll);
|
|
2135
|
+
clearTimeout(timers.timeout);
|
|
1734
2136
|
};
|
|
1735
2137
|
const succeed = () => {
|
|
1736
|
-
if (settled)
|
|
2138
|
+
if (settled) {
|
|
2139
|
+
return;
|
|
2140
|
+
}
|
|
1737
2141
|
settled = true;
|
|
1738
2142
|
cleanup();
|
|
1739
2143
|
resolve();
|
|
1740
2144
|
};
|
|
1741
2145
|
const fail = () => {
|
|
1742
|
-
if (settled)
|
|
2146
|
+
if (settled) {
|
|
2147
|
+
return;
|
|
2148
|
+
}
|
|
1743
2149
|
settled = true;
|
|
1744
2150
|
cleanup();
|
|
1745
2151
|
twitterScriptPromise = null;
|
|
@@ -1749,12 +2155,12 @@ var loadTwitterScript = () => {
|
|
|
1749
2155
|
succeed();
|
|
1750
2156
|
return;
|
|
1751
2157
|
}
|
|
1752
|
-
|
|
2158
|
+
timers.poll = setInterval(() => {
|
|
1753
2159
|
if (window.twttr?.widgets) {
|
|
1754
2160
|
succeed();
|
|
1755
2161
|
}
|
|
1756
2162
|
}, READY_POLL_INTERVAL_MS);
|
|
1757
|
-
|
|
2163
|
+
timers.timeout = setTimeout(fail, SCRIPT_LOAD_TIMEOUT_MS);
|
|
1758
2164
|
if (isNewScript) {
|
|
1759
2165
|
script.addEventListener(
|
|
1760
2166
|
"load",
|
|
@@ -1772,15 +2178,15 @@ var loadTwitterScript = () => {
|
|
|
1772
2178
|
};
|
|
1773
2179
|
var TwitterNodeView = (props) => {
|
|
1774
2180
|
const { node } = props;
|
|
1775
|
-
const containerRef = (0,
|
|
1776
|
-
const [loading, setLoading] = (0,
|
|
1777
|
-
const [failed, setFailed] = (0,
|
|
2181
|
+
const containerRef = (0, import_react15.useRef)(null);
|
|
2182
|
+
const [loading, setLoading] = (0, import_react15.useState)(true);
|
|
2183
|
+
const [failed, setFailed] = (0, import_react15.useState)(false);
|
|
1778
2184
|
const { tweetId } = node.attrs;
|
|
1779
|
-
const renderedTweetIdRef = (0,
|
|
1780
|
-
const activeRenderIdRef = (0,
|
|
1781
|
-
const retryToken = (0,
|
|
1782
|
-
const [retryCount, setRetryCount] = (0,
|
|
1783
|
-
(0,
|
|
2185
|
+
const renderedTweetIdRef = (0, import_react15.useRef)(null);
|
|
2186
|
+
const activeRenderIdRef = (0, import_react15.useRef)(0);
|
|
2187
|
+
const retryToken = (0, import_react15.useRef)(0);
|
|
2188
|
+
const [retryCount, setRetryCount] = (0, import_react15.useState)(0);
|
|
2189
|
+
(0, import_react15.useEffect)(() => {
|
|
1784
2190
|
if (!containerRef.current || !tweetId) {
|
|
1785
2191
|
return;
|
|
1786
2192
|
}
|
|
@@ -1839,11 +2245,11 @@ var TwitterNodeView = (props) => {
|
|
|
1839
2245
|
isCancelled = true;
|
|
1840
2246
|
};
|
|
1841
2247
|
}, [tweetId, retryCount, failed]);
|
|
1842
|
-
const handleRetry = (0,
|
|
2248
|
+
const handleRetry = (0, import_react15.useCallback)(() => {
|
|
1843
2249
|
retryToken.current += 1;
|
|
1844
2250
|
setRetryCount(retryToken.current);
|
|
1845
2251
|
}, []);
|
|
1846
|
-
return /* @__PURE__ */ (0,
|
|
2252
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
1847
2253
|
ResizableNodeView,
|
|
1848
2254
|
{
|
|
1849
2255
|
...props,
|
|
@@ -1851,12 +2257,12 @@ var TwitterNodeView = (props) => {
|
|
|
1851
2257
|
minWidth: 300,
|
|
1852
2258
|
maxWidth: 1200,
|
|
1853
2259
|
children: [
|
|
1854
|
-
loading && /* @__PURE__ */ (0,
|
|
1855
|
-
!loading && failed && /* @__PURE__ */ (0,
|
|
1856
|
-
/* @__PURE__ */ (0,
|
|
1857
|
-
/* @__PURE__ */ (0,
|
|
2260
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "rte-embed-loading", children: "Loading tweet..." }),
|
|
2261
|
+
!loading && failed && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "rte-embed-error", children: [
|
|
2262
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { children: "Couldn't load this tweet." }),
|
|
2263
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", onClick: handleRetry, children: "Retry" })
|
|
1858
2264
|
] }),
|
|
1859
|
-
/* @__PURE__ */ (0,
|
|
2265
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { ref: containerRef })
|
|
1860
2266
|
]
|
|
1861
2267
|
}
|
|
1862
2268
|
);
|
|
@@ -1912,7 +2318,7 @@ var TwitterEmbed = import_core2.Node.create({
|
|
|
1912
2318
|
];
|
|
1913
2319
|
},
|
|
1914
2320
|
addNodeView() {
|
|
1915
|
-
return (0,
|
|
2321
|
+
return (0, import_react14.ReactNodeViewRenderer)(TwitterNodeView);
|
|
1916
2322
|
},
|
|
1917
2323
|
atom: true,
|
|
1918
2324
|
draggable: true,
|
|
@@ -1946,10 +2352,10 @@ var extractTweetId = (input) => {
|
|
|
1946
2352
|
};
|
|
1947
2353
|
var TwitterEmbedControl = ({ className }) => {
|
|
1948
2354
|
const { editor } = useRichTextEditorContext();
|
|
1949
|
-
const [open, setOpen] = (0,
|
|
1950
|
-
const [url, setUrl] = (0,
|
|
1951
|
-
const [touched, setTouched] = (0,
|
|
1952
|
-
const { active } = (0,
|
|
2355
|
+
const [open, setOpen] = (0, import_react15.useState)(false);
|
|
2356
|
+
const [url, setUrl] = (0, import_react15.useState)("");
|
|
2357
|
+
const [touched, setTouched] = (0, import_react15.useState)(false);
|
|
2358
|
+
const { active } = (0, import_react14.useEditorState)({
|
|
1953
2359
|
editor: editor ?? null,
|
|
1954
2360
|
selector: (ctx) => ({
|
|
1955
2361
|
active: ctx.editor && !ctx.editor.isDestroyed ? ctx.editor.isActive("twitter") : false
|
|
@@ -1957,11 +2363,11 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
1957
2363
|
}) ?? { active: false };
|
|
1958
2364
|
const tweetId = url ? extractTweetId(url) : null;
|
|
1959
2365
|
const showError = touched && url.length > 0 && !tweetId;
|
|
1960
|
-
const resetState = (0,
|
|
2366
|
+
const resetState = (0, import_react15.useCallback)(() => {
|
|
1961
2367
|
setUrl("");
|
|
1962
2368
|
setTouched(false);
|
|
1963
2369
|
}, []);
|
|
1964
|
-
const handleInsert = (0,
|
|
2370
|
+
const handleInsert = (0, import_react15.useCallback)(() => {
|
|
1965
2371
|
setTouched(true);
|
|
1966
2372
|
if (!tweetId || !editor) {
|
|
1967
2373
|
return false;
|
|
@@ -1970,7 +2376,7 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
1970
2376
|
resetState();
|
|
1971
2377
|
return true;
|
|
1972
2378
|
}, [tweetId, editor, resetState]);
|
|
1973
|
-
return /* @__PURE__ */ (0,
|
|
2379
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
1974
2380
|
Dialog,
|
|
1975
2381
|
{
|
|
1976
2382
|
open,
|
|
@@ -1981,59 +2387,59 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
1981
2387
|
}
|
|
1982
2388
|
},
|
|
1983
2389
|
children: [
|
|
1984
|
-
/* @__PURE__ */ (0,
|
|
2390
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1985
2391
|
DialogTrigger,
|
|
1986
2392
|
{
|
|
1987
|
-
render: /* @__PURE__ */ (0,
|
|
2393
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1988
2394
|
RichTextEditorControl,
|
|
1989
2395
|
{
|
|
1990
2396
|
active,
|
|
1991
2397
|
className,
|
|
1992
2398
|
title: "Embed Tweet",
|
|
1993
2399
|
"aria-label": "Embed Tweet",
|
|
1994
|
-
children: /* @__PURE__ */ (0,
|
|
2400
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1995
2401
|
"svg",
|
|
1996
2402
|
{
|
|
1997
2403
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1998
2404
|
viewBox: "0 0 24 24",
|
|
1999
2405
|
fill: "currentColor",
|
|
2000
2406
|
className: "rte-editor-icon",
|
|
2001
|
-
children: /* @__PURE__ */ (0,
|
|
2407
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.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
2408
|
}
|
|
2003
2409
|
)
|
|
2004
2410
|
}
|
|
2005
2411
|
)
|
|
2006
2412
|
}
|
|
2007
2413
|
),
|
|
2008
|
-
/* @__PURE__ */ (0,
|
|
2009
|
-
/* @__PURE__ */ (0,
|
|
2010
|
-
/* @__PURE__ */ (0,
|
|
2011
|
-
/* @__PURE__ */ (0,
|
|
2414
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(DialogContent, { children: [
|
|
2415
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(DialogHeader, { children: [
|
|
2416
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DialogTitle, { children: "Embed Tweet" }),
|
|
2417
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DialogDescription, { children: "Paste a tweet URL or ID." })
|
|
2012
2418
|
] }),
|
|
2013
|
-
/* @__PURE__ */ (0,
|
|
2419
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2014
2420
|
Input,
|
|
2015
2421
|
{
|
|
2016
2422
|
value: url,
|
|
2017
2423
|
onChange: (e) => {
|
|
2018
2424
|
setUrl(e.target.value);
|
|
2019
|
-
if (touched)
|
|
2425
|
+
if (touched) {
|
|
2426
|
+
setTouched(false);
|
|
2427
|
+
}
|
|
2020
2428
|
},
|
|
2021
2429
|
onBlur: () => setTouched(true),
|
|
2022
2430
|
placeholder: "https://x.com/user/status/...",
|
|
2023
2431
|
"aria-invalid": showError,
|
|
2024
2432
|
onKeyDown: (e) => {
|
|
2025
|
-
if (e.key === "Enter" && url) {
|
|
2026
|
-
|
|
2027
|
-
setOpen(false);
|
|
2028
|
-
}
|
|
2433
|
+
if (e.key === "Enter" && url && handleInsert()) {
|
|
2434
|
+
setOpen(false);
|
|
2029
2435
|
}
|
|
2030
2436
|
}
|
|
2031
2437
|
}
|
|
2032
2438
|
),
|
|
2033
|
-
showError && /* @__PURE__ */ (0,
|
|
2034
|
-
/* @__PURE__ */ (0,
|
|
2035
|
-
/* @__PURE__ */ (0,
|
|
2036
|
-
/* @__PURE__ */ (0,
|
|
2439
|
+
showError && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "rte-input-error", role: "alert", children: "That doesn't look like a valid tweet URL or ID." }),
|
|
2440
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(DialogFooter, { children: [
|
|
2441
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DialogClose, { children: "Cancel" }),
|
|
2442
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2037
2443
|
"button",
|
|
2038
2444
|
{
|
|
2039
2445
|
type: "button",
|
|
@@ -2056,9 +2462,9 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2056
2462
|
|
|
2057
2463
|
// src/controls/rte-youtube-control.tsx
|
|
2058
2464
|
var import_core3 = require("@tiptap/core");
|
|
2059
|
-
var
|
|
2060
|
-
var
|
|
2061
|
-
var
|
|
2465
|
+
var import_react16 = require("@tiptap/react");
|
|
2466
|
+
var import_react17 = require("react");
|
|
2467
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2062
2468
|
var getYouTubeId = (url) => {
|
|
2063
2469
|
const clean = url.trim();
|
|
2064
2470
|
const patterns = [
|
|
@@ -2086,7 +2492,7 @@ var YouTubeNodeView = (props) => {
|
|
|
2086
2492
|
if (videoId) {
|
|
2087
2493
|
watchUrl = videoId.startsWith("http") ? videoId : `https://www.youtube.com/watch?v=${videoId}`;
|
|
2088
2494
|
}
|
|
2089
|
-
return /* @__PURE__ */ (0,
|
|
2495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2090
2496
|
ResizableNodeView,
|
|
2091
2497
|
{
|
|
2092
2498
|
...props,
|
|
@@ -2097,7 +2503,7 @@ var YouTubeNodeView = (props) => {
|
|
|
2097
2503
|
videoSrc: rawSrc,
|
|
2098
2504
|
watchUrl,
|
|
2099
2505
|
onSrcChange: (newSrc) => updateAttributes({ src: newSrc }),
|
|
2100
|
-
children: /* @__PURE__ */ (0,
|
|
2506
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2101
2507
|
"iframe",
|
|
2102
2508
|
{
|
|
2103
2509
|
src: `https://www.youtube-nocookie.com/embed/${videoId}`,
|
|
@@ -2161,7 +2567,7 @@ var YouTubeEmbed = import_core3.Node.create({
|
|
|
2161
2567
|
];
|
|
2162
2568
|
},
|
|
2163
2569
|
addNodeView() {
|
|
2164
|
-
return (0,
|
|
2570
|
+
return (0, import_react16.ReactNodeViewRenderer)(YouTubeNodeView);
|
|
2165
2571
|
},
|
|
2166
2572
|
atom: true,
|
|
2167
2573
|
draggable: true,
|
|
@@ -2185,32 +2591,32 @@ var YouTubeEmbed = import_core3.Node.create({
|
|
|
2185
2591
|
});
|
|
2186
2592
|
var YouTubeEmbedControl = ({ className }) => {
|
|
2187
2593
|
const { editor } = useRichTextEditorContext();
|
|
2188
|
-
const [open, setOpen] = (0,
|
|
2189
|
-
const [url, setUrl] = (0,
|
|
2190
|
-
const { active } = (0,
|
|
2594
|
+
const [open, setOpen] = (0, import_react17.useState)(false);
|
|
2595
|
+
const [url, setUrl] = (0, import_react17.useState)("");
|
|
2596
|
+
const { active } = (0, import_react16.useEditorState)({
|
|
2191
2597
|
editor: editor ?? null,
|
|
2192
2598
|
selector: (ctx) => ({
|
|
2193
2599
|
active: ctx.editor && !ctx.editor.isDestroyed ? ctx.editor.isActive("youtube") : false
|
|
2194
2600
|
})
|
|
2195
2601
|
}) ?? { active: false };
|
|
2196
|
-
const handleInsert = (0,
|
|
2602
|
+
const handleInsert = (0, import_react17.useCallback)(() => {
|
|
2197
2603
|
if (url && editor) {
|
|
2198
2604
|
editor.chain().focus().setYouTubeEmbed(url).run();
|
|
2199
2605
|
setUrl("");
|
|
2200
2606
|
}
|
|
2201
2607
|
}, [url, editor]);
|
|
2202
|
-
return /* @__PURE__ */ (0,
|
|
2203
|
-
/* @__PURE__ */ (0,
|
|
2608
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Dialog, { open, onOpenChange: setOpen, children: [
|
|
2609
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2204
2610
|
DialogTrigger,
|
|
2205
2611
|
{
|
|
2206
|
-
render: /* @__PURE__ */ (0,
|
|
2612
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2207
2613
|
RichTextEditorControl,
|
|
2208
2614
|
{
|
|
2209
2615
|
active,
|
|
2210
2616
|
className,
|
|
2211
2617
|
title: "Embed YouTube video",
|
|
2212
2618
|
"aria-label": "Embed YouTube video",
|
|
2213
|
-
children: /* @__PURE__ */ (0,
|
|
2619
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2214
2620
|
"svg",
|
|
2215
2621
|
{
|
|
2216
2622
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -2222,8 +2628,8 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
2222
2628
|
strokeLinejoin: "round",
|
|
2223
2629
|
className: "rte-editor-icon",
|
|
2224
2630
|
children: [
|
|
2225
|
-
/* @__PURE__ */ (0,
|
|
2226
|
-
/* @__PURE__ */ (0,
|
|
2631
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.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" }),
|
|
2632
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "M9.5 15.5V8.5l6.2 3.5z" })
|
|
2227
2633
|
]
|
|
2228
2634
|
}
|
|
2229
2635
|
)
|
|
@@ -2231,12 +2637,12 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
2231
2637
|
)
|
|
2232
2638
|
}
|
|
2233
2639
|
),
|
|
2234
|
-
/* @__PURE__ */ (0,
|
|
2235
|
-
/* @__PURE__ */ (0,
|
|
2236
|
-
/* @__PURE__ */ (0,
|
|
2237
|
-
/* @__PURE__ */ (0,
|
|
2640
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DialogContent, { showCloseButton: false, children: [
|
|
2641
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DialogHeader, { children: [
|
|
2642
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DialogTitle, { children: "Embed YouTube video" }),
|
|
2643
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DialogDescription, { children: "Paste a YouTube video URL or ID." })
|
|
2238
2644
|
] }),
|
|
2239
|
-
/* @__PURE__ */ (0,
|
|
2645
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2240
2646
|
Input,
|
|
2241
2647
|
{
|
|
2242
2648
|
value: url,
|
|
@@ -2250,9 +2656,9 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
2250
2656
|
}
|
|
2251
2657
|
}
|
|
2252
2658
|
),
|
|
2253
|
-
/* @__PURE__ */ (0,
|
|
2254
|
-
/* @__PURE__ */ (0,
|
|
2255
|
-
/* @__PURE__ */ (0,
|
|
2659
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DialogFooter, { children: [
|
|
2660
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DialogClose, { children: "Cancel" }),
|
|
2661
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2256
2662
|
DialogClose,
|
|
2257
2663
|
{
|
|
2258
2664
|
disabled: !url,
|
|
@@ -2308,16 +2714,16 @@ var DEFAULT_LABELS = {
|
|
|
2308
2714
|
};
|
|
2309
2715
|
|
|
2310
2716
|
// src/rte-content.tsx
|
|
2311
|
-
var
|
|
2312
|
-
var
|
|
2717
|
+
var import_react18 = require("@tiptap/react");
|
|
2718
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2313
2719
|
var Content = ({
|
|
2314
2720
|
children,
|
|
2315
2721
|
className
|
|
2316
2722
|
}) => {
|
|
2317
2723
|
const { editor } = useRichTextEditorContext();
|
|
2318
|
-
return /* @__PURE__ */ (0,
|
|
2319
|
-
/* @__PURE__ */ (0,
|
|
2320
|
-
|
|
2724
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "relative", children: [
|
|
2725
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2726
|
+
import_react18.EditorContent,
|
|
2321
2727
|
{
|
|
2322
2728
|
editor,
|
|
2323
2729
|
className: cn("rte-content w-full", className)
|
|
@@ -2328,15 +2734,15 @@ var Content = ({
|
|
|
2328
2734
|
};
|
|
2329
2735
|
|
|
2330
2736
|
// src/rte-controls-group.tsx
|
|
2331
|
-
var
|
|
2737
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2332
2738
|
var ControlsGroup = ({
|
|
2333
2739
|
children,
|
|
2334
2740
|
className
|
|
2335
|
-
}) => /* @__PURE__ */ (0,
|
|
2741
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: cn("rte-controls-group", className), children });
|
|
2336
2742
|
|
|
2337
2743
|
// src/rte-footer.tsx
|
|
2338
|
-
var
|
|
2339
|
-
var
|
|
2744
|
+
var import_react19 = require("react");
|
|
2745
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2340
2746
|
var Footer = ({
|
|
2341
2747
|
children,
|
|
2342
2748
|
className,
|
|
@@ -2347,9 +2753,9 @@ var Footer = ({
|
|
|
2347
2753
|
wordCountFormatter
|
|
2348
2754
|
}) => {
|
|
2349
2755
|
const { editor, variant } = useRichTextEditorContext();
|
|
2350
|
-
const [, forceUpdate] = (0,
|
|
2351
|
-
const rafRef = (0,
|
|
2352
|
-
(0,
|
|
2756
|
+
const [, forceUpdate] = (0, import_react19.useState)(0);
|
|
2757
|
+
const rafRef = (0, import_react19.useRef)(null);
|
|
2758
|
+
(0, import_react19.useEffect)(() => {
|
|
2353
2759
|
if (!editor || !showWordCount) {
|
|
2354
2760
|
return;
|
|
2355
2761
|
}
|
|
@@ -2378,7 +2784,7 @@ var Footer = ({
|
|
|
2378
2784
|
}
|
|
2379
2785
|
};
|
|
2380
2786
|
}, [editor, showWordCount]);
|
|
2381
|
-
const wordCount = (0,
|
|
2787
|
+
const wordCount = (0, import_react19.useMemo)(() => {
|
|
2382
2788
|
if (!editor || !showWordCount) {
|
|
2383
2789
|
return null;
|
|
2384
2790
|
}
|
|
@@ -2395,7 +2801,7 @@ var Footer = ({
|
|
|
2395
2801
|
if (!showWordCount && !children) {
|
|
2396
2802
|
return null;
|
|
2397
2803
|
}
|
|
2398
|
-
return /* @__PURE__ */ (0,
|
|
2804
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
2399
2805
|
"div",
|
|
2400
2806
|
{
|
|
2401
2807
|
className: cn(
|
|
@@ -2407,21 +2813,21 @@ var Footer = ({
|
|
|
2407
2813
|
"data-sticky": sticky ? "" : void 0,
|
|
2408
2814
|
style: sticky ? { bottom: stickyOffset } : void 0,
|
|
2409
2815
|
children: [
|
|
2410
|
-
showWordCount && wordCount && /* @__PURE__ */ (0,
|
|
2411
|
-
/* @__PURE__ */ (0,
|
|
2412
|
-
/* @__PURE__ */ (0,
|
|
2413
|
-
/* @__PURE__ */ (0,
|
|
2816
|
+
showWordCount && wordCount && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: cn("rte-footer-word-count", wordCountClassName), children: wordCountFormatter ? wordCountFormatter(wordCount) : /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
2817
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "rte-footer-word-count-stat", children: [
|
|
2818
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "rte-footer-word-count-number", children: wordCount.words }),
|
|
2819
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "rte-footer-word-count-unit", children: "words" })
|
|
2414
2820
|
] }),
|
|
2415
|
-
/* @__PURE__ */ (0,
|
|
2821
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2416
2822
|
"span",
|
|
2417
2823
|
{
|
|
2418
2824
|
className: "rte-footer-word-count-separator",
|
|
2419
2825
|
"aria-hidden": "true"
|
|
2420
2826
|
}
|
|
2421
2827
|
),
|
|
2422
|
-
/* @__PURE__ */ (0,
|
|
2423
|
-
/* @__PURE__ */ (0,
|
|
2424
|
-
/* @__PURE__ */ (0,
|
|
2828
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "rte-footer-word-count-stat", children: [
|
|
2829
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "rte-footer-word-count-number", children: wordCount.characters }),
|
|
2830
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "rte-footer-word-count-unit", children: "characters" })
|
|
2425
2831
|
] })
|
|
2426
2832
|
] }) }),
|
|
2427
2833
|
children
|
|
@@ -2431,7 +2837,7 @@ var Footer = ({
|
|
|
2431
2837
|
};
|
|
2432
2838
|
|
|
2433
2839
|
// src/rte-toolbar.tsx
|
|
2434
|
-
var
|
|
2840
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
2435
2841
|
var Toolbar = ({
|
|
2436
2842
|
children,
|
|
2437
2843
|
className,
|
|
@@ -2442,7 +2848,7 @@ var Toolbar = ({
|
|
|
2442
2848
|
if (!editable) {
|
|
2443
2849
|
return null;
|
|
2444
2850
|
}
|
|
2445
|
-
return /* @__PURE__ */ (0,
|
|
2851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2446
2852
|
"div",
|
|
2447
2853
|
{
|
|
2448
2854
|
className: cn(
|
|
@@ -2459,7 +2865,7 @@ var Toolbar = ({
|
|
|
2459
2865
|
};
|
|
2460
2866
|
|
|
2461
2867
|
// src/rte-text-editor.tsx
|
|
2462
|
-
var
|
|
2868
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2463
2869
|
var RichTextEditorRoot = ({
|
|
2464
2870
|
editor,
|
|
2465
2871
|
children,
|
|
@@ -2469,17 +2875,17 @@ var RichTextEditorRoot = ({
|
|
|
2469
2875
|
variant = "default",
|
|
2470
2876
|
editable = true
|
|
2471
2877
|
}) => {
|
|
2472
|
-
const mergedLabels = (0,
|
|
2878
|
+
const mergedLabels = (0, import_react20.useMemo)(
|
|
2473
2879
|
() => ({ ...DEFAULT_LABELS, ...labels }),
|
|
2474
2880
|
[labels]
|
|
2475
2881
|
);
|
|
2476
|
-
const mergedIcons = (0,
|
|
2477
|
-
(0,
|
|
2882
|
+
const mergedIcons = (0, import_react20.useMemo)(() => ({ ...DEFAULT_ICONS, ...icons }), [icons]);
|
|
2883
|
+
(0, import_react20.useEffect)(() => {
|
|
2478
2884
|
if (editor && editor.isEditable !== editable) {
|
|
2479
2885
|
editor.setEditable(editable);
|
|
2480
2886
|
}
|
|
2481
2887
|
}, [editor, editable]);
|
|
2482
|
-
return /* @__PURE__ */ (0,
|
|
2888
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2483
2889
|
RichTextEditorContext.Provider,
|
|
2484
2890
|
{
|
|
2485
2891
|
value: {
|
|
@@ -2489,7 +2895,7 @@ var RichTextEditorRoot = ({
|
|
|
2489
2895
|
labels: mergedLabels,
|
|
2490
2896
|
variant
|
|
2491
2897
|
},
|
|
2492
|
-
children: /* @__PURE__ */ (0,
|
|
2898
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2493
2899
|
"div",
|
|
2494
2900
|
{
|
|
2495
2901
|
className: cn(
|