@file-viewer/pptx 2.1.26 → 2.1.27
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/viewer.d.ts +2 -0
- package/dist/viewer.js +12 -2
- package/package.json +1 -1
package/dist/viewer.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare class PptxViewer {
|
|
|
13
13
|
private userZoomPercent;
|
|
14
14
|
private currentZoomPercent;
|
|
15
15
|
private thumbnailElement;
|
|
16
|
+
private previewThumbnailDataUrl;
|
|
16
17
|
private slideSize;
|
|
17
18
|
private slideRecords;
|
|
18
19
|
private slideWindowTarget;
|
|
@@ -24,6 +25,7 @@ export declare class PptxViewer {
|
|
|
24
25
|
private readonly handleSlideWindowChange;
|
|
25
26
|
private constructor();
|
|
26
27
|
get zoomPercent(): number;
|
|
28
|
+
get thumbnailDataUrl(): string | null;
|
|
27
29
|
open(): Promise<void>;
|
|
28
30
|
setZoom(percent: number): Promise<void>;
|
|
29
31
|
destroy(): void;
|
package/dist/viewer.js
CHANGED
|
@@ -80,6 +80,7 @@ export class PptxViewer {
|
|
|
80
80
|
this.userZoomPercent = 100;
|
|
81
81
|
this.currentZoomPercent = 100;
|
|
82
82
|
this.thumbnailElement = null;
|
|
83
|
+
this.previewThumbnailDataUrl = null;
|
|
83
84
|
this.slideSize = null;
|
|
84
85
|
this.slideRecords = [];
|
|
85
86
|
this.slideWindowTarget = null;
|
|
@@ -105,6 +106,9 @@ export class PptxViewer {
|
|
|
105
106
|
get zoomPercent() {
|
|
106
107
|
return Math.round(this.currentZoomPercent);
|
|
107
108
|
}
|
|
109
|
+
get thumbnailDataUrl() {
|
|
110
|
+
return this.previewThumbnailDataUrl;
|
|
111
|
+
}
|
|
108
112
|
async open() {
|
|
109
113
|
ensureZipWithinLimits(this.buffer, this.options);
|
|
110
114
|
ensurePptxViewerStyles(this.target.ownerDocument || document, this.options.styleRoot);
|
|
@@ -121,6 +125,7 @@ export class PptxViewer {
|
|
|
121
125
|
destroy() {
|
|
122
126
|
var _a, _b, _c, _d;
|
|
123
127
|
this.disposed = true;
|
|
128
|
+
this.previewThumbnailDataUrl = null;
|
|
124
129
|
(_a = this.worker) === null || _a === void 0 ? void 0 : _a.terminate();
|
|
125
130
|
this.worker = null;
|
|
126
131
|
(_b = this.resizeObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
@@ -139,6 +144,7 @@ export class PptxViewer {
|
|
|
139
144
|
(_a = this.worker) === null || _a === void 0 ? void 0 : _a.terminate();
|
|
140
145
|
this.completed = false;
|
|
141
146
|
this.charts = null;
|
|
147
|
+
this.previewThumbnailDataUrl = null;
|
|
142
148
|
this.slideSize = null;
|
|
143
149
|
this.slideRecords = [];
|
|
144
150
|
this.content.replaceChildren();
|
|
@@ -219,13 +225,17 @@ export class PptxViewer {
|
|
|
219
225
|
this.content.append(style);
|
|
220
226
|
}
|
|
221
227
|
showThumbnail(base64Jpeg) {
|
|
222
|
-
if (!base64Jpeg
|
|
228
|
+
if (!base64Jpeg) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
this.previewThumbnailDataUrl = `data:image/jpeg;base64,${base64Jpeg}`;
|
|
232
|
+
if (this.content.children.length > 0) {
|
|
223
233
|
return;
|
|
224
234
|
}
|
|
225
235
|
const image = this.target.ownerDocument.createElement('img');
|
|
226
236
|
image.className = 'flyfish-pptx-thumbnail';
|
|
227
237
|
image.alt = 'PPTX preview thumbnail';
|
|
228
|
-
image.src =
|
|
238
|
+
image.src = this.previewThumbnailDataUrl;
|
|
229
239
|
this.thumbnailElement = image;
|
|
230
240
|
this.scaleBox.insertBefore(image, this.content);
|
|
231
241
|
}
|