[DE] Fix highlighting of search results

This commit is contained in:
JuliaSvinareva 2022-03-29 20:49:35 +03:00
parent c10d349a19
commit 1ed6a7b830
3 changed files with 23 additions and 6 deletions

View file

@ -131,6 +131,7 @@ define([
if (text) {
this.inputSearch.val(text);
this.fireEvent('search:input', [text]);
} else {
this.inputSearch.val('');
}
@ -149,6 +150,7 @@ define([
setText: function (text) {
this.inputSearch.val(text);
this.fireEvent('search:input', [text]);
},
getSettings: function() {

View file

@ -806,12 +806,13 @@ define([
this.leftMenu.fireEvent('search:aftershow', this.leftMenu, selectedText);
return false;
} else if (this.getApplication().getController('Viewport').isSearchBarVisible()) {
var viewport = this.getApplication().getController('Viewport');
if (s === 'replace') {
this.getApplication().getController('Viewport').header.btnSearch.toggle(false);
this.onShowHideSearch(true, this.getApplication().getController('Viewport').searchBar.inputSearch.val());
viewport.header.btnSearch.toggle(false);
this.onShowHideSearch(true, viewport.searchBar.inputSearch.val());
} else {
selectedText && this.getApplication().getController('Viewport').searchBar.setText(selectedText);
this.getApplication().getController('Viewport').searchBar.focus();
selectedText && viewport.searchBar.setText(selectedText);
viewport.searchBar.focus();
return false;
}
} else if (s === 'search') {

View file

@ -58,7 +58,9 @@ define([
'search:back': _.bind(this.onSearchNext, this, 'back'),
'search:next': _.bind(this.onSearchNext, this, 'next'),
'search:input': _.bind(this.onInputSearchChange, this),
'search:keydown': _.bind(this.onSearchNext, this, 'keydown')
'search:keydown': _.bind(this.onSearchNext, this, 'keydown'),
'show': _.bind(this.onSelectSearchingResults, this, true),
'hide': _.bind(this.onSelectSearchingResults, this, false)
},
'Common.Views.SearchPanel': {
'search:back': _.bind(this.onSearchNext, this, 'back'),
@ -81,7 +83,8 @@ define([
searchText: '',
matchCase: false,
matchWord: false,
useRegExp: false
useRegExp: false,
isHighlightedResults: false
};
},
@ -329,6 +332,7 @@ define([
},
onShowPanel: function () {
this.onSelectSearchingResults(true);
if (this.resultItems && this.resultItems.length > 0 && !this._state.isStartedAddingResults) {
var me = this;
this.view.$resultsContainer.show();
@ -345,6 +349,16 @@ define([
onHidePanel: function () {
this.hideResults();
this.onSelectSearchingResults(false);
},
onSelectSearchingResults: function (val) {
if (!val && this.getApplication().getController('LeftMenu').isSearchPanelVisible()) return;
if (this._state.isHighlightedResults !== val) {
this.api.asc_selectSearchingResults(val);
this._state.isHighlightedResults = val;
}
},
notcriticalErrorTitle: 'Warning',