@netless/app-presentation 0.1.8 → 0.1.9-beta.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/dist/index.mjs CHANGED
@@ -1153,7 +1153,7 @@ var Presentation = class {
1153
1153
  };
1154
1154
 
1155
1155
  // src/style.scss?inline
1156
- var style_default = ".netless-app-presentation{height:100%;display:flex;flex-flow:column nowrap}.netless-app-presentation-content{position:relative;height:100%;overflow:hidden}.netless-app-presentation-preview-mask{display:none;position:absolute;z-index:200;top:0;left:0;width:100%;height:100%}.netless-app-presentation-preview{display:flex;flex-direction:column;align-items:center;position:absolute;z-index:300;top:0;left:0;width:33%;max-width:200px;height:100%;padding-top:10px;transform:translate(-100%);background:#ededf0e6;box-shadow:inset -1px 0 #0000001c;transition:transform .4s;overflow:auto;overflow-y:scroll}.netless-app-presentation-preview-active .netless-app-presentation-preview-mask{display:block}.netless-app-presentation-preview-active .netless-app-presentation-preview{transform:translate(0)}.netless-app-presentation-preview-page{position:relative;display:block;width:55%;margin-bottom:10px;font-size:0;color:#0000;outline:none;border:7px solid rgba(0,0,0,0);border-radius:4px;transition:border-color .3s;user-select:none}.netless-app-presentation-preview-page:hover,.netless-app-presentation-preview-page.netless-app-presentation-preview-page-active{border-color:#444e601a}.netless-app-presentation-preview-page>img{width:100%;height:auto;box-sizing:border-box;border:1px solid rgba(0,0,0,.5);border-radius:1px;background-color:#fff;box-shadow:0 2px 8px #0000004d}.netless-app-presentation-preview-page-name{position:absolute;top:1px;left:-10px;transform:translate(-100%);text-align:right;font-size:12px;color:#5f5f5f;user-select:none}.netless-app-presentation-footer{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;border-top:1px solid #eeeef7;color:#191919}.netless-app-presentation-float-footer{width:100%;min-height:26px;position:absolute;left:0;bottom:0;z-index:2000;background:#f9f9fce6;transition:opacity .4s}.netless-app-presentation-footer-btn{box-sizing:border-box;width:26px;height:26px;font-size:0;margin:0;padding:3px;border:none;border-radius:1px;outline:none;color:currentColor;background:#0000;transition:background .4s;cursor:pointer;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-presentation-footer-btn:hover{background:#ededf0e6}@media (hover: none){.netless-app-presentation-footer-btn:hover{background:#0000!important}}.netless-app-presentation-footer-btn>svg{width:100%;height:100%}.netless-app-presentation-footer-btn>svg:nth-of-type(2){display:none}.netless-app-presentation-footer-btn.netless-app-presentation-footer-btn-playing>svg:nth-of-type(1){display:none}.netless-app-presentation-footer-btn.netless-app-presentation-footer-btn-playing>svg:nth-of-type(2){display:initial}.netless-app-presentation-footer-btn~.netless-app-presentation-footer-btn{margin-left:15px}.netless-app-presentation-page-jumps{flex:1;display:flex;justify-content:center;align-items:center}.netless-app-presentation-page-number{margin-left:auto;font-size:13px;user-select:none;white-space:nowrap;word-break:keep-all}.netless-app-presentation-page-number-input{border:none;outline:none;width:3em;margin:0;padding:0 2px;text-align:right;font-size:13px;line-height:1;font-weight:400;font-family:inherit;border-radius:2px;color:currentColor;background:#0000;transition:background .4s;user-select:text;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-presentation-page-number-input:hover,.netless-app-presentation-page-number-input:focus,.netless-app-presentation-page-number-input:active{background:#fff;box-shadow:#63636333 0 2px 8px}.netless-app-presentation-readonly.netless-app-presentation-footer{display:none}.netless-app-presentation-wb-view{position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;overflow:hidden;transition:opacity .2s}.netless-app-presentation-image{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.netless-app-presentation-image>img{max-width:100%;max-height:100%;object-fit:contain}.telebox-color-scheme-dark .netless-app-presentation-page-number-input{color:#a6a6a8}.telebox-color-scheme-dark .netless-app-presentation-page-number-input:active,.telebox-color-scheme-dark .netless-app-presentation-page-number-input:focus,.telebox-color-scheme-dark .netless-app-presentation-page-number-input:hover{color:#222}.telebox-color-scheme-dark .netless-app-presentation-footer{color:#a6a6a8;background:#2d2d33;border-top:none}.telebox-color-scheme-dark .netless-app-presentation-footer-btn:hover{background:#212126}.telebox-color-scheme-dark .netless-app-presentation-preview{background:#323232e6}";
1156
+ var style_default = ".netless-app-presentation{height:100%;display:flex;flex-flow:column nowrap}.netless-app-presentation-content{position:relative;height:100%;overflow:hidden}.netless-app-presentation-preview-mask{display:none;position:absolute;z-index:200;top:0;left:0;width:100%;height:100%}.netless-app-presentation-preview{display:flex;flex-direction:column;align-items:center;position:absolute;z-index:300;top:0;left:0;width:33%;max-width:200px;height:100%;padding-top:10px;transform:translate(-100%);background:#ededf0e6;box-shadow:inset -1px 0 #0000001c;transition:transform .4s;overflow:auto;overflow-y:scroll}.netless-app-presentation-preview-active .netless-app-presentation-preview-mask{display:block}.netless-app-presentation-preview-active .netless-app-presentation-preview{transform:translate(0)}.netless-app-presentation-preview-page{position:relative;display:block;width:55%;margin-bottom:10px;font-size:0;color:#0000;outline:none;border:7px solid rgba(0,0,0,0);border-radius:4px;transition:border-color .3s;user-select:none}.netless-app-presentation-preview-page:hover,.netless-app-presentation-preview-page.netless-app-presentation-preview-page-active{border-color:#444e601a}.netless-app-presentation-preview-page>img{width:100%;height:auto;box-sizing:border-box;border:1px solid rgba(0,0,0,.5);border-radius:1px;background-color:#fff;box-shadow:0 2px 8px #0000004d}.netless-app-presentation-preview-page-name{position:absolute;top:1px;left:-10px;transform:translate(-100%);text-align:right;font-size:12px;color:#5f5f5f;user-select:none}.netless-app-presentation-footer{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;border-top:1px solid #eeeef7;color:#191919}.netless-app-presentation-float-footer{width:100%;min-height:26px;position:absolute;left:0;bottom:0;z-index:2000;background:#f9f9fce6;transition:opacity .4s}.netless-app-presentation-footer-btn{box-sizing:border-box;width:26px;height:26px;font-size:0;margin:0;padding:3px;border:none;border-radius:1px;outline:none;color:currentColor;background:#0000;transition:background .4s;cursor:pointer;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-presentation-footer-btn:hover{background:#ededf0e6}@media (hover: none){.netless-app-presentation-footer-btn:hover{background:#0000!important}}.netless-app-presentation-footer-btn>svg{width:100%;height:100%}.netless-app-presentation-footer-btn>svg:nth-of-type(2){display:none}.netless-app-presentation-footer-btn.netless-app-presentation-footer-btn-playing>svg:nth-of-type(1){display:none}.netless-app-presentation-footer-btn.netless-app-presentation-footer-btn-playing>svg:nth-of-type(2){display:initial}.netless-app-presentation-footer-btn~.netless-app-presentation-footer-btn{margin-left:15px}.netless-app-presentation-page-jumps{flex:1;display:flex;justify-content:center;align-items:center}.netless-app-presentation-page-number{margin-left:auto;font-size:13px;user-select:none;white-space:nowrap;word-break:keep-all}.netless-app-presentation-page-number-input{border:none;outline:none;width:3em;margin:0;padding:0 2px;text-align:right;font-size:13px;line-height:1;font-weight:400;font-family:inherit;border-radius:2px;color:currentColor;background:#0000;transition:background .4s;user-select:text;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-presentation-page-number-input:hover,.netless-app-presentation-page-number-input:focus,.netless-app-presentation-page-number-input:active{background:#fff;box-shadow:#63636333 0 2px 8px}.netless-app-presentation-readonly.netless-app-presentation-footer{display:none}.netless-app-presentation-wb-view{position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;overflow:hidden;transition:opacity .2s}.netless-app-presentation-image{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.netless-app-presentation-image>img{max-width:100%;max-height:100%;object-fit:contain}.telebox-color-scheme-dark .netless-app-presentation-page-number-input{color:#a6a6a8}.telebox-color-scheme-dark .netless-app-presentation-page-number-input:active,.telebox-color-scheme-dark .netless-app-presentation-page-number-input:focus,.telebox-color-scheme-dark .netless-app-presentation-page-number-input:hover{color:#222}.telebox-color-scheme-dark .netless-app-presentation-footer{color:#a6a6a8;background:#2d2d33;border-top:none}.telebox-color-scheme-dark .netless-app-presentation-footer-btn:hover{background:#212126}.telebox-color-scheme-dark .netless-app-presentation-preview{background:#323232e6}.netless-app-presentation-scrollbar-container{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;z-index:101}.netless-app-presentation-scrollbar-container-x,.netless-app-presentation-scrollbar-container-y{position:absolute;pointer-events:none;display:flex;justify-content:center;box-sizing:border-box;padding:0}.netless-app-presentation-scrollbar-container-x{bottom:0;left:0;height:6px;width:100%;padding-right:6px}.netless-app-presentation-scrollbar-container-y{top:0;right:0;width:6px;height:100%;flex-direction:column;padding-bottom:6px}.netless-app-presentation-scrollbar-x,.netless-app-presentation-scrollbar-y{border-radius:2px;background-color:#1b1f4d4d;pointer-events:auto;cursor:default}.netless-app-presentation-scrollbar-x{height:6px}.netless-app-presentation-scrollbar-y{width:6px}";
1157
1157
 
1158
1158
  // src/store.ts
1159
1159
  function noop() {
@@ -1224,6 +1224,249 @@ function readable(value, start = noop) {
1224
1224
  };
1225
1225
  }
1226
1226
 
1227
+ // src/scrollbar/Draggable.ts
1228
+ function makeDraggable(element, options) {
1229
+ let currentDragger = null;
1230
+ let originalMouseX = 0;
1231
+ let originalMouseY = 0;
1232
+ const { onDragEnd, onDrag, onDragStart, direction = "xy" } = options;
1233
+ const drag = (e, state) => {
1234
+ e.stopPropagation();
1235
+ if (!currentDragger)
1236
+ return;
1237
+ let transformedDragX = 0;
1238
+ let transformedDragY = 0;
1239
+ if (direction === "x") {
1240
+ transformedDragX = Math.round(e.pageX - originalMouseX);
1241
+ } else if (direction === "y") {
1242
+ transformedDragY = Math.round(e.pageY - originalMouseY);
1243
+ } else {
1244
+ transformedDragX = Math.round(e.pageX - originalMouseX);
1245
+ transformedDragY = Math.round(e.pageY - originalMouseY);
1246
+ }
1247
+ if (state === 3 /* END */) {
1248
+ onDragEnd == null ? void 0 : onDragEnd({ x: transformedDragX, y: transformedDragY });
1249
+ } else {
1250
+ onDrag == null ? void 0 : onDrag({ x: transformedDragX, y: transformedDragY });
1251
+ }
1252
+ };
1253
+ element.addEventListener("pointerdown", bindDrag);
1254
+ function bindDrag(e) {
1255
+ currentDragger = e.target;
1256
+ e.stopPropagation();
1257
+ if (currentDragger !== element) {
1258
+ return;
1259
+ }
1260
+ originalMouseX = e.pageX;
1261
+ originalMouseY = e.pageY;
1262
+ element.addEventListener("pointermove", drag);
1263
+ document.body.addEventListener("pointerup", stopDrag);
1264
+ document.body.addEventListener("pointercancel", stopDrag);
1265
+ element.setPointerCapture(e.pointerId);
1266
+ onDragStart == null ? void 0 : onDragStart();
1267
+ }
1268
+ function removeEventListener2() {
1269
+ currentDragger = null;
1270
+ element.removeEventListener("pointermove", drag);
1271
+ document.body.removeEventListener("pointerup", stopDrag);
1272
+ document.body.removeEventListener("pointercancel", stopDrag);
1273
+ }
1274
+ function stopDrag(e) {
1275
+ if (!currentDragger)
1276
+ return;
1277
+ e.stopPropagation();
1278
+ drag(e, 3 /* END */);
1279
+ removeEventListener2();
1280
+ }
1281
+ function destroy() {
1282
+ stop();
1283
+ element.removeEventListener("pointerdown", bindDrag);
1284
+ }
1285
+ function stop() {
1286
+ removeEventListener2();
1287
+ }
1288
+ return { destroy };
1289
+ }
1290
+
1291
+ // src/scrollbar/index.ts
1292
+ var Scrollbar = class {
1293
+ constructor(container, option, view) {
1294
+ this.namespace = "netless-app-presentation";
1295
+ this.scrollContainer = document.createElement("div");
1296
+ this.option = {
1297
+ getPageSize: () => {
1298
+ return {
1299
+ width: 0,
1300
+ height: 0
1301
+ };
1302
+ },
1303
+ getWritable: () => false,
1304
+ syncView: () => void 0
1305
+ };
1306
+ this.onCameraUpdated = () => {
1307
+ if (this.readonly)
1308
+ return;
1309
+ const { scale, centerX, centerY } = this.view.camera;
1310
+ const originScale = this.getOriginScale();
1311
+ const ratio = Math.round(originScale / scale * 1e3) / 1e3;
1312
+ const scrollX = Math.round(centerX * originScale);
1313
+ const scrollY = Math.round(centerY * originScale);
1314
+ if (this.scrollbarX) {
1315
+ this.scrollbarX.style.width = `${ratio * 100}%`;
1316
+ this.scrollbarX.style.display = ratio === 1 ? "none" : "block";
1317
+ this.scrollbarX.style.transform = `translateX(${scrollX}px)`;
1318
+ }
1319
+ if (this.scrollbarY) {
1320
+ this.scrollbarY.style.height = `${ratio * 100}%`;
1321
+ this.scrollbarY.style.display = ratio === 1 ? "none" : "block";
1322
+ this.scrollbarY.style.transform = `translateY(${scrollY}px)`;
1323
+ }
1324
+ };
1325
+ this.onDragStart = () => {
1326
+ const camera = this.view.camera;
1327
+ this.cameraCache = {
1328
+ centerX: camera.centerX,
1329
+ centerY: camera.centerY,
1330
+ scale: camera.scale
1331
+ };
1332
+ };
1333
+ this.onDragX = (transformedDrag) => {
1334
+ if (this.cameraCache) {
1335
+ const { x } = transformedDrag;
1336
+ const originScale = this.getOriginScale();
1337
+ const { minX, maxX } = this.getScrollXRange(this.cameraCache);
1338
+ const scrollX = Math.round(x / originScale);
1339
+ let centerX = scrollX + this.cameraCache.centerX;
1340
+ if (centerX < minX) {
1341
+ centerX = minX;
1342
+ } else if (centerX > maxX) {
1343
+ centerX = maxX;
1344
+ }
1345
+ this.view.moveCamera({
1346
+ centerX,
1347
+ animationMode: "immediately"
1348
+ });
1349
+ }
1350
+ };
1351
+ this.onDragY = (transformedDrag) => {
1352
+ if (this.cameraCache) {
1353
+ const { y } = transformedDrag;
1354
+ const originScale = this.getOriginScale();
1355
+ const { minY, maxY } = this.getScrollYRange(this.cameraCache);
1356
+ const scrollY = Math.round(y / originScale);
1357
+ let centerY = scrollY + this.cameraCache.centerY;
1358
+ if (centerY < minY) {
1359
+ centerY = minY;
1360
+ } else if (centerY > maxY) {
1361
+ centerY = maxY;
1362
+ }
1363
+ this.view.moveCamera({
1364
+ centerY,
1365
+ animationMode: "immediately"
1366
+ });
1367
+ }
1368
+ };
1369
+ this.onDragEnd = () => {
1370
+ this.cameraCache = void 0;
1371
+ this.option.syncView();
1372
+ };
1373
+ this.scrollContainer.className = this.c("scrollbar-container");
1374
+ this.container = container;
1375
+ this.option = option;
1376
+ this.readonly = option.readonly || false;
1377
+ this.view = view;
1378
+ this.init();
1379
+ }
1380
+ c(className) {
1381
+ return `${this.namespace}-${className}`;
1382
+ }
1383
+ getOriginScale() {
1384
+ const { size } = this.view;
1385
+ const { width, height } = this.option.getPageSize();
1386
+ return Math.min(size.height / height, size.width / width);
1387
+ }
1388
+ setReadonly(bol) {
1389
+ this.readonly = bol;
1390
+ if (this.readonly) {
1391
+ this.destroy();
1392
+ } else {
1393
+ this.init();
1394
+ }
1395
+ }
1396
+ getScrollXRange(camera) {
1397
+ const { width } = this.option.getPageSize();
1398
+ const originScale = this.getOriginScale();
1399
+ const scale = camera.scale;
1400
+ const ratio = Math.round(originScale / scale * 1e3) / 1e3;
1401
+ const scrollWidth = width * (1 - ratio);
1402
+ const minX = -scrollWidth / 2;
1403
+ const maxX = scrollWidth / 2;
1404
+ return { minX, maxX };
1405
+ }
1406
+ getScrollYRange(camera) {
1407
+ const { height } = this.option.getPageSize();
1408
+ const originScale = this.getOriginScale();
1409
+ const scale = camera.scale;
1410
+ const ratio = Math.round(originScale / scale * 1e3) / 1e3;
1411
+ const scrollHeight = height * (1 - ratio);
1412
+ const minY = -scrollHeight / 2;
1413
+ const maxY = scrollHeight / 2;
1414
+ return { minY, maxY };
1415
+ }
1416
+ init() {
1417
+ this.scrollbarX = document.createElement("div");
1418
+ this.scrollbarX.classList.add(this.c("scrollbar-x"));
1419
+ if (this.option.getWritable()) {
1420
+ this.draggableX = makeDraggable(this.scrollbarX, {
1421
+ direction: "x",
1422
+ onDrag: this.onDragX,
1423
+ onDragEnd: this.onDragEnd,
1424
+ onDragStart: this.onDragStart
1425
+ });
1426
+ }
1427
+ Object.assign(this.scrollbarX.style, {
1428
+ width: "100%",
1429
+ display: "none"
1430
+ });
1431
+ this.scrollbarContainerX = document.createElement("div");
1432
+ this.scrollbarContainerX.classList.add(this.c("scrollbar-container-x"));
1433
+ this.scrollbarContainerX.appendChild(this.scrollbarX);
1434
+ this.scrollbarY = document.createElement("div");
1435
+ this.scrollbarY.classList.add(this.c("scrollbar-y"));
1436
+ if (this.option.getWritable()) {
1437
+ this.draggableY = makeDraggable(this.scrollbarY, {
1438
+ direction: "y",
1439
+ onDrag: this.onDragY,
1440
+ onDragEnd: this.onDragEnd,
1441
+ onDragStart: this.onDragStart
1442
+ });
1443
+ }
1444
+ Object.assign(this.scrollbarY.style, {
1445
+ height: "100%",
1446
+ display: "none"
1447
+ });
1448
+ this.scrollbarContainerY = document.createElement("div");
1449
+ this.scrollbarContainerY.classList.add(this.c("scrollbar-container-y"));
1450
+ this.scrollbarContainerY.appendChild(this.scrollbarY);
1451
+ this.scrollContainer.append(this.scrollbarContainerX, this.scrollbarContainerY);
1452
+ this.container.appendChild(this.scrollContainer);
1453
+ this.view.callbacks.on("onCameraUpdated", this.onCameraUpdated);
1454
+ this.onCameraUpdated();
1455
+ }
1456
+ destroy() {
1457
+ var _a, _b, _c, _d;
1458
+ this.view.callbacks.off("onCameraUpdated", this.onCameraUpdated);
1459
+ (_a = this.scrollbarX) == null ? void 0 : _a.remove();
1460
+ (_b = this.scrollbarY) == null ? void 0 : _b.remove();
1461
+ this.scrollbarX = void 0;
1462
+ this.scrollbarY = void 0;
1463
+ (_c = this.draggableX) == null ? void 0 : _c.destroy();
1464
+ (_d = this.draggableY) == null ? void 0 : _d.destroy();
1465
+ this.draggableX = void 0;
1466
+ this.draggableY = void 0;
1467
+ }
1468
+ };
1469
+
1227
1470
  // src/app-presentation.ts
1228
1471
  var emptySceneName = "$$empty$$";
1229
1472
  var ppt2page = (ppt, name) => ppt ? { width: ppt.width, height: ppt.height, src: ppt.src, thumbnail: ppt.previewURL, name } : null;
@@ -1415,21 +1658,27 @@ var NetlessAppPresentation = {
1415
1658
  }
1416
1659
  };
1417
1660
  const syncView = () => {
1418
- if (throttleSyncView > 0)
1419
- return;
1420
- const { width, height } = app.page() || {};
1421
- if (width && height && context.getIsWritable()) {
1422
- const { camera, size } = view;
1423
- const fixedW = Math.min(size.width, size.height * width / height);
1424
- const fixedH = Math.min(size.height, size.width * height / width);
1425
- const w = fixedW / camera.scale;
1426
- const h = fixedH / camera.scale;
1427
- const x = camera.centerX - w / 2;
1428
- const y = camera.centerY - h / 2;
1429
- throttleSyncView = setTimeout(() => {
1661
+ if (context.getIsWritable()) {
1662
+ if (options.debounceSync) {
1663
+ clearTimeout(throttleSyncView);
1430
1664
  throttleSyncView = 0;
1431
- view$$.setState({ uid: me, originX: x, originY: y, width: w, height: h });
1432
- }, 50);
1665
+ }
1666
+ if (throttleSyncView > 0)
1667
+ return;
1668
+ const { width, height } = app.page() || {};
1669
+ if (width && height) {
1670
+ throttleSyncView = setTimeout(() => {
1671
+ throttleSyncView = 0;
1672
+ const { camera, size } = view;
1673
+ const fixedW = Math.min(size.width, size.height * width / height);
1674
+ const fixedH = Math.min(size.height, size.width * height / width);
1675
+ const w = fixedW / camera.scale;
1676
+ const h = fixedH / camera.scale;
1677
+ const x = camera.centerX - w / 2;
1678
+ const y = camera.centerY - h / 2;
1679
+ view$$.setState({ uid: me, originX: x, originY: y, width: w, height: h });
1680
+ }, 50);
1681
+ }
1433
1682
  }
1434
1683
  };
1435
1684
  dispose2.add(() => {
@@ -1451,7 +1700,7 @@ var NetlessAppPresentation = {
1451
1700
  dispose2.add(view$$.addStateChangedListener(() => syncViewFromRemote(false, true)));
1452
1701
  const box = context.getBox();
1453
1702
  const app = dispose2.add(createPresentation(box, pages, jumpPage, pageIndex$, options.thumbnail));
1454
- app.contentDOM.dataset.appPresentationVersion = "0.1.8";
1703
+ app.contentDOM.dataset.appPresentationVersion = "0.1.9-beta.1";
1455
1704
  app.scaleDocsToFit = scaleDocsToFit;
1456
1705
  app.log = log;
1457
1706
  if (options.justDocsViewReadonly) {
@@ -1486,6 +1735,20 @@ var NetlessAppPresentation = {
1486
1735
  dispose2.add(context.emitter.on("writableChange", (isWritable) => {
1487
1736
  app.setReadonly(!isWritable);
1488
1737
  }));
1738
+ let scrollbar;
1739
+ if (options.useScrollbar) {
1740
+ dispose2.make(() => {
1741
+ scrollbar = new Scrollbar(app.contentDOM, {
1742
+ getPageSize: () => {
1743
+ const { width, height } = app.page() || {};
1744
+ return { width: width || 0, height: height || 0 };
1745
+ },
1746
+ getWritable: () => context.getIsWritable(),
1747
+ syncView: () => syncView()
1748
+ }, view);
1749
+ return () => scrollbar == null ? void 0 : scrollbar.destroy();
1750
+ });
1751
+ }
1489
1752
  context.emitter.on("destroy", () => dispose2());
1490
1753
  const reportProgress = (progress, result) => {
1491
1754
  window.postMessage({ type: "@netless/_result_save_pdf_", appId: context.appId, progress, result }, "*");
@@ -1603,7 +1866,13 @@ var NetlessAppPresentation = {
1603
1866
  const setDocsViewReadonly = (bol) => {
1604
1867
  app.setDocsViewReadonly(bol);
1605
1868
  };
1606
- const controller = { app, view, context, jumpPage, prevPage, nextPage, pageState, toPdf, log, setDocsViewReadonly };
1869
+ const setReadonly = (bol) => {
1870
+ app.setReadonly(bol);
1871
+ if (scrollbar) {
1872
+ scrollbar.setReadonly(bol);
1873
+ }
1874
+ };
1875
+ const controller = { app, view, context, jumpPage, prevPage, nextPage, pageState, toPdf, log, setDocsViewReadonly, setReadonly };
1607
1876
  dispose2.add(listen(window, "message", (ev) => {
1608
1877
  if (ev.data === "@netless/_presentation_") {
1609
1878
  if (typeof window !== "undefined")
@@ -1659,7 +1928,7 @@ var install = (register, options = {}) => {
1659
1928
  };
1660
1929
 
1661
1930
  // src/index.ts
1662
- var version = "0.1.8";
1931
+ var version = "0.1.9-beta.1";
1663
1932
 
1664
1933
  export { NetlessAppPresentation, Presentation, NetlessAppPresentation as default, install, style_default as styles, version };
1665
1934
  //# sourceMappingURL=index.mjs.map