@netless/forge-slide 0.1.1-alpha.2 → 0.1.1-alpha.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/SlideApplication.d.ts +1 -0
- package/dist/SlideApplication.d.ts.map +1 -1
- package/dist/index.esm.js +10 -4
- package/dist/index.esm.js.map +2 -2
- package/dist/index.js +10 -4
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
- package/src/SlideApplication.ts +11 -4
package/package.json
CHANGED
package/src/SlideApplication.ts
CHANGED
|
@@ -156,7 +156,7 @@ export class SlideApplication extends AbstractApplication<SlideApplicationOption
|
|
|
156
156
|
});
|
|
157
157
|
Object.defineProperty(this.emitter, "pageCount", {
|
|
158
158
|
get(): any {
|
|
159
|
-
return that.
|
|
159
|
+
return that.slideCount;
|
|
160
160
|
}
|
|
161
161
|
});
|
|
162
162
|
Object.defineProperty(this.emitter, "goto", {
|
|
@@ -226,6 +226,13 @@ export class SlideApplication extends AbstractApplication<SlideApplicationOption
|
|
|
226
226
|
})
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
+
private getPreviewImageUrl (pageIndex: number) {
|
|
230
|
+
if (pageIndex < 1 || pageIndex > this.slideCount) {
|
|
231
|
+
throw new Error("pageIndex out of range");
|
|
232
|
+
}
|
|
233
|
+
return `${this.prefix}/${this.taskId}/preview/${pageIndex}.png`;
|
|
234
|
+
}
|
|
235
|
+
|
|
229
236
|
private async getPreviewImage(imageUrl: string) {
|
|
230
237
|
const image = fetch(imageUrl);
|
|
231
238
|
return await image.then(res => res.blob()).then(blob => {
|
|
@@ -250,11 +257,11 @@ export class SlideApplication extends AbstractApplication<SlideApplicationOption
|
|
|
250
257
|
}
|
|
251
258
|
|
|
252
259
|
private async getImageUrl(pageIndex: number) {
|
|
253
|
-
return
|
|
260
|
+
return this.getPreviewImageUrl(pageIndex);
|
|
254
261
|
}
|
|
255
262
|
|
|
256
263
|
private async getImageSize(pageIndex: number) {
|
|
257
|
-
const imageUrl =
|
|
264
|
+
const imageUrl = this.getPreviewImageUrl(pageIndex);
|
|
258
265
|
let preview: PreviewImage | null = null;
|
|
259
266
|
try {
|
|
260
267
|
const result = await kvStore.getItem(imageUrl);
|
|
@@ -271,7 +278,7 @@ export class SlideApplication extends AbstractApplication<SlideApplicationOption
|
|
|
271
278
|
}
|
|
272
279
|
|
|
273
280
|
private async getImageContent(pageIndex: number) {
|
|
274
|
-
const imageUrl =
|
|
281
|
+
const imageUrl = this.getPreviewImageUrl(pageIndex);
|
|
275
282
|
let preview: PreviewImage | null = null;
|
|
276
283
|
try {
|
|
277
284
|
const result = await kvStore.getItem(imageUrl);
|