@netless/window-manager 0.4.6 → 0.4.7
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/CHANGELOG.md +4 -0
- package/dist/AppManager.d.ts +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +2 -2
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/docs/api.md +2 -2
- package/docs/migrate.md +6 -3
- package/package.json +1 -1
- package/src/AppManager.ts +14 -1
- package/src/index.ts +7 -5
package/docs/api.md
CHANGED
@@ -195,8 +195,8 @@ if (!success) {
|
|
195
195
|
|
196
196
|
```ts
|
197
197
|
manager.addPage() // 默认在最后添加一页
|
198
|
-
manager.addPage({
|
199
|
-
manager.addPage({
|
198
|
+
manager.addPage({ after: true }) // 在当前页后添加一页
|
199
|
+
manager.addPage({ scene: { name: "page2" } }) // 传入 page 信息
|
200
200
|
```
|
201
201
|
|
202
202
|
|
package/docs/migrate.md
CHANGED
@@ -40,6 +40,8 @@ manager.mainView.callbacks.on("onSizeUpdated", size => {
|
|
40
40
|
});
|
41
41
|
```
|
42
42
|
|
43
|
+
<br>
|
44
|
+
|
43
45
|
## `white-web-sdk` 从 `2.15.x` 迁移至 `2.16.x`
|
44
46
|
|
45
47
|
### `room.setMemberState`
|
@@ -48,10 +50,11 @@ manager.mainView.callbacks.on("onSizeUpdated", size => {
|
|
48
50
|
|
49
51
|
或者使用 `manager.mainView.setMemberState` 代替
|
50
52
|
|
53
|
+
<br>
|
51
54
|
|
52
|
-
### `room.pptPreviousStep` `room.pptNextStep`
|
55
|
+
### `room.pptPreviousStep` `room.pptNextStep` 切换上下页
|
53
56
|
|
54
|
-
|
57
|
+
因为窗口实现机制的改变, `pptPreviousStep` 和 `pptNextStep` 不再生效
|
55
58
|
|
56
|
-
请使用 `manager.nextPage` 和 `manager.prevPage`
|
59
|
+
如果需要切换主白板的上下页, 请使用 `manager.nextPage` 和 `manager.prevPage`
|
57
60
|
|
package/package.json
CHANGED
package/src/AppManager.ts
CHANGED
@@ -40,7 +40,7 @@ export class AppManager {
|
|
40
40
|
|
41
41
|
private _prevSceneIndex: number | undefined;
|
42
42
|
private _prevFocused: string | undefined;
|
43
|
-
private callbacksNode: ScenesCallbacksNode | null;
|
43
|
+
private callbacksNode: ScenesCallbacksNode | null = null;
|
44
44
|
private appCreateQueue = new AppCreateQueue();
|
45
45
|
|
46
46
|
constructor(public windowManger: WindowManager) {
|
@@ -74,6 +74,7 @@ export class AppManager {
|
|
74
74
|
emitter.on("removeScenes", scenePath => {
|
75
75
|
if (scenePath === ROOT_DIR) {
|
76
76
|
this.setMainViewScenePath(ROOT_DIR);
|
77
|
+
this.createRootDirScenesCallback();
|
77
78
|
return;
|
78
79
|
}
|
79
80
|
const mainViewScenePath = this.store.getMainViewScenePath();
|
@@ -83,6 +84,15 @@ export class AppManager {
|
|
83
84
|
}
|
84
85
|
}
|
85
86
|
});
|
87
|
+
this.createRootDirScenesCallback();
|
88
|
+
}
|
89
|
+
|
90
|
+
private createRootDirScenesCallback = () => {
|
91
|
+
let isRecreate = false;
|
92
|
+
if (this.callbacksNode) {
|
93
|
+
this.callbacksNode.dispose();
|
94
|
+
isRecreate = true;
|
95
|
+
}
|
86
96
|
this.callbacksNode = this.displayer.createScenesCallback(ROOT_DIR, {
|
87
97
|
onAddScene: scenesCallback => {
|
88
98
|
this.mainViewScenesLength = scenesCallback.scenes.length;
|
@@ -95,6 +105,9 @@ export class AppManager {
|
|
95
105
|
});
|
96
106
|
if (this.callbacksNode) {
|
97
107
|
this.mainViewScenesLength = this.callbacksNode.scenes.length;
|
108
|
+
if (isRecreate) {
|
109
|
+
callbacks.emit("mainViewScenesLengthChange", this.callbacksNode.scenes.length);
|
110
|
+
}
|
98
111
|
}
|
99
112
|
}
|
100
113
|
|
package/src/index.ts
CHANGED
@@ -180,7 +180,7 @@ export const callbacks: CallbacksType = new Emittery();
|
|
180
180
|
export const reconnectRefresher = new ReconnectRefresher({ emitter });
|
181
181
|
|
182
182
|
export type AddPageParams = {
|
183
|
-
|
183
|
+
after?: boolean;
|
184
184
|
scene?: SceneDefinition;
|
185
185
|
}
|
186
186
|
|
@@ -519,11 +519,13 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
|
|
519
519
|
|
520
520
|
public async addPage(params?: AddPageParams): Promise<void> {
|
521
521
|
if (this.appManager) {
|
522
|
-
const
|
523
|
-
|
524
|
-
|
522
|
+
const after = params?.after;
|
523
|
+
const scene = params?.scene;
|
524
|
+
if (after) {
|
525
|
+
const nextIndex = this.mainViewSceneIndex + 1;
|
526
|
+
this.room.putScenes(ROOT_DIR, [scene || {}], nextIndex);
|
525
527
|
} else {
|
526
|
-
this.room.putScenes(ROOT_DIR, [
|
528
|
+
this.room.putScenes(ROOT_DIR, [scene || {}]);
|
527
529
|
}
|
528
530
|
}
|
529
531
|
}
|