diff --git a/apps/presentationeditor/main/app/controller/LeftMenu.js b/apps/presentationeditor/main/app/controller/LeftMenu.js index e26083eef..95d73dc93 100644 --- a/apps/presentationeditor/main/app/controller/LeftMenu.js +++ b/apps/presentationeditor/main/app/controller/LeftMenu.js @@ -107,6 +107,9 @@ define([ }, 'Common.Views.ReviewChanges': { 'collaboration:chat': _.bind(this.onShowHideChat, this) + }, + 'SearchBar': { + 'search:show': _.bind(this.onShowHideSearch, this) } }); Common.NotificationCenter.on('leftmenu:change', _.bind(this.onMenuChange, this)); @@ -768,6 +771,16 @@ define([ } }, + onShowHideSearch: function (state) { + if (state) { + Common.UI.Menu.Manager.hideAll(); + this.leftMenu.showMenu('advancedsearch'); + } else { + this.leftMenu.btnSearchBar.toggle(false, true); + this.leftMenu.onBtnMenuClick(this.leftMenu.btnSearchBar); + } + }, + showHistory: function() { if (!this.mode.wopi) { var maincontroller = PE.getController('Main'); diff --git a/apps/presentationeditor/main/app/controller/Viewport.js b/apps/presentationeditor/main/app/controller/Viewport.js index b79d21b1d..93d072182 100644 --- a/apps/presentationeditor/main/app/controller/Viewport.js +++ b/apps/presentationeditor/main/app/controller/Viewport.js @@ -43,6 +43,7 @@ define([ 'core', 'common/main/lib/view/Header', + 'common/main/lib/view/SearchBar', 'presentationeditor/main/app/view/DocumentPreview', 'presentationeditor/main/app/view/Viewport' // 'documenteditor/main/app/view/LeftMenu' @@ -341,6 +342,7 @@ define([ })).on('click', _on_btn_zoom.bind(me, 'up')); me.header.btnOptions.menu.on('item:click', me.onOptionsItemClick.bind(this)); + me.header.btnSearch.on('click', me.onSearchClick.bind(this)); } }, @@ -512,6 +514,24 @@ define([ Common.localStorage.setBool('pe-hidden-notes', !bIsShow); }, + onSearchClick: function () { + if (!this.searchBar) { + this.searchBar = new Common.UI.SearchBar({}); + } + if (this.header.btnSearch.pressed) { + if (this.searchBar.isVisible()) { + this.searchBar.focus(); + } else { + this.searchBar.show(); + } + } else { + this.searchBar.hide(); + } + this.searchBar.on('hide', _.bind(function () { + this.header.btnSearch.toggle(false); + }, this)); + }, + textFitPage: 'Fit to Page', textFitWidth: 'Fit to Width' }, PE.Controllers.Viewport)); diff --git a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js index 0df79e991..911cc0f2a 100644 --- a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js @@ -99,6 +99,9 @@ define([ }, 'Common.Views.ReviewChanges': { 'collaboration:chat': _.bind(this.onShowHideChat, this) + }, + 'SearchBar': { + 'search:show': _.bind(this.onShowHideSearch, this) } }); Common.NotificationCenter.on('app:comment:add', _.bind(this.onAppAddComment, this)); @@ -977,6 +980,16 @@ define([ } }, + onShowHideSearch: function (state) { + if (state) { + Common.UI.Menu.Manager.hideAll(); + this.leftMenu.showMenu('advancedsearch'); + } else { + this.leftMenu.btnSearchBar.toggle(false, true); + this.leftMenu.onBtnMenuClick(this.leftMenu.btnSearchBar); + } + }, + onMenuChange: function (value) { if ('hide' === value) { if (this.leftMenu.btnComments.isActive() && this.api) { diff --git a/apps/spreadsheeteditor/main/app/controller/Viewport.js b/apps/spreadsheeteditor/main/app/controller/Viewport.js index 171cbf229..fc15ad3ad 100644 --- a/apps/spreadsheeteditor/main/app/controller/Viewport.js +++ b/apps/spreadsheeteditor/main/app/controller/Viewport.js @@ -43,6 +43,7 @@ define([ 'core', 'common/main/lib/view/Header', + 'common/main/lib/view/SearchBar', 'spreadsheeteditor/main/app/view/Viewport' // ,'spreadsheeteditor/main/app/view/LeftMenu' ], function (Viewport) { @@ -347,6 +348,7 @@ define([ })).on('click', _on_btn_zoom.bind(me, 'up')); me.header.btnOptions.menu.on('item:click', me.onOptionsItemClick.bind(this)); + me.header.btnSearch.on('click', me.onSearchClick.bind(this)); } }, @@ -542,6 +544,24 @@ define([ this.header.mnuitemFreezePanes.setDisabled(disabled); }, + onSearchClick: function () { + if (!this.searchBar) { + this.searchBar = new Common.UI.SearchBar({}); + } + if (this.header.btnSearch.pressed) { + if (this.searchBar.isVisible()) { + this.searchBar.focus(); + } else { + this.searchBar.show(); + } + } else { + this.searchBar.hide(); + } + this.searchBar.on('hide', _.bind(function () { + this.header.btnSearch.toggle(false); + }, this)); + }, + textHideFBar: 'Hide Formula Bar', textHideHeadings: 'Hide Headings', textHideGridlines: 'Hide Gridlines',