Commit 2600efb3 authored by Julia Radzhabova's avatar Julia Radzhabova

[SSE] Update table templates depending on whether or not a table is selected....

[SSE] Update table templates depending on whether or not a table is selected. Query table templates when theme colors are changed.
parent 28a4bf62
......@@ -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) {
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment