Fix Infogram resize bug

This commit is contained in:
Ramon Wenger 2020-05-26 15:06:16 +02:00
parent 09153782d5
commit aad4f1f846
1 changed files with 6 additions and 1 deletions

View File

@ -41,7 +41,7 @@
window.addEventListener('message', event => { window.addEventListener('message', event => {
try { try {
const data = JSON.parse(event.data); const data = JSON.parse(event.data);
if (data.context === 'iframe.resize') { if (data.context === 'iframe.resize' && this.parseId(data.src) === this.id) {
this.height = data.height; this.height = data.height;
} }
} catch (e) { } catch (e) {
@ -51,6 +51,11 @@
}, },
methods: { methods: {
parseId(src) {
// src will be in the format of something like https://e.infogram.com/0ccf86bc-1afe-4026-b313-1f1b5992452b?src=embed
let last = src.split('/').pop();
return last.substring(0, last.indexOf('?')); // we're only interested in the id part before the '?'
},
openFullscreen() { openFullscreen() {
this.$store.dispatch('showFullscreenInfographic', { this.$store.dispatch('showFullscreenInfographic', {
id: this.value.id, id: this.value.id,