diff --git a/apps/documenteditor/main/app/view/LeftMenu.js b/apps/documenteditor/main/app/view/LeftMenu.js index 8b1852cf1..b0efb77f3 100644 --- a/apps/documenteditor/main/app/view/LeftMenu.js +++ b/apps/documenteditor/main/app/view/LeftMenu.js @@ -209,7 +209,7 @@ define([ this.supressEvents = false; this.onCoauthOptions(); - (btn.options.action == 'advancedsearch') && this.fireEvent('search:aftershow', this.leftMenu); + (btn.options.action == 'advancedsearch') && this.fireEvent('search:aftershow', this); Common.NotificationCenter.trigger('layout:changed', 'leftmenu'); }, diff --git a/apps/presentationeditor/main/app/view/LeftMenu.js b/apps/presentationeditor/main/app/view/LeftMenu.js index b0c3dcef2..02d0ea6f8 100644 --- a/apps/presentationeditor/main/app/view/LeftMenu.js +++ b/apps/presentationeditor/main/app/view/LeftMenu.js @@ -202,7 +202,7 @@ define([ } this.fireEvent('panel:show', [this, btn.options.action, btn.pressed]); - (btn.options.action == 'advancedsearch') && this.fireEvent('search:aftershow', this.leftMenu); + (btn.options.action == 'advancedsearch') && this.fireEvent('search:aftershow', this); Common.NotificationCenter.trigger('layout:changed', 'leftmenu'); }, diff --git a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js index e5e61ac04..8a9389bd5 100644 --- a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js @@ -740,7 +740,6 @@ define([ case 'escape': var btnSearch = this.getApplication().getController('Viewport').header.btnSearch; btnSearch.pressed && btnSearch.toggle(false); - this.leftMenu._state.isSearchOpen && (this.leftMenu._state.isSearchOpen = false); if ( this.leftMenu.menuFile.isVisible() ) { if (Common.UI.HintManager.needCloseFileMenu()) @@ -865,11 +864,10 @@ define([ var mode = this.mode.isEdit && !this.viewmode ? undefined : 'no-replace'; this.leftMenu.panelSearch.setSearchMode(mode); } - this.leftMenu._state.isSearchOpen = show; }, isSearchPanelVisible: function () { - return this.leftMenu._state.isSearchOpen; + return this.leftMenu && this.leftMenu.panelSearch && this.leftMenu.panelSearch.isVisible(); }, onMenuChange: function (value) { diff --git a/apps/spreadsheeteditor/main/app/view/LeftMenu.js b/apps/spreadsheeteditor/main/app/view/LeftMenu.js index a8312d83c..eb88e6eea 100644 --- a/apps/spreadsheeteditor/main/app/view/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/view/LeftMenu.js @@ -59,13 +59,6 @@ define([ // Delegated events for creating new items, and clearing completed ones. events: function() { return { - /** coauthoring begin **/ - 'click #left-btn-comments': _.bind(this.onCoauthOptions, this), - 'click #left-btn-chat': _.bind(this.onCoauthOptions, this), - /** coauthoring end **/ - 'click #left-btn-plugins': _.bind(this.onCoauthOptions, this), - 'click #left-btn-spellcheck': _.bind(this.onCoauthOptions, this), - 'click #left-btn-searchbar': _.bind(this.onCoauthOptions, this), 'click #left-btn-support': function() { var config = this.mode.customization; config && !!config.feedback && !!config.feedback.url ? @@ -91,6 +84,7 @@ define([ enableToggle: true, toggleGroup: 'leftMenuGroup' }); + this.btnSearchBar.on('click', _.bind(this.onBtnMenuClick, this)); this.btnAbout = new Common.UI.Button({ action: 'about', @@ -100,6 +94,7 @@ define([ disabled: true, toggleGroup: 'leftMenuGroup' }); + this.btnAbout.on('toggle', _.bind(this.onBtnMenuToggle, this)); this.btnSupport = new Common.UI.Button({ action: 'support', @@ -116,6 +111,8 @@ define([ disabled: true, toggleGroup: 'leftMenuGroup' }); + this.btnComments.on('toggle', this.onBtnCommentsToggle.bind(this)); + this.btnComments.on('click', this.onBtnMenuClick.bind(this)); this.btnChat = new Common.UI.Button({ el: $markup.elementById('#left-btn-chat'), @@ -124,13 +121,10 @@ define([ disabled: true, toggleGroup: 'leftMenuGroup' }); + this.btnChat.on('click', this.onBtnMenuClick.bind(this)); this.btnComments.hide(); this.btnChat.hide(); - - this.btnComments.on('toggle', this.onBtnCommentsToggle.bind(this)); - this.btnComments.on('click', this.onBtnMenuClick.bind(this)); - this.btnChat.on('click', this.onBtnMenuClick.bind(this)); /** coauthoring end **/ this.btnPlugins = new Common.UI.Button({ @@ -153,9 +147,6 @@ define([ this.btnSpellcheck.hide(); this.btnSpellcheck.on('click', _.bind(this.onBtnMenuClick, this)); - this.btnSearchBar.on('click', _.bind(this.onBtnMenuClick, this)); - this.btnAbout.on('toggle', _.bind(this.onBtnMenuToggle, this)); - this.menuFile = new SSE.Views.FileMenu({}); this.btnAbout.panel = (new Common.Views.About({el: '#about-menu-panel', appName: this.txtEditor})); this.$el.html($markup); @@ -183,19 +174,16 @@ define([ onBtnMenuClick: function(btn, e) { this.btnAbout.toggle(false); - if (btn.options.action == 'search') { - } else { - if (btn.pressed) { - if (!(this.$el.width() > SCALE_MIN)) { - this.$el.width(Common.localStorage.getItem('sse-mainmenu-width') || MENU_SCALE_PART); - } - } else if (!this._state.pluginIsRunning){ - Common.localStorage.setItem('sse-mainmenu-width',this.$el.width()); - this.$el.width(SCALE_MIN); + if (btn.pressed) { + if (!(this.$el.width() > SCALE_MIN)) { + this.$el.width(Common.localStorage.getItem('sse-mainmenu-width') || MENU_SCALE_PART); } + } else if (!this._state.pluginIsRunning){ + Common.localStorage.setItem('sse-mainmenu-width',this.$el.width()); + this.$el.width(SCALE_MIN); } - -// this.btnChat.id == btn.id && !this.btnChat.pressed && this.fireEvent('chat:hide', this); + this.onCoauthOptions(); + (btn.options.action == 'advancedsearch') && this.fireEvent('search:aftershow', this); Common.NotificationCenter.trigger('layout:changed', 'leftmenu'); }, @@ -228,7 +216,6 @@ define([ if (this.panelSearch) { if (this.btnSearchBar.pressed) { this.panelSearch.show(); - this.fireEvent('search:aftershow', this); } else { this.panelSearch.hide(); } @@ -335,7 +322,6 @@ define([ !this.btnChat.isDisabled() && !this.btnChat.pressed) { this.btnChat.toggle(true); this.onBtnMenuClick(this.btnChat); - this.onCoauthOptions(); this.panelChat.focus(); } } else @@ -344,7 +330,6 @@ define([ !this.btnComments.isDisabled() && !this.btnComments.pressed) { this.btnComments.toggle(true); this.onBtnMenuClick(this.btnComments); - this.onCoauthOptions(); this.btnComments.$el.focus(); } } else if (menu == 'advancedsearch') { @@ -352,7 +337,6 @@ define([ !this.btnSearchBar.isDisabled() && !this.btnSearchBar.pressed) { this.btnSearchBar.toggle(true); this.onBtnMenuClick(this.btnSearchBar); - this.onCoauthOptions(); } } /** coauthoring end **/