[common] Edits toolbar and corrected searchbar

This commit is contained in:
SergeyEzhin 2021-04-30 01:18:03 +03:00
parent 482feeb67d
commit 45b0cb2bac
13 changed files with 101 additions and 33 deletions

View file

@ -9,7 +9,8 @@ import { observable, runInAction } from "mobx";
import { observer } from "mobx-react";
const searchOptions = observable({
usereplace: false
usereplace: false,
isReplaceAll: false
});
const popoverStyle = {
@ -31,15 +32,20 @@ class SearchSettingsView extends Component {
searchBy: 1,
lookIn: 1,
isMatchCase: false,
isMatchCell: false
isMatchCell: false,
isReplaceAll: false
};
}
onFindReplaceClick(action) {
runInAction(() => searchOptions.usereplace = action == 'replace');
runInAction(() => {
searchOptions.usereplace = action == 'replace';
searchOptions.isReplaceAll = action == 'replace-all';
});
this.setState({
useReplace: searchOptions.usereplace
useReplace: searchOptions.usereplace,
isReplaceAll: searchOptions.isReplaceAll
});
if (this.onReplaceChecked) {}
@ -251,14 +257,15 @@ class SearchView extends Component {
render() {
const usereplace = searchOptions.usereplace;
const hidden = {display: "none"};
const isReplaceAll = searchOptions.isReplaceAll;
// const hidden = {display: "none"};
const searchQuery = this.state.searchQuery;
const replaceQuery = this.state.replaceQuery;
const isIos = Device.ios;
const { _t } = this.props;
if(this.searchbar && this.searchbar.enabled) {
usereplace ? this.searchbar.el.classList.add('replace') : this.searchbar.el.classList.remove('replace');
usereplace || isReplaceAll ? this.searchbar.el.classList.add('replace') : this.searchbar.el.classList.remove('replace');
}
return (
@ -277,17 +284,25 @@ class SearchView extends Component {
{isIos ? <i className="searchbar-icon" /> : null}
<span className="input-clear-button" />
</div>
<div className="searchbar-input-wrap" style={!usereplace ? hidden: null}>
<input placeholder={_t.textReplace} type="search" maxLength="255" id="idx-replace-val" value={replaceQuery}
onChange={e => {this.changeReplaceQuery(e.target.value)}} />
{isIos ? <i className="searchbar-icon" /> : null}
<span className="input-clear-button" />
</div>
{usereplace || isReplaceAll ?
<div className="searchbar-input-wrap">
{/* style={!usereplace ? hidden: null} */}
<input placeholder={_t.textReplace} type="search" maxLength="255" id="idx-replace-val" value={replaceQuery}
onChange={e => {this.changeReplaceQuery(e.target.value)}} />
{isIos ? <i className="searchbar-icon" /> : null}
<span className="input-clear-button" />
</div>
: null}
</div>
<div className="buttons-row searchbar-inner__right">
<div className="buttons-row buttons-row-replace">
<a id="replace-link" className={"link " + (searchQuery.trim().length ? "" : "disabled")} style={!usereplace ? hidden: null} onClick={() => this.onReplaceClick()}>{_t.textReplace}</a>
<a id="replace-all-link" className={"link " + (searchQuery.trim().length ? "" : "disabled")} style={!usereplace ? hidden: null} onClick={() => this.onReplaceAllClick()}>{_t.textReplaceAll}</a>
{/* <a id="replace-link" className={"link " + (searchQuery.trim().length ? "" : "disabled")} style={!usereplace ? hidden: null} onClick={() => this.onReplaceClick()}>{_t.textReplace}</a>
<a id="replace-all-link" className={"link " + (searchQuery.trim().length ? "" : "disabled")} style={!usereplace ? hidden: null} onClick={() => this.onReplaceAllClick()}>{_t.textReplaceAll}</a> */}
{isReplaceAll ? (
<a id="replace-all-link" className={"link " + (searchQuery.trim().length ? "" : "disabled")} onClick={() => this.onReplaceAllClick()}>{_t.textReplaceAll}</a>
) : usereplace ? (
<a id="replace-link" className={"link " + (searchQuery.trim().length ? "" : "disabled")} onClick={() => this.onReplaceClick()}>{_t.textReplace}</a>
) : null}
</div>
<div className="buttons-row">
<a className={"link icon-only prev " + (searchQuery.trim().length ? "" : "disabled")} onClick={() => this.onSearchClick(SEARCH_BACKWARD)}>

View file

@ -435,6 +435,9 @@
// Find and Replace
.navbar {
.searchbar {
background: var(--f7-navbar-bg-color);
}
.searchbar-input-wrap {
margin-right: 10px;
height: 28px;
@ -462,6 +465,10 @@
}
.searchbar-inner {
&__left {
margin-right: 10px;
justify-content: center;
}
&__right {
.buttons-row a.next {
margin-left: 15px;
@ -469,14 +476,25 @@
}
}
@media(max-width: 550px)
{
.searchbar-expandable.searchbar-enabled {
&.replace {
.searchbar-inner {
&__right {
width: 28%;
}
}
}
}
@media(max-width: 550px) {
.navbar {
.searchbar-input-wrap {
margin-right: 0;
}
}
.searchbar-expandable.searchbar-enabled {
top: 0;
.searchbar-inner {
&__left {
margin-right: 15px;
}
&__center {
flex-direction: column;
}
@ -494,6 +512,14 @@
margin: 8px 0;
}
}
&__right {
width: auto;
height: 100%;
justify-content: space-between;
.buttons-row-replace {
height: 50%;
}
}
}
}
}

View file

@ -344,13 +344,9 @@
&__center {
flex-wrap: wrap;
}
&__left {
padding-top: 4px;
}
}
.buttons-row-replace a {
color: @white;
// &__left {
// padding-top: 4px;
// }
}
.navbar {
@ -434,6 +430,7 @@
}
.buttons-row-replace a {
color: @white;
padding: 0;
}
.searchbar .buttons-row {
align-self: flex-start;

View file

@ -15,10 +15,11 @@
}
.searchbar-inner {
justify-content: space-between;
&__center {
display: flex;
align-items: center;
width: 100%;
width: 81%;
}
&__right {
display: flex;
@ -34,7 +35,9 @@
display: flex;
flex-direction: column;
align-items: center;
width: max-content;
// width: max-content;
width: 100%;
justify-content: center;
a {
font-size: 15px;
height: auto;

View file

@ -337,7 +337,8 @@
"textSearch": "Search",
"textMarginsW": "Left and right margins are too high for a given page width",
"textMarginsH": "Top and bottom margins are too high for a given page height",
"textCollaboration": "Collaboration"
"textCollaboration": "Collaboration",
"textFindAndReplaceAll": "Find and Replace All"
},
"Edit": {
"textClose": "Close",

View file

@ -35,6 +35,8 @@ class SearchSettings extends SearchSettingsView {
<List>
<ListItem radio title={_t.textFind} name="find-replace-checkbox" checked={!this.state.useReplace} onClick={e => this.onFindReplaceClick('find')} />
<ListItem radio title={_t.textFindAndReplace} name="find-replace-checkbox" checked={this.state.useReplace} onClick={e => this.onFindReplaceClick('replace')} />
<ListItem radio title={_t.textFindAndReplaceAll} name="find-replace-checkbox" checked={this.state.isReplaceAll}
onClick={() => this.onFindReplaceClick('replace-all')}></ListItem>
</List>
<List>
<ListItem title={_t.textCaseSensitive}>

View file

@ -9,7 +9,7 @@ const ToolbarView = props => {
<Fragment>
<NavLeft>
{props.isShowBack && <Link className={`btn-doc-back${props.disabledControls && ' disabled'}`} icon='icon-back' onClick={props.onBack}></Link>}
{props.isEdit && EditorUIController.getUndoRedo && EditorUIController.getUndoRedo({
{Device.ios && props.isEdit && EditorUIController.getUndoRedo && EditorUIController.getUndoRedo({
disabledUndo: !props.isCanUndo,
disabledRedo: !props.isCanRedo,
onUndoClick: props.onUndo,
@ -18,6 +18,12 @@ const ToolbarView = props => {
</NavLeft>
{!Device.phone && <NavTitle>{props.docTitle}</NavTitle>}
<NavRight>
{Device.android && props.isEdit && EditorUIController.getUndoRedo && EditorUIController.getUndoRedo({
disabledUndo: !props.isCanUndo,
disabledRedo: !props.isCanRedo,
onUndoClick: props.onUndo,
onRedoClick: props.onRedo
})}
{props.isEdit && EditorUIController.getToolbarOptions && EditorUIController.getToolbarOptions({
disabled: disableEditBtn || props.disabledControls,
onEditClick: e => props.openOptions('edit'),

View file

@ -150,7 +150,8 @@
"Settings": {
"textDone": "Done",
"textSettings": "Settings",
"textFindAndReplace": "Find and replace",
"textFindAndReplace": "Find and Replace",
"textFindAndReplaceAll": "Find and Replace All",
"textPresentationSettings": "Presentation Settings",
"textApplicationSettings": "Application Settings",
"textDownload": "Download",

View file

@ -28,6 +28,8 @@ class SearchSettings extends SearchSettingsView {
<List>
<ListItem radio title={_t.textFind} name="find-replace-checkbox" checked={!this.state.useReplace} onClick={e => this.onFindReplaceClick('find')} />
<ListItem radio title={_t.textFindAndReplace} name="find-replace-checkbox" checked={this.state.useReplace} onClick={e => this.onFindReplaceClick('replace')} />
<ListItem radio title={_t.textFindAndReplaceAll} name="find-replace-checkbox" checked={this.state.isReplaceAll}
onClick={() => this.onFindReplaceClick('replace-all')}></ListItem>
</List>
<List>
<ListItem title={_t.textCaseSensitive}>

View file

@ -8,7 +8,7 @@ const ToolbarView = props => {
<Fragment>
<NavLeft>
{props.isShowBack && <Link className={`btn-doc-back${props.disabledControls && ' disabled'}`} icon='icon-back' onClick={props.onBack}></Link>}
{props.isEdit && EditorUIController.getUndoRedo && EditorUIController.getUndoRedo({
{Device.ios && props.isEdit && EditorUIController.getUndoRedo && EditorUIController.getUndoRedo({
disabledUndo: !props.isCanUndo,
disabledRedo: !props.isCanRedo,
onUndoClick: props.onUndo,
@ -17,6 +17,12 @@ const ToolbarView = props => {
</NavLeft>
{!Device.phone && <NavTitle>{props.docTitle}</NavTitle>}
<NavRight>
{Device.android && props.isEdit && EditorUIController.getUndoRedo && EditorUIController.getUndoRedo({
disabledUndo: !props.isCanUndo,
disabledRedo: !props.isCanRedo,
onUndoClick: props.onUndo,
onRedoClick: props.onRedo
})}
<Link className={(props.disabledControls || props.disabledPreview) && 'disabled'} icon='icon-play' href={false} onClick={() => {props.openOptions('preview')}}></Link>
{props.isEdit && EditorUIController.getToolbarOptions && EditorUIController.getToolbarOptions({
disabledAdd: props.disabledAdd || props.disabledControls,

View file

@ -402,6 +402,7 @@
},
"Settings": {
"textFindAndReplace": "Find and Replace",
"textFindAndReplaceAll": "Find and Replace All",
"textSpreadsheetSettings": "Spreadsheet Settings",
"textApplicationSettings": "Application Settings",
"textDownload": "Download",

View file

@ -36,6 +36,8 @@ class SearchSettings extends SearchSettingsView {
<List>
<ListItem radio title={_t.textFind} name="find-replace-checkbox" checked={!this.state.useReplace} onClick={e => this.onFindReplaceClick('find')} />
<ListItem radio title={_t.textFindAndReplace} name="find-replace-checkbox" checked={this.state.useReplace} onClick={e => this.onFindReplaceClick('replace')} />
<ListItem radio title={_t.textFindAndReplaceAll} name="find-replace-checkbox" checked={this.state.isReplaceAll}
onClick={() => this.onFindReplaceClick('replace-all')}></ListItem>
</List>
<BlockTitle>{_t.textSearchIn}</BlockTitle>
<List>

View file

@ -8,7 +8,7 @@ const ToolbarView = props => {
<Fragment>
<NavLeft>
{props.isShowBack && <Link className={`btn-doc-back${props.disabledControls && ' disabled'}`} icon='icon-back' onClick={props.onBack}></Link>}
{props.isEdit && EditorUIController.toolbarOptions && EditorUIController.toolbarOptions.getUndoRedo({
{Device.ios && props.isEdit && EditorUIController.getUndoRedo && EditorUIController.getUndoRedo({
disabledUndo: !props.isCanUndo,
disabledRedo: !props.isCanRedo,
onUndoClick: props.onUndo,
@ -17,6 +17,12 @@ const ToolbarView = props => {
</NavLeft>
{!Device.phone && <NavTitle>{props.docTitle}</NavTitle>}
<NavRight>
{Device.android && props.isEdit && EditorUIController.getUndoRedo && EditorUIController.getUndoRedo({
disabledUndo: !props.isCanUndo,
disabledRedo: !props.isCanRedo,
onUndoClick: props.onUndo,
onRedoClick: props.onRedo
})}
{props.isEdit && EditorUIController.toolbarOptions && EditorUIController.toolbarOptions.getEditOptions({
disabled: props.disabledEditControls || props.disabledControls,
onEditClick: () => props.openOptions('edit'),