[DE PE SSE] Fix bug 58193

This commit is contained in:
JuliaSvinareva 2022-07-19 21:07:25 +03:00
parent 65e7054b54
commit d937172a52
3 changed files with 6 additions and 3 deletions

View file

@ -368,7 +368,8 @@ define([
viewport.searchBar.hide(); 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 && if (this.resultItems && this.resultItems.length > 0 &&
(!this._state.matchCase && text && 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 this._state.matchCase && text === this.view.inputText.getValue())) { // show old results

View file

@ -337,7 +337,8 @@ define([
viewport.searchBar.hide(); 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) { if (text) {
this.view.setFindText(text); this.view.setFindText(text);
} else if (text !== undefined) { // panel was opened from empty searchbar, clear to start new search } else if (text !== undefined) { // panel was opened from empty searchbar, clear to start new search

View file

@ -481,7 +481,8 @@ define([
viewport.searchBar.hide(); 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 && if (this.resultItems && this.resultItems.length > 0 &&
(!text && !this.view.inputText.getValue() || (!text && !this.view.inputText.getValue() ||
!this._state.matchCase && text && text.toLowerCase() === this.view.inputText.getValue().toLowerCase() || !this._state.matchCase && text && text.toLowerCase() === this.view.inputText.getValue().toLowerCase() ||