editor: Update defaults in social block and use stored defaults for new social block

This commit is contained in:
Rostislav Wolny
2018-03-12 15:19:36 +01:00
parent 1df25aef76
commit f6374d0602
2 changed files with 26 additions and 24 deletions

View File

@@ -69,6 +69,7 @@ define([
initialize: function () {
this.get('icons').on('add remove change', this._iconsChanged, this);
this.on('change:iconSet', this.changeIconSet, this);
this.on('change', this._updateDefaults, this);
},
getIconSet: function () {
return App.getAvailableStyles().get('socialIconSets').get(this.get('iconSet'));
@@ -80,6 +81,7 @@ define([
});
},
_iconsChanged: function () {
this._updateDefaults();
App.getChannel().trigger('autoSave');
}
});
@@ -270,30 +272,7 @@ define([
DraggableBehavior: {
cloneOriginal: true,
drop: function () {
return new Module.SocialBlockModel({
type: 'social',
iconSet: 'default',
icons: [
{
type: 'socialIcon',
iconType: 'facebook',
link: 'http://www.facebook.com',
image: App.getAvailableStyles().get('socialIconSets.default.facebook'),
height: '32px',
width: '32px',
text: 'Facebook'
},
{
type: 'socialIcon',
iconType: 'twitter',
link: 'http://www.twitter.com',
image: App.getAvailableStyles().get('socialIconSets.default.twitter'),
height: '32px',
width: '32px',
text: 'Twitter'
}
]
}, { parse: true });
return new Module.SocialBlockModel();
}
}
}