From 6c10117086b8925089bdf56d83006204be594616 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Tue, 19 Jul 2022 15:46:16 +0300 Subject: [PATCH] [DE PE] Fix bug 58181 --- .../documenteditor/main/app/controller/Search.js | 16 +++++++++++++++- apps/documenteditor/main/locale/en.json | 3 +++ .../main/app/controller/Search.js | 16 +++++++++++++++- apps/presentationeditor/main/locale/en.json | 3 +++ 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Search.js b/apps/documenteditor/main/app/controller/Search.js index a48a70112..256e7b97a 100644 --- a/apps/documenteditor/main/app/controller/Search.js +++ b/apps/documenteditor/main/app/controller/Search.js @@ -107,6 +107,7 @@ define([ 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)); + this.api.asc_registerCallback('asc_onReplaceAll', _.bind(this.onApiTextReplaced, this)); } return this; }, @@ -432,8 +433,21 @@ define([ this.removeResultItems('stop'); }, + onApiTextReplaced: function(found, replaced) { + if (found) { + !(found - replaced > 0) ? + Common.UI.info( {msg: Common.Utils.String.format(this.textReplaceSuccess, replaced)} ) : + Common.UI.warning( {msg: Common.Utils.String.format(this.textReplaceSkipped, found-replaced)} ); + } else { + Common.UI.info({msg: this.textNoTextFound}); + } + }, + 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.', + textReplaceSuccess: 'Search has been done. {0} occurrences have been replaced', + textReplaceSkipped: 'The replacement has been made. {0} occurrences were skipped.', + textNoTextFound: 'The data you have been searching for could not be found. Please adjust your search options.' }, DE.Controllers.Search || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index a44fce141..a833e1ebc 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -936,6 +936,9 @@ "DE.Controllers.Navigation.txtGotoBeginning": "Go to the beginning of the document", "DE.Controllers.Search.notcriticalErrorTitle": "Warning", "DE.Controllers.Search.warnReplaceString": "{0} is not a valid special character for the Replace With box.", + "DE.Controllers.Search.textReplaceSuccess": "Search has been done. {0} occurrences have been replaced", + "DE.Controllers.Search.textReplaceSkipped": "The replacement has been made. {0} occurrences were skipped.", + "DE.Controllers.Search.textNoTextFound": "The data you have been searching for could not be found. Please adjust your search options.", "DE.Controllers.Statusbar.textDisconnect": "Connection is lost
Trying to connect. Please check connection settings.", "DE.Controllers.Statusbar.textHasChanges": "New changes have been tracked", "DE.Controllers.Statusbar.textSetTrackChanges": "You are in Track Changes mode", diff --git a/apps/presentationeditor/main/app/controller/Search.js b/apps/presentationeditor/main/app/controller/Search.js index 1dab339c6..dbd8aadac 100644 --- a/apps/presentationeditor/main/app/controller/Search.js +++ b/apps/presentationeditor/main/app/controller/Search.js @@ -104,6 +104,7 @@ define([ 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)); + this.api.asc_registerCallback('asc_onReplaceAll', _.bind(this.onApiTextReplaced, this)); } return this; }, @@ -385,8 +386,21 @@ define([ this.removeResultItems('stop'); }, + onApiTextReplaced: function(found, replaced) { + if (found) { + !(found - replaced > 0) ? + Common.UI.info( {msg: Common.Utils.String.format(this.textReplaceSuccess, replaced)} ) : + Common.UI.warning( {msg: Common.Utils.String.format(this.textReplaceSkipped, found-replaced)} ); + } else { + Common.UI.info({msg: this.textNoTextFound}); + } + }, + 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.', + textReplaceSuccess: 'Search has been done. {0} occurrences have been replaced', + textReplaceSkipped: 'The replacement has been made. {0} occurrences were skipped.', + textNoTextFound: 'The data you have been searching for could not be found. Please adjust your search options.' }, PE.Controllers.Search || {})); }); \ No newline at end of file diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index 32f62013d..d8fd9a8df 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -997,6 +997,9 @@ "PE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", "PE.Controllers.Search.notcriticalErrorTitle": "Warning", "PE.Controllers.Search.warnReplaceString": "{0} is not a valid special character for the Replace With box.", + "PE.Controllers.Search.textReplaceSuccess": "Search has been done. {0} occurrences have been replaced", + "PE.Controllers.Search.textReplaceSkipped": "The replacement has been made. {0} occurrences were skipped.", + "PE.Controllers.Search.textNoTextFound": "The data you have been searching for could not be found. Please adjust your search options.", "PE.Controllers.Statusbar.textDisconnect": "Connection is lost
Trying to connect. Please check connection settings.", "PE.Controllers.Statusbar.zoomText": "Zoom {0}%", "PE.Controllers.Toolbar.confirmAddFontName": "The font you are going to save is not available on the current device.
The text style will be displayed using one of the system fonts, the saved font will be used when it is available.
Do you want to continue?",