[DE mobile] Corrected Find and Replace
This commit is contained in:
parent
e866cec627
commit
e0258fa0b7
|
@ -1,5 +1,6 @@
|
|||
import React from 'react';
|
||||
import SearchView, {SearchSettingsView} from '../view/Search'
|
||||
import SearchView, {SearchSettingsView} from '../view/Search';
|
||||
import { useTranslation, withTranslation } from 'react-i18next';
|
||||
|
||||
|
||||
const SearchController = props => {
|
||||
|
|
|
@ -130,8 +130,6 @@ class SearchView extends Component {
|
|||
componentDidMount(){
|
||||
const $$ = Dom7;
|
||||
this.$replace = $$('#idx-replace-val');
|
||||
// this.t = t;
|
||||
// console.log(this.t);
|
||||
}
|
||||
|
||||
onSettingsClick(e) {
|
||||
|
@ -153,10 +151,12 @@ class SearchView extends Component {
|
|||
}
|
||||
|
||||
onSearchClick(action) {
|
||||
if (this.searchbar && this.searchbar.query) {
|
||||
if ( this.props.onSearchQuery ) {
|
||||
if (this.searchbar && this.state.searchQuery) {
|
||||
if (this.props.onSearchQuery) {
|
||||
let params = this.searchParams();
|
||||
params.find = this.state.searchQuery;
|
||||
params.forward = action != SEARCH_BACKWARD;
|
||||
// console.log(params);
|
||||
|
||||
this.props.onSearchQuery(params);
|
||||
}
|
||||
|
@ -164,27 +164,29 @@ class SearchView extends Component {
|
|||
}
|
||||
|
||||
onReplaceClick() {
|
||||
if (this.searchbar && this.searchbar.query) {
|
||||
if ( this.props.onReplaceQuery ) {
|
||||
if (this.searchbar && this.state.searchQuery) {
|
||||
if (this.props.onReplaceQuery) {
|
||||
let params = this.searchParams();
|
||||
params.find = this.state.searchQuery;
|
||||
// console.log(params);
|
||||
|
||||
this.props.onReplaceQuery(params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onReplaceAllClick() {
|
||||
if (this.searchbar && this.searchbar.query) {
|
||||
if (this.searchbar && this.state.searchQuery) {
|
||||
if (this.props.onReplaceAllQuery) {
|
||||
let params = this.searchParams();
|
||||
params.find = this.state.searchQuery;
|
||||
// console.log(params);
|
||||
|
||||
this.props.onReplaceAllQuery(params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// onReplaceHold() {
|
||||
// f7.dialog.alert('Tap hold fired!');
|
||||
// }
|
||||
|
||||
onSearchbarShow(isshowed, bar) {
|
||||
if ( !isshowed ) {
|
||||
this.$replace.val('');
|
||||
|
@ -241,11 +243,13 @@ 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);
|
||||
|
||||
if(this.searchbar && this.searchbar.enabled) {
|
||||
usereplace ? this.searchbar.el.classList.add('replace') : this.searchbar.el.classList.remove('replace');
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<form className="searchbar">
|
||||
|
|
|
@ -398,6 +398,9 @@
|
|||
margin-right: 10px;
|
||||
height: 28px;
|
||||
}
|
||||
.buttons-row-replace a {
|
||||
color: @themeColor;
|
||||
}
|
||||
}
|
||||
|
||||
.searchbar input[type=search] {
|
||||
|
@ -417,10 +420,18 @@
|
|||
padding: 0 28px;
|
||||
}
|
||||
|
||||
.searchbar-inner {
|
||||
&__right {
|
||||
.buttons-row a.next {
|
||||
margin-left: 15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media(max-width: 550px)
|
||||
{
|
||||
.searchbar-expandable.searchbar-enabled {
|
||||
top: auto;
|
||||
top: 0;
|
||||
.searchbar-inner {
|
||||
&__left {
|
||||
margin-right: 15px;
|
||||
|
@ -435,12 +446,7 @@
|
|||
}
|
||||
&.replace {
|
||||
height: 88px;
|
||||
top: 0;
|
||||
.searchbar-inner {
|
||||
height: 100%;
|
||||
&__left {
|
||||
align-items: flex-start;
|
||||
}
|
||||
&__center {
|
||||
.searchbar-input-wrap {
|
||||
margin: 8px 0;
|
||||
|
|
|
@ -293,6 +293,9 @@
|
|||
&__center {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
&__left {
|
||||
padding-top: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.buttons-row-replace a {
|
||||
|
@ -354,10 +357,10 @@
|
|||
color: @white;
|
||||
}
|
||||
|
||||
.navbar.with-searchbar-expandable-enabled, .navbar.with-searchbar-expandable-enabled {
|
||||
.navbar {
|
||||
.searchbar-expandable.searchbar-enabled {
|
||||
top: 0;
|
||||
height: 100%;
|
||||
// height: 100%;
|
||||
.searchbar-inner {
|
||||
height: 100%;
|
||||
&__center {
|
||||
|
@ -365,19 +368,25 @@
|
|||
}
|
||||
&__right {
|
||||
flex-direction: column-reverse;
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
&.replace {
|
||||
height: 96px;
|
||||
.searchbar-inner {
|
||||
height: 100%;
|
||||
&__left {
|
||||
align-items: flex-start;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
a.link {
|
||||
padding: 0 16px;
|
||||
}
|
||||
a.icon-only {
|
||||
width: auto;
|
||||
height: 48px;
|
||||
}
|
||||
.buttons-row-replace a {
|
||||
color: @white;
|
||||
}
|
||||
.searchbar .buttons-row {
|
||||
align-self: flex-start;
|
||||
}
|
||||
}
|
||||
|
||||
@media(max-width: 550px) {
|
||||
|
|
|
@ -4,5 +4,21 @@
|
|||
&.icon_mask {
|
||||
background-color: white;
|
||||
}
|
||||
&.icon-prev {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
.encoded-svg-background('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 0 22 22" fill="@{themeColor}"><g><path d="M16,20.5L15,21.5L4.5,11l0,0l0,0L15,0.5L16,1.5L6.6,11L16,20.5z"/></g></svg>');
|
||||
&:after {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
&.icon-next {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
.encoded-svg-background('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 0 22 22" fill="@{themeColor}"><g><path d="M15.5,11L6,1.5l1.1-1.1L17.5,11l0,0l0,0L7.1,21.5L6,20.5L15.5,11z"/></g></svg>');
|
||||
&:after {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,5 +4,21 @@
|
|||
&.icon_mask {
|
||||
background-color: black;
|
||||
}
|
||||
&.icon-prev {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
.encoded-svg-background('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 0 22 22" fill="@{white}"><g><polygon points="5.1,10.9 13.9,2 16,4.1 9.2,11.1 16,17.9 13.9,20 5.1,11.2 5,11.1 "/></g></svg>');
|
||||
&:after {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
&.icon-next {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
.encoded-svg-background('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 0 22 22" fill="@{white}"><g><polygon points="16.9,10.9 8.1,2 6,4.1 12.8,11.1 6,17.9 8.1,20 16.9,11.2 17,11.1 "/></g></svg>');
|
||||
&:after {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
.searchbar-expandable {
|
||||
transition-duration: 0s;
|
||||
}
|
||||
|
||||
.buttons-row-replace {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
@ -42,7 +46,6 @@
|
|||
@media(max-width: 550px)
|
||||
{
|
||||
.searchbar-expandable.searchbar-enabled {
|
||||
top: auto;
|
||||
.searchbar-inner {
|
||||
&__left {
|
||||
min-width: 22px;
|
||||
|
@ -53,16 +56,14 @@
|
|||
}
|
||||
&__right {
|
||||
flex-direction: column-reverse;
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
&.replace {
|
||||
height: 88px;
|
||||
top: 0;
|
||||
.searchbar-inner {
|
||||
height: 100%;
|
||||
&__left {
|
||||
align-items: flex-start;
|
||||
align-self: flex-start;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import React from 'react';
|
|||
import { List, ListItem, Toggle } 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 { useTranslation, withTranslation } from 'react-i18next';
|
||||
|
||||
class SearchSettings extends SearchSettingsView {
|
||||
constructor(props) {
|
||||
|
@ -58,12 +58,16 @@ class DESearchView extends SearchView {
|
|||
}
|
||||
|
||||
const Search = props => {
|
||||
// const { t } = useTranslation();
|
||||
// const _t = t('View.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) ) {
|
||||
// const { t } = useTranslation();
|
||||
// const _t = t('View.Settings', {returnObjects: true});
|
||||
f7.dialog.alert(null, 'Text not Found');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,22 +57,6 @@
|
|||
height: 24px;
|
||||
.encoded-svg-background('<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M7 12C7 13.6569 5.65685 15 4 15C2.34315 15 1 13.6569 1 12C1 10.3431 2.34315 9 4 9C5.65685 9 7 10.3431 7 12ZM15 12C15 13.6569 13.6569 15 12 15C10.3431 15 9 13.6569 9 12C9 10.3431 10.3431 9 12 9C13.6569 9 15 10.3431 15 12ZM20 15C21.6569 15 23 13.6569 23 12C23 10.3431 21.6569 9 20 9C18.3431 9 17 10.3431 17 12C17 13.6569 18.3431 15 20 15Z" fill="@{navBarIconColor}"/></svg>');
|
||||
}
|
||||
&.icon-prev {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
.encoded-svg-background('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 0 22 22" fill="@{white}"><g><polygon points="5.1,10.9 13.9,2 16,4.1 9.2,11.1 16,17.9 13.9,20 5.1,11.2 5,11.1 "/></g></svg>');
|
||||
&:after {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
&.icon-next {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
.encoded-svg-background('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 0 22 22" fill="@{white}"><g><polygon points="16.9,10.9 8.1,2 6,4.1 12.8,11.1 6,17.9 8.1,20 16.9,11.2 17,11.1 "/></g></svg>');
|
||||
&:after {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
i.icon {
|
||||
|
@ -95,7 +79,7 @@
|
|||
&.icon-search {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
.encoded-svg-background('<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 22 22" fill="@{navBarIconColor}"><g><path d="M19.5,16.8L16,13.3c0.7-1.1,1.1-2.4,1.1-3.8C17,5.4,13.6,2,9.5,2S2,5.4,2,9.5S5.4,17,9.5,17c1.4,0,2.7-0.4,3.8-1.1l3.5,3.5c0.7,0.7,1.9,0.7,2.6,0C20.2,18.7,20.2,17.6,19.5,16.8z M9.5,15.3c-3.2,0-5.8-2.6-5.8-5.8s2.6-5.8,5.8-5.8s5.8,2.6,5.8,5.8S12.7,15.3,9.5,15.3z"/></g></svg>');
|
||||
.encoded-svg-background('<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 22 22" fill="@{themeColor}"><g><path d="M19.5,16.8L16,13.3c0.7-1.1,1.1-2.4,1.1-3.8C17,5.4,13.6,2,9.5,2S2,5.4,2,9.5S5.4,17,9.5,17c1.4,0,2.7-0.4,3.8-1.1l3.5,3.5c0.7,0.7,1.9,0.7,2.6,0C20.2,18.7,20.2,17.6,19.5,16.8z M9.5,15.3c-3.2,0-5.8-2.6-5.8-5.8s2.6-5.8,5.8-5.8s5.8,2.6,5.8,5.8S12.7,15.3,9.5,15.3z"/></g></svg>');
|
||||
}
|
||||
&.icon-reader {
|
||||
width: 22px;
|
||||
|
|
Loading…
Reference in a new issue