Wrap editor JS code in AMD modules and load them

This commit is contained in:
Tautvidas Sipavičius
2015-08-19 16:26:38 +03:00
parent da371e33f4
commit 40507d2cad
33 changed files with 4901 additions and 5236 deletions

View File

@ -139,4 +139,6 @@ define('handlebars_helpers', ['handlebars'], function(Handlebars) {
Handlebars.registerHelper('getNumber', function (string) {
return parseInt(string, 10);
});
window.Handlebars = Handlebars;
});

View File

@ -0,0 +1,35 @@
define('newsletter_editor/App', [
'backbone',
'backbone.marionette',
'backbone.supermodel',
'jquery',
'underscore',
'handlebars',
'handlebars_helpers',
], function(Backbone, Marionette, SuperModel, jQuery, _, Handlebars) {
var app = new Marionette.Application(), AppView;
// Decoupled communication between application components
app.getChannel = function(channel) {
if (channel === undefined) return app.channel;
return Radio.channel(channel);
};
AppView = Marionette.LayoutView.extend({
el: '#mailpoet_editor',
regions: {
stylesRegion: '#mailpoet_editor_styles',
contentRegion: '#mailpoet_editor_content',
sidebarRegion: '#mailpoet_editor_sidebar',
bottomRegion: '#mailpoet_editor_bottom',
headingRegion: '#mailpoet_editor_heading',
},
});
app.on('start', function(options) {
app._appView = new AppView();
});
window.EditorApplication = app;
return app;
});

View File

@ -4,7 +4,16 @@
*
* For more check: http://marionettejs.com/docs/marionette.behaviors.html#behaviorslookup
*/
BehaviorsLookup = {};
Backbone.Marionette.Behaviors.behaviorsLookup = function() {
define('newsletter_editor/behaviors/behaviorsLookup', [
'backbone.marionette',
], function(Marionette) {
var BehaviorsLookup = {};
Marionette.Behaviors.behaviorsLookup = function() {
return BehaviorsLookup;
};
window.BehaviorsLookup = BehaviorsLookup;
return BehaviorsLookup;
});

View File

@ -3,7 +3,13 @@
*
* Adds a color picker integration with the view
*/
BehaviorsLookup.ColorPickerBehavior = Backbone.Marionette.Behavior.extend({
define('newsletter_editor/behaviors/ColorPickerBehavior', [
'backbone.marionette',
'newsletter_editor/behaviors/BehaviorsLookup',
'spectrum-colorpicker',
], function(Marionette, BehaviorsLookup) {
BehaviorsLookup.ColorPickerBehavior = Marionette.Behavior.extend({
onRender: function() {
this.view.$('.mailpoet_color').spectrum({
clickoutFiresChange: true,
@ -14,3 +20,5 @@ BehaviorsLookup.ColorPickerBehavior = Backbone.Marionette.Behavior.extend({
});
},
});
});

View File

@ -5,7 +5,14 @@
* Allows CollectionView instances that use this behavior to act as drop zones and
* accept droppables
*/
BehaviorsLookup.ContainerDropZoneBehavior = Backbone.Marionette.Behavior.extend({
define('newsletter_editor/behaviors/ContainerDropZoneBehavior', [
'backbone.marionette',
'underscore',
'newsletter_editor/behaviors/BehaviorsLookup',
'interact.js',
], function(Marionette, _, BehaviorsLookup, interact) {
BehaviorsLookup.ContainerDropZoneBehavior = Marionette.Behavior.extend({
defaults: {
columnLimit: 3,
},
@ -417,3 +424,5 @@ BehaviorsLookup.ContainerDropZoneBehavior = Backbone.Marionette.Behavior.extend(
return depth === 0 || (depth === 1 && orientation === 'horizontal' && childCount <= this.options.columnLimit);
},
});
});

View File

@ -4,7 +4,13 @@
* Allows View instances to be draggable.
* Part of the drag&drop behavior.
*/
BehaviorsLookup.DraggableBehavior = Backbone.Marionette.Behavior.extend({
define('newsletter_editor/behaviors/DraggableBehavior', [
'backbone.marionette',
'newsletter_editor/behaviors/BehaviorsLookup',
'interact.js',
], function(Marionette, BehaviorsLookup, interact) {
BehaviorsLookup.DraggableBehavior = Marionette.Behavior.extend({
defaults: {
cloneOriginal: false,
hideOriginal: false,
@ -122,3 +128,5 @@ BehaviorsLookup.DraggableBehavior = Backbone.Marionette.Behavior.extend({
};
},
});
});

View File

@ -3,7 +3,13 @@
*
* Allows resizing elements within a block
*/
BehaviorsLookup.ResizableBehavior = Backbone.Marionette.Behavior.extend({
define('newsletter_editor/behaviors/ResizableBehavior', [
'backbone.marionette',
'newsletter_editor/behaviors/BehaviorsLookup',
'interact.js',
], function(Marionette, BehaviorsLookup, interact) {
BehaviorsLookup.ResizableBehavior = Marionette.Behavior.extend({
defaults: {
elementSelector: null,
resizeHandleSelector: true, // true will use edges of the element itself
@ -59,3 +65,5 @@ BehaviorsLookup.ResizableBehavior = Backbone.Marionette.Behavior.extend({
}
},
});
});

View File

@ -3,7 +3,12 @@
*
* Allows sorting elements within a collection
*/
BehaviorsLookup.SortableBehavior = Backbone.Marionette.Behavior.extend({
define('newsletter_editor/behaviors/SortableBehavior', [
'backbone.marionette',
'newsletter_editor/behaviors/BehaviorsLookup',
], function(Marionette, BehaviorsLookup) {
BehaviorsLookup.SortableBehavior = Marionette.Behavior.extend({
onRender: function() {
var collection = this.view.collection;
@ -32,3 +37,4 @@ BehaviorsLookup.SortableBehavior = Backbone.Marionette.Behavior.extend({
}
});
});

View File

@ -6,6 +6,14 @@
* This block depends on blocks.button and blocks.divider for block model and
* block settings view.
*/
define('newsletter_editor/blocks/automatedLatestContent', [
'newsletter_editor/App',
'backbone',
'backbone.supermodel',
'backbone.marionette',
'mailpoet',
], function(EditorApplication, Backbone, SuperModel, Marionette, MailPoet) {
EditorApplication.module("blocks.automatedLatestContent", function(Module, App, Backbone, Marionette, $, _) {
"use strict";
@ -328,3 +336,5 @@ EditorApplication.module("blocks.automatedLatestContent", function(Module, App,
});
});
});
});

View File

@ -4,12 +4,21 @@
* a BlockModel and a BlockView.
* BlockToolsView, BlockSettingsView and BlockWidgetView are optional.
*/
define('newsletter_editor/blocks/base', [
'newsletter_editor/App',
'backbone',
'backbone.supermodel',
'backbone.marionette',
'mailpoet',
'modal',
], function(EditorApplication, Backbone, SuperModel, Marionette, MailPoet) {
EditorApplication.module("blocks.base", function(Module, App, Backbone, Marionette, $, _) {
"use strict";
var AugmentedView = Marionette.LayoutView.extend({});
Module.BlockModel = Backbone.SuperModel.extend({
Module.BlockModel = SuperModel.extend({
stale: [], // Attributes to be removed upon saving
initialize: function() {
var that = this;
@ -21,14 +30,14 @@ EditorApplication.module("blocks.base", function(Module, App, Backbone, Marionet
var defaults = (_.isObject(configDefaults) && _.isFunction(configDefaults.toJSON)) ? configDefaults.toJSON() : configDefaults;
// Patch the resulting JSON object and fix it's constructors to be Object.
// Otherwise Backbone.SuperModel interprets it not as a simpleObject
// Otherwise SuperModel interprets it not as a simpleObject
// and misbehaves
// TODO: Investigate for a better solution
return JSON.parse(JSON.stringify(jQuery.extend(blockDefaults, defaults || {})));
},
toJSON: function() {
// Remove stale attributes from resulting JSON object
return _.omit(Backbone.SuperModel.prototype.toJSON.call(this), this.stale);
return _.omit(SuperModel.prototype.toJSON.call(this), this.stale);
},
});
@ -207,3 +216,5 @@ EditorApplication.module("blocks.base", function(Module, App, Backbone, Marionet
},
});
});
});

View File

@ -1,6 +1,14 @@
/**
* Button content block
*/
define('newsletter_editor/blocks/button', [
'newsletter_editor/App',
'backbone',
'backbone.supermodel',
'backbone.marionette',
'mailpoet',
], function(EditorApplication, Backbone, SuperModel, Marionette, MailPoet) {
EditorApplication.module("blocks.button", function(Module, App, Backbone, Marionette, $, _) {
"use strict";
@ -151,3 +159,5 @@ EditorApplication.module("blocks.button", function(Module, App, Backbone, Marion
});
});
});
});

View File

@ -3,6 +3,14 @@
* This is a special kind of block, as it can contain content blocks, as well
* as other containers.
*/
define('newsletter_editor/blocks/container', [
'newsletter_editor/App',
'backbone',
'backbone.supermodel',
'backbone.marionette',
'mailpoet',
], function(EditorApplication, Backbone, SuperModel, Marionette, MailPoet) {
EditorApplication.module("blocks.container", function(Module, App, Backbone, Marionette, $, _) {
"use strict";
@ -337,3 +345,5 @@ EditorApplication.module("blocks.container", function(Module, App, Backbone, Mar
});
});
});
});

View File

@ -1,6 +1,14 @@
/**
* Divider content block
*/
define('newsletter_editor/blocks/divider', [
'newsletter_editor/App',
'backbone',
'backbone.supermodel',
'backbone.marionette',
'mailpoet',
], function(EditorApplication, Backbone, SuperModel, Marionette, MailPoet) {
EditorApplication.module("blocks.divider", function(Module, App, Backbone, Marionette, $, _) {
"use strict";
@ -162,3 +170,5 @@ EditorApplication.module("blocks.divider", function(Module, App, Backbone, Mario
});
});
});
});

View File

@ -1,6 +1,14 @@
/**
* Footer content block
*/
define('newsletter_editor/blocks/footer', [
'newsletter_editor/App',
'backbone',
'backbone.supermodel',
'backbone.marionette',
'mailpoet',
], function(EditorApplication, Backbone, SuperModel, Marionette, MailPoet) {
EditorApplication.module("blocks.footer", function(Module, App, Backbone, Marionette, $, _) {
"use strict";
@ -136,3 +144,5 @@ EditorApplication.module("blocks.footer", function(Module, App, Backbone, Marion
});
});
});
});

View File

@ -1,6 +1,14 @@
/**
* Header content block
*/
define('newsletter_editor/blocks/header', [
'newsletter_editor/App',
'backbone',
'backbone.supermodel',
'backbone.marionette',
'mailpoet',
], function(EditorApplication, Backbone, SuperModel, Marionette, MailPoet) {
EditorApplication.module("blocks.header", function(Module, App, Backbone, Marionette, $, _) {
"use strict";
@ -136,3 +144,5 @@ EditorApplication.module("blocks.header", function(Module, App, Backbone, Marion
});
});
});
});

View File

@ -1,6 +1,14 @@
/**
* Image content block
*/
define('newsletter_editor/blocks/image', [
'newsletter_editor/App',
'backbone',
'backbone.supermodel',
'backbone.marionette',
'mailpoet',
], function(EditorApplication, Backbone, SuperModel, Marionette, MailPoet) {
EditorApplication.module("blocks.image", function(Module, App, Backbone, Marionette, $, _) {
"use strict";
@ -378,3 +386,5 @@ EditorApplication.module("blocks.image", function(Module, App, Backbone, Marione
});
});
});
});

View File

@ -10,6 +10,14 @@
* This block depends on blocks.button and blocks.divider for block model and
* block settings view.
*/
define('newsletter_editor/blocks/posts', [
'newsletter_editor/App',
'backbone',
'backbone.supermodel',
'backbone.marionette',
'mailpoet',
], function(EditorApplication, Backbone, SuperModel, Marionette, MailPoet) {
EditorApplication.module("blocks.posts", function(Module, App, Backbone, Marionette, $, _) {
"use strict";
@ -467,3 +475,5 @@ EditorApplication.module("blocks.posts", function(Module, App, Backbone, Marione
});
});
});
});

View File

@ -1,13 +1,21 @@
/**
* Social icons content block
*/
define('newsletter_editor/blocks/social', [
'newsletter_editor/App',
'backbone',
'backbone.supermodel',
'backbone.marionette',
'mailpoet',
], function(EditorApplication, Backbone, SuperModel, Marionette, MailPoet) {
EditorApplication.module("blocks.social", function(Module, App, Backbone, Marionette, $, _) {
"use strict";
var base = App.module('blocks.base'),
SocialBlockSettingsIconSelectorView, SocialBlockSettingsIconView, SocialBlockSettingsStylesView;
Module.SocialIconModel = Backbone.SuperModel.extend({
Module.SocialIconModel = SuperModel.extend({
defaults: function() {
var defaultValues = App.getConfig().get('socialIcons.custom');
return {
@ -363,3 +371,5 @@ EditorApplication.module("blocks.social", function(Module, App, Backbone, Marion
});
});
});
});

View File

@ -1,6 +1,14 @@
/**
* Spacer content block
*/
define('newsletter_editor/blocks/spacer', [
'newsletter_editor/App',
'backbone',
'backbone.supermodel',
'backbone.marionette',
'mailpoet',
], function(EditorApplication, Backbone, SuperModel, Marionette, MailPoet) {
EditorApplication.module("blocks.spacer", function(Module, App, Backbone, Marionette, $, _) {
"use strict";
@ -94,3 +102,5 @@ EditorApplication.module("blocks.spacer", function(Module, App, Backbone, Marion
});
});
});
});

View File

@ -1,6 +1,17 @@
/**
* Text content block
*/
define('newsletter_editor/blocks/text', [
'newsletter_editor/App',
'backbone',
'backbone.supermodel',
'backbone.marionette',
'mailpoet',
'jquery',
//'tinymce',
//'jquery.tinymce',
], function(EditorApplication, Backbone, SuperModel, Marionette, MailPoet, jQuery, TinyMCE) {
EditorApplication.module("blocks.text", function(Module, App, Backbone, Marionette, $, _) {
"use strict";
@ -114,3 +125,5 @@ EditorApplication.module("blocks.text", function(Module, App, Backbone, Marionet
});
});
});
});

View File

@ -1,7 +1,13 @@
define('newsletter_editor/components/config', [
'newsletter_editor/App',
'backbone',
'backbone.supermodel',
], function(EditorApplication, Backbone, SuperModel) {
EditorApplication.module("components.config", function(Module, App, Backbone, Marionette, $, _) {
"use strict";
Module.ConfigModel = Backbone.SuperModel.extend({
Module.ConfigModel = SuperModel.extend({
defaults: {
availableStyles: {},
socialIcons: {},
@ -26,3 +32,5 @@ EditorApplication.module("components.config", function(Module, App, Backbone, Ma
App.setConfig(options.config);
});
});
});

View File

@ -1,10 +1,17 @@
define('newsletter_editor/components/content', [
'newsletter_editor/App',
'backbone',
'backbone.supermodel',
'backbone.marionette',
], function(EditorApplication, Backbone, SuperModel, Marionette) {
EditorApplication.module("components.content", function(Module, App, Backbone, Marionette, $, _) {
"use strict";
// Holds newsletter entry fields, such as subject or creation datetime.
// Does not hold newsletter content nor newsletter styles, those are
// handled by other components.
Module.NewsletterModel = Backbone.SuperModel.extend({
Module.NewsletterModel = SuperModel.extend({
stale: ['data', 'styles'],
initialize: function(options) {
this.on('change', function() {
@ -13,7 +20,7 @@ EditorApplication.module("components.content", function(Module, App, Backbone, M
},
toJSON: function() {
// Remove stale attributes from resulting JSON object
return _.omit(Backbone.SuperModel.prototype.toJSON.call(this), this.stale);
return _.omit(SuperModel.prototype.toJSON.call(this), this.stale);
},
});
@ -70,3 +77,5 @@ EditorApplication.module("components.content", function(Module, App, Backbone, M
App._appView.contentRegion.show(App._contentContainerView);
});
});
});

View File

@ -1,3 +1,9 @@
define('newsletter_editor/components/heading', [
'newsletter_editor/App',
'backbone',
'backbone.marionette',
], function(EditorApplication, Backbone, Marionette) {
EditorApplication.module("components.heading", function(Module, App, Backbone, Marionette, $, _) {
"use strict";
@ -24,3 +30,4 @@ EditorApplication.module("components.heading", function(Module, App, Backbone, M
});
});
});

View File

@ -1,3 +1,9 @@
define('newsletter_editor/components/save', [
'newsletter_editor/App',
'backbone',
'backbone.marionette',
], function(EditorApplication, Backbone, Marionette) {
EditorApplication.module("components.save", function(Module, App, Backbone, Marionette, $, _) {
"use strict";
var saveTimeout;
@ -167,3 +173,5 @@ EditorApplication.module("components.save", function(Module, App, Backbone, Mari
App._appView.bottomRegion.show(saveView);
});
});
});

View File

@ -1,9 +1,17 @@
define('newsletter_editor/components/sidebar', [
'newsletter_editor/App',
'backbone',
'backbone.supermodel',
'backbone.marionette',
'sticky-kit',
], function(EditorApplication, Backbone, SuperModel, Marionette) {
EditorApplication.module("components.sidebar", function(Module, App, Backbone, Marionette, $, _) {
"use strict";
// Widget handlers for use to create new content blocks via drag&drop
Module._contentWidgets = new (Backbone.Collection.extend({
model: Backbone.SuperModel.extend({
model: SuperModel.extend({
defaults: {
name: '',
priority: 100,
@ -17,7 +25,7 @@ EditorApplication.module("components.sidebar", function(Module, App, Backbone, M
// Layout widget handlers for use to create new layout blocks via drag&drop
Module._layoutWidgets = new (Backbone.Collection.extend({
model: Backbone.SuperModel.extend({
model: SuperModel.extend({
defaults: {
name: '',
priority: 100,
@ -247,3 +255,5 @@ EditorApplication.module("components.sidebar", function(Module, App, Backbone, M
App._appView.sidebarRegion.show(sidebarView);
});
});
});

View File

@ -1,7 +1,14 @@
define('newsletter_editor/components/styles', [
'newsletter_editor/App',
'backbone',
'backbone.supermodel',
'backbone.marionette',
], function(EditorApplication, Backbone, SuperModel, Marionette) {
EditorApplication.module("components.styles", function(Module, App, Backbone, Marionette, $, _) {
"use strict";
Module.StylesModel = Backbone.SuperModel.extend({
Module.StylesModel = SuperModel.extend({
defaults: {
text: {
fontColor: '#000000',
@ -46,7 +53,7 @@ EditorApplication.module("components.styles", function(Module, App, Backbone, Ma
},
});
Module._globalStyles = new Backbone.SuperModel();
Module._globalStyles = new SuperModel();
Module.getGlobalStyles = function() {
return Module._globalStyles;
};
@ -73,3 +80,5 @@ EditorApplication.module("components.styles", function(Module, App, Backbone, Ma
App._appView.stylesRegion.show(stylesView);
});
});
});

File diff suppressed because it is too large Load Diff

View File

@ -1,28 +0,0 @@
var EditorApplication = (function() {
"use strict";
var app = new Backbone.Marionette.Application(), AppView;
// Decoupled communication between application components
app.getChannel = function(channel) {
if (channel === undefined) return app.channel;
return Radio.channel(channel);
};
AppView = Marionette.LayoutView.extend({
el: '#mailpoet_editor',
regions: {
stylesRegion: '#mailpoet_editor_styles',
contentRegion: '#mailpoet_editor_content',
sidebarRegion: '#mailpoet_editor_sidebar',
bottomRegion: '#mailpoet_editor_bottom',
headingRegion: '#mailpoet_editor_heading',
},
});
app.on('start', function(options) {
app._appView = new AppView();
});
return app;
})();

View File

@ -10,7 +10,7 @@
/*jshint unused:false */
/*global tinymce:true */
define('mailpoet_custom_fields', ['jquery', 'tinymce'], function(jQuery, tinymce) {
tinymce.PluginManager.add('mailpoet_custom_fields', function(editor, url) {
var appendLabelAndClose = function(text) {
editor.insertContent('[' + text + ']');
@ -57,3 +57,4 @@ tinymce.PluginManager.add('mailpoet_custom_fields', function(editor, url) {
},
});
});
});

View File

@ -82,6 +82,7 @@ class Menu {
function newsletterEditor() {
$data = array();
wp_enqueue_media();
echo $this->renderer->render('newsletter/editor.html', $data);
}
}

View File

@ -97,12 +97,13 @@
<%= partial('newsletter_editor_template_automated_latest_content_block', 'newsletter/templates/blocks/automatedLatestContent/block.hbs') %>
<%= partial('newsletter_editor_template_automated_latest_content_widget', 'newsletter/templates/blocks/automatedLatestContent/widget.hbs') %>
<%= partial('newsletter_editor_template_automated_latest_content_settings', 'newsletter/templates/blocks/automatedLatestContent/settings.hbs') %>
<%= partial('newsletter_editor_template_button_block', 'newsletter/templates/blocks/button/block.hbs') %>
<%= partial('newsletter_editor_template_button_widget', 'newsletter/templates/blocks/button/widget.hbs') %>
<%= partial('newsletter_editor_template_button_settings', 'newsletter/templates/blocks/button/settings.hbs') %>
<%= partial('newsletter_editor_template_container_block', 'newsletter/templates/blocks/container/block.hbs') %>
<%= partial('newsletter_editor_template_container_block', 'newsletter/templates/blocks/container/emptyBlock.hbs') %>
<%= partial('newsletter_editor_template_container_block_empty', 'newsletter/templates/blocks/container/emptyBlock.hbs') %>
<%= partial('newsletter_editor_template_container_one_column_widget', 'newsletter/templates/blocks/container/oneColumnLayoutWidget.hbs') %>
<%= partial('newsletter_editor_template_container_two_column_widget', 'newsletter/templates/blocks/container/twoColumnLayoutWidget.hbs') %>
<%= partial('newsletter_editor_template_container_three_column_widget', 'newsletter/templates/blocks/container/threeColumnLayoutWidget.hbs') %>
@ -133,6 +134,7 @@
<%= partial('newsletter_editor_template_posts_settings_single_post', 'newsletter/templates/blocks/posts/settingsSinglePost.hbs') %>
<%= partial('newsletter_editor_template_social_block', 'newsletter/templates/blocks/social/block.hbs') %>
<%= partial('newsletter_editor_template_social_block_icon', 'newsletter/templates/blocks/social/blockIcon.hbs') %>
<%= partial('newsletter_editor_template_social_widget', 'newsletter/templates/blocks/social/widget.hbs') %>
<%= partial('newsletter_editor_template_social_settings', 'newsletter/templates/blocks/social/settings.hbs') %>
<%= partial('newsletter_editor_template_social_settings_icon', 'newsletter/templates/blocks/social/settingsIcon.hbs') %>
@ -152,10 +154,670 @@
<%= partial('newsletter_editor_template_styles', 'newsletter/templates/components/styles.hbs') %>
<%= partial('newsletter_editor_template_sidebar', 'newsletter/templates/components/sidebar/sidebar.hbs') %>
<%= partial('newsletter_editor_template_content', 'newsletter/templates/components/sidebar/content.hbs') %>
<%= partial('newsletter_editor_template_layout', 'newsletter/templates/components/sidebar/layout.hbs') %>
<%= partial('newsletter_editor_template_preview', 'newsletter/templates/components/sidebar/preview.hbs') %>
<%= partial('newsletter_editor_template_styles', 'newsletter/templates/components/sidebar/styles.hbs') %>
<%= partial('newsletter_editor_template_sidebar_content', 'newsletter/templates/components/sidebar/content.hbs') %>
<%= partial('newsletter_editor_template_sidebar_layout', 'newsletter/templates/components/sidebar/layout.hbs') %>
<%= partial('newsletter_editor_template_sidebar_preview', 'newsletter/templates/components/sidebar/preview.hbs') %>
<%= partial('newsletter_editor_template_sidebar_styles', 'newsletter/templates/components/sidebar/styles.hbs') %>
<%= stylesheet('newsletter_editor.css') %>
<%= stylesheet(
'lib/select2/select2.css',
'lib/spectrum.css',
'newsletter_editor.css'
) %>
<%= javascript(
'vendor.js',
'newsletter_editor.js'
) %>
<script type="text/javascript">
var templates = {
styles: Handlebars.compile(jQuery('#newsletter_editor_template_styles').html()),
save: Handlebars.compile(jQuery('#newsletter_editor_template_save').html()),
heading: Handlebars.compile(jQuery('#newsletter_editor_template_heading').html()),
sidebar: Handlebars.compile(jQuery('#newsletter_editor_template_sidebar').html()),
sidebarContent: Handlebars.compile(jQuery('#newsletter_editor_template_sidebar_content').html()),
sidebarLayout: Handlebars.compile(jQuery('#newsletter_editor_template_sidebar_layout').html()),
sidebarStyles: Handlebars.compile(jQuery('#newsletter_editor_template_sidebar_styles').html()),
sidebarPreview: Handlebars.compile(jQuery('#newsletter_editor_template_sidebar_preview').html()),
genericBlockTools: Handlebars.compile(jQuery('#newsletter_editor_template_tools_generic').html()),
containerBlock: Handlebars.compile(jQuery('#newsletter_editor_template_container_block').html()),
containerEmpty: Handlebars.compile(jQuery('#newsletter_editor_template_container_block_empty').html()),
oneColumnLayoutInsertion: Handlebars.compile(jQuery('#newsletter_editor_template_container_one_column_widget').html()),
twoColumnLayoutInsertion: Handlebars.compile(jQuery('#newsletter_editor_template_container_two_column_widget').html()),
threeColumnLayoutInsertion: Handlebars.compile(jQuery('#newsletter_editor_template_container_three_column_widget').html()),
containerBlockSettings: Handlebars.compile(jQuery('#newsletter_editor_template_container_settings').html()),
buttonBlock: Handlebars.compile(jQuery('#newsletter_editor_template_button_block').html()),
buttonInsertion: Handlebars.compile(jQuery('#newsletter_editor_template_button_widget').html()),
buttonBlockSettings: Handlebars.compile(jQuery('#newsletter_editor_template_button_settings').html()),
dividerBlock: Handlebars.compile(jQuery('#newsletter_editor_template_divider_block').html()),
dividerInsertion: Handlebars.compile(jQuery('#newsletter_editor_template_divider_widget').html()),
dividerBlockSettings: Handlebars.compile(jQuery('#newsletter_editor_template_divider_settings').html()),
footerBlock: Handlebars.compile(jQuery('#newsletter_editor_template_footer_block').html()),
footerInsertion: Handlebars.compile(jQuery('#newsletter_editor_template_footer_widget').html()),
footerBlockSettings: Handlebars.compile(jQuery('#newsletter_editor_template_footer_settings').html()),
headerBlock: Handlebars.compile(jQuery('#newsletter_editor_template_header_block').html()),
headerInsertion: Handlebars.compile(jQuery('#newsletter_editor_template_header_widget').html()),
headerBlockSettings: Handlebars.compile(jQuery('#newsletter_editor_template_header_settings').html()),
imageBlock: Handlebars.compile(jQuery('#newsletter_editor_template_image_block').html()),
imageInsertion: Handlebars.compile(jQuery('#newsletter_editor_template_image_widget').html()),
imageBlockSettings: Handlebars.compile(jQuery('#newsletter_editor_template_image_settings').html()),
socialBlock: Handlebars.compile(jQuery('#newsletter_editor_template_social_block').html()),
socialIconBlock: Handlebars.compile(jQuery('#newsletter_editor_template_social_block_icon').html()),
socialInsertion: Handlebars.compile(jQuery('#newsletter_editor_template_social_widget').html()),
socialBlockSettings: Handlebars.compile(jQuery('#newsletter_editor_template_social_settings').html()),
socialSettingsIconSelector: Handlebars.compile(jQuery('#newsletter_editor_template_social_settings_icon_selector').html()),
socialSettingsIcon: Handlebars.compile(jQuery('#newsletter_editor_template_social_settings_icon').html()),
socialSettingsStyles: Handlebars.compile(jQuery('#newsletter_editor_template_social_settings_styles').html()),
spacerBlock: Handlebars.compile(jQuery('#newsletter_editor_template_spacer_block').html()),
spacerInsertion: Handlebars.compile(jQuery('#newsletter_editor_template_spacer_widget').html()),
spacerBlockSettings: Handlebars.compile(jQuery('#newsletter_editor_template_spacer_settings').html()),
automatedLatestContentBlock: Handlebars.compile(jQuery('#newsletter_editor_template_automated_latest_content_block').html()),
automatedLatestContentInsertion: Handlebars.compile(jQuery('#newsletter_editor_template_automated_latest_content_widget').html()),
automatedLatestContentBlockSettings: Handlebars.compile(jQuery('#newsletter_editor_template_automated_latest_content_settings').html()),
postsBlock: Handlebars.compile(jQuery('#newsletter_editor_template_posts_block').html()),
postsInsertion: Handlebars.compile(jQuery('#newsletter_editor_template_posts_widget').html()),
postsBlockSettings: Handlebars.compile(jQuery('#newsletter_editor_template_posts_settings').html()),
postSelectionPostsBlockSettings: Handlebars.compile(jQuery('#newsletter_editor_template_posts_settings_selection').html()),
emptyPostPostsBlockSettings: Handlebars.compile(jQuery('#newsletter_editor_template_posts_settings_selection_empty').html()),
singlePostPostsBlockSettings: Handlebars.compile(jQuery('#newsletter_editor_template_posts_settings_single_post').html()),
displayOptionsPostsBlockSettings: Handlebars.compile(jQuery('#newsletter_editor_template_posts_settings_display_options').html()),
textBlock: Handlebars.compile(jQuery('#newsletter_editor_template_text_block').html()),
textInsertion: Handlebars.compile(jQuery('#newsletter_editor_template_text_widget').html()),
textBlockSettings: Handlebars.compile(jQuery('#newsletter_editor_template_text_settings').html()),
};
</script>
<script type="text/javascript">
var newsletter = {
data: {},
styles: {
text: {
fontColor: "#565656",
fontFamily: "Arial",
fontSize: "16px"
},
h1: {
fontColor: "#565656",
fontFamily: "Arial",
fontSize: "36px"
},
h2: {
fontColor: "#565656",
fontFamily: "Arial",
fontSize: "26px"
},
h3: {
fontColor: "#565656",
fontFamily: "Arial",
fontSize: "18px"
},
link: {
fontColor: "#a86b6b",
textDecoration: "underline"
},
newsletter: {
backgroundColor: "#999999"
},
background: {
backgroundColor: "#333333"
}
},
}, config = {
availableStyles: {
textSizes: [
'9px', '10px', '11px', '12px', '13px', '14px', '15px', '16px', '17px', '18px', '19px', '20px', '21px', '22px', '23px', '24px',
],
headingSizes: [
'10px', '12px', '14px', '16px', '18px', '20px', '22px', '24px', '26px', '30px', '36px', '40px',
],
fonts: [
'Arial',
'Comic Sans',
'Courier New',
'Georgia',
'Lucida',
'Tahoma',
'Times New Roman',
'Trebuchet MS',
'Verdana',
],
socialIconSets: {
'default': {
'custom': '<%= 'assets/img/newsletter_editor/social-icons/custom.png' %>',
'facebook': '<%= 'assets/img/newsletter_editor/social-icons/01-social/Facebook.png' %>',
'twitter': '<%= 'assets/img/newsletter_editor/social-icons/01-social/Twitter.png' %>',
'google-plus': '<%= 'assets/img/newsletter_editor/social-icons/01-social/Google-Plus.png' %>',
'youtube': '<%= 'assets/img/newsletter_editor/social-icons/01-social/Youtube.png' %>',
'website': '<%= 'assets/img/newsletter_editor/social-icons/01-social/Website.png' %>',
'email': '<%= 'assets/img/newsletter_editor/social-icons/01-social/Email.png' %>',
'instagram': '<%= 'assets/img/newsletter_editor/social-icons/01-social/Instagram.png' %>',
'pinterest': '<%= 'assets/img/newsletter_editor/social-icons/01-social/Pinterest.png' %>',
'linkedin': '<%= 'assets/img/newsletter_editor/social-icons/01-social/LinkedIn.png' %>',
},
'grey': {
'custom': '<%= 'assets/img/newsletter_editor/social-icons/custom.png' %>',
'facebook': '<%= 'assets/img/newsletter_editor/social-icons/02-grey/Facebook.png' %>',
'twitter': '<%= 'assets/img/newsletter_editor/social-icons/02-grey/Twitter.png' %>',
'google-plus': '<%= 'assets/img/newsletter_editor/social-icons/02-grey/Google-Plus.png' %>',
'youtube': '<%= 'assets/img/newsletter_editor/social-icons/02-grey/Youtube.png' %>',
'website': '<%= 'assets/img/newsletter_editor/social-icons/02-grey/Website.png' %>',
'email': '<%= 'assets/img/newsletter_editor/social-icons/02-grey/Email.png' %>',
'instagram': '<%= 'assets/img/newsletter_editor/social-icons/02-grey/Instagram.png' %>',
'pinterest': '<%= 'assets/img/newsletter_editor/social-icons/02-grey/Pinterest.png' %>',
'linkedin': '<%= 'assets/img/newsletter_editor/social-icons/02-grey/LinkedIn.png' %>',
},
'circles': {
'custom': '<%= 'assets/img/newsletter_editor/social-icons/custom.png' %>',
'facebook': '<%= 'assets/img/newsletter_editor/social-icons/03-circles/Facebook.png' %>',
'twitter': '<%= 'assets/img/newsletter_editor/social-icons/03-circles/Twitter.png' %>',
'google-plus': '<%= 'assets/img/newsletter_editor/social-icons/03-circles/Google-Plus.png' %>',
'youtube': '<%= 'assets/img/newsletter_editor/social-icons/03-circles/Youtube.png' %>',
'website': '<%= 'assets/img/newsletter_editor/social-icons/03-circles/Website.png' %>',
'email': '<%= 'assets/img/newsletter_editor/social-icons/03-circles/Email.png' %>',
'instagram': '<%= 'assets/img/newsletter_editor/social-icons/03-circles/Instagram.png' %>',
'pinterest': '<%= 'assets/img/newsletter_editor/social-icons/03-circles/Pinterest.png' %>',
'linkedin': '<%= 'assets/img/newsletter_editor/social-icons/03-circles/LinkedIn.png' %>',
},
'full-flat-roundrect': {
'custom': '<%= 'assets/img/newsletter_editor/social-icons/custom.png' %>',
'facebook': '<%= 'assets/img/newsletter_editor/social-icons/04-full-flat-roundrect/Facebook.png' %>',
'twitter': '<%= 'assets/img/newsletter_editor/social-icons/04-full-flat-roundrect/Twitter.png' %>',
'google-plus': '<%= 'assets/img/newsletter_editor/social-icons/04-full-flat-roundrect/Google-Plus.png' %>',
'youtube': '<%= 'assets/img/newsletter_editor/social-icons/04-full-flat-roundrect/Youtube.png' %>',
'website': '<%= 'assets/img/newsletter_editor/social-icons/04-full-flat-roundrect/Website.png' %>',
'email': '<%= 'assets/img/newsletter_editor/social-icons/04-full-flat-roundrect/Email.png' %>',
'instagram': '<%= 'assets/img/newsletter_editor/social-icons/04-full-flat-roundrect/Instagram.png' %>',
'pinterest': '<%= 'assets/img/newsletter_editor/social-icons/04-full-flat-roundrect/Pinterest.png' %>',
'linkedin': '<%= 'assets/img/newsletter_editor/social-icons/04-full-flat-roundrect/LinkedIn.png' %>',
},
'full-gradient-square': {
'custom': '<%= 'assets/img/newsletter_editor/social-icons/custom.png' %>',
'facebook': '<%= 'assets/img/newsletter_editor/social-icons/05-full-gradient-square/Facebook.png' %>',
'twitter': '<%= 'assets/img/newsletter_editor/social-icons/05-full-gradient-square/Twitter.png' %>',
'google-plus': '<%= 'assets/img/newsletter_editor/social-icons/05-full-gradient-square/Google-Plus.png' %>',
'youtube': '<%= 'assets/img/newsletter_editor/social-icons/05-full-gradient-square/Youtube.png' %>',
'website': '<%= 'assets/img/newsletter_editor/social-icons/05-full-gradient-square/Website.png' %>',
'email': '<%= 'assets/img/newsletter_editor/social-icons/05-full-gradient-square/Email.png' %>',
'instagram': '<%= 'assets/img/newsletter_editor/social-icons/05-full-gradient-square/Instagram.png' %>',
'pinterest': '<%= 'assets/img/newsletter_editor/social-icons/05-full-gradient-square/Pinterest.png' %>',
'linkedin': '<%= 'assets/img/newsletter_editor/social-icons/05-full-gradient-square/LinkedIn.png' %>',
},
'full-symbol-color': {
'custom': '<%= 'assets/img/newsletter_editor/social-icons/custom.png' %>',
'facebook': '<%= 'assets/img/newsletter_editor/social-icons/06-full-symbol-color/Facebook.png' %>',
'twitter': '<%= 'assets/img/newsletter_editor/social-icons/06-full-symbol-color/Twitter.png' %>',
'google-plus': '<%= 'assets/img/newsletter_editor/social-icons/06-full-symbol-color/Google-Plus.png' %>',
'youtube': '<%= 'assets/img/newsletter_editor/social-icons/06-full-symbol-color/Youtube.png' %>',
'website': '<%= 'assets/img/newsletter_editor/social-icons/06-full-symbol-color/Website.png' %>',
'email': '<%= 'assets/img/newsletter_editor/social-icons/06-full-symbol-color/Email.png' %>',
'instagram': '<%= 'assets/img/newsletter_editor/social-icons/06-full-symbol-color/Instagram.png' %>',
'pinterest': '<%= 'assets/img/newsletter_editor/social-icons/06-full-symbol-color/Pinterest.png' %>',
'linkedin': '<%= 'assets/img/newsletter_editor/social-icons/06-full-symbol-color/LinkedIn.png' %>',
},
'full-symbol-black': {
'custom': '<%= 'assets/img/newsletter_editor/social-icons/custom.png' %>',
'facebook': '<%= 'assets/img/newsletter_editor/social-icons/07-full-symbol-black/Facebook.png' %>',
'twitter': '<%= 'assets/img/newsletter_editor/social-icons/07-full-symbol-black/Twitter.png' %>',
'google-plus': '<%= 'assets/img/newsletter_editor/social-icons/07-full-symbol-black/Google-Plus.png' %>',
'youtube': '<%= 'assets/img/newsletter_editor/social-icons/07-full-symbol-black/Youtube.png' %>',
'website': '<%= 'assets/img/newsletter_editor/social-icons/07-full-symbol-black/Website.png' %>',
'email': '<%= 'assets/img/newsletter_editor/social-icons/07-full-symbol-black/Email.png' %>',
'instagram': '<%= 'assets/img/newsletter_editor/social-icons/07-full-symbol-black/Instagram.png' %>',
'pinterest': '<%= 'assets/img/newsletter_editor/social-icons/07-full-symbol-black/Pinterest.png' %>',
'linkedin': '<%= 'assets/img/newsletter_editor/social-icons/07-full-symbol-black/LinkedIn.png' %>',
},
'full-symbol-grey': {
'custom': '<%= 'assets/img/newsletter_editor/social-icons/custom.png' %>',
'facebook': '<%= 'assets/img/newsletter_editor/social-icons/08-full-symbol-grey/Facebook.png' %>',
'twitter': '<%= 'assets/img/newsletter_editor/social-icons/08-full-symbol-grey/Twitter.png' %>',
'google-plus': '<%= 'assets/img/newsletter_editor/social-icons/08-full-symbol-grey/Google-Plus.png' %>',
'youtube': '<%= 'assets/img/newsletter_editor/social-icons/08-full-symbol-grey/Youtube.png' %>',
'website': '<%= 'assets/img/newsletter_editor/social-icons/08-full-symbol-grey/Website.png' %>',
'email': '<%= 'assets/img/newsletter_editor/social-icons/08-full-symbol-grey/Email.png' %>',
'instagram': '<%= 'assets/img/newsletter_editor/social-icons/08-full-symbol-grey/Instagram.png' %>',
'pinterest': '<%= 'assets/img/newsletter_editor/social-icons/08-full-symbol-grey/Pinterest.png' %>',
'linkedin': '<%= 'assets/img/newsletter_editor/social-icons/08-full-symbol-grey/LinkedIn.png' %>',
},
'line-roundrect': {
'custom': '<%= 'assets/img/newsletter_editor/social-icons/custom.png' %>',
'facebook': '<%= 'assets/img/newsletter_editor/social-icons/09-line-roundrect/Facebook.png' %>',
'twitter': '<%= 'assets/img/newsletter_editor/social-icons/09-line-roundrect/Twitter.png' %>',
'google-plus': '<%= 'assets/img/newsletter_editor/social-icons/09-line-roundrect/Google-Plus.png' %>',
'youtube': '<%= 'assets/img/newsletter_editor/social-icons/09-line-roundrect/Youtube.png' %>',
'website': '<%= 'assets/img/newsletter_editor/social-icons/09-line-roundrect/Website.png' %>',
'email': '<%= 'assets/img/newsletter_editor/social-icons/09-line-roundrect/Email.png' %>',
'instagram': '<%= 'assets/img/newsletter_editor/social-icons/09-line-roundrect/Instagram.png' %>',
'pinterest': '<%= 'assets/img/newsletter_editor/social-icons/09-line-roundrect/Pinterest.png' %>',
'linkedin': '<%= 'assets/img/newsletter_editor/social-icons/09-line-roundrect/LinkedIn.png' %>',
},
'line-square': {
'custom': '<%= 'assets/img/newsletter_editor/social-icons/custom.png' %>',
'facebook': '<%= 'assets/img/newsletter_editor/social-icons/10-line-square/Facebook.png' %>',
'twitter': '<%= 'assets/img/newsletter_editor/social-icons/10-line-square/Twitter.png' %>',
'google-plus': '<%= 'assets/img/newsletter_editor/social-icons/10-line-square/Google-Plus.png' %>',
'youtube': '<%= 'assets/img/newsletter_editor/social-icons/10-line-square/Youtube.png' %>',
'website': '<%= 'assets/img/newsletter_editor/social-icons/10-line-square/Website.png' %>',
'email': '<%= 'assets/img/newsletter_editor/social-icons/10-line-square/Email.png' %>',
'instagram': '<%= 'assets/img/newsletter_editor/social-icons/10-line-square/Instagram.png' %>',
'pinterest': '<%= 'assets/img/newsletter_editor/social-icons/10-line-square/Pinterest.png' %>',
'linkedin': '<%= 'assets/img/newsletter_editor/social-icons/10-line-square/LinkedIn.png' %>',
},
},
dividers: [
'hidden',
'dotted',
'dashed',
'solid',
'double',
'groove',
'ridge',
],
},
socialIcons: {
'facebook': {
title: 'Facebook',
linkFieldName: '<%= __('Link') %>',
defaultLink: 'http://www.facebook.com',
},
'twitter': {
title: 'Twitter',
linkFieldName: '<%= __('Link') %>',
defaultLink: 'http://www.twitter.com',
},
'google-plus': {
title: 'Google Plus',
linkFieldName: '<%= __('Link') %>',
defaultLink: 'http://plus.google.com',
},
'youtube': {
title: 'Youtube',
linkFieldName: '<%= __('Link') %>',
defaultLink: 'http://www.youtube.com',
},
'website': {
title: '<%= __('Website') %>',
linkFieldName: '<%= __('Link') %>',
defaultLink: 'http://example.org',
},
'email': {
title: '<%= __('Email') %>',
linkFieldName: '<%= __('Email') %>',
defaultLink: 'mailto:mail@example.org',
},
'instagram': {
title: 'Instagram',
linkFieldName: '<%= __('Link') %>',
defaultLink: 'http://instagram.com',
},
'pinterest': {
title: 'Pinterest',
linkFieldName: '<%= __('Link') %>',
defaultLink: 'http://www.pinterest.com',
},
'linkedin': {
title: 'LinkedIn',
linkFieldName: '<%= __('Link') %>',
defaultLink: 'http://www.linkedin.com',
},
'custom': {
title: '<%= __('Custom') %>',
linkFieldName: '<%= __('Link') %>',
defaultLink: 'http://example.org',
},
},
blockDefaults: {
automatedLatestContent: {
amount: '5',
contentType: 'post', // 'post'|'page'|'mailpoet_page'
inclusionType: 'include', // 'include'|'exclude'
displayType: 'excerpt', // 'excerpt'|'full'|'titleOnly'
titleFormat: 'h1', // 'h1'|'h2'|'h3'|'ul'
titlePosition: 'inTextBlock', // 'inTextBlock'|'aboveBlock',
titleAlignment: 'left', // 'left'|'center'|'right'
titleIsLink: false, // false|true
imagePadded: true, // true|false
showAuthor: 'no', // 'no'|'aboveText'|'belowText'
authorPrecededBy: '<%= __('Author:') %>',
showCategories: 'no', // 'no'|'aboveText'|'belowText'
categoriesPrecededBy: '<%= __('Categories:') %>',
readMoreType: 'button', // 'link'|'button'
readMoreText: 'Read more', // 'link'|'button'
readMoreButton: {
text: '<%= __('Read more') %>',
url: '[postLink]',
styles: {
block: {
backgroundColor: '#ffffff',
borderColor: '#00ddff',
borderWidth: '1px',
borderRadius: '5px',
borderStyle: 'solid',
width: '120px',
lineHeight: '30px',
fontColor: '#00ddff',
fontFamily: 'Arial',
fontSize: '20px',
textAlign: 'center',
},
},
},
sortBy: 'newest', // 'newest'|'oldest',
showDivider: true, // true|false
divider: {
styles: {
block: {
backgroundColor: 'transparent',
padding: '13px',
borderStyle: 'solid',
borderWidth: '3px',
borderColor: '#aaaaaa',
},
},
},
backgroundColor: '#ffffff',
backgroundColorAlternate: '#eeeeee',
},
button: {
text: '<%= __('Button') %>',
url: 'http://example.org',
styles: {
block: {
backgroundColor: '#2ea1cd',
borderColor: '#0074a2',
borderWidth: '1px',
borderRadius: '7px',
borderStyle: 'solid',
width: '120px',
lineHeight: '35px',
fontColor: '#ffffff',
fontFamily: 'Verdana',
fontSize: '18px',
textAlign: 'center',
},
},
},
container: {
styles: {
block: {
backgroundColor: 'transparent',
},
},
},
divider: {
styles: {
block: {
backgroundColor: 'transparent',
padding: '13px',
borderStyle: 'solid',
borderWidth: '3px',
borderColor: '#aaaaaa',
},
},
},
footer: {
text: '<a href="[unsubscribeUrl]"><%= __('Unsubscribe') %></a> | <a href="[manageSubscriptionUrl]"><%= __('Manage subscription') %></a><br /><b><%= __('Add your postal address here!') %></b>',
styles: {
block: {
backgroundColor: 'transparent',
},
text: {
fontColor: '#222222',
fontFamily: 'Arial',
fontSize: '12px',
textAlign: 'center',
},
link: {
fontColor: '#6cb7d4',
textDecoration: 'none',
},
},
},
image: {
link: 'http://example.org',
src: '<%= 'assets/img/newsletter_editor/pigeon.png' %>',
alt: '<%= __('An image of...') %>',
padded: true,
width: '281px',
height: '190px',
styles: {
block: {
textAlign: 'center',
},
},
},
posts: {
amount: '10',
contentType: 'post', // 'post'|'page'|'mailpoet_page'
postStatus: 'publish', // 'draft'|'pending'|'private'|'publish'|'future'
inclusionType: 'include', // 'include'|'exclude'
displayType: 'excerpt', // 'excerpt'|'full'|'titleOnly'
titleFormat: 'h1', // 'h1'|'h2'|'h3'|'ul'
titlePosition: 'inTextBlock', // 'inTextBlock'|'aboveBlock',
titleAlignment: 'left', // 'left'|'center'|'right'
titleIsLink: false, // false|true
imagePadded: true, // true|false
showAuthor: 'no', // 'no'|'aboveText'|'belowText'
authorPrecededBy: '<%= __('Author:') %>',
showCategories: 'no', // 'no'|'aboveText'|'belowText'
categoriesPrecededBy: '<%= __('Categories:') %>',
readMoreType: 'link', // 'link'|'button'
readMoreText: 'Read more', // 'link'|'button'
readMoreButton: {
text: '<%= __('Read more') %>',
url: '[postLink]',
styles: {
block: {
backgroundColor: '#ffffff',
borderColor: '#000000',
borderWidth: '1px',
borderRadius: '5px',
borderStyle: 'solid',
width: '120px',
lineHeight: '30px',
fontColor: '#000000',
fontFamily: 'Arial',
fontSize: '20px',
textAlign: 'center',
},
},
},
sortBy: 'newest', // 'newest'|'oldest',
showDivider: true, // true|false
divider: {
styles: {
block: {
backgroundColor: 'transparent',
padding: '13px',
borderStyle: 'solid',
borderWidth: '3px',
borderColor: '#aaaaaa',
},
},
},
backgroundColor: '#ffffff',
backgroundColorAlternate: '#eeeeee',
},
social: {
iconSet: 'default',
icons: [
{
type: 'socialIcon',
iconType: 'facebook',
link: 'http://example.com',
image: '<%= 'assets/img/newsletter_editor/social-icons/01-social/Facebook.png' %>',
height: '32px',
width: '32px',
text: '<%= __('Facebook') %>',
},
{
type: 'socialIcon',
iconType: 'twitter',
link: 'http://example.com',
image: '<%= 'assets/img/newsletter_editor/social-icons/01-social/Twitter.png' %>',
height: '32px',
width: '32px',
text: '<%= __('Twitter') %>',
},
],
},
spacer: {
styles: {
block: {
backgroundColor: 'transparent',
height: '40px',
},
},
},
text: {
text: '<%= __('Edit this to insert text') %>',
},
header: {
text: '<%= __('Display problems?') %> <a href="[viewInBrowserUrl]"><%= __('View it in your browser') %></a>',
styles: {
block: {
backgroundColor: 'transparent',
},
text: {
fontColor: '#222222',
fontFamily: 'Arial',
fontSize: '12px',
textAlign: 'center',
},
link: {
fontColor: '#6cb7d4',
textDecoration: 'underline',
},
},
},
},
customFields: {
'<%= __('Subscriber') %>': [
{
text: '<%= __('First Name') %>',
shortcode: 'user:firstname | default:reader',
},
{
text: '<%= __('Last Name') %>',
shortcode: 'user:lastname | default:reader',
},
{
text: '<%= __('Email Address') %>',
shortcode: 'user:email',
},
{
text: '<%= __('Wordpress user display name') %>',
shortcode: 'user:displayname | default:member',
},
{
text: '<%= __('Total of subscribers') %>',
shortcode: 'user:count',
},
],
'<%= __('Newsletter') %>': [
{
text: '<%= __('Newsletter Subject') %>',
shortcode: 'newsletter:subject',
},
],
'<%= __('Post Notifications') %>': [
{
text: '<%= __('Total number of posts or pages') %>',
shortcode: 'newsletter:total',
},
{
text: '<%= __('Latest post title') %>',
shortcode: 'newsletter:post_title',
},
{
text: '<%= __('Issue number') %>',
shortcode: 'newsletter:number',
},
],
'<%= __('Date') %>': [
{
text: '<%= __('Current day of the month number') %>',
shortcode: 'date:d',
},
{
text: '<%= __('Current day of the month in ordinal, ie. 2nd, 3rd, etc.') %>',
shortcode: 'date:dordinal',
},
{
text: '<%= __('Full name of current day') %>',
shortcode: 'date:dtext',
},
{
text: '<%= __('Current month number') %>',
shortcode: 'date:m',
},
{
text: '<%= __('Full name of current month') %>',
shortcode: 'date:mtext',
},
{
text: '<%= __('Year') %>',
shortcode: 'date:y',
},
],
'<%= __('Links') %>': [
{
text: '<%= __('Unsubscribe link') %>',
shortcode: 'global:unsubscribe',
},
{
text: '<%= __('Edit subscription page link') %>',
shortcode: 'global:manage',
},
{
text: '<%= __('View in browser link') %>',
shortcode: 'global:browser',
},
],
'<%= __('Custom fields') %>': [
{
text: '<%= __('Temporary sample custom field') %>',
shortcode: 'custom:samplefield',
},
],
},
translations: {
customFieldsWindowTitle: '<%= __('Select a shortcode') %>',
unsubscribeLinkMissing: '<%= __('Please include an unsubscribe link to continue.') %>',
testEmailSent: '<%= __('Test email succesfully sent!') %>',
unknownErrorOccurred: '<%= __('An unknown error occurred, please check your settings.') %>',
},
sidepanelWidth: '331px',
validation: {
validateUnsubscribeLinkPresent: true, // TODO: Add validation based on whether Mailpoet MTA is used or not
},
urls: {
termSearch: ajaxurl + '?action=mailpoet_ajax&mailpoet_file=search_terms.php',
send: '?page=mailpoet-newsletters&action=send&newsletter=1', // TODO: Add saving path based on newsletter id
imageMissing: '<%= 'assets/img/newsletter_editor/image-missing.svg' %>',
},
};
// start editor
var editor = EditorApplication.start({
newsletter: newsletter,
config: config,
});
</script>
<% endblock %>

View File

@ -1,2 +1,2 @@
<div class="mailpoet_container_empty">{{#if isRoot}}<?php _e('Drop layout here'); ?>{{else}}<?php _e('Drop content here'); ?>{{/if}}</div>
<div class="mailpoet_container_empty">{{#if isRoot}}<%= __('Drop layout here') %>{{else}}<%= __('Drop content here') %>{{/if}}</div>
{{debug}}

View File

@ -17,7 +17,11 @@ baseConfig = {
],
alias: {
'handlebars': 'handlebars/dist/handlebars.js',
},
'backbone.marionette': 'backbone.marionette/lib/backbone.marionette',
'sticky-kit': 'sticky-kit/jquery.sticky-kit',
//'tinymce': 'tinymce/tinymce.jquery',
//'jquery.tinymce': 'tinymce/jquery.tinymce.min.js',
}
},
node: {
fs: 'empty'
@ -45,7 +49,54 @@ config.push(_.extend({}, baseConfig, {
'newsletters/newsletters.jsx',
'newsletters/list.jsx',
'newsletters/form.jsx'
]
],
newsletter_editor: [
'underscore',
'backbone',
'backbone.marionette',
'backbone.supermodel/build/backbone.supermodel.amd',
'interact.js',
'backbone.radio',
//'moment-with-locales',
'tinymce/tinymce.jquery.js',
'tinymce/jquery.tinymce.min.js',
//'tinymce',
//'jquery.tinymce',
'select2',
'spectrum-colorpicker',
'sticky-kit',
//'newsletter_editor/tinymce/wplink.js',
//'newsletter_editor/tinymce/mailpoet_custom_fields/plugin.js',
'newsletter_editor/communicationsFix.js',
'newsletter_editor/App',
'newsletter_editor/components/config.js',
'newsletter_editor/components/styles.js',
'newsletter_editor/components/sidebar.js',
'newsletter_editor/components/content.js',
'newsletter_editor/components/heading.js',
'newsletter_editor/components/save.js',
'newsletter_editor/behaviors/BehaviorsLookup.js',
'newsletter_editor/behaviors/ColorPickerBehavior.js',
'newsletter_editor/behaviors/ContainerDropZoneBehavior.js',
'newsletter_editor/behaviors/DraggableBehavior.js',
'newsletter_editor/behaviors/ResizableBehavior.js',
'newsletter_editor/behaviors/SortableBehavior.js',
'newsletter_editor/blocks/base.js',
'newsletter_editor/blocks/container.js',
'newsletter_editor/blocks/button.js',
'newsletter_editor/blocks/image.js',
'newsletter_editor/blocks/divider.js',
'newsletter_editor/blocks/text.js',
'newsletter_editor/blocks/spacer.js',
'newsletter_editor/blocks/footer.js',
'newsletter_editor/blocks/header.js',
'newsletter_editor/blocks/automatedLatestContent.js',
'newsletter_editor/blocks/posts.js',
'newsletter_editor/blocks/social.js',
],
},
plugins: [
new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.js'),