From 962548467f869d2b5827b597767c7495fe3874b9 Mon Sep 17 00:00:00 2001 From: ShimaginAndrey Date: Thu, 28 Oct 2021 11:31:21 +0300 Subject: [PATCH] [DE PE SSE] Edit SearchBar --- apps/common/mobile/lib/view/Search.jsx | 8 +++++--- apps/documenteditor/mobile/src/controller/Search.jsx | 12 ++++++++++-- .../mobile/src/controller/Search.jsx | 8 +++++++- .../mobile/src/controller/Search.jsx | 12 ++++++++++-- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/apps/common/mobile/lib/view/Search.jsx b/apps/common/mobile/lib/view/Search.jsx index 1a9932d06..3d9590dd8 100644 --- a/apps/common/mobile/lib/view/Search.jsx +++ b/apps/common/mobile/lib/view/Search.jsx @@ -227,6 +227,8 @@ class SearchView extends Component { this.setState({ searchQuery: value }); + + this.props.onchangeSearchQuery(value); } changeReplaceQuery(value) { @@ -240,7 +242,7 @@ class SearchView extends Component { const isReplaceAll = searchOptions.isReplaceAll; const hidden = {display: "none"}; const searchQuery = this.state.searchQuery; - // const replaceQuery = this.state.replaceQuery; + const replaceQuery = this.state.replaceQuery; const isIos = Device.ios; const { _t } = this.props; @@ -259,7 +261,7 @@ class SearchView extends Component {
- {this.changeSearchQuery(e.target.value)}} /> {isIos ? : null} this.changeSearchQuery('')} /> @@ -267,7 +269,7 @@ class SearchView extends Component { {/* {usereplace || isReplaceAll ? */}
{/* style={!usereplace ? hidden: null} */} - {this.changeReplaceQuery(e.target.value)}} /> {isIos ? : null} this.changeReplaceQuery('')} /> diff --git a/apps/documenteditor/mobile/src/controller/Search.jsx b/apps/documenteditor/mobile/src/controller/Search.jsx index c3f8ae3f9..099f5328a 100644 --- a/apps/documenteditor/mobile/src/controller/Search.jsx +++ b/apps/documenteditor/mobile/src/controller/Search.jsx @@ -81,7 +81,7 @@ class DESearchView extends SearchView { super.onSearchbarShow(isshowed, bar); const api = Common.EditorApi.get(); - if ( isshowed ) { + if ( isshowed && this.state.searchQuery.length ) { const checkboxMarkResults = f7.toggle.get('.toggle-mark-results'); api.asc_selectSearchingResults(checkboxMarkResults.checked); } else api.asc_selectSearchingResults(false); @@ -96,12 +96,20 @@ const Search = withTranslation()(props => { const api = Common.EditorApi.get(); if (params.find && params.find.length) { + + api.asc_selectSearchingResults(true); if (!api.asc_findText(params.find, params.forward, params.caseSensitive, params.highlight) ) { f7.dialog.alert(null, _t.textNoTextFound); } } }; + const onchangeSearchQuery = params => { + const api = Common.EditorApi.get(); + + if(params.length === 0) api.asc_selectSearchingResults(false); + } + const onReplaceQuery = params => { const api = Common.EditorApi.get(); @@ -118,7 +126,7 @@ const Search = withTranslation()(props => { } } - return + return }); const SearchSettingsWithTranslation = inject("storeAppOptions")(observer(withTranslation()(SearchSettings))); diff --git a/apps/presentationeditor/mobile/src/controller/Search.jsx b/apps/presentationeditor/mobile/src/controller/Search.jsx index b854ae12f..40dc92ec5 100644 --- a/apps/presentationeditor/mobile/src/controller/Search.jsx +++ b/apps/presentationeditor/mobile/src/controller/Search.jsx @@ -84,6 +84,12 @@ const Search = withTranslation()(props => { } }; + const onchangeSearchQuery = params => { + const api = Common.EditorApi.get(); + + if(params.length === 0) api.asc_selectSearchingResults(false); + } + const onReplaceQuery = params => { const api = Common.EditorApi.get(); @@ -100,7 +106,7 @@ const Search = withTranslation()(props => { } } - return + return }); const SearchSettingsWithTranslation = inject("storeAppOptions")(observer(withTranslation()(SearchSettings))); diff --git a/apps/spreadsheeteditor/mobile/src/controller/Search.jsx b/apps/spreadsheeteditor/mobile/src/controller/Search.jsx index f80e789fc..b517c82ea 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/Search.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/Search.jsx @@ -126,7 +126,7 @@ class SESearchView extends SearchView { super.onSearchbarShow(isshowed, bar); const api = Common.EditorApi.get(); - if ( isshowed ) { + if ( isshowed && this.state.searchQuery.length ) { const checkboxMarkResults = f7.toggle.get('.toggle-mark-results'); api.asc_selectSearchingResults(checkboxMarkResults.checked); } else api.asc_selectSearchingResults(false); @@ -155,12 +155,20 @@ const Search = withTranslation()(props => { options.asc_setScanByRows(searchBy); options.asc_setLookIn(lookIn ? Asc.c_oAscFindLookIn.Formulas : Asc.c_oAscFindLookIn.Value); + api.asc_selectSearchingResults(true); + if (!api.asc_findText(options)) { f7.dialog.alert(null, _t.textNoTextFound); } } }; + const onchangeSearchQuery = params => { + const api = Common.EditorApi.get(); + + if(params.length === 0) api.asc_selectSearchingResults(false); + } + const onReplaceQuery = params => { const api = Common.EditorApi.get(); let lookIn = +params.lookIn === 0; @@ -209,7 +217,7 @@ const Search = withTranslation()(props => { } } - return + return }); const SearchSettingsWithTranslation = inject("storeAppOptions")(observer(withTranslation()(SearchSettings)));