From fc3e1aee83004df7b1249758a5a4990115837d58 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Mon, 3 May 2021 09:16:09 +0200 Subject: [PATCH] MOBILE-3704 mod: Fix files with parameters in book & page --- src/core/services/utils/dom.ts | 8 ++++++-- src/theme/theme.base.scss | 12 ++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/core/services/utils/dom.ts b/src/core/services/utils/dom.ts index 34c897a7d..cffd289dc 100644 --- a/src/core/services/utils/dom.ts +++ b/src/core/services/utils/dom.ts @@ -971,7 +971,9 @@ export class CoreDomUtilsProvider { const media = Array.from(element.querySelectorAll('img, video, audio, source, track')); media.forEach((media: HTMLElement) => { const currentSrc = media.getAttribute('src'); - const newSrc = currentSrc ? paths[CoreTextUtils.decodeURIComponent(currentSrc)] : undefined; + const newSrc = currentSrc ? + paths[CoreUrlUtils.removeUrlParams(CoreTextUtils.decodeURIComponent(currentSrc))] : + undefined; if (typeof newSrc != 'undefined') { media.setAttribute('src', newSrc); @@ -991,7 +993,9 @@ export class CoreDomUtilsProvider { const anchors = Array.from(element.querySelectorAll('a')); anchors.forEach((anchor: HTMLElement) => { const currentHref = anchor.getAttribute('href'); - const newHref = currentHref ? paths[CoreTextUtils.decodeURIComponent(currentHref)] : undefined; + const newHref = currentHref ? + paths[CoreUrlUtils.removeUrlParams(CoreTextUtils.decodeURIComponent(currentHref))] : + undefined; if (typeof newHref != 'undefined') { anchor.setAttribute('href', newHref); diff --git a/src/theme/theme.base.scss b/src/theme/theme.base.scss index 8ab2de7ad..65735f44e 100644 --- a/src/theme/theme.base.scss +++ b/src/theme/theme.base.scss @@ -514,3 +514,15 @@ ion-back-button.md::part(text) { cursor: auto; } } + +.core-media-adapt-width { + max-width: 100%; +} + +img.core-media-adapt-width { + height: auto; +} + +audio.core-media-adapt-width { + width: 100%; +}