@blocknote/xl-pdf-exporter 0.26.0 → 0.27.2
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/blocknote-xl-pdf-exporter.cjs +2 -2
- package/dist/blocknote-xl-pdf-exporter.cjs.map +1 -1
- package/dist/blocknote-xl-pdf-exporter.js +123 -127
- package/dist/blocknote-xl-pdf-exporter.js.map +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +22 -18
- package/src/pdf/defaultSchema/blocks.tsx +12 -0
- package/src/pdf/defaultSchema/index.ts +5 -1
- package/src/pdf/pdfExporter.test.tsx +2 -2
- package/types/src/pdf/defaultSchema/blocks.d.ts +0 -1
- package/types/src/pdf/defaultSchema/index.d.ts +6 -527
- package/types/src/pdf/defaultSchema/inlinecontent.d.ts +0 -1
- package/types/src/pdf/pdfExporter.d.ts +2 -3
- package/types/src/pdf/util/listItem.d.ts +3 -3
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { jsx as n, jsxs as f, Fragment as
|
|
5
|
-
import {
|
|
6
|
-
import { mapTableCell as
|
|
7
|
-
const
|
|
1
|
+
var P = Object.defineProperty;
|
|
2
|
+
var R = (t, r, e) => r in t ? P(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e;
|
|
3
|
+
var x = (t, r, e) => R(t, typeof r != "symbol" ? r + "" : r, e);
|
|
4
|
+
import { jsx as n, jsxs as f, Fragment as L } from "react/jsx-runtime";
|
|
5
|
+
import { View as l, StyleSheet as T, Text as d, Svg as m, Path as C, Image as D, Link as V, Font as p, Document as _, Page as Z } from "@react-pdf/renderer";
|
|
6
|
+
import { mapTableCell as F, Exporter as B, COLORS_DEFAULT as A } from "@blocknote/core";
|
|
7
|
+
const O = 0.75, v = T.create({
|
|
8
8
|
listItem: {
|
|
9
9
|
display: "flex",
|
|
10
10
|
flexDirection: "row",
|
|
11
|
-
gap: 8 *
|
|
11
|
+
gap: 8 * O,
|
|
12
12
|
paddingRight: 10
|
|
13
13
|
// otherwise text overflows, seems like a react-pdf / yoga bug
|
|
14
14
|
},
|
|
@@ -23,7 +23,7 @@ const N = 0.75, V = v.create({
|
|
|
23
23
|
viewBox: "0 -960 960 960",
|
|
24
24
|
width: "12",
|
|
25
25
|
fill: "undefined",
|
|
26
|
-
children: /* @__PURE__ */ n(
|
|
26
|
+
children: /* @__PURE__ */ n(C, { 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" })
|
|
27
27
|
}
|
|
28
28
|
), z = /* @__PURE__ */ n(
|
|
29
29
|
m,
|
|
@@ -33,16 +33,16 @@ const N = 0.75, V = v.create({
|
|
|
33
33
|
viewBox: "0 -960 960 960",
|
|
34
34
|
width: "12",
|
|
35
35
|
fill: "undefined",
|
|
36
|
-
children: /* @__PURE__ */ n(
|
|
36
|
+
children: /* @__PURE__ */ n(C, { 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" })
|
|
37
37
|
}
|
|
38
38
|
), H = ({
|
|
39
39
|
listMarker: t,
|
|
40
40
|
children: r,
|
|
41
41
|
style: e
|
|
42
|
-
}) => /* @__PURE__ */ f(
|
|
43
|
-
/* @__PURE__ */ n(
|
|
42
|
+
}) => /* @__PURE__ */ f(l, { style: [v.listItem, e || {}], children: [
|
|
43
|
+
/* @__PURE__ */ n(l, { style: v.bullet, children: typeof t == "string" ? /* @__PURE__ */ n(d, { children: t }) : t }),
|
|
44
44
|
r
|
|
45
|
-
] }),
|
|
45
|
+
] }), k = 0.75, u = T.create({
|
|
46
46
|
tableContainer: {
|
|
47
47
|
// width: "100%",
|
|
48
48
|
},
|
|
@@ -54,8 +54,8 @@ const N = 0.75, V = v.create({
|
|
|
54
54
|
display: "flex"
|
|
55
55
|
},
|
|
56
56
|
cell: {
|
|
57
|
-
paddingHorizontal: 5 *
|
|
58
|
-
paddingTop: 3 *
|
|
57
|
+
paddingHorizontal: 5 * k,
|
|
58
|
+
paddingTop: 3 * k,
|
|
59
59
|
// paddingBottom: 1 * PIXELS_PER_POINT, should be 3px but looks odd, better with no padding Bottom
|
|
60
60
|
borderLeft: "1px solid #ddd",
|
|
61
61
|
borderTop: "1px solid #ddd",
|
|
@@ -71,25 +71,25 @@ const N = 0.75, V = v.create({
|
|
|
71
71
|
rightCell: {
|
|
72
72
|
borderRight: "1px solid #ddd"
|
|
73
73
|
}
|
|
74
|
-
}),
|
|
74
|
+
}), q = (t) => {
|
|
75
75
|
const r = new Array(t.data.headerRows ?? 0).fill(!0), e = new Array(t.data.headerCols ?? 0).fill(!0);
|
|
76
|
-
return /* @__PURE__ */ n(
|
|
77
|
-
|
|
76
|
+
return /* @__PURE__ */ n(l, { style: u.tableContainer, wrap: !1, children: t.data.rows.map((o, s) => /* @__PURE__ */ n(
|
|
77
|
+
l,
|
|
78
78
|
{
|
|
79
79
|
style: [
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
u.row,
|
|
81
|
+
s === t.data.rows.length - 1 ? u.bottomCell : {}
|
|
82
82
|
],
|
|
83
|
-
children: o.cells.map((
|
|
84
|
-
const a =
|
|
83
|
+
children: o.cells.map((c, i) => {
|
|
84
|
+
const a = F(c), y = r[s], b = e[i];
|
|
85
85
|
return /* @__PURE__ */ n(
|
|
86
|
-
|
|
86
|
+
l,
|
|
87
87
|
{
|
|
88
88
|
style: [
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
t.data.columnWidths[
|
|
89
|
+
u.cell,
|
|
90
|
+
y || b ? u.headerCell : {},
|
|
91
|
+
i === o.cells.length - 1 ? u.rightCell : {},
|
|
92
|
+
t.data.columnWidths[i] ? { width: t.data.columnWidths[i] } : { flex: 1 },
|
|
93
93
|
{
|
|
94
94
|
color: a.props.textColor === "default" ? void 0 : t.transformer.options.colors[a.props.textColor].text,
|
|
95
95
|
backgroundColor: a.props.backgroundColor === "default" ? void 0 : t.transformer.options.colors[a.props.backgroundColor].background,
|
|
@@ -98,29 +98,29 @@ const N = 0.75, V = v.create({
|
|
|
98
98
|
],
|
|
99
99
|
children: t.transformer.transformInlineContent(a.content)
|
|
100
100
|
},
|
|
101
|
-
|
|
101
|
+
i
|
|
102
102
|
);
|
|
103
103
|
})
|
|
104
104
|
},
|
|
105
|
-
|
|
105
|
+
s
|
|
106
106
|
)) });
|
|
107
|
-
}, h = 0.75, M = 16,
|
|
108
|
-
paragraph: (t, r) => /* @__PURE__ */ n(
|
|
109
|
-
bulletListItem: (t, r) => /* @__PURE__ */ n(H, { listMarker: W, children: /* @__PURE__ */ n(
|
|
110
|
-
numberedListItem: (t, r, e, o) => /* @__PURE__ */ n(H, { listMarker: `${o}.`, children: /* @__PURE__ */ n(
|
|
107
|
+
}, h = 0.75, M = 16, N = {
|
|
108
|
+
paragraph: (t, r) => /* @__PURE__ */ n(d, { children: r.transformInlineContent(t.content) }),
|
|
109
|
+
bulletListItem: (t, r) => /* @__PURE__ */ n(H, { listMarker: W, children: /* @__PURE__ */ n(d, { children: r.transformInlineContent(t.content) }) }),
|
|
110
|
+
numberedListItem: (t, r, e, o) => /* @__PURE__ */ n(H, { listMarker: `${o}.`, children: /* @__PURE__ */ n(d, { children: r.transformInlineContent(t.content) }) }),
|
|
111
111
|
// would be nice to have pdf checkboxes:
|
|
112
112
|
// https://github.com/diegomura/react-pdf/issues/2103
|
|
113
113
|
checkListItem: (t, r) => /* @__PURE__ */ n(
|
|
114
114
|
H,
|
|
115
115
|
{
|
|
116
116
|
listMarker: t.props.checked ? z : j,
|
|
117
|
-
children: /* @__PURE__ */ n(
|
|
117
|
+
children: /* @__PURE__ */ n(d, { children: r.transformInlineContent(t.content) })
|
|
118
118
|
}
|
|
119
119
|
),
|
|
120
120
|
heading: (t, r) => {
|
|
121
121
|
const e = t.props.level === 1 ? 2 : t.props.level === 2 ? 1.5 : 1.17;
|
|
122
122
|
return /* @__PURE__ */ n(
|
|
123
|
-
|
|
123
|
+
d,
|
|
124
124
|
{
|
|
125
125
|
style: {
|
|
126
126
|
fontSize: e * M * h,
|
|
@@ -130,25 +130,36 @@ const N = 0.75, V = v.create({
|
|
|
130
130
|
}
|
|
131
131
|
);
|
|
132
132
|
},
|
|
133
|
+
quote: (t, r) => /* @__PURE__ */ n(
|
|
134
|
+
d,
|
|
135
|
+
{
|
|
136
|
+
style: {
|
|
137
|
+
borderLeft: "#7D797A",
|
|
138
|
+
color: "#7D797A",
|
|
139
|
+
paddingLeft: 9.5 * h
|
|
140
|
+
},
|
|
141
|
+
children: r.transformInlineContent(t.content)
|
|
142
|
+
}
|
|
143
|
+
),
|
|
133
144
|
codeBlock: (t) => {
|
|
134
145
|
var o;
|
|
135
146
|
const e = (((o = t.content[0]) == null ? void 0 : o.text) || "").split(`
|
|
136
|
-
`).map((
|
|
147
|
+
`).map((s, c) => {
|
|
137
148
|
var a;
|
|
138
|
-
const
|
|
149
|
+
const i = ((a = s.match(/^\s*/)) == null ? void 0 : a[0].length) || 0;
|
|
139
150
|
return /* @__PURE__ */ n(
|
|
140
|
-
|
|
151
|
+
d,
|
|
141
152
|
{
|
|
142
153
|
style: {
|
|
143
|
-
marginLeft:
|
|
154
|
+
marginLeft: i * 9.5 * h
|
|
144
155
|
},
|
|
145
|
-
children:
|
|
156
|
+
children: s.trimStart() || /* @__PURE__ */ n(L, { children: " " })
|
|
146
157
|
},
|
|
147
|
-
`line_${
|
|
158
|
+
`line_${c}`
|
|
148
159
|
);
|
|
149
160
|
});
|
|
150
161
|
return /* @__PURE__ */ n(
|
|
151
|
-
|
|
162
|
+
l,
|
|
152
163
|
{
|
|
153
164
|
wrap: !1,
|
|
154
165
|
style: {
|
|
@@ -163,32 +174,32 @@ const N = 0.75, V = v.create({
|
|
|
163
174
|
}
|
|
164
175
|
);
|
|
165
176
|
},
|
|
166
|
-
pageBreak: () => /* @__PURE__ */ n(
|
|
167
|
-
audio: (t, r) => /* @__PURE__ */ f(
|
|
177
|
+
pageBreak: () => /* @__PURE__ */ n(l, { break: !0 }),
|
|
178
|
+
audio: (t, r) => /* @__PURE__ */ f(l, { wrap: !1, children: [
|
|
168
179
|
S(
|
|
169
180
|
t.props,
|
|
170
181
|
"Open audio file",
|
|
171
|
-
/* @__PURE__ */ n(m, { height: 14, width: 14, viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ n(
|
|
182
|
+
/* @__PURE__ */ n(m, { height: 14, width: 14, viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ n(C, { 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" }) })
|
|
172
183
|
),
|
|
173
|
-
|
|
184
|
+
w(t.props)
|
|
174
185
|
] }),
|
|
175
|
-
video: (t, r) => /* @__PURE__ */ f(
|
|
186
|
+
video: (t, r) => /* @__PURE__ */ f(l, { wrap: !1, children: [
|
|
176
187
|
S(
|
|
177
188
|
t.props,
|
|
178
189
|
"Open video file",
|
|
179
|
-
/* @__PURE__ */ n(m, { height: 14, width: 14, viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ n(
|
|
190
|
+
/* @__PURE__ */ n(m, { height: 14, width: 14, viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ n(C, { 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" }) })
|
|
180
191
|
),
|
|
181
|
-
|
|
192
|
+
w(t.props)
|
|
182
193
|
] }),
|
|
183
|
-
file: (t, r) => /* @__PURE__ */ f(
|
|
194
|
+
file: (t, r) => /* @__PURE__ */ f(l, { wrap: !1, children: [
|
|
184
195
|
S(
|
|
185
196
|
t.props,
|
|
186
197
|
"Open file",
|
|
187
|
-
/* @__PURE__ */ n(m, { height: 16, width: 16, viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ n(
|
|
198
|
+
/* @__PURE__ */ n(m, { height: 16, width: 16, viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ n(C, { 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" }) })
|
|
188
199
|
),
|
|
189
|
-
|
|
200
|
+
w(t.props)
|
|
190
201
|
] }),
|
|
191
|
-
image: async (t, r) => /* @__PURE__ */ f(
|
|
202
|
+
image: async (t, r) => /* @__PURE__ */ f(l, { wrap: !1, children: [
|
|
192
203
|
/* @__PURE__ */ n(
|
|
193
204
|
D,
|
|
194
205
|
{
|
|
@@ -198,13 +209,13 @@ const N = 0.75, V = v.create({
|
|
|
198
209
|
}
|
|
199
210
|
}
|
|
200
211
|
),
|
|
201
|
-
|
|
212
|
+
w(t.props)
|
|
202
213
|
] }),
|
|
203
|
-
table: (t, r) => /* @__PURE__ */ n(
|
|
214
|
+
table: (t, r) => /* @__PURE__ */ n(q, { data: t.content, transformer: r })
|
|
204
215
|
};
|
|
205
216
|
function S(t, r, e, o) {
|
|
206
|
-
return /* @__PURE__ */ n(
|
|
207
|
-
|
|
217
|
+
return /* @__PURE__ */ n(V, { src: t.url, children: /* @__PURE__ */ f(
|
|
218
|
+
l,
|
|
208
219
|
{
|
|
209
220
|
style: {
|
|
210
221
|
display: "flex",
|
|
@@ -213,15 +224,15 @@ function S(t, r, e, o) {
|
|
|
213
224
|
},
|
|
214
225
|
children: [
|
|
215
226
|
e,
|
|
216
|
-
/* @__PURE__ */ n(
|
|
227
|
+
/* @__PURE__ */ n(d, { children: t.name || r })
|
|
217
228
|
]
|
|
218
229
|
}
|
|
219
230
|
) });
|
|
220
231
|
}
|
|
221
|
-
function
|
|
232
|
+
function w(t, r) {
|
|
222
233
|
if (t.caption)
|
|
223
234
|
return /* @__PURE__ */ n(
|
|
224
|
-
|
|
235
|
+
d,
|
|
225
236
|
{
|
|
226
237
|
style: {
|
|
227
238
|
width: t.previewWidth ? t.previewWidth * h : void 0,
|
|
@@ -231,8 +242,8 @@ function x(t, r) {
|
|
|
231
242
|
}
|
|
232
243
|
);
|
|
233
244
|
}
|
|
234
|
-
const
|
|
235
|
-
link: (t, r) => /* @__PURE__ */ n(
|
|
245
|
+
const U = {
|
|
246
|
+
link: (t, r) => /* @__PURE__ */ n(V, { href: t.href, children: t.content.map((e) => r.transformStyledText(e)) }),
|
|
236
247
|
text: (t, r) => r.transformStyledText(t)
|
|
237
248
|
}, K = {
|
|
238
249
|
bold: (t) => t ? {
|
|
@@ -257,58 +268,43 @@ const q = {
|
|
|
257
268
|
code: (t) => t ? {
|
|
258
269
|
fontFamily: "GeistMono"
|
|
259
270
|
} : {}
|
|
260
|
-
},
|
|
261
|
-
blockMapping:
|
|
262
|
-
inlineContentMapping:
|
|
271
|
+
}, tt = {
|
|
272
|
+
blockMapping: N,
|
|
273
|
+
inlineContentMapping: U,
|
|
263
274
|
styleMapping: K
|
|
264
275
|
};
|
|
265
|
-
async function
|
|
276
|
+
async function $(t) {
|
|
266
277
|
return "https://corsproxy.api.blocknotejs.org/corsproxy/?url=" + encodeURIComponent(t);
|
|
267
278
|
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
if (R.NODE_ENV === "test") {
|
|
271
|
-
const o = (await J(t)).toString("base64");
|
|
272
|
-
return `data:${r};base64,${o}`;
|
|
273
|
-
} else
|
|
274
|
-
return t.default;
|
|
279
|
+
async function X(t, r) {
|
|
280
|
+
return t.default;
|
|
275
281
|
}
|
|
276
282
|
async function g(t) {
|
|
277
|
-
return
|
|
283
|
+
return X(t);
|
|
278
284
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
return e.startsWith("/@fs/") && (e = e.substring(4)), r.readFileSync(e);
|
|
284
|
-
} else {
|
|
285
|
-
const r = t.default;
|
|
286
|
-
return await (await fetch(r)).arrayBuffer();
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
const _ = 16, E = 0.75;
|
|
290
|
-
class nt extends O {
|
|
291
|
-
constructor(e, o, i) {
|
|
292
|
-
const l = {
|
|
285
|
+
const E = 16, I = 0.75;
|
|
286
|
+
class et extends B {
|
|
287
|
+
constructor(e, o, s) {
|
|
288
|
+
const i = {
|
|
293
289
|
...{
|
|
294
290
|
emojiSource: {
|
|
295
291
|
format: "png",
|
|
296
292
|
url: "https://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/72x72/"
|
|
297
293
|
},
|
|
298
|
-
resolveFileUrl:
|
|
294
|
+
resolveFileUrl: $,
|
|
299
295
|
colors: A
|
|
300
296
|
},
|
|
301
|
-
...
|
|
297
|
+
...s
|
|
302
298
|
};
|
|
303
|
-
super(e, o,
|
|
304
|
-
|
|
305
|
-
|
|
299
|
+
super(e, o, i);
|
|
300
|
+
x(this, "fontsRegistered", !1);
|
|
301
|
+
x(this, "styles", T.create({
|
|
306
302
|
page: {
|
|
307
303
|
paddingTop: 35,
|
|
308
304
|
paddingBottom: 65,
|
|
309
305
|
paddingHorizontal: 35,
|
|
310
306
|
fontFamily: "Inter",
|
|
311
|
-
fontSize:
|
|
307
|
+
fontSize: E * I,
|
|
312
308
|
// pixels
|
|
313
309
|
lineHeight: 1.5
|
|
314
310
|
},
|
|
@@ -319,52 +315,52 @@ class nt extends O {
|
|
|
319
315
|
position: "absolute"
|
|
320
316
|
}
|
|
321
317
|
}));
|
|
322
|
-
|
|
323
|
-
this.schema = e, this.options =
|
|
318
|
+
x(this, "options");
|
|
319
|
+
this.schema = e, this.options = i;
|
|
324
320
|
}
|
|
325
321
|
/**
|
|
326
322
|
* Mostly for internal use, you probably want to use `toBlob` or `toReactPDFDocument` instead.
|
|
327
323
|
*/
|
|
328
324
|
transformStyledText(e) {
|
|
329
|
-
const o = this.mapStyles(e.styles),
|
|
330
|
-
return /* @__PURE__ */ n(
|
|
325
|
+
const o = this.mapStyles(e.styles), s = Object.assign({}, ...o);
|
|
326
|
+
return /* @__PURE__ */ n(d, { style: s, children: e.text });
|
|
331
327
|
}
|
|
332
328
|
/**
|
|
333
329
|
* Mostly for internal use, you probably want to use `toBlob` or `toReactPDFDocument` instead.
|
|
334
330
|
*/
|
|
335
331
|
async transformBlocks(e, o = 0) {
|
|
336
|
-
const
|
|
337
|
-
let
|
|
338
|
-
for (const
|
|
339
|
-
|
|
340
|
-
const a = await this.transformBlocks(
|
|
341
|
-
|
|
332
|
+
const s = [];
|
|
333
|
+
let c = 0;
|
|
334
|
+
for (const i of e) {
|
|
335
|
+
i.type === "numberedListItem" ? c++ : c = 0;
|
|
336
|
+
const a = await this.transformBlocks(i.children, o + 1), y = await this.mapBlock(
|
|
337
|
+
i,
|
|
342
338
|
o,
|
|
343
|
-
|
|
339
|
+
c
|
|
344
340
|
);
|
|
345
|
-
if (
|
|
346
|
-
|
|
341
|
+
if (i.type === "pageBreak") {
|
|
342
|
+
s.push(y);
|
|
347
343
|
continue;
|
|
348
344
|
}
|
|
349
|
-
const b = this.blocknoteDefaultPropsToReactPDFStyle(
|
|
350
|
-
|
|
351
|
-
/* @__PURE__ */ f(
|
|
345
|
+
const b = this.blocknoteDefaultPropsToReactPDFStyle(i.props);
|
|
346
|
+
s.push(
|
|
347
|
+
/* @__PURE__ */ f(L, { children: [
|
|
352
348
|
/* @__PURE__ */ n(
|
|
353
|
-
|
|
349
|
+
l,
|
|
354
350
|
{
|
|
355
351
|
style: {
|
|
356
|
-
paddingVertical: 3 *
|
|
352
|
+
paddingVertical: 3 * I,
|
|
357
353
|
...this.styles.block,
|
|
358
354
|
...b
|
|
359
355
|
},
|
|
360
|
-
children:
|
|
356
|
+
children: y
|
|
361
357
|
}
|
|
362
358
|
),
|
|
363
359
|
a.length > 0 && /* @__PURE__ */ n(
|
|
364
|
-
|
|
360
|
+
l,
|
|
365
361
|
{
|
|
366
362
|
style: {
|
|
367
|
-
marginLeft:
|
|
363
|
+
marginLeft: E * 1.5 * I,
|
|
368
364
|
...this.styles.blockChildren
|
|
369
365
|
},
|
|
370
366
|
children: a
|
|
@@ -373,40 +369,40 @@ class nt extends O {
|
|
|
373
369
|
] })
|
|
374
370
|
);
|
|
375
371
|
}
|
|
376
|
-
return
|
|
372
|
+
return s;
|
|
377
373
|
}
|
|
378
374
|
async registerFonts() {
|
|
379
375
|
if (this.fontsRegistered)
|
|
380
376
|
return;
|
|
381
|
-
this.options.emojiSource &&
|
|
377
|
+
this.options.emojiSource && p.registerEmojiSource(this.options.emojiSource);
|
|
382
378
|
let e = await g(
|
|
383
379
|
await import("./Inter_18pt-Regular-byxnNS-8.js")
|
|
384
380
|
);
|
|
385
|
-
|
|
381
|
+
p.register({
|
|
386
382
|
family: "Inter",
|
|
387
383
|
src: e
|
|
388
384
|
}), e = await g(
|
|
389
385
|
await import("./Inter_18pt-Italic-BVnfHlUD.js")
|
|
390
|
-
),
|
|
386
|
+
), p.register({
|
|
391
387
|
family: "Inter",
|
|
392
388
|
fontStyle: "italic",
|
|
393
389
|
src: e
|
|
394
390
|
}), e = await g(
|
|
395
391
|
await import("./Inter_18pt-Bold-BOnnSImi.js")
|
|
396
|
-
),
|
|
392
|
+
), p.register({
|
|
397
393
|
family: "Inter",
|
|
398
394
|
src: e,
|
|
399
395
|
fontWeight: "bold"
|
|
400
396
|
}), e = await g(
|
|
401
397
|
await import("./Inter_18pt-BoldItalic-DPKIpVzB.js")
|
|
402
|
-
),
|
|
398
|
+
), p.register({
|
|
403
399
|
family: "Inter",
|
|
404
400
|
fontStyle: "italic",
|
|
405
401
|
src: e,
|
|
406
402
|
fontWeight: "bold"
|
|
407
403
|
}), e = await g(
|
|
408
404
|
await import("./GeistMono-Regular-D4rKXxwr.js")
|
|
409
|
-
),
|
|
405
|
+
), p.register({
|
|
410
406
|
family: "GeistMono",
|
|
411
407
|
src: e
|
|
412
408
|
}), this.fontsRegistered = !0;
|
|
@@ -415,11 +411,11 @@ class nt extends O {
|
|
|
415
411
|
* Convert a document (array of Blocks) to a react-pdf Document.
|
|
416
412
|
*/
|
|
417
413
|
async toReactPDFDocument(e, o = {}) {
|
|
418
|
-
return await this.registerFonts(), /* @__PURE__ */ n(
|
|
419
|
-
o.header && /* @__PURE__ */ n(
|
|
414
|
+
return await this.registerFonts(), /* @__PURE__ */ n(_, { children: /* @__PURE__ */ f(Z, { dpi: 100, size: "A4", style: this.styles.page, children: [
|
|
415
|
+
o.header && /* @__PURE__ */ n(l, { fixed: !0, style: this.styles.header, children: o.header }),
|
|
420
416
|
await this.transformBlocks(e),
|
|
421
417
|
o.footer && /* @__PURE__ */ n(
|
|
422
|
-
|
|
418
|
+
l,
|
|
423
419
|
{
|
|
424
420
|
fixed: !0,
|
|
425
421
|
style: [
|
|
@@ -445,7 +441,7 @@ class nt extends O {
|
|
|
445
441
|
}
|
|
446
442
|
}
|
|
447
443
|
export {
|
|
448
|
-
|
|
449
|
-
|
|
444
|
+
et as PDFExporter,
|
|
445
|
+
tt as pdfDefaultSchemaMappings
|
|
450
446
|
};
|
|
451
447
|
//# sourceMappingURL=blocknote-xl-pdf-exporter.js.map
|