Merge pull request #373 from mailpoet/editor_rendering

Editor rendering (Part 2)
This commit is contained in:
mrcasual
2016-03-04 11:11:42 -05:00
7 changed files with 31 additions and 1890 deletions

View File

@ -32,5 +32,6 @@ $block-hover-highlight-color = $primary-active-color
position: relative position: relative
line-height: 1.61803398875 line-height: 1.61803398875
p p, h1, h2, h3, h4, h5, h6
line-height: 1.61803398875 line-height: 1.61803398875
font-style: normal

View File

@ -12,9 +12,11 @@
h1, h2, h3, h4, h5, h6 h1, h2, h3, h4, h5, h6
padding: 0 padding: 0
margin: 0 margin: 0
font-weight: normal
p p
margin-top: 0 margin-top: 0
font-weight: normal
blockquote blockquote
margin: 1em margin: 1em

View File

@ -230,15 +230,17 @@ define([
json.body = JSON.stringify(json.body); json.body = JSON.stringify(json.body);
} }
MailPoet.Modal.loading(true);
MailPoet.Ajax.post({ MailPoet.Ajax.post({
endpoint: 'newsletters', endpoint: 'newsletters',
action: 'render', action: 'render',
data: json, data: json,
}).done(function(response){ }).done(function(response){
console.log('Should open a new window'); MailPoet.Modal.loading(false);
window.open('data:text/html;charset=utf-8,' + encodeURIComponent(response.rendered_body), '_blank'); window.open('data:text/html;charset=utf-8,' + encodeURIComponent(response.rendered_body), '_blank');
}).fail(function(error) { }).fail(function(error) {
console.log('Preview error', json); MailPoet.Modal.loading(false);
alert('Something went wrong, check console'); alert('Something went wrong, check console');
}); });
}, },
@ -246,11 +248,23 @@ define([
// testing sending method // testing sending method
console.log('trying to send a preview'); console.log('trying to send a preview');
// get form data // get form data
var $emailField = this.$('#mailpoet_preview_to_email');
var data = { var data = {
subscriber: this.$('#mailpoet_preview_to_email').val(), subscriber: $emailField.val(),
id: App.getNewsletter().get('id'), id: App.getNewsletter().get('id'),
}; };
if (data.subscriber.length <= 0) {
MailPoet.Notice.error(
App.getConfig().get('translations.newsletterPreviewEmailMissing'),
{
positionAfter: $emailField,
scroll: true,
}
);
return false;
}
// send test email // send test email
MailPoet.Modal.loading(true); MailPoet.Modal.loading(true);

View File

@ -380,6 +380,7 @@ class Menu {
$data = array( $data = array(
'customFields' => $custom_fields, 'customFields' => $custom_fields,
'settings' => Setting::getAll(),
); );
wp_enqueue_media(); wp_enqueue_media();
wp_enqueue_script('tinymce-wplink', includes_url('js/tinymce/plugins/wplink/plugin.js')); wp_enqueue_script('tinymce-wplink', includes_url('js/tinymce/plugins/wplink/plugin.js'));

File diff suppressed because it is too large Load Diff

View File

@ -522,7 +522,7 @@
], ],
fonts: [ fonts: [
'Arial', 'Arial',
'Comic Sans', 'Comic Sans MS',
'Courier New', 'Courier New',
'Georgia', 'Georgia',
'Lucida', 'Lucida',
@ -976,10 +976,10 @@
backgroundColor: '#2ea1cd', backgroundColor: '#2ea1cd',
borderColor: '#0074a2', borderColor: '#0074a2',
borderWidth: '1px', borderWidth: '1px',
borderRadius: '7px', borderRadius: '5px',
borderStyle: 'solid', borderStyle: 'solid',
width: '120px', width: '180px',
lineHeight: '35px', lineHeight: '40px',
fontColor: '#ffffff', fontColor: '#ffffff',
fontFamily: 'Verdana', fontFamily: 'Verdana',
fontSize: '18px', fontSize: '18px',
@ -1241,7 +1241,9 @@
customFieldsWindowTitle: customFieldsWindowTitle:
'<%= __('Select a shortcode') %>', '<%= __('Select a shortcode') %>',
unsubscribeLinkMissing: unsubscribeLinkMissing:
'<%= __('Please include an unsubscribe link to continue.') %>', '<%= __('All newsletter must include an "unsubscribe" link. Add a footer widget to your newsletter to continue.') %>',
newsletterPreviewEmailMissing:
'<%= __('Please enter an email where newsletter preview should be sent to.') %>',
newsletterPreviewSent: newsletterPreviewSent:
'<%= __('Newsletter preview email has been successfully sent!') %>', '<%= __('Newsletter preview email has been successfully sent!') %>',
newsletterPreviewFailedToSend: newsletterPreviewFailedToSend:
@ -1264,7 +1266,7 @@
imageMissing: '<%= image_url( imageMissing: '<%= image_url(
"newsletter_editor/image-missing.svg" "newsletter_editor/image-missing.svg"
) %>', ) %>',
} },
}; };
var editor = null; var editor = null;

View File

@ -4,7 +4,7 @@
<div class="mailpoet_form_field"> <div class="mailpoet_form_field">
<label> <label>
<%= __('Send preview to') %><br /> <%= __('Send preview to') %><br />
<input id="mailpoet_preview_to_email" class="mailpoet_input mailpoet_input_full" type="text" name="to_email" value="{{ from_email }}" /> <input id="mailpoet_preview_to_email" class="mailpoet_input mailpoet_input_full" type="text" name="to_email" value="<%= settings.sender.address %>" />
</label> </label>
</div> </div>