Merge pull request #1831 from ONLYOFFICE/fix/fix-bugs

[SSE] Bug 57795, 57797
This commit is contained in:
maxkadushkin 2022-06-28 11:32:23 +03:00 committed by GitHub
commit 48972b04e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -105,6 +105,7 @@ define([
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_onRemoveTextAroundSearch', _.bind(this.onApiRemoveTextAroundSearch, this));
this.api.asc_registerCallback('asc_onSearchEnd', _.bind(this.onApiSearchEnd, this));
}
return this;
},
@ -314,9 +315,9 @@ define([
var me = this;
if (this.api.isReplaceAll) {
if (!found) {
this.allResultsWasRemoved();
this.removeResultItems();
} else {
!(found-replaced) && this.allResultsWasRemoved();
!(found-replaced) && this.removeResultItems();
Common.UI.info({
msg: !(found-replaced) ? Common.Utils.String.format(this.textReplaceSuccess,replaced) : Common.Utils.String.format(this.textReplaceSkipped,found-replaced),
callback: function() {
@ -337,15 +338,15 @@ define([
options.asc_setScanByRows(this._state.searchByRows);
options.asc_setLookIn(this._state.lookInFormulas ? Asc.c_oAscFindLookIn.Formulas : Asc.c_oAscFindLookIn.Value);
if (!this.api.asc_findText(options)) {
this.allResultsWasRemoved();
this.removeResultItems();
}
}
},
allResultsWasRemoved: function () {
removeResultItems: function (type) {
this.resultItems = [];
this.hideResults();
this.view.updateResultsNumber(undefined, 0);
this.view.updateResultsNumber(type, 0); // type === undefined, count === 0 -> no matches
//this.view.disableReplaceButtons(true);
this._state.currentResult = 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.',
textReplaceSuccess: 'Search has been done. {0} occurrences have been replaced',
textReplaceSkipped: 'The replacement has been made. {0} occurrences were skipped.',