[SSE] Bug 57795, 57797

This commit is contained in:
JuliaSvinareva 2022-06-27 20:31:43 +03:00
parent 200acbcc4f
commit e2889c06c3

View file

@ -105,6 +105,7 @@ define([
this.api.asc_registerCallback('asc_onEndTextAroundSearch', _.bind(this.onEndTextAroundSearch, this)); this.api.asc_registerCallback('asc_onEndTextAroundSearch', _.bind(this.onEndTextAroundSearch, this));
this.api.asc_registerCallback('asc_onGetTextAroundSearchPack', _.bind(this.onApiGetTextAroundSearch, this)); this.api.asc_registerCallback('asc_onGetTextAroundSearchPack', _.bind(this.onApiGetTextAroundSearch, this));
this.api.asc_registerCallback('asc_onRemoveTextAroundSearch', _.bind(this.onApiRemoveTextAroundSearch, this)); this.api.asc_registerCallback('asc_onRemoveTextAroundSearch', _.bind(this.onApiRemoveTextAroundSearch, this));
this.api.asc_registerCallback('asc_onSearchEnd', _.bind(this.onApiSearchEnd, this));
} }
return this; return this;
}, },
@ -314,9 +315,9 @@ define([
var me = this; var me = this;
if (this.api.isReplaceAll) { if (this.api.isReplaceAll) {
if (!found) { if (!found) {
this.allResultsWasRemoved(); this.removeResultItems();
} else { } else {
!(found-replaced) && this.allResultsWasRemoved(); !(found-replaced) && this.removeResultItems();
Common.UI.info({ Common.UI.info({
msg: !(found-replaced) ? Common.Utils.String.format(this.textReplaceSuccess,replaced) : Common.Utils.String.format(this.textReplaceSkipped,found-replaced), msg: !(found-replaced) ? Common.Utils.String.format(this.textReplaceSuccess,replaced) : Common.Utils.String.format(this.textReplaceSkipped,found-replaced),
callback: function() { callback: function() {
@ -337,15 +338,15 @@ define([
options.asc_setScanByRows(this._state.searchByRows); options.asc_setScanByRows(this._state.searchByRows);
options.asc_setLookIn(this._state.lookInFormulas ? Asc.c_oAscFindLookIn.Formulas : Asc.c_oAscFindLookIn.Value); options.asc_setLookIn(this._state.lookInFormulas ? Asc.c_oAscFindLookIn.Formulas : Asc.c_oAscFindLookIn.Value);
if (!this.api.asc_findText(options)) { if (!this.api.asc_findText(options)) {
this.allResultsWasRemoved(); this.removeResultItems();
} }
} }
}, },
allResultsWasRemoved: function () { removeResultItems: function (type) {
this.resultItems = []; this.resultItems = [];
this.hideResults(); this.hideResults();
this.view.updateResultsNumber(undefined, 0); this.view.updateResultsNumber(type, 0); // type === undefined, count === 0 -> no matches
//this.view.disableReplaceButtons(true); //this.view.disableReplaceButtons(true);
this._state.currentResult = 0; this._state.currentResult = 0;
this._state.resultsNumber = 0; this._state.resultsNumber = 0;
@ -541,6 +542,10 @@ define([
} }
}, },
onApiSearchEnd: function () {
this.removeResultItems('stop');
},
textNoTextFound: 'The data you have been searching for could not be found. Please adjust your search options.', textNoTextFound: 'The data you have been searching for could not be found. Please adjust your search options.',
textReplaceSuccess: 'Search has been done. {0} occurrences have been replaced', textReplaceSuccess: 'Search has been done. {0} occurrences have been replaced',
textReplaceSkipped: 'The replacement has been made. {0} occurrences were skipped.', textReplaceSkipped: 'The replacement has been made. {0} occurrences were skipped.',