@blocknote/xl-docx-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--NrcstcO.cjs.map +1 -1
- package/dist/GeistMono-Regular-D4rKXxwr.js.map +1 -1
- package/dist/Inter_18pt-Regular-CCMUw8TC.cjs.map +1 -1
- package/dist/Inter_18pt-Regular-byxnNS-8.js.map +1 -1
- package/dist/blocknote-xl-docx-exporter.cjs +2 -2
- package/dist/blocknote-xl-docx-exporter.cjs.map +1 -1
- package/dist/blocknote-xl-docx-exporter.js +110 -78
- package/dist/blocknote-xl-docx-exporter.js.map +1 -1
- package/dist/index-B-FmPo2r.cjs.map +1 -1
- package/dist/index-cA_PmnZy.js.map +1 -1
- package/dist/styles-C7c5RlKz.cjs.map +1 -1
- package/dist/styles-CujW8HHo.js.map +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +16 -16
- package/src/docx/defaultSchema/blocks.ts +14 -5
- package/src/docx/defaultSchema/styles.ts +10 -7
- package/src/docx/docxExporter.test.ts +9 -3
- package/src/docx/util/Table.tsx +17 -8
|
@@ -4,7 +4,13 @@ import {
|
|
|
4
4
|
createPageBreakBlockSpec,
|
|
5
5
|
} from "@blocknote/core";
|
|
6
6
|
import { testDocument } from "@shared/testDocument.js";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
BlobReader,
|
|
9
|
+
Entry,
|
|
10
|
+
FileEntry,
|
|
11
|
+
TextWriter,
|
|
12
|
+
ZipReader,
|
|
13
|
+
} from "@zip.js/zip.js";
|
|
8
14
|
import { Packer, Paragraph, TextRun } from "docx";
|
|
9
15
|
import { describe, expect, it } from "vitest";
|
|
10
16
|
import xmlFormat from "xml-formatter";
|
|
@@ -15,8 +21,8 @@ import { partialBlocksToBlocksForTesting } from "@shared/formatConversionTestUti
|
|
|
15
21
|
|
|
16
22
|
const getZIPEntryContent = (entries: Entry[], fileName: string) => {
|
|
17
23
|
const entry = entries.find((entry) => {
|
|
18
|
-
return entry.filename === fileName;
|
|
19
|
-
});
|
|
24
|
+
return entry.filename === fileName && !entry.directory;
|
|
25
|
+
}) as FileEntry | undefined;
|
|
20
26
|
|
|
21
27
|
if (!entry) {
|
|
22
28
|
return "";
|
package/src/docx/util/Table.tsx
CHANGED
|
@@ -55,11 +55,15 @@ export const Table = (
|
|
|
55
55
|
? undefined
|
|
56
56
|
: {
|
|
57
57
|
type: ShadingType.SOLID,
|
|
58
|
-
color:
|
|
59
|
-
|
|
60
|
-
cell.props
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
color: (() => {
|
|
59
|
+
const color =
|
|
60
|
+
t.options.colors[cell.props.backgroundColor]
|
|
61
|
+
?.background;
|
|
62
|
+
if (!color) {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
return color.slice(1);
|
|
66
|
+
})(),
|
|
63
67
|
},
|
|
64
68
|
children: [
|
|
65
69
|
new Paragraph({
|
|
@@ -88,9 +92,14 @@ export const Table = (
|
|
|
88
92
|
color:
|
|
89
93
|
cell.props.textColor === "default" || !cell.props.textColor
|
|
90
94
|
? undefined
|
|
91
|
-
:
|
|
92
|
-
|
|
93
|
-
|
|
95
|
+
: (() => {
|
|
96
|
+
const color =
|
|
97
|
+
t.options.colors[cell.props.textColor]?.text;
|
|
98
|
+
if (!color) {
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
return color.slice(1);
|
|
102
|
+
})(),
|
|
94
103
|
},
|
|
95
104
|
}),
|
|
96
105
|
],
|