@@ -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";
134134const 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
141141WindowManager .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
204204interface 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 {
215215const 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
2302311 . ** 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
0 commit comments