@blocknote/xl-odt-exporter 0.26.0 → 0.27.2
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 +138 -123
- 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 +22 -17
- package/src/odt/defaultSchema/blocks.tsx +31 -3
- package/src/odt/defaultSchema/inlineContent.tsx +2 -2
- package/src/odt/util/jsx.d.ts +55 -53
- package/types/src/odt/defaultSchema/blocks.d.ts +1 -2
- package/types/src/odt/defaultSchema/index.d.ts +35 -4
- package/types/src/odt/defaultSchema/inlineContent.d.ts +1 -2
- package/types/src/odt/odtExporter.d.ts +0 -1
package/dist/webpack-stats.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"builtAt":
|
|
1
|
+
{"builtAt":1743885358060,"assets":[{"name":"blocknote-xl-odt-exporter.umd.cjs","size":698972},{"name":"blocknote-xl-odt-exporter.umd.cjs.map","size":747000}],"chunks":[{"id":"642be88","entry":true,"initial":true,"files":["blocknote-xl-odt-exporter.umd.cjs"],"names":["index"]}],"modules":[{"name":"./src/odt/defaultSchema/blocks.tsx","size":14185,"chunks":["642be88"]},{"name":"./src/odt/defaultSchema/inlineContent.tsx","size":533,"chunks":["642be88"]},{"name":"./src/odt/defaultSchema/styles.ts","size":963,"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":9974,"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
|
@@ -2,8 +2,14 @@
|
|
|
2
2
|
"name": "@blocknote/xl-odt-exporter",
|
|
3
3
|
"homepage": "https://github.com/TypeCellOS/BlockNote",
|
|
4
4
|
"private": false,
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/TypeCellOS/BlockNote.git",
|
|
9
|
+
"directory": "packages/xl-odt-exporter"
|
|
10
|
+
},
|
|
5
11
|
"license": "AGPL-3.0 OR PROPRIETARY",
|
|
6
|
-
"version": "0.
|
|
12
|
+
"version": "0.27.2",
|
|
7
13
|
"files": [
|
|
8
14
|
"dist",
|
|
9
15
|
"types",
|
|
@@ -41,29 +47,25 @@
|
|
|
41
47
|
"require": "./dist/style.css"
|
|
42
48
|
}
|
|
43
49
|
},
|
|
44
|
-
"scripts": {
|
|
45
|
-
"dev": "vite",
|
|
46
|
-
"build": "tsc --build && vite build",
|
|
47
|
-
"lint": "eslint src --max-warnings 0",
|
|
48
|
-
"test": "vitest --run",
|
|
49
|
-
"test-watch": "vitest watch",
|
|
50
|
-
"clean": "rimraf dist && rimraf types"
|
|
51
|
-
},
|
|
52
50
|
"dependencies": {
|
|
53
|
-
"@blocknote/core": "^0.
|
|
51
|
+
"@blocknote/core": "^0.27.2",
|
|
54
52
|
"@zip.js/zip.js": "^2.7.57",
|
|
55
53
|
"buffer": "^6.0.3",
|
|
56
54
|
"image-meta": "^0.2.1"
|
|
57
55
|
},
|
|
58
56
|
"devDependencies": {
|
|
59
57
|
"@testing-library/react": "^16.0.1",
|
|
58
|
+
"@types/react": "^18.0.25",
|
|
59
|
+
"@types/react-dom": "^18.0.9",
|
|
60
60
|
"prettier": "^2.7.1",
|
|
61
61
|
"rollup-plugin-webpack-stats": "^0.2.2",
|
|
62
62
|
"typescript": "^5.0.4",
|
|
63
63
|
"vite": "^5.3.4",
|
|
64
64
|
"vite-plugin-eslint": "^1.8.1",
|
|
65
65
|
"vitest": "^2.0.3",
|
|
66
|
-
"xml-formatter": "^3.6.3"
|
|
66
|
+
"xml-formatter": "^3.6.3",
|
|
67
|
+
"react": "^18.3.1",
|
|
68
|
+
"react-dom": "^18.3.1"
|
|
67
69
|
},
|
|
68
70
|
"peerDependencies": {
|
|
69
71
|
"react": "^18.0 || ^19.0 || >= 19.0.0-rc",
|
|
@@ -74,9 +76,12 @@
|
|
|
74
76
|
"../../.eslintrc.js"
|
|
75
77
|
]
|
|
76
78
|
},
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
"scripts": {
|
|
80
|
+
"dev": "vite",
|
|
81
|
+
"build": "tsc --build && vite build",
|
|
82
|
+
"lint": "eslint src --max-warnings 0",
|
|
83
|
+
"test": "vitest --run",
|
|
84
|
+
"test-watch": "vitest watch",
|
|
85
|
+
"clean": "rimraf dist && rimraf types"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -17,10 +17,14 @@ const createParagraphStyle = (
|
|
|
17
17
|
exporter: ODTExporter<any, any, any>,
|
|
18
18
|
props: Partial<DefaultProps>,
|
|
19
19
|
parentStyleName = "Standard",
|
|
20
|
-
styleAttributes: Record<string, string> = {}
|
|
20
|
+
styleAttributes: Record<string, string> = {},
|
|
21
|
+
paragraphStyleAttributes: Record<string, string> = {},
|
|
22
|
+
textStyleAttributes: Record<string, string> = {}
|
|
21
23
|
) => {
|
|
22
|
-
const paragraphStyles: Record<string, string> = {
|
|
23
|
-
|
|
24
|
+
const paragraphStyles: Record<string, string> = {
|
|
25
|
+
...paragraphStyleAttributes,
|
|
26
|
+
};
|
|
27
|
+
const textStyles: Record<string, string> = { ...textStyleAttributes };
|
|
24
28
|
|
|
25
29
|
if (props.textAlignment && props.textAlignment !== "left") {
|
|
26
30
|
const alignmentMap = {
|
|
@@ -201,6 +205,30 @@ export const odtBlockMappingForDefaultSchema: BlockMapping<
|
|
|
201
205
|
);
|
|
202
206
|
},
|
|
203
207
|
|
|
208
|
+
quote: (block, exporter, nestingLevel) => {
|
|
209
|
+
const customStyleName = createParagraphStyle(
|
|
210
|
+
exporter as ODTExporter<any, any, any>,
|
|
211
|
+
block.props,
|
|
212
|
+
"Standard",
|
|
213
|
+
{},
|
|
214
|
+
{
|
|
215
|
+
"fo:border-left": "2pt solid #7D797A",
|
|
216
|
+
"fo:padding-left": "0.25in",
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"fo:color": "#7D797A",
|
|
220
|
+
}
|
|
221
|
+
);
|
|
222
|
+
const styleName = customStyleName;
|
|
223
|
+
|
|
224
|
+
return (
|
|
225
|
+
<text:p text:style-name={styleName}>
|
|
226
|
+
{getTabs(nestingLevel)}
|
|
227
|
+
{exporter.transformInlineContent(block.content)}
|
|
228
|
+
</text:p>
|
|
229
|
+
);
|
|
230
|
+
},
|
|
231
|
+
|
|
204
232
|
/**
|
|
205
233
|
* Note: we wrap each list item in it's own list element.
|
|
206
234
|
* This is not the cleanest solution, it would be nicer to recognize subsequent
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
export const odtInlineContentMappingForDefaultSchema: InlineContentMapping<
|
|
7
7
|
DefaultInlineContentSchema,
|
|
8
8
|
any,
|
|
9
|
-
JSX.Element,
|
|
10
|
-
JSX.Element
|
|
9
|
+
React.JSX.Element,
|
|
10
|
+
React.JSX.Element
|
|
11
11
|
> = {
|
|
12
12
|
link: (ic, exporter) => {
|
|
13
13
|
const content = ic.content.map((c) => exporter.transformStyledText(c));
|
package/src/odt/util/jsx.d.ts
CHANGED
|
@@ -1,55 +1,57 @@
|
|
|
1
|
-
declare
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
1
|
+
declare module 'react/jsx-runtime' {
|
|
2
|
+
namespace JSX {
|
|
3
|
+
interface IntrinsicElements {
|
|
4
|
+
"office:document-content": any;
|
|
5
|
+
"office:body": any;
|
|
6
|
+
"office:text": any;
|
|
7
|
+
"office:automatic-styles": any;
|
|
8
|
+
"office:font-face-decls": any;
|
|
9
|
+
"office:master-styles": any;
|
|
10
|
+
"style:style": any;
|
|
11
|
+
"style:text-properties": any;
|
|
12
|
+
"style:master-page": any;
|
|
13
|
+
"style:header": any;
|
|
14
|
+
"style:footer": any;
|
|
15
|
+
"text:p": any;
|
|
16
|
+
"text:h": any;
|
|
17
|
+
"text:list-item": any;
|
|
18
|
+
"text:list": any;
|
|
19
|
+
"text:a": any;
|
|
20
|
+
"text:span": any;
|
|
21
|
+
"text:line-break": any;
|
|
22
|
+
"text:tab": any;
|
|
23
|
+
"draw:frame": any;
|
|
24
|
+
"draw:image": any;
|
|
25
|
+
"draw:text-box": any;
|
|
26
|
+
"table:table": any;
|
|
27
|
+
"table:table-row": any;
|
|
28
|
+
"table:table-cell": any;
|
|
29
|
+
"table:table-column": any;
|
|
30
|
+
"manifest:manifest": any;
|
|
31
|
+
"manifest:file-entry": any;
|
|
32
|
+
"style:paragraph-properties": any;
|
|
33
|
+
"style:background-fill": any;
|
|
34
|
+
"style:table-properties": any;
|
|
35
|
+
"style:table-cell-properties": any;
|
|
36
|
+
"style:table-column-properties": any;
|
|
37
|
+
"style:table-row-properties": any;
|
|
38
|
+
"style:font-face": any;
|
|
39
|
+
"svg:font-face-src": any;
|
|
40
|
+
"svg:font-face-uri": any;
|
|
41
|
+
"svg:font-face-format": any;
|
|
42
|
+
"loext:graphic-properties": any;
|
|
43
|
+
}
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
45
|
+
interface IntrinsicAttributes {
|
|
46
|
+
"text:style-name"?: string;
|
|
47
|
+
"style:style-name"?: string;
|
|
48
|
+
"style:name"?: string;
|
|
49
|
+
"style:family"?: string;
|
|
50
|
+
"style:background-fill"?: string;
|
|
51
|
+
"draw:fill"?: string;
|
|
52
|
+
"draw:fill-color"?: string;
|
|
53
|
+
"fo:border"?: string;
|
|
54
|
+
"fo:padding"?: string;
|
|
55
|
+
}
|
|
54
56
|
}
|
|
55
|
-
}
|
|
57
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { BlockMapping, DefaultBlockSchema, pageBreakSchema } from "@blocknote/core";
|
|
3
|
-
export declare const getTabs: (nestingLevel: number) =>
|
|
2
|
+
export declare const getTabs: (nestingLevel: number) => any[];
|
|
4
3
|
export declare const odtBlockMappingForDefaultSchema: BlockMapping<DefaultBlockSchema & typeof pageBreakSchema.blockSchema, any, any, React.ReactNode, React.ReactNode>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export declare const odtDefaultSchemaMappings: {
|
|
3
2
|
blockMapping: import("@blocknote/core").BlockMapping<import("@blocknote/core").BlockSchemaFromSpecs<{
|
|
4
3
|
paragraph: {
|
|
@@ -77,6 +76,40 @@ export declare const odtDefaultSchemaMappings: {
|
|
|
77
76
|
};
|
|
78
77
|
}, any, import("@blocknote/core").InlineContentSchema, import("@blocknote/core").StyleSchema>;
|
|
79
78
|
};
|
|
79
|
+
quote: {
|
|
80
|
+
config: {
|
|
81
|
+
type: "quote";
|
|
82
|
+
content: "inline";
|
|
83
|
+
propSchema: {
|
|
84
|
+
backgroundColor: {
|
|
85
|
+
default: "default";
|
|
86
|
+
};
|
|
87
|
+
textColor: {
|
|
88
|
+
default: "default";
|
|
89
|
+
};
|
|
90
|
+
textAlignment: {
|
|
91
|
+
default: "left";
|
|
92
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
implementation: import("@blocknote/core").TiptapBlockImplementation<{
|
|
97
|
+
type: "quote";
|
|
98
|
+
content: "inline";
|
|
99
|
+
propSchema: {
|
|
100
|
+
backgroundColor: {
|
|
101
|
+
default: "default";
|
|
102
|
+
};
|
|
103
|
+
textColor: {
|
|
104
|
+
default: "default";
|
|
105
|
+
};
|
|
106
|
+
textAlignment: {
|
|
107
|
+
default: "left";
|
|
108
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
}, any, import("@blocknote/core").InlineContentSchema, import("@blocknote/core").StyleSchema>;
|
|
112
|
+
};
|
|
80
113
|
codeBlock: {
|
|
81
114
|
config: {
|
|
82
115
|
type: "codeBlock";
|
|
@@ -84,7 +117,6 @@ export declare const odtDefaultSchemaMappings: {
|
|
|
84
117
|
propSchema: {
|
|
85
118
|
language: {
|
|
86
119
|
default: string;
|
|
87
|
-
values: string[];
|
|
88
120
|
};
|
|
89
121
|
};
|
|
90
122
|
};
|
|
@@ -94,7 +126,6 @@ export declare const odtDefaultSchemaMappings: {
|
|
|
94
126
|
propSchema: {
|
|
95
127
|
language: {
|
|
96
128
|
default: string;
|
|
97
|
-
values: string[];
|
|
98
129
|
};
|
|
99
130
|
};
|
|
100
131
|
}, any, import("@blocknote/core").InlineContentSchema, import("@blocknote/core").StyleSchema>;
|
|
@@ -474,7 +505,7 @@ export declare const odtDefaultSchemaMappings: {
|
|
|
474
505
|
config: "link";
|
|
475
506
|
implementation: any;
|
|
476
507
|
};
|
|
477
|
-
}>, any, JSX.Element, JSX.Element>;
|
|
508
|
+
}>, any, import("react").JSX.Element, import("react").JSX.Element>;
|
|
478
509
|
styleMapping: import("@blocknote/core").StyleMapping<import("@blocknote/core").StyleSchemaFromSpecs<{
|
|
479
510
|
bold: {
|
|
480
511
|
config: {
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { DefaultInlineContentSchema, InlineContentMapping } from "@blocknote/core";
|
|
3
|
-
export declare const odtInlineContentMappingForDefaultSchema: InlineContentMapping<DefaultInlineContentSchema, any, JSX.Element, JSX.Element>;
|
|
2
|
+
export declare const odtInlineContentMappingForDefaultSchema: InlineContentMapping<DefaultInlineContentSchema, any, React.JSX.Element, React.JSX.Element>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { Block, BlockNoteSchema, BlockSchema, Exporter, ExporterOptions, InlineContentSchema, StyleSchema, StyledText } from "@blocknote/core";
|
|
3
2
|
export declare class ODTExporter<B extends BlockSchema, S extends StyleSchema, I extends InlineContentSchema> extends Exporter<B, I, S, React.ReactNode, React.ReactNode, Record<string, string>, React.ReactNode> {
|
|
4
3
|
protected readonly schema: BlockNoteSchema<B, I, S>;
|