Fix Infogram resize bug
This commit is contained in:
parent
09153782d5
commit
aad4f1f846
|
|
@ -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,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue