[SSE] Fix disabling of nav buttons in search panel
This commit is contained in:
parent
a3ce08a602
commit
8fd396814c
|
@ -185,7 +185,7 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
disableNavButtons: function (resultNumber, allResults) {
|
disableNavButtons: function (resultNumber, allResults) {
|
||||||
var disable = this.inputSearch.val() === '' || !allResults;
|
var disable = (this.inputSearch.val() === '' && !window.SSE) || !allResults;
|
||||||
this.btnBack.setDisabled(disable);
|
this.btnBack.setDisabled(disable);
|
||||||
this.btnNext.setDisabled(disable);
|
this.btnNext.setDisabled(disable);
|
||||||
},
|
},
|
||||||
|
|
|
@ -375,7 +375,7 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
disableNavButtons: function (resultNumber, allResults) {
|
disableNavButtons: function (resultNumber, allResults) {
|
||||||
var disable = this.inputText._input.val() === '' || !allResults;
|
var disable = (this.inputText._input.val() === '' && !window.SSE) || !allResults;
|
||||||
this.btnBack.setDisabled(disable);
|
this.btnBack.setDisabled(disable);
|
||||||
this.btnNext.setDisabled(disable);
|
this.btnNext.setDisabled(disable);
|
||||||
},
|
},
|
||||||
|
|
|
@ -80,7 +80,7 @@ define([
|
||||||
},
|
},
|
||||||
onLaunch: function () {
|
onLaunch: function () {
|
||||||
this._state = {
|
this._state = {
|
||||||
searchText: '',
|
searchText: undefined,
|
||||||
matchCase: false,
|
matchCase: false,
|
||||||
matchWord: false,
|
matchWord: false,
|
||||||
useRegExp: false,
|
useRegExp: false,
|
||||||
|
@ -226,11 +226,10 @@ define([
|
||||||
if (me.view.$el.is(':visible')) {
|
if (me.view.$el.is(':visible')) {
|
||||||
me.api.asc_StartTextAroundSearch();
|
me.api.asc_StartTextAroundSearch();
|
||||||
}
|
}
|
||||||
//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.disableNavButtons();
|
||||||
//me.view.disableReplaceButtons(true);
|
Common.NotificationCenter.trigger('search:updateresults', undefined, 0);
|
||||||
}
|
}
|
||||||
clearInterval(me.searchTimer);
|
clearInterval(me.searchTimer);
|
||||||
me.searchTimer = undefined;
|
me.searchTimer = undefined;
|
||||||
|
@ -267,10 +266,10 @@ define([
|
||||||
if (!this.api.asc_findText(options)) {
|
if (!this.api.asc_findText(options)) {
|
||||||
this.resultItems = [];
|
this.resultItems = [];
|
||||||
this.view.updateResultsNumber(undefined, 0);
|
this.view.updateResultsNumber(undefined, 0);
|
||||||
//this.view.disableReplaceButtons(true);
|
|
||||||
this._state.currentResult = 0;
|
this._state.currentResult = 0;
|
||||||
this._state.resultsNumber = 0;
|
this._state.resultsNumber = 0;
|
||||||
this.view.disableNavButtons();
|
this.view.disableNavButtons();
|
||||||
|
Common.NotificationCenter.trigger('search:updateresults', undefined, 0);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -348,10 +347,10 @@ define([
|
||||||
this.resultItems = [];
|
this.resultItems = [];
|
||||||
this.hideResults();
|
this.hideResults();
|
||||||
this.view.updateResultsNumber(type, 0); // type === undefined, count === 0 -> no matches
|
this.view.updateResultsNumber(type, 0); // type === undefined, count === 0 -> no matches
|
||||||
//this.view.disableReplaceButtons(true);
|
|
||||||
this._state.currentResult = 0;
|
this._state.currentResult = 0;
|
||||||
this._state.resultsNumber = 0;
|
this._state.resultsNumber = 0;
|
||||||
this.view.disableNavButtons();
|
this.view.disableNavButtons();
|
||||||
|
Common.NotificationCenter.trigger('search:updateresults', undefined, 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
onApiRemoveTextAroundSearch: function (arr) {
|
onApiRemoveTextAroundSearch: function (arr) {
|
||||||
|
@ -482,7 +481,8 @@ define([
|
||||||
|
|
||||||
var text = typeof findText === 'string' ? findText : (this.api.asc_GetSelectedText() || this._state.searchText);
|
var text = typeof findText === 'string' ? findText : (this.api.asc_GetSelectedText() || 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() ||
|
(!text && !this.view.inputText.getValue() ||
|
||||||
|
!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
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -494,14 +494,12 @@ define([
|
||||||
}
|
}
|
||||||
|
|
||||||
this.hideResults();
|
this.hideResults();
|
||||||
if (text && text !== '' && text === this._state.searchText) { // search was made
|
if (this._state.searchText !== undefined && text === this._state.searchText) { // search was made
|
||||||
//this.view.disableReplaceButtons(false);
|
|
||||||
this.api.asc_StartTextAroundSearch();
|
this.api.asc_StartTextAroundSearch();
|
||||||
} else if (text && text !== '') { // search wasn't made
|
} else if (this._state.searchText !== undefined) { // search wasn't made
|
||||||
this.onInputSearchChange(text);
|
this.onInputSearchChange(text);
|
||||||
} else {
|
} else {
|
||||||
this.resultItems = [];
|
this.resultItems = [];
|
||||||
//this.view.disableReplaceButtons(true);
|
|
||||||
this.view.clearResultsNumber();
|
this.view.clearResultsNumber();
|
||||||
}
|
}
|
||||||
this.view.disableNavButtons(this._state.currentResult, this._state.resultsNumber);
|
this.view.disableNavButtons(this._state.currentResult, this._state.resultsNumber);
|
||||||
|
|
Loading…
Reference in a new issue