@teipublisher/pb-components 2.26.0-next-3.17 → 2.26.0-next-3.19

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.26.0-next-3.17",
3
+ "version": "2.26.0-next-3.19",
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",
@@ -84,6 +84,7 @@
84
84
  "lit-element": "^2.5.1",
85
85
  "lit-html": "^1.3.0",
86
86
  "marked": "^1.2.0",
87
+ "openseadragon": "^5.0.1",
87
88
  "pagedjs": "^0.4.3",
88
89
  "path-to-regexp": "^6.2.1",
89
90
  "prismjs": "^1.29.0",
@@ -40,6 +40,9 @@ export class GND extends Registry {
40
40
  case 'organization':
41
41
  filter = 'CorporateBody';
42
42
  break;
43
+ case 'work':
44
+ filter = 'Work';
45
+ break;
43
46
  default:
44
47
  filter = 'Person';
45
48
  break;
@@ -310,6 +310,10 @@ export class PbFacsimile extends pbMixin(LitElement) {
310
310
  }
311
311
  this.viewer = OpenSeadragon(options);
312
312
 
313
+ if (this.showFullPageControl) {
314
+ this._overrideFullscreenButton();
315
+ }
316
+
313
317
  this.viewer.addHandler('open', () => {
314
318
  this.resetZoom();
315
319
  this.emitTo('pb-facsimile-status', { status: 'loaded', facsimiles: this._facsimiles });
@@ -467,6 +471,38 @@ export class PbFacsimile extends pbMixin(LitElement) {
467
471
  }
468
472
  this.viewer.viewport.goHome();
469
473
  }
474
+
475
+ _overrideFullscreenButton() {
476
+ // The full page control in OSD makes all body elements disappear, causing all kinds of bugs in
477
+ // our webcomponents. Replace it with something that just calls `requestFullScreen` instead.
478
+ // This approach (but more elaborate) is also PR-ed to OSD
479
+ // (https://github.com/openseadragon/openseadragon/pull/2786). This code can be dropped the
480
+ // moment we upgrade to OSD.
481
+
482
+ const toggleFullscreenButton = this.viewer.buttonGroup.buttons.find(
483
+ button => button.tooltip === 'Toggle full page',
484
+ );
485
+ if (!toggleFullscreenButton) {
486
+ return;
487
+ }
488
+ const releaseHandler = async () => {
489
+ if (!document.fullscreenElement) {
490
+ await this.viewer.element.requestFullscreen();
491
+ return;
492
+ }
493
+ await document.exitFullscreen();
494
+ };
495
+
496
+ toggleFullscreenButton.onRelease = releaseHandler;
497
+ const oldRaiseEvent = toggleFullscreenButton.raiseEvent;
498
+ toggleFullscreenButton.raiseEvent = (eventName, args) => {
499
+ if (eventName === 'release') {
500
+ releaseHandler();
501
+ } else {
502
+ oldRaiseEvent.call(toggleFullscreenButton, eventName, args);
503
+ }
504
+ };
505
+ }
470
506
  }
471
507
  if (!customElements.get('pb-facsimile')) {
472
508
  customElements.define('pb-facsimile', PbFacsimile);