@blocknote/xl-odt-exporter 0.39.1 → 0.41.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/dist/blocknote-xl-odt-exporter.js +28 -12
- package/dist/blocknote-xl-odt-exporter.js.map +1 -1
- package/dist/blocknote-xl-odt-exporter.umd.cjs +1 -1
- package/dist/blocknote-xl-odt-exporter.umd.cjs.map +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +3 -3
- package/src/odt/__snapshots__/basic/content.xml +4 -0
- package/src/odt/__snapshots__/withCustomOptions/content.xml +4 -0
- package/src/odt/defaultSchema/blocks.tsx +18 -0
|
@@ -5,7 +5,7 @@ import { jsxs as f, Fragment as h, jsx as l } from "react/jsx-runtime";
|
|
|
5
5
|
import { mapTableCell as T, Exporter as M, COLORS_DEFAULT as B } from "@blocknote/core";
|
|
6
6
|
import { ZipWriter as $, BlobWriter as W, TextReader as v, BlobReader as k } from "@zip.js/zip.js";
|
|
7
7
|
import { renderToString as C } from "react-dom/server";
|
|
8
|
-
const L = (e) => Array.from({ length: e }, () => /* @__PURE__ */ l("text:tab", {})),
|
|
8
|
+
const L = (e) => Array.from({ length: e }, () => /* @__PURE__ */ l("text:tab", {})), d = (e, t, n = "Standard", s = {}, a = {}, o = {}) => {
|
|
9
9
|
const y = {
|
|
10
10
|
...a
|
|
11
11
|
}, i = { ...o };
|
|
@@ -73,7 +73,7 @@ const L = (e) => Array.from({ length: e }, () => /* @__PURE__ */ l("text:tab", {
|
|
|
73
73
|
}
|
|
74
74
|
) })), S = (e, t) => t <= 0 ? e : /* @__PURE__ */ l("text:list", { children: /* @__PURE__ */ l("text:list-item", { children: S(e, t - 1) }) }), O = {
|
|
75
75
|
paragraph: (e, t, n) => {
|
|
76
|
-
const s =
|
|
76
|
+
const s = d(
|
|
77
77
|
t,
|
|
78
78
|
e.props
|
|
79
79
|
);
|
|
@@ -83,7 +83,7 @@ const L = (e) => Array.from({ length: e }, () => /* @__PURE__ */ l("text:tab", {
|
|
|
83
83
|
] });
|
|
84
84
|
},
|
|
85
85
|
heading: (e, t, n) => {
|
|
86
|
-
const a =
|
|
86
|
+
const a = d(
|
|
87
87
|
t,
|
|
88
88
|
e.props,
|
|
89
89
|
"Heading_20_" + e.props.level
|
|
@@ -101,7 +101,7 @@ const L = (e) => Array.from({ length: e }, () => /* @__PURE__ */ l("text:tab", {
|
|
|
101
101
|
);
|
|
102
102
|
},
|
|
103
103
|
quote: (e, t, n) => {
|
|
104
|
-
const a =
|
|
104
|
+
const a = d(
|
|
105
105
|
t,
|
|
106
106
|
e.props,
|
|
107
107
|
"Standard",
|
|
@@ -134,7 +134,7 @@ const L = (e) => Array.from({ length: e }, () => /* @__PURE__ */ l("text:tab", {
|
|
|
134
134
|
t.transformInlineContent(e.content)
|
|
135
135
|
] }),
|
|
136
136
|
bulletListItem: (e, t, n) => {
|
|
137
|
-
const s =
|
|
137
|
+
const s = d(
|
|
138
138
|
t,
|
|
139
139
|
e.props,
|
|
140
140
|
"Standard",
|
|
@@ -146,7 +146,7 @@ const L = (e) => Array.from({ length: e }, () => /* @__PURE__ */ l("text:tab", {
|
|
|
146
146
|
) }) });
|
|
147
147
|
},
|
|
148
148
|
numberedListItem: (e, t, n, s) => {
|
|
149
|
-
const a =
|
|
149
|
+
const a = d(
|
|
150
150
|
t,
|
|
151
151
|
e.props
|
|
152
152
|
), o = (s || 0) > 1 ? "true" : "false";
|
|
@@ -175,6 +175,22 @@ const L = (e) => Array.from({ length: e }, () => /* @__PURE__ */ l("text:tab", {
|
|
|
175
175
|
t.transformInlineContent(e.content)
|
|
176
176
|
] }),
|
|
177
177
|
pageBreak: async () => /* @__PURE__ */ l("text:p", { "text:style-name": "PageBreak" }),
|
|
178
|
+
divider: (e, t) => {
|
|
179
|
+
const n = d(
|
|
180
|
+
t,
|
|
181
|
+
e.props,
|
|
182
|
+
"Standard",
|
|
183
|
+
{},
|
|
184
|
+
{
|
|
185
|
+
"fo:border-top": "1pt solid #cccccc",
|
|
186
|
+
"fo:margin-top": "11pt",
|
|
187
|
+
"fo:margin-bottom": "12pt",
|
|
188
|
+
"fo:padding-top": "0pt",
|
|
189
|
+
"fo:padding-bottom": "0pt"
|
|
190
|
+
}
|
|
191
|
+
);
|
|
192
|
+
return /* @__PURE__ */ l("text:p", { "text:style-name": n });
|
|
193
|
+
},
|
|
178
194
|
column: (e, t, n, s, a) => {
|
|
179
195
|
const y = t.registerStyle((i) => /* @__PURE__ */ l("style:style", { "style:name": i, "style:family": "table-cell", children: /* @__PURE__ */ l(
|
|
180
196
|
"style:table-cell-properties",
|
|
@@ -199,7 +215,7 @@ const L = (e) => Array.from({ length: e }, () => /* @__PURE__ */ l("text:tab", {
|
|
|
199
215
|
) }));
|
|
200
216
|
return /* @__PURE__ */ f("table:table", { "table:name": e.id, "table:style-name": i, children: [
|
|
201
217
|
(o.children || []).map((r, m) => {
|
|
202
|
-
const x = y.registerStyle((
|
|
218
|
+
const x = y.registerStyle((g) => /* @__PURE__ */ l("style:style", { "style:name": g, "style:family": "table-column", children: /* @__PURE__ */ l(
|
|
203
219
|
"style:table-column-properties",
|
|
204
220
|
{
|
|
205
221
|
"style:rel-column-width": `${r.props.width * 100}*`
|
|
@@ -211,7 +227,7 @@ const L = (e) => Array.from({ length: e }, () => /* @__PURE__ */ l("text:tab", {
|
|
|
211
227
|
] });
|
|
212
228
|
},
|
|
213
229
|
image: async (e, t) => {
|
|
214
|
-
const n = t, { path: s, mimeType: a, ...o } = await n.registerPicture(e.props.url), y =
|
|
230
|
+
const n = t, { path: s, mimeType: a, ...o } = await n.registerPicture(e.props.url), y = d(
|
|
215
231
|
t,
|
|
216
232
|
e.props
|
|
217
233
|
), i = e.props.previewWidth || o.width, r = o.height / o.width * i, m = 20, x = /* @__PURE__ */ f("text:p", { "text:style-name": e.props.caption ? "Caption" : y, children: [
|
|
@@ -270,8 +286,8 @@ const L = (e) => Array.from({ length: e }, () => /* @__PURE__ */ l("text:tab", {
|
|
|
270
286
|
) }));
|
|
271
287
|
return /* @__PURE__ */ l("table:table-column", { "table:style-name": c }, x);
|
|
272
288
|
}),
|
|
273
|
-
e.content.rows.map((m, x) => /* @__PURE__ */ l("table:table-row", { children: m.cells.map((
|
|
274
|
-
const c = T(
|
|
289
|
+
e.content.rows.map((m, x) => /* @__PURE__ */ l("table:table-row", { children: m.cells.map((g, u) => {
|
|
290
|
+
const c = T(g);
|
|
275
291
|
return /* @__PURE__ */ l(
|
|
276
292
|
"table:table-cell",
|
|
277
293
|
{
|
|
@@ -1539,7 +1555,7 @@ class K extends M {
|
|
|
1539
1555
|
const z = /<([a-zA-Z0-9:]+)\s+?(?:xml)ns(?::[a-zA-Z0-9]+)?=".*"(.*)>/g;
|
|
1540
1556
|
let w = "";
|
|
1541
1557
|
return typeof p == "string" ? w = p : w = new XMLSerializer().serializeToString(p), w.replace(z, "<$1$2>");
|
|
1542
|
-
}, o = await this.transformBlocks(n), y = Array.from(this.automaticStyles.values()), i = Array.from(this.pictures.values()), r = await this.loadFonts(), m = a((s == null ? void 0 : s.header) || ""), x = a((s == null ? void 0 : s.footer) || ""),
|
|
1558
|
+
}, o = await this.transformBlocks(n), y = Array.from(this.automaticStyles.values()), i = Array.from(this.pictures.values()), r = await this.loadFonts(), m = a((s == null ? void 0 : s.header) || ""), x = a((s == null ? void 0 : s.footer) || ""), g = /* @__PURE__ */ f(
|
|
1543
1559
|
"office:document-content",
|
|
1544
1560
|
{
|
|
1545
1561
|
"xmlns:office": "urn:oasis:names:tc:opendocument:xmlns:office:1.0",
|
|
@@ -1657,7 +1673,7 @@ class K extends M {
|
|
|
1657
1673
|
extendedTimestamp: !1
|
|
1658
1674
|
}
|
|
1659
1675
|
);
|
|
1660
|
-
const _ = C(
|
|
1676
|
+
const _ = C(g), F = C(u);
|
|
1661
1677
|
return c.add("content.xml", new v(_)), c.add("styles.xml", new v(j)), c.add("META-INF/manifest.xml", new v(F)), r.forEach((p) => {
|
|
1662
1678
|
c.add(`Fonts/${p.fileName}`, new k(p.data));
|
|
1663
1679
|
}), i.forEach((p) => {
|