@blocknote/xl-email-exporter 0.34.0 → 0.36.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/LICENSE +674 -373
- package/dist/blocknote-xl-email-exporter.js +443 -208
- package/dist/blocknote-xl-email-exporter.js.map +1 -1
- package/dist/blocknote-xl-email-exporter.umd.cjs +1 -1
- package/dist/blocknote-xl-email-exporter.umd.cjs.map +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +4 -4
- package/src/react-email/__snapshots__/reactEmailExporter.test.tsx.snap +17 -17
- package/src/react-email/defaultSchema/blocks.tsx +230 -28
- package/src/react-email/defaultSchema/index.ts +71 -3
- package/src/react-email/defaultSchema/inlinecontent.tsx +21 -5
- package/src/react-email/defaultSchema/styles.tsx +28 -10
- package/src/react-email/reactEmailExporter.tsx +26 -7
- package/types/src/react-email/defaultSchema/blocks.d.ts +632 -4
- package/types/src/react-email/defaultSchema/index.d.ts +16 -0
- package/types/src/react-email/defaultSchema/inlinecontent.d.ts +66 -3
- package/types/src/react-email/defaultSchema/styles.d.ts +54 -1
- package/types/src/react-email/reactEmailExporter.d.ts +6 -0
|
@@ -1,16 +1,140 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { mapTableCell as
|
|
3
|
-
import { Text as
|
|
4
|
-
import { render as
|
|
1
|
+
import { jsx as l, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import { mapTableCell as T, Exporter as E, COLORS_DEFAULT as R } from "@blocknote/core";
|
|
3
|
+
import { Text as f, Img as A, CodeBlock as D, dracula as F, Heading as W, Link as k, Section as I, Html as Z, Head as z, Body as N, Preview as _, Tailwind as O } from "@react-email/components";
|
|
4
|
+
import { render as j } from "@react-email/render";
|
|
5
5
|
import v from "react";
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
const g = {
|
|
7
|
+
fontSize: 16,
|
|
8
|
+
lineHeight: 1.5,
|
|
9
|
+
margin: 3,
|
|
10
|
+
minHeight: 24
|
|
11
|
+
}, m = {
|
|
12
|
+
paragraph: {
|
|
13
|
+
style: g
|
|
14
|
+
},
|
|
15
|
+
bulletListItem: {
|
|
16
|
+
style: g
|
|
17
|
+
},
|
|
18
|
+
toggleListItem: {
|
|
19
|
+
style: g
|
|
20
|
+
},
|
|
21
|
+
numberedListItem: {
|
|
22
|
+
style: g
|
|
23
|
+
},
|
|
24
|
+
checkListItem: {
|
|
25
|
+
style: g
|
|
26
|
+
},
|
|
27
|
+
quote: {
|
|
28
|
+
style: g
|
|
29
|
+
},
|
|
30
|
+
tableError: {
|
|
31
|
+
style: g
|
|
32
|
+
},
|
|
33
|
+
tableCell: {
|
|
34
|
+
style: g
|
|
35
|
+
},
|
|
36
|
+
caption: {
|
|
37
|
+
style: g
|
|
38
|
+
},
|
|
39
|
+
heading1: {
|
|
40
|
+
style: {
|
|
41
|
+
fontSize: 48,
|
|
42
|
+
margin: 3
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
heading2: {
|
|
46
|
+
style: {
|
|
47
|
+
fontSize: 36,
|
|
48
|
+
margin: 3
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
heading3: {
|
|
52
|
+
style: {
|
|
53
|
+
fontSize: 24,
|
|
54
|
+
margin: 3
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
heading4: {
|
|
58
|
+
style: {
|
|
59
|
+
fontSize: 20,
|
|
60
|
+
margin: 3
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
heading5: {
|
|
64
|
+
style: {
|
|
65
|
+
fontSize: 18,
|
|
66
|
+
margin: 3
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
heading6: {
|
|
70
|
+
style: {
|
|
71
|
+
fontSize: 16,
|
|
72
|
+
margin: 3
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
codeBlock: {
|
|
76
|
+
style: g
|
|
77
|
+
}
|
|
78
|
+
}, H = (r = m) => ({
|
|
79
|
+
paragraph: (e, t) => {
|
|
80
|
+
var n;
|
|
81
|
+
return /* @__PURE__ */ l(
|
|
82
|
+
f,
|
|
83
|
+
{
|
|
84
|
+
...r.paragraph,
|
|
85
|
+
style: {
|
|
86
|
+
...m.paragraph.style,
|
|
87
|
+
...(n = r.paragraph) == null ? void 0 : n.style
|
|
88
|
+
},
|
|
89
|
+
children: t.transformInlineContent(e.content)
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
},
|
|
93
|
+
bulletListItem: (e, t) => {
|
|
94
|
+
var n;
|
|
95
|
+
return /* @__PURE__ */ l(
|
|
96
|
+
f,
|
|
97
|
+
{
|
|
98
|
+
...r.bulletListItem,
|
|
99
|
+
style: {
|
|
100
|
+
...m.bulletListItem.style,
|
|
101
|
+
...(n = r.bulletListItem) == null ? void 0 : n.style
|
|
102
|
+
},
|
|
103
|
+
children: t.transformInlineContent(e.content)
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
},
|
|
107
|
+
toggleListItem: (e, t) => {
|
|
108
|
+
var n;
|
|
109
|
+
return /* @__PURE__ */ l(
|
|
110
|
+
f,
|
|
111
|
+
{
|
|
112
|
+
...r.toggleListItem,
|
|
113
|
+
style: {
|
|
114
|
+
...m.toggleListItem.style,
|
|
115
|
+
...(n = r.toggleListItem) == null ? void 0 : n.style
|
|
116
|
+
},
|
|
117
|
+
children: t.transformInlineContent(e.content)
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
},
|
|
121
|
+
numberedListItem: (e, t, n) => {
|
|
122
|
+
var o;
|
|
123
|
+
return /* @__PURE__ */ l(
|
|
124
|
+
f,
|
|
125
|
+
{
|
|
126
|
+
...r.numberedListItem,
|
|
127
|
+
style: {
|
|
128
|
+
...m.numberedListItem.style,
|
|
129
|
+
...(o = r.numberedListItem) == null ? void 0 : o.style
|
|
130
|
+
},
|
|
131
|
+
children: t.transformInlineContent(e.content)
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
},
|
|
11
135
|
checkListItem: (e, t) => {
|
|
12
|
-
var s;
|
|
13
|
-
const o = ((
|
|
136
|
+
var i, s;
|
|
137
|
+
const o = ((i = e.props) == null ? void 0 : i.checked) ? /* @__PURE__ */ h(
|
|
14
138
|
"svg",
|
|
15
139
|
{
|
|
16
140
|
width: "18",
|
|
@@ -18,7 +142,7 @@ const R = {
|
|
|
18
142
|
viewBox: "0 0 18 18",
|
|
19
143
|
style: { display: "inline", verticalAlign: "middle", marginRight: 8 },
|
|
20
144
|
children: [
|
|
21
|
-
/* @__PURE__ */
|
|
145
|
+
/* @__PURE__ */ l(
|
|
22
146
|
"rect",
|
|
23
147
|
{
|
|
24
148
|
x: "2",
|
|
@@ -31,7 +155,7 @@ const R = {
|
|
|
31
155
|
strokeWidth: "2"
|
|
32
156
|
}
|
|
33
157
|
),
|
|
34
|
-
/* @__PURE__ */
|
|
158
|
+
/* @__PURE__ */ l(
|
|
35
159
|
"polyline",
|
|
36
160
|
{
|
|
37
161
|
points: "5,10 8,13 13,6",
|
|
@@ -42,14 +166,14 @@ const R = {
|
|
|
42
166
|
)
|
|
43
167
|
]
|
|
44
168
|
}
|
|
45
|
-
) : /* @__PURE__ */
|
|
169
|
+
) : /* @__PURE__ */ l(
|
|
46
170
|
"svg",
|
|
47
171
|
{
|
|
48
172
|
width: "18",
|
|
49
173
|
height: "18",
|
|
50
174
|
viewBox: "0 0 18 18",
|
|
51
175
|
style: { display: "inline", verticalAlign: "middle", marginRight: 8 },
|
|
52
|
-
children: /* @__PURE__ */
|
|
176
|
+
children: /* @__PURE__ */ l(
|
|
53
177
|
"rect",
|
|
54
178
|
{
|
|
55
179
|
x: "2",
|
|
@@ -64,27 +188,56 @@ const R = {
|
|
|
64
188
|
)
|
|
65
189
|
}
|
|
66
190
|
);
|
|
67
|
-
return /* @__PURE__ */
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
191
|
+
return /* @__PURE__ */ h(
|
|
192
|
+
f,
|
|
193
|
+
{
|
|
194
|
+
...r.checkListItem,
|
|
195
|
+
style: {
|
|
196
|
+
...m.checkListItem.style,
|
|
197
|
+
...(s = r.checkListItem) == null ? void 0 : s.style
|
|
198
|
+
},
|
|
199
|
+
children: [
|
|
200
|
+
o,
|
|
201
|
+
/* @__PURE__ */ l("span", { children: t.transformInlineContent(e.content) })
|
|
202
|
+
]
|
|
203
|
+
}
|
|
204
|
+
);
|
|
71
205
|
},
|
|
72
|
-
heading: (e, t) =>
|
|
73
|
-
codeBlock: (e) => {
|
|
206
|
+
heading: (e, t) => {
|
|
74
207
|
var n;
|
|
208
|
+
return /* @__PURE__ */ l(
|
|
209
|
+
W,
|
|
210
|
+
{
|
|
211
|
+
as: `h${e.props.level}`,
|
|
212
|
+
...r[`heading${e.props.level}`],
|
|
213
|
+
style: {
|
|
214
|
+
...m[`heading${e.props.level}`].style,
|
|
215
|
+
...(n = r[`heading${e.props.level}`]) == null ? void 0 : n.style
|
|
216
|
+
},
|
|
217
|
+
children: t.transformInlineContent(e.content)
|
|
218
|
+
}
|
|
219
|
+
);
|
|
220
|
+
},
|
|
221
|
+
codeBlock: (e) => {
|
|
222
|
+
var n, o;
|
|
75
223
|
const t = ((n = e.content[0]) == null ? void 0 : n.text) || "";
|
|
76
|
-
return /* @__PURE__ */
|
|
77
|
-
|
|
224
|
+
return /* @__PURE__ */ l(
|
|
225
|
+
D,
|
|
78
226
|
{
|
|
79
227
|
code: t,
|
|
80
228
|
fontFamily: "'CommitMono', monospace",
|
|
81
229
|
language: e.props.language,
|
|
82
|
-
theme:
|
|
230
|
+
theme: F,
|
|
231
|
+
...r.codeBlock,
|
|
232
|
+
style: {
|
|
233
|
+
...m.codeBlock.style,
|
|
234
|
+
...(o = r.codeBlock) == null ? void 0 : o.style
|
|
235
|
+
}
|
|
83
236
|
}
|
|
84
237
|
);
|
|
85
238
|
},
|
|
86
239
|
audio: (e) => {
|
|
87
|
-
const t = /* @__PURE__ */
|
|
240
|
+
const t = /* @__PURE__ */ l(
|
|
88
241
|
"svg",
|
|
89
242
|
{
|
|
90
243
|
height: "18",
|
|
@@ -92,12 +245,12 @@ const R = {
|
|
|
92
245
|
viewBox: "0 0 24 24",
|
|
93
246
|
fill: "#4F8A10",
|
|
94
247
|
style: { display: "inline", verticalAlign: "middle" },
|
|
95
|
-
children: /* @__PURE__ */
|
|
248
|
+
children: /* @__PURE__ */ l("path", { d: "M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z" })
|
|
96
249
|
}
|
|
97
250
|
), n = "previewWidth" in e.props ? e.props.previewWidth : void 0;
|
|
98
|
-
return /* @__PURE__ */
|
|
99
|
-
/* @__PURE__ */
|
|
100
|
-
|
|
251
|
+
return /* @__PURE__ */ h("div", { style: { margin: "8px 0" }, children: [
|
|
252
|
+
/* @__PURE__ */ l(
|
|
253
|
+
x,
|
|
101
254
|
{
|
|
102
255
|
url: e.props.url,
|
|
103
256
|
name: e.props.name,
|
|
@@ -105,11 +258,18 @@ const R = {
|
|
|
105
258
|
icon: t
|
|
106
259
|
}
|
|
107
260
|
),
|
|
108
|
-
/* @__PURE__ */
|
|
261
|
+
/* @__PURE__ */ l(
|
|
262
|
+
L,
|
|
263
|
+
{
|
|
264
|
+
caption: e.props.caption,
|
|
265
|
+
width: n,
|
|
266
|
+
textStyles: r
|
|
267
|
+
}
|
|
268
|
+
)
|
|
109
269
|
] });
|
|
110
270
|
},
|
|
111
271
|
video: (e) => {
|
|
112
|
-
const t = /* @__PURE__ */
|
|
272
|
+
const t = /* @__PURE__ */ l(
|
|
113
273
|
"svg",
|
|
114
274
|
{
|
|
115
275
|
height: "18",
|
|
@@ -117,12 +277,12 @@ const R = {
|
|
|
117
277
|
viewBox: "0 0 24 24",
|
|
118
278
|
fill: "#1976D2",
|
|
119
279
|
style: { display: "inline", verticalAlign: "middle" },
|
|
120
|
-
children: /* @__PURE__ */
|
|
280
|
+
children: /* @__PURE__ */ l("path", { d: "M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z" })
|
|
121
281
|
}
|
|
122
282
|
), n = "previewWidth" in e.props ? e.props.previewWidth : void 0;
|
|
123
|
-
return /* @__PURE__ */
|
|
124
|
-
/* @__PURE__ */
|
|
125
|
-
|
|
283
|
+
return /* @__PURE__ */ h("div", { style: { margin: "8px 0" }, children: [
|
|
284
|
+
/* @__PURE__ */ l(
|
|
285
|
+
x,
|
|
126
286
|
{
|
|
127
287
|
url: e.props.url,
|
|
128
288
|
name: e.props.name,
|
|
@@ -130,11 +290,18 @@ const R = {
|
|
|
130
290
|
icon: t
|
|
131
291
|
}
|
|
132
292
|
),
|
|
133
|
-
/* @__PURE__ */
|
|
293
|
+
/* @__PURE__ */ l(
|
|
294
|
+
L,
|
|
295
|
+
{
|
|
296
|
+
caption: e.props.caption,
|
|
297
|
+
width: n,
|
|
298
|
+
textStyles: r
|
|
299
|
+
}
|
|
300
|
+
)
|
|
134
301
|
] });
|
|
135
302
|
},
|
|
136
303
|
file: (e) => {
|
|
137
|
-
const t = /* @__PURE__ */
|
|
304
|
+
const t = /* @__PURE__ */ l(
|
|
138
305
|
"svg",
|
|
139
306
|
{
|
|
140
307
|
height: "18",
|
|
@@ -142,12 +309,12 @@ const R = {
|
|
|
142
309
|
viewBox: "0 0 24 24",
|
|
143
310
|
fill: "#888",
|
|
144
311
|
style: { display: "inline", verticalAlign: "middle" },
|
|
145
|
-
children: /* @__PURE__ */
|
|
312
|
+
children: /* @__PURE__ */ l("path", { d: "M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z" })
|
|
146
313
|
}
|
|
147
314
|
), n = "previewWidth" in e.props ? e.props.previewWidth : void 0;
|
|
148
|
-
return /* @__PURE__ */
|
|
149
|
-
/* @__PURE__ */
|
|
150
|
-
|
|
315
|
+
return /* @__PURE__ */ h("div", { style: { margin: "8px 0" }, children: [
|
|
316
|
+
/* @__PURE__ */ l(
|
|
317
|
+
x,
|
|
151
318
|
{
|
|
152
319
|
url: e.props.url,
|
|
153
320
|
name: e.props.name,
|
|
@@ -155,11 +322,18 @@ const R = {
|
|
|
155
322
|
icon: t
|
|
156
323
|
}
|
|
157
324
|
),
|
|
158
|
-
/* @__PURE__ */
|
|
325
|
+
/* @__PURE__ */ l(
|
|
326
|
+
L,
|
|
327
|
+
{
|
|
328
|
+
caption: e.props.caption,
|
|
329
|
+
width: n,
|
|
330
|
+
textStyles: r
|
|
331
|
+
}
|
|
332
|
+
)
|
|
159
333
|
] });
|
|
160
334
|
},
|
|
161
|
-
image: (e) => /* @__PURE__ */
|
|
162
|
-
|
|
335
|
+
image: (e) => /* @__PURE__ */ l(
|
|
336
|
+
A,
|
|
163
337
|
{
|
|
164
338
|
src: e.props.url,
|
|
165
339
|
width: e.props.previewWidth,
|
|
@@ -169,9 +343,9 @@ const R = {
|
|
|
169
343
|
table: (e, t) => {
|
|
170
344
|
const n = e.content;
|
|
171
345
|
if (!n || typeof n != "object" || !Array.isArray(n.rows))
|
|
172
|
-
return /* @__PURE__ */
|
|
173
|
-
const o = n.headerRows ?? 0,
|
|
174
|
-
return /* @__PURE__ */
|
|
346
|
+
return /* @__PURE__ */ l(f, { ...r.tableError, children: "Table data not available" });
|
|
347
|
+
const o = n.headerRows ?? 0, i = n.headerCols ?? 0;
|
|
348
|
+
return /* @__PURE__ */ l(
|
|
175
349
|
"table",
|
|
176
350
|
{
|
|
177
351
|
style: {
|
|
@@ -185,49 +359,56 @@ const R = {
|
|
|
185
359
|
border: 0,
|
|
186
360
|
cellPadding: 0,
|
|
187
361
|
cellSpacing: 0,
|
|
188
|
-
children: /* @__PURE__ */
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
362
|
+
children: /* @__PURE__ */ l("tbody", { children: n.rows.map((s, p) => /* @__PURE__ */ l("tr", { children: s.cells.map((u, a) => {
|
|
363
|
+
var b;
|
|
364
|
+
const c = T(u), d = p < o, w = a < i, C = d || w;
|
|
365
|
+
return /* @__PURE__ */ l(
|
|
366
|
+
C ? "th" : "td",
|
|
192
367
|
{
|
|
193
368
|
style: {
|
|
194
369
|
border: "1px solid #ddd",
|
|
195
370
|
padding: "8px 12px",
|
|
196
|
-
background:
|
|
197
|
-
fontWeight:
|
|
198
|
-
textAlign:
|
|
199
|
-
color:
|
|
371
|
+
background: c.props.backgroundColor !== "default" ? t.options.colors[c.props.backgroundColor].background : "inherit",
|
|
372
|
+
fontWeight: C ? "bold" : void 0,
|
|
373
|
+
textAlign: c.props.textAlignment || "left",
|
|
374
|
+
color: c.props.textColor !== "default" ? t.options.colors[c.props.textColor].text : "inherit",
|
|
375
|
+
...m.tableCell.style,
|
|
376
|
+
...(b = r.tableCell) == null ? void 0 : b.style
|
|
200
377
|
},
|
|
201
|
-
...(
|
|
202
|
-
colSpan:
|
|
378
|
+
...(c.props.colspan || 1) > 1 && {
|
|
379
|
+
colSpan: c.props.colspan || 1
|
|
203
380
|
},
|
|
204
|
-
...(
|
|
205
|
-
rowSpan:
|
|
381
|
+
...(c.props.rowspan || 1) > 1 && {
|
|
382
|
+
rowSpan: c.props.rowspan || 1
|
|
206
383
|
},
|
|
207
|
-
children: t.transformInlineContent(
|
|
384
|
+
children: t.transformInlineContent(c.content)
|
|
208
385
|
},
|
|
209
|
-
"row_" +
|
|
386
|
+
"row_" + p + "_col_" + a
|
|
210
387
|
);
|
|
211
|
-
}) }, "row-" +
|
|
388
|
+
}) }, "row-" + p)) })
|
|
212
389
|
}
|
|
213
390
|
);
|
|
214
391
|
},
|
|
215
|
-
quote: (e, t) =>
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
392
|
+
quote: (e, t) => {
|
|
393
|
+
var n;
|
|
394
|
+
return /* @__PURE__ */ l(
|
|
395
|
+
f,
|
|
396
|
+
{
|
|
397
|
+
...r.quote,
|
|
398
|
+
style: {
|
|
399
|
+
borderLeft: "2px solid #bdbdbd",
|
|
400
|
+
padding: "0px 12px",
|
|
401
|
+
fontStyle: "italic",
|
|
402
|
+
color: t.options.colors.gray.text,
|
|
403
|
+
display: "block",
|
|
404
|
+
...m.quote.style,
|
|
405
|
+
...(n = r.quote) == null ? void 0 : n.style
|
|
406
|
+
},
|
|
407
|
+
children: t.transformInlineContent(e.content)
|
|
408
|
+
}
|
|
409
|
+
);
|
|
410
|
+
},
|
|
411
|
+
pageBreak: () => /* @__PURE__ */ l(
|
|
231
412
|
"hr",
|
|
232
413
|
{
|
|
233
414
|
style: {
|
|
@@ -237,17 +418,17 @@ const R = {
|
|
|
237
418
|
}
|
|
238
419
|
}
|
|
239
420
|
)
|
|
240
|
-
};
|
|
241
|
-
function
|
|
242
|
-
url:
|
|
243
|
-
name:
|
|
244
|
-
defaultText:
|
|
245
|
-
icon:
|
|
421
|
+
}), P = H();
|
|
422
|
+
function x({
|
|
423
|
+
url: r,
|
|
424
|
+
name: e,
|
|
425
|
+
defaultText: t,
|
|
426
|
+
icon: n
|
|
246
427
|
}) {
|
|
247
|
-
return /* @__PURE__ */
|
|
248
|
-
|
|
428
|
+
return /* @__PURE__ */ h(
|
|
429
|
+
k,
|
|
249
430
|
{
|
|
250
|
-
href:
|
|
431
|
+
href: r,
|
|
251
432
|
style: {
|
|
252
433
|
textDecoration: "none",
|
|
253
434
|
color: "#333",
|
|
@@ -257,21 +438,42 @@ function y({
|
|
|
257
438
|
fontSize: 16
|
|
258
439
|
},
|
|
259
440
|
children: [
|
|
260
|
-
|
|
261
|
-
/* @__PURE__ */
|
|
441
|
+
n,
|
|
442
|
+
/* @__PURE__ */ l("span", { style: { verticalAlign: "middle" }, children: e || t })
|
|
262
443
|
]
|
|
263
444
|
}
|
|
264
445
|
);
|
|
265
446
|
}
|
|
266
|
-
function
|
|
267
|
-
|
|
447
|
+
function L({
|
|
448
|
+
caption: r,
|
|
449
|
+
width: e,
|
|
450
|
+
textStyles: t
|
|
451
|
+
}) {
|
|
452
|
+
var n;
|
|
453
|
+
return r ? /* @__PURE__ */ l(
|
|
454
|
+
f,
|
|
455
|
+
{
|
|
456
|
+
...t.caption,
|
|
457
|
+
style: {
|
|
458
|
+
width: e,
|
|
459
|
+
fontSize: 13,
|
|
460
|
+
color: "#888",
|
|
461
|
+
margin: "4px 0 0 0",
|
|
462
|
+
...m.caption.style,
|
|
463
|
+
...(n = t.caption) == null ? void 0 : n.style
|
|
464
|
+
},
|
|
465
|
+
children: r
|
|
466
|
+
}
|
|
467
|
+
) : null;
|
|
268
468
|
}
|
|
269
|
-
const
|
|
270
|
-
link:
|
|
469
|
+
const M = {
|
|
470
|
+
link: {}
|
|
471
|
+
}, S = (r = M) => ({
|
|
472
|
+
link: (e, t) => /* @__PURE__ */ h(k, { href: e.href, ...r.link, children: [
|
|
271
473
|
...e.content.map((n) => t.transformStyledText(n))
|
|
272
474
|
] }),
|
|
273
475
|
text: (e, t) => t.transformStyledText(e)
|
|
274
|
-
},
|
|
476
|
+
}), q = S(), B = {}, V = (r = B) => ({
|
|
275
477
|
bold: (e) => e ? {
|
|
276
478
|
fontWeight: "bold"
|
|
277
479
|
} : {},
|
|
@@ -285,157 +487,179 @@ const E = {
|
|
|
285
487
|
strike: (e) => e ? {
|
|
286
488
|
textDecoration: "line-through"
|
|
287
489
|
} : {},
|
|
288
|
-
backgroundColor: (e) =>
|
|
289
|
-
backgroundColor: e
|
|
290
|
-
}
|
|
291
|
-
textColor: (e) => e ? {
|
|
292
|
-
color: e
|
|
490
|
+
backgroundColor: (e, t) => e ? {
|
|
491
|
+
backgroundColor: t.options.colors[e].background
|
|
492
|
+
} : {},
|
|
493
|
+
textColor: (e, t) => e ? {
|
|
494
|
+
color: t.options.colors[e].text
|
|
293
495
|
} : {},
|
|
294
496
|
code: (e) => e ? {
|
|
295
|
-
fontFamily: "
|
|
497
|
+
fontFamily: "GeistMono"
|
|
296
498
|
} : {}
|
|
297
|
-
}, G = {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
499
|
+
}), $ = V(), G = {
|
|
500
|
+
textStyles: m,
|
|
501
|
+
linkStyles: M,
|
|
502
|
+
styleTransformStyles: B
|
|
503
|
+
}, Y = {
|
|
504
|
+
blockMapping: P,
|
|
505
|
+
inlineContentMapping: q,
|
|
506
|
+
styleMapping: $
|
|
507
|
+
}, ee = (r = G) => ({
|
|
508
|
+
blockMapping: H(
|
|
509
|
+
r.textStyles
|
|
510
|
+
),
|
|
511
|
+
inlineContentMapping: S(
|
|
512
|
+
r.linkStyles
|
|
513
|
+
),
|
|
514
|
+
styleMapping: V(
|
|
515
|
+
r.styleTransformStyles
|
|
516
|
+
)
|
|
517
|
+
});
|
|
518
|
+
class te extends E {
|
|
519
|
+
constructor(e, t, n) {
|
|
520
|
+
const i = {
|
|
305
521
|
...{
|
|
306
|
-
colors:
|
|
522
|
+
colors: R
|
|
307
523
|
},
|
|
308
|
-
...
|
|
524
|
+
...n
|
|
309
525
|
};
|
|
310
|
-
super(
|
|
526
|
+
super(e, t, i), this.schema = e;
|
|
311
527
|
}
|
|
312
|
-
transformStyledText(
|
|
313
|
-
const
|
|
314
|
-
return /* @__PURE__ */
|
|
528
|
+
transformStyledText(e) {
|
|
529
|
+
const t = this.mapStyles(e.styles), n = Object.assign({}, ...t);
|
|
530
|
+
return /* @__PURE__ */ l(
|
|
531
|
+
"span",
|
|
532
|
+
{
|
|
533
|
+
style: n,
|
|
534
|
+
dangerouslySetInnerHTML: {
|
|
535
|
+
__html: e.text.replace(/\n/g, "<br />")
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
);
|
|
315
539
|
}
|
|
316
|
-
async renderGroupedListBlocks(t, n
|
|
317
|
-
const
|
|
318
|
-
let
|
|
319
|
-
for (let
|
|
320
|
-
const
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
540
|
+
async renderGroupedListBlocks(e, t, n) {
|
|
541
|
+
const o = e[t].type, i = [];
|
|
542
|
+
let s = t;
|
|
543
|
+
for (let u = 1; s < e.length && e[s].type === o; s++, u++) {
|
|
544
|
+
const a = e[s], c = await this.mapBlock(
|
|
545
|
+
a,
|
|
546
|
+
n,
|
|
547
|
+
u
|
|
324
548
|
);
|
|
325
549
|
let d = [];
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
)),
|
|
331
|
-
/* @__PURE__ */
|
|
332
|
-
|
|
550
|
+
a.children && a.children.length > 0 && (d = await this.renderNestedLists(
|
|
551
|
+
a.children,
|
|
552
|
+
n + 1,
|
|
553
|
+
a.id
|
|
554
|
+
)), i.push(
|
|
555
|
+
/* @__PURE__ */ h("li", { children: [
|
|
556
|
+
c,
|
|
333
557
|
d.length > 0 && d
|
|
334
|
-
] },
|
|
558
|
+
] }, a.id)
|
|
335
559
|
);
|
|
336
560
|
}
|
|
337
561
|
let p;
|
|
338
|
-
return
|
|
562
|
+
return o === "bulletListItem" || o === "toggleListItem" ? p = /* @__PURE__ */ l("ul", { className: "mb-2 list-disc pl-6", children: i }, e[t].id + "-ul") : p = /* @__PURE__ */ l(
|
|
339
563
|
"ol",
|
|
340
564
|
{
|
|
341
565
|
className: "mb-2 list-decimal pl-6",
|
|
342
566
|
start: 1,
|
|
343
|
-
children:
|
|
567
|
+
children: i
|
|
344
568
|
},
|
|
345
|
-
t
|
|
346
|
-
), { element: p, nextIndex:
|
|
569
|
+
e[t].id + "-ol"
|
|
570
|
+
), { element: p, nextIndex: s };
|
|
347
571
|
}
|
|
348
|
-
async renderNestedLists(t, n
|
|
349
|
-
const
|
|
350
|
-
let
|
|
351
|
-
for (;
|
|
352
|
-
const
|
|
353
|
-
if (
|
|
354
|
-
const p =
|
|
355
|
-
let
|
|
356
|
-
for (let
|
|
357
|
-
const d =
|
|
572
|
+
async renderNestedLists(e, t, n) {
|
|
573
|
+
const o = [];
|
|
574
|
+
let i = 0;
|
|
575
|
+
for (; i < e.length; ) {
|
|
576
|
+
const s = e[i];
|
|
577
|
+
if (s.type === "bulletListItem" || s.type === "numberedListItem") {
|
|
578
|
+
const p = s.type, u = [];
|
|
579
|
+
let a = i;
|
|
580
|
+
for (let c = 1; a < e.length && e[a].type === p; a++, c++) {
|
|
581
|
+
const d = e[a], w = await this.mapBlock(
|
|
358
582
|
d,
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
),
|
|
583
|
+
t,
|
|
584
|
+
c
|
|
585
|
+
), C = this.blocknoteDefaultPropsToReactEmailStyle(
|
|
362
586
|
d.props
|
|
363
587
|
);
|
|
364
|
-
let
|
|
365
|
-
d.children && d.children.length > 0 && (d.children[0] && (d.children[0].type === "bulletListItem" || d.children[0].type === "numberedListItem") ?
|
|
588
|
+
let y = [];
|
|
589
|
+
d.children && d.children.length > 0 && (d.children[0] && (d.children[0].type === "bulletListItem" || d.children[0].type === "numberedListItem") ? y = await this.renderNestedLists(
|
|
366
590
|
d.children,
|
|
367
|
-
|
|
591
|
+
t + 1,
|
|
368
592
|
d.id
|
|
369
|
-
) :
|
|
593
|
+
) : y = await this.transformBlocks(
|
|
370
594
|
d.children,
|
|
371
|
-
|
|
372
|
-
)),
|
|
373
|
-
/* @__PURE__ */
|
|
374
|
-
|
|
375
|
-
|
|
595
|
+
t + 1
|
|
596
|
+
)), u.push(
|
|
597
|
+
/* @__PURE__ */ h("li", { style: C, children: [
|
|
598
|
+
w,
|
|
599
|
+
y.length > 0 && /* @__PURE__ */ l("div", { style: { marginTop: "8px" }, children: y })
|
|
376
600
|
] }, d.id)
|
|
377
601
|
);
|
|
378
602
|
}
|
|
379
|
-
p === "bulletListItem" ?
|
|
380
|
-
/* @__PURE__ */
|
|
603
|
+
p === "bulletListItem" ? o.push(
|
|
604
|
+
/* @__PURE__ */ l(
|
|
381
605
|
"ul",
|
|
382
606
|
{
|
|
383
607
|
className: "mb-2 list-disc pl-6",
|
|
384
|
-
children:
|
|
608
|
+
children: u
|
|
385
609
|
},
|
|
386
|
-
|
|
610
|
+
n + "-ul-nested-" + i
|
|
387
611
|
)
|
|
388
|
-
) :
|
|
389
|
-
/* @__PURE__ */
|
|
612
|
+
) : o.push(
|
|
613
|
+
/* @__PURE__ */ l(
|
|
390
614
|
"ol",
|
|
391
615
|
{
|
|
392
616
|
className: "mb-2 list-decimal pl-6",
|
|
393
617
|
start: 1,
|
|
394
|
-
children:
|
|
618
|
+
children: u
|
|
395
619
|
},
|
|
396
|
-
|
|
620
|
+
n + "-ol-nested-" + i
|
|
397
621
|
)
|
|
398
|
-
),
|
|
622
|
+
), i = a;
|
|
399
623
|
} else {
|
|
400
|
-
const p = await this.transformBlocks([
|
|
401
|
-
|
|
402
|
-
/* @__PURE__ */
|
|
403
|
-
),
|
|
624
|
+
const p = await this.transformBlocks([s], t);
|
|
625
|
+
o.push(
|
|
626
|
+
/* @__PURE__ */ l(I, { style: { marginLeft: "24px" }, children: p }, s.id)
|
|
627
|
+
), i++;
|
|
404
628
|
}
|
|
405
629
|
}
|
|
406
|
-
return
|
|
630
|
+
return o;
|
|
407
631
|
}
|
|
408
|
-
async transformBlocks(
|
|
409
|
-
const
|
|
410
|
-
let
|
|
411
|
-
for (;
|
|
412
|
-
const
|
|
413
|
-
if (
|
|
414
|
-
const { element:
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
632
|
+
async transformBlocks(e, t = 0) {
|
|
633
|
+
const n = [];
|
|
634
|
+
let o = 0;
|
|
635
|
+
for (; o < e.length; ) {
|
|
636
|
+
const i = e[o];
|
|
637
|
+
if (i.type === "bulletListItem" || i.type === "numberedListItem" || i.type === "toggleListItem") {
|
|
638
|
+
const { element: a, nextIndex: c } = await this.renderGroupedListBlocks(
|
|
639
|
+
e,
|
|
640
|
+
o,
|
|
641
|
+
t
|
|
418
642
|
);
|
|
419
|
-
|
|
643
|
+
n.push(a), o = c;
|
|
420
644
|
continue;
|
|
421
645
|
}
|
|
422
|
-
const
|
|
423
|
-
|
|
424
|
-
/* @__PURE__ */
|
|
425
|
-
/* @__PURE__ */
|
|
426
|
-
|
|
427
|
-
] },
|
|
428
|
-
),
|
|
646
|
+
const s = await this.transformBlocks(i.children, t + 1), p = await this.mapBlock(i, t, 0), u = this.blocknoteDefaultPropsToReactEmailStyle(i.props);
|
|
647
|
+
n.push(
|
|
648
|
+
/* @__PURE__ */ h(v.Fragment, { children: [
|
|
649
|
+
/* @__PURE__ */ l(I, { style: u, children: p }),
|
|
650
|
+
s.length > 0 && /* @__PURE__ */ l("div", { style: { marginLeft: "24px" }, children: s })
|
|
651
|
+
] }, i.id)
|
|
652
|
+
), o++;
|
|
429
653
|
}
|
|
430
|
-
return
|
|
654
|
+
return n;
|
|
431
655
|
}
|
|
432
|
-
async toReactEmailDocument(
|
|
433
|
-
const
|
|
434
|
-
return
|
|
435
|
-
/* @__PURE__ */
|
|
436
|
-
/* @__PURE__ */
|
|
437
|
-
/* @__PURE__ */
|
|
438
|
-
|
|
656
|
+
async toReactEmailDocument(e, t) {
|
|
657
|
+
const n = await this.transformBlocks(e), o = (t == null ? void 0 : t.container) || (({ children: i }) => /* @__PURE__ */ l(v.Fragment, { children: i }));
|
|
658
|
+
return j(
|
|
659
|
+
/* @__PURE__ */ h(Z, { children: [
|
|
660
|
+
/* @__PURE__ */ l(z, { children: t == null ? void 0 : t.head }),
|
|
661
|
+
/* @__PURE__ */ h(
|
|
662
|
+
N,
|
|
439
663
|
{
|
|
440
664
|
style: {
|
|
441
665
|
fontFamily: "'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif",
|
|
@@ -444,11 +668,11 @@ class U extends L {
|
|
|
444
668
|
color: "#333"
|
|
445
669
|
},
|
|
446
670
|
children: [
|
|
447
|
-
(
|
|
448
|
-
/* @__PURE__ */
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
671
|
+
(t == null ? void 0 : t.preview) && /* @__PURE__ */ l(_, { children: t.preview }),
|
|
672
|
+
/* @__PURE__ */ l(O, { children: /* @__PURE__ */ h(o, { children: [
|
|
673
|
+
t == null ? void 0 : t.header,
|
|
674
|
+
n,
|
|
675
|
+
t == null ? void 0 : t.footer
|
|
452
676
|
] }) })
|
|
453
677
|
]
|
|
454
678
|
}
|
|
@@ -456,17 +680,28 @@ class U extends L {
|
|
|
456
680
|
] })
|
|
457
681
|
);
|
|
458
682
|
}
|
|
459
|
-
blocknoteDefaultPropsToReactEmailStyle(
|
|
683
|
+
blocknoteDefaultPropsToReactEmailStyle(e) {
|
|
460
684
|
return {
|
|
461
|
-
textAlign:
|
|
462
|
-
backgroundColor:
|
|
463
|
-
color:
|
|
464
|
-
alignItems:
|
|
685
|
+
textAlign: e.textAlignment,
|
|
686
|
+
backgroundColor: e.backgroundColor === "default" || !e.backgroundColor ? void 0 : this.options.colors[e.backgroundColor].background,
|
|
687
|
+
color: e.textColor === "default" || !e.textColor ? void 0 : this.options.colors[e.textColor].text,
|
|
688
|
+
alignItems: e.textAlignment === "right" ? "flex-end" : e.textAlignment === "center" ? "center" : void 0
|
|
465
689
|
};
|
|
466
690
|
}
|
|
467
691
|
}
|
|
468
692
|
export {
|
|
469
|
-
|
|
470
|
-
|
|
693
|
+
te as ReactEmailExporter,
|
|
694
|
+
H as createReactEmailBlockMappingForDefaultSchema,
|
|
695
|
+
S as createReactEmailInlineContentMappingForDefaultSchema,
|
|
696
|
+
V as createReactEmailStyleMappingForDefaultSchema,
|
|
697
|
+
G as defaultReactEmailDefaultSchemaStyles,
|
|
698
|
+
M as defaultReactEmailLinkStyles,
|
|
699
|
+
B as defaultReactEmailStyleTransformStyles,
|
|
700
|
+
m as defaultReactEmailTextStyles,
|
|
701
|
+
P as reactEmailBlockMappingForDefaultSchema,
|
|
702
|
+
Y as reactEmailDefaultSchemaMappings,
|
|
703
|
+
ee as reactEmailDefaultSchemaMappingsWithStyles,
|
|
704
|
+
q as reactEmailInlineContentMappingForDefaultSchema,
|
|
705
|
+
$ as reactEmailStyleMappingForDefaultSchema
|
|
471
706
|
};
|
|
472
707
|
//# sourceMappingURL=blocknote-xl-email-exporter.js.map
|