@blocknote/xl-odt-exporter 0.51.4 → 0.52.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.
@@ -1 +1 @@
1
- {"builtAt":1780397424283,"assets":[{"name":"blocknote-xl-odt-exporter.umd.cjs","size":700474},{"name":"blocknote-xl-odt-exporter.umd.cjs.map","size":745272}],"chunks":[{"id":"a1ee98a","entry":true,"initial":true,"files":["blocknote-xl-odt-exporter.umd.cjs"],"names":["index"]}],"modules":[{"name":"./rolldown/runtime.js","size":430,"chunks":["a1ee98a"]},{"name":"./src/odt/defaultSchema/blocks.tsx","size":15475,"chunks":["a1ee98a"]},{"name":"./src/odt/defaultSchema/inlineContent.tsx","size":561,"chunks":["a1ee98a"]},{"name":"./src/odt/defaultSchema/styles.ts","size":959,"chunks":["a1ee98a"]},{"name":"./src/odt/defaultSchema/index.ts","size":254,"chunks":["a1ee98a"]},{"name":"../../shared/util/fileUtil.ts","size":202,"chunks":["a1ee98a"]},{"name":"../../shared/util/imageUtil.ts","size":584,"chunks":["a1ee98a"]},{"name":"./src/odt/template/styles.xml?raw","size":76841,"chunks":["a1ee98a"]},{"name":"../../shared/assets/fonts/inter/Inter_18pt-Regular.ttf","size":457240,"chunks":["a1ee98a"]},{"name":"../../shared/assets/fonts/GeistMono-Regular.ttf","size":155320,"chunks":["a1ee98a"]},{"name":"./src/odt/odtExporter.tsx","size":9021,"chunks":["a1ee98a"]},{"name":"./src/index.ts","size":0,"chunks":["a1ee98a"]}]}
1
+ {"builtAt":1784560156704,"assets":[{"name":"blocknote-xl-odt-exporter.umd.cjs","size":700631},{"name":"blocknote-xl-odt-exporter.umd.cjs.map","size":662276}],"chunks":[{"id":"a1ee98a","entry":true,"initial":true,"files":["blocknote-xl-odt-exporter.umd.cjs"],"names":["index"]}],"modules":[{"name":"./rolldown/runtime.js","size":430,"chunks":["a1ee98a"]},{"name":"./src/odt/defaultSchema/blocks.tsx","size":15669,"chunks":["a1ee98a"]},{"name":"./src/odt/defaultSchema/inlineContent.tsx","size":561,"chunks":["a1ee98a"]},{"name":"./src/odt/defaultSchema/styles.ts","size":959,"chunks":["a1ee98a"]},{"name":"./src/odt/defaultSchema/index.ts","size":254,"chunks":["a1ee98a"]},{"name":"../../shared/util/fileUtil.ts","size":202,"chunks":["a1ee98a"]},{"name":"../../shared/util/imageUtil.ts","size":584,"chunks":["a1ee98a"]},{"name":"./src/odt/template/styles.xml?raw","size":76841,"chunks":["a1ee98a"]},{"name":"../../shared/assets/fonts/inter/Inter_18pt-Regular.ttf","size":457240,"chunks":["a1ee98a"]},{"name":"../../shared/assets/fonts/GeistMono-Regular.ttf","size":155320,"chunks":["a1ee98a"]},{"name":"./src/odt/odtExporter.tsx","size":9071,"chunks":["a1ee98a"]},{"name":"./src/index.ts","size":0,"chunks":["a1ee98a"]}]}
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.51.4",
12
+ "version": "0.52.1",
13
13
  "files": [
14
14
  "dist",
15
15
  "types",
@@ -49,41 +49,34 @@
49
49
  }
50
50
  },
51
51
  "dependencies": {
52
- "@blocknote/core": "0.51.4",
53
- "@blocknote/xl-multi-column": "0.51.4",
54
52
  "@zip.js/zip.js": "^2.8.8",
55
- "buffer": "^6.0.3",
56
- "image-meta": "^0.2.2"
53
+ "image-meta": "^0.2.2",
54
+ "@blocknote/core": "^0.52.1",
55
+ "@blocknote/xl-multi-column": "^0.52.1"
57
56
  },
58
57
  "devDependencies": {
59
58
  "@testing-library/react": "^16.3.0",
59
+ "@types/node": "22.13.13",
60
60
  "@types/react": "^19.2.3",
61
61
  "@types/react-dom": "^19.2.3",
62
- "eslint": "^8.57.1",
63
62
  "react": "^19.2.5",
64
63
  "react-dom": "^19.2.5",
64
+ "rimraf": "^5.0.10",
65
65
  "rollup-plugin-webpack-stats": "^0.2.6",
66
66
  "typescript": "^5.9.3",
67
- "vite": "^8.0.8",
68
- "vite-plugin-eslint": "^1.8.1",
69
- "vitest": "^4.1.2",
70
- "xml-formatter": "^3.6.7"
67
+ "xml-formatter": "^3.6.7",
68
+ "vite-plus": "^0.1.24",
69
+ "@blocknote/shared": "^0.30.0"
71
70
  },
72
71
  "peerDependencies": {
73
72
  "react": "^18.0 || ^19.0 || >= 19.0.0-rc",
74
73
  "react-dom": "^18.0 || ^19.0 || >= 19.0.0-rc"
75
74
  },
76
- "eslintConfig": {
77
- "extends": [
78
- "../../.eslintrc.json"
79
- ]
80
- },
81
75
  "scripts": {
82
- "dev": "vite",
83
- "build": "tsc && vite build",
84
- "lint": "eslint src --max-warnings 0",
85
- "test": "vitest --run",
86
- "test-watch": "vitest watch",
76
+ "dev": "vp dev",
77
+ "lint": "vp lint src",
78
+ "test": "vp test --run",
79
+ "test-watch": "vp test watch",
87
80
  "clean": "rimraf dist && rimraf types"
88
81
  }
89
82
  }
@@ -5,14 +5,13 @@ import {
5
5
  DefaultBlockSchema,
6
6
  DefaultProps,
7
7
  mapTableCell,
8
- StyledText,
9
8
  TableCell,
10
9
  } from "@blocknote/core";
11
- import { ODTExporter } from "../odtExporter.js";
12
10
  import { multiColumnSchema } from "@blocknote/xl-multi-column";
11
+ import { ODTExporter } from "../odtExporter.js";
13
12
 
14
13
  export const getTabs = (nestingLevel: number) => {
15
- return Array.from({ length: nestingLevel }, () => <text:tab />);
14
+ return Array.from({ length: nestingLevel }, (_, i) => <text:tab key={i} />);
16
15
  };
17
16
 
18
17
  const createParagraphStyle = (
@@ -501,7 +500,12 @@ export const odtBlockMappingForDefaultSchema: BlockMapping<
501
500
  },
502
501
 
503
502
  codeBlock: (block) => {
504
- const textContent = (block.content as StyledText<any>[])[0]?.text || "";
503
+ // Code blocks hold plain content: at most a single unstyled text item.
504
+ const [textItem, ...excessItems] = block.content;
505
+ if (excessItems.length > 0 || (textItem && !("text" in textItem))) {
506
+ throw new Error("expected plain block content to be a single text item");
507
+ }
508
+ const textContent = textItem?.text ?? "";
505
509
 
506
510
  return (
507
511
  <text:p text:style-name="Codeblock">
@@ -5,12 +5,13 @@ import {
5
5
  } from "@blocknote/core";
6
6
  import { testDocument } from "@shared/testDocument.js";
7
7
  import { BlobReader, FileEntry, TextWriter, ZipReader } from "@zip.js/zip.js";
8
- import { beforeAll, describe, expect, it } from "vitest";
8
+ import { beforeAll, describe, expect, it } from "vite-plus/test";
9
9
  import xmlFormat from "xml-formatter";
10
10
  import { odtDefaultSchemaMappings } from "./defaultSchema/index.js";
11
11
  import { ODTExporter } from "./odtExporter.js";
12
12
  import { ColumnBlock, ColumnListBlock } from "@blocknote/xl-multi-column";
13
13
  import { partialBlocksToBlocksForTesting } from "@shared/formatConversionTestUtil.js";
14
+ import { testResolveFileUrl } from "@shared/util/testFileResolver.js";
14
15
 
15
16
  beforeAll(async () => {
16
17
  // @ts-expect-error - Blob polyfill for Node test environment
@@ -27,6 +28,7 @@ describe("exporter", () => {
27
28
  },
28
29
  }),
29
30
  odtDefaultSchemaMappings,
31
+ { resolveFileUrl: testResolveFileUrl },
30
32
  );
31
33
  const odt = await exporter.toODTDocument(testDocument);
32
34
  await testODTDocumentAgainstSnapshot(odt, {
@@ -47,6 +49,7 @@ describe("exporter", () => {
47
49
  },
48
50
  }),
49
51
  odtDefaultSchemaMappings,
52
+ { resolveFileUrl: testResolveFileUrl },
50
53
  );
51
54
 
52
55
  const odt = await exporter.toODTDocument(testDocument, {
@@ -76,7 +79,9 @@ describe("exporter", () => {
76
79
  columnList: ColumnListBlock,
77
80
  },
78
81
  });
79
- const exporter = new ODTExporter(schema, odtDefaultSchemaMappings);
82
+ const exporter = new ODTExporter(schema, odtDefaultSchemaMappings, {
83
+ resolveFileUrl: testResolveFileUrl,
84
+ });
80
85
  const odt = await exporter.toODTDocument(
81
86
  partialBlocksToBlocksForTesting(schema, [
82
87
  {
@@ -163,10 +168,10 @@ async function testODTDocumentAgainstSnapshot(
163
168
 
164
169
  expect(stylesXML).toBeDefined();
165
170
  expect(contentXML).toBeDefined();
166
- expect(
171
+ await expect(
167
172
  xmlFormat(await stylesXML.getData(stylesXMLWriter)),
168
173
  ).toMatchFileSnapshot(snapshots.styles);
169
- expect(
174
+ await expect(
170
175
  xmlFormat(await contentXML.getData(contentXMLWriter)),
171
176
  ).toMatchFileSnapshot(snapshots.content);
172
177
  }
@@ -205,6 +205,7 @@ export class ODTExporter<
205
205
  {fonts.map((font) => {
206
206
  return (
207
207
  <style:font-face
208
+ key={font.name}
208
209
  style:name={font.name}
209
210
  svg:font-family={font.name}
210
211
  style:font-pitch="variable"
@@ -274,6 +275,7 @@ export class ODTExporter<
274
275
  {pictures.map((picture) => {
275
276
  return (
276
277
  <manifest:file-entry
278
+ key={picture.fileName}
277
279
  manifest:media-type={picture.file.type}
278
280
  manifest:full-path={`Pictures/${picture.fileName}`}
279
281
  />
@@ -282,6 +284,7 @@ export class ODTExporter<
282
284
  {fonts.map((font) => {
283
285
  return (
284
286
  <manifest:file-entry
287
+ key={font.name}
285
288
  manifest:media-type="application/x-font-ttf"
286
289
  manifest:full-path={`Fonts/${font.fileName}`}
287
290
  />
@@ -294,7 +297,7 @@ export class ODTExporter<
294
297
  );
295
298
 
296
299
  // Add mimetype first, uncompressed
297
- zipWriter.add(
300
+ void zipWriter.add(
298
301
  "mimetype",
299
302
  new TextReader("application/vnd.oasis.opendocument.text"),
300
303
  {
@@ -308,14 +311,14 @@ export class ODTExporter<
308
311
  const contentXml = renderToString(content);
309
312
  const manifestXml = renderToString(manifestNode);
310
313
 
311
- zipWriter.add("content.xml", new TextReader(contentXml));
312
- zipWriter.add("styles.xml", new TextReader(stylesXml));
313
- zipWriter.add("META-INF/manifest.xml", new TextReader(manifestXml));
314
+ void zipWriter.add("content.xml", new TextReader(contentXml));
315
+ void zipWriter.add("styles.xml", new TextReader(stylesXml));
316
+ void zipWriter.add("META-INF/manifest.xml", new TextReader(manifestXml));
314
317
  fonts.forEach((font) => {
315
- zipWriter.add(`Fonts/${font.fileName}`, new BlobReader(font.data));
318
+ void zipWriter.add(`Fonts/${font.fileName}`, new BlobReader(font.data));
316
319
  });
317
320
  pictures.forEach((picture) => {
318
- zipWriter.add(
321
+ void zipWriter.add(
319
322
  `Pictures/${picture.fileName}`,
320
323
  new BlobReader(picture.file),
321
324
  );
package/src/vite-env.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /// <reference types="vite/client" />
1
+ /// <reference types="vite-plus/client" />
2
2
 
3
3
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
4
4
  interface ImportMetaEnv {