[PE] Bug 57795, 57797

This commit is contained in:
JuliaSvinareva 2022-06-27 11:41:34 +03:00
parent e00199071e
commit 02d81d88d3

View file

@ -97,6 +97,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;
}, },
@ -198,7 +199,7 @@ define([
searchSettings.put_MatchCase(this._state.matchCase); searchSettings.put_MatchCase(this._state.matchCase);
searchSettings.put_WholeWords(this._state.matchWord); searchSettings.put_WholeWords(this._state.matchWord);
if (!this.api.asc_replaceText(searchSettings, textReplace, false)) { if (!this.api.asc_replaceText(searchSettings, textReplace, false)) {
this.allResultsWasRemoved(); this.removeResultItems();
} }
} }
}, },
@ -211,14 +212,14 @@ define([
searchSettings.put_WholeWords(this._state.matchWord); searchSettings.put_WholeWords(this._state.matchWord);
this.api.asc_replaceText(searchSettings, textReplace, true); this.api.asc_replaceText(searchSettings, textReplace, true);
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;
@ -373,6 +374,10 @@ define([
this.hideResults(); this.hideResults();
}, },
onApiSearchEnd: function () {
this.removeResultItems('stop');
},
notcriticalErrorTitle: 'Warning', notcriticalErrorTitle: 'Warning',
warnReplaceString: '{0} is not a valid special character for the Replace With box.' warnReplaceString: '{0} is not a valid special character for the Replace With box.'