@netless/app-slide 0.2.72 → 0.2.73

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/app-slide",
3
- "version": "0.2.72",
3
+ "version": "0.2.73",
4
4
  "main": "dist/main.cjs.js",
5
5
  "module": "dist/main.es.js",
6
6
  "types": "dist/index.d.ts",
@@ -10,7 +10,7 @@
10
10
  "README-zh.md"
11
11
  ],
12
12
  "devDependencies": {
13
- "@netless/slide": "1.4.32",
13
+ "@netless/slide": "1.4.34",
14
14
  "@types/color-string": "^1.5.2",
15
15
  "color-string": "^1.9.1",
16
16
  "jspdf": "2.5.1",
@@ -122,7 +122,7 @@ export class SlideController {
122
122
  public ready = false;
123
123
  private resolveReady!: (index: number) => void;
124
124
  public readonly readyPromise = new Promise<void>(resolve => {
125
- this.resolveReady = (slideIndex) => {
125
+ this.resolveReady = slideIndex => {
126
126
  if (this.ready) {
127
127
  log("[Slide] render end", slideIndex);
128
128
  } else {
@@ -321,6 +321,7 @@ export class SlideController {
321
321
  whiteTracker: defaults.whiteTracker,
322
322
  timestamp: this.timestamp,
323
323
  skipActionWhenFrozen: true,
324
+ customLinks: options.customLinks,
324
325
  });
325
326
  if (import.meta.env.DEV) {
326
327
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -51,6 +51,7 @@ export class SlideDocsViewer {
51
51
  private readonly baseScenePath: string;
52
52
  private readonly appId: string;
53
53
  private isViewMounted = false;
54
+ private justSildeReadonly = false;
54
55
 
55
56
  public constructor({
56
57
  context,
@@ -106,11 +107,19 @@ export class SlideDocsViewer {
106
107
  public $whiteboardView!: HTMLDivElement;
107
108
  public $overlay!: HTMLDivElement;
108
109
 
110
+ public setJustSildeReadonly(justSildeReadonly: boolean) {
111
+ this.justSildeReadonly = justSildeReadonly;
112
+ this.slideController?.slide.setInteractive(!this.justSildeReadonly);
113
+ }
114
+
109
115
  public render() {
110
116
  this.viewer.$content.appendChild(this.renderSlideContainer());
111
117
  this.viewer.$content.appendChild(this.renderWhiteboardView());
112
118
  this.viewer.$content.appendChild(this.renderOverlay());
113
119
  this.sideEffect.addEventListener(window, "keydown", ev => {
120
+ if (this.justSildeReadonly) {
121
+ return;
122
+ }
114
123
  if (this.box.focus && this.slideController && !isEditable(ev.target)) {
115
124
  switch (ev.key) {
116
125
  case "ArrowUp":
package/src/index.ts CHANGED
@@ -44,6 +44,7 @@ export interface AppOptions
44
44
  | "fixedFrameSize"
45
45
  | "logger"
46
46
  | "enableGlobalClick"
47
+ | "customLinks"
47
48
  > {
48
49
  /** show debug controller */
49
50
  debug?: boolean;
@@ -71,6 +72,8 @@ export interface AppOptions
71
72
  showRenderError?: boolean;
72
73
  /** Specify the behavior after hiding the slide; Freeze will destroy the slide and replace it with a snapshot, while Pause simply pauses the slide @default: 'frozen' */
73
74
  invisibleBehavior?: "frozen" | "pause";
75
+ /** just readonly, no operate silder */
76
+ justSildeReadonly?: true;
74
77
  }
75
78
 
76
79
  export interface ILogger {
@@ -89,6 +92,7 @@ export interface AppResult {
89
92
  nextPage: () => boolean;
90
93
  prevPage: () => boolean;
91
94
  jumpToPage: (page: number) => boolean;
95
+ setSildeReadonly: (bol: boolean) => void;
92
96
  }
93
97
 
94
98
  const SlideApp: NetlessApp<Attributes, MagixEvents, AppOptions, AppResult> = {
@@ -192,6 +196,10 @@ const SlideApp: NetlessApp<Attributes, MagixEvents, AppOptions, AppResult> = {
192
196
  },
193
197
  });
194
198
 
199
+ if (context.getAppOptions()?.justSildeReadonly) {
200
+ docsViewer?.setJustSildeReadonly(true);
201
+ }
202
+
195
203
  if (import.meta.env.DEV) {
196
204
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
197
205
  (window as any).slideDoc = docsViewer;
@@ -233,6 +241,9 @@ const SlideApp: NetlessApp<Attributes, MagixEvents, AppOptions, AppResult> = {
233
241
  docsViewer.mount();
234
242
 
235
243
  return {
244
+ setSildeReadonly: (bol: boolean) => {
245
+ docsViewer?.setJustSildeReadonly(bol);
246
+ },
236
247
  viewer: () => {
237
248
  return docsViewer;
238
249
  },