@netless/app-slide 0.2.34 → 0.2.35
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 +5 -2
- package/dist/main.cjs.js +145 -145
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +34 -20
- package/dist/main.es.js.map +1 -1
- package/dist/main.iife.js +203 -203
- package/dist/main.iife.js.map +1 -1
- package/package.json +1 -1
- package/src/DocsViewer/index.ts +20 -5
- package/src/SlideDocsViewer/index.ts +3 -0
- package/src/index.ts +1 -0
package/dist/main.es.js
CHANGED
|
@@ -38031,7 +38031,7 @@ if (runningOnBrowser) {
|
|
|
38031
38031
|
autoInitialize(LazyLoad, window.lazyLoadOptions);
|
|
38032
38032
|
}
|
|
38033
38033
|
class DocsViewer {
|
|
38034
|
-
constructor({ readonly, onNewPageIndex, onPlay }) {
|
|
38034
|
+
constructor({ readonly, onNewPageIndex, onPlay, urlInterrupter }) {
|
|
38035
38035
|
this._pages = [];
|
|
38036
38036
|
this.pageIndex = 0;
|
|
38037
38037
|
this.setPaused = () => {
|
|
@@ -38047,13 +38047,13 @@ class DocsViewer {
|
|
|
38047
38047
|
this.readonly = readonly;
|
|
38048
38048
|
this.onNewPageIndex = onNewPageIndex;
|
|
38049
38049
|
this.onPlay = onPlay;
|
|
38050
|
+
this.urlInterrupter = urlInterrupter || ((url) => url);
|
|
38050
38051
|
this.render();
|
|
38051
38052
|
}
|
|
38052
38053
|
set pages(value) {
|
|
38053
38054
|
this._pages = value;
|
|
38054
|
-
this.refreshPreview();
|
|
38055
|
+
this.refreshPreview().then(this.refreshBtnSidebar.bind(this));
|
|
38055
38056
|
this.refreshTotalPage();
|
|
38056
|
-
this.refreshBtnSidebar();
|
|
38057
38057
|
}
|
|
38058
38058
|
get pages() {
|
|
38059
38059
|
return this._pages;
|
|
@@ -38134,17 +38134,27 @@ class DocsViewer {
|
|
|
38134
38134
|
}
|
|
38135
38135
|
return this.$preview;
|
|
38136
38136
|
}
|
|
38137
|
-
refreshPreview() {
|
|
38138
|
-
var _a;
|
|
38137
|
+
async refreshPreview() {
|
|
38138
|
+
var _a, _b;
|
|
38139
38139
|
const { $preview } = this;
|
|
38140
38140
|
const pageClassName = this.wrapClassName("preview-page");
|
|
38141
38141
|
const pageNameClassName = this.wrapClassName("preview-page-name");
|
|
38142
38142
|
while ($preview.firstChild) {
|
|
38143
38143
|
$preview.firstChild.remove();
|
|
38144
38144
|
}
|
|
38145
|
+
const previewSRCs = [];
|
|
38146
|
+
for (let i = 0, len = this.pages.length; i < len; i++) {
|
|
38147
|
+
const page = this.pages[i];
|
|
38148
|
+
const src = (_a = page.thumbnail) != null ? _a : page.src.startsWith("ppt") ? void 0 : page.src;
|
|
38149
|
+
if (src) {
|
|
38150
|
+
previewSRCs[i] = this.urlInterrupter(src);
|
|
38151
|
+
}
|
|
38152
|
+
}
|
|
38153
|
+
for (let i = 0, len = this.pages.length; i < len; i++) {
|
|
38154
|
+
previewSRCs[i] = await previewSRCs[i];
|
|
38155
|
+
}
|
|
38145
38156
|
this.pages.forEach((page, i) => {
|
|
38146
|
-
|
|
38147
|
-
const previewSRC = (_a2 = page.thumbnail) != null ? _a2 : page.src.startsWith("ppt") ? void 0 : page.src;
|
|
38157
|
+
const previewSRC = previewSRCs[i];
|
|
38148
38158
|
if (!previewSRC) {
|
|
38149
38159
|
return;
|
|
38150
38160
|
}
|
|
@@ -38166,7 +38176,7 @@ class DocsViewer {
|
|
|
38166
38176
|
$page.appendChild($name);
|
|
38167
38177
|
$preview.appendChild($page);
|
|
38168
38178
|
});
|
|
38169
|
-
(
|
|
38179
|
+
(_b = this.previewLazyLoad) == null ? void 0 : _b.update();
|
|
38170
38180
|
}
|
|
38171
38181
|
renderPreviewMask() {
|
|
38172
38182
|
if (!this.$previewMask) {
|
|
@@ -38305,7 +38315,8 @@ class SlideDocsViewer {
|
|
|
38305
38315
|
mountSlideController,
|
|
38306
38316
|
mountWhiteboard,
|
|
38307
38317
|
baseScenePath,
|
|
38308
|
-
appId
|
|
38318
|
+
appId,
|
|
38319
|
+
urlInterrupter
|
|
38309
38320
|
}) {
|
|
38310
38321
|
this.slideController = null;
|
|
38311
38322
|
this.isViewMounted = false;
|
|
@@ -38454,7 +38465,8 @@ class SlideDocsViewer {
|
|
|
38454
38465
|
this.viewer = new DocsViewer({
|
|
38455
38466
|
readonly: box.readonly,
|
|
38456
38467
|
onNewPageIndex: this.onNewPageIndex,
|
|
38457
|
-
onPlay: this.onPlay
|
|
38468
|
+
onPlay: this.onPlay,
|
|
38469
|
+
urlInterrupter
|
|
38458
38470
|
});
|
|
38459
38471
|
this.sideEffect.add(() => {
|
|
38460
38472
|
const handler = (readonly) => {
|
|
@@ -38822,10 +38834,11 @@ class SlidePreviewer {
|
|
|
38822
38834
|
}
|
|
38823
38835
|
}
|
|
38824
38836
|
const usePlugin = /* @__PURE__ */ Slide.Slide.usePlugin.bind(Slide.Slide);
|
|
38825
|
-
const version = "0.2.
|
|
38837
|
+
const version = "0.2.35";
|
|
38826
38838
|
const SlideApp = {
|
|
38827
38839
|
kind: "Slide",
|
|
38828
38840
|
setup(context) {
|
|
38841
|
+
var _a;
|
|
38829
38842
|
console.log("[Slide] setup @ " + version);
|
|
38830
38843
|
if (context.getIsWritable()) {
|
|
38831
38844
|
context.storage.ensureState(EmptyAttributes);
|
|
@@ -38889,14 +38902,15 @@ const SlideApp = {
|
|
|
38889
38902
|
mountSlideController,
|
|
38890
38903
|
mountWhiteboard: context.mountView.bind(context),
|
|
38891
38904
|
baseScenePath,
|
|
38892
|
-
appId: context.appId
|
|
38905
|
+
appId: context.appId,
|
|
38906
|
+
urlInterrupter: (_a = context.getAppOptions()) == null ? void 0 : _a.urlInterrupter
|
|
38893
38907
|
});
|
|
38894
38908
|
const room = context.getRoom();
|
|
38895
38909
|
const sideEffect = new SideEffectManager();
|
|
38896
38910
|
sideEffect.add(() => {
|
|
38897
|
-
var
|
|
38911
|
+
var _a2;
|
|
38898
38912
|
logger.setAppContext(context.appId, context);
|
|
38899
|
-
logger.enable = ((
|
|
38913
|
+
logger.enable = ((_a2 = context.getAppOptions()) == null ? void 0 : _a2.debug) || false;
|
|
38900
38914
|
logger.level = "debug";
|
|
38901
38915
|
return () => logger.deleteApp(context.appId);
|
|
38902
38916
|
});
|
|
@@ -38931,21 +38945,21 @@ const SlideApp = {
|
|
|
38931
38945
|
return docsViewer == null ? void 0 : docsViewer.slideController;
|
|
38932
38946
|
},
|
|
38933
38947
|
slide: () => {
|
|
38934
|
-
var
|
|
38935
|
-
return (
|
|
38948
|
+
var _a2;
|
|
38949
|
+
return (_a2 = docsViewer == null ? void 0 : docsViewer.slideController) == null ? void 0 : _a2.slide;
|
|
38936
38950
|
},
|
|
38937
38951
|
nextStep: () => {
|
|
38938
|
-
var
|
|
38952
|
+
var _a2;
|
|
38939
38953
|
if (docsViewer && docsViewer.slideController) {
|
|
38940
|
-
(
|
|
38954
|
+
(_a2 = docsViewer == null ? void 0 : docsViewer.slideController) == null ? void 0 : _a2.slide.nextStep();
|
|
38941
38955
|
return true;
|
|
38942
38956
|
}
|
|
38943
38957
|
return false;
|
|
38944
38958
|
},
|
|
38945
38959
|
prevStep: () => {
|
|
38946
|
-
var
|
|
38960
|
+
var _a2;
|
|
38947
38961
|
if (docsViewer && docsViewer.slideController) {
|
|
38948
|
-
(
|
|
38962
|
+
(_a2 = docsViewer == null ? void 0 : docsViewer.slideController) == null ? void 0 : _a2.slide.prevStep();
|
|
38949
38963
|
return true;
|
|
38950
38964
|
}
|
|
38951
38965
|
return false;
|