diff --git a/apps/common/mobile/lib/view/Search.jsx b/apps/common/mobile/lib/view/Search.jsx index 51bca9ca5..b65518223 100644 --- a/apps/common/mobile/lib/view/Search.jsx +++ b/apps/common/mobile/lib/view/Search.jsx @@ -76,6 +76,11 @@ class SearchView extends Component { constructor(props) { super(props); + this.state = { + searchQuery: '', + replaceQuery: '' + }; + $$(document).on('page:init', (e, page) => { if ( page.name == 'home' ) { this.searchbar = f7.searchbar.create({ @@ -114,16 +119,18 @@ class SearchView extends Component { this.onSettingsClick = this.onSettingsClick.bind(this); this.onSearchClick = this.onSearchClick.bind(this); + this.onReplaceClick = this.onReplaceClick.bind(this); } componentDidMount(){ const $$ = Dom7; - this.$repalce = $$('#idx-replace-val'); + this.$replace = $$('#idx-replace-val'); } onSettingsClick(e) { if ( Device.phone ) { // f7.popup.open('.settings-popup'); + f7.popover.open('#idx-search-settings', '#idx-btn-search-settings'); } else f7.popover.open('#idx-search-settings', '#idx-btn-search-settings'); } @@ -149,9 +156,18 @@ class SearchView extends Component { } } + onReplaceClick() { + if ( this.searchbar && this.searchbar.query) { + if ( this.props.onReplaceQuery ) { + let params = this.searchParams(); + this.props.onReplaceQuery(params); + } + } + } + onSearchbarShow(isshowed, bar) { if ( !isshowed ) { - this.$repalce.val(''); + this.$replace.val(''); } } @@ -187,9 +203,27 @@ class SearchView extends Component { return out; } + changeSearchQuery(value) { + this.setState({ + searchQuery: value + }); + } + + changeReplaceQuery(value) { + this.setState({ + replaceQuery: value + }); + } + render() { const usereplace = searchOptions.usereplace; const hidden = {display: "none"}; + const searchQuery = this.state.searchQuery; + const replaceQuery = this.state.replaceQuery; + + // console.log(searchQuery); + // console.log(replaceQuery) + return (