@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/index.js CHANGED
@@ -67104,7 +67104,7 @@ var SlideApplication = class extends import_forge_room4.AbstractApplication {
67104
67104
  });
67105
67105
  Object.defineProperty(this.emitter, "pageCount", {
67106
67106
  get() {
67107
- return that.slide.slideCount;
67107
+ return that.slideCount;
67108
67108
  }
67109
67109
  });
67110
67110
  Object.defineProperty(this.emitter, "goto", {
@@ -67171,6 +67171,12 @@ var SlideApplication = class extends import_forge_room4.AbstractApplication {
67171
67171
  }
67172
67172
  });
67173
67173
  }
67174
+ getPreviewImageUrl(pageIndex) {
67175
+ if (pageIndex < 1 || pageIndex > this.slideCount) {
67176
+ throw new Error("pageIndex out of range");
67177
+ }
67178
+ return `${this.prefix}/${this.taskId}/preview/${pageIndex}.png`;
67179
+ }
67174
67180
  async getPreviewImage(imageUrl) {
67175
67181
  const image = fetch(imageUrl);
67176
67182
  return await image.then((res) => res.blob()).then((blob) => {
@@ -67194,10 +67200,10 @@ var SlideApplication = class extends import_forge_room4.AbstractApplication {
67194
67200
  });
67195
67201
  }
67196
67202
  async getImageUrl(pageIndex) {
67197
- return `${this.prefix}/${this.taskId}/preview/${pageIndex + 1}.png`;
67203
+ return this.getPreviewImageUrl(pageIndex);
67198
67204
  }
67199
67205
  async getImageSize(pageIndex) {
67200
- const imageUrl = `${this.prefix}/${this.taskId}/preview/${pageIndex + 1}.png`;
67206
+ const imageUrl = this.getPreviewImageUrl(pageIndex);
67201
67207
  let preview = null;
67202
67208
  try {
67203
67209
  const result = await import_forge_room5.kvStore.getItem(imageUrl);
@@ -67213,7 +67219,7 @@ var SlideApplication = class extends import_forge_room4.AbstractApplication {
67213
67219
  return { width: preview.width, height: preview.height };
67214
67220
  }
67215
67221
  async getImageContent(pageIndex) {
67216
- const imageUrl = `${this.prefix}/${this.taskId}/preview/${pageIndex + 1}.png`;
67222
+ const imageUrl = this.getPreviewImageUrl(pageIndex);
67217
67223
  let preview = null;
67218
67224
  try {
67219
67225
  const result = await import_forge_room5.kvStore.getItem(imageUrl);