diff --git a/apps/common/mobile/lib/controller/Search.jsx b/apps/common/mobile/lib/controller/Search.jsx
index cd686b884..8a0983a5d 100644
--- a/apps/common/mobile/lib/controller/Search.jsx
+++ b/apps/common/mobile/lib/controller/Search.jsx
@@ -1,7 +1,5 @@
import React from 'react';
-import SearchView, {SearchSettingsView} from '../view/Search';
-import { useTranslation, withTranslation } from 'react-i18next';
-
+import {SearchView, SearchSettingsView} from '../view/Search';
const SearchController = props => {
const onSearchQuery = params => {
diff --git a/apps/common/mobile/lib/view/Search.jsx b/apps/common/mobile/lib/view/Search.jsx
index ee5f42d4b..8ab31b908 100644
--- a/apps/common/mobile/lib/view/Search.jsx
+++ b/apps/common/mobile/lib/view/Search.jsx
@@ -6,7 +6,6 @@ import { Dom7 } from 'framework7';
import { Device } from '../../../../common/mobile/utils/device';
import { observable, runInAction } from "mobx";
import { observer } from "mobx-react";
-import { useTranslation, withTranslation } from 'react-i18next';
const searchOptions = observable({
usereplace: false
@@ -25,8 +24,13 @@ class SearchSettingsView extends Component {
this.state = {
useReplace: false,
- caseSensitive: false,
- markResults: false
+ // caseSensitive: false,
+ // markResults: false
+ searchIn: 0,
+ searchBy: 1,
+ lookIn: 1,
+ isMatchCase: false,
+ isMatchCell: false
};
}
@@ -45,25 +49,21 @@ class SearchSettingsView extends Component {
render() {
const show_popover = !Device.phone;
- const navbar =
-
- {!show_popover &&
-
- Done
-
- }
- ;
+ // const navbar =
+ //
+ // {!show_popover &&
+ //
+ // Done
+ //
+ // }
+ // ;
const extra = this.extraSearchOptions();
const content =
-
- {navbar}
-
- this.onFindReplaceClick('find')} />
- this.onFindReplaceClick('replace')} />
-
- { extra }
-
+ {/* */}
+ {/* {navbar} */}
+ {extra}
+ {/* */}
;
return (
show_popover ?
@@ -73,7 +73,7 @@ class SearchSettingsView extends Component {
}
}
-@observer
+// @observer
class SearchView extends Component {
constructor(props) {
super(props);
@@ -107,7 +107,7 @@ class SearchView extends Component {
// }
const $editor = $$('#editor_sdk');
- const $replaceLink = $$('#replace-link');
+ // const $replaceLink = $$('#replace-link');
if (false /*iOSVersion() < 13*/) {
// $editor.single('mousedown touchstart', _.bind(me.onEditorTouchStart, me));
@@ -203,11 +203,20 @@ class SearchView extends Component {
const endPoint = this.pointerPosition(e);
// console.log(endPoint);
- if ( this.searchbar.enabled ) {
- const distance = (this.startPoint.x === undefined || this.startPoint.y === undefined) ? 0 :
- Math.sqrt((endPoint.x -= this.startPoint.x) * endPoint.x + (endPoint.y -= this.startPoint.y) * endPoint.y);
+ if (this.searchbar.enabled) {
+ let distance;
- if ( distance < 1 ) {
+ if(this.startPoint) {
+ distance = (!!this.startPoint.x || !!this.startPoint.y) ? 0 :
+ Math.sqrt((endPoint.x -= this.startPoint.x) * endPoint.x + (endPoint.y -= this.startPoint.y) * endPoint.y);
+ } else {
+ distance = 0;
+ }
+
+ // const distance = (this.startPoint.x === undefined || this.startPoint.y === undefined) ? 0 :
+ // Math.sqrt((endPoint.x -= this.startPoint.x) * endPoint.x + (endPoint.y -= this.startPoint.y) * endPoint.y);
+
+ if (distance < 1) {
this.searchbar.disable();
}
}
@@ -219,8 +228,7 @@ class SearchView extends Component {
const touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
out.x = touch.pageX;
out.y = touch.pageY;
- } else
- if ( e.type == 'mousedown' || e.type == 'mouseup' ) {
+ } else if ( e.type == 'mousedown' || e.type == 'mouseup' ) {
out.x = e.pageX;
out.y = e.pageY;
}
@@ -246,9 +254,7 @@ class SearchView extends Component {
const searchQuery = this.state.searchQuery;
const replaceQuery = this.state.replaceQuery;
const isIos = Device.ios;
-
- // const _t = this.t('View.Settings', {returnObjects: true});
- // console.log(this.state.searchQuery, this.state.replaceQuery);
+ const { _t } = this.props;
if(this.searchbar && this.searchbar.enabled) {
usereplace ? this.searchbar.el.classList.add('replace') : this.searchbar.el.classList.remove('replace');
@@ -265,13 +271,13 @@ class SearchView extends Component {
- {this.changeSearchQuery(e.target.value)}} />
{isIos ? : null}
- {this.changeReplaceQuery(e.target.value)}} />
{isIos ? : null}
@@ -279,8 +285,8 @@ class SearchView extends Component {
this.onSearchClick(SEARCH_BACKWARD)}>
@@ -297,4 +303,6 @@ class SearchView extends Component {
}
}
-export {SearchView as default, SearchView, SearchSettingsView};
+const SearchViewWithObserver = observer(SearchView);
+
+export {SearchViewWithObserver as SearchView, SearchSettingsView};
diff --git a/apps/documenteditor/mobile/locale/en.json b/apps/documenteditor/mobile/locale/en.json
index 9ef6d3d38..2943e90e6 100644
--- a/apps/documenteditor/mobile/locale/en.json
+++ b/apps/documenteditor/mobile/locale/en.json
@@ -198,7 +198,10 @@
"txtProtected": "Once you enter the password and open the file, the current password to the file will be reset",
"textNoTextFound": "Text not found",
"textReplace": "Replace",
- "textReplaceAll": "Replace All"
+ "textReplaceAll": "Replace All",
+ "textCaseSensitive": "Case Sensitive",
+ "textHighlightResults": "Highlight Results",
+ "textSearch": "Search"
},
"Edit": {
"textClose": "Close",
diff --git a/apps/documenteditor/mobile/src/controller/Search.jsx b/apps/documenteditor/mobile/src/controller/Search.jsx
index 0da97f37e..4184133cc 100644
--- a/apps/documenteditor/mobile/src/controller/Search.jsx
+++ b/apps/documenteditor/mobile/src/controller/Search.jsx
@@ -1,8 +1,9 @@
import React from 'react';
-import { List, ListItem, Toggle } from 'framework7-react';
+import { List, ListItem, Toggle, Page, Navbar, NavRight, Link } from 'framework7-react';
import { SearchController, SearchView, SearchSettingsView } from '../../../../common/mobile/lib/controller/Search';
import { f7 } from 'framework7-react';
-import { useTranslation, withTranslation } from 'react-i18next';
+import { withTranslation } from 'react-i18next';
+import { Device } from '../../../../common/mobile/utils/device';
class SearchSettings extends SearchSettingsView {
constructor(props) {
@@ -18,21 +19,43 @@ class SearchSettings extends SearchSettingsView {
extraSearchOptions() {
const anc_markup = super.extraSearchOptions();
+ const show_popover = !Device.phone;
+ const { t } = this.props;
+ const _t = t("Settings", {returnObjects: true});
- const markup =
-
+ const markup = (
+
+
+ {!show_popover &&
+
+ {_t.textDone}
+
+ }
+
+
+ this.onFindReplaceClick('find')} />
+ this.onFindReplaceClick('replace')} />
+
+
+
-
+
-
;
+
+
+ );
return {...anc_markup, ...markup};
}
}
class DESearchView extends SearchView {
+ constructor(props) {
+ super(props);
+ }
+
searchParams() {
let params = super.searchParams();
@@ -57,16 +80,16 @@ class DESearchView extends SearchView {
}
}
-const Search = props => {
- // const { t } = useTranslation();
- // const _t = t('View.Settings', {returnObjects: true});
+const Search = withTranslation()(props => {
+ const { t } = props;
+ const _t = t('Settings', {returnObjects: true});
const onSearchQuery = params => {
const api = Common.EditorApi.get();
if (params.find && params.find.length) {
if (!api.asc_findText(params.find, params.forward, params.caseSensitive, params.highlight) ) {
- f7.dialog.alert(null, 'Text not Found');
+ f7.dialog.alert(null, _t.textNoTextFound);
}
}
};
@@ -87,7 +110,9 @@ const Search = props => {
}
}
- return
-};
+ return
+});
-export {Search, SearchSettings}
+const SearchSettingsWithTranslation = withTranslation()(SearchSettings);
+
+export {Search, SearchSettingsWithTranslation as SearchSettings}
diff --git a/apps/documenteditor/mobile/src/page/main.jsx b/apps/documenteditor/mobile/src/page/main.jsx
index 38d3e529f..4598f8f32 100644
--- a/apps/documenteditor/mobile/src/page/main.jsx
+++ b/apps/documenteditor/mobile/src/page/main.jsx
@@ -71,7 +71,7 @@ export default class MainPage extends Component {
this.handleClickToOpenOptions('settings')}>
{/* { Device.phone ? null : } */}
-
+
{/* Page content */}
@@ -80,7 +80,7 @@ export default class MainPage extends Component {
{/* {
Device.phone ? null :
} */}
-
+
{
!this.state.editOptionsVisible ? null :
diff --git a/apps/presentationeditor/mobile/locale/en.json b/apps/presentationeditor/mobile/locale/en.json
index ea418aa9c..15ec8dca9 100644
--- a/apps/presentationeditor/mobile/locale/en.json
+++ b/apps/presentationeditor/mobile/locale/en.json
@@ -71,7 +71,14 @@
"textAddress": "address:",
"textEmail": "email:",
"textTel": "tel:",
- "textPoweredBy": "Powered By"
+ "textPoweredBy": "Powered By",
+ "textReplaceAll": "Replace All",
+ "textFind": "Find",
+ "textSearch": "Search",
+ "textCaseSensitive": "Case Sensitive",
+ "textHighlight": "Highlight Results",
+ "textReplace": "Replace",
+ "textNoTextFound": "Text not Found"
},
"Add": {
"textSlide": "Slide",
@@ -245,14 +252,14 @@
"textDisplay": "Display",
"textScreenTip": "Screen Tip",
"textDefault": "Selected text",
- "textNoTextFound": "Text not found",
"textReplaceAll": "Replace All",
"textFind": "Find",
"textFindAndReplace": "Find and Replace",
"textDone": "Done",
"textSearch": "Search",
- "textCase": "Case sensitive",
- "textHighlight": "Highlight results"
+ "textCaseSensitive": "Case Sensitive",
+ "textHighlight": "Highlight Results",
+ "textNoTextFound": "Text not Found"
}
},
"Common": {
diff --git a/apps/presentationeditor/mobile/src/controller/Search.jsx b/apps/presentationeditor/mobile/src/controller/Search.jsx
index ae761031e..d99567a2d 100644
--- a/apps/presentationeditor/mobile/src/controller/Search.jsx
+++ b/apps/presentationeditor/mobile/src/controller/Search.jsx
@@ -1,8 +1,9 @@
import React from 'react';
-import { List, ListItem, Toggle } from 'framework7-react';
+import { List, ListItem, Toggle, Page, Navbar, NavRight, Link } from 'framework7-react';
import { SearchController, SearchView, SearchSettingsView } from '../../../../common/mobile/lib/controller/Search';
import { f7 } from 'framework7-react';
-import { useTranslation, withTranslation } from 'react-i18next';
+import { withTranslation } from 'react-i18next';
+import { Device } from '../../../../common/mobile/utils/device';
class SearchSettings extends SearchSettingsView {
constructor(props) {
@@ -11,18 +12,40 @@ class SearchSettings extends SearchSettingsView {
extraSearchOptions() {
const anc_markup = super.extraSearchOptions();
+ const show_popover = !Device.phone;
+ const { t } = this.props;
+ const _t = t("View.Settings", {returnObjects: true});
- const markup =
-
+ const markup = (
+
+
+ {!show_popover &&
+
+ {_t.textDone}
+
+ }
+
+
+ this.onFindReplaceClick('find')} />
+ this.onFindReplaceClick('replace')} />
+
+
+
-
;
+
+
+ );
return {...anc_markup, ...markup};
}
}
class PESearchView extends SearchView {
+ constructor(props) {
+ super(props);
+ }
+
searchParams() {
let params = super.searchParams();
@@ -39,16 +62,16 @@ class PESearchView extends SearchView {
}
}
-const Search = props => {
- // const { t } = useTranslation();
- // const _t = t('View.Settings', {returnObjects: true});
+const Search = withTranslation()(props => {
+ const { t } = props;
+ const _t = t('View.Settings', {returnObjects: true});
const onSearchQuery = params => {
const api = Common.EditorApi.get();
if (params.find && params.find.length) {
if (!api.findText(params.find, params.forward, params.caseSensitive) ) {
- f7.dialog.alert(null, 'Text not Found');
+ f7.dialog.alert(null, _t.textNoTextFound);
}
}
};
@@ -69,7 +92,9 @@ const Search = props => {
}
}
- return
-};
+ return
+});
-export {Search, SearchSettings}
+const SearchSettingsWithTranslation = withTranslation()(SearchSettings);
+
+export {Search, SearchSettingsWithTranslation as SearchSettings}
diff --git a/apps/presentationeditor/mobile/src/page/main.jsx b/apps/presentationeditor/mobile/src/page/main.jsx
index 2f4844379..e1c094826 100644
--- a/apps/presentationeditor/mobile/src/page/main.jsx
+++ b/apps/presentationeditor/mobile/src/page/main.jsx
@@ -64,12 +64,12 @@ export default class MainPage extends Component {
this.handleClickToOpenOptions('coauth')}>
this.handleClickToOpenOptions('settings')}>
-
+
{/* Page content */}
-
+
{
!this.state.editOptionsVisible ? null :