@netless/window-manager 0.3.25 → 0.3.26

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/window-manager",
3
- "version": "0.3.25",
3
+ "version": "0.3.26",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",
@@ -8,6 +8,7 @@
8
8
  "scripts": {
9
9
  "prettier": "prettier --write .",
10
10
  "build": "vite build && yarn type-gen",
11
+ "build:dev": "vite build --mode development && yarn type-gen",
11
12
  "type-gen": "tsc --emitDeclarationOnly",
12
13
  "predev": "yarn type-gen",
13
14
  "build:lib:types": "tsc --emitDeclarationOnly",
package/src/AppManager.ts CHANGED
@@ -70,6 +70,11 @@ export class AppManager {
70
70
  this.onAppDelete(this.attributes.apps);
71
71
  });
72
72
  }
73
+ emitter.on("setReadonly", () => {
74
+ this.appProxies.forEach(appProxy => {
75
+ appProxy.emitAppIsWritableChange();
76
+ });
77
+ });
73
78
  }
74
79
 
75
80
  private async onCreated() {
package/src/index.ts CHANGED
@@ -141,6 +141,7 @@ export type EmitterEvent = {
141
141
  playgroundSizeChange: DOMRect;
142
142
  onReconnected: undefined;
143
143
  cursorMove: CursorMovePayload;
144
+ setReadonly: boolean;
144
145
  };
145
146
 
146
147
  export const emitter: Emittery<EmitterEvent> = new Emittery();
@@ -479,10 +480,9 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
479
480
  * 设置所有 app 的 readonly 模式
480
481
  */
481
482
  public setReadonly(readonly: boolean): void {
482
- if (this.room?.isWritable) {
483
- this.readonly = readonly;
484
- this.appManager?.boxManager.setReadonly(readonly);
485
- }
483
+ this.readonly = readonly;
484
+ this.appManager?.boxManager.setReadonly(readonly);
485
+ emitter.emit("setReadonly", readonly);
486
486
  }
487
487
 
488
488
  /**