@blocknote/xl-odt-exporter 0.41.1 → 0.42.1
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-D4rKXxwr.js.map +1 -1
- package/dist/Inter_18pt-Regular-byxnNS-8.js.map +1 -1
- package/dist/blocknote-xl-odt-exporter.js +94 -78
- package/dist/blocknote-xl-odt-exporter.js.map +1 -1
- package/dist/blocknote-xl-odt-exporter.umd.cjs +3 -3
- package/dist/blocknote-xl-odt-exporter.umd.cjs.map +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +15 -15
- package/src/odt/defaultSchema/blocks.tsx +5 -11
- package/src/odt/defaultSchema/styles.ts +8 -5
- package/src/odt/odtExporter.test.ts +7 -5
- package/src/odt/odtExporter.tsx +2 -2
package/dist/webpack-stats.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"builtAt":
|
|
1
|
+
{"builtAt":1763459680786,"assets":[{"name":"blocknote-xl-odt-exporter.umd.cjs","size":700741},{"name":"blocknote-xl-odt-exporter.umd.cjs.map","size":752538}],"chunks":[{"id":"642be88","entry":true,"initial":true,"files":["blocknote-xl-odt-exporter.umd.cjs"],"names":["index"]}],"modules":[{"name":"./src/odt/defaultSchema/blocks.tsx","size":16737,"chunks":["642be88"]},{"name":"./src/odt/defaultSchema/inlineContent.tsx","size":533,"chunks":["642be88"]},{"name":"./src/odt/defaultSchema/styles.ts","size":1047,"chunks":["642be88"]},{"name":"./src/odt/defaultSchema/index.ts","size":199,"chunks":["642be88"]},{"name":"../../shared/util/fileUtil.ts","size":214,"chunks":["642be88"]},{"name":"../../shared/util/imageUtil.ts","size":592,"chunks":["642be88"]},{"name":"./src/odt/template/styles.xml?raw","size":76781,"chunks":["642be88"]},{"name":"./src/odt/odtExporter.tsx","size":10335,"chunks":["642be88"]},{"name":"./src/index.ts","size":0,"chunks":["642be88"]},{"name":"../../shared/assets/fonts/inter/Inter_18pt-Regular.ttf","size":456958,"chunks":["642be88"]},{"name":"../../shared/assets/fonts/GeistMono-Regular.ttf","size":155049,"chunks":["642be88"]}]}
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"directory": "packages/xl-odt-exporter"
|
|
10
10
|
},
|
|
11
11
|
"license": "GPL-3.0 OR PROPRIETARY",
|
|
12
|
-
"version": "0.
|
|
12
|
+
"version": "0.42.1",
|
|
13
13
|
"files": [
|
|
14
14
|
"dist",
|
|
15
15
|
"types",
|
|
@@ -49,24 +49,24 @@
|
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@blocknote/core": "0.
|
|
53
|
-
"@blocknote/xl-multi-column": "0.
|
|
54
|
-
"@zip.js/zip.js": "^2.
|
|
52
|
+
"@blocknote/core": "0.42.1",
|
|
53
|
+
"@blocknote/xl-multi-column": "0.42.1",
|
|
54
|
+
"@zip.js/zip.js": "^2.8.8",
|
|
55
55
|
"buffer": "^6.0.3",
|
|
56
|
-
"image-meta": "^0.2.
|
|
56
|
+
"image-meta": "^0.2.2"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@testing-library/react": "^16.0
|
|
60
|
-
"@types/react": "^19.
|
|
61
|
-
"@types/react-dom": "^19.
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
59
|
+
"@testing-library/react": "^16.3.0",
|
|
60
|
+
"@types/react": "^19.2.2",
|
|
61
|
+
"@types/react-dom": "^19.2.2",
|
|
62
|
+
"react": "^19.2.0",
|
|
63
|
+
"react-dom": "^19.2.0",
|
|
64
|
+
"rollup-plugin-webpack-stats": "^0.2.6",
|
|
65
|
+
"typescript": "^5.9.3",
|
|
66
|
+
"vite": "^5.4.20",
|
|
65
67
|
"vite-plugin-eslint": "^1.8.1",
|
|
66
|
-
"vitest": "^2.
|
|
67
|
-
"xml-formatter": "^3.6.
|
|
68
|
-
"react": "^19.1.0",
|
|
69
|
-
"react-dom": "^19.1.0"
|
|
68
|
+
"vitest": "^2.1.9",
|
|
69
|
+
"xml-formatter": "^3.6.7"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
72
|
"react": "^18.0 || ^19.0 || >= 19.0.0-rc",
|
|
@@ -41,9 +41,7 @@ const createParagraphStyle = (
|
|
|
41
41
|
|
|
42
42
|
const backgroundColor =
|
|
43
43
|
props.backgroundColor && props.backgroundColor !== "default"
|
|
44
|
-
? exporter.options.colors[
|
|
45
|
-
props.backgroundColor as keyof typeof exporter.options.colors
|
|
46
|
-
].background
|
|
44
|
+
? exporter.options.colors[props.backgroundColor]?.background
|
|
47
45
|
: undefined;
|
|
48
46
|
|
|
49
47
|
if (backgroundColor) {
|
|
@@ -54,7 +52,7 @@ const createParagraphStyle = (
|
|
|
54
52
|
const color =
|
|
55
53
|
exporter.options.colors[
|
|
56
54
|
props.textColor as keyof typeof exporter.options.colors
|
|
57
|
-
].
|
|
55
|
+
]?.text ?? props.textColor;
|
|
58
56
|
textStyles["fo:color"] = color;
|
|
59
57
|
}
|
|
60
58
|
|
|
@@ -115,18 +113,14 @@ const createTableCellStyle = (
|
|
|
115
113
|
fo:background-color={
|
|
116
114
|
cell.props.backgroundColor !== "default" &&
|
|
117
115
|
cell.props.backgroundColor
|
|
118
|
-
? exporter.options.colors[
|
|
119
|
-
|
|
120
|
-
.backgroundColor as keyof typeof exporter.options.colors
|
|
121
|
-
].background
|
|
116
|
+
? exporter.options.colors?.[cell.props.backgroundColor]
|
|
117
|
+
?.background
|
|
122
118
|
: undefined
|
|
123
119
|
}
|
|
124
120
|
// TODO This is not applying because the children set their own colors
|
|
125
121
|
fo:color={
|
|
126
122
|
cell.props.textColor !== "default" && cell.props.textColor
|
|
127
|
-
? exporter.options.colors[
|
|
128
|
-
cell.props.textColor as keyof typeof exporter.options.colors
|
|
129
|
-
].text
|
|
123
|
+
? exporter.options.colors[cell.props.textColor]?.text
|
|
130
124
|
: undefined
|
|
131
125
|
}
|
|
132
126
|
/>
|
|
@@ -35,8 +35,10 @@ export const odtStyleMappingForDefaultSchema: StyleMapping<
|
|
|
35
35
|
if (!val) {
|
|
36
36
|
return {};
|
|
37
37
|
}
|
|
38
|
-
const color =
|
|
39
|
-
|
|
38
|
+
const color = exporter.options.colors[val]?.text;
|
|
39
|
+
if (!color) {
|
|
40
|
+
return {};
|
|
41
|
+
}
|
|
40
42
|
return { "fo:color": color };
|
|
41
43
|
},
|
|
42
44
|
|
|
@@ -44,9 +46,10 @@ export const odtStyleMappingForDefaultSchema: StyleMapping<
|
|
|
44
46
|
if (!val) {
|
|
45
47
|
return {};
|
|
46
48
|
}
|
|
47
|
-
const color =
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
const color = exporter.options.colors[val]?.background;
|
|
50
|
+
if (!color) {
|
|
51
|
+
return {};
|
|
52
|
+
}
|
|
50
53
|
return { "fo:background-color": color };
|
|
51
54
|
},
|
|
52
55
|
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
defaultBlockSpecs,
|
|
5
5
|
} from "@blocknote/core";
|
|
6
6
|
import { testDocument } from "@shared/testDocument.js";
|
|
7
|
-
import { BlobReader, TextWriter, ZipReader } from "@zip.js/zip.js";
|
|
7
|
+
import { BlobReader, FileEntry, TextWriter, ZipReader } from "@zip.js/zip.js";
|
|
8
8
|
import { beforeAll, describe, expect, it } from "vitest";
|
|
9
9
|
import xmlFormat from "xml-formatter";
|
|
10
10
|
import { odtDefaultSchemaMappings } from "./defaultSchema/index.js";
|
|
@@ -154,17 +154,19 @@ async function testODTDocumentAgainstSnapshot(
|
|
|
154
154
|
const entries = await zipReader.getEntries();
|
|
155
155
|
const stylesXMLWriter = new TextWriter();
|
|
156
156
|
const contentXMLWriter = new TextWriter();
|
|
157
|
-
const stylesXML = entries.find(
|
|
157
|
+
const stylesXML = entries.find(
|
|
158
|
+
(entry) => entry.filename === "styles.xml",
|
|
159
|
+
) as FileEntry;
|
|
158
160
|
const contentXML = entries.find((entry) => {
|
|
159
161
|
return entry.filename === "content.xml";
|
|
160
|
-
});
|
|
162
|
+
}) as FileEntry;
|
|
161
163
|
|
|
162
164
|
expect(stylesXML).toBeDefined();
|
|
163
165
|
expect(contentXML).toBeDefined();
|
|
164
166
|
expect(
|
|
165
|
-
xmlFormat(await stylesXML
|
|
167
|
+
xmlFormat(await stylesXML.getData(stylesXMLWriter)),
|
|
166
168
|
).toMatchFileSnapshot(snapshots.styles);
|
|
167
169
|
expect(
|
|
168
|
-
xmlFormat(await contentXML
|
|
170
|
+
xmlFormat(await contentXML.getData(contentXMLWriter)),
|
|
169
171
|
).toMatchFileSnapshot(snapshots.content);
|
|
170
172
|
}
|
package/src/odt/odtExporter.tsx
CHANGED
|
@@ -81,12 +81,12 @@ export class ODTExporter<
|
|
|
81
81
|
{
|
|
82
82
|
name: "Inter 18pt",
|
|
83
83
|
fileName: "Inter_18pt-Regular.ttf",
|
|
84
|
-
data: new Blob([interFont], { type: "font/ttf" }),
|
|
84
|
+
data: new Blob([interFont as ArrayBuffer], { type: "font/ttf" }),
|
|
85
85
|
},
|
|
86
86
|
{
|
|
87
87
|
name: "Geist Mono",
|
|
88
88
|
fileName: "GeistMono-Regular.ttf",
|
|
89
|
-
data: new Blob([geistMonoFont], { type: "font/ttf" }),
|
|
89
|
+
data: new Blob([geistMonoFont as ArrayBuffer], { type: "font/ttf" }),
|
|
90
90
|
},
|
|
91
91
|
];
|
|
92
92
|
}
|