From c31017def888dc4dd33ccd0d52c54e51d3675220 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Fri, 17 Jun 2022 14:35:25 +0300 Subject: [PATCH] [DE PE SSE] Fix search --- apps/common/main/lib/view/SearchBar.js | 3 ++- apps/documenteditor/main/app/controller/Search.js | 6 +++--- apps/documenteditor/main/app/view/LeftMenu.js | 2 +- apps/presentationeditor/main/app/controller/Search.js | 4 ++-- apps/presentationeditor/main/app/view/LeftMenu.js | 2 +- apps/spreadsheeteditor/main/app/controller/Search.js | 6 +++--- apps/spreadsheeteditor/main/app/view/LeftMenu.js | 2 +- 7 files changed, 13 insertions(+), 12 deletions(-) diff --git a/apps/common/main/lib/view/SearchBar.js b/apps/common/main/lib/view/SearchBar.js index 7942c985c..cd4774de9 100644 --- a/apps/common/main/lib/view/SearchBar.js +++ b/apps/common/main/lib/view/SearchBar.js @@ -52,7 +52,8 @@ define([ header: false, cls: 'search-bar', alias: 'SearchBar', - showOpenPanel: true + showOpenPanel: true, + toolclose: 'hide' }, initialize : function(options) { diff --git a/apps/documenteditor/main/app/controller/Search.js b/apps/documenteditor/main/app/controller/Search.js index a49ed86d8..649e8f73c 100644 --- a/apps/documenteditor/main/app/controller/Search.js +++ b/apps/documenteditor/main/app/controller/Search.js @@ -361,7 +361,7 @@ define([ var text = typeof findText === 'string' ? findText : (this.api.asc_GetSelectedText() || this._state.searchText); if (this.resultItems && this.resultItems.length > 0 && - (!this._state.matchCase && text.toLowerCase() === this.view.inputText.getValue().toLowerCase() || + (!this._state.matchCase && text && text.toLowerCase() === this.view.inputText.getValue().toLowerCase() || this._state.matchCase && text === this.view.inputText.getValue())) { // show old results return; } @@ -373,10 +373,10 @@ define([ } this.hideResults(); - if (text !== '' && text === this._state.searchText) { // search was made + if (text && text !== '' && text === this._state.searchText) { // search was made this.view.disableReplaceButtons(false); this.api.asc_StartTextAroundSearch(); - } else if (text !== '') { // search wasn't made + } else if (text && text !== '') { // search wasn't made this.onInputSearchChange(text); } else { this.resultItems = []; diff --git a/apps/documenteditor/main/app/view/LeftMenu.js b/apps/documenteditor/main/app/view/LeftMenu.js index d6b13128c..55f2eb040 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); + btn.pressed && btn.options.action == 'advancedsearch' && this.fireEvent('search:aftershow', this); Common.NotificationCenter.trigger('layout:changed', 'leftmenu'); }, diff --git a/apps/presentationeditor/main/app/controller/Search.js b/apps/presentationeditor/main/app/controller/Search.js index a8737608f..cde4704a9 100644 --- a/apps/presentationeditor/main/app/controller/Search.js +++ b/apps/presentationeditor/main/app/controller/Search.js @@ -337,10 +337,10 @@ define([ } this.hideResults(); - if (text !== '' && text === this._state.searchText) { // search was made + if (text && text !== '' && text === this._state.searchText) { // search was made this.view.disableReplaceButtons(false); this.api.asc_StartTextAroundSearch(); - } else if (text !== '') { // search wasn't made + } else if (text && text !== '') { // search wasn't made this.onInputSearchChange(text); } else { this.resultItems = []; diff --git a/apps/presentationeditor/main/app/view/LeftMenu.js b/apps/presentationeditor/main/app/view/LeftMenu.js index 0095d4959..98c6d9681 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); + btn.pressed && btn.options.action == 'advancedsearch' && this.fireEvent('search:aftershow', this); Common.NotificationCenter.trigger('layout:changed', 'leftmenu'); }, diff --git a/apps/spreadsheeteditor/main/app/controller/Search.js b/apps/spreadsheeteditor/main/app/controller/Search.js index 09f2fbac8..7aa8e1300 100644 --- a/apps/spreadsheeteditor/main/app/controller/Search.js +++ b/apps/spreadsheeteditor/main/app/controller/Search.js @@ -482,7 +482,7 @@ define([ var text = typeof findText === 'string' ? findText : (this.api.asc_GetSelectedText() || this._state.searchText); if (this.resultItems && this.resultItems.length > 0 && - (!this._state.matchCase && text.toLowerCase() === this.view.inputText.getValue().toLowerCase() || + (!this._state.matchCase && text && text.toLowerCase() === this.view.inputText.getValue().toLowerCase() || this._state.matchCase && text === this.view.inputText.getValue())) { // show old results return; } @@ -494,10 +494,10 @@ define([ } this.hideResults(); - if (text !== '' && text === this._state.searchText) { // search was made + if (text && text !== '' && text === this._state.searchText) { // search was made this.view.disableReplaceButtons(false); this.api.asc_StartTextAroundSearch(); - } else if (text !== '') { // search wasn't made + } else if (text && text !== '') { // search wasn't made this.onInputSearchChange(text); } else { this.resultItems = []; diff --git a/apps/spreadsheeteditor/main/app/view/LeftMenu.js b/apps/spreadsheeteditor/main/app/view/LeftMenu.js index b9540ad44..46052302c 100644 --- a/apps/spreadsheeteditor/main/app/view/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/view/LeftMenu.js @@ -183,7 +183,7 @@ define([ this.$el.width(SCALE_MIN); } this.onCoauthOptions(); - (btn.options.action == 'advancedsearch') && this.fireEvent('search:aftershow', this); + btn.pressed && btn.options.action == 'advancedsearch' && this.fireEvent('search:aftershow', this); Common.NotificationCenter.trigger('layout:changed', 'leftmenu'); },