@react-email/editor 0.0.0-experimental.30 → 0.0.0-experimental.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/index.d.cts +1 -1
- package/dist/core/index.d.mts +1 -1
- package/dist/core-mUMTkab3.mjs.map +1 -1
- package/dist/extensions/index.d.cts +1 -1
- package/dist/extensions/index.d.cts.map +1 -1
- package/dist/extensions/index.d.mts +1 -1
- package/dist/{index-ozCcANmD.d.mts → index-BrSAA0dn.d.mts} +2 -2
- package/dist/index-BrSAA0dn.d.mts.map +1 -0
- package/dist/{index-jGyVEd5q.d.cts → index-CVRlPqX_.d.cts} +2 -2
- package/dist/index-CVRlPqX_.d.cts.map +1 -0
- package/dist/plugins/index.cjs +41 -6
- package/dist/plugins/index.d.cts +4 -3
- package/dist/plugins/index.d.cts.map +1 -1
- package/dist/plugins/index.d.mts +4 -3
- package/dist/plugins/index.d.mts.map +1 -1
- package/dist/plugins/index.mjs +41 -6
- package/dist/plugins/index.mjs.map +1 -1
- package/dist/ui/button-bubble-menu/button-bubble-menu.css +37 -3
- package/dist/ui/index.cjs +964 -51
- package/dist/ui/index.d.cts +409 -49
- package/dist/ui/index.d.cts.map +1 -1
- package/dist/ui/index.d.mts +409 -49
- package/dist/ui/index.d.mts.map +1 -1
- package/dist/ui/index.mjs +890 -10
- package/dist/ui/index.mjs.map +1 -1
- package/dist/ui/link-bubble-menu/link-bubble-menu.css +8 -6
- package/dist/ui/themes/default.css +102 -14
- package/package.json +3 -4
- package/dist/index-jGyVEd5q.d.cts.map +0 -1
- package/dist/index-ozCcANmD.d.mts.map +0 -1
package/dist/ui/index.mjs
CHANGED
|
@@ -5,13 +5,736 @@ import { useCurrentEditor, useEditorState } from "@tiptap/react";
|
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
7
7
|
import { PluginKey } from "@tiptap/pm/state";
|
|
8
|
-
import { AlignCenterIcon, AlignLeftIcon, AlignRightIcon, BoldIcon, CaseUpperIcon, Check, ChevronDown, Code, CodeIcon, Columns2, Columns3, Columns4, ExternalLinkIcon, Heading1, Heading2, Heading3, ItalicIcon, LinkIcon, List, ListOrdered, MousePointer, PencilIcon, Rows2, SplitSquareVertical, SquareCode, StrikethroughIcon, Text, TextIcon, TextQuote, UnderlineIcon, UnlinkIcon } from "lucide-react";
|
|
9
8
|
import * as Popover from "@radix-ui/react-popover";
|
|
10
9
|
import { BubbleMenu as BubbleMenu$1 } from "@tiptap/react/menus";
|
|
11
10
|
import { autoUpdate, flip, offset, shift, useFloating } from "@floating-ui/react-dom";
|
|
12
11
|
import Suggestion from "@tiptap/suggestion";
|
|
13
12
|
import { createPortal } from "react-dom";
|
|
14
13
|
|
|
14
|
+
//#region src/ui/icons/align-center.tsx
|
|
15
|
+
function AlignCenterIcon({ size, width, height, ...props }) {
|
|
16
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
17
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18
|
+
width: size ?? width ?? 24,
|
|
19
|
+
height: size ?? height ?? 24,
|
|
20
|
+
viewBox: "0 0 24 24",
|
|
21
|
+
fill: "none",
|
|
22
|
+
stroke: "currentColor",
|
|
23
|
+
strokeWidth: 2,
|
|
24
|
+
strokeLinecap: "round",
|
|
25
|
+
strokeLinejoin: "round",
|
|
26
|
+
"aria-hidden": "true",
|
|
27
|
+
...props,
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ jsx("path", { d: "M21 5H3" }),
|
|
30
|
+
/* @__PURE__ */ jsx("path", { d: "M17 12H7" }),
|
|
31
|
+
/* @__PURE__ */ jsx("path", { d: "M19 19H5" })
|
|
32
|
+
]
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/ui/icons/align-left.tsx
|
|
38
|
+
function AlignLeftIcon({ size, width, height, ...props }) {
|
|
39
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
40
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
41
|
+
width: size ?? width ?? 24,
|
|
42
|
+
height: size ?? height ?? 24,
|
|
43
|
+
viewBox: "0 0 24 24",
|
|
44
|
+
fill: "none",
|
|
45
|
+
stroke: "currentColor",
|
|
46
|
+
strokeWidth: 2,
|
|
47
|
+
strokeLinecap: "round",
|
|
48
|
+
strokeLinejoin: "round",
|
|
49
|
+
"aria-hidden": "true",
|
|
50
|
+
...props,
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ jsx("path", { d: "M21 5H3" }),
|
|
53
|
+
/* @__PURE__ */ jsx("path", { d: "M15 12H3" }),
|
|
54
|
+
/* @__PURE__ */ jsx("path", { d: "M17 19H3" })
|
|
55
|
+
]
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/ui/icons/align-right.tsx
|
|
61
|
+
function AlignRightIcon({ size, width, height, ...props }) {
|
|
62
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
63
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
64
|
+
width: size ?? width ?? 24,
|
|
65
|
+
height: size ?? height ?? 24,
|
|
66
|
+
viewBox: "0 0 24 24",
|
|
67
|
+
fill: "none",
|
|
68
|
+
stroke: "currentColor",
|
|
69
|
+
strokeWidth: 2,
|
|
70
|
+
strokeLinecap: "round",
|
|
71
|
+
strokeLinejoin: "round",
|
|
72
|
+
"aria-hidden": "true",
|
|
73
|
+
...props,
|
|
74
|
+
children: [
|
|
75
|
+
/* @__PURE__ */ jsx("path", { d: "M21 5H3" }),
|
|
76
|
+
/* @__PURE__ */ jsx("path", { d: "M21 12H9" }),
|
|
77
|
+
/* @__PURE__ */ jsx("path", { d: "M21 19H7" })
|
|
78
|
+
]
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/ui/icons/bold.tsx
|
|
84
|
+
function BoldIcon({ size, width, height, ...props }) {
|
|
85
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
86
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
87
|
+
width: size ?? width ?? 24,
|
|
88
|
+
height: size ?? height ?? 24,
|
|
89
|
+
viewBox: "0 0 24 24",
|
|
90
|
+
fill: "none",
|
|
91
|
+
stroke: "currentColor",
|
|
92
|
+
strokeWidth: 2,
|
|
93
|
+
strokeLinecap: "round",
|
|
94
|
+
strokeLinejoin: "round",
|
|
95
|
+
"aria-hidden": "true",
|
|
96
|
+
...props,
|
|
97
|
+
children: /* @__PURE__ */ jsx("path", { d: "M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8" })
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/ui/icons/case-upper.tsx
|
|
103
|
+
function CaseUpperIcon({ size, width, height, ...props }) {
|
|
104
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
105
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
106
|
+
width: size ?? width ?? 24,
|
|
107
|
+
height: size ?? height ?? 24,
|
|
108
|
+
viewBox: "0 0 24 24",
|
|
109
|
+
fill: "none",
|
|
110
|
+
stroke: "currentColor",
|
|
111
|
+
strokeWidth: 2,
|
|
112
|
+
strokeLinecap: "round",
|
|
113
|
+
strokeLinejoin: "round",
|
|
114
|
+
"aria-hidden": "true",
|
|
115
|
+
...props,
|
|
116
|
+
children: [
|
|
117
|
+
/* @__PURE__ */ jsx("path", { d: "M15 11h4.5a1 1 0 0 1 0 5h-4a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h3a1 1 0 0 1 0 5" }),
|
|
118
|
+
/* @__PURE__ */ jsx("path", { d: "m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16" }),
|
|
119
|
+
/* @__PURE__ */ jsx("path", { d: "M3.304 13h6.392" })
|
|
120
|
+
]
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/ui/icons/check.tsx
|
|
126
|
+
function Check({ size, width, height, ...props }) {
|
|
127
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
128
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
129
|
+
width: size ?? width ?? 24,
|
|
130
|
+
height: size ?? height ?? 24,
|
|
131
|
+
viewBox: "0 0 24 24",
|
|
132
|
+
fill: "none",
|
|
133
|
+
stroke: "currentColor",
|
|
134
|
+
strokeWidth: 2,
|
|
135
|
+
strokeLinecap: "round",
|
|
136
|
+
strokeLinejoin: "round",
|
|
137
|
+
"aria-hidden": "true",
|
|
138
|
+
...props,
|
|
139
|
+
children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" })
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region src/ui/icons/chevron-down.tsx
|
|
145
|
+
function ChevronDown({ size, width, height, ...props }) {
|
|
146
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
147
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
148
|
+
width: size ?? width ?? 24,
|
|
149
|
+
height: size ?? height ?? 24,
|
|
150
|
+
viewBox: "0 0 24 24",
|
|
151
|
+
fill: "none",
|
|
152
|
+
stroke: "currentColor",
|
|
153
|
+
strokeWidth: 2,
|
|
154
|
+
strokeLinecap: "round",
|
|
155
|
+
strokeLinejoin: "round",
|
|
156
|
+
"aria-hidden": "true",
|
|
157
|
+
...props,
|
|
158
|
+
children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" })
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
//#endregion
|
|
163
|
+
//#region src/ui/icons/code.tsx
|
|
164
|
+
function CodeIcon({ size, width, height, ...props }) {
|
|
165
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
166
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
167
|
+
width: size ?? width ?? 24,
|
|
168
|
+
height: size ?? height ?? 24,
|
|
169
|
+
viewBox: "0 0 24 24",
|
|
170
|
+
fill: "none",
|
|
171
|
+
stroke: "currentColor",
|
|
172
|
+
strokeWidth: 2,
|
|
173
|
+
strokeLinecap: "round",
|
|
174
|
+
strokeLinejoin: "round",
|
|
175
|
+
"aria-hidden": "true",
|
|
176
|
+
...props,
|
|
177
|
+
children: [/* @__PURE__ */ jsx("path", { d: "m16 18 6-6-6-6" }), /* @__PURE__ */ jsx("path", { d: "m8 6-6 6 6 6" })]
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
const Code = CodeIcon;
|
|
181
|
+
|
|
182
|
+
//#endregion
|
|
183
|
+
//#region src/ui/icons/columns-2.tsx
|
|
184
|
+
function Columns2({ size, width, height, ...props }) {
|
|
185
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
186
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
187
|
+
width: size ?? width ?? 24,
|
|
188
|
+
height: size ?? height ?? 24,
|
|
189
|
+
viewBox: "0 0 24 24",
|
|
190
|
+
fill: "none",
|
|
191
|
+
stroke: "currentColor",
|
|
192
|
+
strokeWidth: 2,
|
|
193
|
+
strokeLinecap: "round",
|
|
194
|
+
strokeLinejoin: "round",
|
|
195
|
+
"aria-hidden": "true",
|
|
196
|
+
...props,
|
|
197
|
+
children: [/* @__PURE__ */ jsx("rect", {
|
|
198
|
+
width: "18",
|
|
199
|
+
height: "18",
|
|
200
|
+
x: "3",
|
|
201
|
+
y: "3",
|
|
202
|
+
rx: "2"
|
|
203
|
+
}), /* @__PURE__ */ jsx("path", { d: "M12 3v18" })]
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
//#endregion
|
|
208
|
+
//#region src/ui/icons/columns-3.tsx
|
|
209
|
+
function Columns3({ size, width, height, ...props }) {
|
|
210
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
211
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
212
|
+
width: size ?? width ?? 24,
|
|
213
|
+
height: size ?? height ?? 24,
|
|
214
|
+
viewBox: "0 0 24 24",
|
|
215
|
+
fill: "none",
|
|
216
|
+
stroke: "currentColor",
|
|
217
|
+
strokeWidth: 2,
|
|
218
|
+
strokeLinecap: "round",
|
|
219
|
+
strokeLinejoin: "round",
|
|
220
|
+
"aria-hidden": "true",
|
|
221
|
+
...props,
|
|
222
|
+
children: [
|
|
223
|
+
/* @__PURE__ */ jsx("rect", {
|
|
224
|
+
width: "18",
|
|
225
|
+
height: "18",
|
|
226
|
+
x: "3",
|
|
227
|
+
y: "3",
|
|
228
|
+
rx: "2"
|
|
229
|
+
}),
|
|
230
|
+
/* @__PURE__ */ jsx("path", { d: "M9 3v18" }),
|
|
231
|
+
/* @__PURE__ */ jsx("path", { d: "M15 3v18" })
|
|
232
|
+
]
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
//#endregion
|
|
237
|
+
//#region src/ui/icons/columns-4.tsx
|
|
238
|
+
function Columns4({ size, width, height, ...props }) {
|
|
239
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
240
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
241
|
+
width: size ?? width ?? 24,
|
|
242
|
+
height: size ?? height ?? 24,
|
|
243
|
+
viewBox: "0 0 24 24",
|
|
244
|
+
fill: "none",
|
|
245
|
+
stroke: "currentColor",
|
|
246
|
+
strokeWidth: 2,
|
|
247
|
+
strokeLinecap: "round",
|
|
248
|
+
strokeLinejoin: "round",
|
|
249
|
+
"aria-hidden": "true",
|
|
250
|
+
...props,
|
|
251
|
+
children: [
|
|
252
|
+
/* @__PURE__ */ jsx("rect", {
|
|
253
|
+
width: "18",
|
|
254
|
+
height: "18",
|
|
255
|
+
x: "3",
|
|
256
|
+
y: "3",
|
|
257
|
+
rx: "2"
|
|
258
|
+
}),
|
|
259
|
+
/* @__PURE__ */ jsx("path", { d: "M7.5 3v18" }),
|
|
260
|
+
/* @__PURE__ */ jsx("path", { d: "M12 3v18" }),
|
|
261
|
+
/* @__PURE__ */ jsx("path", { d: "M16.5 3v18" })
|
|
262
|
+
]
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
//#endregion
|
|
267
|
+
//#region src/ui/icons/external-link.tsx
|
|
268
|
+
function ExternalLinkIcon({ size, width, height, ...props }) {
|
|
269
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
270
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
271
|
+
width: size ?? width ?? 24,
|
|
272
|
+
height: size ?? height ?? 24,
|
|
273
|
+
viewBox: "0 0 24 24",
|
|
274
|
+
fill: "none",
|
|
275
|
+
stroke: "currentColor",
|
|
276
|
+
strokeWidth: 2,
|
|
277
|
+
strokeLinecap: "round",
|
|
278
|
+
strokeLinejoin: "round",
|
|
279
|
+
"aria-hidden": "true",
|
|
280
|
+
...props,
|
|
281
|
+
children: [
|
|
282
|
+
/* @__PURE__ */ jsx("path", { d: "M15 3h6v6" }),
|
|
283
|
+
/* @__PURE__ */ jsx("path", { d: "M10 14 21 3" }),
|
|
284
|
+
/* @__PURE__ */ jsx("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" })
|
|
285
|
+
]
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
//#endregion
|
|
290
|
+
//#region src/ui/icons/heading-1.tsx
|
|
291
|
+
function Heading1({ size, width, height, ...props }) {
|
|
292
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
293
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
294
|
+
width: size ?? width ?? 24,
|
|
295
|
+
height: size ?? height ?? 24,
|
|
296
|
+
viewBox: "0 0 24 24",
|
|
297
|
+
fill: "none",
|
|
298
|
+
stroke: "currentColor",
|
|
299
|
+
strokeWidth: 2,
|
|
300
|
+
strokeLinecap: "round",
|
|
301
|
+
strokeLinejoin: "round",
|
|
302
|
+
"aria-hidden": "true",
|
|
303
|
+
...props,
|
|
304
|
+
children: [
|
|
305
|
+
/* @__PURE__ */ jsx("path", { d: "M4 12h8" }),
|
|
306
|
+
/* @__PURE__ */ jsx("path", { d: "M4 18V6" }),
|
|
307
|
+
/* @__PURE__ */ jsx("path", { d: "M12 18V6" }),
|
|
308
|
+
/* @__PURE__ */ jsx("path", { d: "m17 12 3-2v8" })
|
|
309
|
+
]
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
//#endregion
|
|
314
|
+
//#region src/ui/icons/heading-2.tsx
|
|
315
|
+
function Heading2({ size, width, height, ...props }) {
|
|
316
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
317
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
318
|
+
width: size ?? width ?? 24,
|
|
319
|
+
height: size ?? height ?? 24,
|
|
320
|
+
viewBox: "0 0 24 24",
|
|
321
|
+
fill: "none",
|
|
322
|
+
stroke: "currentColor",
|
|
323
|
+
strokeWidth: 2,
|
|
324
|
+
strokeLinecap: "round",
|
|
325
|
+
strokeLinejoin: "round",
|
|
326
|
+
"aria-hidden": "true",
|
|
327
|
+
...props,
|
|
328
|
+
children: [
|
|
329
|
+
/* @__PURE__ */ jsx("path", { d: "M4 12h8" }),
|
|
330
|
+
/* @__PURE__ */ jsx("path", { d: "M4 18V6" }),
|
|
331
|
+
/* @__PURE__ */ jsx("path", { d: "M12 18V6" }),
|
|
332
|
+
/* @__PURE__ */ jsx("path", { d: "M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1" })
|
|
333
|
+
]
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
//#endregion
|
|
338
|
+
//#region src/ui/icons/heading-3.tsx
|
|
339
|
+
function Heading3({ size, width, height, ...props }) {
|
|
340
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
341
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
342
|
+
width: size ?? width ?? 24,
|
|
343
|
+
height: size ?? height ?? 24,
|
|
344
|
+
viewBox: "0 0 24 24",
|
|
345
|
+
fill: "none",
|
|
346
|
+
stroke: "currentColor",
|
|
347
|
+
strokeWidth: 2,
|
|
348
|
+
strokeLinecap: "round",
|
|
349
|
+
strokeLinejoin: "round",
|
|
350
|
+
"aria-hidden": "true",
|
|
351
|
+
...props,
|
|
352
|
+
children: [
|
|
353
|
+
/* @__PURE__ */ jsx("path", { d: "M4 12h8" }),
|
|
354
|
+
/* @__PURE__ */ jsx("path", { d: "M4 18V6" }),
|
|
355
|
+
/* @__PURE__ */ jsx("path", { d: "M12 18V6" }),
|
|
356
|
+
/* @__PURE__ */ jsx("path", { d: "M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2" }),
|
|
357
|
+
/* @__PURE__ */ jsx("path", { d: "M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2" })
|
|
358
|
+
]
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
//#endregion
|
|
363
|
+
//#region src/ui/icons/italic.tsx
|
|
364
|
+
function ItalicIcon({ size, width, height, ...props }) {
|
|
365
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
366
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
367
|
+
width: size ?? width ?? 24,
|
|
368
|
+
height: size ?? height ?? 24,
|
|
369
|
+
viewBox: "0 0 24 24",
|
|
370
|
+
fill: "none",
|
|
371
|
+
stroke: "currentColor",
|
|
372
|
+
strokeWidth: 2,
|
|
373
|
+
strokeLinecap: "round",
|
|
374
|
+
strokeLinejoin: "round",
|
|
375
|
+
"aria-hidden": "true",
|
|
376
|
+
...props,
|
|
377
|
+
children: [
|
|
378
|
+
/* @__PURE__ */ jsx("line", {
|
|
379
|
+
x1: "19",
|
|
380
|
+
x2: "10",
|
|
381
|
+
y1: "4",
|
|
382
|
+
y2: "4"
|
|
383
|
+
}),
|
|
384
|
+
/* @__PURE__ */ jsx("line", {
|
|
385
|
+
x1: "14",
|
|
386
|
+
x2: "5",
|
|
387
|
+
y1: "20",
|
|
388
|
+
y2: "20"
|
|
389
|
+
}),
|
|
390
|
+
/* @__PURE__ */ jsx("line", {
|
|
391
|
+
x1: "15",
|
|
392
|
+
x2: "9",
|
|
393
|
+
y1: "4",
|
|
394
|
+
y2: "20"
|
|
395
|
+
})
|
|
396
|
+
]
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
//#endregion
|
|
401
|
+
//#region src/ui/icons/link.tsx
|
|
402
|
+
function LinkIcon({ size, width, height, ...props }) {
|
|
403
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
404
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
405
|
+
width: size ?? width ?? 24,
|
|
406
|
+
height: size ?? height ?? 24,
|
|
407
|
+
viewBox: "0 0 24 24",
|
|
408
|
+
fill: "none",
|
|
409
|
+
stroke: "currentColor",
|
|
410
|
+
strokeWidth: 2,
|
|
411
|
+
strokeLinecap: "round",
|
|
412
|
+
strokeLinejoin: "round",
|
|
413
|
+
"aria-hidden": "true",
|
|
414
|
+
...props,
|
|
415
|
+
children: [/* @__PURE__ */ jsx("path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }), /* @__PURE__ */ jsx("path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" })]
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
//#endregion
|
|
420
|
+
//#region src/ui/icons/list.tsx
|
|
421
|
+
function List({ size, width, height, ...props }) {
|
|
422
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
423
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
424
|
+
width: size ?? width ?? 24,
|
|
425
|
+
height: size ?? height ?? 24,
|
|
426
|
+
viewBox: "0 0 24 24",
|
|
427
|
+
fill: "none",
|
|
428
|
+
stroke: "currentColor",
|
|
429
|
+
strokeWidth: 2,
|
|
430
|
+
strokeLinecap: "round",
|
|
431
|
+
strokeLinejoin: "round",
|
|
432
|
+
"aria-hidden": "true",
|
|
433
|
+
...props,
|
|
434
|
+
children: [
|
|
435
|
+
/* @__PURE__ */ jsx("path", { d: "M3 5h.01" }),
|
|
436
|
+
/* @__PURE__ */ jsx("path", { d: "M3 12h.01" }),
|
|
437
|
+
/* @__PURE__ */ jsx("path", { d: "M3 19h.01" }),
|
|
438
|
+
/* @__PURE__ */ jsx("path", { d: "M8 5h13" }),
|
|
439
|
+
/* @__PURE__ */ jsx("path", { d: "M8 12h13" }),
|
|
440
|
+
/* @__PURE__ */ jsx("path", { d: "M8 19h13" })
|
|
441
|
+
]
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
//#endregion
|
|
446
|
+
//#region src/ui/icons/list-ordered.tsx
|
|
447
|
+
function ListOrdered({ size, width, height, ...props }) {
|
|
448
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
449
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
450
|
+
width: size ?? width ?? 24,
|
|
451
|
+
height: size ?? height ?? 24,
|
|
452
|
+
viewBox: "0 0 24 24",
|
|
453
|
+
fill: "none",
|
|
454
|
+
stroke: "currentColor",
|
|
455
|
+
strokeWidth: 2,
|
|
456
|
+
strokeLinecap: "round",
|
|
457
|
+
strokeLinejoin: "round",
|
|
458
|
+
"aria-hidden": "true",
|
|
459
|
+
...props,
|
|
460
|
+
children: [
|
|
461
|
+
/* @__PURE__ */ jsx("path", { d: "M11 5h10" }),
|
|
462
|
+
/* @__PURE__ */ jsx("path", { d: "M11 12h10" }),
|
|
463
|
+
/* @__PURE__ */ jsx("path", { d: "M11 19h10" }),
|
|
464
|
+
/* @__PURE__ */ jsx("path", { d: "M4 4h1v5" }),
|
|
465
|
+
/* @__PURE__ */ jsx("path", { d: "M4 9h2" }),
|
|
466
|
+
/* @__PURE__ */ jsx("path", { d: "M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02" })
|
|
467
|
+
]
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
//#endregion
|
|
472
|
+
//#region src/ui/icons/mouse-pointer.tsx
|
|
473
|
+
function MousePointer({ size, width, height, ...props }) {
|
|
474
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
475
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
476
|
+
width: size ?? width ?? 24,
|
|
477
|
+
height: size ?? height ?? 24,
|
|
478
|
+
viewBox: "0 0 24 24",
|
|
479
|
+
fill: "none",
|
|
480
|
+
stroke: "currentColor",
|
|
481
|
+
strokeWidth: 2,
|
|
482
|
+
strokeLinecap: "round",
|
|
483
|
+
strokeLinejoin: "round",
|
|
484
|
+
"aria-hidden": "true",
|
|
485
|
+
...props,
|
|
486
|
+
children: [/* @__PURE__ */ jsx("path", { d: "M12.586 12.586 19 19" }), /* @__PURE__ */ jsx("path", { d: "M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z" })]
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
//#endregion
|
|
491
|
+
//#region src/ui/icons/pencil.tsx
|
|
492
|
+
function PencilIcon({ size, width, height, ...props }) {
|
|
493
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
494
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
495
|
+
width: size ?? width ?? 24,
|
|
496
|
+
height: size ?? height ?? 24,
|
|
497
|
+
viewBox: "0 0 24 24",
|
|
498
|
+
fill: "none",
|
|
499
|
+
stroke: "currentColor",
|
|
500
|
+
strokeWidth: 2,
|
|
501
|
+
strokeLinecap: "round",
|
|
502
|
+
strokeLinejoin: "round",
|
|
503
|
+
"aria-hidden": "true",
|
|
504
|
+
...props,
|
|
505
|
+
children: [/* @__PURE__ */ jsx("path", { d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" }), /* @__PURE__ */ jsx("path", { d: "m15 5 4 4" })]
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
//#endregion
|
|
510
|
+
//#region src/ui/icons/rows-2.tsx
|
|
511
|
+
function Rows2({ size, width, height, ...props }) {
|
|
512
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
513
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
514
|
+
width: size ?? width ?? 24,
|
|
515
|
+
height: size ?? height ?? 24,
|
|
516
|
+
viewBox: "0 0 24 24",
|
|
517
|
+
fill: "none",
|
|
518
|
+
stroke: "currentColor",
|
|
519
|
+
strokeWidth: 2,
|
|
520
|
+
strokeLinecap: "round",
|
|
521
|
+
strokeLinejoin: "round",
|
|
522
|
+
"aria-hidden": "true",
|
|
523
|
+
...props,
|
|
524
|
+
children: [/* @__PURE__ */ jsx("rect", {
|
|
525
|
+
width: "18",
|
|
526
|
+
height: "18",
|
|
527
|
+
x: "3",
|
|
528
|
+
y: "3",
|
|
529
|
+
rx: "2"
|
|
530
|
+
}), /* @__PURE__ */ jsx("path", { d: "M3 12h18" })]
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
//#endregion
|
|
535
|
+
//#region src/ui/icons/split-square-vertical.tsx
|
|
536
|
+
function SplitSquareVertical({ size, width, height, ...props }) {
|
|
537
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
538
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
539
|
+
width: size ?? width ?? 24,
|
|
540
|
+
height: size ?? height ?? 24,
|
|
541
|
+
viewBox: "0 0 24 24",
|
|
542
|
+
fill: "none",
|
|
543
|
+
stroke: "currentColor",
|
|
544
|
+
strokeWidth: 2,
|
|
545
|
+
strokeLinecap: "round",
|
|
546
|
+
strokeLinejoin: "round",
|
|
547
|
+
"aria-hidden": "true",
|
|
548
|
+
...props,
|
|
549
|
+
children: [
|
|
550
|
+
/* @__PURE__ */ jsx("path", { d: "M5 8V5c0-1 1-2 2-2h10c1 0 2 1 2 2v3" }),
|
|
551
|
+
/* @__PURE__ */ jsx("path", { d: "M19 16v3c0 1-1 2-2 2H7c-1 0-2-1-2-2v-3" }),
|
|
552
|
+
/* @__PURE__ */ jsx("line", {
|
|
553
|
+
x1: "4",
|
|
554
|
+
x2: "20",
|
|
555
|
+
y1: "12",
|
|
556
|
+
y2: "12"
|
|
557
|
+
})
|
|
558
|
+
]
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
//#endregion
|
|
563
|
+
//#region src/ui/icons/square-code.tsx
|
|
564
|
+
function SquareCode({ size, width, height, ...props }) {
|
|
565
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
566
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
567
|
+
width: size ?? width ?? 24,
|
|
568
|
+
height: size ?? height ?? 24,
|
|
569
|
+
viewBox: "0 0 24 24",
|
|
570
|
+
fill: "none",
|
|
571
|
+
stroke: "currentColor",
|
|
572
|
+
strokeWidth: 2,
|
|
573
|
+
strokeLinecap: "round",
|
|
574
|
+
strokeLinejoin: "round",
|
|
575
|
+
"aria-hidden": "true",
|
|
576
|
+
...props,
|
|
577
|
+
children: [
|
|
578
|
+
/* @__PURE__ */ jsx("path", { d: "m10 9-3 3 3 3" }),
|
|
579
|
+
/* @__PURE__ */ jsx("path", { d: "m14 15 3-3-3-3" }),
|
|
580
|
+
/* @__PURE__ */ jsx("rect", {
|
|
581
|
+
x: "3",
|
|
582
|
+
y: "3",
|
|
583
|
+
width: "18",
|
|
584
|
+
height: "18",
|
|
585
|
+
rx: "2"
|
|
586
|
+
})
|
|
587
|
+
]
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
//#endregion
|
|
592
|
+
//#region src/ui/icons/strikethrough.tsx
|
|
593
|
+
function StrikethroughIcon({ size, width, height, ...props }) {
|
|
594
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
595
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
596
|
+
width: size ?? width ?? 24,
|
|
597
|
+
height: size ?? height ?? 24,
|
|
598
|
+
viewBox: "0 0 24 24",
|
|
599
|
+
fill: "none",
|
|
600
|
+
stroke: "currentColor",
|
|
601
|
+
strokeWidth: 2,
|
|
602
|
+
strokeLinecap: "round",
|
|
603
|
+
strokeLinejoin: "round",
|
|
604
|
+
"aria-hidden": "true",
|
|
605
|
+
...props,
|
|
606
|
+
children: [
|
|
607
|
+
/* @__PURE__ */ jsx("path", { d: "M16 4H9a3 3 0 0 0-2.83 4" }),
|
|
608
|
+
/* @__PURE__ */ jsx("path", { d: "M14 12a4 4 0 0 1 0 8H6" }),
|
|
609
|
+
/* @__PURE__ */ jsx("line", {
|
|
610
|
+
x1: "4",
|
|
611
|
+
x2: "20",
|
|
612
|
+
y1: "12",
|
|
613
|
+
y2: "12"
|
|
614
|
+
})
|
|
615
|
+
]
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
//#endregion
|
|
620
|
+
//#region src/ui/icons/text.tsx
|
|
621
|
+
function TextIcon({ size, width, height, ...props }) {
|
|
622
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
623
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
624
|
+
width: size ?? width ?? 24,
|
|
625
|
+
height: size ?? height ?? 24,
|
|
626
|
+
viewBox: "0 0 24 24",
|
|
627
|
+
fill: "none",
|
|
628
|
+
stroke: "currentColor",
|
|
629
|
+
strokeWidth: 2,
|
|
630
|
+
strokeLinecap: "round",
|
|
631
|
+
strokeLinejoin: "round",
|
|
632
|
+
"aria-hidden": "true",
|
|
633
|
+
...props,
|
|
634
|
+
children: [
|
|
635
|
+
/* @__PURE__ */ jsx("path", { d: "M21 5H3" }),
|
|
636
|
+
/* @__PURE__ */ jsx("path", { d: "M15 12H3" }),
|
|
637
|
+
/* @__PURE__ */ jsx("path", { d: "M17 19H3" })
|
|
638
|
+
]
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
const Text = TextIcon;
|
|
642
|
+
|
|
643
|
+
//#endregion
|
|
644
|
+
//#region src/ui/icons/text-quote.tsx
|
|
645
|
+
function TextQuote({ size, width, height, ...props }) {
|
|
646
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
647
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
648
|
+
width: size ?? width ?? 24,
|
|
649
|
+
height: size ?? height ?? 24,
|
|
650
|
+
viewBox: "0 0 24 24",
|
|
651
|
+
fill: "none",
|
|
652
|
+
stroke: "currentColor",
|
|
653
|
+
strokeWidth: 2,
|
|
654
|
+
strokeLinecap: "round",
|
|
655
|
+
strokeLinejoin: "round",
|
|
656
|
+
"aria-hidden": "true",
|
|
657
|
+
...props,
|
|
658
|
+
children: [
|
|
659
|
+
/* @__PURE__ */ jsx("path", { d: "M17 5H3" }),
|
|
660
|
+
/* @__PURE__ */ jsx("path", { d: "M21 12H8" }),
|
|
661
|
+
/* @__PURE__ */ jsx("path", { d: "M21 19H8" }),
|
|
662
|
+
/* @__PURE__ */ jsx("path", { d: "M3 12v7" })
|
|
663
|
+
]
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
//#endregion
|
|
668
|
+
//#region src/ui/icons/underline.tsx
|
|
669
|
+
function UnderlineIcon({ size, width, height, ...props }) {
|
|
670
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
671
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
672
|
+
width: size ?? width ?? 24,
|
|
673
|
+
height: size ?? height ?? 24,
|
|
674
|
+
viewBox: "0 0 24 24",
|
|
675
|
+
fill: "none",
|
|
676
|
+
stroke: "currentColor",
|
|
677
|
+
strokeWidth: 2,
|
|
678
|
+
strokeLinecap: "round",
|
|
679
|
+
strokeLinejoin: "round",
|
|
680
|
+
"aria-hidden": "true",
|
|
681
|
+
...props,
|
|
682
|
+
children: [/* @__PURE__ */ jsx("path", { d: "M6 4v6a6 6 0 0 0 12 0V4" }), /* @__PURE__ */ jsx("line", {
|
|
683
|
+
x1: "4",
|
|
684
|
+
x2: "20",
|
|
685
|
+
y1: "20",
|
|
686
|
+
y2: "20"
|
|
687
|
+
})]
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
//#endregion
|
|
692
|
+
//#region src/ui/icons/unlink.tsx
|
|
693
|
+
function UnlinkIcon({ size, width, height, ...props }) {
|
|
694
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
695
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
696
|
+
width: size ?? width ?? 24,
|
|
697
|
+
height: size ?? height ?? 24,
|
|
698
|
+
viewBox: "0 0 24 24",
|
|
699
|
+
fill: "none",
|
|
700
|
+
stroke: "currentColor",
|
|
701
|
+
strokeWidth: 2,
|
|
702
|
+
strokeLinecap: "round",
|
|
703
|
+
strokeLinejoin: "round",
|
|
704
|
+
"aria-hidden": "true",
|
|
705
|
+
...props,
|
|
706
|
+
children: [
|
|
707
|
+
/* @__PURE__ */ jsx("path", { d: "m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71" }),
|
|
708
|
+
/* @__PURE__ */ jsx("path", { d: "m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71" }),
|
|
709
|
+
/* @__PURE__ */ jsx("line", {
|
|
710
|
+
x1: "8",
|
|
711
|
+
x2: "8",
|
|
712
|
+
y1: "2",
|
|
713
|
+
y2: "5"
|
|
714
|
+
}),
|
|
715
|
+
/* @__PURE__ */ jsx("line", {
|
|
716
|
+
x1: "2",
|
|
717
|
+
x2: "5",
|
|
718
|
+
y1: "8",
|
|
719
|
+
y2: "8"
|
|
720
|
+
}),
|
|
721
|
+
/* @__PURE__ */ jsx("line", {
|
|
722
|
+
x1: "16",
|
|
723
|
+
x2: "16",
|
|
724
|
+
y1: "19",
|
|
725
|
+
y2: "22"
|
|
726
|
+
}),
|
|
727
|
+
/* @__PURE__ */ jsx("line", {
|
|
728
|
+
x1: "19",
|
|
729
|
+
x2: "22",
|
|
730
|
+
y1: "16",
|
|
731
|
+
y2: "16"
|
|
732
|
+
})
|
|
733
|
+
]
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
//#endregion
|
|
15
738
|
//#region src/ui/bubble-menu/context.tsx
|
|
16
739
|
const BubbleMenuContext = React.createContext(null);
|
|
17
740
|
function useBubbleMenuContext() {
|
|
@@ -512,14 +1235,20 @@ function BubbleMenuNodeSelector({ omit = [], className, triggerContent, open, on
|
|
|
512
1235
|
|
|
513
1236
|
//#endregion
|
|
514
1237
|
//#region src/ui/bubble-menu/root.tsx
|
|
515
|
-
function BubbleMenuRoot({ excludeNodes = [], placement = "bottom", offset: offset$1 = 8, onHide, className, children }) {
|
|
1238
|
+
function BubbleMenuRoot({ excludeNodes = [], excludeMarks = [], placement = "bottom", offset: offset$1 = 8, onHide, className, children }) {
|
|
516
1239
|
const { editor } = useCurrentEditor();
|
|
517
1240
|
if (!editor) return null;
|
|
518
1241
|
return /* @__PURE__ */ jsx(BubbleMenu$1, {
|
|
519
1242
|
editor,
|
|
1243
|
+
pluginKey: "textBubbleMenu",
|
|
520
1244
|
"data-re-bubble-menu": "",
|
|
521
|
-
shouldShow: ({ editor: editor$1, view }) => {
|
|
522
|
-
for (const node of excludeNodes)
|
|
1245
|
+
shouldShow: ({ editor: editor$1, view, state }) => {
|
|
1246
|
+
for (const node of excludeNodes) {
|
|
1247
|
+
if (editor$1.isActive(node)) return false;
|
|
1248
|
+
const { $from } = state.selection;
|
|
1249
|
+
for (let d = $from.depth; d > 0; d--) if ($from.node(d).type.name === node) return false;
|
|
1250
|
+
}
|
|
1251
|
+
for (const mark of excludeMarks) if (editor$1.isActive(mark)) return false;
|
|
523
1252
|
if (view.dom.classList.contains("dragging")) return false;
|
|
524
1253
|
return editor$1.view.state.selection.content().size > 0;
|
|
525
1254
|
},
|
|
@@ -565,7 +1294,7 @@ const BubbleMenuUppercase = createMarkBubbleItem({
|
|
|
565
1294
|
|
|
566
1295
|
//#endregion
|
|
567
1296
|
//#region src/ui/bubble-menu/default.tsx
|
|
568
|
-
function BubbleMenuDefault({ excludeItems = [], excludeNodes, placement, offset: offset$1, onHide, className }) {
|
|
1297
|
+
function BubbleMenuDefault({ excludeItems = [], excludeNodes, excludeMarks, placement, offset: offset$1, onHide, className }) {
|
|
569
1298
|
const [isNodeSelectorOpen, setIsNodeSelectorOpen] = React.useState(false);
|
|
570
1299
|
const [isLinkSelectorOpen, setIsLinkSelectorOpen] = React.useState(false);
|
|
571
1300
|
const has = (item) => !excludeItems.includes(item);
|
|
@@ -586,6 +1315,7 @@ function BubbleMenuDefault({ excludeItems = [], excludeNodes, placement, offset:
|
|
|
586
1315
|
const hasAlignmentItems = has("align-left") || has("align-center") || has("align-right");
|
|
587
1316
|
return /* @__PURE__ */ jsxs(BubbleMenuRoot, {
|
|
588
1317
|
excludeNodes,
|
|
1318
|
+
excludeMarks,
|
|
589
1319
|
placement,
|
|
590
1320
|
offset: offset$1,
|
|
591
1321
|
onHide: handleHide,
|
|
@@ -678,7 +1408,109 @@ function ButtonBubbleMenuEditLink({ className, children, onClick, onMouseDown, .
|
|
|
678
1408
|
onClick?.(e);
|
|
679
1409
|
setIsEditing(true);
|
|
680
1410
|
},
|
|
681
|
-
children: children ?? /* @__PURE__ */ jsx(
|
|
1411
|
+
children: children ?? /* @__PURE__ */ jsx(PencilIcon, {})
|
|
1412
|
+
});
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
//#endregion
|
|
1416
|
+
//#region src/ui/button-bubble-menu/form.tsx
|
|
1417
|
+
function ButtonBubbleMenuForm({ className, validateUrl, onLinkApply, onLinkRemove }) {
|
|
1418
|
+
const { editor, buttonHref, isEditing, setIsEditing } = useButtonBubbleMenuContext();
|
|
1419
|
+
const inputRef = React.useRef(null);
|
|
1420
|
+
const formRef = React.useRef(null);
|
|
1421
|
+
const displayHref = buttonHref === "#" ? "" : buttonHref;
|
|
1422
|
+
const [inputValue, setInputValue] = React.useState(displayHref);
|
|
1423
|
+
React.useEffect(() => {
|
|
1424
|
+
if (!isEditing) return;
|
|
1425
|
+
setInputValue(displayHref);
|
|
1426
|
+
const timeoutId = setTimeout(() => {
|
|
1427
|
+
inputRef.current?.focus();
|
|
1428
|
+
}, 0);
|
|
1429
|
+
return () => clearTimeout(timeoutId);
|
|
1430
|
+
}, [isEditing, displayHref]);
|
|
1431
|
+
React.useEffect(() => {
|
|
1432
|
+
if (!isEditing) return;
|
|
1433
|
+
const handleKeyDown = (event) => {
|
|
1434
|
+
if (event.key === "Escape") setIsEditing(false);
|
|
1435
|
+
};
|
|
1436
|
+
const handleClickOutside = (event) => {
|
|
1437
|
+
if (formRef.current && !formRef.current.contains(event.target)) {
|
|
1438
|
+
const form = formRef.current;
|
|
1439
|
+
const submitEvent = new Event("submit", {
|
|
1440
|
+
bubbles: true,
|
|
1441
|
+
cancelable: true
|
|
1442
|
+
});
|
|
1443
|
+
form.dispatchEvent(submitEvent);
|
|
1444
|
+
setIsEditing(false);
|
|
1445
|
+
}
|
|
1446
|
+
};
|
|
1447
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
1448
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
1449
|
+
return () => {
|
|
1450
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
1451
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
1452
|
+
};
|
|
1453
|
+
}, [isEditing, setIsEditing]);
|
|
1454
|
+
if (!isEditing) return null;
|
|
1455
|
+
function handleSubmit(e) {
|
|
1456
|
+
e.preventDefault();
|
|
1457
|
+
const value = inputValue.trim();
|
|
1458
|
+
if (value === "") {
|
|
1459
|
+
editor.commands.updateButton({ href: "#" });
|
|
1460
|
+
setIsEditing(false);
|
|
1461
|
+
focusEditor(editor);
|
|
1462
|
+
onLinkRemove?.();
|
|
1463
|
+
return;
|
|
1464
|
+
}
|
|
1465
|
+
const finalValue = (validateUrl ?? getUrlFromString)(value);
|
|
1466
|
+
if (!finalValue) {
|
|
1467
|
+
editor.commands.updateButton({ href: "#" });
|
|
1468
|
+
setIsEditing(false);
|
|
1469
|
+
focusEditor(editor);
|
|
1470
|
+
onLinkRemove?.();
|
|
1471
|
+
return;
|
|
1472
|
+
}
|
|
1473
|
+
editor.commands.updateButton({ href: finalValue });
|
|
1474
|
+
setIsEditing(false);
|
|
1475
|
+
focusEditor(editor);
|
|
1476
|
+
onLinkApply?.(finalValue);
|
|
1477
|
+
}
|
|
1478
|
+
function handleUnlink(e) {
|
|
1479
|
+
e.stopPropagation();
|
|
1480
|
+
editor.commands.updateButton({ href: "#" });
|
|
1481
|
+
setIsEditing(false);
|
|
1482
|
+
focusEditor(editor);
|
|
1483
|
+
onLinkRemove?.();
|
|
1484
|
+
}
|
|
1485
|
+
return /* @__PURE__ */ jsxs("form", {
|
|
1486
|
+
ref: formRef,
|
|
1487
|
+
"data-re-btn-bm-form": "",
|
|
1488
|
+
className,
|
|
1489
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
1490
|
+
onClick: (e) => e.stopPropagation(),
|
|
1491
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
1492
|
+
onSubmit: handleSubmit,
|
|
1493
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
1494
|
+
ref: inputRef,
|
|
1495
|
+
"data-re-btn-bm-input": "",
|
|
1496
|
+
value: inputValue,
|
|
1497
|
+
onFocus: (e) => e.stopPropagation(),
|
|
1498
|
+
onChange: (e) => setInputValue(e.target.value),
|
|
1499
|
+
placeholder: "Paste a link",
|
|
1500
|
+
type: "text"
|
|
1501
|
+
}), displayHref ? /* @__PURE__ */ jsx("button", {
|
|
1502
|
+
type: "button",
|
|
1503
|
+
"aria-label": "Remove link",
|
|
1504
|
+
"data-re-btn-bm-unlink": "",
|
|
1505
|
+
onClick: handleUnlink,
|
|
1506
|
+
children: /* @__PURE__ */ jsx(UnlinkIcon, {})
|
|
1507
|
+
}) : /* @__PURE__ */ jsx("button", {
|
|
1508
|
+
type: "submit",
|
|
1509
|
+
"aria-label": "Apply link",
|
|
1510
|
+
"data-re-btn-bm-apply": "",
|
|
1511
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
1512
|
+
children: /* @__PURE__ */ jsx(Check, {})
|
|
1513
|
+
})]
|
|
682
1514
|
});
|
|
683
1515
|
}
|
|
684
1516
|
|
|
@@ -687,9 +1519,14 @@ function ButtonBubbleMenuEditLink({ className, children, onClick, onMouseDown, .
|
|
|
687
1519
|
function ButtonBubbleMenuRoot({ onHide, placement = "top", offset: offset$1 = 8, className, children }) {
|
|
688
1520
|
const { editor } = useCurrentEditor();
|
|
689
1521
|
const [isEditing, setIsEditing] = React.useState(false);
|
|
1522
|
+
const buttonHref = useEditorState({
|
|
1523
|
+
editor,
|
|
1524
|
+
selector: ({ editor: e }) => e?.getAttributes("button").href ?? ""
|
|
1525
|
+
});
|
|
690
1526
|
if (!editor) return null;
|
|
691
1527
|
return /* @__PURE__ */ jsx(BubbleMenu$1, {
|
|
692
1528
|
editor,
|
|
1529
|
+
pluginKey: "buttonBubbleMenu",
|
|
693
1530
|
"data-re-btn-bm": "",
|
|
694
1531
|
shouldShow: ({ editor: e, view }) => e.isActive("button") && !view.dom.classList.contains("dragging"),
|
|
695
1532
|
options: {
|
|
@@ -704,6 +1541,7 @@ function ButtonBubbleMenuRoot({ onHide, placement = "top", offset: offset$1 = 8,
|
|
|
704
1541
|
children: /* @__PURE__ */ jsx(ButtonBubbleMenuContext.Provider, {
|
|
705
1542
|
value: {
|
|
706
1543
|
editor,
|
|
1544
|
+
buttonHref: buttonHref ?? "",
|
|
707
1545
|
isEditing,
|
|
708
1546
|
setIsEditing
|
|
709
1547
|
},
|
|
@@ -724,15 +1562,52 @@ function ButtonBubbleMenuToolbar({ children, ...rest }) {
|
|
|
724
1562
|
});
|
|
725
1563
|
}
|
|
726
1564
|
|
|
1565
|
+
//#endregion
|
|
1566
|
+
//#region src/ui/button-bubble-menu/unlink.tsx
|
|
1567
|
+
function ButtonBubbleMenuUnlink({ className, children, onClick, onMouseDown, onLinkRemove, ...rest }) {
|
|
1568
|
+
const { editor } = useButtonBubbleMenuContext();
|
|
1569
|
+
return /* @__PURE__ */ jsx("button", {
|
|
1570
|
+
...rest,
|
|
1571
|
+
type: "button",
|
|
1572
|
+
"aria-label": "Remove link",
|
|
1573
|
+
"data-re-btn-bm-item": "",
|
|
1574
|
+
"data-item": "unlink",
|
|
1575
|
+
className,
|
|
1576
|
+
onMouseDown: (e) => {
|
|
1577
|
+
e.preventDefault();
|
|
1578
|
+
onMouseDown?.(e);
|
|
1579
|
+
},
|
|
1580
|
+
onClick: (e) => {
|
|
1581
|
+
onClick?.(e);
|
|
1582
|
+
editor.commands.updateButton({ href: "#" });
|
|
1583
|
+
focusEditor(editor);
|
|
1584
|
+
onLinkRemove?.();
|
|
1585
|
+
},
|
|
1586
|
+
children: children ?? /* @__PURE__ */ jsx(UnlinkIcon, {})
|
|
1587
|
+
});
|
|
1588
|
+
}
|
|
1589
|
+
|
|
727
1590
|
//#endregion
|
|
728
1591
|
//#region src/ui/button-bubble-menu/default.tsx
|
|
729
|
-
function
|
|
1592
|
+
function ButtonBubbleMenuDefaultInner({ validateUrl, onLinkApply, onLinkRemove }) {
|
|
1593
|
+
const { buttonHref } = useButtonBubbleMenuContext();
|
|
1594
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(ButtonBubbleMenuToolbar, { children: [/* @__PURE__ */ jsx(ButtonBubbleMenuEditLink, {}), buttonHref !== "" && buttonHref !== "#" && /* @__PURE__ */ jsx(ButtonBubbleMenuUnlink, { onLinkRemove })] }), /* @__PURE__ */ jsx(ButtonBubbleMenuForm, {
|
|
1595
|
+
validateUrl,
|
|
1596
|
+
onLinkApply,
|
|
1597
|
+
onLinkRemove
|
|
1598
|
+
})] });
|
|
1599
|
+
}
|
|
1600
|
+
function ButtonBubbleMenuDefault({ placement, offset: offset$1, onHide, className, validateUrl, onLinkApply, onLinkRemove }) {
|
|
730
1601
|
return /* @__PURE__ */ jsx(ButtonBubbleMenuRoot, {
|
|
731
1602
|
placement,
|
|
732
1603
|
offset: offset$1,
|
|
733
1604
|
onHide,
|
|
734
1605
|
className,
|
|
735
|
-
children:
|
|
1606
|
+
children: /* @__PURE__ */ jsx(ButtonBubbleMenuDefaultInner, {
|
|
1607
|
+
validateUrl,
|
|
1608
|
+
onLinkApply,
|
|
1609
|
+
onLinkRemove
|
|
1610
|
+
})
|
|
736
1611
|
});
|
|
737
1612
|
}
|
|
738
1613
|
|
|
@@ -742,6 +1617,8 @@ const ButtonBubbleMenu = {
|
|
|
742
1617
|
Root: ButtonBubbleMenuRoot,
|
|
743
1618
|
Toolbar: ButtonBubbleMenuToolbar,
|
|
744
1619
|
EditLink: ButtonBubbleMenuEditLink,
|
|
1620
|
+
Unlink: ButtonBubbleMenuUnlink,
|
|
1621
|
+
Form: ButtonBubbleMenuForm,
|
|
745
1622
|
Default: ButtonBubbleMenuDefault
|
|
746
1623
|
};
|
|
747
1624
|
|
|
@@ -785,6 +1662,7 @@ function ImageBubbleMenuRoot({ onHide, placement = "top", offset: offset$1 = 8,
|
|
|
785
1662
|
if (!editor) return null;
|
|
786
1663
|
return /* @__PURE__ */ jsx(BubbleMenu$1, {
|
|
787
1664
|
editor,
|
|
1665
|
+
pluginKey: "imageBubbleMenu",
|
|
788
1666
|
"data-re-img-bm": "",
|
|
789
1667
|
shouldShow: ({ editor: e, view }) => e.isActive("image") && !view.dom.classList.contains("dragging"),
|
|
790
1668
|
options: {
|
|
@@ -882,11 +1760,12 @@ function LinkBubbleMenuForm({ className, validateUrl, onLinkApply, onLinkRemove,
|
|
|
882
1760
|
const [inputValue, setInputValue] = React.useState(displayHref);
|
|
883
1761
|
React.useEffect(() => {
|
|
884
1762
|
if (!isEditing) return;
|
|
1763
|
+
setInputValue(displayHref);
|
|
885
1764
|
const timeoutId = setTimeout(() => {
|
|
886
1765
|
inputRef.current?.focus();
|
|
887
1766
|
}, 0);
|
|
888
1767
|
return () => clearTimeout(timeoutId);
|
|
889
|
-
}, [isEditing]);
|
|
1768
|
+
}, [isEditing, displayHref]);
|
|
890
1769
|
React.useEffect(() => {
|
|
891
1770
|
if (!isEditing) return;
|
|
892
1771
|
const handleKeyDown = (event) => {
|
|
@@ -1006,6 +1885,7 @@ function LinkBubbleMenuRoot({ onHide, placement = "top", offset: offset$1 = 8, c
|
|
|
1006
1885
|
if (!editor) return null;
|
|
1007
1886
|
return /* @__PURE__ */ jsx(BubbleMenu$1, {
|
|
1008
1887
|
editor,
|
|
1888
|
+
pluginKey: "linkBubbleMenu",
|
|
1009
1889
|
"data-re-link-bm": "",
|
|
1010
1890
|
shouldShow: ({ editor: e }) => e.isActive("link") && e.view.state.selection.content().size === 0,
|
|
1011
1891
|
options: {
|
|
@@ -1580,5 +2460,5 @@ const SlashCommand = {
|
|
|
1580
2460
|
};
|
|
1581
2461
|
|
|
1582
2462
|
//#endregion
|
|
1583
|
-
export { BULLET_LIST, BUTTON, BubbleMenu, BubbleMenuAlignCenter, BubbleMenuAlignLeft, BubbleMenuAlignRight, BubbleMenuBold, BubbleMenuCode, BubbleMenuDefault, BubbleMenuItalic, BubbleMenuItem, BubbleMenuItemGroup, BubbleMenuLinkSelector, BubbleMenuNodeSelector, BubbleMenuRoot, BubbleMenuSeparator, BubbleMenuStrike, BubbleMenuUnderline, BubbleMenuUppercase, ButtonBubbleMenu, ButtonBubbleMenuDefault, ButtonBubbleMenuEditLink, ButtonBubbleMenuRoot, ButtonBubbleMenuToolbar, CODE, CommandList, DIVIDER, FOUR_COLUMNS, H1, H2, H3, ImageBubbleMenu, ImageBubbleMenuDefault, ImageBubbleMenuEditLink, ImageBubbleMenuRoot, ImageBubbleMenuToolbar, LinkBubbleMenu, LinkBubbleMenuDefault, LinkBubbleMenuEditLink, LinkBubbleMenuForm, LinkBubbleMenuOpenLink, LinkBubbleMenuRoot, LinkBubbleMenuToolbar, LinkBubbleMenuUnlink, NUMBERED_LIST, NodeSelectorContent, NodeSelectorRoot, NodeSelectorTrigger, QUOTE, SECTION, SlashCommand, TEXT, THREE_COLUMNS, TWO_COLUMNS, defaultSlashCommands, filterAndRankItems, isAtMaxColumnsDepth, isInsideNode, scoreItem, useButtonBubbleMenuContext, useImageBubbleMenuContext, useLinkBubbleMenuContext };
|
|
2463
|
+
export { AlignCenterIcon, AlignLeftIcon, AlignRightIcon, BULLET_LIST, BUTTON, BoldIcon, BubbleMenu, BubbleMenuAlignCenter, BubbleMenuAlignLeft, BubbleMenuAlignRight, BubbleMenuBold, BubbleMenuCode, BubbleMenuDefault, BubbleMenuItalic, BubbleMenuItem, BubbleMenuItemGroup, BubbleMenuLinkSelector, BubbleMenuNodeSelector, BubbleMenuRoot, BubbleMenuSeparator, BubbleMenuStrike, BubbleMenuUnderline, BubbleMenuUppercase, ButtonBubbleMenu, ButtonBubbleMenuDefault, ButtonBubbleMenuEditLink, ButtonBubbleMenuForm, ButtonBubbleMenuRoot, ButtonBubbleMenuToolbar, ButtonBubbleMenuUnlink, CODE, CaseUpperIcon, Check, ChevronDown, Code, CodeIcon, Columns2, Columns3, Columns4, CommandList, DIVIDER, ExternalLinkIcon, FOUR_COLUMNS, H1, H2, H3, Heading1, Heading2, Heading3, ImageBubbleMenu, ImageBubbleMenuDefault, ImageBubbleMenuEditLink, ImageBubbleMenuRoot, ImageBubbleMenuToolbar, ItalicIcon, LinkBubbleMenu, LinkBubbleMenuDefault, LinkBubbleMenuEditLink, LinkBubbleMenuForm, LinkBubbleMenuOpenLink, LinkBubbleMenuRoot, LinkBubbleMenuToolbar, LinkBubbleMenuUnlink, LinkIcon, List, ListOrdered, MousePointer, NUMBERED_LIST, NodeSelectorContent, NodeSelectorRoot, NodeSelectorTrigger, PencilIcon, QUOTE, Rows2, SECTION, SlashCommand, SplitSquareVertical, SquareCode, StrikethroughIcon, TEXT, THREE_COLUMNS, TWO_COLUMNS, Text, TextIcon, TextQuote, UnderlineIcon, UnlinkIcon, defaultSlashCommands, filterAndRankItems, isAtMaxColumnsDepth, isInsideNode, scoreItem, useButtonBubbleMenuContext, useImageBubbleMenuContext, useLinkBubbleMenuContext };
|
|
1584
2464
|
//# sourceMappingURL=index.mjs.map
|