@file-viewer/renderer-word 3.3.1 → 3.3.4
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/openDocument.js +3 -3
- package/dist/wordDocx.js +1 -1
- package/package.json +3 -3
package/dist/openDocument.js
CHANGED
|
@@ -36,12 +36,12 @@ const parseOdf = async (buffer, type, t) => {
|
|
|
36
36
|
const zip = await JSZip.loadAsync(buffer);
|
|
37
37
|
const content = await ((_a = zip.file('content.xml')) === null || _a === void 0 ? void 0 : _a.async('text'));
|
|
38
38
|
if (!content) {
|
|
39
|
-
throw
|
|
39
|
+
throw t.error('word.error.missingOdfContent');
|
|
40
40
|
}
|
|
41
41
|
const doc = new DOMParser().parseFromString(content, 'application/xml');
|
|
42
42
|
const parseError = doc.querySelector('parsererror');
|
|
43
43
|
if (parseError) {
|
|
44
|
-
throw
|
|
44
|
+
throw t.error('word.error.odfXmlParseFailed');
|
|
45
45
|
}
|
|
46
46
|
if (type === 'odp') {
|
|
47
47
|
const slides = Array.from(doc.getElementsByTagName('draw:page'));
|
|
@@ -115,7 +115,7 @@ const renderRtf = async (buffer, target, context) => {
|
|
|
115
115
|
};
|
|
116
116
|
export default async function renderOpenDocument(buffer, target, type, context) {
|
|
117
117
|
var _a;
|
|
118
|
-
const t = createFileViewerTranslator(context === null || context === void 0 ? void 0 : context.options);
|
|
118
|
+
const t = createFileViewerTranslator((context === null || context === void 0 ? void 0 : context.i18n) || (context === null || context === void 0 ? void 0 : context.options));
|
|
119
119
|
const normalizedType = (type || 'odt').toLowerCase();
|
|
120
120
|
if (normalizedType === 'rtf') {
|
|
121
121
|
return renderRtf(buffer, target, context);
|
package/dist/wordDocx.js
CHANGED
|
@@ -38,7 +38,7 @@ const assertValidDocxPackage = (buffer, context) => {
|
|
|
38
38
|
if (signature === ZIP_SIGNATURE_PK) {
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
|
-
throw new Error(createFileViewerTranslator(context === null || context === void 0 ? void 0 : context.options)('word.error.invalidDocx'));
|
|
41
|
+
throw new Error(createFileViewerTranslator((context === null || context === void 0 ? void 0 : context.i18n) || (context === null || context === void 0 ? void 0 : context.options))('word.error.invalidDocx'));
|
|
42
42
|
};
|
|
43
43
|
const getTargetWindow = (target) => {
|
|
44
44
|
return target.ownerDocument.defaultView;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@file-viewer/renderer-word",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Standalone DOCX, DOC, and OpenDocument renderer for File Viewer; RTF parsing is an explicit opt-in capability.",
|
|
@@ -81,8 +81,8 @@
|
|
|
81
81
|
"README.zh-CN.md"
|
|
82
82
|
],
|
|
83
83
|
"dependencies": {
|
|
84
|
-
"@file-viewer/core": "3.3.
|
|
85
|
-
"@file-viewer/doc": "3.3.
|
|
84
|
+
"@file-viewer/core": "3.3.4",
|
|
85
|
+
"@file-viewer/doc": "3.3.4",
|
|
86
86
|
"@file-viewer/docx": "0.3.39",
|
|
87
87
|
"jszip": "3.10.2"
|
|
88
88
|
},
|