[SSE] Update table templates depending on whether or not a table is selected. Query table templates when theme colors are changed.

This commit is contained in:
Julia Radzhabova 2016-11-29 15:48:18 +03:00
parent 28a4bf62b7
commit 2600efb38c
2 changed files with 18 additions and 3 deletions

View file

@ -272,7 +272,7 @@ define([
setApi: function(api) {
this.api = api;
this.api.asc_registerCallback('asc_onInitTablePictures', _.bind(this.onApiInitTableTemplates, this));
this.api.asc_registerCallback('asc_onSendThemeColors', _.bind(this.onSendThemeColors, this));
this.api.asc_registerCallback('asc_onInitEditorStyles', _.bind(this.onApiInitEditorStyles, this));
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiCoAuthoringDisconnect, this, true));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this));
@ -1366,14 +1366,21 @@ define([
},
onTableTplMenuOpen: function(cmp) {
var scroller = this.toolbar.mnuTableTemplatePicker.scroller;
this.onApiInitTableTemplates(this.api.asc_getTablePictures(this.api.asc_getCellInfo().asc_getFormatTableInfo()));
var scroller = this.toolbar.mnuTableTemplatePicker.scroller;
if (scroller) {
scroller.update({alwaysVisibleY: true});
scroller.scrollTop(0);
}
},
onSendThemeColors: function() {
// get new table templates
if (this.toolbar.btnTableTemplate.rendered && this.toolbar.btnTableTemplate.cmpEl.hasClass('open'))
this.onTableTplMenuOpen();
},
onApiInitTableTemplates: function(images) {
var store = this.getCollection('TableTemplates');
if (store) {

View file

@ -140,7 +140,7 @@ define([
setApi: function(o) {
this.api = o;
if (o) {
this.api.asc_registerCallback('asc_onInitTablePictures', _.bind(this.onApiInitTableTemplates, this));
this.api.asc_registerCallback('asc_onSendThemeColors', _.bind(this.onSendThemeColors, this));
}
return this;
},
@ -347,6 +347,14 @@ define([
}
},
onSendThemeColors: function() {
// get new table templates
if (this.cmbTableTemplate) {
this.onApiInitTableTemplates(this.api.asc_getTablePictures(this._originalProps));
this.cmbTableTemplate.menuPicker.scroller.update({alwaysVisibleY: true});
}
},
onApiInitTableTemplates: function(Templates){
var self = this;
this._isTemplatesChanged = true;