moving width to css
This commit is contained in:
@@ -29,3 +29,5 @@
|
||||
@require 'mp2migrator'
|
||||
|
||||
@require '../../../node_modules/react-confirm-alert/src/react-confirm-alert.css'
|
||||
|
||||
@require 'newsletter_templates'
|
7
assets/css/src/newsletter_templates.styl
Normal file
7
assets/css/src/newsletter_templates.styl
Normal file
@@ -0,0 +1,7 @@
|
||||
@require 'newsletter_editor/variables'
|
||||
|
||||
.mailpoet_template_iframe
|
||||
position: absolute
|
||||
z-index: -9999
|
||||
width: $newsletter-width
|
||||
max-width: $newsletter-width
|
@@ -92,30 +92,27 @@ 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({
|
||||
api_version: window.mailpoet_api_version,
|
||||
endpoint: 'newsletterTemplates',
|
||||
action: 'save',
|
||||
data: {
|
||||
newsletter_id: response.data.id,
|
||||
name: response.data.subject,
|
||||
description: response.data.preheader,
|
||||
thumbnail: thumbnail.toDataURL('image/jpeg'),
|
||||
body: JSON.stringify(response.data.body),
|
||||
categories: '["recent"]',
|
||||
},
|
||||
}).then(done).fail(this.showError);
|
||||
});
|
||||
}, 500);
|
||||
html2canvas(iframe.contentDocument.documentElement).then((thumbnail) => {
|
||||
document.body.removeChild(iframe);
|
||||
MailPoet.Ajax.post({
|
||||
api_version: window.mailpoet_api_version,
|
||||
endpoint: 'newsletterTemplates',
|
||||
action: 'save',
|
||||
data: {
|
||||
newsletter_id: response.data.id,
|
||||
name: response.data.subject,
|
||||
description: response.data.preheader,
|
||||
thumbnail: thumbnail.toDataURL('image/jpeg'),
|
||||
body: JSON.stringify(response.data.body),
|
||||
categories: '["recent"]',
|
||||
},
|
||||
}).then(done).fail(this.showError);
|
||||
});
|
||||
};
|
||||
// just to hide the iframe
|
||||
iframe.style.cssText ='position: absolute; opacity:0; z-index: -9999';
|
||||
iframe.className ='mailpoet_template_iframe';
|
||||
document.body.appendChild(iframe);
|
||||
},
|
||||
handleSend: function (e) {
|
||||
|
1027
package-lock.json
generated
1027
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user