From 89940b67d781fcea1a4ef1efab9e01027c08ff82 Mon Sep 17 00:00:00 2001 From: Martin Dullweber Date: Tue, 12 Sep 2023 20:58:12 +0200 Subject: [PATCH] refactor: address new linter errors --- src/plugins/pdfPlayer/plugin.js | 8 +++++--- src/plugins/pdfPlayer/style.scss | 7 ++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/plugins/pdfPlayer/plugin.js b/src/plugins/pdfPlayer/plugin.js index 4f06fb63d351..138d64655420 100644 --- a/src/plugins/pdfPlayer/plugin.js +++ b/src/plugins/pdfPlayer/plugin.js @@ -151,7 +151,8 @@ export class PdfPlayer { this.bindMediaElementEvents(); document.addEventListener('keyup', this.onWindowKeyUp); - screen.orientation.addEventListener("change", this.onScreenResize); + if ('screen' in window) window.screen.orientation.addEventListener('change', this.onScreenResize); + else document.addEventListener('orientationchange', this.onScreenResize); } unbindMediaElementEvents() { @@ -169,7 +170,8 @@ export class PdfPlayer { } document.removeEventListener('keyup', this.onWindowKeyUp); - screen.orientation.removeEventListener("change", this.onScreenResize); + if ('screen' in window) window.screen.orientation.removeEventListener('change', this.onScreenResize); + else document.removeEventListener('orientationchange', this.onScreenResize); } createMediaElement() { @@ -258,7 +260,7 @@ export class PdfPlayer { } reloadPage() { - this.loadPage(this.progress + 1) + this.loadPage(this.progress + 1); } setPage(pageNumber) { diff --git a/src/plugins/pdfPlayer/style.scss b/src/plugins/pdfPlayer/style.scss index e74bc18f7f9b..e537601cb26c 100644 --- a/src/plugins/pdfPlayer/style.scss +++ b/src/plugins/pdfPlayer/style.scss @@ -13,6 +13,10 @@ width: 100vw; overflow: scroll; + // stylelint has a problem with the selector order + // but grouping it this way simply makes the most sense + // so we turn it off for this block: + /* stylelint-disable no-descending-specificity */ &.fullPage { display: flex !important; align-items: center; @@ -28,7 +32,7 @@ max-width: 100% !important; } } - + &:not(.fullPage) { canvas { max-height: 150vmax; @@ -39,6 +43,7 @@ max-width: 150vmax !important; } } + /* stylelint-enable no-descending-specificity */ } .actionButtons {