From b2ac613b3b2c9f63340c7461ffe713b288f9f14e Mon Sep 17 00:00:00 2001 From: Hangzhi Yu <hangzhi@protonmail.com> Date: Mon, 6 Mar 2023 16:13:06 +0100 Subject: [PATCH] Use alternative mechanism for listening to IFrame height changes in LegacyBaseTemplate --- CHANGELOG.rst | 2 ++ aleksis/core/frontend/components/LegacyBaseTemplate.vue | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 781f9fe93..5a056d444 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -20,6 +20,8 @@ Fixed * In case the status code of a response was not in the range between 200 and 299 but still indicates that the response should be delivered, e. g. in the case of a redirected request, the service worker served the offline fallback page. +* In some cases, the resize listener for the IFrame in the `LegacyBaseTemplate` + did not trigger. `3.0b1` - 2023-02-27 -------------------- diff --git a/aleksis/core/frontend/components/LegacyBaseTemplate.vue b/aleksis/core/frontend/components/LegacyBaseTemplate.vue index 324882b44..25bf5e903 100644 --- a/aleksis/core/frontend/components/LegacyBaseTemplate.vue +++ b/aleksis/core/frontend/components/LegacyBaseTemplate.vue @@ -77,13 +77,13 @@ export default { const title = this.$refs.contentIFrame.contentWindow.document.title; this.$root.$setPageTitle(title); - // Adapt height of IFrame according to the height of its contents once and listen to resize events + // Adapt height of IFrame according to the height of its contents once and observe height changes this.iFrameHeight = this.$refs.contentIFrame.contentDocument.body.scrollHeight; - this.$refs.contentIFrame.contentWindow.onresize = () => { + new ResizeObserver(() => { this.iFrameHeight = this.$refs.contentIFrame.contentDocument.body.scrollHeight; - }; + }).observe(this.$refs.contentIFrame.contentDocument.body) this.$root.contentLoading = false; }, -- GitLab