@@ -40,7 +40,7 @@ const DEFAULT_TAB_STOP =
40
40
export class DOCXExporter <
41
41
B extends BlockSchema ,
42
42
S extends StyleSchema ,
43
- I extends InlineContentSchema
43
+ I extends InlineContentSchema ,
44
44
> extends Exporter <
45
45
B ,
46
46
I ,
@@ -71,7 +71,7 @@ export class DOCXExporter<
71
71
IRunPropertiesOptions ,
72
72
TextRun
73
73
> [ "mappings" ] ,
74
- options ?: Partial < ExporterOptions >
74
+ options ?: Partial < ExporterOptions > ,
75
75
) {
76
76
const defaults = {
77
77
colors : COLORS_DEFAULT ,
@@ -93,7 +93,7 @@ export class DOCXExporter<
93
93
94
94
const styles : IRunPropertiesOptions = Object . assign (
95
95
{ } as IRunPropertiesOptions ,
96
- ...stylesArray
96
+ ...stylesArray ,
97
97
) ;
98
98
99
99
return new TextRun ( {
@@ -108,7 +108,7 @@ export class DOCXExporter<
108
108
*/
109
109
public async transformBlocks (
110
110
blocks : Block < B , I , S > [ ] ,
111
- nestingLevel = 0
111
+ nestingLevel = 0 ,
112
112
) : Promise < Array < Paragraph | Table > > {
113
113
const ret : Array < Paragraph | Table > = [ ] ;
114
114
@@ -123,7 +123,7 @@ export class DOCXExporter<
123
123
c . addRunToFront (
124
124
new TextRun ( {
125
125
children : [ new Tab ( ) ] ,
126
- } )
126
+ } ) ,
127
127
) ;
128
128
}
129
129
return c ;
@@ -143,15 +143,15 @@ export class DOCXExporter<
143
143
// "./src/fonts/Inter-VariableFont_opsz,wght.ttf",
144
144
145
145
let interFont = await loadFileBuffer (
146
- await import ( "@shared/assets/fonts/inter/Inter_18pt-Regular.ttf" )
146
+ await import ( "@shared/assets/fonts/inter/Inter_18pt-Regular.ttf" ) ,
147
147
) ;
148
148
let geistMonoFont = await loadFileBuffer (
149
- await import ( "@shared/assets/fonts/GeistMono-Regular.ttf" )
149
+ await import ( "@shared/assets/fonts/GeistMono-Regular.ttf" ) ,
150
150
) ;
151
151
152
152
if (
153
153
interFont instanceof ArrayBuffer ||
154
- geistMonoFont instanceof Uint8Array
154
+ geistMonoFont instanceof ArrayBuffer
155
155
) {
156
156
// conversion with Polyfill needed because docxjs requires Buffer
157
157
// NOTE: the buffer/ import is intentional and as documented in
@@ -160,18 +160,18 @@ export class DOCXExporter<
160
160
const Buffer = ( await import ( "buffer/" ) ) . Buffer ;
161
161
162
162
if ( interFont instanceof ArrayBuffer ) {
163
- interFont = Buffer . from ( interFont ) ;
163
+ interFont = Buffer . from ( interFont ) as unknown as Buffer ;
164
164
}
165
165
if ( geistMonoFont instanceof ArrayBuffer ) {
166
- geistMonoFont = Buffer . from ( geistMonoFont ) ;
166
+ geistMonoFont = Buffer . from ( geistMonoFont ) as unknown as Buffer ;
167
167
}
168
168
}
169
169
170
170
return [
171
- { name : "Inter" , data : interFont as Buffer } ,
171
+ { name : "Inter" , data : interFont } ,
172
172
{
173
173
name : "GeistMono" ,
174
- data : geistMonoFont as Buffer ,
174
+ data : geistMonoFont ,
175
175
} ,
176
176
] ;
177
177
}
@@ -239,7 +239,7 @@ export class DOCXExporter<
239
239
} = {
240
240
sectionOptions : { } ,
241
241
documentOptions : { } ,
242
- }
242
+ } ,
243
243
) {
244
244
const doc = await this . toDocxJsDocument ( blocks , options ) ;
245
245
type GlobalThis = typeof globalThis & { Buffer ?: any } ;
@@ -268,7 +268,7 @@ export class DOCXExporter<
268
268
} = {
269
269
sectionOptions : { } ,
270
270
documentOptions : { } ,
271
- }
271
+ } ,
272
272
) {
273
273
const doc = new Document ( {
274
274
...( await this . createDefaultDocumentOptions ( ) ) ,
@@ -285,7 +285,7 @@ export class DOCXExporter<
285
285
doc . Document . Relationships . createRelationship (
286
286
doc . Document . Relationships . RelationshipCount + 1 ,
287
287
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" ,
288
- "fontTable.xml"
288
+ "fontTable.xml" ,
289
289
) ;
290
290
291
291
return doc ;
0 commit comments