@netless/app-slide 0.2.72 → 0.2.74-beta.0
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/dist/index.d.ts +6 -2
- package/dist/main.cjs.js +152 -152
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +33 -28
- package/dist/main.es.js.map +1 -1
- package/dist/main.iife.js +154 -154
- package/dist/main.iife.js.map +1 -1
- package/package.json +9 -9
- package/src/SlideController/helpers.ts +6 -3
- package/src/SlideController/index.ts +2 -1
- package/src/SlideDocsViewer/index.ts +9 -0
- package/src/index.ts +11 -0
- package/LICENSE +0 -21
package/package.json
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netless/app-slide",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.74-beta.0",
|
|
4
4
|
"main": "dist/main.cjs.js",
|
|
5
5
|
"module": "dist/main.es.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"types": "node scripts/build-types.mjs",
|
|
9
|
+
"build": "vite build && npm run types",
|
|
10
|
+
"build:dev": "vite build --mode development && npm run types",
|
|
11
|
+
"cleanup": "rimraf ./dist"
|
|
12
|
+
},
|
|
7
13
|
"files": [
|
|
8
14
|
"src",
|
|
9
15
|
"dist",
|
|
10
16
|
"README-zh.md"
|
|
11
17
|
],
|
|
12
18
|
"devDependencies": {
|
|
13
|
-
"@netless/slide": "1.4.
|
|
19
|
+
"@netless/slide": "1.4.35",
|
|
14
20
|
"@types/color-string": "^1.5.2",
|
|
15
21
|
"color-string": "^1.9.1",
|
|
16
22
|
"jspdf": "2.5.1",
|
|
@@ -24,11 +30,5 @@
|
|
|
24
30
|
"jspdf": {
|
|
25
31
|
"optional": true
|
|
26
32
|
}
|
|
27
|
-
},
|
|
28
|
-
"scripts": {
|
|
29
|
-
"types": "node scripts/build-types.mjs",
|
|
30
|
-
"build": "vite build && npm run types",
|
|
31
|
-
"build:dev": "vite build --mode development && npm run types",
|
|
32
|
-
"cleanup": "rimraf ./dist"
|
|
33
33
|
}
|
|
34
|
-
}
|
|
34
|
+
}
|
|
@@ -31,8 +31,8 @@ export function syncSceneWithSlide(
|
|
|
31
31
|
if (!(page > 0) || !context.getIsWritable()) return;
|
|
32
32
|
|
|
33
33
|
const scenePath = [baseScenePath, page].join("/");
|
|
34
|
-
|
|
35
|
-
if (room.scenePathType(scenePath) !== ("page" as ScenePathType.Page)) {
|
|
34
|
+
// 只有打开ppt用户,并且场景路径不是页面(未被其它用户创建出页面),则需要同步场景
|
|
35
|
+
if (context.isAddApp && room.scenePathType(scenePath) !== ("page" as ScenePathType.Page)) {
|
|
36
36
|
room.removeScenes(baseScenePath);
|
|
37
37
|
const count = slide.slideCount;
|
|
38
38
|
const scenes: { name: string }[] = [];
|
|
@@ -47,7 +47,10 @@ export function syncSceneWithSlide(
|
|
|
47
47
|
currentScenePath = context.getView()?.focusScenePath || "";
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
if (
|
|
50
|
+
if (
|
|
51
|
+
currentScenePath !== scenePath &&
|
|
52
|
+
room.scenePathType(scenePath) === ("page" as ScenePathType.Page)
|
|
53
|
+
) {
|
|
51
54
|
context.setScenePath(scenePath);
|
|
52
55
|
}
|
|
53
56
|
}
|
|
@@ -122,7 +122,7 @@ export class SlideController {
|
|
|
122
122
|
public ready = false;
|
|
123
123
|
private resolveReady!: (index: number) => void;
|
|
124
124
|
public readonly readyPromise = new Promise<void>(resolve => {
|
|
125
|
-
this.resolveReady =
|
|
125
|
+
this.resolveReady = slideIndex => {
|
|
126
126
|
if (this.ready) {
|
|
127
127
|
log("[Slide] render end", slideIndex);
|
|
128
128
|
} else {
|
|
@@ -321,6 +321,7 @@ export class SlideController {
|
|
|
321
321
|
whiteTracker: defaults.whiteTracker,
|
|
322
322
|
timestamp: this.timestamp,
|
|
323
323
|
skipActionWhenFrozen: true,
|
|
324
|
+
customLinks: options.customLinks,
|
|
324
325
|
});
|
|
325
326
|
if (import.meta.env.DEV) {
|
|
326
327
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -51,6 +51,7 @@ export class SlideDocsViewer {
|
|
|
51
51
|
private readonly baseScenePath: string;
|
|
52
52
|
private readonly appId: string;
|
|
53
53
|
private isViewMounted = false;
|
|
54
|
+
private justSildeReadonly = false;
|
|
54
55
|
|
|
55
56
|
public constructor({
|
|
56
57
|
context,
|
|
@@ -106,11 +107,19 @@ export class SlideDocsViewer {
|
|
|
106
107
|
public $whiteboardView!: HTMLDivElement;
|
|
107
108
|
public $overlay!: HTMLDivElement;
|
|
108
109
|
|
|
110
|
+
public setJustSildeReadonly(justSildeReadonly: boolean) {
|
|
111
|
+
this.justSildeReadonly = justSildeReadonly;
|
|
112
|
+
this.slideController?.slide.setInteractive(!this.justSildeReadonly);
|
|
113
|
+
}
|
|
114
|
+
|
|
109
115
|
public render() {
|
|
110
116
|
this.viewer.$content.appendChild(this.renderSlideContainer());
|
|
111
117
|
this.viewer.$content.appendChild(this.renderWhiteboardView());
|
|
112
118
|
this.viewer.$content.appendChild(this.renderOverlay());
|
|
113
119
|
this.sideEffect.addEventListener(window, "keydown", ev => {
|
|
120
|
+
if (this.justSildeReadonly) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
114
123
|
if (this.box.focus && this.slideController && !isEditable(ev.target)) {
|
|
115
124
|
switch (ev.key) {
|
|
116
125
|
case "ArrowUp":
|
package/src/index.ts
CHANGED
|
@@ -44,6 +44,7 @@ export interface AppOptions
|
|
|
44
44
|
| "fixedFrameSize"
|
|
45
45
|
| "logger"
|
|
46
46
|
| "enableGlobalClick"
|
|
47
|
+
| "customLinks"
|
|
47
48
|
> {
|
|
48
49
|
/** show debug controller */
|
|
49
50
|
debug?: boolean;
|
|
@@ -71,6 +72,8 @@ export interface AppOptions
|
|
|
71
72
|
showRenderError?: boolean;
|
|
72
73
|
/** Specify the behavior after hiding the slide; Freeze will destroy the slide and replace it with a snapshot, while Pause simply pauses the slide @default: 'frozen' */
|
|
73
74
|
invisibleBehavior?: "frozen" | "pause";
|
|
75
|
+
/** just readonly, no operate silder */
|
|
76
|
+
justSildeReadonly?: true;
|
|
74
77
|
}
|
|
75
78
|
|
|
76
79
|
export interface ILogger {
|
|
@@ -89,6 +92,7 @@ export interface AppResult {
|
|
|
89
92
|
nextPage: () => boolean;
|
|
90
93
|
prevPage: () => boolean;
|
|
91
94
|
jumpToPage: (page: number) => boolean;
|
|
95
|
+
setSildeReadonly: (bol: boolean) => void;
|
|
92
96
|
}
|
|
93
97
|
|
|
94
98
|
const SlideApp: NetlessApp<Attributes, MagixEvents, AppOptions, AppResult> = {
|
|
@@ -192,6 +196,10 @@ const SlideApp: NetlessApp<Attributes, MagixEvents, AppOptions, AppResult> = {
|
|
|
192
196
|
},
|
|
193
197
|
});
|
|
194
198
|
|
|
199
|
+
if (context.getAppOptions()?.justSildeReadonly) {
|
|
200
|
+
docsViewer?.setJustSildeReadonly(true);
|
|
201
|
+
}
|
|
202
|
+
|
|
195
203
|
if (import.meta.env.DEV) {
|
|
196
204
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
197
205
|
(window as any).slideDoc = docsViewer;
|
|
@@ -233,6 +241,9 @@ const SlideApp: NetlessApp<Attributes, MagixEvents, AppOptions, AppResult> = {
|
|
|
233
241
|
docsViewer.mount();
|
|
234
242
|
|
|
235
243
|
return {
|
|
244
|
+
setSildeReadonly: (bol: boolean) => {
|
|
245
|
+
docsViewer?.setJustSildeReadonly(bol);
|
|
246
|
+
},
|
|
236
247
|
viewer: () => {
|
|
237
248
|
return docsViewer;
|
|
238
249
|
},
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2020 netless
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|