From cde9f19aecc39030c599d8d1575b32e00c6becc0 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 25 Jan 2022 15:03:42 +0300 Subject: [PATCH 1/2] Use callback in search function --- apps/documenteditor/main/app/controller/LeftMenu.js | 10 +++++----- apps/documenteditor/mobile/src/controller/Search.jsx | 9 ++++----- .../presentationeditor/main/app/controller/LeftMenu.js | 10 +++++----- .../mobile/src/controller/Search.jsx | 7 ++++--- apps/spreadsheeteditor/main/app/controller/LeftMenu.js | 10 +++++----- .../spreadsheeteditor/mobile/src/controller/Search.jsx | 6 +++--- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index 270215f25..9d95cd407 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -560,15 +560,15 @@ define([ onQuerySearch: function(d, w, opts) { if (opts.textsearch && opts.textsearch.length) { - if (!this.api.asc_findText(opts.textsearch, d != 'back', opts.matchcase, opts.matchword)) { - var me = this; - Common.UI.info({ - msg: this.textNoTextFound, + var me = this; + this.api.asc_findText(opts.textsearch, d != 'back', opts.matchcase, function(resultCount) { + !resultCount && Common.UI.info({ + msg: me.textNoTextFound, callback: function() { me.dlgSearch.focus(); } }); - } + }); } }, diff --git a/apps/documenteditor/mobile/src/controller/Search.jsx b/apps/documenteditor/mobile/src/controller/Search.jsx index c5f062726..dca750607 100644 --- a/apps/documenteditor/mobile/src/controller/Search.jsx +++ b/apps/documenteditor/mobile/src/controller/Search.jsx @@ -110,11 +110,10 @@ const Search = withTranslation()(props => { if (params.find && params.find.length) { if(params.highlight) api.asc_selectSearchingResults(true); - - if (!api.asc_findText(params.find, params.forward, params.caseSensitive, params.highlight) ) { - f7.dialog.alert(null, _t.textNoTextFound); - } - } + + api.asc_findText(params.find, params.forward, params.caseSensitive, function(resultCount) { + !resultCount && f7.dialog.alert(null, _t.textNoTextFound); + }); }; const onchangeSearchQuery = params => { diff --git a/apps/presentationeditor/main/app/controller/LeftMenu.js b/apps/presentationeditor/main/app/controller/LeftMenu.js index 3be667173..b71cd5294 100644 --- a/apps/presentationeditor/main/app/controller/LeftMenu.js +++ b/apps/presentationeditor/main/app/controller/LeftMenu.js @@ -438,15 +438,15 @@ define([ onQuerySearch: function(d, w, opts) { if (opts.textsearch && opts.textsearch.length) { - if (!this.api.findText(opts.textsearch, d != 'back', opts.matchcase)) { - var me = this; - Common.UI.info({ - msg: this.textNoTextFound, + var me = this; + this.api.asc_findText(opts.textsearch, d != 'back', opts.matchcase, function(resultCount) { + !resultCount && Common.UI.info({ + msg: me.textNoTextFound, callback: function() { me.dlgSearch.focus(); } }); - } + }); } }, diff --git a/apps/presentationeditor/mobile/src/controller/Search.jsx b/apps/presentationeditor/mobile/src/controller/Search.jsx index 23fd51cb1..d6dc11a94 100644 --- a/apps/presentationeditor/mobile/src/controller/Search.jsx +++ b/apps/presentationeditor/mobile/src/controller/Search.jsx @@ -88,9 +88,10 @@ const Search = withTranslation()(props => { f7.popover.close('.document-menu.modal-in', false); if (params.find && params.find.length) { - if (!api.findText(params.find, params.forward, params.caseSensitive) ) { - f7.dialog.alert(null, _t.textNoTextFound); - } + api.asc_findText(params.find, params.forward, params.caseSensitive, function(resultCount) { + !resultCount && f7.dialog.alert(null, _t.textNoTextFound); + }); + } }; diff --git a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js index 40139a084..ebd80e5a2 100644 --- a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js @@ -566,15 +566,15 @@ define([ options.asc_setScanByRows(this.dlgSearch.menuSearch.menu.items[0].checked); options.asc_setLookIn(this.dlgSearch.menuLookin.menu.items[0].checked?Asc.c_oAscFindLookIn.Formulas:Asc.c_oAscFindLookIn.Value); - if (!this.api.asc_findText(options)) { - var me = this; - Common.UI.info({ - msg: this.textNoTextFound, + var me = this; + this.api.asc_findText(options, function(resultCount) { + !resultCount && Common.UI.info({ + msg: me.textNoTextFound, callback: function() { me.dlgSearch.focus(); } }); - } + }); // } }, diff --git a/apps/spreadsheeteditor/mobile/src/controller/Search.jsx b/apps/spreadsheeteditor/mobile/src/controller/Search.jsx index f67b8e065..c4d33a82c 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/Search.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/Search.jsx @@ -165,9 +165,9 @@ const Search = withTranslation()(props => { if (params.highlight) api.asc_selectSearchingResults(true); - if (!api.asc_findText(options)) { - f7.dialog.alert(null, _t.textNoTextFound); - } + api.asc_findText(options, function(resultCount) { + !resultCount && f7.dialog.alert(null, _t.textNoTextFound); + }); } }; From 9acf7e4d710dbcd72f8fb5da2182fd86abb7703c Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 25 Jan 2022 15:21:38 +0300 Subject: [PATCH 2/2] [DE mobile] Fix bug --- apps/documenteditor/mobile/src/controller/Search.jsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/documenteditor/mobile/src/controller/Search.jsx b/apps/documenteditor/mobile/src/controller/Search.jsx index dca750607..b51fadee1 100644 --- a/apps/documenteditor/mobile/src/controller/Search.jsx +++ b/apps/documenteditor/mobile/src/controller/Search.jsx @@ -108,12 +108,13 @@ const Search = withTranslation()(props => { f7.popover.close('.document-menu.modal-in', false); if (params.find && params.find.length) { - - if(params.highlight) api.asc_selectSearchingResults(true); - api.asc_findText(params.find, params.forward, params.caseSensitive, function(resultCount) { + if (params.highlight) api.asc_selectSearchingResults(true); + + api.asc_findText(params.find, params.forward, params.caseSensitive, function (resultCount) { !resultCount && f7.dialog.alert(null, _t.textNoTextFound); }); + } }; const onchangeSearchQuery = params => {