[common] Correct searchbar v.2

This commit is contained in:
SergeyEzhin 2021-10-16 02:13:31 +04:00
parent d899bcabbf
commit c45fcb0ca5

View file

@ -85,14 +85,16 @@ class SearchView extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
const $$ = Dom7;
this.state = { this.state = {
searchQuery: '', searchQuery: '',
replaceQuery: '' replaceQuery: ''
}; };
this.$editor = $$('#editor_sdk');
const $$ = Dom7;
$$(document).on('page:init', (e, page) => { $$(document).on('page:init', (e, page) => {
if(!this.searchbar) {
this.searchbar = f7.searchbar.create({ this.searchbar = f7.searchbar.create({
el: '.searchbar', el: '.searchbar',
customSearch: true, customSearch: true,
@ -105,27 +107,7 @@ class SearchView extends Component {
disable: this.onSearchbarShow.bind(this, false) disable: this.onSearchbarShow.bind(this, false)
} }
}); });
// function iOSVersion() {
// var ua = navigator.userAgent;
// var m;
// return (m = /(iPad|iPhone|iphone).*?(OS |os |OS\_)(\d+((_|\.)\d)?((_|\.)\d)?)/.exec(ua)) ? parseFloat(m[3]) : 0;
// }
const $editor = $$('#editor_sdk');
// const $replaceLink = $$('#replace-link');
if (false /* iOSVersion < 13 */) {
// $editor.on('mousedown touchstart', this.onEditorTouchStart.bind(this));
// $editor.on('mouseup touchend', this.onEditorTouchEnd.bind(this));
} else {
// $editor.on('pointerdown', this.onEditorTouchStart.bind(this));
// $editor.on('pointerup', this.onEditorTouchEnd.bind(this));
} }
$editor.on('pointerdown', this.onEditorTouchStart.bind(this));
$editor.on('pointerup', this.onEditorTouchEnd.bind(this));
// $replaceLink.on('click', this.onReplaceHold.bind(this));
}); });
this.onSettingsClick = this.onSettingsClick.bind(this); this.onSettingsClick = this.onSettingsClick.bind(this);
@ -135,7 +117,15 @@ class SearchView extends Component {
componentDidMount(){ componentDidMount(){
const $$ = Dom7; const $$ = Dom7;
this.$replace = $$('#idx-replace-val'); this.$replace = $$('#idx-replace-val');
this.$editor.on('pointerdown', this.onEditorTouchStart.bind(this));
this.$editor.on('pointerup', this.onEditorTouchEnd.bind(this));
}
componentWillUnmount() {
this.$editor.off('pointerdown', this.onEditorTouchStart.bind(this));
this.$editor.off('pointerup', this.onEditorTouchEnd.bind(this));
} }
onSettingsClick(e) { onSettingsClick(e) {