diff --git a/apps/common/main/lib/component/Mixtbar.js b/apps/common/main/lib/component/Mixtbar.js index 7b59950ed..0361f6c1d 100644 --- a/apps/common/main/lib/component/Mixtbar.js +++ b/apps/common/main/lib/component/Mixtbar.js @@ -399,7 +399,9 @@ define([ _btns = data.buttons, _flex = data.flex; var more_section = $active.find('.more-box'); - + if (more_section.length===0) { + me.setMoreButton($active.attr('data-tab'), $active); + } if ( !_rightedge ) { _rightedge = $active.get(0).getBoundingClientRect().right; } @@ -527,10 +529,30 @@ define([ this.$moreBar = btnsMore[tab].panel; }, + clearMoreButton: function(tab) { + var panel = this.$panels.filter('[data-tab=' + tab + ']'); + if ( panel.length ) { + var data = panel.data(); + data.buttons = data.flex = data.rightedge = undefined; + panel.find('.more-box').remove(); + } + if (btnsMore[tab]) { + var moreContainer = optsFold.$bar.find('.more-container[data-tab="' + tab + '"]'); + moreContainer.remove(); + btnsMore[tab].remove(); + delete btnsMore[tab]; + } + }, + resizeToolbar: function(reset) { var $active = this.$panels.filter('.active'), - more_section = $active.find('.more-box'), - more_section_width = parseInt(more_section.css('width')) || 0, + more_section = $active.find('.more-box'); + + if (more_section.length===0) { + this.setMoreButton($active.attr('data-tab'), $active); + } + + var more_section_width = parseInt(more_section.css('width')) || 0, box_controls_width = $active.parents('.box-controls').width(), _maxright = box_controls_width, _rightedge = $active.get(0).getBoundingClientRect().right, diff --git a/apps/common/main/lib/controller/Plugins.js b/apps/common/main/lib/controller/Plugins.js index ddc0c42db..8b589d926 100644 --- a/apps/common/main/lib/controller/Plugins.js +++ b/apps/common/main/lib/controller/Plugins.js @@ -66,7 +66,7 @@ define([ if ( !appOptions.isEditMailMerge && !appOptions.isEditDiagram && !appOptions.isEditOle ) { var tab = {action: 'plugins', caption: me.panelPlugins.groupCaption, dataHintTitle: 'E', layoutname: 'toolbar-plugins'}; me.$toolbarPanelPlugins = me.panelPlugins.getPanel(); - + me.toolbar = toolbar; toolbar.addTab(tab, me.$toolbarPanelPlugins, 10); // TODO: clear plugins list in left panel } } @@ -248,6 +248,7 @@ define([ me.appOptions.canPlugins = !collection.isEmpty(); if ( me.$toolbarPanelPlugins ) { me.$toolbarPanelPlugins.empty(); + me.toolbar && me.toolbar.clearMoreButton('plugins'); var _group = $('
'), rank = -1, @@ -274,6 +275,7 @@ define([ rank = new_rank; }); _group.appendTo(me.$toolbarPanelPlugins); + me.toolbar && me.toolbar.isTabActive('plugins') && me.toolbar.processPanelVisible(null, true, true); var docProtection = me.panelPlugins._state.docProtection; Common.Utils.lockControls(Common.enumLock.docLockView, docProtection.isReadOnly, {array: me.panelPlugins.lockedControls}); Common.Utils.lockControls(Common.enumLock.docLockForms, docProtection.isFormsOnly, {array: me.panelPlugins.lockedControls});