@netless/window-manager 1.0.0-canary.9 → 1.0.1
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/LICENSE.txt +21 -0
- package/README.md +90 -64
- package/README.zh-cn.md +224 -0
- package/dist/index.d.ts +1133 -40
- package/dist/index.js +62 -0
- package/dist/index.js.map +1 -0
- package/dist/{index.es.js → index.mjs} +7954 -5445
- package/dist/index.mjs.map +1 -0
- package/dist/style.css +1 -1
- package/docs/advanced.md +55 -55
- package/docs/api.md +126 -113
- package/docs/app-context.md +248 -209
- package/docs/basic.md +25 -26
- package/docs/camera.md +21 -21
- package/docs/cn/advanced.md +137 -0
- package/docs/cn/api.md +311 -0
- package/docs/cn/app-context.md +369 -0
- package/docs/cn/basic.md +64 -0
- package/docs/cn/camera.md +53 -0
- package/docs/cn/concept.md +9 -0
- package/docs/cn/custom-max-bar.md +31 -0
- package/docs/cn/develop-app.md +94 -0
- package/docs/cn/export-pdf.md +48 -0
- package/docs/cn/migrate.md +60 -0
- package/docs/cn/replay.md +40 -0
- package/docs/concept.md +6 -5
- package/docs/custom-max-bar.md +31 -0
- package/docs/develop-app.md +22 -19
- package/docs/export-pdf.md +48 -0
- package/docs/migrate.md +25 -27
- package/docs/quickstart.md +50 -0
- package/docs/replay.md +20 -20
- package/package.json +32 -22
- package/src/App/AppContext.ts +105 -73
- package/src/App/AppPageStateImpl.ts +6 -25
- package/src/App/AppProxy.ts +41 -166
- package/src/App/MagixEvent/index.ts +38 -38
- package/src/App/Storage/StorageEvent.ts +13 -13
- package/src/App/Storage/index.ts +269 -245
- package/src/App/Storage/typings.ts +4 -2
- package/src/App/Storage/utils.ts +3 -3
- package/src/App/index.ts +0 -1
- package/src/AppListener.ts +8 -8
- package/src/AppManager.ts +88 -77
- package/src/AttributesDelegate.ts +42 -22
- package/src/BoxEmitter.ts +12 -6
- package/src/BoxManager.ts +128 -108
- package/src/ContainerResizeObserver.ts +75 -0
- package/src/Cursor/Cursor.svelte +16 -5
- package/src/Cursor/Cursor.svelte.d.ts +21 -0
- package/src/Cursor/Cursor.ts +77 -13
- package/src/Cursor/icons.ts +6 -0
- package/src/Cursor/icons2.ts +66 -0
- package/src/Cursor/index.ts +127 -26
- package/src/Helper.ts +94 -14
- package/src/InternalEmitter.ts +2 -7
- package/src/Page/index.ts +1 -1
- package/src/PageState.ts +6 -5
- package/src/ReconnectRefresher.ts +9 -4
- package/src/RedoUndo.ts +3 -3
- package/src/Register/index.ts +22 -17
- package/src/Register/loader.ts +26 -22
- package/src/Register/storage.ts +13 -13
- package/src/Utils/Common.ts +18 -14
- package/src/Utils/Reactive.ts +26 -25
- package/src/Utils/RoomHacker.ts +4 -4
- package/src/Utils/error.ts +0 -1
- package/src/View/IframeBridge.ts +680 -0
- package/src/View/MainView.ts +127 -53
- package/src/callback.ts +21 -1
- package/src/constants.ts +0 -2
- package/src/image/pencil-eraser-1.svg +3 -0
- package/src/image/pencil-eraser-2.svg +3 -0
- package/src/image/pencil-eraser-3.svg +3 -0
- package/src/index.ts +220 -83
- package/src/style.css +27 -10
- package/src/typings.ts +20 -10
- package/.prettierignore +0 -7
- package/.prettierrc.json +0 -9
- package/CHANGELOG.md +0 -196
- package/__mocks__/white-web-sdk.ts +0 -50
- package/dist/App/AppContext.d.ts +0 -76
- package/dist/App/AppPageStateImpl.d.ts +0 -21
- package/dist/App/AppProxy.d.ts +0 -86
- package/dist/App/AppViewSync.d.ts +0 -11
- package/dist/App/MagixEvent/index.d.ts +0 -29
- package/dist/App/Storage/StorageEvent.d.ts +0 -8
- package/dist/App/Storage/index.d.ts +0 -39
- package/dist/App/Storage/typings.d.ts +0 -22
- package/dist/App/Storage/utils.d.ts +0 -5
- package/dist/App/WhiteboardView.d.ts +0 -22
- package/dist/App/index.d.ts +0 -3
- package/dist/AppListener.d.ts +0 -21
- package/dist/AppManager.d.ts +0 -107
- package/dist/AttributesDelegate.d.ts +0 -80
- package/dist/BoxEmitter.d.ts +0 -34
- package/dist/BoxManager.d.ts +0 -99
- package/dist/BuiltinApps.d.ts +0 -5
- package/dist/Cursor/Cursor.d.ts +0 -39
- package/dist/Cursor/icons.d.ts +0 -3
- package/dist/Cursor/index.d.ts +0 -46
- package/dist/Helper.d.ts +0 -17
- package/dist/InternalEmitter.d.ts +0 -39
- package/dist/Page/PageController.d.ts +0 -21
- package/dist/Page/index.d.ts +0 -3
- package/dist/PageState.d.ts +0 -9
- package/dist/ReconnectRefresher.d.ts +0 -24
- package/dist/RedoUndo.d.ts +0 -18
- package/dist/Register/index.d.ts +0 -28
- package/dist/Register/loader.d.ts +0 -4
- package/dist/Register/storage.d.ts +0 -8
- package/dist/Utils/AppCreateQueue.d.ts +0 -15
- package/dist/Utils/Common.d.ts +0 -23
- package/dist/Utils/Reactive.d.ts +0 -6
- package/dist/Utils/RoomHacker.d.ts +0 -3
- package/dist/Utils/error.d.ts +0 -27
- package/dist/Utils/log.d.ts +0 -1
- package/dist/View/CameraSynchronizer.d.ts +0 -16
- package/dist/View/MainView.d.ts +0 -47
- package/dist/View/ViewManager.d.ts +0 -13
- package/dist/callback.d.ts +0 -24
- package/dist/constants.d.ts +0 -49
- package/dist/index.cjs.js +0 -46
- package/dist/index.umd.js +0 -46
- package/dist/typings.d.ts +0 -82
- package/jest.config.js +0 -27
- package/pnpm-lock.yaml +0 -6302
- package/src/App/AppViewSync.ts +0 -68
- package/src/App/WhiteboardView.ts +0 -83
- package/src/View/CameraSynchronizer.ts +0 -56
- package/vite.config.js +0 -51
- /package/docs/{qickstart.md → cn/quickstart.md} +0 -0
@@ -0,0 +1,60 @@
|
|
1
|
+
|
2
|
+
### 注意事项
|
3
|
+
|
4
|
+
多窗口模式必须开启白板的 `useMultiViews` 和 `useMobXState` 选项
|
5
|
+
|
6
|
+
会造成原本以下 `room` 上的一些方法和 `state` 失效
|
7
|
+
|
8
|
+
`方法`
|
9
|
+
|
10
|
+
- `room.bindHtmlElement()` 用 `WindowManager.mount()` 代替
|
11
|
+
- `room.scalePptToFit()` 暂无代替,不再推荐调用 `scalePptToFit`
|
12
|
+
- `room.setScenePath()` 用 `manager.setMainViewScenePath()` 代替
|
13
|
+
- `room.setSceneIndex()` 用 `manager.setMainViewSceneIndex()` 代替
|
14
|
+
|
15
|
+
> 为了方便使用 `manager` 替换了 `room` 上的一些方法可以直接对 `mainView` 生效
|
16
|
+
|
17
|
+
- `room.disableCameraTransform`
|
18
|
+
- `room.moveCamera`
|
19
|
+
- `room.moveCameraToContain`
|
20
|
+
- `room.convertToPointInWorld`
|
21
|
+
- `room.setCameraBound`
|
22
|
+
|
23
|
+
`camera`
|
24
|
+
|
25
|
+
- `room.state.cameraState` 用 `manager.mainView.camera` 和 `manager.mainView.size` 代替
|
26
|
+
|
27
|
+
想要监听主白板 `camera` 的变化, 请使用如下方式代替
|
28
|
+
|
29
|
+
```javascript
|
30
|
+
manager.mainView.callbacks.on("onCameraUpdated", camera => {
|
31
|
+
console.log(camera);
|
32
|
+
});
|
33
|
+
```
|
34
|
+
|
35
|
+
监听主白板 `size` 变化
|
36
|
+
|
37
|
+
```javascript
|
38
|
+
manager.mainView.callbacks.on("onSizeUpdated", size => {
|
39
|
+
console.log(size);
|
40
|
+
});
|
41
|
+
```
|
42
|
+
|
43
|
+
<br>
|
44
|
+
|
45
|
+
## `white-web-sdk` 从 `2.15.x` 迁移至 `2.16.x`
|
46
|
+
|
47
|
+
### `room.setMemberState`
|
48
|
+
|
49
|
+
此方法在开启多窗口时要等待 `WindowManager` 挂载完成后才可以直接调用。
|
50
|
+
|
51
|
+
或者使用 `manager.mainView.setMemberState` 代替
|
52
|
+
|
53
|
+
<br>
|
54
|
+
|
55
|
+
### `room.pptPreviousStep` `room.pptNextStep` 切换上下页
|
56
|
+
|
57
|
+
因为窗口实现机制的改变, `pptPreviousStep` 和 `pptNextStep` 不再生效
|
58
|
+
|
59
|
+
如果需要切换主白板的上下页, 请使用 `manager.nextPage` 和 `manager.prevPage`
|
60
|
+
|
@@ -0,0 +1,40 @@
|
|
1
|
+
## 回放
|
2
|
+
|
3
|
+
> 注意: 多窗口的回放只支持从创建房间开始就是多窗口的房间
|
4
|
+
|
5
|
+
> 如果是一开始作为单窗口模式使用,又转变成多窗口模式使用, 则会造成回放渲染空白
|
6
|
+
|
7
|
+
<br>
|
8
|
+
|
9
|
+
|
10
|
+
```typescript
|
11
|
+
import { WhiteWebSdk } from "white-web-sdk";
|
12
|
+
import { WindowManager, BuiltinApps } from "@netless/window-manager";
|
13
|
+
import "@netless/window-manager/dist/style.css";
|
14
|
+
|
15
|
+
const sdk = new WhiteWebSdk({
|
16
|
+
appIdentifier: "appIdentifier",
|
17
|
+
useMobXState: true // 请确保打开这个选项
|
18
|
+
});
|
19
|
+
|
20
|
+
let manager: WindowManager;
|
21
|
+
|
22
|
+
sdk.replayRoom({
|
23
|
+
uuid: "room uuid",
|
24
|
+
roomToken: "room token",
|
25
|
+
invisiblePlugins: [WindowManager],
|
26
|
+
useMultiViews: true, // 多窗口必须用开启 useMultiViews
|
27
|
+
}).then(player => {
|
28
|
+
player.callbacks.on("onPhaseChanged", async (phase) => {
|
29
|
+
if (phase === PlayerPhase.Playing) {
|
30
|
+
if (manager) return;
|
31
|
+
manager = await WindowManager.mount({
|
32
|
+
room: player,
|
33
|
+
container: document.getElementById("container")
|
34
|
+
});
|
35
|
+
}
|
36
|
+
})
|
37
|
+
});
|
38
|
+
|
39
|
+
player.play(); // WindowManager 只有在播放之后才能挂载
|
40
|
+
```
|
package/docs/concept.md
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
#
|
1
|
+
# Concept
|
2
2
|
|
3
|
-
##
|
3
|
+
## Sync Zone
|
4
4
|
|
5
|
-
|
5
|
+
On devices with different resolutions, if we want to see the same area and window, we need to maintain the same ratio on all devices.
|
6
6
|
|
7
|
-
|
7
|
+
So `WindowManager` has a `containerSizeRatio` option to configure the aspect ratio of the whiteboard, the default is `9 / 16`
|
8
|
+
|
9
|
+
If the width and height given to WindowManager by the outer layer do not perfectly fit this aspect ratio, WindowManger will automatically calculate a maximum width and height that fits this ratio internally, and then fill it in. At this time, there will be some internal areas that cannot be operated
|
8
10
|
|
9
|
-
如果外层给到 `WindowManager` 宽高并不是完美适配这个宽高比的话, `WindowManger` 会自动在内部算出一个适配这个比例的最大宽高,然后填充上去,这时在内部就会有一些区域不能操作
|
@@ -0,0 +1,31 @@
|
|
1
|
+
## How to customize maximized `titleBar`
|
2
|
+
|
3
|
+
Get and subscribe to all `box`
|
4
|
+
|
5
|
+
```js
|
6
|
+
manager.boxManager.teleboxManager.boxes$.subscribe(boxes => {
|
7
|
+
// boxes are all windows, trigger when windows are added and deleted
|
8
|
+
})
|
9
|
+
```
|
10
|
+
|
11
|
+
Toggle `focus` of `box`
|
12
|
+
```js
|
13
|
+
manager.boxManager.teleBoxManager.focusBox(box)
|
14
|
+
```
|
15
|
+
|
16
|
+
close a `box`
|
17
|
+
```js
|
18
|
+
manager.boxManager.teleBoxManager.remove(box)
|
19
|
+
```
|
20
|
+
|
21
|
+
Toggle maximized state
|
22
|
+
```js
|
23
|
+
manager.boxManager.teleBoxManager.setMaximized(false)
|
24
|
+
manager.boxManager.teleBoxManager.setMaximized(true)
|
25
|
+
```
|
26
|
+
|
27
|
+
Toggle minimized state
|
28
|
+
```js
|
29
|
+
manager.boxManager.teleBoxManager.setMinimized(true)
|
30
|
+
manager.boxManager.teleBoxManager.setMaximized(false)
|
31
|
+
```
|
package/docs/develop-app.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
#
|
1
|
+
# Develop custom APP
|
2
2
|
|
3
|
-
-
|
3
|
+
- [AppContext](./app-context.md)
|
4
4
|
|
5
5
|
## official apps https://github.com/netless-io/netless-app
|
6
6
|
|
7
7
|
## app-with-whiteboard
|
8
8
|
|
9
|
-
|
9
|
+
If you need to mount a whiteboard in the app, please refer to [board.tsx](https://github.com/netless-io/window-manager/blob/master/example/app/board.tsx)
|
10
10
|
|
11
11
|
<br>
|
12
12
|
|
@@ -14,9 +14,9 @@
|
|
14
14
|
import type { NetlessApp, AppContext } from "@netless/window-manager";
|
15
15
|
|
16
16
|
const HelloWorld: NetlessApp = {
|
17
|
-
kind: "
|
17
|
+
kind: "Hello World",
|
18
18
|
setup: (context: AppContext) => {
|
19
|
-
context.
|
19
|
+
context.mountView(context.getBox().$content); // optional: mount the View to the box
|
20
20
|
},
|
21
21
|
};
|
22
22
|
|
@@ -26,7 +26,10 @@ WindowManager.register({
|
|
26
26
|
});
|
27
27
|
|
28
28
|
manager.addApp({
|
29
|
-
kind: "
|
29
|
+
kind: "Hello World",
|
30
|
+
options: {
|
31
|
+
scenePath: "/hello-world", // If you need to use the whiteboard in the app, you must declare scenePath
|
32
|
+
},
|
30
33
|
});
|
31
34
|
```
|
32
35
|
|
@@ -35,21 +38,21 @@ manager.addApp({
|
|
35
38
|
```ts
|
36
39
|
const Counter: NetlessApp<{ count: number }> = {
|
37
40
|
kind: "Counter",
|
38
|
-
setup:
|
41
|
+
setup: context => {
|
39
42
|
const storage = context.storage;
|
40
43
|
storage.ensureState({ count: 0 });
|
41
44
|
|
42
|
-
const box = context.
|
43
|
-
const $content = box.$content //
|
45
|
+
const box = context.getBox(); // box is the window opened for this application
|
46
|
+
const $content = box.$content; // Get the content of the window
|
44
47
|
|
45
48
|
const countDom = document.createElement("div");
|
46
49
|
countDom.innerText = storage.state.count.toString();
|
47
50
|
$content.appendChild(countDom);
|
48
51
|
|
49
|
-
//
|
52
|
+
// Listen for state change callbacks
|
50
53
|
storage.addStateChangedListener(diff => {
|
51
54
|
if (diff.count) {
|
52
|
-
// diff
|
55
|
+
// diff will give newValue and oldValue
|
53
56
|
console.log(diff.count.newValue);
|
54
57
|
console.log(diff.count.oldValue);
|
55
58
|
countDom.innerText = diff.count.newValue.toString();
|
@@ -60,7 +63,7 @@ const Counter: NetlessApp<{ count: number }> = {
|
|
60
63
|
incButton.innerText = "Inc";
|
61
64
|
const incButtonOnClick = () => {
|
62
65
|
storage.setState({ count: storage.state.count + 1 });
|
63
|
-
}
|
66
|
+
};
|
64
67
|
incButton.addEventListener("click", incButtonOnClick);
|
65
68
|
$content.appendChild(incButton);
|
66
69
|
|
@@ -68,24 +71,24 @@ const Counter: NetlessApp<{ count: number }> = {
|
|
68
71
|
decButton.innerText = "Dec";
|
69
72
|
const decButtonOnClick = () => {
|
70
73
|
storage.setState({ count: storage.state.count - 1 });
|
71
|
-
}
|
74
|
+
};
|
72
75
|
decButton.addEventListener("click", decButtonOnClick);
|
73
76
|
$content.appendChild(decButton);
|
74
77
|
|
75
|
-
|
78
|
+
// listen for events
|
76
79
|
const event1Disposer = context.addMagixEventListener("event1", msg => {
|
77
80
|
console.log("event1", msg);
|
78
81
|
});
|
79
82
|
|
80
|
-
//
|
83
|
+
// Send a message to other people who have the app open
|
81
84
|
context.dispatchMagixEvent("event1", { count: 10 });
|
82
85
|
|
83
|
-
//
|
86
|
+
// When the application is destroyed, pay attention to clean up the listener
|
84
87
|
context.emitter.on("destroy", () => {
|
85
88
|
incButton.removeEventListener("click", incButtonOnClick);
|
86
89
|
decButton.removeEventListener("click", decButtonOnClick);
|
87
90
|
event1Disposer();
|
88
91
|
});
|
89
|
-
}
|
90
|
-
}
|
91
|
-
```
|
92
|
+
},
|
93
|
+
};
|
94
|
+
```
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# Export PDF
|
2
|
+
|
3
|
+
This feature requires additional installation of the `jspdf` dependency to use
|
4
|
+
|
5
|
+
```
|
6
|
+
npm install jspdf@2.5.1
|
7
|
+
```
|
8
|
+
|
9
|
+
### Supported apps and versions
|
10
|
+
|
11
|
+
1. @netless/app-slide `0.2.23` and above support saving dynamic ppt board writing
|
12
|
+
|
13
|
+
2. @netless/app-docs-viewer `0.2.10` and above support saving pdf board writing, **Note** app-docs-viewer can show static ppt, pdf, dynamic ppt. Only pdf files support saving board writing
|
14
|
+
|
15
|
+
Only pdf files can be saved in the app-docs-viewer, which is compatible with @netless/window-manager `0.4.50` and above.
|
16
|
+
|
17
|
+
3. white-web-sdk `2.16.37` and above
|
18
|
+
|
19
|
+
### Initiate a save board writing task
|
20
|
+
|
21
|
+
Launch the save board writing task with a `window.postMessage` event, and be careful not to repeat the event before the task is completed.
|
22
|
+
|
23
|
+
```js
|
24
|
+
window.postMessage({
|
25
|
+
type: "@netless/_request_save_pdf_",
|
26
|
+
appId: /* windowManager.addApp return value, specify which window to save the board writing, */
|
27
|
+
})
|
28
|
+
```
|
29
|
+
|
30
|
+
### Get task progress
|
31
|
+
|
32
|
+
Task progress is also passed through the message event, you need to listen to the task progress event before launching the task, the example code is shown below.
|
33
|
+
The data.result will only have a value if the task succeeds, and will be null if the task fails or is in progress.
|
34
|
+
**If the download task fails, then progress is 100 but result is null.**
|
35
|
+
|
36
|
+
```js
|
37
|
+
window.addEventListener("message", evt => {
|
38
|
+
if (evt.data.type === "@netless/_result_save_pdf_") {
|
39
|
+
console.log(evt.data);
|
40
|
+
// data contains the following properties
|
41
|
+
// data.type: fixed value "@netless/_result_save_pdf_"
|
42
|
+
// data.appId: specifies which download task, same as the appId value passed when the board writing was saved
|
43
|
+
// data.progress: progress of the download, 0 ~ 100
|
44
|
+
// data.result: { pdf: ArrayBuffer {}, title: "a.pptx" } or null, the contents of the pdf file for the board writing.
|
45
|
+
// value only when the download progresses to 100. After getting the ArrayBuffer you need to complete the logic of downloading to local.
|
46
|
+
}
|
47
|
+
});
|
48
|
+
```
|
package/docs/migrate.md
CHANGED
@@ -1,60 +1,58 @@
|
|
1
|
+
### Precautions
|
1
2
|
|
2
|
-
|
3
|
+
Multi-window mode must enable whiteboard `useMultiViews` and `useMobXState` options
|
3
4
|
|
4
|
-
|
5
|
+
It will cause some methods and `state` on the following `room` to fail
|
5
6
|
|
6
|
-
|
7
|
+
`method`
|
7
8
|
|
8
|
-
|
9
|
+
- `room.bindHtmlElement()` is replaced by `WindowManager.mount()`
|
10
|
+
- There is no replacement for `room.scalePptToFit()`, calling `scalePptToFit` is no longer recommended
|
11
|
+
- `room.setScenePath()` is replaced by `manager.setMainViewScenePath()`
|
12
|
+
- `room.setSceneIndex()` is replaced by `manager.setMainViewSceneIndex()`
|
9
13
|
|
10
|
-
|
11
|
-
- `room.scalePptToFit()` 暂无代替,不再推荐调用 `scalePptToFit`
|
12
|
-
- `room.setScenePath()` 用 `manager.setMainViewScenePath()` 代替
|
13
|
-
- `room.setSceneIndex()` 用 `manager.setMainViewSceneIndex()` 代替
|
14
|
+
> In order to use `manager` to replace some methods on `room`, it can directly take effect on `mainView`
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
-
|
18
|
-
-
|
19
|
-
-
|
20
|
-
- `room.convertToPointInWorld`
|
21
|
-
- `room.setCameraBound`
|
16
|
+
- `room.disableCameraTransform`
|
17
|
+
- `room.moveCamera`
|
18
|
+
- `room.moveCameraToContain`
|
19
|
+
- `room.convertToPointInWorld`
|
20
|
+
- `room.setCameraBound`
|
22
21
|
|
23
22
|
`camera`
|
24
23
|
|
25
|
-
-
|
24
|
+
- `room.state.cameraState` is replaced by `manager.mainView.camera` and `manager.mainView.size`
|
26
25
|
|
27
|
-
|
26
|
+
If you want to monitor the main whiteboard `camera` changes, please use the following method instead
|
28
27
|
|
29
28
|
```javascript
|
30
29
|
manager.mainView.callbacks.on("onCameraUpdated", camera => {
|
31
|
-
|
30
|
+
console.log(camera);
|
32
31
|
});
|
33
32
|
```
|
34
33
|
|
35
|
-
|
34
|
+
Monitor main whiteboard `size` changes
|
36
35
|
|
37
36
|
```javascript
|
38
37
|
manager.mainView.callbacks.on("onSizeUpdated", size => {
|
39
|
-
|
38
|
+
console.log(size);
|
40
39
|
});
|
41
40
|
```
|
42
41
|
|
43
42
|
<br>
|
44
43
|
|
45
|
-
## `white-web-sdk`
|
44
|
+
## `white-web-sdk` migrated from `2.15.x` to `2.16.x`
|
46
45
|
|
47
46
|
### `room.setMemberState`
|
48
47
|
|
49
|
-
|
48
|
+
This method can be called directly after waiting for `WindowManager` to be mounted when multi-window is enabled.
|
50
49
|
|
51
|
-
|
50
|
+
Or use `manager.mainView.setMemberState` instead
|
52
51
|
|
53
52
|
<br>
|
54
53
|
|
55
|
-
### `room.pptPreviousStep` `room.pptNextStep`
|
56
|
-
|
57
|
-
因为窗口实现机制的改变, `pptPreviousStep` 和 `pptNextStep` 不再生效
|
54
|
+
### `room.pptPreviousStep` `room.pptNextStep` Switch to the next page
|
58
55
|
|
59
|
-
|
56
|
+
`pptPreviousStep` and `pptNextStep` no longer work due to changes in window implementation
|
60
57
|
|
58
|
+
If you need to switch the top and bottom pages of the main whiteboard, please use `manager.nextPage` and `manager.prevPage`
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# Get started quickly
|
2
|
+
|
3
|
+
## Install
|
4
|
+
Install `WindowManager` via `npm` or `yarn`.
|
5
|
+
```bash
|
6
|
+
# npm
|
7
|
+
$ npm install @netless/window-manager
|
8
|
+
|
9
|
+
# yarn
|
10
|
+
$ yarn add @netless/window-manager
|
11
|
+
```
|
12
|
+
|
13
|
+
Import:
|
14
|
+
```typescript
|
15
|
+
import { WhiteWindowSDK } from "@netless/window-manager";
|
16
|
+
import "@netless/window-manager/dist/style.css";
|
17
|
+
```
|
18
|
+
|
19
|
+
## Start using
|
20
|
+
|
21
|
+
### Prepare container
|
22
|
+
Create a container for mounting in the page
|
23
|
+
```html
|
24
|
+
<div id="container"></div>
|
25
|
+
```
|
26
|
+
|
27
|
+
### Initialize the SDK
|
28
|
+
```typescript
|
29
|
+
const sdk = new WhiteWindowSDK({
|
30
|
+
appIdentifier: "appIdentifier"
|
31
|
+
})
|
32
|
+
```
|
33
|
+
|
34
|
+
### Join the room and mount the container
|
35
|
+
```typescript
|
36
|
+
const manager = await sdk.mount({
|
37
|
+
joinRoomParams: {
|
38
|
+
uuid: "room uuid",
|
39
|
+
roomToken: "room token",
|
40
|
+
},
|
41
|
+
mountParams: {
|
42
|
+
container: document.getElementById("container")
|
43
|
+
}
|
44
|
+
})
|
45
|
+
```
|
46
|
+
|
47
|
+
### Uninstall
|
48
|
+
```typescript
|
49
|
+
manager.destroy();
|
50
|
+
```
|
package/docs/replay.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
##
|
1
|
+
## playback
|
2
2
|
|
3
|
-
>
|
3
|
+
> Note: Multi-window playback only supports multi-window rooms from the creation of the room
|
4
4
|
|
5
|
-
>
|
5
|
+
> If it is used as a single-window mode at the beginning and then converted to a multi-window mode, it will cause blank playback rendering
|
6
6
|
|
7
7
|
<br>
|
8
8
|
|
@@ -13,28 +13,28 @@ import { WindowManager, BuiltinApps } from "@netless/window-manager";
|
|
13
13
|
import "@netless/window-manager/dist/style.css";
|
14
14
|
|
15
15
|
const sdk = new WhiteWebSdk({
|
16
|
-
|
17
|
-
|
16
|
+
appIdentifier: "appIdentifier",
|
17
|
+
useMobXState: true // make sure this option is turned on
|
18
18
|
});
|
19
19
|
|
20
20
|
let manager: WindowManager;
|
21
21
|
|
22
22
|
sdk.replayRoom({
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
uuid: "room uuid",
|
24
|
+
roomToken: "room token",
|
25
|
+
invisiblePlugins: [WindowManager],
|
26
|
+
useMultiViews: true, // Multi-window must be enabled useMultiViews
|
27
27
|
}).then(player => {
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
28
|
+
player.callbacks.on("onPhaseChanged", async (phase) => {
|
29
|
+
if (phase === PlayerPhase.Playing) {
|
30
|
+
if (manager) return;
|
31
|
+
manager = await WindowManager.mount({
|
32
|
+
room: player,
|
33
|
+
container: document.getElementById("container")
|
34
|
+
});
|
35
|
+
}
|
36
|
+
})
|
37
37
|
});
|
38
38
|
|
39
|
-
player.play(); // WindowManager
|
40
|
-
```
|
39
|
+
player.play(); // WindowManager can only be mounted after playing
|
40
|
+
```
|
package/package.json
CHANGED
@@ -1,40 +1,48 @@
|
|
1
1
|
{
|
2
2
|
"name": "@netless/window-manager",
|
3
|
-
"version": "1.0.
|
4
|
-
"description": "",
|
5
|
-
"
|
6
|
-
"
|
7
|
-
"types": "dist/index.d.ts",
|
3
|
+
"version": "1.0.1",
|
4
|
+
"description": "Multi-window mode for Netless Whiteboard",
|
5
|
+
"author": "l1shen <lishen1635@gmail.com> (https://github.com/l1shen)",
|
6
|
+
"license": "MIT",
|
8
7
|
"repository": "netless-io/window-manager",
|
8
|
+
"main": "dist/index.js",
|
9
|
+
"module": "dist/index.mjs",
|
10
|
+
"types": "dist/index.d.ts",
|
11
|
+
"files": [
|
12
|
+
"dist",
|
13
|
+
"docs",
|
14
|
+
"src"
|
15
|
+
],
|
9
16
|
"scripts": {
|
10
|
-
"
|
11
|
-
"build": "vite build && yarn type-gen",
|
12
|
-
"type-gen": "tsc --emitDeclarationOnly",
|
13
|
-
"predev": "yarn type-gen",
|
14
|
-
"build:lib:types": "tsc --emitDeclarationOnly",
|
17
|
+
"build": "vite build && npm run type-gen",
|
15
18
|
"lint": "eslint --ext .ts,.tsx,.svelte . && prettier --check .",
|
16
|
-
"
|
19
|
+
"predev": "npm run type-gen",
|
20
|
+
"prettier": "prettier --write .",
|
21
|
+
"test": "vitest",
|
22
|
+
"type-gen": "dts src/index.ts -o dist/index.d.ts"
|
17
23
|
},
|
18
|
-
"keywords": [],
|
19
|
-
"author": "",
|
20
|
-
"license": "ISC",
|
21
24
|
"peerDependencies": {
|
22
|
-
"
|
25
|
+
"jspdf": "2.5.1",
|
26
|
+
"white-web-sdk": "^2.16.52"
|
27
|
+
},
|
28
|
+
"peerDependenciesMeta": {
|
29
|
+
"jspdf": {
|
30
|
+
"optional": true
|
31
|
+
}
|
23
32
|
},
|
24
33
|
"dependencies": {
|
25
34
|
"@juggle/resize-observer": "^3.3.1",
|
26
|
-
"@netless/telebox-insider": "
|
35
|
+
"@netless/telebox-insider": "0.2.28",
|
27
36
|
"emittery": "^0.9.2",
|
28
37
|
"lodash": "^4.17.21",
|
29
38
|
"p-retry": "^4.6.1",
|
30
|
-
"side-effect-manager": "^1.1.0",
|
31
39
|
"uuid": "^7.0.3",
|
32
|
-
"value-enhancer": "^1.2.1",
|
33
40
|
"video.js": ">=7"
|
34
41
|
},
|
35
42
|
"devDependencies": {
|
36
|
-
"@
|
37
|
-
"@netless/app-
|
43
|
+
"@hyrious/dts": "^0.2.2",
|
44
|
+
"@netless/app-docs-viewer": "^0.2.18",
|
45
|
+
"@netless/app-media-player": "0.1.3",
|
38
46
|
"@rollup/plugin-commonjs": "^20.0.0",
|
39
47
|
"@rollup/plugin-node-resolve": "^13.0.4",
|
40
48
|
"@rollup/plugin-url": "^6.1.0",
|
@@ -53,15 +61,17 @@
|
|
53
61
|
"eslint-config-prettier": "^8.3.0",
|
54
62
|
"eslint-plugin-svelte3": "^3.2.0",
|
55
63
|
"jsdom": "^19.0.0",
|
64
|
+
"jspdf": "^2.5.1",
|
56
65
|
"less": "^4.1.1",
|
57
66
|
"prettier": "^2.3.2",
|
58
67
|
"prettier-plugin-svelte": "^2.4.0",
|
59
68
|
"rollup-plugin-analyzer": "^4.0.0",
|
60
69
|
"rollup-plugin-styles": "^3.14.1",
|
70
|
+
"side-effect-manager": "0.1.5",
|
61
71
|
"svelte": "^3.42.4",
|
62
72
|
"typescript": "^4.5.5",
|
63
|
-
"vite": "^2.
|
73
|
+
"vite": "^2.9.9",
|
64
74
|
"vitest": "^0.14.1",
|
65
|
-
"white-web-sdk": "2.16.
|
75
|
+
"white-web-sdk": "2.16.52"
|
66
76
|
}
|
67
77
|
}
|