From 45aea82e9f79e633a70efe48696811b3450b95ed Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Sat, 25 Jun 2022 14:00:17 +0300 Subject: [PATCH] [DE] Bug 57795, 57797 --- apps/common/main/lib/view/SearchPanel.js | 7 +++++-- apps/documenteditor/main/app/controller/Search.js | 13 +++++++++---- apps/documenteditor/main/locale/en.json | 1 + 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/apps/common/main/lib/view/SearchPanel.js b/apps/common/main/lib/view/SearchPanel.js index 1f1d52163..a4711695e 100644 --- a/apps/common/main/lib/view/SearchPanel.js +++ b/apps/common/main/lib/view/SearchPanel.js @@ -326,7 +326,9 @@ define([ if (count > 300) { text = this.textTooManyResults; } else { - text = current === 'no-results' ? this.textNoSearchResults : (!count ? this.textNoMatches : Common.Utils.String.format(this.textSearchResults, current + 1, count)); + text = current === 'no-results' ? this.textNoSearchResults : + (current === 'stop' ? this.textSearchHasStopped : + (!count ? this.textNoMatches : Common.Utils.String.format(this.textSearchResults, current + 1, count))); } this.$reaultsNumber.text(text); this.disableReplaceButtons(!count); @@ -412,7 +414,8 @@ define([ textName: 'Name', textCell: 'Cell', textValue: 'Value', - textFormula: 'Formula' + textFormula: 'Formula', + textSearchHasStopped: 'Search has stopped' }, Common.Views.SearchPanel || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/app/controller/Search.js b/apps/documenteditor/main/app/controller/Search.js index 649e8f73c..21e8f7825 100644 --- a/apps/documenteditor/main/app/controller/Search.js +++ b/apps/documenteditor/main/app/controller/Search.js @@ -100,6 +100,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; }, @@ -215,7 +216,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(); } } }, @@ -242,14 +243,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; @@ -420,6 +421,10 @@ define([ } }, + onApiSearchEnd: function () { + this.removeResultItems('stop'); + }, + notcriticalErrorTitle: 'Warning', warnReplaceString: '{0} is not a valid special character for the Replace With box.' diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index 76ab2592b..ece2b315f 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -480,6 +480,7 @@ "Common.Views.SearchPanel.textWholeWords": "Whole words only", "Common.Views.SearchPanel.tipNextResult": "Next result", "Common.Views.SearchPanel.tipPreviousResult": "Previous result", + "Common.Views.SearchPanel.textSearchHasStopped": "Search has stopped", "Common.Views.SelectFileDlg.textLoading": "Loading", "Common.Views.SelectFileDlg.textTitle": "Select Data Source", "Common.Views.SignDialog.textBold": "Bold",