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