Add new column layouts to editor

[MAILPOET-1568]
This commit is contained in:
Pavel Dohnal
2018-10-22 08:54:45 +02:00
parent fcfd6f1f09
commit 056b971f7b
7 changed files with 96 additions and 0 deletions

View File

@@ -353,6 +353,44 @@ define([
}
});
Module.TwoColumn12ContainerWidgetView = base.WidgetView.extend({
className: base.WidgetView.prototype.className + ' mailpoet_droppable_layout_block',
getTemplate: function () { return window.templates.twoColumn12LayoutInsertion; },
behaviors: {
DraggableBehavior: {
cloneOriginal: true,
drop: function () {
return new Module.ContainerBlockModel({
orientation: 'horizontal',
blocks: [
new Module.ContainerBlockModel(),
new Module.ContainerBlockModel()
]
});
}
}
}
});
Module.TwoColumn21ContainerWidgetView = base.WidgetView.extend({
className: base.WidgetView.prototype.className + ' mailpoet_droppable_layout_block',
getTemplate: function () { return window.templates.twoColumn21LayoutInsertion; },
behaviors: {
DraggableBehavior: {
cloneOriginal: true,
drop: function () {
const block1 = new Module.ContainerBlockModel();
const block2 = new Module.ContainerBlockModel();
block1.
return new Module.ContainerBlockModel({
orientation: 'horizontal',
blocks: [block1, block2],
});
}
}
}
});
App.on('before:start', function (BeforeStartApp) {
BeforeStartApp.registerBlockType('container', {
blockModel: Module.ContainerBlockModel,
@@ -376,6 +414,18 @@ define([
priority: 100,
widgetView: Module.ThreeColumnContainerWidgetView
});
BeforeStartApp.registerLayoutWidget({
name: 'twoColumn12Layout',
priority: 100,
widgetView: Module.TwoColumn12ContainerWidgetView
});
BeforeStartApp.registerLayoutWidget({
name: 'twoColumn21Layout',
priority: 100,
widgetView: Module.TwoColumn21ContainerWidgetView
});
});
return Module;