@editorcn/editor 0.5.2 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/index.cjs +702 -651
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +622 -571
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -42,17 +42,16 @@ __export(index_exports, {
|
|
|
42
42
|
});
|
|
43
43
|
module.exports = __toCommonJS(index_exports);
|
|
44
44
|
|
|
45
|
-
// src/
|
|
46
|
-
var
|
|
45
|
+
// src/rich-text-editor.tsx
|
|
46
|
+
var import_react23 = require("react");
|
|
47
47
|
|
|
48
48
|
// src/bubble-menu/index.tsx
|
|
49
49
|
var import_core = require("@tiptap/core");
|
|
50
50
|
var import_menus = require("@tiptap/react/menus");
|
|
51
|
-
var
|
|
51
|
+
var import_react4 = require("react");
|
|
52
52
|
|
|
53
53
|
// src/ui/button.tsx
|
|
54
|
-
var
|
|
55
|
-
var import_class_variance_authority = require("class-variance-authority");
|
|
54
|
+
var React = __toESM(require("react"), 1);
|
|
56
55
|
|
|
57
56
|
// src/ui/utils.ts
|
|
58
57
|
var import_clsx = require("clsx");
|
|
@@ -61,238 +60,23 @@ var cn = (...inputs) => (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)
|
|
|
61
60
|
|
|
62
61
|
// src/ui/button.tsx
|
|
63
62
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
64
|
-
var
|
|
65
|
-
"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",
|
|
66
|
-
{
|
|
67
|
-
defaultVariants: {
|
|
68
|
-
size: "default",
|
|
69
|
-
variant: "default"
|
|
70
|
-
},
|
|
71
|
-
variants: {
|
|
72
|
-
size: {
|
|
73
|
-
default: "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
74
|
-
icon: "size-8",
|
|
75
|
-
"icon-lg": "size-9",
|
|
76
|
-
"icon-sm": "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
|
|
77
|
-
"icon-xs": "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
|
|
78
|
-
lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
79
|
-
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",
|
|
80
|
-
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"
|
|
81
|
-
},
|
|
82
|
-
variant: {
|
|
83
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
84
|
-
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",
|
|
85
|
-
ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
|
|
86
|
-
link: "text-primary underline-offset-4 hover:underline",
|
|
87
|
-
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",
|
|
88
|
-
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"
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
);
|
|
93
|
-
var Button = ({
|
|
94
|
-
className,
|
|
95
|
-
variant = "default",
|
|
96
|
-
size = "default",
|
|
97
|
-
...props
|
|
98
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
99
|
-
import_button.Button,
|
|
100
|
-
{
|
|
101
|
-
"data-slot": "button",
|
|
102
|
-
className: cn(buttonVariants({ className, size, variant })),
|
|
103
|
-
...props
|
|
104
|
-
}
|
|
105
|
-
);
|
|
106
|
-
|
|
107
|
-
// src/ui/dialog.tsx
|
|
108
|
-
var import_dialog = require("@base-ui/react/dialog");
|
|
109
|
-
var React = require("react");
|
|
110
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
111
|
-
var Dialog = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dialog.Dialog.Root, { "data-slot": "dialog", ...props });
|
|
112
|
-
var DialogTrigger = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dialog.Dialog.Trigger, { "data-slot": "dialog-trigger", ...props });
|
|
113
|
-
var DialogPortal = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dialog.Dialog.Portal, { "data-slot": "dialog-portal", ...props });
|
|
114
|
-
var DialogClose = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dialog.Dialog.Close, { "data-slot": "dialog-close", ...props });
|
|
115
|
-
var DialogOverlay = ({
|
|
116
|
-
className,
|
|
117
|
-
...props
|
|
118
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
119
|
-
import_dialog.Dialog.Backdrop,
|
|
120
|
-
{
|
|
121
|
-
"data-slot": "dialog-overlay",
|
|
122
|
-
className: cn(
|
|
123
|
-
"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",
|
|
124
|
-
className
|
|
125
|
-
),
|
|
126
|
-
...props
|
|
127
|
-
}
|
|
128
|
-
);
|
|
129
|
-
var DialogContent = ({
|
|
130
|
-
className,
|
|
131
|
-
children,
|
|
132
|
-
showCloseButton = true,
|
|
133
|
-
...props
|
|
134
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(DialogPortal, { children: [
|
|
135
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DialogOverlay, {}),
|
|
136
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
137
|
-
import_dialog.Dialog.Popup,
|
|
138
|
-
{
|
|
139
|
-
"data-slot": "dialog-content",
|
|
140
|
-
className: cn(
|
|
141
|
-
"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-xl bg-popover p-5 text-xs/relaxed text-popover-foreground shadow-[0_8px_30px_-12px_rgb(0_0_0/0.15)] ring-1 ring-border/60 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",
|
|
142
|
-
className
|
|
143
|
-
),
|
|
144
|
-
...props,
|
|
145
|
-
children: [
|
|
146
|
-
children,
|
|
147
|
-
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
148
|
-
import_dialog.Dialog.Close,
|
|
149
|
-
{
|
|
150
|
-
"data-slot": "dialog-close",
|
|
151
|
-
render: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
152
|
-
Button,
|
|
153
|
-
{
|
|
154
|
-
variant: "ghost",
|
|
155
|
-
className: "absolute top-2 right-2",
|
|
156
|
-
size: "icon-sm"
|
|
157
|
-
}
|
|
158
|
-
),
|
|
159
|
-
children: [
|
|
160
|
-
"X",
|
|
161
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "sr-only", children: "Close" })
|
|
162
|
-
]
|
|
163
|
-
}
|
|
164
|
-
)
|
|
165
|
-
]
|
|
166
|
-
}
|
|
167
|
-
)
|
|
168
|
-
] });
|
|
169
|
-
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
170
|
-
"div",
|
|
171
|
-
{
|
|
172
|
-
"data-slot": "dialog-header",
|
|
173
|
-
className: cn("flex flex-col gap-1 text-left", className),
|
|
174
|
-
...props
|
|
175
|
-
}
|
|
176
|
-
);
|
|
177
|
-
var DialogFooter = ({
|
|
178
|
-
className,
|
|
179
|
-
showCloseButton = false,
|
|
180
|
-
children,
|
|
181
|
-
...props
|
|
182
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
183
|
-
"div",
|
|
184
|
-
{
|
|
185
|
-
"data-slot": "dialog-footer",
|
|
186
|
-
className: cn(
|
|
187
|
-
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
188
|
-
className
|
|
189
|
-
),
|
|
190
|
-
...props,
|
|
191
|
-
children: [
|
|
192
|
-
children,
|
|
193
|
-
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dialog.Dialog.Close, { render: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Button, { variant: "outline" }), children: "Close" })
|
|
194
|
-
]
|
|
195
|
-
}
|
|
196
|
-
);
|
|
197
|
-
var DialogTitle = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
198
|
-
import_dialog.Dialog.Title,
|
|
199
|
-
{
|
|
200
|
-
"data-slot": "dialog-title",
|
|
201
|
-
className: cn("text-sm font-medium", className),
|
|
202
|
-
...props
|
|
203
|
-
}
|
|
204
|
-
);
|
|
205
|
-
var DialogDescription = ({
|
|
206
|
-
className,
|
|
207
|
-
...props
|
|
208
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
209
|
-
import_dialog.Dialog.Description,
|
|
210
|
-
{
|
|
211
|
-
"data-slot": "dialog-description",
|
|
212
|
-
className: cn(
|
|
213
|
-
"text-xs/relaxed text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",
|
|
214
|
-
className
|
|
215
|
-
),
|
|
216
|
-
...props
|
|
217
|
-
}
|
|
218
|
-
);
|
|
219
|
-
|
|
220
|
-
// src/ui/input.tsx
|
|
221
|
-
var import_input = require("@base-ui/react/input");
|
|
222
|
-
var React2 = require("react");
|
|
223
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
224
|
-
var Input = ({
|
|
225
|
-
className,
|
|
226
|
-
type,
|
|
227
|
-
...props
|
|
228
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
229
|
-
import_input.Input,
|
|
230
|
-
{
|
|
231
|
-
type,
|
|
232
|
-
"data-slot": "input",
|
|
233
|
-
className: cn(
|
|
234
|
-
"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",
|
|
235
|
-
className
|
|
236
|
-
),
|
|
237
|
-
...props
|
|
238
|
-
}
|
|
239
|
-
);
|
|
240
|
-
|
|
241
|
-
// src/ui/popover.tsx
|
|
242
|
-
var import_popover = require("@base-ui/react/popover");
|
|
243
|
-
var React3 = require("react");
|
|
244
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
245
|
-
var Popover = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_popover.Popover.Root, { "data-slot": "popover", ...props });
|
|
246
|
-
var PopoverTrigger = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_popover.Popover.Trigger, { "data-slot": "popover-trigger", ...props });
|
|
247
|
-
var PopoverContent = ({
|
|
248
|
-
className,
|
|
249
|
-
align = "center",
|
|
250
|
-
alignOffset = 0,
|
|
251
|
-
side = "bottom",
|
|
252
|
-
sideOffset = 4,
|
|
253
|
-
...props
|
|
254
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_popover.Popover.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
255
|
-
import_popover.Popover.Positioner,
|
|
256
|
-
{
|
|
257
|
-
align,
|
|
258
|
-
alignOffset,
|
|
259
|
-
side,
|
|
260
|
-
sideOffset,
|
|
261
|
-
className: "isolate z-50",
|
|
262
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
263
|
-
import_popover.Popover.Popup,
|
|
264
|
-
{
|
|
265
|
-
"data-slot": "popover-content",
|
|
266
|
-
className: cn(
|
|
267
|
-
"z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-xs text-popover-foreground shadow-[0_8px_30px_-12px_rgb(0_0_0/0.15)] ring-1 ring-border/60 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",
|
|
268
|
-
className
|
|
269
|
-
),
|
|
270
|
-
...props
|
|
271
|
-
}
|
|
272
|
-
)
|
|
273
|
-
}
|
|
274
|
-
) });
|
|
275
|
-
|
|
276
|
-
// src/ui/rte-button.tsx
|
|
277
|
-
var React4 = __toESM(require("react"), 1);
|
|
278
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
279
|
-
var RteButton = React4.forwardRef(
|
|
63
|
+
var Button = React.forwardRef(
|
|
280
64
|
({ className, active = false, ...props }, ref) => {
|
|
281
65
|
const cls = cn(
|
|
282
66
|
"rte-bubble-btn flex h-8 min-w-8 cursor-pointer items-center justify-center gap-1 rounded-md border-none bg-transparent px-2 text-[0.8125rem] font-medium whitespace-nowrap text-popover-foreground [transition:background-color_150ms_ease-out,color_150ms_ease-out,scale_100ms_ease-out] hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-ring/50 focus-visible:-outline-offset-2 active:scale-96",
|
|
283
67
|
active && "rte-bubble-btn--active bg-muted text-foreground",
|
|
284
68
|
className
|
|
285
69
|
);
|
|
286
|
-
return /* @__PURE__ */ (0,
|
|
70
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { ref, type: "button", className: cls, ...props });
|
|
287
71
|
}
|
|
288
72
|
);
|
|
289
|
-
|
|
73
|
+
Button.displayName = "Button";
|
|
290
74
|
|
|
291
|
-
// src/ui/
|
|
292
|
-
var
|
|
293
|
-
var
|
|
294
|
-
var
|
|
295
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
75
|
+
// src/ui/button-group.tsx
|
|
76
|
+
var React2 = __toESM(require("react"), 1);
|
|
77
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
78
|
+
var ButtonGroup = React2.forwardRef(
|
|
79
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
296
80
|
"div",
|
|
297
81
|
{
|
|
298
82
|
ref,
|
|
@@ -301,13 +85,13 @@ var RteButtonGroup = React5.forwardRef(
|
|
|
301
85
|
}
|
|
302
86
|
)
|
|
303
87
|
);
|
|
304
|
-
|
|
88
|
+
ButtonGroup.displayName = "ButtonGroup";
|
|
305
89
|
|
|
306
|
-
// src/ui/
|
|
307
|
-
var
|
|
308
|
-
var
|
|
309
|
-
var
|
|
310
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
90
|
+
// src/ui/icon.tsx
|
|
91
|
+
var React3 = __toESM(require("react"), 1);
|
|
92
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
93
|
+
var Icon = React3.forwardRef(
|
|
94
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
311
95
|
"span",
|
|
312
96
|
{
|
|
313
97
|
ref,
|
|
@@ -319,13 +103,13 @@ var RteIcon = React6.forwardRef(
|
|
|
319
103
|
}
|
|
320
104
|
)
|
|
321
105
|
);
|
|
322
|
-
|
|
106
|
+
Icon.displayName = "Icon";
|
|
323
107
|
|
|
324
|
-
// src/ui/
|
|
325
|
-
var
|
|
326
|
-
var
|
|
327
|
-
var
|
|
328
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
108
|
+
// src/ui/separator.tsx
|
|
109
|
+
var React4 = __toESM(require("react"), 1);
|
|
110
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
111
|
+
var Separator = React4.forwardRef(
|
|
112
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
329
113
|
"div",
|
|
330
114
|
{
|
|
331
115
|
ref,
|
|
@@ -337,13 +121,13 @@ var RteSeparator = React7.forwardRef(
|
|
|
337
121
|
}
|
|
338
122
|
)
|
|
339
123
|
);
|
|
340
|
-
|
|
124
|
+
Separator.displayName = "Separator";
|
|
341
125
|
|
|
342
|
-
// src/ui/
|
|
343
|
-
var
|
|
344
|
-
var
|
|
345
|
-
var
|
|
346
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
126
|
+
// src/ui/overlay.tsx
|
|
127
|
+
var React5 = __toESM(require("react"), 1);
|
|
128
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
129
|
+
var Overlay = React5.forwardRef(
|
|
130
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
347
131
|
"div",
|
|
348
132
|
{
|
|
349
133
|
ref,
|
|
@@ -353,18 +137,18 @@ var RteOverlay = React8.forwardRef(
|
|
|
353
137
|
}
|
|
354
138
|
)
|
|
355
139
|
);
|
|
356
|
-
|
|
140
|
+
Overlay.displayName = "Overlay";
|
|
357
141
|
|
|
358
|
-
// src/ui/
|
|
359
|
-
var
|
|
142
|
+
// src/ui/dropdown.tsx
|
|
143
|
+
var React6 = __toESM(require("react"), 1);
|
|
360
144
|
var import_react = require("react");
|
|
361
|
-
var
|
|
145
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
362
146
|
var variantClass = {
|
|
363
147
|
color: "rte-bubble-dropdown--color min-w-auto p-2 [&_.rte-bubble-dropdown-divider]:mx-[-0.5rem] [&_.rte-bubble-dropdown-divider]:mt-2.5 [&_.rte-bubble-dropdown-divider]:mb-2",
|
|
364
148
|
default: "",
|
|
365
149
|
language: "rte-bubble-dropdown--language max-h-80 min-w-40 overflow-y-auto [scrollbar-width:thin]"
|
|
366
150
|
};
|
|
367
|
-
var
|
|
151
|
+
var Dropdown = React6.forwardRef(
|
|
368
152
|
({ className, variant = "default", children, onMouseLeave, ...props }, ref) => {
|
|
369
153
|
const containerRef = (0, import_react.useRef)(null);
|
|
370
154
|
const [pill, setPill] = (0, import_react.useState)(null);
|
|
@@ -406,7 +190,7 @@ var RteDropdown = React9.forwardRef(
|
|
|
406
190
|
variantClass[variant],
|
|
407
191
|
className
|
|
408
192
|
);
|
|
409
|
-
return /* @__PURE__ */ (0,
|
|
193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
410
194
|
"div",
|
|
411
195
|
{
|
|
412
196
|
ref: (node) => {
|
|
@@ -423,7 +207,7 @@ var RteDropdown = React9.forwardRef(
|
|
|
423
207
|
onMouseOver: handleMouseOver,
|
|
424
208
|
...props,
|
|
425
209
|
children: [
|
|
426
|
-
/* @__PURE__ */ (0,
|
|
210
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
427
211
|
"div",
|
|
428
212
|
{
|
|
429
213
|
"aria-hidden": "true",
|
|
@@ -445,11 +229,11 @@ var RteDropdown = React9.forwardRef(
|
|
|
445
229
|
);
|
|
446
230
|
}
|
|
447
231
|
);
|
|
448
|
-
|
|
232
|
+
Dropdown.displayName = "Dropdown";
|
|
449
233
|
|
|
450
|
-
// src/ui/
|
|
451
|
-
var
|
|
452
|
-
var
|
|
234
|
+
// src/ui/color-swatch.tsx
|
|
235
|
+
var React7 = __toESM(require("react"), 1);
|
|
236
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
453
237
|
var getCheckColor = (hex) => {
|
|
454
238
|
const value = hex.replace("#", "");
|
|
455
239
|
const r = Number.parseInt(value.slice(0, 2), 16) / 255;
|
|
@@ -458,10 +242,10 @@ var getCheckColor = (hex) => {
|
|
|
458
242
|
const luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
459
243
|
return luminance > 0.5 ? "#18181b" : "#ffffff";
|
|
460
244
|
};
|
|
461
|
-
var
|
|
245
|
+
var ColorSwatch = React7.forwardRef(
|
|
462
246
|
({ color, label, variant, active = false, onSelect }, ref) => {
|
|
463
247
|
const checkColor = getCheckColor(color);
|
|
464
|
-
return /* @__PURE__ */ (0,
|
|
248
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
465
249
|
"button",
|
|
466
250
|
{
|
|
467
251
|
ref,
|
|
@@ -483,7 +267,7 @@ var RteColorSwatch = React10.forwardRef(
|
|
|
483
267
|
onMouseDown: (e) => e.preventDefault(),
|
|
484
268
|
onClick: () => onSelect(color),
|
|
485
269
|
children: [
|
|
486
|
-
variant === "text" && !active ? /* @__PURE__ */ (0,
|
|
270
|
+
variant === "text" && !active ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
487
271
|
"span",
|
|
488
272
|
{
|
|
489
273
|
className: "rte-bubble-color-glyph text-[0.6875rem] leading-none font-semibold",
|
|
@@ -491,12 +275,12 @@ var RteColorSwatch = React10.forwardRef(
|
|
|
491
275
|
children: "A"
|
|
492
276
|
}
|
|
493
277
|
) : null,
|
|
494
|
-
active ? /* @__PURE__ */ (0,
|
|
278
|
+
active ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
495
279
|
"span",
|
|
496
280
|
{
|
|
497
281
|
className: "rte-bubble-color-check flex size-3 items-center justify-center text-(--swatch-check) [&_svg]:size-full",
|
|
498
282
|
"aria-hidden": "true",
|
|
499
|
-
children: /* @__PURE__ */ (0,
|
|
283
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
500
284
|
"svg",
|
|
501
285
|
{
|
|
502
286
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -506,7 +290,7 @@ var RteColorSwatch = React10.forwardRef(
|
|
|
506
290
|
strokeWidth: 3,
|
|
507
291
|
strokeLinecap: "round",
|
|
508
292
|
strokeLinejoin: "round",
|
|
509
|
-
children: /* @__PURE__ */ (0,
|
|
293
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M20 6 9 17l-5-5" })
|
|
510
294
|
}
|
|
511
295
|
)
|
|
512
296
|
}
|
|
@@ -516,34 +300,36 @@ var RteColorSwatch = React10.forwardRef(
|
|
|
516
300
|
);
|
|
517
301
|
}
|
|
518
302
|
);
|
|
519
|
-
|
|
303
|
+
ColorSwatch.displayName = "ColorSwatch";
|
|
520
304
|
|
|
521
|
-
// src/ui/
|
|
522
|
-
var
|
|
523
|
-
var
|
|
524
|
-
var
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
305
|
+
// src/ui/dropdown-item.tsx
|
|
306
|
+
var React8 = __toESM(require("react"), 1);
|
|
307
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
308
|
+
var DropdownItem = React8.forwardRef(
|
|
309
|
+
({ className, active = false, ...props }, ref) => {
|
|
310
|
+
const cls = cn(
|
|
311
|
+
"rte-bubble-dropdown-item relative z-1 flex h-8 w-full cursor-pointer items-center justify-start gap-2 rounded-sm border-none bg-transparent px-2 text-left text-[0.8125rem] text-muted-foreground outline-none [transition:background-color_150ms_ease-out,color_150ms_ease-out] hover:text-foreground focus-visible:text-foreground hover:[&_.rte-bubble-dropdown-icon]:text-foreground",
|
|
312
|
+
active && "rte-bubble-dropdown-item--active bg-muted font-medium text-foreground [&_.rte-bubble-dropdown-icon]:text-foreground",
|
|
313
|
+
className
|
|
314
|
+
);
|
|
315
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
316
|
+
"button",
|
|
317
|
+
{
|
|
318
|
+
ref,
|
|
319
|
+
type: "button",
|
|
320
|
+
"data-dropdown-item": true,
|
|
321
|
+
className: cls,
|
|
322
|
+
...props
|
|
323
|
+
}
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
);
|
|
327
|
+
DropdownItem.displayName = "DropdownItem";
|
|
542
328
|
|
|
543
|
-
// src/ui/
|
|
544
|
-
var
|
|
545
|
-
var
|
|
546
|
-
var
|
|
329
|
+
// src/ui/dropdown-separator.tsx
|
|
330
|
+
var React9 = __toESM(require("react"), 1);
|
|
331
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
332
|
+
var DropdownSeparator = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
547
333
|
"div",
|
|
548
334
|
{
|
|
549
335
|
ref,
|
|
@@ -554,13 +340,13 @@ var RteDropdownDivider = React12.forwardRef(({ className, ...props }, ref) => /*
|
|
|
554
340
|
...props
|
|
555
341
|
}
|
|
556
342
|
));
|
|
557
|
-
|
|
343
|
+
DropdownSeparator.displayName = "DropdownSeparator";
|
|
558
344
|
|
|
559
|
-
// src/ui/
|
|
560
|
-
var
|
|
561
|
-
var
|
|
562
|
-
var
|
|
563
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
345
|
+
// src/ui/dropdown-icon.tsx
|
|
346
|
+
var React10 = __toESM(require("react"), 1);
|
|
347
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
348
|
+
var DropdownIcon = React10.forwardRef(
|
|
349
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
564
350
|
"span",
|
|
565
351
|
{
|
|
566
352
|
ref,
|
|
@@ -572,108 +358,13 @@ var RteDropdownIcon = React13.forwardRef(
|
|
|
572
358
|
}
|
|
573
359
|
)
|
|
574
360
|
);
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
// src/ui/toggle.tsx
|
|
578
|
-
var import_toggle = require("@base-ui/react/toggle");
|
|
579
|
-
var import_class_variance_authority2 = require("class-variance-authority");
|
|
580
|
-
var import_react2 = require("react");
|
|
581
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
582
|
-
var toggleVariants = (0, import_class_variance_authority2.cva)(
|
|
583
|
-
"group/toggle inline-flex items-center justify-center gap-1 rounded-md text-xs font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
584
|
-
{
|
|
585
|
-
defaultVariants: {
|
|
586
|
-
size: "default",
|
|
587
|
-
variant: "default"
|
|
588
|
-
},
|
|
589
|
-
variants: {
|
|
590
|
-
size: {
|
|
591
|
-
default: "h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
592
|
-
lg: "h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
593
|
-
sm: "h-7 min-w-7 px-2.5 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5"
|
|
594
|
-
},
|
|
595
|
-
variant: {
|
|
596
|
-
default: "bg-transparent",
|
|
597
|
-
outline: "border border-input bg-transparent hover:bg-muted"
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
);
|
|
602
|
-
var Toggle = (0, import_react2.forwardRef)(({ className, variant = "default", size = "default", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
603
|
-
import_toggle.Toggle,
|
|
604
|
-
{
|
|
605
|
-
ref,
|
|
606
|
-
"data-slot": "toggle",
|
|
607
|
-
className: cn(toggleVariants({ className, size, variant })),
|
|
608
|
-
...props
|
|
609
|
-
}
|
|
610
|
-
));
|
|
611
|
-
Toggle.displayName = "Toggle";
|
|
612
|
-
|
|
613
|
-
// src/ui/tooltip.tsx
|
|
614
|
-
var import_tooltip = require("@base-ui/react/tooltip");
|
|
615
|
-
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
616
|
-
var TooltipProvider = ({
|
|
617
|
-
delay = 0,
|
|
618
|
-
...props
|
|
619
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
620
|
-
import_tooltip.Tooltip.Provider,
|
|
621
|
-
{
|
|
622
|
-
"data-slot": "tooltip-provider",
|
|
623
|
-
delay,
|
|
624
|
-
...props
|
|
625
|
-
}
|
|
626
|
-
);
|
|
627
|
-
var Tooltip = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_tooltip.Tooltip.Root, { "data-slot": "tooltip", ...props });
|
|
628
|
-
var TooltipTrigger = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_tooltip.Tooltip.Trigger, { "data-slot": "tooltip-trigger", ...props });
|
|
629
|
-
var TooltipContent = ({
|
|
630
|
-
className,
|
|
631
|
-
side = "top",
|
|
632
|
-
sideOffset = 4,
|
|
633
|
-
align = "center",
|
|
634
|
-
alignOffset = 0,
|
|
635
|
-
children,
|
|
636
|
-
...props
|
|
637
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_tooltip.Tooltip.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
638
|
-
import_tooltip.Tooltip.Positioner,
|
|
639
|
-
{
|
|
640
|
-
align,
|
|
641
|
-
alignOffset,
|
|
642
|
-
side,
|
|
643
|
-
sideOffset,
|
|
644
|
-
className: "isolate z-50",
|
|
645
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
646
|
-
import_tooltip.Tooltip.Popup,
|
|
647
|
-
{
|
|
648
|
-
"data-slot": "tooltip-content",
|
|
649
|
-
className: cn(
|
|
650
|
-
"z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-2 py-1 text-xs text-background has-data-[slot=kbd]:pr-1.5 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-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 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",
|
|
651
|
-
className
|
|
652
|
-
),
|
|
653
|
-
...props,
|
|
654
|
-
children: [
|
|
655
|
-
children,
|
|
656
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_tooltip.Tooltip.Arrow, { className: "z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5" })
|
|
657
|
-
]
|
|
658
|
-
}
|
|
659
|
-
)
|
|
660
|
-
}
|
|
661
|
-
) });
|
|
662
|
-
var createTooltipHandle = () => import_tooltip.Tooltip.createHandle();
|
|
663
|
-
var TooltipHost = ({
|
|
664
|
-
handle,
|
|
665
|
-
children,
|
|
666
|
-
...props
|
|
667
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
668
|
-
children,
|
|
669
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Tooltip, { handle, children: ({ payload }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TooltipContent, { ...props, children: payload }) })
|
|
670
|
-
] });
|
|
361
|
+
DropdownIcon.displayName = "DropdownIcon";
|
|
671
362
|
|
|
672
363
|
// src/bubble-menu/color-selector.tsx
|
|
673
|
-
var
|
|
364
|
+
var import_react3 = require("react");
|
|
674
365
|
|
|
675
366
|
// src/bubble-menu/utils.ts
|
|
676
|
-
var
|
|
367
|
+
var import_react2 = require("react");
|
|
677
368
|
var defaultEqual = (a, b) => a === b;
|
|
678
369
|
var shallowEqual = (a, b) => {
|
|
679
370
|
if (a === b) {
|
|
@@ -690,16 +381,16 @@ var shallowEqual = (a, b) => {
|
|
|
690
381
|
return ak.every((k) => a[k] === b[k]);
|
|
691
382
|
};
|
|
692
383
|
var useEditorState = (editor, selector, isEqual = defaultEqual) => {
|
|
693
|
-
const selectorRef = (0,
|
|
694
|
-
const isEqualRef = (0,
|
|
695
|
-
(0,
|
|
384
|
+
const selectorRef = (0, import_react2.useRef)(selector);
|
|
385
|
+
const isEqualRef = (0, import_react2.useRef)(isEqual);
|
|
386
|
+
(0, import_react2.useEffect)(() => {
|
|
696
387
|
selectorRef.current = selector;
|
|
697
388
|
isEqualRef.current = isEqual;
|
|
698
389
|
});
|
|
699
|
-
const snapshotRef = (0,
|
|
390
|
+
const snapshotRef = (0, import_react2.useRef)({
|
|
700
391
|
value: editor ? selector(editor) : void 0
|
|
701
392
|
});
|
|
702
|
-
const updateSnapshot = (0,
|
|
393
|
+
const updateSnapshot = (0, import_react2.useCallback)(() => {
|
|
703
394
|
if (!editor) {
|
|
704
395
|
return;
|
|
705
396
|
}
|
|
@@ -709,7 +400,7 @@ var useEditorState = (editor, selector, isEqual = defaultEqual) => {
|
|
|
709
400
|
}
|
|
710
401
|
snapshotRef.current = { value: next };
|
|
711
402
|
}, [editor]);
|
|
712
|
-
const subscribe = (0,
|
|
403
|
+
const subscribe = (0, import_react2.useCallback)(
|
|
713
404
|
(onStoreChange) => {
|
|
714
405
|
if (!editor) {
|
|
715
406
|
return () => {
|
|
@@ -728,12 +419,12 @@ var useEditorState = (editor, selector, isEqual = defaultEqual) => {
|
|
|
728
419
|
},
|
|
729
420
|
[editor, updateSnapshot]
|
|
730
421
|
);
|
|
731
|
-
const getSnapshot = (0,
|
|
732
|
-
return (0,
|
|
422
|
+
const getSnapshot = (0, import_react2.useCallback)(() => snapshotRef.current.value, []);
|
|
423
|
+
return (0, import_react2.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
|
|
733
424
|
};
|
|
734
425
|
|
|
735
426
|
// src/bubble-menu/color-selector.tsx
|
|
736
|
-
var
|
|
427
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
737
428
|
var RECENT_KEY = "editorcn-editor-recent-colors";
|
|
738
429
|
var RECENT_LIMIT = 10;
|
|
739
430
|
var readRecentColors = () => {
|
|
@@ -782,8 +473,8 @@ var HIGHLIGHT_COLORS = [
|
|
|
782
473
|
{ color: "#bbf7d0", label: "Green" }
|
|
783
474
|
];
|
|
784
475
|
var ColorSelector = ({ editor }) => {
|
|
785
|
-
const [open, setOpen] = (0,
|
|
786
|
-
const [recent, setRecent] = (0,
|
|
476
|
+
const [open, setOpen] = (0, import_react3.useState)(false);
|
|
477
|
+
const [recent, setRecent] = (0, import_react3.useState)(() => readRecentColors());
|
|
787
478
|
const { highlightColor, textColor } = useEditorState(
|
|
788
479
|
editor,
|
|
789
480
|
(ed) => ({
|
|
@@ -827,15 +518,15 @@ var ColorSelector = ({ editor }) => {
|
|
|
827
518
|
if (!hasColor && !hasHighlight) {
|
|
828
519
|
return null;
|
|
829
520
|
}
|
|
830
|
-
return /* @__PURE__ */ (0,
|
|
831
|
-
/* @__PURE__ */ (0,
|
|
832
|
-
|
|
521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { position: "relative" }, children: [
|
|
522
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
523
|
+
Button,
|
|
833
524
|
{
|
|
834
525
|
active: Boolean(textColor || highlightColor),
|
|
835
526
|
onMouseDown: (e) => e.preventDefault(),
|
|
836
527
|
onClick: () => setOpen(!open),
|
|
837
528
|
title: "Text color",
|
|
838
|
-
children: /* @__PURE__ */ (0,
|
|
529
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
839
530
|
"svg",
|
|
840
531
|
{
|
|
841
532
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -847,17 +538,17 @@ var ColorSelector = ({ editor }) => {
|
|
|
847
538
|
strokeLinejoin: "round",
|
|
848
539
|
className: "rte-editor-icon",
|
|
849
540
|
children: [
|
|
850
|
-
/* @__PURE__ */ (0,
|
|
851
|
-
/* @__PURE__ */ (0,
|
|
852
|
-
/* @__PURE__ */ (0,
|
|
541
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M4 20h16" }),
|
|
542
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "m6 16 6-12 6 12" }),
|
|
543
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M8 12h8" })
|
|
853
544
|
]
|
|
854
545
|
}
|
|
855
546
|
) })
|
|
856
547
|
}
|
|
857
548
|
),
|
|
858
|
-
open && /* @__PURE__ */ (0,
|
|
859
|
-
/* @__PURE__ */ (0,
|
|
860
|
-
|
|
549
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
550
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
551
|
+
Overlay,
|
|
861
552
|
{
|
|
862
553
|
onClick: () => setOpen(false),
|
|
863
554
|
onKeyDown: (e) => {
|
|
@@ -867,11 +558,11 @@ var ColorSelector = ({ editor }) => {
|
|
|
867
558
|
}
|
|
868
559
|
}
|
|
869
560
|
),
|
|
870
|
-
/* @__PURE__ */ (0,
|
|
871
|
-
recent.length > 0 ? /* @__PURE__ */ (0,
|
|
872
|
-
/* @__PURE__ */ (0,
|
|
873
|
-
/* @__PURE__ */ (0,
|
|
874
|
-
|
|
561
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Dropdown, { variant: "color", children: [
|
|
562
|
+
recent.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "rte-bubble-color-section flex flex-col gap-2", children: [
|
|
563
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "rte-bubble-color-label px-0.5 text-[0.75rem] leading-none font-medium text-muted-foreground", children: "Recently Used" }),
|
|
564
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "rte-bubble-color-recent flex flex-wrap justify-center gap-1.5", children: recent.map((item) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
565
|
+
ColorSwatch,
|
|
875
566
|
{
|
|
876
567
|
variant: item.type,
|
|
877
568
|
color: item.color,
|
|
@@ -882,12 +573,12 @@ var ColorSelector = ({ editor }) => {
|
|
|
882
573
|
`${item.type}-${item.color}`
|
|
883
574
|
)) })
|
|
884
575
|
] }) : null,
|
|
885
|
-
hasColor ? /* @__PURE__ */ (0,
|
|
886
|
-
recent.length > 0 && /* @__PURE__ */ (0,
|
|
887
|
-
/* @__PURE__ */ (0,
|
|
888
|
-
/* @__PURE__ */ (0,
|
|
889
|
-
/* @__PURE__ */ (0,
|
|
890
|
-
|
|
576
|
+
hasColor ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
577
|
+
recent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DropdownSeparator, {}),
|
|
578
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "rte-bubble-color-section flex flex-col gap-2", children: [
|
|
579
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "rte-bubble-color-label px-0.5 text-[0.75rem] leading-none font-medium text-muted-foreground", children: "Text Color" }),
|
|
580
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "rte-bubble-color-grid grid grid-cols-[repeat(5,1.5rem)] justify-center gap-1.5", children: TEXT_COLORS.map((item) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
581
|
+
ColorSwatch,
|
|
891
582
|
{
|
|
892
583
|
variant: "text",
|
|
893
584
|
color: item.color,
|
|
@@ -899,12 +590,12 @@ var ColorSelector = ({ editor }) => {
|
|
|
899
590
|
)) })
|
|
900
591
|
] })
|
|
901
592
|
] }) : null,
|
|
902
|
-
hasHighlight ? /* @__PURE__ */ (0,
|
|
903
|
-
(recent.length > 0 || hasColor) && /* @__PURE__ */ (0,
|
|
904
|
-
/* @__PURE__ */ (0,
|
|
905
|
-
/* @__PURE__ */ (0,
|
|
906
|
-
/* @__PURE__ */ (0,
|
|
907
|
-
|
|
593
|
+
hasHighlight ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
594
|
+
(recent.length > 0 || hasColor) && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DropdownSeparator, {}),
|
|
595
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "rte-bubble-color-section flex flex-col gap-2", children: [
|
|
596
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "rte-bubble-color-label px-0.5 text-[0.75rem] leading-none font-medium text-muted-foreground", children: "Highlight Color" }),
|
|
597
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "rte-bubble-color-grid grid grid-cols-[repeat(5,1.5rem)] justify-center gap-1.5", children: HIGHLIGHT_COLORS.map((item) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
598
|
+
ColorSwatch,
|
|
908
599
|
{
|
|
909
600
|
variant: "highlight",
|
|
910
601
|
color: item.color,
|
|
@@ -922,11 +613,11 @@ var ColorSelector = ({ editor }) => {
|
|
|
922
613
|
};
|
|
923
614
|
|
|
924
615
|
// src/bubble-menu/text-buttons.tsx
|
|
925
|
-
var
|
|
616
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
926
617
|
var Svg = ({
|
|
927
618
|
children,
|
|
928
619
|
strokeWidth = 2
|
|
929
|
-
}) => /* @__PURE__ */ (0,
|
|
620
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
930
621
|
"svg",
|
|
931
622
|
{
|
|
932
623
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -940,51 +631,50 @@ var Svg = ({
|
|
|
940
631
|
children
|
|
941
632
|
}
|
|
942
633
|
);
|
|
943
|
-
var Icon = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RteIcon, { children });
|
|
944
634
|
var textItems = [
|
|
945
635
|
{
|
|
946
636
|
command: (e) => e.chain().focus().toggleBold().run(),
|
|
947
|
-
icon: /* @__PURE__ */ (0,
|
|
948
|
-
/* @__PURE__ */ (0,
|
|
949
|
-
/* @__PURE__ */ (0,
|
|
637
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Svg, { children: [
|
|
638
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" }),
|
|
639
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" })
|
|
950
640
|
] }) }),
|
|
951
641
|
isActive: (s) => s.isBold,
|
|
952
642
|
mark: "bold"
|
|
953
643
|
},
|
|
954
644
|
{
|
|
955
645
|
command: (e) => e.chain().focus().toggleItalic().run(),
|
|
956
|
-
icon: /* @__PURE__ */ (0,
|
|
957
|
-
/* @__PURE__ */ (0,
|
|
958
|
-
/* @__PURE__ */ (0,
|
|
959
|
-
/* @__PURE__ */ (0,
|
|
646
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Svg, { children: [
|
|
647
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("line", { x1: "19", y1: "4", x2: "10", y2: "4" }),
|
|
648
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("line", { x1: "14", y1: "20", x2: "5", y2: "20" }),
|
|
649
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("line", { x1: "15", y1: "4", x2: "9", y2: "20" })
|
|
960
650
|
] }) }),
|
|
961
651
|
isActive: (s) => s.isItalic,
|
|
962
652
|
mark: "italic"
|
|
963
653
|
},
|
|
964
654
|
{
|
|
965
655
|
command: (e) => e.chain().focus().toggleUnderline().run(),
|
|
966
|
-
icon: /* @__PURE__ */ (0,
|
|
967
|
-
/* @__PURE__ */ (0,
|
|
968
|
-
/* @__PURE__ */ (0,
|
|
656
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Svg, { children: [
|
|
657
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M6 4v6a6 6 0 0 0 12 0V4" }),
|
|
658
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("line", { x1: "4", y1: "20", x2: "20", y2: "20" })
|
|
969
659
|
] }) }),
|
|
970
660
|
isActive: (s) => s.isUnderline,
|
|
971
661
|
mark: "underline"
|
|
972
662
|
},
|
|
973
663
|
{
|
|
974
664
|
command: (e) => e.chain().focus().toggleStrike().run(),
|
|
975
|
-
icon: /* @__PURE__ */ (0,
|
|
976
|
-
/* @__PURE__ */ (0,
|
|
977
|
-
/* @__PURE__ */ (0,
|
|
978
|
-
/* @__PURE__ */ (0,
|
|
665
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Svg, { children: [
|
|
666
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M16 4H9.5a3.5 3.5 0 0 0-2.9 5.4" }),
|
|
667
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M14.5 14.6a3.5 3.5 0 0 1-2.9 5.4H8" }),
|
|
668
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("line", { x1: "4", y1: "12", x2: "20", y2: "12" })
|
|
979
669
|
] }) }),
|
|
980
670
|
isActive: (s) => s.isStrike,
|
|
981
671
|
mark: "strike"
|
|
982
672
|
},
|
|
983
673
|
{
|
|
984
674
|
command: (e) => e.chain().focus().toggleCode().run(),
|
|
985
|
-
icon: /* @__PURE__ */ (0,
|
|
986
|
-
/* @__PURE__ */ (0,
|
|
987
|
-
/* @__PURE__ */ (0,
|
|
675
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Svg, { children: [
|
|
676
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("polyline", { points: "16 18 22 12 16 6" }),
|
|
677
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("polyline", { points: "8 6 2 12 8 18" })
|
|
988
678
|
] }) }),
|
|
989
679
|
isActive: (s) => s.isCode,
|
|
990
680
|
mark: "code"
|
|
@@ -1003,8 +693,8 @@ var TextButtons = ({ editor }) => {
|
|
|
1003
693
|
}),
|
|
1004
694
|
shallowEqual
|
|
1005
695
|
);
|
|
1006
|
-
return /* @__PURE__ */ (0,
|
|
1007
|
-
|
|
696
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ButtonGroup, { children: getTextItems(editor).map((item) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
697
|
+
Button,
|
|
1008
698
|
{
|
|
1009
699
|
active: item.isActive(editorState),
|
|
1010
700
|
onMouseDown: (e) => e.preventDefault(),
|
|
@@ -1016,9 +706,9 @@ var TextButtons = ({ editor }) => {
|
|
|
1016
706
|
};
|
|
1017
707
|
|
|
1018
708
|
// src/bubble-menu/index.tsx
|
|
1019
|
-
var
|
|
709
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1020
710
|
var BubbleMenu = ({ editor }) => {
|
|
1021
|
-
const shouldShow = (0,
|
|
711
|
+
const shouldShow = (0, import_react4.useCallback)(
|
|
1022
712
|
({
|
|
1023
713
|
editor: ed,
|
|
1024
714
|
state
|
|
@@ -1047,31 +737,30 @@ var BubbleMenu = ({ editor }) => {
|
|
|
1047
737
|
if (!(hasText || hasColor)) {
|
|
1048
738
|
return null;
|
|
1049
739
|
}
|
|
1050
|
-
return /* @__PURE__ */ (0,
|
|
740
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1051
741
|
import_menus.BubbleMenu,
|
|
1052
742
|
{
|
|
1053
743
|
className: "z-50",
|
|
1054
744
|
editor,
|
|
1055
745
|
options: { offset: 8, placement: "top" },
|
|
1056
746
|
shouldShow,
|
|
1057
|
-
children: /* @__PURE__ */ (0,
|
|
1058
|
-
hasText && /* @__PURE__ */ (0,
|
|
1059
|
-
hasText && hasColor && /* @__PURE__ */ (0,
|
|
1060
|
-
hasColor && /* @__PURE__ */ (0,
|
|
747
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "rte-bubble-menu flex h-10 animate-rte-bubble-pop-in items-center rounded-lg border border-[color-mix(in_srgb,var(--border)_60%,transparent)] bg-popover px-1 text-popover-foreground shadow-[0_8px_30px_-12px_rgb(0_0_0/0.15)]", children: [
|
|
748
|
+
hasText && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TextButtons, { editor }),
|
|
749
|
+
hasText && hasColor && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Separator, {}),
|
|
750
|
+
hasColor && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ColorSelector, { editor })
|
|
1061
751
|
] })
|
|
1062
752
|
}
|
|
1063
753
|
);
|
|
1064
754
|
};
|
|
1065
755
|
|
|
1066
|
-
// src/
|
|
1067
|
-
var
|
|
1068
|
-
var import_react8 = require("react");
|
|
756
|
+
// src/content.tsx
|
|
757
|
+
var import_react6 = require("@tiptap/react");
|
|
1069
758
|
|
|
1070
|
-
// src/
|
|
1071
|
-
var
|
|
1072
|
-
var RichTextEditorContext = (0,
|
|
759
|
+
// src/core/context.ts
|
|
760
|
+
var import_react5 = require("react");
|
|
761
|
+
var RichTextEditorContext = (0, import_react5.createContext)(null);
|
|
1073
762
|
var useRichTextEditorContext = () => {
|
|
1074
|
-
const context = (0,
|
|
763
|
+
const context = (0, import_react5.useContext)(RichTextEditorContext);
|
|
1075
764
|
if (!context) {
|
|
1076
765
|
throw new Error(
|
|
1077
766
|
"useRichTextEditorContext must be used within RichTextEditor"
|
|
@@ -1080,18 +769,142 @@ var useRichTextEditorContext = () => {
|
|
|
1080
769
|
return context;
|
|
1081
770
|
};
|
|
1082
771
|
|
|
1083
|
-
// src/
|
|
1084
|
-
var
|
|
772
|
+
// src/content.tsx
|
|
773
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
774
|
+
var Content = ({
|
|
775
|
+
children,
|
|
776
|
+
className
|
|
777
|
+
}) => {
|
|
778
|
+
const { editor, preset, variant } = useRichTextEditorContext();
|
|
779
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "relative", children: [
|
|
780
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
781
|
+
import_react6.EditorContent,
|
|
782
|
+
{
|
|
783
|
+
editor,
|
|
784
|
+
className: cn(
|
|
785
|
+
"rte-content editorcn-content w-full",
|
|
786
|
+
variant === "default" && "rounded-lg border border-(--rte-hairline) bg-[var(--card,var(--background))]",
|
|
787
|
+
className
|
|
788
|
+
),
|
|
789
|
+
"data-preset": preset,
|
|
790
|
+
spellCheck: false
|
|
791
|
+
}
|
|
792
|
+
),
|
|
793
|
+
children
|
|
794
|
+
] });
|
|
795
|
+
};
|
|
796
|
+
|
|
797
|
+
// src/controls/control.tsx
|
|
798
|
+
var import_react8 = require("@tiptap/react");
|
|
799
|
+
var import_react9 = require("react");
|
|
800
|
+
|
|
801
|
+
// src/primitives/base/toggle.tsx
|
|
802
|
+
var import_toggle = require("@base-ui/react/toggle");
|
|
803
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
804
|
+
var import_react7 = require("react");
|
|
805
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
806
|
+
var toggleVariants = (0, import_class_variance_authority.cva)(
|
|
807
|
+
"group/toggle inline-flex items-center justify-center gap-1 rounded-md text-xs font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
808
|
+
{
|
|
809
|
+
defaultVariants: {
|
|
810
|
+
size: "default",
|
|
811
|
+
variant: "default"
|
|
812
|
+
},
|
|
813
|
+
variants: {
|
|
814
|
+
size: {
|
|
815
|
+
default: "h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
816
|
+
lg: "h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
817
|
+
sm: "h-7 min-w-7 px-2.5 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5"
|
|
818
|
+
},
|
|
819
|
+
variant: {
|
|
820
|
+
default: "bg-transparent",
|
|
821
|
+
outline: "border border-input bg-transparent hover:bg-muted"
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
);
|
|
826
|
+
var Toggle = (0, import_react7.forwardRef)(({ className, variant = "default", size = "default", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
827
|
+
import_toggle.Toggle,
|
|
828
|
+
{
|
|
829
|
+
ref,
|
|
830
|
+
"data-slot": "toggle",
|
|
831
|
+
className: cn(toggleVariants({ className, size, variant })),
|
|
832
|
+
...props
|
|
833
|
+
}
|
|
834
|
+
));
|
|
835
|
+
Toggle.displayName = "Toggle";
|
|
836
|
+
|
|
837
|
+
// src/primitives/base/tooltip.tsx
|
|
838
|
+
var import_tooltip = require("@base-ui/react/tooltip");
|
|
839
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
840
|
+
var TooltipProvider = ({
|
|
841
|
+
delay = 0,
|
|
842
|
+
...props
|
|
843
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
844
|
+
import_tooltip.Tooltip.Provider,
|
|
845
|
+
{
|
|
846
|
+
"data-slot": "tooltip-provider",
|
|
847
|
+
delay,
|
|
848
|
+
...props
|
|
849
|
+
}
|
|
850
|
+
);
|
|
851
|
+
var Tooltip = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_tooltip.Tooltip.Root, { "data-slot": "tooltip", ...props });
|
|
852
|
+
var TooltipTrigger = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_tooltip.Tooltip.Trigger, { "data-slot": "tooltip-trigger", ...props });
|
|
853
|
+
var TooltipContent = ({
|
|
854
|
+
className,
|
|
855
|
+
side = "top",
|
|
856
|
+
sideOffset = 4,
|
|
857
|
+
align = "center",
|
|
858
|
+
alignOffset = 0,
|
|
859
|
+
children,
|
|
860
|
+
...props
|
|
861
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_tooltip.Tooltip.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
862
|
+
import_tooltip.Tooltip.Positioner,
|
|
863
|
+
{
|
|
864
|
+
align,
|
|
865
|
+
alignOffset,
|
|
866
|
+
side,
|
|
867
|
+
sideOffset,
|
|
868
|
+
className: "isolate z-50",
|
|
869
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
870
|
+
import_tooltip.Tooltip.Popup,
|
|
871
|
+
{
|
|
872
|
+
"data-slot": "tooltip-content",
|
|
873
|
+
className: cn(
|
|
874
|
+
"z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-2 py-1 text-xs text-background has-data-[slot=kbd]:pr-1.5 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-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 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",
|
|
875
|
+
className
|
|
876
|
+
),
|
|
877
|
+
...props,
|
|
878
|
+
children: [
|
|
879
|
+
children,
|
|
880
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_tooltip.Tooltip.Arrow, { className: "z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5" })
|
|
881
|
+
]
|
|
882
|
+
}
|
|
883
|
+
)
|
|
884
|
+
}
|
|
885
|
+
) });
|
|
886
|
+
var createTooltipHandle = () => import_tooltip.Tooltip.createHandle();
|
|
887
|
+
var TooltipHost = ({
|
|
888
|
+
handle,
|
|
889
|
+
children,
|
|
890
|
+
...props
|
|
891
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
892
|
+
children,
|
|
893
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Tooltip, { handle, children: ({ payload }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TooltipContent, { ...props, children: payload }) })
|
|
894
|
+
] });
|
|
895
|
+
|
|
896
|
+
// src/controls/control.tsx
|
|
897
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1085
898
|
var RichTextEditorTooltip = ({
|
|
1086
899
|
children,
|
|
1087
900
|
id,
|
|
1088
901
|
label
|
|
1089
902
|
}) => {
|
|
1090
|
-
const tooltip = (0,
|
|
903
|
+
const tooltip = (0, import_react9.useContext)(RichTextEditorContext)?.tooltip;
|
|
1091
904
|
if (!tooltip) {
|
|
1092
|
-
return id ? (0,
|
|
905
|
+
return id ? (0, import_react9.cloneElement)(children, { id }) : children;
|
|
1093
906
|
}
|
|
1094
|
-
return /* @__PURE__ */ (0,
|
|
907
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1095
908
|
TooltipTrigger,
|
|
1096
909
|
{
|
|
1097
910
|
handle: tooltip,
|
|
@@ -1111,7 +924,7 @@ var triggerProps = (props) => Object.fromEntries(
|
|
|
1111
924
|
(key) => props[key] === void 0 ? [] : [[key, props[key]]]
|
|
1112
925
|
)
|
|
1113
926
|
);
|
|
1114
|
-
var RichTextEditorControl = (0,
|
|
927
|
+
var RichTextEditorControl = (0, import_react9.forwardRef)(
|
|
1115
928
|
({
|
|
1116
929
|
active = false,
|
|
1117
930
|
interactive: _interactive = true,
|
|
@@ -1122,7 +935,7 @@ var RichTextEditorControl = (0, import_react8.forwardRef)(
|
|
|
1122
935
|
disabled,
|
|
1123
936
|
...props
|
|
1124
937
|
}, ref) => {
|
|
1125
|
-
const toggle = /* @__PURE__ */ (0,
|
|
938
|
+
const toggle = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1126
939
|
Toggle,
|
|
1127
940
|
{
|
|
1128
941
|
ref,
|
|
@@ -1144,9 +957,10 @@ var RichTextEditorControl = (0, import_react8.forwardRef)(
|
|
|
1144
957
|
children
|
|
1145
958
|
}
|
|
1146
959
|
);
|
|
1147
|
-
return props.title ? /* @__PURE__ */ (0,
|
|
960
|
+
return props.title ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RichTextEditorTooltip, { id: props.id, label: props.title, children: toggle }) : toggle;
|
|
1148
961
|
}
|
|
1149
962
|
);
|
|
963
|
+
RichTextEditorControl.displayName = "RichTextEditorControl";
|
|
1150
964
|
var resolveIsActive = (editor, config) => {
|
|
1151
965
|
if (!editor || !config) {
|
|
1152
966
|
return false;
|
|
@@ -1174,9 +988,9 @@ var createControl = ({
|
|
|
1174
988
|
const { editor, labels, icons } = useRichTextEditorContext();
|
|
1175
989
|
const ariaLabel = labels[label];
|
|
1176
990
|
const selector = createSelector(isActive, isDisabled);
|
|
1177
|
-
(0,
|
|
991
|
+
(0, import_react8.useEditorState)({ editor: editor ?? null, selector });
|
|
1178
992
|
const { active, disabled } = selector({ editor: editor ?? null });
|
|
1179
|
-
return /* @__PURE__ */ (0,
|
|
993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1180
994
|
RichTextEditorControl,
|
|
1181
995
|
{
|
|
1182
996
|
active,
|
|
@@ -1199,7 +1013,7 @@ var createControl = ({
|
|
|
1199
1013
|
return Control;
|
|
1200
1014
|
};
|
|
1201
1015
|
|
|
1202
|
-
// src/controls/
|
|
1016
|
+
// src/controls/controls.tsx
|
|
1203
1017
|
var BoldControl = createControl({
|
|
1204
1018
|
iconKey: "boldControlIcon",
|
|
1205
1019
|
isActive: { name: "bold" },
|
|
@@ -1360,20 +1174,125 @@ var SuperscriptControl = createControl({
|
|
|
1360
1174
|
operation: { name: "toggleSuperscript" }
|
|
1361
1175
|
});
|
|
1362
1176
|
|
|
1363
|
-
// src/controls/
|
|
1364
|
-
var
|
|
1365
|
-
var
|
|
1366
|
-
var
|
|
1177
|
+
// src/controls/link-control.tsx
|
|
1178
|
+
var import_react10 = require("@tiptap/react");
|
|
1179
|
+
var React14 = __toESM(require("react"), 1);
|
|
1180
|
+
var import_react11 = require("react");
|
|
1181
|
+
|
|
1182
|
+
// src/primitives/base/button.tsx
|
|
1183
|
+
var import_button2 = require("@base-ui/react/button");
|
|
1184
|
+
var import_class_variance_authority2 = require("class-variance-authority");
|
|
1185
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1186
|
+
var buttonVariants = (0, import_class_variance_authority2.cva)(
|
|
1187
|
+
"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",
|
|
1188
|
+
{
|
|
1189
|
+
defaultVariants: {
|
|
1190
|
+
size: "default",
|
|
1191
|
+
variant: "default"
|
|
1192
|
+
},
|
|
1193
|
+
variants: {
|
|
1194
|
+
size: {
|
|
1195
|
+
default: "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
1196
|
+
icon: "size-8",
|
|
1197
|
+
"icon-lg": "size-9",
|
|
1198
|
+
"icon-sm": "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
|
|
1199
|
+
"icon-xs": "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
|
|
1200
|
+
lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
1201
|
+
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",
|
|
1202
|
+
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"
|
|
1203
|
+
},
|
|
1204
|
+
variant: {
|
|
1205
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
1206
|
+
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",
|
|
1207
|
+
ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
|
|
1208
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
1209
|
+
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",
|
|
1210
|
+
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"
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
);
|
|
1215
|
+
var Button2 = ({
|
|
1216
|
+
className,
|
|
1217
|
+
variant = "default",
|
|
1218
|
+
size = "default",
|
|
1219
|
+
...props
|
|
1220
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1221
|
+
import_button2.Button,
|
|
1222
|
+
{
|
|
1223
|
+
"data-slot": "button",
|
|
1224
|
+
className: cn(buttonVariants({ className, size, variant })),
|
|
1225
|
+
...props
|
|
1226
|
+
}
|
|
1227
|
+
);
|
|
1228
|
+
|
|
1229
|
+
// src/primitives/base/input.tsx
|
|
1230
|
+
var import_input = require("@base-ui/react/input");
|
|
1231
|
+
var React12 = require("react");
|
|
1232
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1233
|
+
var Input = ({
|
|
1234
|
+
className,
|
|
1235
|
+
type,
|
|
1236
|
+
...props
|
|
1237
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1238
|
+
import_input.Input,
|
|
1239
|
+
{
|
|
1240
|
+
type,
|
|
1241
|
+
"data-slot": "input",
|
|
1242
|
+
className: cn(
|
|
1243
|
+
"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",
|
|
1244
|
+
className
|
|
1245
|
+
),
|
|
1246
|
+
...props
|
|
1247
|
+
}
|
|
1248
|
+
);
|
|
1249
|
+
|
|
1250
|
+
// src/primitives/base/popover.tsx
|
|
1251
|
+
var import_popover = require("@base-ui/react/popover");
|
|
1252
|
+
var React13 = require("react");
|
|
1253
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1254
|
+
var Popover = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_popover.Popover.Root, { "data-slot": "popover", ...props });
|
|
1255
|
+
var PopoverTrigger = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_popover.Popover.Trigger, { "data-slot": "popover-trigger", ...props });
|
|
1256
|
+
var PopoverContent = ({
|
|
1257
|
+
className,
|
|
1258
|
+
align = "center",
|
|
1259
|
+
alignOffset = 0,
|
|
1260
|
+
side = "bottom",
|
|
1261
|
+
sideOffset = 4,
|
|
1262
|
+
...props
|
|
1263
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_popover.Popover.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1264
|
+
import_popover.Popover.Positioner,
|
|
1265
|
+
{
|
|
1266
|
+
align,
|
|
1267
|
+
alignOffset,
|
|
1268
|
+
side,
|
|
1269
|
+
sideOffset,
|
|
1270
|
+
className: "isolate z-50",
|
|
1271
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1272
|
+
import_popover.Popover.Popup,
|
|
1273
|
+
{
|
|
1274
|
+
"data-slot": "popover-content",
|
|
1275
|
+
className: cn(
|
|
1276
|
+
"z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-xs text-popover-foreground shadow-[0_8px_30px_-12px_rgb(0_0_0/0.15)] ring-1 ring-border/60 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",
|
|
1277
|
+
className
|
|
1278
|
+
),
|
|
1279
|
+
...props
|
|
1280
|
+
}
|
|
1281
|
+
)
|
|
1282
|
+
}
|
|
1283
|
+
) });
|
|
1284
|
+
|
|
1285
|
+
// src/controls/link-control.tsx
|
|
1367
1286
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1368
1287
|
var LinkControl = () => {
|
|
1369
1288
|
const { editor, icons, labels, tooltip } = useRichTextEditorContext();
|
|
1370
|
-
const [url, setUrl] = (0,
|
|
1371
|
-
const [open, setOpen] = (0,
|
|
1372
|
-
const active = (0,
|
|
1289
|
+
const [url, setUrl] = (0, import_react11.useState)("");
|
|
1290
|
+
const [open, setOpen] = (0, import_react11.useState)(false);
|
|
1291
|
+
const active = (0, import_react10.useEditorState)({
|
|
1373
1292
|
editor: editor ?? null,
|
|
1374
1293
|
selector: (ctx) => ctx.editor && !ctx.editor.isDestroyed ? ctx.editor.isActive("link") : false
|
|
1375
1294
|
});
|
|
1376
|
-
const handleOpen = (0,
|
|
1295
|
+
const handleOpen = (0, import_react11.useCallback)(
|
|
1377
1296
|
(isOpen) => {
|
|
1378
1297
|
if (isOpen) {
|
|
1379
1298
|
const linkData = editor?.getAttributes("link");
|
|
@@ -1403,7 +1322,7 @@ var LinkControl = () => {
|
|
|
1403
1322
|
handleSave();
|
|
1404
1323
|
}
|
|
1405
1324
|
};
|
|
1406
|
-
|
|
1325
|
+
React14.useEffect(() => {
|
|
1407
1326
|
const handler = () => handleOpen(true);
|
|
1408
1327
|
window.addEventListener("edit-link", handler);
|
|
1409
1328
|
return () => window.removeEventListener("edit-link", handler);
|
|
@@ -1446,7 +1365,7 @@ var LinkControl = () => {
|
|
|
1446
1365
|
}
|
|
1447
1366
|
),
|
|
1448
1367
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1449
|
-
|
|
1368
|
+
Button2,
|
|
1450
1369
|
{
|
|
1451
1370
|
size: "sm",
|
|
1452
1371
|
variant: "default",
|
|
@@ -1459,19 +1378,19 @@ var LinkControl = () => {
|
|
|
1459
1378
|
] });
|
|
1460
1379
|
};
|
|
1461
1380
|
|
|
1462
|
-
// src/controls/
|
|
1381
|
+
// src/controls/twitter-control.tsx
|
|
1463
1382
|
var import_core2 = require("@tiptap/core");
|
|
1464
|
-
var
|
|
1465
|
-
var
|
|
1383
|
+
var import_react16 = require("@tiptap/react");
|
|
1384
|
+
var import_react17 = require("react");
|
|
1466
1385
|
|
|
1467
1386
|
// src/extensions/resizable-node-view.tsx
|
|
1468
|
-
var
|
|
1469
|
-
var
|
|
1387
|
+
var import_react14 = require("@tiptap/react");
|
|
1388
|
+
var import_react15 = require("react");
|
|
1470
1389
|
|
|
1471
|
-
// src/icons.tsx
|
|
1472
|
-
var
|
|
1390
|
+
// src/icons/icons.tsx
|
|
1391
|
+
var import_react13 = require("react");
|
|
1473
1392
|
|
|
1474
|
-
// src/icon-placeholder.tsx
|
|
1393
|
+
// src/icons/icon-placeholder.tsx
|
|
1475
1394
|
var import_lucide_react = require("lucide-react");
|
|
1476
1395
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1477
1396
|
var ICONS = {
|
|
@@ -1516,8 +1435,8 @@ var IconPlaceholder = ({
|
|
|
1516
1435
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon2, { ...props });
|
|
1517
1436
|
};
|
|
1518
1437
|
|
|
1519
|
-
// src/language-icons.tsx
|
|
1520
|
-
var
|
|
1438
|
+
// src/icons/language-icons.tsx
|
|
1439
|
+
var import_react12 = require("react");
|
|
1521
1440
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1522
1441
|
var LangIcon = ({
|
|
1523
1442
|
children,
|
|
@@ -1651,7 +1570,7 @@ var DEFAULT_LANGUAGE_ICONS = {
|
|
|
1651
1570
|
] })
|
|
1652
1571
|
};
|
|
1653
1572
|
|
|
1654
|
-
// src/icons.tsx
|
|
1573
|
+
// src/icons/icons.tsx
|
|
1655
1574
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1656
1575
|
var ALIGN_PATHS = {
|
|
1657
1576
|
center: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
@@ -2210,26 +2129,26 @@ var ResizableNodeView = ({
|
|
|
2210
2129
|
watchUrl,
|
|
2211
2130
|
onSrcChange
|
|
2212
2131
|
}) => {
|
|
2213
|
-
const containerRef = (0,
|
|
2214
|
-
const [isEditingUrl, setIsEditingUrl] = (0,
|
|
2215
|
-
const [urlInput, setUrlInput] = (0,
|
|
2216
|
-
const [isResizing, setIsResizing] = (0,
|
|
2217
|
-
const [currentDimensions, setCurrentDimensions] = (0,
|
|
2218
|
-
const resizingRef = (0,
|
|
2132
|
+
const containerRef = (0, import_react15.useRef)(null);
|
|
2133
|
+
const [isEditingUrl, setIsEditingUrl] = (0, import_react15.useState)(false);
|
|
2134
|
+
const [urlInput, setUrlInput] = (0, import_react15.useState)(videoSrc || "");
|
|
2135
|
+
const [isResizing, setIsResizing] = (0, import_react15.useState)(false);
|
|
2136
|
+
const [currentDimensions, setCurrentDimensions] = (0, import_react15.useState)(null);
|
|
2137
|
+
const resizingRef = (0, import_react15.useRef)(null);
|
|
2219
2138
|
const width = node.attrs.width;
|
|
2220
2139
|
const height = node.attrs.height;
|
|
2221
2140
|
const align = node.attrs.align || "center";
|
|
2222
|
-
const getEditorWidth = (0,
|
|
2141
|
+
const getEditorWidth = (0, import_react15.useCallback)(
|
|
2223
2142
|
() => view?.dom?.parentElement?.offsetWidth ?? 800,
|
|
2224
2143
|
[view]
|
|
2225
2144
|
);
|
|
2226
|
-
const inputRef = (0,
|
|
2227
|
-
(0,
|
|
2145
|
+
const inputRef = (0, import_react15.useRef)(null);
|
|
2146
|
+
(0, import_react15.useEffect)(() => {
|
|
2228
2147
|
if (isEditingUrl) {
|
|
2229
2148
|
inputRef.current?.focus();
|
|
2230
2149
|
}
|
|
2231
2150
|
}, [isEditingUrl]);
|
|
2232
|
-
const handleMouseMove = (0,
|
|
2151
|
+
const handleMouseMove = (0, import_react15.useCallback)(
|
|
2233
2152
|
(e) => {
|
|
2234
2153
|
const resize = resizingRef.current;
|
|
2235
2154
|
if (!resize) {
|
|
@@ -2279,7 +2198,7 @@ var ResizableNodeView = ({
|
|
|
2279
2198
|
},
|
|
2280
2199
|
[lockAspect, aspectRatio, minWidth, maxWidth]
|
|
2281
2200
|
);
|
|
2282
|
-
const handleMouseUp = (0,
|
|
2201
|
+
const handleMouseUp = (0, import_react15.useCallback)(
|
|
2283
2202
|
function handleMouseUp2() {
|
|
2284
2203
|
const resize = resizingRef.current;
|
|
2285
2204
|
if (!resize) {
|
|
@@ -2300,7 +2219,7 @@ var ResizableNodeView = ({
|
|
|
2300
2219
|
},
|
|
2301
2220
|
[handleMouseMove, updateAttributes]
|
|
2302
2221
|
);
|
|
2303
|
-
const handleMouseDown = (0,
|
|
2222
|
+
const handleMouseDown = (0, import_react15.useCallback)(
|
|
2304
2223
|
(e, direction) => {
|
|
2305
2224
|
e.preventDefault();
|
|
2306
2225
|
e.stopPropagation();
|
|
@@ -2331,7 +2250,7 @@ var ResizableNodeView = ({
|
|
|
2331
2250
|
},
|
|
2332
2251
|
[width, height, getEditorWidth, handleMouseMove, handleMouseUp]
|
|
2333
2252
|
);
|
|
2334
|
-
(0,
|
|
2253
|
+
(0, import_react15.useEffect)(
|
|
2335
2254
|
() => () => {
|
|
2336
2255
|
document.removeEventListener("mousemove", handleMouseMove);
|
|
2337
2256
|
document.removeEventListener("mouseup", handleMouseUp);
|
|
@@ -2360,7 +2279,7 @@ var ResizableNodeView = ({
|
|
|
2360
2279
|
};
|
|
2361
2280
|
const isEditable = editor ? editor.isEditable : true;
|
|
2362
2281
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2363
|
-
|
|
2282
|
+
import_react14.NodeViewWrapper,
|
|
2364
2283
|
{
|
|
2365
2284
|
className: "rte-embed-wrapper group/embed",
|
|
2366
2285
|
"data-selected": selected || void 0,
|
|
@@ -2458,8 +2377,121 @@ var ResizableNodeView = ({
|
|
|
2458
2377
|
);
|
|
2459
2378
|
};
|
|
2460
2379
|
|
|
2461
|
-
// src/
|
|
2380
|
+
// src/primitives/base/dialog.tsx
|
|
2381
|
+
var import_dialog = require("@base-ui/react/dialog");
|
|
2382
|
+
var React17 = require("react");
|
|
2462
2383
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2384
|
+
var Dialog = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_dialog.Dialog.Root, { "data-slot": "dialog", ...props });
|
|
2385
|
+
var DialogTrigger = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_dialog.Dialog.Trigger, { "data-slot": "dialog-trigger", ...props });
|
|
2386
|
+
var DialogPortal = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_dialog.Dialog.Portal, { "data-slot": "dialog-portal", ...props });
|
|
2387
|
+
var DialogClose = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_dialog.Dialog.Close, { "data-slot": "dialog-close", ...props });
|
|
2388
|
+
var DialogOverlay = ({
|
|
2389
|
+
className,
|
|
2390
|
+
...props
|
|
2391
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2392
|
+
import_dialog.Dialog.Backdrop,
|
|
2393
|
+
{
|
|
2394
|
+
"data-slot": "dialog-overlay",
|
|
2395
|
+
className: cn(
|
|
2396
|
+
"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",
|
|
2397
|
+
className
|
|
2398
|
+
),
|
|
2399
|
+
...props
|
|
2400
|
+
}
|
|
2401
|
+
);
|
|
2402
|
+
var DialogContent = ({
|
|
2403
|
+
className,
|
|
2404
|
+
children,
|
|
2405
|
+
showCloseButton = true,
|
|
2406
|
+
...props
|
|
2407
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(DialogPortal, { children: [
|
|
2408
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DialogOverlay, {}),
|
|
2409
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
2410
|
+
import_dialog.Dialog.Popup,
|
|
2411
|
+
{
|
|
2412
|
+
"data-slot": "dialog-content",
|
|
2413
|
+
className: cn(
|
|
2414
|
+
"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-xl bg-popover p-5 text-xs/relaxed text-popover-foreground shadow-[0_8px_30px_-12px_rgb(0_0_0/0.15)] ring-1 ring-border/60 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",
|
|
2415
|
+
className
|
|
2416
|
+
),
|
|
2417
|
+
...props,
|
|
2418
|
+
children: [
|
|
2419
|
+
children,
|
|
2420
|
+
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
2421
|
+
import_dialog.Dialog.Close,
|
|
2422
|
+
{
|
|
2423
|
+
"data-slot": "dialog-close",
|
|
2424
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2425
|
+
Button2,
|
|
2426
|
+
{
|
|
2427
|
+
variant: "ghost",
|
|
2428
|
+
className: "absolute top-2 right-2",
|
|
2429
|
+
size: "icon-sm"
|
|
2430
|
+
}
|
|
2431
|
+
),
|
|
2432
|
+
children: [
|
|
2433
|
+
"X",
|
|
2434
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "sr-only", children: "Close" })
|
|
2435
|
+
]
|
|
2436
|
+
}
|
|
2437
|
+
)
|
|
2438
|
+
]
|
|
2439
|
+
}
|
|
2440
|
+
)
|
|
2441
|
+
] });
|
|
2442
|
+
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2443
|
+
"div",
|
|
2444
|
+
{
|
|
2445
|
+
"data-slot": "dialog-header",
|
|
2446
|
+
className: cn("flex flex-col gap-1 text-left", className),
|
|
2447
|
+
...props
|
|
2448
|
+
}
|
|
2449
|
+
);
|
|
2450
|
+
var DialogFooter = ({
|
|
2451
|
+
className,
|
|
2452
|
+
showCloseButton = false,
|
|
2453
|
+
children,
|
|
2454
|
+
...props
|
|
2455
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
2456
|
+
"div",
|
|
2457
|
+
{
|
|
2458
|
+
"data-slot": "dialog-footer",
|
|
2459
|
+
className: cn(
|
|
2460
|
+
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
2461
|
+
className
|
|
2462
|
+
),
|
|
2463
|
+
...props,
|
|
2464
|
+
children: [
|
|
2465
|
+
children,
|
|
2466
|
+
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_dialog.Dialog.Close, { render: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Button2, { variant: "outline" }), children: "Close" })
|
|
2467
|
+
]
|
|
2468
|
+
}
|
|
2469
|
+
);
|
|
2470
|
+
var DialogTitle = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2471
|
+
import_dialog.Dialog.Title,
|
|
2472
|
+
{
|
|
2473
|
+
"data-slot": "dialog-title",
|
|
2474
|
+
className: cn("text-sm font-medium", className),
|
|
2475
|
+
...props
|
|
2476
|
+
}
|
|
2477
|
+
);
|
|
2478
|
+
var DialogDescription = ({
|
|
2479
|
+
className,
|
|
2480
|
+
...props
|
|
2481
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2482
|
+
import_dialog.Dialog.Description,
|
|
2483
|
+
{
|
|
2484
|
+
"data-slot": "dialog-description",
|
|
2485
|
+
className: cn(
|
|
2486
|
+
"text-xs/relaxed text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",
|
|
2487
|
+
className
|
|
2488
|
+
),
|
|
2489
|
+
...props
|
|
2490
|
+
}
|
|
2491
|
+
);
|
|
2492
|
+
|
|
2493
|
+
// src/controls/twitter-control.tsx
|
|
2494
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2463
2495
|
var WIDGET_SCRIPT_URL = "https://platform.twitter.com/widgets.js";
|
|
2464
2496
|
var SCRIPT_LOAD_TIMEOUT_MS = 8e3;
|
|
2465
2497
|
var READY_POLL_INTERVAL_MS = 50;
|
|
@@ -2535,15 +2567,15 @@ var loadTwitterScript = () => {
|
|
|
2535
2567
|
};
|
|
2536
2568
|
var TwitterNodeView = (props) => {
|
|
2537
2569
|
const { node } = props;
|
|
2538
|
-
const containerRef = (0,
|
|
2539
|
-
const [loading, setLoading] = (0,
|
|
2540
|
-
const [failed, setFailed] = (0,
|
|
2570
|
+
const containerRef = (0, import_react17.useRef)(null);
|
|
2571
|
+
const [loading, setLoading] = (0, import_react17.useState)(true);
|
|
2572
|
+
const [failed, setFailed] = (0, import_react17.useState)(false);
|
|
2541
2573
|
const { tweetId } = node.attrs;
|
|
2542
|
-
const renderedTweetIdRef = (0,
|
|
2543
|
-
const activeRenderIdRef = (0,
|
|
2544
|
-
const retryToken = (0,
|
|
2545
|
-
const [retryCount, setRetryCount] = (0,
|
|
2546
|
-
(0,
|
|
2574
|
+
const renderedTweetIdRef = (0, import_react17.useRef)(null);
|
|
2575
|
+
const activeRenderIdRef = (0, import_react17.useRef)(0);
|
|
2576
|
+
const retryToken = (0, import_react17.useRef)(0);
|
|
2577
|
+
const [retryCount, setRetryCount] = (0, import_react17.useState)(0);
|
|
2578
|
+
(0, import_react17.useEffect)(() => {
|
|
2547
2579
|
if (!containerRef.current || !tweetId) {
|
|
2548
2580
|
return;
|
|
2549
2581
|
}
|
|
@@ -2602,11 +2634,11 @@ var TwitterNodeView = (props) => {
|
|
|
2602
2634
|
isCancelled = true;
|
|
2603
2635
|
};
|
|
2604
2636
|
}, [tweetId, retryCount, failed]);
|
|
2605
|
-
const handleRetry = (0,
|
|
2637
|
+
const handleRetry = (0, import_react17.useCallback)(() => {
|
|
2606
2638
|
retryToken.current += 1;
|
|
2607
2639
|
setRetryCount(retryToken.current);
|
|
2608
2640
|
}, []);
|
|
2609
|
-
return /* @__PURE__ */ (0,
|
|
2641
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
2610
2642
|
ResizableNodeView,
|
|
2611
2643
|
{
|
|
2612
2644
|
...props,
|
|
@@ -2614,12 +2646,12 @@ var TwitterNodeView = (props) => {
|
|
|
2614
2646
|
minWidth: 300,
|
|
2615
2647
|
maxWidth: 1200,
|
|
2616
2648
|
children: [
|
|
2617
|
-
loading && /* @__PURE__ */ (0,
|
|
2618
|
-
!loading && failed && /* @__PURE__ */ (0,
|
|
2619
|
-
/* @__PURE__ */ (0,
|
|
2620
|
-
/* @__PURE__ */ (0,
|
|
2649
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "rte-embed-loading animate-pulse", children: "Loading tweet..." }),
|
|
2650
|
+
!loading && failed && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "rte-embed-error", children: [
|
|
2651
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { children: "Couldn't load this tweet." }),
|
|
2652
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", onClick: handleRetry, children: "Retry" })
|
|
2621
2653
|
] }),
|
|
2622
|
-
/* @__PURE__ */ (0,
|
|
2654
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { ref: containerRef })
|
|
2623
2655
|
]
|
|
2624
2656
|
}
|
|
2625
2657
|
);
|
|
@@ -2689,7 +2721,7 @@ var TwitterEmbed = import_core2.Node.create({
|
|
|
2689
2721
|
];
|
|
2690
2722
|
},
|
|
2691
2723
|
addNodeView() {
|
|
2692
|
-
return (0,
|
|
2724
|
+
return (0, import_react16.ReactNodeViewRenderer)(TwitterNodeView);
|
|
2693
2725
|
},
|
|
2694
2726
|
atom: true,
|
|
2695
2727
|
draggable: true,
|
|
@@ -2723,10 +2755,10 @@ var extractTweetId = (input) => {
|
|
|
2723
2755
|
};
|
|
2724
2756
|
var TwitterEmbedControl = ({ className }) => {
|
|
2725
2757
|
const { editor } = useRichTextEditorContext();
|
|
2726
|
-
const [open, setOpen] = (0,
|
|
2727
|
-
const [url, setUrl] = (0,
|
|
2728
|
-
const [touched, setTouched] = (0,
|
|
2729
|
-
const { active } = (0,
|
|
2758
|
+
const [open, setOpen] = (0, import_react17.useState)(false);
|
|
2759
|
+
const [url, setUrl] = (0, import_react17.useState)("");
|
|
2760
|
+
const [touched, setTouched] = (0, import_react17.useState)(false);
|
|
2761
|
+
const { active } = (0, import_react16.useEditorState)({
|
|
2730
2762
|
editor: editor ?? null,
|
|
2731
2763
|
selector: (ctx) => ({
|
|
2732
2764
|
active: ctx.editor && !ctx.editor.isDestroyed ? ctx.editor.isActive("twitter") : false
|
|
@@ -2734,11 +2766,11 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2734
2766
|
}) ?? { active: false };
|
|
2735
2767
|
const tweetId = url ? extractTweetId(url) : null;
|
|
2736
2768
|
const showError = touched && url.length > 0 && !tweetId;
|
|
2737
|
-
const resetState = (0,
|
|
2769
|
+
const resetState = (0, import_react17.useCallback)(() => {
|
|
2738
2770
|
setUrl("");
|
|
2739
2771
|
setTouched(false);
|
|
2740
2772
|
}, []);
|
|
2741
|
-
const handleInsert = (0,
|
|
2773
|
+
const handleInsert = (0, import_react17.useCallback)(() => {
|
|
2742
2774
|
setTouched(true);
|
|
2743
2775
|
if (!tweetId || !editor) {
|
|
2744
2776
|
return false;
|
|
@@ -2747,7 +2779,7 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2747
2779
|
resetState();
|
|
2748
2780
|
return true;
|
|
2749
2781
|
}, [tweetId, editor, resetState]);
|
|
2750
|
-
return /* @__PURE__ */ (0,
|
|
2782
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
2751
2783
|
Dialog,
|
|
2752
2784
|
{
|
|
2753
2785
|
open,
|
|
@@ -2758,36 +2790,36 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2758
2790
|
}
|
|
2759
2791
|
},
|
|
2760
2792
|
children: [
|
|
2761
|
-
/* @__PURE__ */ (0,
|
|
2793
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2762
2794
|
DialogTrigger,
|
|
2763
2795
|
{
|
|
2764
|
-
render: /* @__PURE__ */ (0,
|
|
2796
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2765
2797
|
RichTextEditorControl,
|
|
2766
2798
|
{
|
|
2767
2799
|
active,
|
|
2768
2800
|
className,
|
|
2769
2801
|
title: "Embed Tweet",
|
|
2770
2802
|
"aria-label": "Embed Tweet",
|
|
2771
|
-
children: /* @__PURE__ */ (0,
|
|
2803
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2772
2804
|
"svg",
|
|
2773
2805
|
{
|
|
2774
2806
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2775
2807
|
viewBox: "0 0 24 24",
|
|
2776
2808
|
fill: "currentColor",
|
|
2777
2809
|
className: "rte-editor-icon",
|
|
2778
|
-
children: /* @__PURE__ */ (0,
|
|
2810
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.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" })
|
|
2779
2811
|
}
|
|
2780
2812
|
)
|
|
2781
2813
|
}
|
|
2782
2814
|
)
|
|
2783
2815
|
}
|
|
2784
2816
|
),
|
|
2785
|
-
/* @__PURE__ */ (0,
|
|
2786
|
-
/* @__PURE__ */ (0,
|
|
2787
|
-
/* @__PURE__ */ (0,
|
|
2788
|
-
/* @__PURE__ */ (0,
|
|
2817
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(DialogContent, { children: [
|
|
2818
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(DialogHeader, { children: [
|
|
2819
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DialogTitle, { children: "Embed Tweet" }),
|
|
2820
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DialogDescription, { children: "Paste a tweet URL or ID." })
|
|
2789
2821
|
] }),
|
|
2790
|
-
/* @__PURE__ */ (0,
|
|
2822
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2791
2823
|
Input,
|
|
2792
2824
|
{
|
|
2793
2825
|
value: url,
|
|
@@ -2807,10 +2839,10 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2807
2839
|
}
|
|
2808
2840
|
}
|
|
2809
2841
|
),
|
|
2810
|
-
showError && /* @__PURE__ */ (0,
|
|
2811
|
-
/* @__PURE__ */ (0,
|
|
2812
|
-
/* @__PURE__ */ (0,
|
|
2813
|
-
/* @__PURE__ */ (0,
|
|
2842
|
+
showError && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "rte-input-error", role: "alert", children: "That doesn't look like a valid tweet URL or ID." }),
|
|
2843
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(DialogFooter, { children: [
|
|
2844
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DialogClose, { children: "Cancel" }),
|
|
2845
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2814
2846
|
"button",
|
|
2815
2847
|
{
|
|
2816
2848
|
type: "button",
|
|
@@ -2831,11 +2863,11 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2831
2863
|
);
|
|
2832
2864
|
};
|
|
2833
2865
|
|
|
2834
|
-
// src/controls/
|
|
2866
|
+
// src/controls/youtube-control.tsx
|
|
2835
2867
|
var import_core3 = require("@tiptap/core");
|
|
2836
|
-
var
|
|
2837
|
-
var
|
|
2838
|
-
var
|
|
2868
|
+
var import_react18 = require("@tiptap/react");
|
|
2869
|
+
var import_react19 = require("react");
|
|
2870
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2839
2871
|
var getYouTubeId = (url) => {
|
|
2840
2872
|
const clean = url.trim();
|
|
2841
2873
|
const patterns = [
|
|
@@ -2863,7 +2895,7 @@ var YouTubeNodeView = (props) => {
|
|
|
2863
2895
|
if (videoId) {
|
|
2864
2896
|
watchUrl = videoId.startsWith("http") ? videoId : `https://www.youtube.com/watch?v=${videoId}`;
|
|
2865
2897
|
}
|
|
2866
|
-
return /* @__PURE__ */ (0,
|
|
2898
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2867
2899
|
ResizableNodeView,
|
|
2868
2900
|
{
|
|
2869
2901
|
...props,
|
|
@@ -2874,7 +2906,7 @@ var YouTubeNodeView = (props) => {
|
|
|
2874
2906
|
videoSrc: rawSrc,
|
|
2875
2907
|
watchUrl,
|
|
2876
2908
|
onSrcChange: (newSrc) => updateAttributes({ src: newSrc }),
|
|
2877
|
-
children: /* @__PURE__ */ (0,
|
|
2909
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2878
2910
|
"iframe",
|
|
2879
2911
|
{
|
|
2880
2912
|
src: `https://www.youtube-nocookie.com/embed/${videoId}`,
|
|
@@ -2952,7 +2984,7 @@ var YouTubeEmbed = import_core3.Node.create({
|
|
|
2952
2984
|
];
|
|
2953
2985
|
},
|
|
2954
2986
|
addNodeView() {
|
|
2955
|
-
return (0,
|
|
2987
|
+
return (0, import_react18.ReactNodeViewRenderer)(YouTubeNodeView);
|
|
2956
2988
|
},
|
|
2957
2989
|
atom: true,
|
|
2958
2990
|
draggable: true,
|
|
@@ -2976,32 +3008,32 @@ var YouTubeEmbed = import_core3.Node.create({
|
|
|
2976
3008
|
});
|
|
2977
3009
|
var YouTubeEmbedControl = ({ className }) => {
|
|
2978
3010
|
const { editor } = useRichTextEditorContext();
|
|
2979
|
-
const [open, setOpen] = (0,
|
|
2980
|
-
const [url, setUrl] = (0,
|
|
2981
|
-
const { active } = (0,
|
|
3011
|
+
const [open, setOpen] = (0, import_react19.useState)(false);
|
|
3012
|
+
const [url, setUrl] = (0, import_react19.useState)("");
|
|
3013
|
+
const { active } = (0, import_react18.useEditorState)({
|
|
2982
3014
|
editor: editor ?? null,
|
|
2983
3015
|
selector: (ctx) => ({
|
|
2984
3016
|
active: ctx.editor && !ctx.editor.isDestroyed ? ctx.editor.isActive("youtube") : false
|
|
2985
3017
|
})
|
|
2986
3018
|
}) ?? { active: false };
|
|
2987
|
-
const handleInsert = (0,
|
|
3019
|
+
const handleInsert = (0, import_react19.useCallback)(() => {
|
|
2988
3020
|
if (url && editor) {
|
|
2989
3021
|
editor.chain().focus().setYouTubeEmbed(url).run();
|
|
2990
3022
|
setUrl("");
|
|
2991
3023
|
}
|
|
2992
3024
|
}, [url, editor]);
|
|
2993
|
-
return /* @__PURE__ */ (0,
|
|
2994
|
-
/* @__PURE__ */ (0,
|
|
3025
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Dialog, { open, onOpenChange: setOpen, children: [
|
|
3026
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2995
3027
|
DialogTrigger,
|
|
2996
3028
|
{
|
|
2997
|
-
render: /* @__PURE__ */ (0,
|
|
3029
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2998
3030
|
RichTextEditorControl,
|
|
2999
3031
|
{
|
|
3000
3032
|
active,
|
|
3001
3033
|
className,
|
|
3002
3034
|
title: "Embed YouTube video",
|
|
3003
3035
|
"aria-label": "Embed YouTube video",
|
|
3004
|
-
children: /* @__PURE__ */ (0,
|
|
3036
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
3005
3037
|
"svg",
|
|
3006
3038
|
{
|
|
3007
3039
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3013,8 +3045,8 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
3013
3045
|
strokeLinejoin: "round",
|
|
3014
3046
|
className: "rte-editor-icon",
|
|
3015
3047
|
children: [
|
|
3016
|
-
/* @__PURE__ */ (0,
|
|
3017
|
-
/* @__PURE__ */ (0,
|
|
3048
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.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" }),
|
|
3049
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "M9.5 15.5V8.5l6.2 3.5z" })
|
|
3018
3050
|
]
|
|
3019
3051
|
}
|
|
3020
3052
|
)
|
|
@@ -3022,12 +3054,12 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
3022
3054
|
)
|
|
3023
3055
|
}
|
|
3024
3056
|
),
|
|
3025
|
-
/* @__PURE__ */ (0,
|
|
3026
|
-
/* @__PURE__ */ (0,
|
|
3027
|
-
/* @__PURE__ */ (0,
|
|
3028
|
-
/* @__PURE__ */ (0,
|
|
3057
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(DialogContent, { showCloseButton: false, children: [
|
|
3058
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(DialogHeader, { children: [
|
|
3059
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DialogTitle, { children: "Embed YouTube video" }),
|
|
3060
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DialogDescription, { children: "Paste a YouTube video URL or ID." })
|
|
3029
3061
|
] }),
|
|
3030
|
-
/* @__PURE__ */ (0,
|
|
3062
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3031
3063
|
Input,
|
|
3032
3064
|
{
|
|
3033
3065
|
value: url,
|
|
@@ -3041,9 +3073,9 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
3041
3073
|
}
|
|
3042
3074
|
}
|
|
3043
3075
|
),
|
|
3044
|
-
/* @__PURE__ */ (0,
|
|
3045
|
-
/* @__PURE__ */ (0,
|
|
3046
|
-
/* @__PURE__ */ (0,
|
|
3076
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(DialogFooter, { children: [
|
|
3077
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DialogClose, { children: "Cancel" }),
|
|
3078
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3047
3079
|
DialogClose,
|
|
3048
3080
|
{
|
|
3049
3081
|
disabled: !url,
|
|
@@ -3057,7 +3089,7 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
3057
3089
|
] });
|
|
3058
3090
|
};
|
|
3059
3091
|
|
|
3060
|
-
// src/labels.ts
|
|
3092
|
+
// src/core/labels.ts
|
|
3061
3093
|
var DEFAULT_LABELS = {
|
|
3062
3094
|
alignCenterControlLabel: "Align center",
|
|
3063
3095
|
alignJustifyControlLabel: "Align justify",
|
|
@@ -3098,63 +3130,9 @@ var DEFAULT_LABELS = {
|
|
|
3098
3130
|
unlinkControlLabel: "Remove link"
|
|
3099
3131
|
};
|
|
3100
3132
|
|
|
3101
|
-
// src/
|
|
3102
|
-
var import_react19 = require("@tiptap/react");
|
|
3103
|
-
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3104
|
-
var Content = ({
|
|
3105
|
-
children,
|
|
3106
|
-
className
|
|
3107
|
-
}) => {
|
|
3108
|
-
const { editor, preset, variant } = useRichTextEditorContext();
|
|
3109
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "relative", children: [
|
|
3110
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3111
|
-
import_react19.EditorContent,
|
|
3112
|
-
{
|
|
3113
|
-
editor,
|
|
3114
|
-
className: cn(
|
|
3115
|
-
"rte-content editorcn-content w-full",
|
|
3116
|
-
variant === "default" && "rounded-lg border border-(--rte-hairline) bg-[var(--card,var(--background))]",
|
|
3117
|
-
className
|
|
3118
|
-
),
|
|
3119
|
-
"data-preset": preset,
|
|
3120
|
-
spellCheck: false
|
|
3121
|
-
}
|
|
3122
|
-
),
|
|
3123
|
-
children
|
|
3124
|
-
] });
|
|
3125
|
-
};
|
|
3126
|
-
|
|
3127
|
-
// src/rte-controls-group.tsx
|
|
3133
|
+
// src/footer.tsx
|
|
3128
3134
|
var import_react20 = require("react");
|
|
3129
3135
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3130
|
-
var SEPARATOR = "[.rte-controls-group+&]:before:w-px [.rte-controls-group+&]:before:shrink-0 [.rte-controls-group+&]:before:bg-border [.rte-controls-group+&]:before:content-['']";
|
|
3131
|
-
var BUTTON = "[&>button]:border-none [&>button]:bg-transparent [&>button]:transition-[background-color,color] [&>button]:duration-150 [&>button]:ease-[ease-out] [&>button:focus-visible]:outline-2 [&>button:focus-visible]:outline-offset-1 [&>button:focus-visible]:outline-ring/50 [&>button:focus-visible]:outline-solid";
|
|
3132
|
-
var variantClasses = {
|
|
3133
|
-
compact: `${SEPARATOR} [.rte-controls-group+&]:before:mx-0.5 [.rte-controls-group+&]:before:h-3.5 ${BUTTON} [&>button]:h-7 [&>button]:min-w-7 [&>button]:rounded-sm [&>button]:text-muted-foreground [&>button:hover]:bg-muted [&>button:hover]:text-foreground [&>button[aria-pressed=true]]:bg-muted [&>button[aria-pressed=true]]:text-foreground [&>button[data-state=on]]:bg-muted [&>button[data-state=on]]:text-foreground`,
|
|
3134
|
-
default: `gap-0.5 ${SEPARATOR} [.rte-controls-group+&]:before:mx-1 [.rte-controls-group+&]:before:h-4 ${BUTTON} [&>button]:h-8 [&>button]:min-w-8 [&>button]:rounded-md [&>button]:text-foreground [&>button:disabled]:cursor-not-allowed [&>button:disabled]:opacity-40 [&>button:hover:not(:disabled)]:bg-foreground/5 [&>button:hover:not(:disabled)]:text-foreground [&>button[aria-pressed=true]]:bg-foreground/8 [&>button[aria-pressed=true]]:text-foreground [&>button[data-state=on]]:bg-foreground/8 [&>button[data-state=on]]:text-foreground`,
|
|
3135
|
-
subtle: `${SEPARATOR} [.rte-controls-group+&]:before:mx-1 [.rte-controls-group+&]:before:h-4 ${BUTTON} [&>button]:h-8 [&>button]:min-w-8 [&>button]:rounded-md [&>button]:text-muted-foreground [&>button:hover]:bg-muted [&>button:hover]:text-foreground [&>button[aria-pressed=true]]:bg-muted [&>button[aria-pressed=true]]:text-foreground [&>button[data-state=on]]:bg-muted [&>button[data-state=on]]:text-foreground`
|
|
3136
|
-
};
|
|
3137
|
-
var ControlsGroup = ({
|
|
3138
|
-
children,
|
|
3139
|
-
className
|
|
3140
|
-
}) => {
|
|
3141
|
-
const variant = (0, import_react20.useContext)(RichTextEditorContext)?.variant;
|
|
3142
|
-
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3143
|
-
"div",
|
|
3144
|
-
{
|
|
3145
|
-
className: cn(
|
|
3146
|
-
"rte-controls-group flex items-center empty:hidden",
|
|
3147
|
-
variant && variantClasses[variant],
|
|
3148
|
-
className
|
|
3149
|
-
),
|
|
3150
|
-
children
|
|
3151
|
-
}
|
|
3152
|
-
);
|
|
3153
|
-
};
|
|
3154
|
-
|
|
3155
|
-
// src/rte-footer.tsx
|
|
3156
|
-
var import_react21 = require("react");
|
|
3157
|
-
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3158
3136
|
var Footer = ({
|
|
3159
3137
|
children,
|
|
3160
3138
|
className,
|
|
@@ -3165,9 +3143,9 @@ var Footer = ({
|
|
|
3165
3143
|
wordCountFormatter
|
|
3166
3144
|
}) => {
|
|
3167
3145
|
const { editor, variant } = useRichTextEditorContext();
|
|
3168
|
-
const [, forceUpdate] = (0,
|
|
3169
|
-
const rafRef = (0,
|
|
3170
|
-
(0,
|
|
3146
|
+
const [, forceUpdate] = (0, import_react20.useState)(0);
|
|
3147
|
+
const rafRef = (0, import_react20.useRef)(null);
|
|
3148
|
+
(0, import_react20.useEffect)(() => {
|
|
3171
3149
|
if (!editor || !showWordCount) {
|
|
3172
3150
|
return;
|
|
3173
3151
|
}
|
|
@@ -3196,7 +3174,7 @@ var Footer = ({
|
|
|
3196
3174
|
}
|
|
3197
3175
|
};
|
|
3198
3176
|
}, [editor, showWordCount]);
|
|
3199
|
-
const wordCount = (0,
|
|
3177
|
+
const wordCount = (0, import_react20.useMemo)(() => {
|
|
3200
3178
|
if (!editor || !showWordCount) {
|
|
3201
3179
|
return null;
|
|
3202
3180
|
}
|
|
@@ -3213,7 +3191,7 @@ var Footer = ({
|
|
|
3213
3191
|
if (!showWordCount && !children) {
|
|
3214
3192
|
return null;
|
|
3215
3193
|
}
|
|
3216
|
-
return /* @__PURE__ */ (0,
|
|
3194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
3217
3195
|
"div",
|
|
3218
3196
|
{
|
|
3219
3197
|
className: cn(
|
|
@@ -3227,28 +3205,28 @@ var Footer = ({
|
|
|
3227
3205
|
"data-sticky": sticky ? "" : void 0,
|
|
3228
3206
|
style: sticky ? { bottom: stickyOffset } : void 0,
|
|
3229
3207
|
children: [
|
|
3230
|
-
showWordCount && wordCount && /* @__PURE__ */ (0,
|
|
3208
|
+
showWordCount && wordCount && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3231
3209
|
"span",
|
|
3232
3210
|
{
|
|
3233
3211
|
className: cn(
|
|
3234
3212
|
"rte-footer-word-count inline-flex items-center gap-1.5 text-[0.75rem] whitespace-nowrap",
|
|
3235
3213
|
wordCountClassName
|
|
3236
3214
|
),
|
|
3237
|
-
children: wordCountFormatter ? wordCountFormatter(wordCount) : /* @__PURE__ */ (0,
|
|
3238
|
-
/* @__PURE__ */ (0,
|
|
3239
|
-
/* @__PURE__ */ (0,
|
|
3240
|
-
/* @__PURE__ */ (0,
|
|
3215
|
+
children: wordCountFormatter ? wordCountFormatter(wordCount) : /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
3216
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "rte-footer-word-count-stat inline-flex items-baseline gap-1", children: [
|
|
3217
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "rte-footer-word-count-number font-medium text-foreground tabular-nums", children: wordCount.words }),
|
|
3218
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "rte-footer-word-count-unit text-muted-foreground", children: "words" })
|
|
3241
3219
|
] }),
|
|
3242
|
-
/* @__PURE__ */ (0,
|
|
3220
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3243
3221
|
"span",
|
|
3244
3222
|
{
|
|
3245
3223
|
className: "rte-footer-word-count-separator size-[3px] shrink-0 rounded-full bg-[color-mix(in_srgb,var(--muted-foreground)_45%,transparent)]",
|
|
3246
3224
|
"aria-hidden": "true"
|
|
3247
3225
|
}
|
|
3248
3226
|
),
|
|
3249
|
-
/* @__PURE__ */ (0,
|
|
3250
|
-
/* @__PURE__ */ (0,
|
|
3251
|
-
/* @__PURE__ */ (0,
|
|
3227
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "rte-footer-word-count-stat inline-flex items-baseline gap-1", children: [
|
|
3228
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "rte-footer-word-count-number font-medium text-foreground tabular-nums", children: wordCount.characters }),
|
|
3229
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "rte-footer-word-count-unit text-muted-foreground", children: "characters" })
|
|
3252
3230
|
] })
|
|
3253
3231
|
] })
|
|
3254
3232
|
}
|
|
@@ -3259,8 +3237,79 @@ var Footer = ({
|
|
|
3259
3237
|
);
|
|
3260
3238
|
};
|
|
3261
3239
|
|
|
3262
|
-
// src/
|
|
3240
|
+
// src/toolbar/controls-group.tsx
|
|
3241
|
+
var import_react21 = require("react");
|
|
3242
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3243
|
+
var SEPARATOR = "[.rte-controls-group+&]:before:w-px [.rte-controls-group+&]:before:shrink-0 [.rte-controls-group+&]:before:bg-border [.rte-controls-group+&]:before:content-[''] [.rte-controls-group+&]:data-line-start:before:invisible";
|
|
3244
|
+
var BUTTON = "[&>button]:border-none [&>button]:bg-transparent [&>button]:transition-[background-color,color] [&>button]:duration-150 [&>button]:ease-[ease-out] [&>button:focus-visible]:outline-2 [&>button:focus-visible]:outline-offset-1 [&>button:focus-visible]:outline-ring/50 [&>button:focus-visible]:outline-solid";
|
|
3245
|
+
var variantClasses = {
|
|
3246
|
+
compact: `${SEPARATOR} [.rte-controls-group+&]:before:mx-0.5 [.rte-controls-group+&]:before:h-3.5 ${BUTTON} [&>button]:h-7 [&>button]:min-w-7 [&>button]:rounded-sm [&>button]:text-muted-foreground [&>button:hover]:bg-muted [&>button:hover]:text-foreground [&>button[aria-pressed=true]]:bg-muted [&>button[aria-pressed=true]]:text-foreground [&>button[data-state=on]]:bg-muted [&>button[data-state=on]]:text-foreground`,
|
|
3247
|
+
default: `gap-0.5 ${SEPARATOR} [.rte-controls-group+&]:before:mx-1 [.rte-controls-group+&]:before:h-4 ${BUTTON} [&>button]:h-8 [&>button]:min-w-8 [&>button]:rounded-md [&>button]:text-foreground [&>button:disabled]:cursor-not-allowed [&>button:disabled]:opacity-40 [&>button:hover:not(:disabled)]:bg-foreground/5 [&>button:hover:not(:disabled)]:text-foreground [&>button[aria-pressed=true]]:bg-foreground/8 [&>button[aria-pressed=true]]:text-foreground [&>button[data-state=on]]:bg-foreground/8 [&>button[data-state=on]]:text-foreground`,
|
|
3248
|
+
subtle: `${SEPARATOR} [.rte-controls-group+&]:before:mx-1 [.rte-controls-group+&]:before:h-4 ${BUTTON} [&>button]:h-8 [&>button]:min-w-8 [&>button]:rounded-md [&>button]:text-muted-foreground [&>button:hover]:bg-muted [&>button:hover]:text-foreground [&>button[aria-pressed=true]]:bg-muted [&>button[aria-pressed=true]]:text-foreground [&>button[data-state=on]]:bg-muted [&>button[data-state=on]]:text-foreground`
|
|
3249
|
+
};
|
|
3250
|
+
var ControlsGroup = ({
|
|
3251
|
+
children,
|
|
3252
|
+
className
|
|
3253
|
+
}) => {
|
|
3254
|
+
const variant = (0, import_react21.useContext)(RichTextEditorContext)?.variant;
|
|
3255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3256
|
+
"div",
|
|
3257
|
+
{
|
|
3258
|
+
className: cn(
|
|
3259
|
+
"rte-controls-group flex items-center empty:hidden",
|
|
3260
|
+
variant && variantClasses[variant],
|
|
3261
|
+
className
|
|
3262
|
+
),
|
|
3263
|
+
children
|
|
3264
|
+
}
|
|
3265
|
+
);
|
|
3266
|
+
};
|
|
3267
|
+
|
|
3268
|
+
// src/toolbar/toolbar.tsx
|
|
3269
|
+
var import_react22 = require("react");
|
|
3263
3270
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
3271
|
+
var GROUPS = ":scope > .rte-controls-group";
|
|
3272
|
+
var useMarkLineStarts = (enabled) => {
|
|
3273
|
+
const ref = (0, import_react22.useRef)(null);
|
|
3274
|
+
(0, import_react22.useLayoutEffect)(() => {
|
|
3275
|
+
const toolbar = ref.current;
|
|
3276
|
+
if (!enabled || !toolbar || typeof ResizeObserver === "undefined") {
|
|
3277
|
+
return;
|
|
3278
|
+
}
|
|
3279
|
+
const mark = () => {
|
|
3280
|
+
let previous = null;
|
|
3281
|
+
for (const group of toolbar.querySelectorAll(GROUPS)) {
|
|
3282
|
+
if (group.getClientRects().length === 0) {
|
|
3283
|
+
continue;
|
|
3284
|
+
}
|
|
3285
|
+
const rect = group.getBoundingClientRect();
|
|
3286
|
+
const startsLine = previous !== null && rect.top >= previous.bottom - 1;
|
|
3287
|
+
group.toggleAttribute("data-line-start", startsLine);
|
|
3288
|
+
previous = rect;
|
|
3289
|
+
}
|
|
3290
|
+
};
|
|
3291
|
+
const resize = new ResizeObserver(mark);
|
|
3292
|
+
const observeAll = () => {
|
|
3293
|
+
resize.disconnect();
|
|
3294
|
+
resize.observe(toolbar);
|
|
3295
|
+
for (const group of toolbar.querySelectorAll(GROUPS)) {
|
|
3296
|
+
resize.observe(group);
|
|
3297
|
+
}
|
|
3298
|
+
};
|
|
3299
|
+
const mutation = new MutationObserver(() => {
|
|
3300
|
+
observeAll();
|
|
3301
|
+
mark();
|
|
3302
|
+
});
|
|
3303
|
+
mutation.observe(toolbar, { childList: true });
|
|
3304
|
+
observeAll();
|
|
3305
|
+
mark();
|
|
3306
|
+
return () => {
|
|
3307
|
+
resize.disconnect();
|
|
3308
|
+
mutation.disconnect();
|
|
3309
|
+
};
|
|
3310
|
+
}, [enabled]);
|
|
3311
|
+
return ref;
|
|
3312
|
+
};
|
|
3264
3313
|
var Toolbar = ({
|
|
3265
3314
|
children,
|
|
3266
3315
|
className,
|
|
@@ -3268,12 +3317,14 @@ var Toolbar = ({
|
|
|
3268
3317
|
stickyOffset = 0
|
|
3269
3318
|
}) => {
|
|
3270
3319
|
const { variant, editable } = useRichTextEditorContext();
|
|
3320
|
+
const ref = useMarkLineStarts(editable);
|
|
3271
3321
|
if (!editable) {
|
|
3272
3322
|
return null;
|
|
3273
3323
|
}
|
|
3274
3324
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3275
3325
|
"div",
|
|
3276
3326
|
{
|
|
3327
|
+
ref,
|
|
3277
3328
|
className: cn(
|
|
3278
3329
|
"rte-toolbar top-[var(--rte-sticky-offset,0px)] z-1 flex flex-wrap items-center justify-center gap-1 rounded-ss-[calc(var(--radius)+3px)] rounded-se-[calc(var(--radius)+3px)] border-b border-(--rte-hairline) bg-(--rte-strip) px-2 py-1.5 [transition:background-color_150ms_ease-out]",
|
|
3279
3330
|
"[@media(max-width:640px)]:justify-start [@media(max-width:640px)]:flex-nowrap [@media(max-width:640px)]:overflow-x-auto [@media(max-width:640px)]:[--rte-toolbar-fade-end:1.5rem] [@media(max-width:640px)]:[-ms-overflow-style:none] [@media(max-width:640px)]:[-webkit-overflow-scrolling:touch] [@media(max-width:640px)]:[mask-image:linear-gradient(to_right,transparent,black_var(--rte-toolbar-fade-start),black_calc(100%-var(--rte-toolbar-fade-end)),transparent)] [@media(max-width:640px)]:[scrollbar-width:none] [@media(max-width:640px)]:[&::-webkit-scrollbar]:hidden [@media(max-width:640px)]:supports-[animation-timeline:scroll()]:[--rte-toolbar-fade-end:0px] [@media(max-width:640px)]:supports-[animation-timeline:scroll()]:animate-rte-toolbar-fade [@media(max-width:640px)]:supports-[animation-timeline:scroll()]:[animation-timeline:scroll(self_inline)]",
|
|
@@ -3292,7 +3343,7 @@ var Toolbar = ({
|
|
|
3292
3343
|
);
|
|
3293
3344
|
};
|
|
3294
3345
|
|
|
3295
|
-
// src/
|
|
3346
|
+
// src/rich-text-editor.tsx
|
|
3296
3347
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3297
3348
|
var RichTextEditorRoot = ({
|
|
3298
3349
|
editor,
|
|
@@ -3304,13 +3355,13 @@ var RichTextEditorRoot = ({
|
|
|
3304
3355
|
preset = "document",
|
|
3305
3356
|
editable = true
|
|
3306
3357
|
}) => {
|
|
3307
|
-
const mergedLabels = (0,
|
|
3358
|
+
const mergedLabels = (0, import_react23.useMemo)(
|
|
3308
3359
|
() => ({ ...DEFAULT_LABELS, ...labels }),
|
|
3309
3360
|
[labels]
|
|
3310
3361
|
);
|
|
3311
|
-
const mergedIcons = (0,
|
|
3312
|
-
const [tooltip] = (0,
|
|
3313
|
-
(0,
|
|
3362
|
+
const mergedIcons = (0, import_react23.useMemo)(() => ({ ...DEFAULT_ICONS, ...icons }), [icons]);
|
|
3363
|
+
const [tooltip] = (0, import_react23.useState)(createTooltipHandle);
|
|
3364
|
+
(0, import_react23.useEffect)(() => {
|
|
3314
3365
|
if (editor && editor.isEditable !== editable) {
|
|
3315
3366
|
editor.setEditable(editable);
|
|
3316
3367
|
}
|