From 25b48c032e3421eeaa21728ec72b4e64564d6b22 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Mon, 21 Mar 2022 20:39:25 +0300 Subject: [PATCH] [DE] For bug 56026 --- .../main/app/controller/Search.js | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/apps/documenteditor/main/app/controller/Search.js b/apps/documenteditor/main/app/controller/Search.js index 0dca0cef6..32c0438c8 100644 --- a/apps/documenteditor/main/app/controller/Search.js +++ b/apps/documenteditor/main/app/controller/Search.js @@ -174,6 +174,20 @@ define([ onQueryReplace: function(textSearch, textReplace) { if (textSearch !== '') { + var me = this; + var str = this.api.asc_GetErrorForReplaceString(textReplace); + if (str) { + Common.UI.warning({ + title: this.notcriticalErrorTitle, + msg: Common.Utils.String.format(this.warnReplaceString, str), + buttons: ['ok'], + callback: function(){ + me.view.focus('replace'); + } + }); + return; + } + var searchSettings = new AscCommon.CSearchSettings(); searchSettings.put_Text(textSearch); searchSettings.put_MatchCase(this._state.matchCase); @@ -187,6 +201,20 @@ define([ onQueryReplaceAll: function(textSearch, textReplace) { if (textSearch !== '') { + var me = this; + var str = this.api.asc_GetErrorForReplaceString(textReplace); + if (str) { + Common.UI.warning({ + title: this.notcriticalErrorTitle, + msg: Common.Utils.String.format(this.warnReplaceString, str), + buttons: ['ok'], + callback: function(){ + me.view.focus('replace'); + } + }); + return; + } + var searchSettings = new AscCommon.CSearchSettings(); searchSettings.put_Text(textSearch); searchSettings.put_MatchCase(this._state.matchCase); @@ -284,5 +312,8 @@ define([ this.view.focus(); }, + notcriticalErrorTitle: 'Warning', + warnReplaceString: '{0} is not a valid special character for the Replace With box.' + }, DE.Controllers.Search || {})); }); \ No newline at end of file