From d937172a52f292fd768ffb7c6e5779f6c4e0b7ca Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Tue, 19 Jul 2022 21:07:25 +0300 Subject: [PATCH] [DE PE SSE] Fix bug 58193 --- apps/documenteditor/main/app/controller/Search.js | 3 ++- apps/presentationeditor/main/app/controller/Search.js | 3 ++- apps/spreadsheeteditor/main/app/controller/Search.js | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Search.js b/apps/documenteditor/main/app/controller/Search.js index 256e7b97a..93cc06350 100644 --- a/apps/documenteditor/main/app/controller/Search.js +++ b/apps/documenteditor/main/app/controller/Search.js @@ -368,7 +368,8 @@ define([ viewport.searchBar.hide(); } - var text = typeof findText === 'string' ? findText : (this.api.asc_GetSelectedText() || this._state.searchText); + var selectedText = this.api.asc_GetSelectedText(), + text = typeof findText === 'string' ? findText : (selectedText && selectedText.trim() || this._state.searchText); if (this.resultItems && this.resultItems.length > 0 && (!this._state.matchCase && text && text.toLowerCase() === this.view.inputText.getValue().toLowerCase() || this._state.matchCase && text === this.view.inputText.getValue())) { // show old results diff --git a/apps/presentationeditor/main/app/controller/Search.js b/apps/presentationeditor/main/app/controller/Search.js index dbd8aadac..663902bf7 100644 --- a/apps/presentationeditor/main/app/controller/Search.js +++ b/apps/presentationeditor/main/app/controller/Search.js @@ -337,7 +337,8 @@ define([ viewport.searchBar.hide(); } - var text = typeof findText === 'string' ? findText : (this.api.asc_GetSelectedText() || this._state.searchText); + var selectedText = this.api.asc_GetSelectedText(), + text = typeof findText === 'string' ? findText : (selectedText && selectedText.trim() || this._state.searchText); if (text) { this.view.setFindText(text); } else if (text !== undefined) { // panel was opened from empty searchbar, clear to start new search diff --git a/apps/spreadsheeteditor/main/app/controller/Search.js b/apps/spreadsheeteditor/main/app/controller/Search.js index 9bde72fd4..2324dd13b 100644 --- a/apps/spreadsheeteditor/main/app/controller/Search.js +++ b/apps/spreadsheeteditor/main/app/controller/Search.js @@ -481,7 +481,8 @@ define([ viewport.searchBar.hide(); } - var text = typeof findText === 'string' ? findText : (this.api.asc_GetSelectedText() || this._state.searchText); + var selectedText = this.api.asc_GetSelectedText(), + text = typeof findText === 'string' ? findText : (selectedText && selectedText.trim() || this._state.searchText); if (this.resultItems && this.resultItems.length > 0 && (!text && !this.view.inputText.getValue() || !this._state.matchCase && text && text.toLowerCase() === this.view.inputText.getValue().toLowerCase() ||