Rerender editor on global styles change

[MAILPOET-1976]
This commit is contained in:
Ján Mikláš
2019-05-29 19:56:57 +02:00
committed by M. Shull
parent 3ff1a6f83d
commit b82ed67b3d
2 changed files with 8 additions and 0 deletions

View File

@@ -163,6 +163,9 @@ Module.SidebarStylesView = Marionette.View.extend({
behaviors: {
ColorPickerBehavior: {},
},
modelEvents: {
change: 'render',
},
events: function () {
return {
'change #mailpoet_text_font_color': _.partial(this.changeColorField, 'text.fontColor'),

View File

@@ -47,6 +47,11 @@ Module.StylesModel = SuperModel.extend({
// apply model defaults recursively (not only on top level)
this.set(jQuery.extend(true, {}, this.defaults, data));
this.on('change', function () { App.getChannel().trigger('autoSave'); }); // eslint-disable-line func-names
App.getChannel().on('historyUpdate', this.onHistoryUpdate, this);
},
onHistoryUpdate: function onHistoryUpdate(json) {
this.set(json.globalStyles);
},
});