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() ||