@teipublisher/pb-components 2.25.6 → 2.25.7
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teipublisher/pb-components",
|
|
3
|
-
"version": "2.25.
|
|
3
|
+
"version": "2.25.7",
|
|
4
4
|
"description": "Collection of webcomponents underlying TEI Publisher",
|
|
5
5
|
"repository": "https://github.com/eeditiones/tei-publisher-components.git",
|
|
6
6
|
"main": "index.html",
|
|
@@ -85,6 +85,7 @@
|
|
|
85
85
|
"lit-element": "^2.5.1",
|
|
86
86
|
"lit-html": "^1.3.0",
|
|
87
87
|
"marked": "^1.2.0",
|
|
88
|
+
"openseadragon": "^5.0.1",
|
|
88
89
|
"pagedjs": "^0.4.3",
|
|
89
90
|
"path-to-regexp": "^6.2.1",
|
|
90
91
|
"prismjs": "^1.29.0",
|
package/src/pb-facsimile.js
CHANGED
|
@@ -303,6 +303,10 @@ export class PbFacsimile extends pbMixin(LitElement) {
|
|
|
303
303
|
}
|
|
304
304
|
this.viewer = OpenSeadragon(options);
|
|
305
305
|
|
|
306
|
+
if (this.showFullPageControl) {
|
|
307
|
+
this._overrideFullscreenButton();
|
|
308
|
+
}
|
|
309
|
+
|
|
306
310
|
this.viewer.addHandler('open', () => {
|
|
307
311
|
this.resetZoom();
|
|
308
312
|
this.emitTo('pb-facsimile-status', { status: 'loaded', facsimiles: this._facsimiles });
|
|
@@ -460,6 +464,38 @@ export class PbFacsimile extends pbMixin(LitElement) {
|
|
|
460
464
|
}
|
|
461
465
|
this.viewer.viewport.goHome();
|
|
462
466
|
}
|
|
467
|
+
|
|
468
|
+
_overrideFullscreenButton() {
|
|
469
|
+
// The full page control in OSD makes all body elements disappear, causing all kinds of bugs in
|
|
470
|
+
// our webcomponents. Replace it with something that just calls `requestFullScreen` instead.
|
|
471
|
+
// This approach (but more elaborate) is also PR-ed to OSD
|
|
472
|
+
// (https://github.com/openseadragon/openseadragon/pull/2786). This code can be dropped the
|
|
473
|
+
// moment we upgrade to OSD.
|
|
474
|
+
|
|
475
|
+
const toggleFullscreenButton = this.viewer.buttonGroup.buttons.find(
|
|
476
|
+
button => button.tooltip === 'Toggle full page',
|
|
477
|
+
);
|
|
478
|
+
if (!toggleFullscreenButton) {
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
const releaseHandler = async () => {
|
|
482
|
+
if (!document.fullscreenElement) {
|
|
483
|
+
await this.viewer.element.requestFullscreen();
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
486
|
+
await document.exitFullscreen();
|
|
487
|
+
};
|
|
488
|
+
|
|
489
|
+
toggleFullscreenButton.onRelease = releaseHandler;
|
|
490
|
+
const oldRaiseEvent = toggleFullscreenButton.raiseEvent;
|
|
491
|
+
toggleFullscreenButton.raiseEvent = (eventName, args) => {
|
|
492
|
+
if (eventName === 'release') {
|
|
493
|
+
releaseHandler();
|
|
494
|
+
} else {
|
|
495
|
+
oldRaiseEvent.call(toggleFullscreenButton, eventName, args);
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
}
|
|
463
499
|
}
|
|
464
500
|
if (!customElements.get('pb-facsimile')) {
|
|
465
501
|
customElements.define('pb-facsimile', PbFacsimile);
|