[SSE] Fix loading color palettes in the toolbar menu.

This commit is contained in:
Julia Radzhabova 2017-04-28 17:28:35 +03:00
parent 59750ed06b
commit b53b32e67f
2 changed files with 27 additions and 19 deletions

View file

@ -176,7 +176,7 @@ define([
Common.NotificationCenter.on('app:face', this.onAppShowed.bind(this));
},
onToolbarAfterRender: function(toolbar) {
attachUIEvents: function(toolbar) {
var me = this;
/**
@ -1331,7 +1331,7 @@ define([
var me = this;
this.toolbar.createDelayedElements();
this.onToolbarAfterRender(this.toolbar);
this.attachUIEvents(this.toolbar);
if ( !this.appConfig.isEditDiagram && !this.appConfig.isEditMailMerge ) {
this.api.asc_registerCallback('asc_onSheetsChanged', _.bind(this.onApiSheetChanged, this));

View file

@ -421,14 +421,6 @@ define([
{ template: _.template('<a id="id-toolbar-menu-new-fontcolor" style="padding-left:12px;">' + me.textNewColor + '</a>') }
]
})
}).on('render:after', function(btn) {
var colorVal = $('<div class="btn-color-value-line"></div>');
$('button:first-child', btn.cmpEl).append(colorVal);
colorVal.css('background-color', btn.currentColor || 'transparent');
me.mnuTextColorPicker = new Common.UI.ThemeColorPalette({
el: $('#id-toolbar-menu-fontcolor')
});
});
me.mnuBackColorPicker = dummyCmp();
@ -444,15 +436,6 @@ define([
{ template: _.template('<a id="id-toolbar-menu-new-paracolor" style="padding-left:12px;">' + me.textNewColor + '</a>') }
]
})
}).on('render:after', function(btn) {
var colorVal = $('<div class="btn-color-value-line"></div>');
$('button:first-child', btn.cmpEl).append(colorVal);
colorVal.css('background-color', btn.currentColor || 'transparent');
me.mnuBackColorPicker = new Common.UI.ThemeColorPalette({
el: $('#id-toolbar-menu-paracolor'),
transparent: true
});
});
me.btnBorders = new Common.UI.Button({
@ -1244,6 +1227,8 @@ define([
if (cmp && _.isFunction(cmp.setDisabled))
cmp.setDisabled(true);
});
this.on('render:after', _.bind(this.onToolbarAfterRender, this));
},
render: function (mode) {
@ -1684,6 +1669,29 @@ define([
}
},
onToolbarAfterRender: function(toolbar) {
// DataView and pickers
//
if (this.btnTextColor.cmpEl) {
var colorVal = $('<div class="btn-color-value-line"></div>');
$('button:first-child', this.btnTextColor.cmpEl).append(colorVal);
colorVal.css('background-color', this.btnTextColor.currentColor || 'transparent');
this.mnuTextColorPicker = new Common.UI.ThemeColorPalette({
el: $('#id-toolbar-menu-fontcolor')
});
}
if (this.btnBackColor.cmpEl) {
var colorVal = $('<div class="btn-color-value-line"></div>');
$('button:first-child', this.btnBackColor.cmpEl).append(colorVal);
colorVal.css('background-color', this.btnBackColor.currentColor || 'transparent');
this.mnuBackColorPicker = new Common.UI.ThemeColorPalette({
el: $('#id-toolbar-menu-paracolor'),
transparent: true
});
}
},
setApi: function(api) {
this.api = api;