Skip to content

Commit d8f4bf0

Browse files
authored
Merge pull request #63 from hqer927/slide-0.2-freeze
fix: when app state minimized must freeze
2 parents fdd5319 + fe06a77 commit d8f4bf0

14 files changed

Lines changed: 780 additions & 594 deletions

File tree

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"devDependencies": {
55
"@commitlint/cli": "^16.2.3",
66
"@commitlint/config-conventional": "^16.2.1",
7-
"@netless/window-manager": "^0.4.75",
7+
"@netless/window-manager": "^1.0.11",
88
"@sveltejs/vite-plugin-svelte": "1.0.0-next.48",
99
"@tsconfig/svelte": "^3.0.0",
1010
"@types/node": "^17.0.41",
@@ -42,7 +42,7 @@
4242
"dev": "pnpm -F playground dev"
4343
},
4444
"overrides": {
45-
"@netless/window-manager": "^0.4.75",
45+
"@netless/window-manager": "^1.0.11",
4646
"white-web-sdk": "2.16.52",
4747
"sass": "1.79.3"
4848
}

packages/app-docs-viewer/README.md

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ WindowManager.register({
4141
kind: "DocsViewer",
4242
appOptions: {
4343
// Set to true to make the viewer readonly when initialized
44-
justDocsViewReadonly?: true,
44+
justDocsViewReadonly: true,
4545
},
4646
src: NetlessAppDocsViewer,
4747
});
@@ -58,7 +58,7 @@ const box = await manager.createBox({
5858
// Optional app options
5959
options: {
6060
justDocsViewReadonly: false, // or true for readonly mode
61-
}
61+
},
6262
});
6363
```
6464

@@ -76,10 +76,10 @@ const staticDocs = {
7676
src: "https://example.com/page1.jpg",
7777
width: 1920,
7878
height: 1080,
79-
previewURL: "https://example.com/page1-thumb.jpg"
80-
}
81-
}
82-
]
79+
previewURL: "https://example.com/page1-thumb.jpg",
80+
},
81+
},
82+
],
8383
};
8484

8585
// Dynamic presentation (converted PPTX)
@@ -91,10 +91,10 @@ const dynamicPresentation = {
9191
src: "ppt://example.com/slide1.slide", // URL starting with "ppt" triggers dynamic mode
9292
width: 1920,
9393
height: 1080,
94-
previewURL: "https://example.com/slide1-thumb.png"
95-
}
96-
}
97-
]
94+
previewURL: "https://example.com/slide1-thumb.png",
95+
},
96+
},
97+
],
9898
};
9999

100100
// Multiple pages example
@@ -106,19 +106,19 @@ const multiPageDocument = {
106106
src: "https://example.com/page1.jpg",
107107
width: 1920,
108108
height: 1080,
109-
previewURL: "https://example.com/page1-thumb.jpg"
110-
}
109+
previewURL: "https://example.com/page1-thumb.jpg",
110+
},
111111
},
112112
{
113113
name: "page2",
114114
ppt: {
115115
src: "https://example.com/page2.jpg",
116116
width: 1920,
117117
height: 1080,
118-
previewURL: "https://example.com/page2-thumb.jpg"
119-
}
120-
}
121-
]
118+
previewURL: "https://example.com/page2-thumb.jpg",
119+
},
120+
},
121+
],
122122
};
123123
```
124124

@@ -134,15 +134,15 @@ import NetlessAppDocsViewer from "@netless/app-docs-viewer";
134134
const manager = await WindowManager.create({
135135
useMobXState: true,
136136
cursor: true,
137-
container: document.querySelector("#container")!
137+
container: document.querySelector("#container")!,
138138
});
139139

140140
// Register the docs viewer app before creating any windows
141141
WindowManager.register({
142142
kind: "DocsViewer",
143143
appOptions: {
144144
// Define default app options for all instances
145-
justDocsViewReadonly?: true,
145+
justDocsViewReadonly: true,
146146
},
147147
src: NetlessAppDocsViewer,
148148
});
@@ -158,13 +158,13 @@ const box = await manager.createBox({
158158
title: "Document Viewer",
159159
style: {
160160
width: 800,
161-
height: 600
161+
height: 600,
162162
},
163163
scenes: yourDocumentScenes,
164164
options: {
165165
// Override default app options for this specific instance
166-
justDocsViewReadonly: false
167-
}
166+
justDocsViewReadonly: false,
167+
},
168168
});
169169
```
170170

@@ -179,7 +179,7 @@ WindowManager.register({
179179
kind: "DocsViewer",
180180
appOptions: {
181181
// Global default options for all instances
182-
justDocsViewReadonly?: true,
182+
justDocsViewReadonly: true,
183183
},
184184
src: NetlessAppDocsViewer,
185185
});
@@ -202,9 +202,9 @@ Documents are configured through Netless scenes with the following page structur
202202

203203
```typescript
204204
interface DocsViewerPage {
205-
src: string; // Page or slide URL
206-
height: number; // Page height in pixels
207-
width: number; // Page width in pixels
205+
src: string; // Page or slide URL
206+
height: number; // Page height in pixels
207+
width: number; // Page width in pixels
208208
thumbnail?: string; // Optional thumbnail URL for preview
209209
}
210210
```
@@ -215,19 +215,21 @@ interface DocsViewerPage {
215215
const scenes = [
216216
{
217217
name: "page1",
218-
ppt: { // Important: Use the 'ppt' field for automatic detection
218+
ppt: {
219+
// Important: Use the 'ppt' field for automatic detection
219220
src: "https://example.com/page1.jpg",
220221
width: 1920,
221222
height: 1080,
222-
previewURL: "https://example.com/page1-thumb.jpg" // Optional
223-
}
224-
}
223+
previewURL: "https://example.com/page1-thumb.jpg", // Optional
224+
},
225+
},
225226
];
226227
```
227228

228229
#### Viewer Modes
229230

230231
1. **Static Mode** - For PDFs and images
232+
231233
- Continuous scrolling
232234
- Zoom controls (25% - 400%)
233235
- Thumbnail sidebar
@@ -273,13 +275,13 @@ import jsPDF from "jspdf";
273275

274276
## Keyboard Shortcuts
275277

276-
| Shortcut | Function | Mode |
277-
|----------|----------|------|
278-
| `` `` | Previous/Next page or slide | Both |
279-
| `Page Up` `Page Down` | Previous/Next page | Static |
280-
| `Space` | Play/pause (dynamic) / Next page (static) | Both |
281-
| `+` `-` | Zoom in/out | Static |
282-
| `Home` `End` | First/last page | Both |
278+
| Shortcut | Function | Mode |
279+
| --------------------- | ----------------------------------------- | ------ |
280+
| `` `` | Previous/Next page or slide | Both |
281+
| `Page Up` `Page Down` | Previous/Next page | Static |
282+
| `Space` | Play/pause (dynamic) / Next page (static) | Both |
283+
| `+` `-` | Zoom in/out | Static |
284+
| `Home` `End` | First/last page | Both |
283285

284286
## Development
285287

packages/app-docs-viewer/README.zh-CN.md

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ WindowManager.register({
4141
kind: "DocsViewer",
4242
appOptions: {
4343
// 设置为 true 可在应用初始化时设为只读模式
44-
justDocsViewReadonly?: true,
44+
justDocsViewReadonly: true,
4545
},
4646
src: NetlessAppDocsViewer,
4747
});
@@ -58,7 +58,7 @@ const box = await manager.createBox({
5858
// 可选的应用选项
5959
options: {
6060
justDocsViewReadonly: false, // 或 true 表示只读模式
61-
}
61+
},
6262
});
6363
```
6464

@@ -76,10 +76,10 @@ const staticDocs = {
7676
src: "https://example.com/page1.jpg",
7777
width: 1920,
7878
height: 1080,
79-
previewURL: "https://example.com/page1-thumb.jpg"
80-
}
81-
}
82-
]
79+
previewURL: "https://example.com/page1-thumb.jpg",
80+
},
81+
},
82+
],
8383
};
8484

8585
// 动态演示文稿(转换后的 PPTX)
@@ -91,10 +91,10 @@ const dynamicPresentation = {
9191
src: "ppt://example.com/slide1.slide", // 以 "ppt" 开头的 URL 触发动态模式
9292
width: 1920,
9393
height: 1080,
94-
previewURL: "https://example.com/slide1-thumb.png"
95-
}
96-
}
97-
]
94+
previewURL: "https://example.com/slide1-thumb.png",
95+
},
96+
},
97+
],
9898
};
9999

100100
// 多页面示例
@@ -106,19 +106,19 @@ const multiPageDocument = {
106106
src: "https://example.com/page1.jpg",
107107
width: 1920,
108108
height: 1080,
109-
previewURL: "https://example.com/page1-thumb.jpg"
110-
}
109+
previewURL: "https://example.com/page1-thumb.jpg",
110+
},
111111
},
112112
{
113113
name: "page2",
114114
ppt: {
115115
src: "https://example.com/page2.jpg",
116116
width: 1920,
117117
height: 1080,
118-
previewURL: "https://example.com/page2-thumb.jpg"
119-
}
120-
}
121-
]
118+
previewURL: "https://example.com/page2-thumb.jpg",
119+
},
120+
},
121+
],
122122
};
123123
```
124124

@@ -134,15 +134,15 @@ import NetlessAppDocsViewer from "@netless/app-docs-viewer";
134134
const manager = await WindowManager.create({
135135
useMobXState: true,
136136
cursor: true,
137-
container: document.querySelector("#container")!
137+
container: document.querySelector("#container")!,
138138
});
139139

140140
// 在创建任何窗口之前注册文档查看器应用
141141
WindowManager.register({
142142
kind: "DocsViewer",
143143
appOptions: {
144144
// 为所有实例定义默认应用选项
145-
justDocsViewReadonly?: true,
145+
justDocsViewReadonly: true,
146146
},
147147
src: NetlessAppDocsViewer,
148148
});
@@ -158,13 +158,13 @@ const box = await manager.createBox({
158158
title: "文档查看器",
159159
style: {
160160
width: 800,
161-
height: 600
161+
height: 600,
162162
},
163163
scenes: yourDocumentScenes,
164164
options: {
165165
// 为此特定实例覆盖默认应用选项
166-
justDocsViewReadonly: false
167-
}
166+
justDocsViewReadonly: false,
167+
},
168168
});
169169
```
170170

@@ -179,7 +179,7 @@ WindowManager.register({
179179
kind: "DocsViewer",
180180
appOptions: {
181181
// 所有实例的全局默认选项
182-
justDocsViewReadonly?: true,
182+
justDocsViewReadonly: true,
183183
},
184184
src: NetlessAppDocsViewer,
185185
});
@@ -202,9 +202,9 @@ interface NetlessAppDocsViewerOptions {
202202

203203
```typescript
204204
interface DocsViewerPage {
205-
src: string; // 页面或幻灯片 URL
206-
height: number; // 页面高度(像素)
207-
width: number; // 页面宽度(像素)
205+
src: string; // 页面或幻灯片 URL
206+
height: number; // 页面高度(像素)
207+
width: number; // 页面宽度(像素)
208208
thumbnail?: string; // 可选的缩略图 URL 用于预览
209209
}
210210
```
@@ -215,19 +215,21 @@ interface DocsViewerPage {
215215
const scenes = [
216216
{
217217
name: "page1",
218-
ppt: { // 重要:使用 'ppt' 字段进行自动检测
218+
ppt: {
219+
// 重要:使用 'ppt' 字段进行自动检测
219220
src: "https://example.com/page1.jpg",
220221
width: 1920,
221222
height: 1080,
222-
previewURL: "https://example.com/page1-thumb.jpg" // 可选
223-
}
224-
}
223+
previewURL: "https://example.com/page1-thumb.jpg", // 可选
224+
},
225+
},
225226
];
226227
```
227228

228229
#### 查看器模式
229230

230231
1. **静态模式** - 用于 PDF 和图片
232+
231233
- 连续滚动
232234
- 缩放控件(25% - 400%)
233235
- 缩略图侧边栏
@@ -273,13 +275,13 @@ import jsPDF from "jspdf";
273275

274276
## 键盘快捷键
275277

276-
| 快捷键 | 功能 | 模式 |
277-
|--------|------|------|
278-
| `` `` | 上一页/下一页或幻灯片 | 全部 |
279-
| `Page Up` `Page Down` | 上一页/下一页 | 静态 |
280-
| `Space` | 播放/暂停(动态)/ 下一页(静态) | 全部 |
281-
| `+` `-` | 放大/缩小 | 静态 |
282-
| `Home` `End` | 第一页/最后一页 | 全部 |
278+
| 快捷键 | 功能 | 模式 |
279+
| --------------------- | --------------------------------- | ---- |
280+
| `` `` | 上一页/下一页或幻灯片 | 全部 |
281+
| `Page Up` `Page Down` | 上一页/下一页 | 静态 |
282+
| `Space` | 播放/暂停(动态)/ 下一页(静态) | 全部 |
283+
| `+` `-` | 放大/缩小 | 静态 |
284+
| `Home` `End` | 第一页/最后一页 | 全部 |
283285

284286
## 开发
285287

@@ -341,4 +343,4 @@ MIT @ [netless](https://github.com/netless-io)
341343
## 相关包
342344

343345
- [@netless/window-manager](../window-manager/) - 窗口管理系统
344-
- [@netless/white-web-sdk](https://github.com/netless-io/white-web-sdk) - 互动白板 SDK
346+
- [@netless/white-web-sdk](https://github.com/netless-io/white-web-sdk) - 互动白板 SDK

packages/app-docs-viewer/playground.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@ const options: PlaygroundConfigs<
4646
ppt: {
4747
height: 735,
4848
src: "https://white-cover.oss-cn-hangzhou.aliyuncs.com/flat/staticConvert/49e8da7c62d2497fa85791ff1a4849c1/1.png",
49-
previewURL: "https://white-cover.oss-cn-hangzhou.aliyuncs.com/flat/staticConvert/49e8da7c62d2497fa85791ff1a4849c1/1.png?x-oss-process=image%2Fresize%2Cl_50&quot;",
49+
previewURL:
50+
"https://white-cover.oss-cn-hangzhou.aliyuncs.com/flat/staticConvert/49e8da7c62d2497fa85791ff1a4849c1/1.png?x-oss-process=image%2Fresize%2Cl_50&quot;",
5051
width: 1031,
5152
},
52-
}
53+
},
5354
],
5455
},
5556
},

0 commit comments

Comments
 (0)