@file-viewer/renderer-word 2.1.28 → 2.1.30
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/wordDoc.js +3 -1
- package/dist/wordDocx.js +12 -1
- package/package.json +3 -3
package/dist/wordDoc.js
CHANGED
|
@@ -159,7 +159,8 @@ function prepareMsDocCloneForExport(target) {
|
|
|
159
159
|
node.style.overflow = 'visible';
|
|
160
160
|
node.style.transform = 'none';
|
|
161
161
|
});
|
|
162
|
-
clone.querySelectorAll('.msdoc-page').forEach(page => {
|
|
162
|
+
clone.querySelectorAll('.msdoc-page').forEach((page, index) => {
|
|
163
|
+
page.dataset.viewerPrintPageIndex = String(index);
|
|
163
164
|
applyPrintPageSize(page, MSDOC_PAGE_SIZE, { heightMode: 'min' });
|
|
164
165
|
page.style.position = 'relative';
|
|
165
166
|
page.style.width = formatCssPixels(MSDOC_PAGE_SIZE.width);
|
|
@@ -353,6 +354,7 @@ export default async function render(buffer, target, context) {
|
|
|
353
354
|
const disposeResponsive = makeMsDocResponsive(target);
|
|
354
355
|
(_a = context === null || context === void 0 ? void 0 : context.registerExportAdapter) === null || _a === void 0 ? void 0 : _a.call(context, {
|
|
355
356
|
includeDocumentStyles: false,
|
|
357
|
+
getPrintMaskPages: () => Array.from(target.querySelectorAll('.msdoc-page')),
|
|
356
358
|
printStyle: buildMsDocPrintStyle,
|
|
357
359
|
toHtml: () => prepareMsDocCloneForExport(target)
|
|
358
360
|
});
|
package/dist/wordDocx.js
CHANGED
|
@@ -10,6 +10,15 @@ const DOCX_MAX_SCALE = 3;
|
|
|
10
10
|
const DOCX_ZOOM_STEP = 0.15;
|
|
11
11
|
const DOCX_VENDOR_ASSET_VERSION = '0.3.20';
|
|
12
12
|
const ZIP_SIGNATURE_PK = 0x504b;
|
|
13
|
+
// Modern bundlers expose the ESM named exports, while some legacy webpack
|
|
14
|
+
// configurations wrap the CommonJS browser API in `default`.
|
|
15
|
+
const resolveDocxLibrary = (module) => {
|
|
16
|
+
const library = typeof module.renderAsync === 'function' ? module : module.default;
|
|
17
|
+
if (!library || typeof library.renderAsync !== 'function') {
|
|
18
|
+
throw new TypeError('@file-viewer/docx did not expose a compatible renderAsync function.');
|
|
19
|
+
}
|
|
20
|
+
return library;
|
|
21
|
+
};
|
|
13
22
|
const loadLibrary = (() => {
|
|
14
23
|
const loader = {
|
|
15
24
|
module: null,
|
|
@@ -21,7 +30,7 @@ const loadLibrary = (() => {
|
|
|
21
30
|
}
|
|
22
31
|
};
|
|
23
32
|
return async () => {
|
|
24
|
-
return await loader.load();
|
|
33
|
+
return resolveDocxLibrary(await loader.load());
|
|
25
34
|
};
|
|
26
35
|
})();
|
|
27
36
|
/**
|
|
@@ -486,6 +495,7 @@ function prepareDocxCloneForExport(target) {
|
|
|
486
495
|
.map(style => style.outerHTML)
|
|
487
496
|
.join('');
|
|
488
497
|
clone.querySelectorAll('.docx-page-frame, .docx-flow-frame').forEach((frame, index) => {
|
|
498
|
+
frame.dataset.viewerPrintPageIndex = String(index);
|
|
489
499
|
normalizeDocxPageForPrint(frame, getDocxFramePrintSize(liveFrames[index]));
|
|
490
500
|
printDocument.appendChild(frame.cloneNode(true));
|
|
491
501
|
});
|
|
@@ -519,6 +529,7 @@ export default async function (buffer, target, context) {
|
|
|
519
529
|
const disposeResponsive = makeDocxResponsive(target, context);
|
|
520
530
|
(_a = context === null || context === void 0 ? void 0 : context.registerExportAdapter) === null || _a === void 0 ? void 0 : _a.call(context, {
|
|
521
531
|
includeDocumentStyles: false,
|
|
532
|
+
getPrintMaskPages: () => Array.from(target.querySelectorAll('.docx-page-frame, .docx-flow-frame')),
|
|
522
533
|
beforeSnapshot: () => {
|
|
523
534
|
const view = getTargetWindow(target);
|
|
524
535
|
if (view) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@file-viewer/renderer-word",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.30",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Standalone Word and compatible document renderer plugin for Flyfish File Viewer powered by @file-viewer/docx, @file-viewer/doc, and RTF/ODF parsing.",
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"LICENSE"
|
|
58
58
|
],
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@file-viewer/core": "2.1.
|
|
61
|
-
"@file-viewer/doc": "2.1.
|
|
60
|
+
"@file-viewer/core": "2.1.30",
|
|
61
|
+
"@file-viewer/doc": "2.1.30",
|
|
62
62
|
"@file-viewer/docx": "^0.3.20",
|
|
63
63
|
"jszip": "^3.10.1",
|
|
64
64
|
"rtf.js": "^3.0.9"
|