fix screenshots

This commit is contained in:
Amine Ben hammou
2018-01-19 12:47:18 +00:00
parent 0d26b62416
commit 5e152e920e

View File

@@ -92,8 +92,10 @@ define(
},
saveTemplate: function (response, done) {
const iframe = document.createElement('iframe');
iframe.width = 660;
iframe.src = response.meta.preview_url;
iframe.onload = () => {
setTimeout(() => {
html2canvas(iframe.contentDocument.documentElement).then((thumbnail) => {
document.body.removeChild(iframe);
MailPoet.Ajax.post({
@@ -110,6 +112,7 @@ define(
},
}).then(done).fail(this.showError);
});
}, 500);
};
// just to hide the iframe
iframe.style.cssText ='position: absolute; opacity:0; z-index: -9999';