@blocknote/xl-pdf-exporter 0.19.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 +661 -0
- package/dist/Inter_18pt-Bold-BOnnSImi.js +5 -0
- package/dist/Inter_18pt-Bold-BOnnSImi.js.map +1 -0
- package/dist/Inter_18pt-BoldItalic-DPKIpVzB.js +5 -0
- package/dist/Inter_18pt-BoldItalic-DPKIpVzB.js.map +1 -0
- package/dist/Inter_18pt-Italic-BVnfHlUD.js +5 -0
- package/dist/Inter_18pt-Italic-BVnfHlUD.js.map +1 -0
- package/dist/Inter_18pt-Regular-byxnNS-8.js +5 -0
- package/dist/Inter_18pt-Regular-byxnNS-8.js.map +1 -0
- package/dist/blocknote-xl-pdf-exporter.js +2503 -0
- package/dist/blocknote-xl-pdf-exporter.js.map +1 -0
- package/dist/blocknote-xl-pdf-exporter.umd.cjs +69 -0
- package/dist/blocknote-xl-pdf-exporter.umd.cjs.map +1 -0
- package/dist/webpack-stats.json +1 -0
- package/package.json +88 -0
- package/src/index.ts +1 -0
- package/src/pdf/__snapshots__/example.jsx +592 -0
- package/src/pdf/__snapshots__/exampleWithHeaderAndFooter.jsx +602 -0
- package/src/pdf/defaultSchema/blocks.tsx +177 -0
- package/src/pdf/defaultSchema/index.ts +9 -0
- package/src/pdf/defaultSchema/inlinecontent.tsx +23 -0
- package/src/pdf/defaultSchema/styles.tsx +68 -0
- package/src/pdf/index.ts +2 -0
- package/src/pdf/pdfExporter.test.tsx +208 -0
- package/src/pdf/pdfExporter.tsx +297 -0
- package/src/pdf/types.ts +3 -0
- package/src/pdf/util/listItem.tsx +70 -0
- package/src/pdf/util/table/Table.tsx +76 -0
- package/src/vite-env.d.ts +11 -0
- package/types/src/Exporter.d.ts +26 -0
- package/types/src/context/BlockNoteContext.d.ts +59 -0
- package/types/src/context/BlockNoteContext.test.d.ts +1 -0
- package/types/src/context/ServerBlockNoteEditor.d.ts +137 -0
- package/types/src/context/ServerBlockNoteEditor.test.d.ts +1 -0
- package/types/src/context/react/ReactServer.test.d.ts +2 -0
- package/types/src/docx/blocks.d.ts +433 -0
- package/types/src/docx/defaultSchema/blocks.d.ts +4 -0
- package/types/src/docx/defaultSchema/index.d.ts +559 -0
- package/types/src/docx/defaultSchema/inlinecontent.d.ts +4 -0
- package/types/src/docx/defaultSchema/styles.d.ts +4 -0
- package/types/src/docx/docxExporter.d.ts +14 -0
- package/types/src/docx/docxExporter.test.d.ts +1 -0
- package/types/src/docx/imageUtil.d.ts +4 -0
- package/types/src/docx/index.d.ts +2 -0
- package/types/src/docx/inlinecontent.d.ts +12 -0
- package/types/src/docx/styles.d.ts +55 -0
- package/types/src/docx/util/Table.d.ts +4 -0
- package/types/src/docxExporter.d.ts +255 -0
- package/types/src/docxExporter.test.d.ts +1 -0
- package/types/src/index.d.ts +1 -0
- package/types/src/mapping.d.ts +29 -0
- package/types/src/pdf/blocks.d.ts +434 -0
- package/types/src/pdf/defaultSchema/blocks.d.ts +4 -0
- package/types/src/pdf/defaultSchema/index.d.ts +510 -0
- package/types/src/pdf/defaultSchema/inlinecontent.d.ts +4 -0
- package/types/src/pdf/defaultSchema/styles.d.ts +3 -0
- package/types/src/pdf/index.d.ts +2 -0
- package/types/src/pdf/inlinecontent.d.ts +13 -0
- package/types/src/pdf/pdfExporter.d.ts +81 -0
- package/types/src/pdf/pdfExporter.test.d.ts +1 -0
- package/types/src/pdf/styles.d.ts +55 -0
- package/types/src/pdf/types.d.ts +2 -0
- package/types/src/pdf/util/listItem.d.ts +9 -0
- package/types/src/pdf/util/loadFontDataUrl.d.ts +3 -0
- package/types/src/pdf/util/table/Table.d.ts +5 -0
- package/types/src/pdfExporter.d.ts +256 -0
- package/types/src/pdfExporter.test.d.ts +1 -0
- package/types/src/react-email/defaultSchema/blocks.d.ts +5 -0
- package/types/src/react-email/defaultSchema/index.d.ts +560 -0
- package/types/src/react-email/defaultSchema/inlinecontent.d.ts +5 -0
- package/types/src/react-email/defaultSchema/styles.d.ts +4 -0
- package/types/src/react-email/reactEmailExporter.d.ts +13 -0
- package/types/src/react-email/reactEmailExporter.test.d.ts +8 -0
- package/types/src/testDocument.d.ts +505 -0
- package/types/src/transformer.d.ts +20 -0
- package/types/src/util/fileUtil.d.ts +22 -0
- package/types/src/util/imageUtil.d.ts +4 -0
- package/types/src/yjs/index.d.ts +2 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { Block } from "@blocknote/core";
|
|
2
|
+
import { Paragraph, TextRun } from "docx";
|
|
3
|
+
export declare function createDocxExporterForDefaultSchema(): {
|
|
4
|
+
util: {
|
|
5
|
+
blockTransformer: (block: import("@blocknote/core").BlockFromConfig<{
|
|
6
|
+
type: "paragraph";
|
|
7
|
+
content: "inline";
|
|
8
|
+
propSchema: {
|
|
9
|
+
backgroundColor: {
|
|
10
|
+
default: "default";
|
|
11
|
+
};
|
|
12
|
+
textColor: {
|
|
13
|
+
default: "default";
|
|
14
|
+
};
|
|
15
|
+
textAlignment: {
|
|
16
|
+
default: "left";
|
|
17
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
} | {
|
|
21
|
+
type: "heading";
|
|
22
|
+
content: "inline";
|
|
23
|
+
propSchema: {
|
|
24
|
+
level: {
|
|
25
|
+
default: number;
|
|
26
|
+
values: readonly [1, 2, 3];
|
|
27
|
+
};
|
|
28
|
+
backgroundColor: {
|
|
29
|
+
default: "default";
|
|
30
|
+
};
|
|
31
|
+
textColor: {
|
|
32
|
+
default: "default";
|
|
33
|
+
};
|
|
34
|
+
textAlignment: {
|
|
35
|
+
default: "left";
|
|
36
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
} | {
|
|
40
|
+
type: "bulletListItem";
|
|
41
|
+
content: "inline";
|
|
42
|
+
propSchema: {
|
|
43
|
+
backgroundColor: {
|
|
44
|
+
default: "default";
|
|
45
|
+
};
|
|
46
|
+
textColor: {
|
|
47
|
+
default: "default";
|
|
48
|
+
};
|
|
49
|
+
textAlignment: {
|
|
50
|
+
default: "left";
|
|
51
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
} | {
|
|
55
|
+
type: "numberedListItem";
|
|
56
|
+
content: "inline";
|
|
57
|
+
propSchema: {
|
|
58
|
+
backgroundColor: {
|
|
59
|
+
default: "default";
|
|
60
|
+
};
|
|
61
|
+
textColor: {
|
|
62
|
+
default: "default";
|
|
63
|
+
};
|
|
64
|
+
textAlignment: {
|
|
65
|
+
default: "left";
|
|
66
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
} | {
|
|
70
|
+
type: "checkListItem";
|
|
71
|
+
content: "inline";
|
|
72
|
+
propSchema: {
|
|
73
|
+
checked: {
|
|
74
|
+
default: false;
|
|
75
|
+
};
|
|
76
|
+
backgroundColor: {
|
|
77
|
+
default: "default";
|
|
78
|
+
};
|
|
79
|
+
textColor: {
|
|
80
|
+
default: "default";
|
|
81
|
+
};
|
|
82
|
+
textAlignment: {
|
|
83
|
+
default: "left";
|
|
84
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
} | {
|
|
88
|
+
type: "table";
|
|
89
|
+
content: "table";
|
|
90
|
+
propSchema: {
|
|
91
|
+
backgroundColor: {
|
|
92
|
+
default: "default";
|
|
93
|
+
};
|
|
94
|
+
textColor: {
|
|
95
|
+
default: "default";
|
|
96
|
+
};
|
|
97
|
+
textAlignment: {
|
|
98
|
+
default: "left";
|
|
99
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
} | {
|
|
103
|
+
type: "file";
|
|
104
|
+
propSchema: {
|
|
105
|
+
backgroundColor: {
|
|
106
|
+
default: "default";
|
|
107
|
+
};
|
|
108
|
+
name: {
|
|
109
|
+
default: "";
|
|
110
|
+
};
|
|
111
|
+
url: {
|
|
112
|
+
default: "";
|
|
113
|
+
};
|
|
114
|
+
caption: {
|
|
115
|
+
default: "";
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
content: "none";
|
|
119
|
+
isFileBlock: true;
|
|
120
|
+
} | {
|
|
121
|
+
type: "image";
|
|
122
|
+
propSchema: {
|
|
123
|
+
textAlignment: {
|
|
124
|
+
default: "left";
|
|
125
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
126
|
+
};
|
|
127
|
+
backgroundColor: {
|
|
128
|
+
default: "default";
|
|
129
|
+
};
|
|
130
|
+
name: {
|
|
131
|
+
default: "";
|
|
132
|
+
};
|
|
133
|
+
url: {
|
|
134
|
+
default: "";
|
|
135
|
+
};
|
|
136
|
+
caption: {
|
|
137
|
+
default: "";
|
|
138
|
+
};
|
|
139
|
+
showPreview: {
|
|
140
|
+
default: true;
|
|
141
|
+
};
|
|
142
|
+
previewWidth: {
|
|
143
|
+
default: number;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
content: "none";
|
|
147
|
+
isFileBlock: true;
|
|
148
|
+
fileBlockAccept: string[];
|
|
149
|
+
} | {
|
|
150
|
+
type: "video";
|
|
151
|
+
propSchema: {
|
|
152
|
+
textAlignment: {
|
|
153
|
+
default: "left";
|
|
154
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
155
|
+
};
|
|
156
|
+
backgroundColor: {
|
|
157
|
+
default: "default";
|
|
158
|
+
};
|
|
159
|
+
name: {
|
|
160
|
+
default: "";
|
|
161
|
+
};
|
|
162
|
+
url: {
|
|
163
|
+
default: "";
|
|
164
|
+
};
|
|
165
|
+
caption: {
|
|
166
|
+
default: "";
|
|
167
|
+
};
|
|
168
|
+
showPreview: {
|
|
169
|
+
default: true;
|
|
170
|
+
};
|
|
171
|
+
previewWidth: {
|
|
172
|
+
default: number;
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
content: "none";
|
|
176
|
+
isFileBlock: true;
|
|
177
|
+
fileBlockAccept: string[];
|
|
178
|
+
} | {
|
|
179
|
+
type: "audio";
|
|
180
|
+
propSchema: {
|
|
181
|
+
backgroundColor: {
|
|
182
|
+
default: "default";
|
|
183
|
+
};
|
|
184
|
+
name: {
|
|
185
|
+
default: "";
|
|
186
|
+
};
|
|
187
|
+
url: {
|
|
188
|
+
default: "";
|
|
189
|
+
};
|
|
190
|
+
caption: {
|
|
191
|
+
default: "";
|
|
192
|
+
};
|
|
193
|
+
showPreview: {
|
|
194
|
+
default: true;
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
content: "none";
|
|
198
|
+
isFileBlock: true;
|
|
199
|
+
fileBlockAccept: string[];
|
|
200
|
+
}, import("@blocknote/core").InlineContentSchema, import("@blocknote/core").StyleSchema>) => Paragraph;
|
|
201
|
+
styledTextTransformer: (styledText: import("@blocknote/core").StyledText<import("@blocknote/core").StyleSchemaFromSpecs<{
|
|
202
|
+
bold: {
|
|
203
|
+
config: {
|
|
204
|
+
type: string;
|
|
205
|
+
propSchema: "boolean";
|
|
206
|
+
};
|
|
207
|
+
implementation: import("@blocknote/core").StyleImplementation;
|
|
208
|
+
};
|
|
209
|
+
italic: {
|
|
210
|
+
config: {
|
|
211
|
+
type: string;
|
|
212
|
+
propSchema: "boolean";
|
|
213
|
+
};
|
|
214
|
+
implementation: import("@blocknote/core").StyleImplementation;
|
|
215
|
+
};
|
|
216
|
+
underline: {
|
|
217
|
+
config: {
|
|
218
|
+
type: string;
|
|
219
|
+
propSchema: "boolean";
|
|
220
|
+
};
|
|
221
|
+
implementation: import("@blocknote/core").StyleImplementation;
|
|
222
|
+
};
|
|
223
|
+
strike: {
|
|
224
|
+
config: {
|
|
225
|
+
type: string;
|
|
226
|
+
propSchema: "boolean";
|
|
227
|
+
};
|
|
228
|
+
implementation: import("@blocknote/core").StyleImplementation;
|
|
229
|
+
};
|
|
230
|
+
code: {
|
|
231
|
+
config: {
|
|
232
|
+
type: string;
|
|
233
|
+
propSchema: "boolean";
|
|
234
|
+
};
|
|
235
|
+
implementation: import("@blocknote/core").StyleImplementation;
|
|
236
|
+
};
|
|
237
|
+
textColor: {
|
|
238
|
+
config: {
|
|
239
|
+
type: string;
|
|
240
|
+
propSchema: "string";
|
|
241
|
+
};
|
|
242
|
+
implementation: import("@blocknote/core").StyleImplementation;
|
|
243
|
+
};
|
|
244
|
+
backgroundColor: {
|
|
245
|
+
config: {
|
|
246
|
+
type: string;
|
|
247
|
+
propSchema: "string";
|
|
248
|
+
};
|
|
249
|
+
implementation: import("@blocknote/core").StyleImplementation;
|
|
250
|
+
};
|
|
251
|
+
}>>) => TextRun;
|
|
252
|
+
inlineContentTransformer: (inlineContent: import("@blocknote/core").StyledText<import("@blocknote/core").StyleSchema> | import("@blocknote/core").Link<import("@blocknote/core").StyleSchema>) => import("docx").ParagraphChild;
|
|
253
|
+
};
|
|
254
|
+
transform: (blocks: Block[]) => Paragraph[];
|
|
255
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./pdf/index.js";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { BlockFromConfigNoChildren, BlockNoteSchema, BlockSchema, InlineContentFromConfig, InlineContentSchema, StyleSchema, Styles } from "@blocknote/core";
|
|
2
|
+
import { Exporter } from "./Exporter.js";
|
|
3
|
+
/**
|
|
4
|
+
* Defines a mapping from all block types with a schema to a result type `R`.
|
|
5
|
+
*/
|
|
6
|
+
export type BlockMapping<B extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema, RB, RI> = {
|
|
7
|
+
[K in keyof B]: (block: BlockFromConfigNoChildren<B[K], I, S>, exporter: Exporter<any, any, any, RB, RI, any, any>, nestingLevel: number, numberedListIndex?: number) => RB | Promise<RB>;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Defines a mapping from all inline content types with a schema to a result type R.
|
|
11
|
+
*/
|
|
12
|
+
export type InlineContentMapping<I extends InlineContentSchema, S extends StyleSchema, RI, TS> = {
|
|
13
|
+
[K in keyof I]: (inlineContent: InlineContentFromConfig<I[K], S>, exporter: Exporter<any, I, S, any, RI, any, TS>) => RI;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Defines a mapping from all style types with a schema to a result type R.
|
|
17
|
+
*/
|
|
18
|
+
export type StyleMapping<S extends StyleSchema, RS> = {
|
|
19
|
+
[K in keyof S]: (style: Styles<S>[K], exporter: Exporter<any, any, any, any, any, RS, any>) => RS;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* The mapping factory is a utility function to easily create mappings for
|
|
23
|
+
* a BlockNoteSchema. Using the factory makes it easier to get typescript code completion etc.
|
|
24
|
+
*/
|
|
25
|
+
export declare function mappingFactory<B extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(_schema: BlockNoteSchema<B, I, S>): {
|
|
26
|
+
createBlockMapping: <R, RI>(mapping: BlockMapping<B, I, S, R, RI>) => BlockMapping<B, I, S, R, RI>;
|
|
27
|
+
createInlineContentMapping: <R_1, RS>(mapping: InlineContentMapping<I, S, R_1, RS>) => InlineContentMapping<I, S, R_1, RS>;
|
|
28
|
+
createStyleMapping: <R_2>(mapping: StyleMapping<S, R_2>) => StyleMapping<S, R_2>;
|
|
29
|
+
};
|