Fix Bug 33139.

This commit is contained in:
Julia Radzhabova 2016-09-23 14:24:54 +03:00
parent d4c0969dbc
commit e0575a4db6
3 changed files with 211 additions and 200 deletions

View file

@ -494,7 +494,7 @@ define([
},
setMenu: function (m) {
if (m && _.isObject(m) && _.isFunction(m.render)){
if (this.rendered && m && _.isObject(m) && _.isFunction(m.render)){
this.menu = m;
this.menu.render(this.cmpEl);
}

View file

@ -183,9 +183,11 @@ define([
toolbar.mnuTextColorPicker.on('select', _.bind(this.onTextColorSelect, this));
toolbar.mnuBackColorPicker.on('select', _.bind(this.onBackColorSelect, this));
toolbar.btnBorders.on('click', _.bind(this.onBorders, this));
if (toolbar.btnBorders.rendered) {
toolbar.btnBorders.menu.on('item:click', _.bind(this.onBordersMenu, this));
toolbar.mnuBorderWidth.on('item:toggle', _.bind(this.onBordersWidth, this));
toolbar.mnuBorderColorPicker.on('select', _.bind(this.onBordersColor, this));
}
toolbar.btnAlignLeft.on('click', _.bind(this.onHorizontalAlign, this, 'left'));
toolbar.btnAlignCenter.on('click', _.bind(this.onHorizontalAlign, this, 'center'));
toolbar.btnAlignRight.on('click', _.bind(this.onHorizontalAlign, this, 'right'));
@ -244,11 +246,11 @@ define([
toolbar.cmbFontSize.on('combo:focusin', _.bind(this.onComboOpen, this, false));
if (toolbar.mnuZoomIn) toolbar.mnuZoomIn.on('click', _.bind(this.onZoomInClick, this));
if (toolbar.mnuZoomOut) toolbar.mnuZoomOut.on('click', _.bind(this.onZoomOutClick, this));
toolbar.btnShowMode.menu.on('item:click', _.bind(this.onHideMenu, this));
if (toolbar.btnShowMode.rendered) toolbar.btnShowMode.menu.on('item:click', _.bind(this.onHideMenu, this));
toolbar.listStyles.on('click', _.bind(this.onListStyleSelect, this));
toolbar.btnNumberFormat.menu.on('item:click', _.bind(this.onNumberFormatMenu, this));
if (toolbar.btnNumberFormat.rendered) toolbar.btnNumberFormat.menu.on('item:click', _.bind(this.onNumberFormatMenu, this));
toolbar.btnCurrencyStyle.menu.on('item:click', _.bind(this.onNumberFormatMenu, this));
toolbar.mnuitemCompactToolbar.on('toggle', _.bind(this.onChangeViewMode, this));
if (toolbar.mnuitemCompactToolbar) toolbar.mnuitemCompactToolbar.on('toggle', _.bind(this.onChangeViewMode, this));
$('#id-toolbar-menu-new-fontcolor').on('click', _.bind(this.onNewTextColor, this));
$('#id-toolbar-menu-new-paracolor').on('click', _.bind(this.onNewBackColor, this));
$('#id-toolbar-menu-new-bordercolor').on('click', _.bind(this.onNewBorderColor, this));
@ -1254,7 +1256,10 @@ define([
}
if (me.toolbar.btnInsertText.rendered)
SSE.getController('Toolbar').fillTextArt();
me.fillTextArt();
if (me.toolbar.btnTableTemplate.rendered)
me.fillTableTemplates();
}, 100);
}
@ -1268,8 +1273,9 @@ define([
},
fillTableTemplates: function() {
var me = this;
if (!this.toolbar.btnTableTemplate.rendered) return;
var me = this;
function createPicker(element, menu) {
var picker = new Common.UI.DataView({
el: element,

View file

@ -1293,6 +1293,7 @@ define([
this.btnAutofilter.updateHint(this.tipAutofilter);
// set menus
if (this.btnShowMode.rendered) {
this.btnShowMode.setMenu(new Common.UI.Menu({
items: [
this.mnuitemCompactToolbar = new Common.UI.MenuItem({
@ -1364,7 +1365,9 @@ define([
if (this.mode.isDesktopApp)
this.mnuitemHideTitleBar.hide();
}
if (this.btnBorders.rendered) {
this.btnBorders.setMenu( new Common.UI.Menu({
items: [
{
@ -1478,6 +1481,7 @@ define([
})
]
}));
var colorVal = $('<div class="btn-color-value-line"></div>');
$('button:first-child', this.btnBorders.cmpEl).append(colorVal);
colorVal.css('background-color', this.btnBorders.currentColor || 'transparent');
@ -1485,6 +1489,7 @@ define([
this.mnuBorderColorPicker = new Common.UI.ThemeColorPalette({
el: $('#id-toolbar-menu-bordercolor')
});
}
var formatTemplate = _.template('<a id="<%= id %>" style="white-space: normal;" tabindex="-1" type="menuitem"><%= caption %><span style="float: right; color: silver;"><%= options.tplval ? options.tplval : options.value %></span></a>');
this.btnNumberFormat.setMenu( new Common.UI.Menu({
@ -1692,7 +1697,7 @@ define([
if (mode.isDesktopApp) {
$('.toolbar-group-native').hide();
this.mnuitemHideTitleBar.hide();
this.mnuitemHideTitleBar && this.mnuitemHideTitleBar.hide();
}
this.lockToolbar(SSE.enumLock.cantPrint, !mode.canPrint, {array: [this.btnPrint]});