@netless/forge-slide 0.1.1-alpha.3 → 0.1.1-alpha.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netless/forge-slide",
3
- "version": "0.1.1-alpha.3",
3
+ "version": "0.1.1-alpha.5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -64,7 +64,6 @@ export class SlideApplication extends AbstractApplication<SlideApplicationOption
64
64
 
65
65
  this.slideContainer.style.width = "100%";
66
66
  this.slideContainer.style.height = "100%";
67
- // this.slideContainer.style.height = "calc(100% - 24px)";
68
67
 
69
68
  this.footer = new FooterView();
70
69
  this.sideBar = new SideBarView();
@@ -226,6 +225,13 @@ export class SlideApplication extends AbstractApplication<SlideApplicationOption
226
225
  })
227
226
  }
228
227
 
228
+ private getPreviewImageUrl (pageIndex: number) {
229
+ if (pageIndex < 1 || pageIndex > this.slideCount) {
230
+ throw new Error("pageIndex out of range");
231
+ }
232
+ return `${this.prefix}/${this.taskId}/preview/${pageIndex}.png`;
233
+ }
234
+
229
235
  private async getPreviewImage(imageUrl: string) {
230
236
  const image = fetch(imageUrl);
231
237
  return await image.then(res => res.blob()).then(blob => {
@@ -250,11 +256,11 @@ export class SlideApplication extends AbstractApplication<SlideApplicationOption
250
256
  }
251
257
 
252
258
  private async getImageUrl(pageIndex: number) {
253
- return `${this.prefix}/${this.taskId}/preview/${pageIndex + 1}.png`;
259
+ return this.getPreviewImageUrl(pageIndex);
254
260
  }
255
261
 
256
262
  private async getImageSize(pageIndex: number) {
257
- const imageUrl = `${this.prefix}/${this.taskId}/preview/${pageIndex + 1}.png`;
263
+ const imageUrl = this.getPreviewImageUrl(pageIndex);
258
264
  let preview: PreviewImage | null = null;
259
265
  try {
260
266
  const result = await kvStore.getItem(imageUrl);
@@ -271,7 +277,7 @@ export class SlideApplication extends AbstractApplication<SlideApplicationOption
271
277
  }
272
278
 
273
279
  private async getImageContent(pageIndex: number) {
274
- const imageUrl = `${this.prefix}/${this.taskId}/preview/${pageIndex + 1}.png`;
280
+ const imageUrl = this.getPreviewImageUrl(pageIndex);
275
281
  let preview: PreviewImage | null = null;
276
282
  try {
277
283
  const result = await kvStore.getItem(imageUrl);
@@ -343,11 +349,13 @@ export class SlideApplication extends AbstractApplication<SlideApplicationOption
343
349
  this.whiteboard.view.style.top = "0";
344
350
  this.whiteboard.view.style.left = "0";
345
351
  this.whiteboard.view.style.zIndex = "4";
352
+ this.whiteboard.view.classList.add("slide-whiteboard");
346
353
  this.whiteboard.permissions.addPermission(WhiteboardPermissionFlag.all);
347
354
  this.whiteboard.setCanvasBackgroundColor("#f0f0f000");
348
355
  this.whiteboardContainer.style.position = "relative";
349
356
  this.whiteboardContainer.style.flex = "0 0 auto";
350
357
  this.whiteboardContainer.style.height = "calc(100% - 24px)";
358
+ this.whiteboardContainer.classList.add("forge-slide-whiteboard-container");
351
359
  this.whiteboardContainer.appendChild(this.whiteboard.view);
352
360
  this.whiteboardContainer.appendChild(this.slideContainer);
353
361