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
line-height: 1.61803398875
p
p, h1, h2, h3, h4, h5, h6
line-height: 1.61803398875
font-style: normal

View File

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

View File

@ -230,15 +230,17 @@ define([
json.body = JSON.stringify(json.body);
}
MailPoet.Modal.loading(true);
MailPoet.Ajax.post({
endpoint: 'newsletters',
action: 'render',
data: json,
}).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');
}).fail(function(error) {
console.log('Preview error', json);
MailPoet.Modal.loading(false);
alert('Something went wrong, check console');
});
},
@ -246,11 +248,23 @@ define([
// testing sending method
console.log('trying to send a preview');
// get form data
var $emailField = this.$('#mailpoet_preview_to_email');
var data = {
subscriber: this.$('#mailpoet_preview_to_email').val(),
subscriber: $emailField.val(),
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
MailPoet.Modal.loading(true);

View File

@ -380,6 +380,7 @@ class Menu {
$data = array(
'customFields' => $custom_fields,
'settings' => Setting::getAll(),
);
wp_enqueue_media();
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: [
'Arial',
'Comic Sans',
'Comic Sans MS',
'Courier New',
'Georgia',
'Lucida',
@ -976,10 +976,10 @@
backgroundColor: '#2ea1cd',
borderColor: '#0074a2',
borderWidth: '1px',
borderRadius: '7px',
borderRadius: '5px',
borderStyle: 'solid',
width: '120px',
lineHeight: '35px',
width: '180px',
lineHeight: '40px',
fontColor: '#ffffff',
fontFamily: 'Verdana',
fontSize: '18px',
@ -1241,7 +1241,9 @@
customFieldsWindowTitle:
'<%= __('Select a shortcode') %>',
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:
'<%= __('Newsletter preview email has been successfully sent!') %>',
newsletterPreviewFailedToSend:
@ -1264,7 +1266,7 @@
imageMissing: '<%= image_url(
"newsletter_editor/image-missing.svg"
) %>',
}
},
};
var editor = null;

View File

@ -4,7 +4,7 @@
<div class="mailpoet_form_field">
<label>
<%= __('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>
</div>