[DE PE SSE] Fix bugs 57793, 57794

This commit is contained in:
JuliaSvinareva 2022-07-01 19:04:21 +03:00
parent b3803f0978
commit 26267635f9
5 changed files with 24 additions and 9 deletions

View file

@ -139,6 +139,7 @@ define([
left = Common.Utils.innerWidth() - ($('#right-menu').is(':visible') ? $('#right-menu').width() : 0) - this.options.width - 32; left = Common.Utils.innerWidth() - ($('#right-menu').is(':visible') ? $('#right-menu').width() : 0) - this.options.width - 32;
Common.UI.Window.prototype.show.call(this, left, top); Common.UI.Window.prototype.show.call(this, left, top);
this.disableNavButtons();
if (text) { if (text) {
this.inputSearch.val(text); this.inputSearch.val(text);
this.fireEvent('search:input', [text]); this.fireEvent('search:input', [text]);
@ -146,7 +147,6 @@ define([
this.inputSearch.val(''); this.inputSearch.val('');
} }
this.disableNavButtons();
this.focus(); this.focus();
}, },
@ -185,9 +185,9 @@ define([
}, },
disableNavButtons: function (resultNumber, allResults) { disableNavButtons: function (resultNumber, allResults) {
var disable = this.inputSearch.val() === ''; var disable = this.inputSearch.val() === '' || !allResults;
this.btnBack.setDisabled(disable || !allResults || resultNumber === 0); this.btnBack.setDisabled(disable);
this.btnNext.setDisabled(disable || resultNumber + 1 === allResults); this.btnNext.setDisabled(disable);
}, },
textFind: 'Find', textFind: 'Find',

View file

@ -373,9 +373,9 @@ define([
}, },
disableNavButtons: function (resultNumber, allResults) { disableNavButtons: function (resultNumber, allResults) {
var disable = this.inputText._input.val() === ''; var disable = this.inputText._input.val() === '' || !allResults;
this.btnBack.setDisabled(disable || !allResults || resultNumber === 0); this.btnBack.setDisabled(disable);
this.btnNext.setDisabled(disable || !allResults || resultNumber + 1 === allResults); this.btnNext.setDisabled(disable);
}, },
disableReplaceButtons: function (disable) { disableReplaceButtons: function (disable) {

View file

@ -57,7 +57,13 @@ define([
'SearchBar': { 'SearchBar': {
'search:back': _.bind(this.onSearchNext, this, 'back'), 'search:back': _.bind(this.onSearchNext, this, 'back'),
'search:next': _.bind(this.onSearchNext, this, 'next'), 'search:next': _.bind(this.onSearchNext, this, 'next'),
'search:input': _.bind(this.onInputSearchChange, this), 'search:input': _.bind(function (text) {
if (this._state.searchText === text) {
Common.NotificationCenter.trigger('search:updateresults', this._state.currentResult, this._state.resultsNumber);
return;
}
this.onInputSearchChange(text);
}, this),
'search:keydown': _.bind(this.onSearchNext, this, 'keydown'), 'search:keydown': _.bind(this.onSearchNext, this, 'keydown'),
'show': _.bind(this.onSelectSearchingResults, this, true), 'show': _.bind(this.onSelectSearchingResults, this, true),
'hide': _.bind(this.onSelectSearchingResults, this, false) 'hide': _.bind(this.onSelectSearchingResults, this, false)
@ -169,6 +175,7 @@ define([
me.view.disableReplaceButtons(false); me.view.disableReplaceButtons(false);
} else if (me._state.newSearchText === '') { } else if (me._state.newSearchText === '') {
me.view.updateResultsNumber('no-results'); me.view.updateResultsNumber('no-results');
me.view.disableNavButtons();
me.view.disableReplaceButtons(true); me.view.disableReplaceButtons(true);
} }
clearInterval(me.searchTimer); clearInterval(me.searchTimer);

View file

@ -57,7 +57,13 @@ define([
'SearchBar': { 'SearchBar': {
'search:back': _.bind(this.onSearchNext, this, 'back'), 'search:back': _.bind(this.onSearchNext, this, 'back'),
'search:next': _.bind(this.onSearchNext, this, 'next'), 'search:next': _.bind(this.onSearchNext, this, 'next'),
'search:input': _.bind(this.onInputSearchChange, this), 'search:input': _.bind(function (text) {
if (this._state.searchText === text) {
Common.NotificationCenter.trigger('search:updateresults', this._state.currentResult, this._state.resultsNumber);
return;
}
this.onInputSearchChange(text);
}, this),
'search:keydown': _.bind(this.onSearchNext, this, 'keydown') 'search:keydown': _.bind(this.onSearchNext, this, 'keydown')
}, },
'Common.Views.SearchPanel': { 'Common.Views.SearchPanel': {
@ -166,6 +172,7 @@ define([
me.view.disableReplaceButtons(false); me.view.disableReplaceButtons(false);
} else if (me._state.newSearchText === '') { } else if (me._state.newSearchText === '') {
me.view.updateResultsNumber('no-results'); me.view.updateResultsNumber('no-results');
me.view.disableNavButtons();
me.view.disableReplaceButtons(true); me.view.disableReplaceButtons(true);
} }
clearInterval(me.searchTimer); clearInterval(me.searchTimer);

View file

@ -229,6 +229,7 @@ define([
//me.view.disableReplaceButtons(false); //me.view.disableReplaceButtons(false);
} else if (me._state.newSearchText === '') { } else if (me._state.newSearchText === '') {
me.view.updateResultsNumber('no-results'); me.view.updateResultsNumber('no-results');
me.view.disableNavButtons();
//me.view.disableReplaceButtons(true); //me.view.disableReplaceButtons(true);
} }
clearInterval(me.searchTimer); clearInterval(me.searchTimer);