@blocknote/xl-pdf-exporter 0.47.2 → 0.48.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/dist/GeistMono-Regular-BG912g5C.cjs +2 -0
- package/dist/GeistMono-Regular-BG912g5C.cjs.map +1 -0
- package/dist/GeistMono-Regular-D2zmhEYE.js +6 -0
- package/dist/GeistMono-Regular-D2zmhEYE.js.map +1 -0
- package/dist/Inter_18pt-Bold-BJ9YYd-d.cjs +2 -0
- package/dist/Inter_18pt-Bold-BJ9YYd-d.cjs.map +1 -0
- package/dist/Inter_18pt-Bold-CAT0xCdm.js +6 -0
- package/dist/Inter_18pt-Bold-CAT0xCdm.js.map +1 -0
- package/dist/Inter_18pt-BoldItalic-CUvI6MuN.js +6 -0
- package/dist/Inter_18pt-BoldItalic-CUvI6MuN.js.map +1 -0
- package/dist/Inter_18pt-BoldItalic-DIU6URl8.cjs +2 -0
- package/dist/Inter_18pt-BoldItalic-DIU6URl8.cjs.map +1 -0
- package/dist/Inter_18pt-Italic-B09-NoiJ.js +6 -0
- package/dist/Inter_18pt-Italic-B09-NoiJ.js.map +1 -0
- package/dist/Inter_18pt-Italic-CbkMTTYj.cjs +2 -0
- package/dist/Inter_18pt-Italic-CbkMTTYj.cjs.map +1 -0
- package/dist/Inter_18pt-Regular-DjtEslHp.js +6 -0
- package/dist/Inter_18pt-Regular-DjtEslHp.js.map +1 -0
- package/dist/Inter_18pt-Regular-DqCBtXZR.cjs +2 -0
- package/dist/Inter_18pt-Regular-DqCBtXZR.cjs.map +1 -0
- package/dist/blocknote-xl-pdf-exporter.cjs +3 -3
- package/dist/blocknote-xl-pdf-exporter.cjs.map +1 -1
- package/dist/blocknote-xl-pdf-exporter.js +385 -503
- package/dist/blocknote-xl-pdf-exporter.js.map +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +7 -7
- package/dist/GeistMono-Regular--NrcstcO.cjs +0 -2
- package/dist/GeistMono-Regular--NrcstcO.cjs.map +0 -1
- package/dist/GeistMono-Regular-D4rKXxwr.js +0 -5
- package/dist/GeistMono-Regular-D4rKXxwr.js.map +0 -1
- package/dist/Inter_18pt-Bold-BOnnSImi.js +0 -5
- package/dist/Inter_18pt-Bold-BOnnSImi.js.map +0 -1
- package/dist/Inter_18pt-Bold-yKiK3cOU.cjs +0 -2
- package/dist/Inter_18pt-Bold-yKiK3cOU.cjs.map +0 -1
- package/dist/Inter_18pt-BoldItalic-DPKIpVzB.js +0 -5
- package/dist/Inter_18pt-BoldItalic-DPKIpVzB.js.map +0 -1
- package/dist/Inter_18pt-BoldItalic-TUYlzxLL.cjs +0 -2
- package/dist/Inter_18pt-BoldItalic-TUYlzxLL.cjs.map +0 -1
- package/dist/Inter_18pt-Italic-B-14jOMa.cjs +0 -2
- package/dist/Inter_18pt-Italic-B-14jOMa.cjs.map +0 -1
- package/dist/Inter_18pt-Italic-BVnfHlUD.js +0 -5
- package/dist/Inter_18pt-Italic-BVnfHlUD.js.map +0 -1
- package/dist/Inter_18pt-Regular-CCMUw8TC.cjs +0 -2
- package/dist/Inter_18pt-Regular-CCMUw8TC.cjs.map +0 -1
- package/dist/Inter_18pt-Regular-byxnNS-8.js +0 -5
- package/dist/Inter_18pt-Regular-byxnNS-8.js.map +0 -1
|
@@ -1,511 +1,393 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
},
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
"codeBlock" + e.id
|
|
207
|
-
);
|
|
208
|
-
},
|
|
209
|
-
pageBreak: () => /* @__PURE__ */ n(l, { break: !0 }, "pageBreak"),
|
|
210
|
-
divider: () => /* @__PURE__ */ n(
|
|
211
|
-
l,
|
|
212
|
-
{
|
|
213
|
-
style: {
|
|
214
|
-
borderTop: "1px solid #ccc",
|
|
215
|
-
marginTop: 11.5 * c,
|
|
216
|
-
marginBottom: 11.5 * c
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
),
|
|
220
|
-
column: (e, r, t, i, o) => /* @__PURE__ */ n(l, { style: { flex: e.props.width }, children: o }),
|
|
221
|
-
columnList: (e, r, t, i, o) => /* @__PURE__ */ n(
|
|
222
|
-
l,
|
|
223
|
-
{
|
|
224
|
-
style: {
|
|
225
|
-
display: "flex",
|
|
226
|
-
gap: 8 * c,
|
|
227
|
-
flexDirection: "row"
|
|
228
|
-
},
|
|
229
|
-
children: o
|
|
230
|
-
}
|
|
231
|
-
),
|
|
232
|
-
audio: (e, r) => /* @__PURE__ */ f(l, { wrap: !1, children: [
|
|
233
|
-
L(
|
|
234
|
-
e.props,
|
|
235
|
-
"Open audio file",
|
|
236
|
-
/* @__PURE__ */ n(m, { height: 14, width: 14, viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ n(g, { 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" }) })
|
|
237
|
-
),
|
|
238
|
-
H(e.props)
|
|
239
|
-
] }, "audio" + e.id),
|
|
240
|
-
video: (e, r) => /* @__PURE__ */ f(l, { wrap: !1, children: [
|
|
241
|
-
L(
|
|
242
|
-
e.props,
|
|
243
|
-
"Open video file",
|
|
244
|
-
/* @__PURE__ */ n(m, { height: 14, width: 14, viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ n(g, { 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" }) })
|
|
245
|
-
),
|
|
246
|
-
H(e.props)
|
|
247
|
-
] }, "video" + e.id),
|
|
248
|
-
file: (e, r) => /* @__PURE__ */ f(l, { wrap: !1, children: [
|
|
249
|
-
L(
|
|
250
|
-
e.props,
|
|
251
|
-
"Open file",
|
|
252
|
-
/* @__PURE__ */ n(m, { height: 16, width: 16, viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ n(g, { 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" }) })
|
|
253
|
-
),
|
|
254
|
-
H(e.props)
|
|
255
|
-
] }, "file" + e.id),
|
|
256
|
-
image: async (e, r) => /* @__PURE__ */ f(l, { wrap: !1, children: [
|
|
257
|
-
/* @__PURE__ */ n(
|
|
258
|
-
Z,
|
|
259
|
-
{
|
|
260
|
-
src: await r.resolveFile(e.props.url),
|
|
261
|
-
style: {
|
|
262
|
-
width: e.props.previewWidth ? e.props.previewWidth * c : void 0
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
),
|
|
266
|
-
H(e.props)
|
|
267
|
-
] }, "image" + e.id),
|
|
268
|
-
table: (e, r) => /* @__PURE__ */ n($, { data: e.content, transformer: r }, "table" + e.id)
|
|
1
|
+
import { Document as e, Font as t, Image as n, Link as r, Page as i, Path as a, StyleSheet as o, Svg as s, Text as c, View as l } from "@react-pdf/renderer";
|
|
2
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
3
|
+
import { COLORS_DEFAULT as p, Exporter as m, mapTableCell as h } from "@blocknote/core";
|
|
4
|
+
import { Fragment as g } from "react";
|
|
5
|
+
//#region src/pdf/util/listItem.tsx
|
|
6
|
+
var _ = o.create({
|
|
7
|
+
listItem: {
|
|
8
|
+
display: "flex",
|
|
9
|
+
flexDirection: "row",
|
|
10
|
+
gap: 8 * .75,
|
|
11
|
+
paddingRight: 10
|
|
12
|
+
},
|
|
13
|
+
bullet: {}
|
|
14
|
+
}), v = /* @__PURE__ */ d(s, {
|
|
15
|
+
style: { marginTop: 2 },
|
|
16
|
+
height: "12",
|
|
17
|
+
viewBox: "0 -960 960 960",
|
|
18
|
+
width: "12",
|
|
19
|
+
fill: "undefined",
|
|
20
|
+
children: /* @__PURE__ */ d(a, { d: "M472-480 332-620q-18-18-18-44t18-44q18-18 44-18t44 18l183 183q9 9 14 21t5 24q0 12-5 24t-14 21L420-252q-18 18-44 18t-44-18q-18-18-18-44t18-44l140-140Z" })
|
|
21
|
+
}), y = /* @__PURE__ */ d(s, {
|
|
22
|
+
style: { marginTop: 2 },
|
|
23
|
+
height: "12",
|
|
24
|
+
viewBox: "0 -960 960 960",
|
|
25
|
+
width: "12",
|
|
26
|
+
fill: "undefined",
|
|
27
|
+
children: /* @__PURE__ */ d(a, { d: "M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Z" })
|
|
28
|
+
}), b = /* @__PURE__ */ d(s, {
|
|
29
|
+
style: { marginTop: 2 },
|
|
30
|
+
height: "12",
|
|
31
|
+
viewBox: "0 -960 960 960",
|
|
32
|
+
width: "12",
|
|
33
|
+
fill: "undefined",
|
|
34
|
+
children: /* @__PURE__ */ d(a, { d: "m424-312 282-282-56-56-226 226-114-114-56 56 170 170ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z" })
|
|
35
|
+
}), x = ({ listMarker: e, children: t, style: n }) => /* @__PURE__ */ f(l, {
|
|
36
|
+
style: [_.listItem, n || {}],
|
|
37
|
+
children: [/* @__PURE__ */ d(l, {
|
|
38
|
+
style: _.bullet,
|
|
39
|
+
children: typeof e == "string" ? /* @__PURE__ */ d(c, { children: e }) : e
|
|
40
|
+
}), t]
|
|
41
|
+
}), S = .75, C = o.create({
|
|
42
|
+
tableContainer: {},
|
|
43
|
+
row: {
|
|
44
|
+
flexDirection: "row",
|
|
45
|
+
flexWrap: "wrap",
|
|
46
|
+
display: "flex"
|
|
47
|
+
},
|
|
48
|
+
cell: {
|
|
49
|
+
paddingHorizontal: 5 * S,
|
|
50
|
+
paddingTop: 3 * S,
|
|
51
|
+
borderLeft: "1px solid #ddd",
|
|
52
|
+
borderTop: "1px solid #ddd",
|
|
53
|
+
wordWrap: "break-word",
|
|
54
|
+
whiteSpace: "pre-wrap"
|
|
55
|
+
},
|
|
56
|
+
headerCell: { fontWeight: "bold" },
|
|
57
|
+
bottomCell: { borderBottom: "1px solid #ddd" },
|
|
58
|
+
rightCell: { borderRight: "1px solid #ddd" }
|
|
59
|
+
}), w = (e) => {
|
|
60
|
+
let t = Array(e.data.headerRows ?? 0).fill(!0), n = Array(e.data.headerCols ?? 0).fill(!0);
|
|
61
|
+
return /* @__PURE__ */ d(l, {
|
|
62
|
+
style: C.tableContainer,
|
|
63
|
+
wrap: !1,
|
|
64
|
+
children: e.data.rows.map((r, i) => /* @__PURE__ */ d(l, {
|
|
65
|
+
style: [C.row, i === e.data.rows.length - 1 ? C.bottomCell : {}],
|
|
66
|
+
children: r.cells.map((a, o) => {
|
|
67
|
+
let s = h(a), c = t[i], u = n[o];
|
|
68
|
+
return /* @__PURE__ */ d(l, {
|
|
69
|
+
style: [
|
|
70
|
+
C.cell,
|
|
71
|
+
c || u ? C.headerCell : {},
|
|
72
|
+
o === r.cells.length - 1 ? C.rightCell : {},
|
|
73
|
+
e.data.columnWidths[o] ? { width: e.data.columnWidths[o] } : { flex: 1 },
|
|
74
|
+
{
|
|
75
|
+
color: s.props.textColor === "default" ? void 0 : e.transformer.options.colors[s.props.textColor]?.text,
|
|
76
|
+
backgroundColor: s.props.backgroundColor === "default" ? void 0 : e.transformer.options.colors[s.props.backgroundColor]?.background,
|
|
77
|
+
textAlign: s.props.textAlignment
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
children: e.transformer.transformInlineContent(s.content)
|
|
81
|
+
}, o);
|
|
82
|
+
})
|
|
83
|
+
}, i))
|
|
84
|
+
});
|
|
85
|
+
}, T = .75, E = 16, D = {
|
|
86
|
+
paragraph: (e, t) => /* @__PURE__ */ d(c, { children: t.transformInlineContent(e.content) }, "paragraph" + e.id),
|
|
87
|
+
toggleListItem: (e, t) => /* @__PURE__ */ d(x, {
|
|
88
|
+
listMarker: v,
|
|
89
|
+
children: /* @__PURE__ */ d(c, { children: t.transformInlineContent(e.content) })
|
|
90
|
+
}),
|
|
91
|
+
bulletListItem: (e, t) => /* @__PURE__ */ d(x, {
|
|
92
|
+
listMarker: "•",
|
|
93
|
+
children: /* @__PURE__ */ d(c, { children: t.transformInlineContent(e.content) })
|
|
94
|
+
}, "bulletListItem" + e.id),
|
|
95
|
+
numberedListItem: (e, t, n, r) => /* @__PURE__ */ d(x, {
|
|
96
|
+
listMarker: `${r}.`,
|
|
97
|
+
children: /* @__PURE__ */ d(c, { children: t.transformInlineContent(e.content) })
|
|
98
|
+
}, "numberedListItem" + e.id),
|
|
99
|
+
checkListItem: (e, t) => /* @__PURE__ */ d(x, {
|
|
100
|
+
listMarker: e.props.checked ? b : y,
|
|
101
|
+
children: /* @__PURE__ */ d(c, { children: t.transformInlineContent(e.content) })
|
|
102
|
+
}, "checkListItem" + e.id),
|
|
103
|
+
heading: (e, t) => {
|
|
104
|
+
let n = {
|
|
105
|
+
1: 2,
|
|
106
|
+
2: 1.5,
|
|
107
|
+
3: 1.17,
|
|
108
|
+
4: 1,
|
|
109
|
+
5: .83,
|
|
110
|
+
6: .67
|
|
111
|
+
}[e.props.level];
|
|
112
|
+
return /* @__PURE__ */ d(c, {
|
|
113
|
+
style: {
|
|
114
|
+
fontSize: n * E * T,
|
|
115
|
+
lineHeight: 1.25,
|
|
116
|
+
fontWeight: 700
|
|
117
|
+
},
|
|
118
|
+
children: t.transformInlineContent(e.content)
|
|
119
|
+
}, "heading" + e.id);
|
|
120
|
+
},
|
|
121
|
+
quote: (e, t) => /* @__PURE__ */ d(c, {
|
|
122
|
+
style: {
|
|
123
|
+
borderLeft: "#7D797A",
|
|
124
|
+
color: "#7D797A",
|
|
125
|
+
paddingLeft: 9.5 * T
|
|
126
|
+
},
|
|
127
|
+
children: t.transformInlineContent(e.content)
|
|
128
|
+
}, "quote" + e.id),
|
|
129
|
+
codeBlock: (e) => {
|
|
130
|
+
let t = (e.content[0]?.text || "").split("\n").map((t, n) => /* @__PURE__ */ d(c, {
|
|
131
|
+
style: { marginLeft: (t.match(/^\s*/)?.[0].length || 0) * 9.5 * T },
|
|
132
|
+
children: t.trimStart() || /* @__PURE__ */ d(u, { children: "\xA0" })
|
|
133
|
+
}, `line_${n}` + e.id));
|
|
134
|
+
return /* @__PURE__ */ d(l, {
|
|
135
|
+
wrap: !1,
|
|
136
|
+
style: {
|
|
137
|
+
padding: 24 * T,
|
|
138
|
+
backgroundColor: "#161616",
|
|
139
|
+
color: "#ffffff",
|
|
140
|
+
lineHeight: 1.25,
|
|
141
|
+
fontSize: E * T,
|
|
142
|
+
fontFamily: "GeistMono"
|
|
143
|
+
},
|
|
144
|
+
children: t
|
|
145
|
+
}, "codeBlock" + e.id);
|
|
146
|
+
},
|
|
147
|
+
pageBreak: () => /* @__PURE__ */ d(l, { break: !0 }, "pageBreak"),
|
|
148
|
+
divider: () => /* @__PURE__ */ d(l, { style: {
|
|
149
|
+
borderTop: "1px solid #ccc",
|
|
150
|
+
marginTop: 11.5 * T,
|
|
151
|
+
marginBottom: 11.5 * T
|
|
152
|
+
} }),
|
|
153
|
+
column: (e, t, n, r, i) => /* @__PURE__ */ d(l, {
|
|
154
|
+
style: { flex: e.props.width },
|
|
155
|
+
children: i
|
|
156
|
+
}),
|
|
157
|
+
columnList: (e, t, n, r, i) => /* @__PURE__ */ d(l, {
|
|
158
|
+
style: {
|
|
159
|
+
display: "flex",
|
|
160
|
+
gap: 8 * T,
|
|
161
|
+
flexDirection: "row"
|
|
162
|
+
},
|
|
163
|
+
children: i
|
|
164
|
+
}),
|
|
165
|
+
audio: (e, t) => /* @__PURE__ */ f(l, {
|
|
166
|
+
wrap: !1,
|
|
167
|
+
children: [O(e.props, "Open audio file", /* @__PURE__ */ d(s, {
|
|
168
|
+
height: 14,
|
|
169
|
+
width: 14,
|
|
170
|
+
viewBox: "0 0 24 24",
|
|
171
|
+
fill: "currentColor",
|
|
172
|
+
children: /* @__PURE__ */ d(a, { 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" })
|
|
173
|
+
}), t), k(e.props, t)]
|
|
174
|
+
}, "audio" + e.id),
|
|
175
|
+
video: (e, t) => /* @__PURE__ */ f(l, {
|
|
176
|
+
wrap: !1,
|
|
177
|
+
children: [O(e.props, "Open video file", /* @__PURE__ */ d(s, {
|
|
178
|
+
height: 14,
|
|
179
|
+
width: 14,
|
|
180
|
+
viewBox: "0 0 24 24",
|
|
181
|
+
fill: "currentColor",
|
|
182
|
+
children: /* @__PURE__ */ d(a, { 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" })
|
|
183
|
+
}), t), k(e.props, t)]
|
|
184
|
+
}, "video" + e.id),
|
|
185
|
+
file: (e, t) => /* @__PURE__ */ f(l, {
|
|
186
|
+
wrap: !1,
|
|
187
|
+
children: [O(e.props, "Open file", /* @__PURE__ */ d(s, {
|
|
188
|
+
height: 16,
|
|
189
|
+
width: 16,
|
|
190
|
+
viewBox: "0 0 24 24",
|
|
191
|
+
fill: "currentColor",
|
|
192
|
+
children: /* @__PURE__ */ d(a, { 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" })
|
|
193
|
+
}), t), k(e.props, t)]
|
|
194
|
+
}, "file" + e.id),
|
|
195
|
+
image: async (e, t) => /* @__PURE__ */ f(l, {
|
|
196
|
+
wrap: !1,
|
|
197
|
+
children: [/* @__PURE__ */ d(n, {
|
|
198
|
+
src: await t.resolveFile(e.props.url),
|
|
199
|
+
style: { width: e.props.previewWidth ? e.props.previewWidth * T : void 0 }
|
|
200
|
+
}), k(e.props, t)]
|
|
201
|
+
}, "image" + e.id),
|
|
202
|
+
table: (e, t) => /* @__PURE__ */ d(w, {
|
|
203
|
+
data: e.content,
|
|
204
|
+
transformer: t
|
|
205
|
+
}, "table" + e.id)
|
|
269
206
|
};
|
|
270
|
-
function
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
]
|
|
283
|
-
}
|
|
284
|
-
) }, "file" + e.url);
|
|
207
|
+
function O(e, t, n, i) {
|
|
208
|
+
return /* @__PURE__ */ d(r, {
|
|
209
|
+
src: e.url,
|
|
210
|
+
children: /* @__PURE__ */ f(l, {
|
|
211
|
+
style: {
|
|
212
|
+
display: "flex",
|
|
213
|
+
gap: 8 * .75,
|
|
214
|
+
flexDirection: "row"
|
|
215
|
+
},
|
|
216
|
+
children: [n, /* @__PURE__ */ d(c, { children: e.name || t })]
|
|
217
|
+
})
|
|
218
|
+
}, "file" + e.url);
|
|
285
219
|
}
|
|
286
|
-
function
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
},
|
|
295
|
-
children: e.caption
|
|
296
|
-
},
|
|
297
|
-
"caption" + e.caption
|
|
298
|
-
);
|
|
220
|
+
function k(e, t) {
|
|
221
|
+
if (e.caption) return /* @__PURE__ */ d(c, {
|
|
222
|
+
style: {
|
|
223
|
+
width: e.previewWidth ? e.previewWidth * T : void 0,
|
|
224
|
+
fontSize: E * .8 * T
|
|
225
|
+
},
|
|
226
|
+
children: e.caption
|
|
227
|
+
}, "caption" + e.caption);
|
|
299
228
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
backgroundColor: (t = r.options.colors[e]) == null ? void 0 : t.background
|
|
321
|
-
} : {};
|
|
322
|
-
},
|
|
323
|
-
textColor: (e, r) => {
|
|
324
|
-
var t;
|
|
325
|
-
return e ? {
|
|
326
|
-
color: (t = r.options.colors[e]) == null ? void 0 : t.text
|
|
327
|
-
} : {};
|
|
328
|
-
},
|
|
329
|
-
code: (e) => e ? {
|
|
330
|
-
fontFamily: "GeistMono"
|
|
331
|
-
} : {}
|
|
332
|
-
}, oe = {
|
|
333
|
-
blockMapping: X,
|
|
334
|
-
inlineContentMapping: G,
|
|
335
|
-
styleMapping: J
|
|
229
|
+
//#endregion
|
|
230
|
+
//#region src/pdf/defaultSchema/index.ts
|
|
231
|
+
var A = {
|
|
232
|
+
blockMapping: D,
|
|
233
|
+
inlineContentMapping: {
|
|
234
|
+
link: (e, t) => /* @__PURE__ */ d(r, {
|
|
235
|
+
href: e.href,
|
|
236
|
+
children: e.content.map((e) => t.transformStyledText(e))
|
|
237
|
+
}, "link" + e.href),
|
|
238
|
+
text: (e, t) => t.transformStyledText(e)
|
|
239
|
+
},
|
|
240
|
+
styleMapping: {
|
|
241
|
+
bold: (e) => e ? { fontWeight: "bold" } : {},
|
|
242
|
+
italic: (e) => e ? { fontStyle: "italic" } : {},
|
|
243
|
+
underline: (e) => e ? { textDecoration: "underline" } : {},
|
|
244
|
+
strike: (e) => e ? { textDecoration: "line-through" } : {},
|
|
245
|
+
backgroundColor: (e, t) => e ? { backgroundColor: t.options.colors[e]?.background } : {},
|
|
246
|
+
textColor: (e, t) => e ? { color: t.options.colors[e]?.text } : {},
|
|
247
|
+
code: (e) => e ? { fontFamily: "GeistMono" } : {}
|
|
248
|
+
}
|
|
336
249
|
};
|
|
337
|
-
|
|
338
|
-
|
|
250
|
+
//#endregion
|
|
251
|
+
//#region ../../shared/api/corsProxy.ts
|
|
252
|
+
async function j(e) {
|
|
253
|
+
return "https://corsproxy.api.blocknotejs.org/corsproxy/?url=" + encodeURIComponent(e);
|
|
339
254
|
}
|
|
340
|
-
|
|
341
|
-
|
|
255
|
+
//#endregion
|
|
256
|
+
//#region ../../shared/util/fileUtil.ts
|
|
257
|
+
async function M(e, t) {
|
|
258
|
+
return e.default;
|
|
342
259
|
}
|
|
343
|
-
async function
|
|
344
|
-
|
|
260
|
+
async function N(e) {
|
|
261
|
+
return M(e, "font/ttf");
|
|
345
262
|
}
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
}
|
|
473
|
-
/**
|
|
474
|
-
* Convert a document (array of Blocks) to a react-pdf Document.
|
|
475
|
-
*/
|
|
476
|
-
async toReactPDFDocument(t, i = {}) {
|
|
477
|
-
return await this.registerFonts(), /* @__PURE__ */ n(k, { children: /* @__PURE__ */ f(B, { dpi: 100, size: "A4", style: this.styles.page, children: [
|
|
478
|
-
i.header && /* @__PURE__ */ n(l, { fixed: !0, style: this.styles.header, children: i.header }),
|
|
479
|
-
await this.transformBlocks(t),
|
|
480
|
-
i.footer && /* @__PURE__ */ n(
|
|
481
|
-
l,
|
|
482
|
-
{
|
|
483
|
-
fixed: !0,
|
|
484
|
-
style: [
|
|
485
|
-
{
|
|
486
|
-
left: this.styles.page.paddingHorizontal || 0,
|
|
487
|
-
bottom: (this.styles.page.paddingBottom || 0) / 2,
|
|
488
|
-
right: this.styles.page.paddingHorizontal || 0
|
|
489
|
-
},
|
|
490
|
-
this.styles.footer
|
|
491
|
-
],
|
|
492
|
-
children: i.footer
|
|
493
|
-
}
|
|
494
|
-
)
|
|
495
|
-
] }) });
|
|
496
|
-
}
|
|
497
|
-
blocknoteDefaultPropsToReactPDFStyle(t) {
|
|
498
|
-
var i, o;
|
|
499
|
-
return {
|
|
500
|
-
textAlign: t.textAlignment,
|
|
501
|
-
backgroundColor: t.backgroundColor === "default" || !t.backgroundColor || (i = this.options.colors[t.backgroundColor]) == null ? void 0 : i.background,
|
|
502
|
-
color: t.textColor === "default" || !t.textColor || (o = this.options.colors[t.textColor]) == null ? void 0 : o.text,
|
|
503
|
-
alignItems: t.textAlignment === "right" ? "flex-end" : t.textAlignment === "center" ? "center" : void 0
|
|
504
|
-
};
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
export {
|
|
508
|
-
le as PDFExporter,
|
|
509
|
-
oe as pdfDefaultSchemaMappings
|
|
263
|
+
//#endregion
|
|
264
|
+
//#region src/pdf/pdfExporter.tsx
|
|
265
|
+
var P = 16, F = .75, I = class extends m {
|
|
266
|
+
fontsRegistered = !1;
|
|
267
|
+
styles = o.create({
|
|
268
|
+
page: {
|
|
269
|
+
paddingTop: 35,
|
|
270
|
+
paddingBottom: 65,
|
|
271
|
+
paddingHorizontal: 35,
|
|
272
|
+
fontFamily: "Inter",
|
|
273
|
+
fontSize: P * F,
|
|
274
|
+
lineHeight: 1.5
|
|
275
|
+
},
|
|
276
|
+
block: {},
|
|
277
|
+
blockChildren: {},
|
|
278
|
+
header: {},
|
|
279
|
+
footer: { position: "absolute" }
|
|
280
|
+
});
|
|
281
|
+
options;
|
|
282
|
+
constructor(e, t, n) {
|
|
283
|
+
let r = {
|
|
284
|
+
emojiSource: {
|
|
285
|
+
format: "png",
|
|
286
|
+
url: "https://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/72x72/"
|
|
287
|
+
},
|
|
288
|
+
resolveFileUrl: j,
|
|
289
|
+
colors: p,
|
|
290
|
+
...n
|
|
291
|
+
};
|
|
292
|
+
super(e, t, r), this.schema = e, this.options = r;
|
|
293
|
+
}
|
|
294
|
+
transformStyledText(e) {
|
|
295
|
+
let t = this.mapStyles(e.styles);
|
|
296
|
+
return /* @__PURE__ */ d(c, {
|
|
297
|
+
style: Object.assign({}, ...t),
|
|
298
|
+
children: e.text
|
|
299
|
+
}, e.text);
|
|
300
|
+
}
|
|
301
|
+
async transformBlocks(e, t = 0) {
|
|
302
|
+
let n = [], r = 0;
|
|
303
|
+
for (let i of e) {
|
|
304
|
+
i.type === "numberedListItem" ? r++ : r = 0;
|
|
305
|
+
let e = await this.transformBlocks(i.children, t + 1), a = await this.mapBlock(i, t, r, e);
|
|
306
|
+
if ([
|
|
307
|
+
"pageBreak",
|
|
308
|
+
"columnList",
|
|
309
|
+
"column"
|
|
310
|
+
].includes(i.type)) {
|
|
311
|
+
n.push(a);
|
|
312
|
+
continue;
|
|
313
|
+
}
|
|
314
|
+
let o = this.blocknoteDefaultPropsToReactPDFStyle(i.props);
|
|
315
|
+
n.push(/* @__PURE__ */ f(g, { children: [/* @__PURE__ */ d(l, {
|
|
316
|
+
style: {
|
|
317
|
+
paddingVertical: 3 * F,
|
|
318
|
+
...this.styles.block,
|
|
319
|
+
...o
|
|
320
|
+
},
|
|
321
|
+
children: a
|
|
322
|
+
}), e.length > 0 && /* @__PURE__ */ d(l, {
|
|
323
|
+
style: {
|
|
324
|
+
marginLeft: P * 1.5 * F,
|
|
325
|
+
...this.styles.blockChildren
|
|
326
|
+
},
|
|
327
|
+
children: e
|
|
328
|
+
}, i.id + t + "children")] }, i.id));
|
|
329
|
+
}
|
|
330
|
+
return n;
|
|
331
|
+
}
|
|
332
|
+
async registerFonts() {
|
|
333
|
+
if (this.fontsRegistered) return;
|
|
334
|
+
this.options.emojiSource && t.registerEmojiSource(this.options.emojiSource);
|
|
335
|
+
let e = await N(await import("./Inter_18pt-Regular-DjtEslHp.js"));
|
|
336
|
+
t.register({
|
|
337
|
+
family: "Inter",
|
|
338
|
+
src: e
|
|
339
|
+
}), e = await N(await import("./Inter_18pt-Italic-B09-NoiJ.js")), t.register({
|
|
340
|
+
family: "Inter",
|
|
341
|
+
fontStyle: "italic",
|
|
342
|
+
src: e
|
|
343
|
+
}), e = await N(await import("./Inter_18pt-Bold-CAT0xCdm.js")), t.register({
|
|
344
|
+
family: "Inter",
|
|
345
|
+
src: e,
|
|
346
|
+
fontWeight: "bold"
|
|
347
|
+
}), e = await N(await import("./Inter_18pt-BoldItalic-CUvI6MuN.js")), t.register({
|
|
348
|
+
family: "Inter",
|
|
349
|
+
fontStyle: "italic",
|
|
350
|
+
src: e,
|
|
351
|
+
fontWeight: "bold"
|
|
352
|
+
}), e = await N(await import("./GeistMono-Regular-D2zmhEYE.js")), t.register({
|
|
353
|
+
family: "GeistMono",
|
|
354
|
+
src: e
|
|
355
|
+
}), this.fontsRegistered = !0;
|
|
356
|
+
}
|
|
357
|
+
async toReactPDFDocument(t, n = {}) {
|
|
358
|
+
return await this.registerFonts(), /* @__PURE__ */ d(e, { children: /* @__PURE__ */ f(i, {
|
|
359
|
+
dpi: 100,
|
|
360
|
+
size: "A4",
|
|
361
|
+
style: this.styles.page,
|
|
362
|
+
children: [
|
|
363
|
+
n.header && /* @__PURE__ */ d(l, {
|
|
364
|
+
fixed: !0,
|
|
365
|
+
style: this.styles.header,
|
|
366
|
+
children: n.header
|
|
367
|
+
}),
|
|
368
|
+
await this.transformBlocks(t),
|
|
369
|
+
n.footer && /* @__PURE__ */ d(l, {
|
|
370
|
+
fixed: !0,
|
|
371
|
+
style: [{
|
|
372
|
+
left: this.styles.page.paddingHorizontal || 0,
|
|
373
|
+
bottom: (this.styles.page.paddingBottom || 0) / 2,
|
|
374
|
+
right: this.styles.page.paddingHorizontal || 0
|
|
375
|
+
}, this.styles.footer],
|
|
376
|
+
children: n.footer
|
|
377
|
+
})
|
|
378
|
+
]
|
|
379
|
+
}) });
|
|
380
|
+
}
|
|
381
|
+
blocknoteDefaultPropsToReactPDFStyle(e) {
|
|
382
|
+
return {
|
|
383
|
+
textAlign: e.textAlignment,
|
|
384
|
+
backgroundColor: e.backgroundColor === "default" || !e.backgroundColor ? void 0 : this.options.colors[e.backgroundColor]?.background,
|
|
385
|
+
color: e.textColor === "default" || !e.textColor ? void 0 : this.options.colors[e.textColor]?.text,
|
|
386
|
+
alignItems: e.textAlignment === "right" ? "flex-end" : e.textAlignment === "center" ? "center" : void 0
|
|
387
|
+
};
|
|
388
|
+
}
|
|
510
389
|
};
|
|
511
|
-
//#
|
|
390
|
+
//#endregion
|
|
391
|
+
export { I as PDFExporter, A as pdfDefaultSchemaMappings };
|
|
392
|
+
|
|
393
|
+
//# sourceMappingURL=blocknote-xl-pdf-exporter.js.map
|