[DE PE SSE mobile] Changed adding and editing link

This commit is contained in:
SergeyEzhin 2022-06-07 00:53:07 +04:00
parent 4d8fde7ea1
commit 454878d3d7
32 changed files with 753 additions and 346 deletions

View file

@ -523,4 +523,15 @@
margin-right: 0;
}
}
// Navbar link settings
.navbar-link-settings {
.navbar-inner {
background: @background-primary;
}
.title, a {
color: @text-normal;
}
}
}

View file

@ -39,6 +39,21 @@
height: 22px;
.encoded-svg-mask('<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 22 22" fill="@{toolbar-icons}"><g><path d="M0,20h22v1H0V20z"/><polygon points="17.1,3.1 3.5,16.7 3,20 6.3,19.5 19.9,5.9"/><path d="M20.5,5.3L22,3.8c0,0-0.2-1.2-0.9-1.9C20.4,1.1,19.2,1,19.2,1l-1.5,1.5L20.5,5.3z"/></g></svg>', @toolbar-icons);
}
&.icon-close {
width: 24px;
height: 24px;
.encoded-svg-mask('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M18.9844 6.42188L13.4062 12L18.9844 17.5781L17.5781 18.9844L12 13.4062L6.42188 18.9844L5.01562 17.5781L10.5938 12L5.01562 6.42188L6.42188 5.01562L12 10.5938L17.5781 5.01562L18.9844 6.42188Z"/></svg>', @text-normal);
}
&.icon-done-disabled {
width: 24px;
height: 24px;
.encoded-svg-mask('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M9 16.2188L19.5938 5.57812L21 6.98438L9 18.9844L3.42188 13.4062L4.78125 12L9 16.2188Z"/></svg>', @text-tertiary);
}
&.icon-done {
width: 24px;
height: 24px;
.encoded-svg-mask('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M9 16.2188L19.5938 5.57812L21 6.98438L9 18.9844L3.42188 13.4062L4.78125 12L9 16.2188Z"/></svg>');
}
}
}
}

View file

@ -102,22 +102,16 @@ class ContextMenu extends ContextMenuController {
Common.Notifications.trigger('viewcomment');
break;
case 'openlink':
case 'editlink':
const stack = api.getSelectedElements();
let value;
if(action === 'openlink') {
let value;
stack.forEach((item) => {
if (item.get_ObjectType() == Asc.c_oAscTypeSelectElement.Hyperlink) {
value = item.get_ObjectValue().get_Value();
}
});
stack.forEach((item) => {
if (item.get_ObjectType() == Asc.c_oAscTypeSelectElement.Hyperlink) {
value = item.get_ObjectValue().get_Value();
}
});
value && this.openLink(value);
} else {
// console.log('edit link');
}
value && this.openLink(value);
break;
case 'review':
setTimeout(() => {

View file

@ -1,5 +1,5 @@
import React, {Component} from 'react';
import { f7, Popup, Popover } from 'framework7-react';
import { f7, Popup, Popover, View } from 'framework7-react';
import {Device} from '../../../../../common/mobile/utils/device';
import { withTranslation} from 'react-i18next';
@ -28,10 +28,8 @@ class AddLinkController extends Component {
onInsertLink (url, display, tip) {
const api = Common.EditorApi.get();
const { t } = this.props;
const _t = t("Add", { returnObjects: true });
const urltype = api.asc_getUrlType(url.trim());
const isEmail = (urltype == 2);
@ -56,13 +54,13 @@ class AddLinkController extends Component {
_url = _url.replace(new RegExp("%20",'g')," ");
const props = new Asc.CHyperlinkProperty();
props.put_Value(_url);
props.put_Text(!display ? _url : display);
// props.put_ToolTip(tip);
props.put_ToolTip(tip);
api.add_Hyperlink(props);
// this.closeModal();
this.props.isNavigate ? f7.views.current.router.back() : this.closeModal();
}
componentDidMount() {
@ -83,8 +81,10 @@ class AddLinkController extends Component {
<PageAddLink closeModal={this.closeModal} onInsertLink={this.onInsertLink} getDisplayLinkText={this.getDisplayLinkText} isNavigate={this.props.isNavigate} />
</Popup>
:
<Popover id="add-link-popover" className="popover__titled" style={{height: '410px'}} closeByOutsideClick={false} onPopoverClosed={() => this.props.onClosed('add-link')}>
<PageAddLink closeModal={this.closeModal} onInsertLink={this.onInsertLink} getDisplayLinkText={this.getDisplayLinkText} isNavigate={this.props.isNavigate}/>
<Popover id="add-link-popover" className="popover__titled" closeByOutsideClick={false} onPopoverClosed={() => this.props.onClosed('add-link')}>
<View style={{height: '410px'}}>
<PageAddLink closeModal={this.closeModal} onInsertLink={this.onInsertLink} getDisplayLinkText={this.getDisplayLinkText} isNavigate={this.props.isNavigate}/>
</View>
</Popover>
:
<PageAddLink closeModal={this.closeModal} onInsertLink={this.onInsertLink} getDisplayLinkText={this.getDisplayLinkText} isNavigate={this.props.isNavigate} />

View file

@ -1,5 +1,5 @@
import React, {Component} from 'react';
import { f7, Popover, Popup } from 'framework7-react';
import { f7, Popover, Popup, View } from 'framework7-react';
import {Device} from '../../../../../common/mobile/utils/device';
import {observer, inject} from "mobx-react";
import { withTranslation } from 'react-i18next';
@ -23,11 +23,13 @@ class EditHyperlinkController extends Component {
}
}
onEditLink (link, display) {
onEditLink (link, display, tip) {
const api = Common.EditorApi.get();
if (api) {
const urltype = api.asc_getUrlType(link.trim());
const isEmail = (urltype == 2);
if (urltype < 1) {
const { t } = this.props;
@ -43,21 +45,29 @@ class EditHyperlinkController extends Component {
return;
}
let url = link.replace(/^\s+|\s+$/g,'');
if (! /(((^https?)|(^ftp)):\/\/)|(^mailto:)/i.test(url) ) {
url = (isEmail ? 'mailto:' : 'http://') + url;
}
url = url.replace(new RegExp("%20",'g')," ");
const props = new Asc.CHyperlinkProperty();
props.put_Value(url);
props.put_Text(display.trim().length < 1 ? url : display);
// props.put_ToolTip(tip);
props.put_ToolTip(tip);
const linkObject = this.props.storeFocusObjects.linkObject;
if (linkObject) {
props.put_InternalHyperlink(linkObject.get_InternalHyperlink());
}
api.change_Hyperlink(props);
// this.closeModal();
this.props.isNavigate ? f7.views.current.router.back() : this.closeModal();
}
}
@ -66,7 +76,6 @@ class EditHyperlinkController extends Component {
if (api) {
const linkObject = this.props.storeFocusObjects.linkObject;
api.remove_Hyperlink(linkObject);
// this.closeModal();
}
}
@ -75,7 +84,7 @@ class EditHyperlinkController extends Component {
if(Device.phone) {
f7.popup.open('#edit-link-popup', true);
} else {
f7.popover.open('#edit-link-popover', '#btn-edit');
f7.popover.open('#edit-link-popover', '#btn-add');
}
}
}
@ -93,13 +102,15 @@ class EditHyperlinkController extends Component {
/>
</Popup>
:
<Popover id="edit-link-popover" className="popover__titled" style={{height: '410px'}} closeByOutsideClick={false} onPopoverClosed={() => this.props.onClosed('edit-link')}>
<EditHyperlink
onEditLink={this.onEditLink}
onRemoveLink={this.onRemoveLink}
closeModal={this.closeModal}
isNavigate={this.props.isNavigate}
/>
<Popover id="edit-link-popover" className="popover__titled" closeByOutsideClick={false} onPopoverClosed={() => this.props.onClosed('edit-link')}>
<View style={{height: '410px'}}>
<EditHyperlink
onEditLink={this.onEditLink}
onRemoveLink={this.onRemoveLink}
closeModal={this.closeModal}
isNavigate={this.props.isNavigate}
/>
</View>
</Popover>
:
<EditHyperlink

View file

@ -172,7 +172,7 @@ class MainPage extends Component {
}
{
!this.state.addOptionsVisible ? null :
<AddOptions openOptions={this.handleClickToOpenOptions.bind(this)} onCloseLinkSettings={this.handleOptionsViewClosed.bind(this)} onclosed={this.handleOptionsViewClosed.bind(this, 'add')} showOptions={this.state.addShowOptions} />
<AddOptions onCloseLinkSettings={this.handleOptionsViewClosed.bind(this)} onclosed={this.handleOptionsViewClosed.bind(this, 'add')} showOptions={this.state.addShowOptions} />
}
{
!this.state.addLinkSettingsVisible ? null :

View file

@ -185,7 +185,6 @@ const AddTabs = inject("storeFocusObjects", "storeTableSettings")(observer(({sto
plainDelLock={plainDelLock}
plainEditLock={plainEditLock}
onCloseLinkSettings={onCloseLinkSettings}
isNavigate={true}
/>
});
}

View file

@ -1,5 +1,5 @@
import React, {useState} from 'react';
import {List, Page, Navbar, Icon, ListButton, ListInput, NavRight, Link, NavLeft, f7, NavTitle, Fragment} from 'framework7-react';
import {List, Page, Navbar, Icon, ListButton, ListInput, NavRight, Link, NavLeft, f7, NavTitle} from 'framework7-react';
import { useTranslation } from 'react-i18next';
import {Device} from "../../../../../common/mobile/utils/device";
@ -12,35 +12,28 @@ const PageLink = props => {
const [stateLink, setLink] = useState('');
const [stateDisplay, setDisplay] = useState(display);
// const [stateTip, setTip] = useState('');
const [stateTip, setTip] = useState('');
const [stateAutoUpdate, setAutoUpdate] = useState(!stateDisplay ? true : false);
return (
<Page>
{/* {!props.noNavbar && <Navbar title={t('Add.textLinkSettings')} backLink={t('Add.textCancel')}>
<Navbar className="navbar-link-settings">
<NavLeft>
<Link text={Device.ios ? t('Add.textCancel') : ''} onClick={() => {
props.isNavigate ? f7.views.current.router.back() : props.closeModal();
}}>
{Device.android && <Icon icon='icon-close' />}
</Link>
</NavLeft>
<NavTitle>{t('Add.textLinkSettings')}</NavTitle>
<NavRight>
<Link className={`${stateLink.length < 1 && 'disabled'}`} onClick={() => {
props.onInsertLink(stateLink, stateDisplay);
}} text={t('Add.textDone')}></Link>
props.onInsertLink(stateLink, stateDisplay, stateTip);
}} text={Device.ios ? t('Add.textDone') : ''}>
{Device.android && <Icon icon={stateLink.length < 1 ? 'icon-done-disabled' : 'icon-done'} />}
</Link>
</NavRight>
</Navbar>} */}
{/* backLink={t('Add.textCancel') */}
{!props.noNavbar &&
<Navbar>
<NavLeft>
<Link text={t('Add.textCancel')} onClick={() => {
props.isNavigate ? f7.views.current.router.back() : props.closeModal();
}}></Link>
</NavLeft>
<NavTitle>{t('Add.textLinkSettings')}</NavTitle>
<NavRight>
<Link className={`${stateLink.length < 1 && 'disabled'}`} onClick={() => {
props.onInsertLink(stateLink, stateDisplay);
props.isNavigate ? f7.views.current.router.back() : props.closeModal();
}} text={t('Add.textDone')}></Link>
</NavRight>
</Navbar>
}
</Navbar>
<List inlineLabels className='inputs-list'>
<ListInput
label={_t.textLink}
@ -62,13 +55,13 @@ const PageLink = props => {
setAutoUpdate(event.target.value == '');
}}
></ListInput>
{/* <ListInput
<ListInput
label={_t.textScreenTip}
type="text"
placeholder={_t.textScreenTip}
value={stateTip}
onChange={(event) => {setTip(event.target.value)}}
></ListInput> */}
></ListInput>
</List>
{/* <List className="buttons-list">
<ListButton className={'button-fill button-raised' + (stateLink.length < 1 ? ' disabled' : '')} title={_t.textInsert} onClick={() => {

View file

@ -193,14 +193,10 @@ const AddOther = props => {
</ListItem>
{(isText && !disabledAddLink) && <ListItem title={_t.textLink} href={isHyperLink ? '/edit-link/' : '/add-link/'} routeProps={{
onClosed: props.onCloseLinkSettings,
isNavigate: props.isNavigate
isNavigate: true
}}>
<Icon slot="media" icon="icon-link"></Icon>
</ListItem>}
{/* routeProps={{
onInsertLink: props.onInsertLink,
getDisplayLinkText: props.getDisplayLinkText
}} */}
{!disabledAddPageNumber &&
<ListItem title={_t.textPageNumber} link={'/add-page-number/'} routeProps={{
onInsertPageNumber: props.onInsertPageNumber

View file

@ -1,42 +1,44 @@
import React, {Fragment, useState} from 'react';
import {observer, inject} from "mobx-react";
import {List, ListInput, ListButton, Page, f7, Link, Navbar, NavLeft, NavTitle, NavRight} from 'framework7-react';
import {List, ListInput, ListButton, Page, f7, Link, Navbar, NavLeft, NavTitle, NavRight, Icon} from 'framework7-react';
import { useTranslation } from 'react-i18next';
import {Device} from "../../../../../common/mobile/utils/device";
const EditHyperlink = props => {
const { t } = useTranslation();
const _t = t('Edit', {returnObjects: true});
const linkObject = props.storeFocusObjects.linkObject;
let link = '', display = '';
let link = '', display = '', tip = '';
if(linkObject) {
link = linkObject.get_Value() ? linkObject.get_Value().replace(new RegExp(" ", 'g'), "%20") : '';
display = !(linkObject.get_Text() === null) ? linkObject.get_Text() : '';
// const tip = linkObject.get_ToolTip();
// const [stateTip, setTip] = useState(tip);
tip = linkObject.get_ToolTip();
}
const [stateLink, setLink] = useState(link);
const [stateDisplay, setDisplay] = useState(display);
const [stateTip, setTip] = useState(tip);
return (
<Page>
{!props.noNavbar &&
<Navbar>
<NavLeft>
<Link text={t('Add.textCancel')} onClick={() => {
props.isNavigate ? f7.views.current.router.back() : props.closeModal();
}}></Link>
</NavLeft>
<NavTitle>{t('Add.textLinkSettings')}</NavTitle>
<NavRight>
<Link className={`${stateLink.length < 1 && 'disabled'}`} onClick={() => {
props.onEditLink(stateLink, stateDisplay);
props.isNavigate ? f7.views.current.router.back() : props.closeModal();
}} text={t('Add.textDone')}></Link>
</NavRight>
</Navbar>
}
<Navbar className="navbar-link-settings">
<NavLeft>
<Link text={Device.ios ? t('Add.textCancel') : ''} onClick={() => {
props.isNavigate ? f7.views.current.router.back() : props.closeModal();
}}>
{Device.android && <Icon icon='icon-close' />}
</Link>
</NavLeft>
<NavTitle>{t('Add.textLinkSettings')}</NavTitle>
<NavRight>
<Link className={`${stateLink.length < 1 && 'disabled'}`} onClick={() => {
props.onEditLink(stateLink, stateDisplay, stateTip);
}} text={Device.ios ? t('Add.textDone') : ''}>
{Device.android && <Icon icon={stateLink.length < 1 ? 'icon-done-disabled' : 'icon-done'} />}
</Link>
</NavRight>
</Navbar>
<List inlineLabels className='inputs-list'>
<ListInput
label={_t.textLink}
@ -52,13 +54,13 @@ const EditHyperlink = props => {
value={stateDisplay}
onChange={(event) => {setDisplay(event.target.value)}}
></ListInput>
{/* <ListInput
<ListInput
label={_t.textScreenTip}
type="text"
placeholder={_t.textScreenTip}
value={stateTip}
onChange={(event) => {setTip(event.target.value)}}
></ListInput> */}
></ListInput>
</List>
<List className="buttons-list">
{/* <ListButton className={'button-fill button-raised' + (stateLink.length < 1 ? ' disabled' : '')} title={_t.textEditLink} onClick={() => {

View file

@ -58,7 +58,8 @@
"textColumns": "Columns",
"textCopyCutPasteActions": "Copy, Cut and Paste Actions",
"textDoNotShowAgain": "Don't show again",
"textRows": "Rows"
"textRows": "Rows",
"menuEditLink": "Edit Link"
},
"Controller": {
"Main": {
@ -242,7 +243,10 @@
"textSlideNumber": "Slide Number",
"textTable": "Table",
"textTableSize": "Table Size",
"txtNotUrl": "This field should be a URL in the format \"http://www.example.com\""
"txtNotUrl": "This field should be a URL in the format \"http://www.example.com\"",
"textDone": "Done",
"textRequired": "Required",
"textRecommended": "Recommended"
},
"Edit": {
"notcriticalErrorTitle": "Warning",
@ -349,7 +353,8 @@
"textPush": "Push",
"textRemoveChart": "Remove Chart",
"textRemoveImage": "Remove Image",
"textRemoveLink": "Remove Link",
"del_textRemoveLink": "Remove Link",
"textDeleteLink": "Delete Link",
"textRemoveShape": "Remove Shape",
"textRemoveTable": "Remove Table",
"textReorder": "Reorder",
@ -393,7 +398,10 @@
"textZoom": "Zoom",
"textZoomIn": "Zoom In",
"textZoomOut": "Zoom Out",
"textZoomRotate": "Zoom and Rotate"
"textZoomRotate": "Zoom and Rotate",
"textCancel": "Cancel",
"textRequired": "Required",
"textRecommended": "Recommended"
},
"Settings": {
"mniSlideStandard": "Standard (4:3)",

View file

@ -1,9 +1,20 @@
import React, {Component} from 'react';
import { f7 } from 'framework7-react';
import { f7, Popup, Popover, View } from 'framework7-react';
import {Device} from '../../../../../common/mobile/utils/device';
import { withTranslation} from 'react-i18next';
import {PageLink} from '../../view/add/AddLink';
import {PageLink, PageTypeLink, PageLinkTo} from '../../view/add/AddLink';
const routes = [
{
path: '/add-link-type/',
component: PageTypeLink
},
{
path: '/add-link-to/',
component: PageLinkTo
}
];
class AddLinkController extends Component {
constructor (props) {
@ -17,9 +28,9 @@ class AddLinkController extends Component {
closeModal () {
if ( Device.phone ) {
f7.sheet.close('.add-popup', true);
f7.popup.close('#add-link-popup');
} else {
f7.popover.close('#add-popover');
f7.popover.close('#add-link-popover');
}
}
@ -33,14 +44,16 @@ class AddLinkController extends Component {
WebLink: 1
};
const display = linkInfo.display;
// const tip = linkInfo.tip;
const tip = linkInfo.tip;
const props = new Asc.CHyperlinkProperty();
let def_display = '';
if (type == c_oHyperlinkType.WebLink) {
let url = linkInfo.url;
const urltype = api.asc_getUrlType(url.trim());
const isEmail = (urltype == 2);
if (urltype < 1) {
f7.dialog.create({
title: _t.notcriticalErrorTitle,
@ -60,11 +73,13 @@ class AddLinkController extends Component {
url = url.replace(new RegExp("%20", 'g'), " ");
props.put_Value(url);
// props.put_ToolTip(tip);
props.put_ToolTip(tip);
def_display = url;
} else {
let url = "ppaction://hlink";
let slidetip = '';
switch (linkInfo.linkTo) {
case 0:
url = url + "showjump?jump=nextslide";
@ -87,8 +102,9 @@ class AddLinkController extends Component {
slidetip = _t.textSlide + ' ' + (linkInfo.numberTo + 1);
break;
}
props.put_Value(url);
// props.put_ToolTip(!tip ? slidetip : tip);
props.put_ToolTip(!tip ? slidetip : tip);
def_display = slidetip;
}
@ -98,20 +114,40 @@ class AddLinkController extends Component {
props.put_Text(null);
api.add_Hyperlink(props);
this.closeModal();
this.props.isNavigate ? f7.views.current.router.back() : this.closeModal();
}
getTextDisplay () {
return this.textDisplay;
}
componentDidMount() {
if(!this.props.isNavigate) {
if(Device.phone) {
f7.popup.open('#add-link-popup', true);
} else {
f7.popover.open('#add-link-popover', '#btn-add');
}
}
}
render () {
return (
<PageLink onInsertLink={this.onInsertLink}
getTextDisplay={this.getTextDisplay}
noNavbar={this.props.noNavbar}
/>
!this.props.isNavigate ?
Device.phone ?
<Popup id="add-link-popup" onPopupClosed={() => this.props.onClosed('add-link')}>
<View routes={routes} style={{height: '100%'}}>
<PageLink closeModal={this.closeModal} onInsertLink={this.onInsertLink} getTextDisplay={this.getTextDisplay} isNavigate={this.props.isNavigate} />
</View>
</Popup>
:
<Popover id="add-link-popover" className="popover__titled" closeByOutsideClick={false} onPopoverClosed={() => this.props.onClosed('add-link')}>
<View routes={routes} style={{height: '410px'}}>
<PageLink closeModal={this.closeModal} onInsertLink={this.onInsertLink} getTextDisplay={this.getTextDisplay} isNavigate={this.props.isNavigate}/>
</View>
</Popover>
:
<PageLink closeModal={this.closeModal} onInsertLink={this.onInsertLink} getTextDisplay={this.getTextDisplay} isNavigate={this.props.isNavigate} />
)
}
}

View file

@ -9,6 +9,7 @@ import {AddOther} from '../../view/add/AddOther';
class AddOtherController extends Component {
constructor (props) {
super(props);
this.onStyleClick = this.onStyleClick.bind(this);
this.onGetTableStylesPreviews = this.onGetTableStylesPreviews.bind(this);
}
@ -120,6 +121,7 @@ class AddOtherController extends Component {
onStyleClick={this.onStyleClick}
hideAddComment={this.hideAddComment}
onGetTableStylesPreviews = {this.onGetTableStylesPreviews}
onCloseLinkSettings={this.props.onCloseLinkSettings}
/>
)
}

View file

@ -1,10 +1,21 @@
import React, { Component } from 'react';
import { f7 } from 'framework7-react';
import { f7, View, Popup, Popover } from 'framework7-react';
import { Device } from '../../../../../common/mobile/utils/device';
import {observer, inject} from "mobx-react";
import { withTranslation } from 'react-i18next';
import { EditLink } from '../../view/edit/EditLink';
import { EditLink, PageEditTypeLink, PageEditLinkTo } from '../../view/edit/EditLink';
const routes = [
{
path: '/edit-link-type/',
component: PageEditTypeLink
},
{
path: '/edit-link-to/',
component: PageEditLinkTo
}
];
class EditLinkController extends Component {
constructor (props) {
@ -21,9 +32,9 @@ class EditLinkController extends Component {
closeModal () {
if ( Device.phone ) {
f7.sheet.close('#edit-sheet', true);
f7.popup.close('#edit-link-popup');
} else {
f7.popover.close('#edit-popover');
f7.popover.close('#edit-link-popover');
}
}
@ -156,30 +167,80 @@ class EditLinkController extends Component {
props.put_Text(null);
api.change_Hyperlink(props);
this.closeModal();
this.props.isNavigate ? f7.views.current.router.back() : this.closeModal();
}
onRemoveLink() {
const api = Common.EditorApi.get();
api.remove_Hyperlink();
this.closeModal();
}
componentDidMount() {
if(!this.props.isNavigate) {
if(Device.phone) {
f7.popup.open('#edit-link-popup', true);
} else {
f7.popover.open('#edit-link-popover', '#btn-add');
}
}
}
render () {
return (
<EditLink
initLink={this.initLink}
typeLink={this.typeLink}
url={this.url}
display={this.display}
tooltip={this.tooltip}
slideLink={this.slideLink}
slideNum={this.slideNum}
onEditLink={this.onEditLink}
onRemoveLink={this.onRemoveLink}
slidesCount={this.slidesCount}
/>
!this.props.isNavigate ?
Device.phone ?
<Popup id="edit-link-popup" onPopupClosed={() => this.props.onClosed('edit-link')}>
<View routes={routes} style={{height: '100%'}}>
<EditLink
initLink={this.initLink}
typeLink={this.typeLink}
url={this.url}
display={this.display}
tooltip={this.tooltip}
slideLink={this.slideLink}
slideNum={this.slideNum}
onEditLink={this.onEditLink}
onRemoveLink={this.onRemoveLink}
slidesCount={this.slidesCount}
closeModal={this.closeModal}
isNavigate={this.props.isNavigate}
/>
</View>
</Popup>
:
<Popover id="edit-link-popover" className="popover__titled" closeByOutsideClick={false} onPopoverClosed={() => this.props.onClosed('edit-link')}>
<View routes={routes} style={{height: '410px'}}>
<EditLink
initLink={this.initLink}
typeLink={this.typeLink}
url={this.url}
display={this.display}
tooltip={this.tooltip}
slideLink={this.slideLink}
slideNum={this.slideNum}
onEditLink={this.onEditLink}
onRemoveLink={this.onRemoveLink}
slidesCount={this.slidesCount}
closeModal={this.closeModal}
isNavigate={this.props.isNavigate}
/>
</View>
</Popover>
:
<EditLink
initLink={this.initLink}
typeLink={this.typeLink}
url={this.url}
display={this.display}
tooltip={this.tooltip}
slideLink={this.slideLink}
slideNum={this.slideNum}
onEditLink={this.onEditLink}
onRemoveLink={this.onRemoveLink}
slidesCount={this.slidesCount}
closeModal={this.closeModal}
isNavigate={this.props.isNavigate}
/>
)
}
}

View file

@ -11,6 +11,8 @@ import { Preview } from "../controller/Preview";
import { Search, SearchSettings } from '../controller/Search';
import ContextMenu from '../controller/ContextMenu';
import { Toolbar } from "../controller/Toolbar";
import { AddLinkController } from '../controller/add/AddLink';
import { EditLinkController } from '../controller/edit/EditLink';
class MainPage extends Component {
constructor(props) {
super(props);
@ -19,7 +21,9 @@ class MainPage extends Component {
addOptionsVisible: false,
settingsVisible: false,
collaborationVisible: false,
previewVisible: false
previewVisible: false,
addLinkSettingsVisible: false,
editLinkSettingsVisible: false
};
}
@ -49,6 +53,12 @@ class MainPage extends Component {
} else if ( opts === 'preview' ) {
this.state.previewVisible && (opened = true);
newState.previewVisible = true;
} else if ( opts === 'add-link') {
this.state.addLinkSettingsVisible && (opened = true);
newState.addLinkSettingsVisible = true;
} else if( opts === 'edit-link') {
this.state.editLinkSettingsVisible && (opened = true);
newState.editLinkSettingsVisible = true;
}
for (let key in this.state) {
@ -82,6 +92,10 @@ class MainPage extends Component {
return {collaborationVisible: false}
else if ( opts == 'preview' )
return {previewVisible: false};
else if ( opts === 'add-link')
return {addLinkSettingsVisible: false};
else if( opts === 'edit-link')
return {editLinkSettingsVisible: false};
});
if ((opts === 'edit' || opts === 'coauth') && Device.phone) {
f7.navbar.show('.main-navbar');
@ -144,7 +158,15 @@ class MainPage extends Component {
}
{
!this.state.addOptionsVisible ? null :
<AddOptions onclosed={this.handleOptionsViewClosed.bind(this, 'add')} showOptions={this.state.addShowOptions} />
<AddOptions onCloseLinkSettings={this.handleOptionsViewClosed.bind(this)} onclosed={this.handleOptionsViewClosed.bind(this, 'add')} showOptions={this.state.addShowOptions} />
}
{
!this.state.addLinkSettingsVisible ? null :
<AddLinkController onClosed={this.handleOptionsViewClosed.bind(this)} />
}
{
!this.state.editLinkSettingsVisible ? null :
<EditLinkController onClosed={this.handleOptionsViewClosed.bind(this)} />
}
{
!this.state.settingsVisible ? null :
@ -155,7 +177,6 @@ class MainPage extends Component {
<CollaborationView onclosed={this.handleOptionsViewClosed.bind(this, 'coauth')} />
}
{appOptions.isDocReady && <ContextMenu openOptions={this.handleClickToOpenOptions.bind(this)} />}
</Page>
</Fragment>
)

View file

@ -12,7 +12,9 @@ import {PageImageLinkSettings} from "./AddImage";
import {AddOtherController} from "../../controller/add/AddOther";
import {PageAddTable} from "./AddOther";
import {AddLinkController} from "../../controller/add/AddLink";
import {PageTypeLink, PageLinkTo} from "./AddLink";
import { PageTypeLink, PageLinkTo } from "./AddLink";
import { EditLinkController } from '../../controller/edit/EditLink';
import { PageEditTypeLink, PageEditLinkTo } from '../../view/edit/EditLink';
const routes = [
// Image
@ -20,6 +22,7 @@ const routes = [
path: '/add-image-from-url/',
component: PageImageLinkSettings
},
// Other
{
path: '/add-table/',
@ -36,6 +39,25 @@ const routes = [
{
path: '/add-link-to/',
component: PageLinkTo
},
{
path: '/edit-link/',
component: EditLinkController
},
{
path: '/edit-link-type/',
component: PageEditTypeLink
},
{
path: '/edit-link-to/',
component: PageEditLinkTo
},
// Image
{
path: '/add-image/',
component: AddImageController
}
];
@ -90,17 +112,19 @@ const AddTabs = props => {
icon: 'icon-add-shape',
component: <AddShapeController/>
});
tabs.push({
caption: _t.textImage,
id: 'add-image',
icon: 'icon-add-image',
component: <AddImageController/>
});
// tabs.push({
// caption: _t.textImage,
// id: 'add-image',
// icon: 'icon-add-image',
// component: <AddImageController/>
// });
tabs.push({
caption: _t.textOther,
id: 'add-other',
icon: 'icon-add-other',
component: <AddOtherController/>
component: <AddOtherController onCloseLinkSettings={props.onCloseLinkSettings} />
});
}
if(!showPanels && !countPages) {
@ -111,13 +135,15 @@ const AddTabs = props => {
component: <AddSlideController />
});
}
if (showPanels && showPanels === 'link') {
tabs.push({
caption: _t.textAddLink,
id: 'add-link',
component: <AddLinkController noNavbar={true}/>
});
}
// if (showPanels && showPanels === 'link') {
// tabs.push({
// caption: _t.textAddLink,
// id: 'add-link',
// component: <AddLinkController noNavbar={true}/>
// });
// }
return (
<View style={props.style} stackPages={true} routes={routes}>
<Page pageContent={false}>
@ -142,10 +168,10 @@ class AddView extends Component {
return (
show_popover ?
<Popover id="add-popover" className="popover__titled" closeByOutsideClick={false} onPopoverClosed={() => this.props.onclosed()}>
<AddTabs inPopover={true} onOptionClick={this.onoptionclick} style={{height: '410px'}} showPanels={this.props.showPanels} />
<AddTabs inPopover={true} onOptionClick={this.onoptionclick} onCloseLinkSettings={this.props.onCloseLinkSettings} style={{height: '410px'}} showPanels={this.props.showPanels} />
</Popover> :
<Popup className="add-popup" onPopupClosed={() => this.props.onclosed()}>
<AddTabs onOptionClick={this.onoptionclick} showPanels={this.props.showPanels} />
<AddTabs onOptionClick={this.onoptionclick} onCloseLinkSettings={this.props.onCloseLinkSettings} showPanels={this.props.showPanels} />
</Popup>
)
}
@ -166,7 +192,7 @@ const Add = props => {
props.onclosed();
}
};
return <AddView usePopover={!Device.phone} onclosed={onviewclosed} showPanels={props.showOptions} />
return <AddView usePopover={!Device.phone} onCloseLinkSettings={props.onCloseLinkSettings} onclosed={onviewclosed} showPanels={props.showOptions} />
};
export default Add;

View file

@ -33,16 +33,19 @@ const AddImage = props => {
const { t } = useTranslation();
const _t = t('View.Add', {returnObjects: true});
return (
<List>
<ListItem title={_t.textPictureFromLibrary} onClick={() => {props.onInsertByFile()}}>
<Icon slot="media" icon="icon-image-library"></Icon>
</ListItem>
<ListItem title={_t.textPictureFromURL} link={'/add-image-from-url/'} routeProps={{
onInsertByUrl: props.onInsertByUrl
}}>
<Icon slot="media" icon="icon-link"></Icon>
</ListItem>
</List>
<Page>
<Navbar title={t('View.Add.textInsertImage')} backLink={_t.textBack}></Navbar>
<List>
<ListItem title={_t.textPictureFromLibrary} onClick={() => {props.onInsertByFile()}}>
<Icon slot="media" icon="icon-image-library"></Icon>
</ListItem>
<ListItem title={_t.textPictureFromURL} link={'/add-image-from-url/'} routeProps={{
onInsertByUrl: props.onInsertByUrl
}}>
<Icon slot="media" icon="icon-link"></Icon>
</ListItem>
</List>
</Page>
)
};

View file

@ -1,6 +1,6 @@
import React, {useState} from 'react';
import {observer, inject} from "mobx-react";
import {List, ListItem, Page, Navbar, Icon, ListButton, ListInput, Segmented, Button} from 'framework7-react';
import {List, ListItem, Page, Navbar, Icon, ListButton, ListInput, Segmented, Button, Link, NavLeft, NavRight, NavTitle, f7} from 'framework7-react';
import { useTranslation } from 'react-i18next';
import {Device} from "../../../../../common/mobile/utils/device";
@ -8,9 +8,16 @@ const PageTypeLink = props => {
const { t } = useTranslation();
const _t = t('View.Add', {returnObjects: true});
const [typeLink, setTypeLink] = useState(props.curType);
return (
<Page>
<Navbar title={_t.textLinkType} backLink={_t.textBack}/>
<Navbar className="navbar-link-settings" title={_t.textLinkType} backLink={_t.textBack}>
{Device.phone &&
<NavRight>
<Link icon='icon-close' popupClose="#add-link-popup"></Link>
</NavRight>
}
</Navbar>
<List>
<ListItem title={_t.textExternalLink} radio checked={typeLink === 1} onClick={() => {setTypeLink(1); props.changeType(1);}}></ListItem>
<ListItem title={_t.textSlideInThisPresentation} radio checked={typeLink === 0} onClick={() => {setTypeLink(0); props.changeType(0);}}></ListItem>
@ -42,28 +49,35 @@ const PageLinkTo = props => {
setNumberTo(value);
props.changeTo(4, value);
};
return (
<Page>
<Navbar title={_t.textLinkTo} backLink={_t.textBack}/>
<Navbar className="navbar-link-settings" title={_t.textLinkTo} backLink={_t.textBack}>
{Device.phone &&
<NavRight>
<Link icon='icon-close' popupClose="#add-link-popup"></Link>
</NavRight>
}
</Navbar>
<List>
<ListItem title={_t.textNextSlide} radio checked={stateTypeTo === 0} onClick={() => {changeTypeTo(0)}}></ListItem>
<ListItem title={_t.textPreviousSlide} radio checked={stateTypeTo === 1} onClick={() => {changeTypeTo(1)}}></ListItem>
<ListItem title={_t.textFirstSlide} radio checked={stateTypeTo === 2} onClick={() => {changeTypeTo(2)}}></ListItem>
<ListItem title={_t.textLastSlide} radio checked={stateTypeTo === 3} onClick={() => {changeTypeTo(3)}}></ListItem>
<ListItem title={_t.textSlideNumber}>
{!isAndroid && <div slot='after-start'>{stateNumberTo + 1}</div>}
<div slot='after'>
<Segmented>
<Button outline className='decrement item-link' onClick={() => {changeNumber(stateNumberTo, true);}}>
{isAndroid ? <Icon icon="icon-expand-down"></Icon> : ' - '}
</Button>
{isAndroid && <label>{stateNumberTo + 1}</label>}
<Button outline className='increment item-link' onClick={() => {changeNumber(stateNumberTo, false);}}>
{isAndroid ? <Icon icon="icon-expand-up"></Icon> : ' + '}
</Button>
</Segmented>
</div>
</ListItem>
<ListItem title={_t.textNextSlide} radio checked={stateTypeTo === 0} onClick={() => {changeTypeTo(0)}}></ListItem>
<ListItem title={_t.textPreviousSlide} radio checked={stateTypeTo === 1} onClick={() => {changeTypeTo(1)}}></ListItem>
<ListItem title={_t.textFirstSlide} radio checked={stateTypeTo === 2} onClick={() => {changeTypeTo(2)}}></ListItem>
<ListItem title={_t.textLastSlide} radio checked={stateTypeTo === 3} onClick={() => {changeTypeTo(3)}}></ListItem>
<ListItem title={_t.textSlideNumber}>
{!isAndroid && <div slot='after-start'>{stateNumberTo + 1}</div>}
<div slot='after'>
<Segmented>
<Button outline className='decrement item-link' onClick={() => {changeNumber(stateNumberTo, true);}}>
{isAndroid ? <Icon icon="icon-expand-down"></Icon> : ' - '}
</Button>
{isAndroid && <label>{stateNumberTo + 1}</label>}
<Button outline className='increment item-link' onClick={() => {changeNumber(stateNumberTo, false);}}>
{isAndroid ? <Icon icon="icon-expand-up"></Icon> : ' + '}
</Button>
</Segmented>
</div>
</ListItem>
</List>
</Page>
)
@ -100,11 +114,29 @@ const PageLink = props => {
const displayDisabled = display !== false && display === null;
const [stateDisplay, setDisplay] = useState(display !== false ? ((display !== null) ? display : _t.textDefault) : "");
const [stateAutoUpdate, setAutoUpdate] = useState(!stateDisplay ? true : false);
// const [screenTip, setScreenTip] = useState('');
const [screenTip, setScreenTip] = useState('');
return (
<Page>
{!props.noNavbar && <Navbar title={_t.textLink} backLink={_t.textBack}/>}
<Navbar className="navbar-link-settings">
<NavLeft>
<Link text={Device.ios ? t('View.Add.textCancel') : ''} onClick={() => {
props.isNavigate ? f7.views.current.router.back() : props.closeModal();
}}>
{Device.android && <Icon icon='icon-close' />}
</Link>
</NavLeft>
<NavTitle>{t('View.Add.textLinkSettings')}</NavTitle>
<NavRight>
<Link className={`${typeLink === 1 && link.length < 1 && 'disabled'}`} onClick={() => {
props.onInsertLink(typeLink, (typeLink === 1 ?
{url: link, display: stateDisplay, displayDisabled, tip: screenTip } :
{linkTo: linkTo, numberTo: numberTo, display: stateDisplay, displayDisabled, tip: screenTip}));
}} text={Device.ios ? t('View.Add.textDone') : ''}>
{Device.android && <Icon icon={link.length < 1 ? 'icon-done-disabled' : 'icon-done'} />}
</Link>
</NavRight>
</Navbar>
<List inlineLabels className='inputs-list'>
<ListItem link={'/add-link-type/'} title={_t.textLinkType} after={textType} routeProps={{
changeType: changeType,
@ -113,7 +145,7 @@ const PageLink = props => {
{typeLink === 1 ?
<ListInput label={_t.textLink}
type="text"
placeholder={_t.textLink}
placeholder={t('View.Add.textRequired')}
value={link}
onChange={(event) => {
setLink(event.target.value);
@ -127,7 +159,7 @@ const PageLink = props => {
}
<ListInput label={_t.textDisplay}
type="text"
placeholder={_t.textDisplay}
placeholder={t('View.Add.textRecommended')}
value={stateDisplay}
disabled={displayDisabled}
onChange={(event) => {
@ -135,23 +167,23 @@ const PageLink = props => {
setAutoUpdate(event.target.value == '');
}}
/>
{/* <ListInput label={_t.textScreenTip}
<ListInput label={_t.textScreenTip}
type="text"
placeholder={_t.textScreenTip}
value={screenTip}
onChange={(event) => {setScreenTip(event.target.value)}}
/> */}
/>
</List>
<List className="buttons-list">
{/* <List className="buttons-list">
<ListButton title={_t.textInsert}
className={`button-fill button-raised ${typeLink === 1 && link.length < 1 && ' disabled'}`}
onClick={() => {
props.onInsertLink(typeLink, (typeLink === 1 ?
{url: link, display: stateDisplay, displayDisabled: displayDisabled } :
{linkTo: linkTo, numberTo: numberTo, display: stateDisplay, displayDisabled: displayDisabled}));
{url: link, display: stateDisplay, displayDisabled: displayDisabled, tip: screenTip } :
{linkTo: linkTo, numberTo: numberTo, display: stateDisplay, displayDisabled: displayDisabled, tip: screenTip}));
}}
/>
</List>
</List> */}
</Page>
)
};

View file

@ -45,6 +45,8 @@ const AddOther = props => {
const _t = t('View.Add', {returnObjects: true});
const showInsertLink = props.storeLinkSettings.canAddLink && !props.storeFocusObjects.paragraphLocked;
const hideAddComment = props.hideAddComment();
const isHyperLink = props.storeFocusObjects.settings.indexOf('hyperlink') > -1;
return (
<List>
<ListItem title={_t.textTable} link={'/add-table/'} onClick = {() => props.onGetTableStylesPreviews()} routeProps={{
@ -58,8 +60,14 @@ const AddOther = props => {
}}>
<Icon slot="media" icon="icon-insert-comment"></Icon>
</ListItem>}
<ListItem title={_t.textImage} link='/add-image/'>
<Icon slot="media" icon="icon-image"></Icon>
</ListItem>
{showInsertLink &&
<ListItem title={_t.textLink} link={'/add-link/'}>
<ListItem title={_t.textLink} link={isHyperLink ? '/edit-link/' : '/add-link/'} routeProps={{
onClosed: props.onCloseLinkSettings,
isNavigate: true
}}>
<Icon slot="media" icon="icon-link"></Icon>
</ListItem>
}

View file

@ -19,7 +19,6 @@ import { PageShapeStyle, PageShapeStyleNoFill, PageReplaceContainer, PageReorder
import { PageImageReplace, PageImageReorder, PageImageAlign, PageLinkSettings } from './EditImage';
import { PageTableStyle, PageTableStyleOptions, PageTableCustomFillColor, PageTableBorderColor, PageTableCustomBorderColor, PageTableReorder, PageTableAlign } from './EditTable';
import { PageChartDesign, PageChartDesignType, PageChartDesignStyle, PageChartDesignFill, PageChartDesignBorder, PageChartCustomFillColor, PageChartBorderColor, PageChartCustomBorderColor, PageChartReorder, PageChartAlign } from './EditChart'
import { PageLinkTo, PageTypeLink } from './EditLink'
const routes = [
@ -214,14 +213,9 @@ const routes = [
},
// Link
{
path: '/edit-link-type/',
component: PageTypeLink
},
{
path: '/edit-link-to/',
component: PageLinkTo
path: '/edit-link/',
component: EditLinkController
}
];

View file

@ -1,10 +1,10 @@
import React, {useState, useEffect} from 'react';
import {observer, inject} from "mobx-react";
import {f7, List, ListItem, Page, Navbar, Icon, ListButton, ListInput, Segmented, Button, NavRight, Link} from 'framework7-react';
import {f7, List, ListItem, Page, Navbar, Icon, ListButton, ListInput, Segmented, Button, NavRight, Link, NavLeft, NavTitle} from 'framework7-react';
import { useTranslation } from 'react-i18next';
import {Device} from "../../../../../common/mobile/utils/device";
const PageTypeLink = props => {
const PageEditTypeLink = props => {
const { t } = useTranslation();
const _t = t('View.Edit', {returnObjects: true});
const [typeLink, setTypeLink] = useState(props.curType);
@ -17,12 +17,10 @@ const PageTypeLink = props => {
return (
<Page>
<Navbar title={_t.textLinkType} backLink={_t.textBack}>
<Navbar className="navbar-link-settings" title={_t.textLinkType} backLink={_t.textBack}>
{Device.phone &&
<NavRight>
<Link sheetClose='#edit-sheet'>
<Icon icon='icon-expand-down'/>
</Link>
<Link icon='icon-close' popupClose="#edit-link-popup"></Link>
</NavRight>
}
</Navbar>
@ -34,7 +32,7 @@ const PageTypeLink = props => {
)
};
const PageLinkTo = props => {
const PageEditLinkTo = props => {
const isAndroid = Device.android;
const { t } = useTranslation();
const _t = t('View.Edit', {returnObjects: true});
@ -70,12 +68,10 @@ const PageLinkTo = props => {
return (
<Page>
<Navbar title={_t.textLinkTo} backLink={_t.textBack}>
<Navbar className="navbar-link-settings" title={_t.textLinkTo} backLink={_t.textBack}>
{Device.phone &&
<NavRight>
<Link sheetClose='#edit-sheet'>
<Icon icon='icon-expand-down'/>
</Link>
<Link icon='icon-close' popupClose="#edit-link-popup"></Link>
</NavRight>
}
</Navbar>
@ -150,14 +146,24 @@ const PageLink = props => {
return (
<Page>
<Navbar title={_t.textLink} backLink={_t.textBack}>
{Device.phone &&
<NavRight>
<Link sheetClose='#edit-sheet'>
<Icon icon='icon-expand-down'/>
</Link>
</NavRight>
}
<Navbar className="navbar-link-settings">
<NavLeft>
<Link text={Device.ios ? t('View.Edit.textCancel') : ''} onClick={() => {
props.isNavigate ? f7.views.current.router.back() : props.closeModal();
}}>
{Device.android && <Icon icon='icon-close' />}
</Link>
</NavLeft>
<NavTitle>{t('View.Edit.textLinkSettings')}</NavTitle>
<NavRight>
<Link className={`${link.length < 1 && 'disabled'}`} onClick={() => {
props.onEditLink(typeLink, (typeLink === 1 ?
{url: link, display: stateDisplay, tip: screenTip, displayDisabled } :
{linkTo: linkTo, numberTo: numberTo, display: stateDisplay, tip: screenTip, displayDisabled}));
}} text={Device.ios ? t('View.Edit.textDone') : ''}>
{Device.android && <Icon icon={link.length < 1 ? 'icon-done-disabled' : 'icon-done'} />}
</Link>
</NavRight>
</Navbar>
<List inlineLabels className='inputs-list'>
<ListItem link={'/edit-link-type/'} title={_t.textLinkType} after={textType} routeProps={{
@ -168,7 +174,7 @@ const PageLink = props => {
{typeLink !== 0 ?
<ListInput label={_t.textLink}
type="text"
placeholder={_t.textLink}
placeholder={t('View.Edit.textRequired')}
value={link}
onChange={(event) => {setLink(event.target.value)}}
/> :
@ -182,7 +188,7 @@ const PageLink = props => {
}
<ListInput label={_t.textDisplay}
type="text"
placeholder={_t.textDisplay}
placeholder={t('View.Edit.textRecommended')}
value={stateDisplay}
disabled={displayDisabled}
onChange={(event) => {setDisplay(event.target.value)}}
@ -195,18 +201,11 @@ const PageLink = props => {
/>
</List>
<List className="buttons-list">
<ListButton title={_t.textEditLink}
className={`button-fill button-raised${typeLink === 1 && link.length < 1 && ' disabled'}`}
onClick={() => {
props.onEditLink(typeLink, (typeLink === 1 ?
{url: link, display: stateDisplay, tip: screenTip, displayDisabled: displayDisabled } :
{linkTo: linkTo, numberTo: numberTo, display: stateDisplay, tip: screenTip, displayDisabled: displayDisabled}));
}}
/>
<ListButton title={_t.textRemoveLink}
<ListButton title={t('View.Edit.textDeleteLink')}
className={`button-red button-fill button-raised`}
onClick={() => {
props.onRemoveLink()
props.onRemoveLink();
props.isNavigate ? f7.views.current.router.back() : props.closeModal();
}}
/>
</List>
@ -214,9 +213,9 @@ const PageLink = props => {
)
};
const _PageLinkTo = inject("storeFocusObjects")(observer(PageLinkTo));
const _PageTypeLink = inject("storeFocusObjects")(observer(PageTypeLink));
const _PageEditLinkTo = inject("storeFocusObjects")(observer(PageEditLinkTo));
const _PageEditTypeLink = inject("storeFocusObjects")(observer(PageEditTypeLink));
export {PageLink as EditLink,
_PageLinkTo as PageLinkTo,
_PageTypeLink as PageTypeLink}
_PageEditLinkTo as PageEditLinkTo,
_PageEditTypeLink as PageEditTypeLink}

View file

@ -53,6 +53,7 @@
"menuMerge": "Merge",
"menuMore": "More",
"menuOpenLink": "Open Link",
"menuEditLink": "Edit Link",
"menuShow": "Show",
"menuUnfreezePanes": "Unfreeze Panes",
"menuUnmerge": "Unmerge",
@ -367,7 +368,9 @@
"txtNotUrl": "This field should be a URL in the format \"http://www.example.com\"",
"txtSorting": "Sorting",
"txtSortSelected": "Sort selected",
"txtYes": "Yes"
"txtYes": "Yes",
"textRecommended": "Recommended",
"textDone": "Done"
},
"Edit": {
"notcriticalErrorTitle": "Warning",
@ -503,7 +506,8 @@
"textRange": "Range",
"textRemoveChart": "Remove Chart",
"textRemoveImage": "Remove Image",
"textRemoveLink": "Remove Link",
"del_textRemoveLink": "Remove Link",
"textDeleteLink": "Delete Link",
"textRemoveShape": "Remove Shape",
"textReorder": "Reorder",
"textReplace": "Replace",
@ -550,7 +554,10 @@
"textYen": "Yen",
"txtNotUrl": "This field should be a URL in the format \"http://www.example.com\"",
"txtSortHigh2Low": "Sort Highest to Lowest",
"txtSortLow2High": "Sort Lowest to Highest"
"txtSortLow2High": "Sort Lowest to Highest",
"textRecommended": "Recommended",
"textDone": "Done",
"textCancel": "Cancel"
},
"Settings": {
"advCSVOptions": "Choose CSV options",

View file

@ -255,6 +255,10 @@ class ContextMenu extends ContextMenuController {
caption: _t.menuOpenLink,
event: 'openlink'
});
itemsText.push({
caption: t("ContextMenu.menuEditLink"),
event: 'editlink'
});
}
if(!isDisconnected) {
if (canViewComments && hasComments && hasComments.length>0) {

View file

@ -1,9 +1,20 @@
import React, {Component} from 'react';
import { f7 } from 'framework7-react';
import { f7, Popup, Popover, View } from 'framework7-react';
import {Device} from '../../../../../common/mobile/utils/device';
import {withTranslation} from 'react-i18next';
import {AddLink} from '../../view/add/AddLink';
import {AddLink, PageTypeLink, PageSheet} from '../../view/add/AddLink';
const routes = [
{
path: '/add-link-type/',
component: PageTypeLink
},
{
path: '/add-link-sheet/',
component: PageSheet
}
];
class AddLinkController extends Component {
constructor (props) {
@ -99,30 +110,71 @@ class AddLinkController extends Component {
link.asc_setText(args.text == null ? null : !!args.text ? args.text : display);
}
// link.asc_setTooltip(args.tooltip);
link.asc_setTooltip(args.tooltip);
api.asc_insertHyperlink(link);
this.closeModal();
this.props.isNavigate ? f7.views.current.router.back() : this.closeModal();
}
closeModal () {
if ( Device.phone ) {
f7.sheet.close('.add-popup', true);
f7.popup.close('#add-link-popup');
} else {
f7.popover.close('#add-popover');
f7.popover.close('#add-link-popover');
}
}
componentDidMount() {
if(!this.props.isNavigate) {
if(Device.phone) {
f7.popup.open('#add-link-popup', true);
} else {
f7.popover.open('#add-link-popover', '#btn-add');
}
}
}
render () {
return (
<AddLink inTabs={this.props.inTabs}
allowInternal={this.allowInternal}
displayText={this.displayText}
sheets={this.sheets}
activeSheet={this.activeSheet}
onInsertLink={this.onInsertLink}
/>
!this.props.isNavigate ?
Device.phone ?
<Popup id="add-link-popup" onPopupClosed={() => this.props.onClosed('add-link')}>
<View routes={routes} style={{height: '100%'}}>
<AddLink
allowInternal={this.allowInternal}
displayText={this.displayText}
sheets={this.sheets}
activeSheet={this.activeSheet}
onInsertLink={this.onInsertLink}
closeModal={this.closeModal}
isNavigate={this.props.isNavigate}
/>
</View>
</Popup>
:
<Popover id="add-link-popover" className="popover__titled" closeByOutsideClick={false} onPopoverClosed={() => this.props.onClosed('add-link')}>
<View routes={routes} style={{height: '410px'}}>
<AddLink
allowInternal={this.allowInternal}
displayText={this.displayText}
sheets={this.sheets}
activeSheet={this.activeSheet}
onInsertLink={this.onInsertLink}
closeModal={this.closeModal}
isNavigate={this.props.isNavigate}
/>
</View>
</Popover>
:
<AddLink
allowInternal={this.allowInternal}
displayText={this.displayText}
sheets={this.sheets}
activeSheet={this.activeSheet}
onInsertLink={this.onInsertLink}
closeModal={this.closeModal}
isNavigate={this.props.isNavigate}
/>
)
}
}

View file

@ -23,14 +23,17 @@ class AddOtherController extends Component {
const iscelllocked = cellinfo.asc_getLocked();
const seltype = cellinfo.asc_getSelectionType();
const isComments = !cellinfo.asc_getComments() || cellinfo.asc_getComments().length > 0;
return (!(seltype === Asc.c_oAscSelectionType.RangeCells && !iscelllocked) || isComments);
}
render () {
return (
<AddOther closeModal={this.closeModal}
hideAddComment={this.hideAddComment}
wsProps={this.props.wsProps}
<AddOther
closeModal={this.closeModal}
hideAddComment={this.hideAddComment}
wsProps={this.props.wsProps}
onCloseLinkSettings={this.props.onCloseLinkSettings}
/>
)
}

View file

@ -1,10 +1,21 @@
import React, { Component } from 'react';
import { f7 } from 'framework7-react';
import { f7, Popup, Popover, View } from 'framework7-react';
import { Device } from '../../../../../common/mobile/utils/device';
import {observer, inject} from "mobx-react";
import { withTranslation } from 'react-i18next';
import { EditLink } from '../../view/edit/EditLink';
import { EditLink, PageEditTypeLink, PageEditSheet} from '../../view/edit/EditLink';
const routes = [
{
path: '/edit-link-type/',
component: PageEditTypeLink
},
{
path: '/edit-link-sheet/',
component: PageEditSheet
}
];
class EditLinkController extends Component {
constructor (props) {
@ -40,9 +51,9 @@ class EditLinkController extends Component {
closeModal () {
if ( Device.phone ) {
f7.sheet.close('#edit-sheet', true);
f7.popup.close('#edit-link-popup');
} else {
f7.popover.close('#edit-popover');
f7.popover.close('#edit-link-popover');
}
}
@ -117,26 +128,69 @@ class EditLinkController extends Component {
linkProps.asc_setTooltip(tip);
api.asc_insertHyperlink(linkProps);
this.closeModal();
this.props.isNavigate ? f7.views.current.router.back() : this.closeModal();
}
onRemoveLink() {
const api = Common.EditorApi.get();
api.asc_removeHyperlink();
this.closeModal();
}
componentDidMount() {
if(!this.props.isNavigate) {
if(Device.phone) {
f7.popup.open('#edit-link-popup', true);
} else {
f7.popover.open('#edit-link-popover', '#btn-add');
}
}
}
render () {
return (
<EditLink
linkInfo={this.linkInfo}
isLock={this.isLock}
sheets={this.sheets}
currentSheet={this.currentSheet}
onEditLink={this.onEditLink}
onRemoveLink={this.onRemoveLink}
/>
!this.props.isNavigate ?
Device.phone ?
<Popup id="edit-link-popup" onPopupClosed={() => this.props.onClosed('edit-link')}>
<View routes={routes} style={{height: '100%'}}>
<EditLink
linkInfo={this.linkInfo}
isLock={this.isLock}
sheets={this.sheets}
currentSheet={this.currentSheet}
onEditLink={this.onEditLink}
onRemoveLink={this.onRemoveLink}
closeModal={this.closeModal}
isNavigate={this.props.isNavigate}
/>
</View>
</Popup>
:
<Popover id="edit-link-popover" className="popover__titled" closeByOutsideClick={false} onPopoverClosed={() => this.props.onClosed('edit-link')}>
<View routes={routes} style={{height: '410px'}}>
<EditLink
linkInfo={this.linkInfo}
isLock={this.isLock}
sheets={this.sheets}
currentSheet={this.currentSheet}
onEditLink={this.onEditLink}
onRemoveLink={this.onRemoveLink}
closeModal={this.closeModal}
isNavigate={this.props.isNavigate}
/>
</View>
</Popover>
:
<EditLink
linkInfo={this.linkInfo}
isLock={this.isLock}
sheets={this.sheets}
currentSheet={this.currentSheet}
onEditLink={this.onEditLink}
onRemoveLink={this.onRemoveLink}
closeModal={this.closeModal}
isNavigate={this.props.isNavigate}
/>
)
}
}

View file

@ -16,6 +16,8 @@ import { f7, Link } from 'framework7-react';
import {FunctionGroups} from "../controller/add/AddFunction";
import ContextMenu from '../controller/ContextMenu';
import { Toolbar } from "../controller/Toolbar";
import { AddLinkController } from '../controller/add/AddLink';
import { EditLinkController } from '../controller/edit/EditLink';
class MainPage extends Component {
constructor(props) {
@ -25,7 +27,9 @@ class MainPage extends Component {
addOptionsVisible: false,
addShowOptions: null,
settingsVisible: false,
collaborationVisible: false
collaborationVisible: false,
addLinkSettingsVisible: false,
editLinkSettingsVisible: false
};
}
@ -48,6 +52,12 @@ class MainPage extends Component {
} else if ( opts === 'coauth' ) {
this.state.collaborationVisible && (opened = true);
newState.collaborationVisible = true;
} else if ( opts === 'add-link') {
this.state.addLinkSettingsVisible && (opened = true);
newState.addLinkSettingsVisible = true;
} else if( opts === 'edit-link') {
this.state.editLinkSettingsVisible && (opened = true);
newState.editLinkSettingsVisible = true;
}
for (let key in this.state) {
@ -79,6 +89,10 @@ class MainPage extends Component {
return {settingsVisible: false};
else if ( opts == 'coauth' )
return {collaborationVisible: false};
else if ( opts === 'add-link')
return {addLinkSettingsVisible: false};
else if( opts === 'edit-link')
return {editLinkSettingsVisible: false};
});
if ((opts === 'edit' || opts === 'coauth') && Device.phone) {
f7.navbar.show('.main-navbar');
@ -133,7 +147,15 @@ class MainPage extends Component {
}
{
!this.state.addOptionsVisible ? null :
<AddOptions onclosed={this.handleOptionsViewClosed.bind(this, 'add')} wsLock={wsLock} wsProps={wsProps} showOptions={this.state.addShowOptions} />
<AddOptions onCloseLinkSettings={this.handleOptionsViewClosed.bind(this)} onclosed={this.handleOptionsViewClosed.bind(this, 'add')} wsLock={wsLock} wsProps={wsProps} showOptions={this.state.addShowOptions} />
}
{
!this.state.addLinkSettingsVisible ? null :
<AddLinkController onClosed={this.handleOptionsViewClosed.bind(this)} />
}
{
!this.state.editLinkSettingsVisible ? null :
<EditLinkController onClosed={this.handleOptionsViewClosed.bind(this)} />
}
{
!this.state.settingsVisible ? null :

View file

@ -13,7 +13,9 @@ import {AddOtherController} from "../../controller/add/AddOther";
import {AddImageController} from "../../controller/add/AddImage";
import {PageImageLinkSettings} from "./AddImage";
import {AddLinkController} from "../../controller/add/AddLink";
import {EditLinkController} from "../../controller/edit/EditLink";
import {PageTypeLink, PageSheet} from "./AddLink";
import {PageEditTypeLink, PageEditSheet} from "../../view/edit/EditLink";
import AddFilterController from "../../controller/add/AddFilter";
const routes = [
@ -48,6 +50,18 @@ const routes = [
path: '/add-link-sheet/',
component: PageSheet
},
{
path: '/edit-link/',
component: EditLinkController
},
{
path: '/edit-link-type/',
component: PageEditTypeLink
},
{
path: '/edit-link-sheet/',
component: PageEditSheet
},
// Other
{
path: '/add-sort-and-filter/',
@ -123,31 +137,34 @@ const AddTabs = props => {
component: <AddShapeController/>
});
}
if (showPanels && showPanels.indexOf('image') !== -1) {
tabs.push({
caption: _t.textImage,
id: 'add-image',
icon: 'icon-add-image',
component: <AddImageController inTabs={true}/>
});
}
// if (showPanels && showPanels.indexOf('image') !== -1) {
// tabs.push({
// caption: _t.textImage,
// id: 'add-image',
// icon: 'icon-add-image',
// component: <AddImageController inTabs={true}/>
// });
// }
}
if (!showPanels && (!wsProps.InsertHyperlinks || !wsProps.Objects || !wsProps.Sort)) {
tabs.push({
caption: _t.textOther,
id: 'add-other',
icon: 'icon-add-other',
component: <AddOtherController wsProps={wsProps} />
});
}
if (((showPanels && showPanels === 'hyperlink') || props.isAddShapeHyperlink) && !wsProps.InsertHyperlinks) {
tabs.push({
caption: _t.textAddLink,
id: 'add-link',
icon: 'icon-link',
component: <AddLinkController/>
component: <AddOtherController wsProps={wsProps} onCloseLinkSettings={props.onCloseLinkSettings} />
});
}
// if (((showPanels && showPanels === 'hyperlink') || props.isAddShapeHyperlink) && !wsProps.InsertHyperlinks) {
// tabs.push({
// caption: _t.textAddLink,
// id: 'add-link',
// icon: 'icon-link',
// component: <AddLinkController/>
// });
// }
if(!tabs.length) {
if (Device.phone) {
@ -183,10 +200,10 @@ class AddView extends Component {
return (
show_popover ?
<Popover id="add-popover" className="popover__titled" closeByOutsideClick={false} onPopoverClosed={() => this.props.onclosed()}>
<AddTabs isAddShapeHyperlink={this.props.isAddShapeHyperlink} wsLock={this.props.wsLock} wsProps={this.props.wsProps} inPopover={true} onOptionClick={this.onoptionclick} style={{height: '410px'}} showPanels={this.props.showPanels}/>
<AddTabs isAddShapeHyperlink={this.props.isAddShapeHyperlink} onCloseLinkSettings={this.props.onCloseLinkSettings} wsLock={this.props.wsLock} wsProps={this.props.wsProps} inPopover={true} onOptionClick={this.onoptionclick} style={{height: '410px'}} showPanels={this.props.showPanels}/>
</Popover> :
<Popup className="add-popup" onPopupClosed={() => this.props.onclosed()}>
<AddTabs isAddShapeHyperlink={this.props.isAddShapeHyperlink} wsLock={this.props.wsLock} wsProps={this.props.wsProps} onOptionClick={this.onoptionclick} showPanels={this.props.showPanels}/>
<AddTabs isAddShapeHyperlink={this.props.isAddShapeHyperlink} onCloseLinkSettings={this.props.onCloseLinkSettings} wsLock={this.props.wsLock} wsProps={this.props.wsProps} onOptionClick={this.onoptionclick} showPanels={this.props.showPanels}/>
</Popup>
)
}
@ -245,6 +262,7 @@ const Add = props => {
isAddShapeHyperlink = {isAddShapeHyperlink}
wsProps={props.wsProps}
wsLock={props.wsLock}
onCloseLinkSettings={props.onCloseLinkSettings}
/>
};

View file

@ -1,5 +1,5 @@
import React, {Fragment, useState} from 'react';
import {Page, Navbar, BlockTitle, List, ListItem, ListInput, ListButton, Icon} from 'framework7-react';
import {Page, Navbar, BlockTitle, List, ListItem, ListInput, ListButton, Icon, Link, NavLeft, NavRight, NavTitle, f7} from 'framework7-react';
import { useTranslation } from 'react-i18next';
import {Device} from "../../../../../common/mobile/utils/device";
@ -7,9 +7,16 @@ const PageTypeLink = ({curType, changeType}) => {
const { t } = useTranslation();
const _t = t('View.Add', {returnObjects: true});
const [typeLink, setTypeLink] = useState(curType);
return (
<Page>
<Navbar title={_t.textLinkType} backLink={_t.textBack}/>
<Navbar className="navbar-link-settings" title={_t.textLinkType} backLink={_t.textBack}>
{Device.phone &&
<NavRight>
<Link icon='icon-close' popupClose="#add-link-popup"></Link>
</NavRight>
}
</Navbar>
<List>
<ListItem title={_t.textExternalLink} radio checked={typeLink === 'ext'} onClick={() => {setTypeLink('ext'); changeType('ext');}}></ListItem>
<ListItem title={_t.textInternalDataRange} radio checked={typeLink === 'int'} onClick={() => {setTypeLink('int'); changeType('int');}}></ListItem>
@ -22,12 +29,19 @@ const PageSheet = ({curSheet, sheets, changeSheet}) => {
const { t } = useTranslation();
const _t = t('View.Add', {returnObjects: true});
const [stateSheet, setSheet] = useState(curSheet.value);
return (
<Page>
<Navbar title={_t.textSheet} backLink={_t.textBack}/>
<Navbar className="navbar-link-settings" title={_t.textSheet} backLink={_t.textBack}>
{Device.phone &&
<NavRight>
<Link icon='icon-close' popupClose="#add-link-popup"></Link>
</NavRight>
}
</Navbar>
<List>
{sheets.map((sheet) => {
return(
return (
<ListItem key={`sheet-${sheet.value}`}
title={sheet.caption}
radio
@ -45,7 +59,7 @@ const PageSheet = ({curSheet, sheets, changeSheet}) => {
)
};
const AddLinkView = props => {
const AddLink = props => {
const isIos = Device.ios;
const { t } = useTranslation();
const _t = t('View.Add', {returnObjects: true});
@ -64,7 +78,7 @@ const AddLinkView = props => {
const [stateDisplayText, setDisplayText] = useState(displayText);
const [stateAutoUpdate, setAutoUpdate] = useState(!stateDisplayText ? true : false);
// const [screenTip, setScreenTip] = useState('');
const [screenTip, setScreenTip] = useState('');
const activeSheet = props.activeSheet;
const [curSheet, setSheet] = useState(activeSheet);
@ -75,7 +89,26 @@ const AddLinkView = props => {
const [range, setRange] = useState('');
return (
<Fragment>
<Page routes={props.routes}>
<Navbar className="navbar-link-settings">
<NavLeft>
<Link text={Device.ios ? t('View.Add.textCancel') : ''} onClick={() => {
props.isNavigate ? f7.views.current.router.back() : props.closeModal();
}}>
{Device.android && <Icon icon='icon-close' />}
</Link>
</NavLeft>
<NavTitle>{t('View.Add.textLinkSettings')}</NavTitle>
<NavRight>
<Link className={`${(typeLink === 'ext' && link.length < 1 || typeLink === 'int' && range.length < 1) && 'disabled'}`} onClick={() => {
props.onInsertLink(typeLink === 'ext' ?
{type: 'ext', url: link, text: stateDisplayText} :
{type: 'int', url: range, sheet: curSheet.caption, text: stateDisplayText});
}} text={Device.ios ? t('View.Add.textDone') : ''}>
{Device.android && <Icon icon={link.length < 1 ? 'icon-done-disabled' : 'icon-done'} />}
</Link>
</NavRight>
</Navbar>
<List inlineLabels className='inputs-list'>
{props.allowInternal &&
<ListItem link={'/add-link-type/'} title={_t.textLinkType} after={textType} routeProps={{
@ -86,7 +119,7 @@ const AddLinkView = props => {
{typeLink === 'ext' &&
<ListInput label={_t.textLink}
type="text"
placeholder={_t.textLink}
placeholder={_t.textRequired}
value={link}
onChange={(event) => {
setLink(event.target.value);
@ -113,7 +146,7 @@ const AddLinkView = props => {
}
<ListInput label={_t.textDisplay}
type="text"
placeholder={_t.textDisplay}
placeholder={t('View.Add.textRecommended')}
value={stateDisplayText}
disabled={displayDisabled}
onChange={(event) => {
@ -122,36 +155,15 @@ const AddLinkView = props => {
}}
className={isIos ? 'list-input-right' : ''}
/>
{/* <ListInput label={_t.textScreenTip}
<ListInput label={_t.textScreenTip}
type="text"
placeholder={_t.textScreenTip}
value={screenTip}
onChange={(event) => {setScreenTip(event.target.value)}}
className={isIos ? 'list-input-right' : ''}
/> */}
</List>
<List className="buttons-list">
<ListButton title={_t.textInsert}
className={`button-fill button-raised${(typeLink === 'ext' && link.length < 1 || typeLink === 'int' && range.length < 1) && ' disabled'}`}
onClick={() => {props.onInsertLink(typeLink === 'ext' ?
{type: 'ext', url: link, text: stateDisplayText} :
{type: 'int', url: range, sheet: curSheet.caption, text: stateDisplayText})}}
/>
</List>
</Fragment>
)
};
const AddLink = props => {
const { t } = useTranslation();
const _t = t('View.Add', {returnObjects: true});
return (
props.inTabs ?
<AddLinkView allowInternal={props.allowInternal} displayText={props.displayText} sheets={props.sheets} activeSheet={props.activeSheet} onInsertLink={props.onInsertLink}/> :
<Page>
<Navbar title={_t.textAddLink} backLink={_t.textBack}/>
<AddLinkView allowInternal={props.allowInternal} displayText={props.displayText} sheets={props.sheets} activeSheet={props.activeSheet} onInsertLink={props.onInsertLink}/>
</Page>
</Page>
)
};

View file

@ -1,10 +1,13 @@
import React from 'react';
import { inject, observer } from 'mobx-react';
import {List, ListItem, Icon} from 'framework7-react';
import { useTranslation } from 'react-i18next';
const AddOther = props => {
const AddOther = inject("storeFocusObjects")(observer(props => {
const { t } = useTranslation();
const _t = t('View.Add', {returnObjects: true});
const storeFocusObjects = props.storeFocusObjects;
const isHyperLink = storeFocusObjects.selections.indexOf('hyperlink') > -1;
const hideAddComment = props.hideAddComment();
const wsProps = props.wsProps;
@ -22,11 +25,14 @@ const AddOther = props => {
<ListItem title={_t.textSortAndFilter} className={wsProps.Sort && 'disabled'} link={'/add-sort-and-filter/'}>
<Icon slot="media" icon="icon-sort"></Icon>
</ListItem>
<ListItem title={_t.textLink} className={wsProps.InsertHyperlinks && 'disabled'} link={'/add-link/'}>
<ListItem title={_t.textLink} className={wsProps.InsertHyperlinks && 'disabled'} link={isHyperLink ? '/edit-link/' : '/add-link/'} routeProps={{
onCloseLinkSettings: props.onCloseLinkSettings,
isNavigate: true
}}>
<Icon slot="media" icon="icon-link"></Icon>
</ListItem>
</List>
)
};
}));
export {AddOther};

View file

@ -17,7 +17,7 @@ import { PageImageReplace, PageImageReorder, PageLinkSettings } from './EditImag
import { TextColorCell, FillColorCell, CustomTextColorCell, CustomFillColorCell, FontsCell, TextFormatCell, TextOrientationCell, BorderStyleCell, BorderColorCell, CustomBorderColorCell, BorderSizeCell, PageFormatCell, PageAccountingFormatCell, PageCurrencyFormatCell, PageDateFormatCell, PageTimeFormatCell, CellStyle } from './EditCell';
import { PageTextFonts, PageTextFontColor, PageTextCustomFontColor } from './EditText';
import { PageChartDesign, PageChartDesignType, PageChartDesignStyle, PageChartDesignFill, PageChartDesignBorder, PageChartCustomFillColor, PageChartBorderColor, PageChartCustomBorderColor, PageChartReorder, PageChartLayout, PageLegend, PageChartTitle, PageHorizontalAxisTitle, PageVerticalAxisTitle, PageHorizontalGridlines, PageVerticalGridlines, PageDataLabels, PageChartVerticalAxis, PageVertAxisCrosses, PageDisplayUnits, PageVertMajorType, PageVertMinorType, PageVertLabelPosition, PageChartHorizontalAxis, PageHorAxisCrosses, PageHorAxisPosition, PageHorMajorType, PageHorMinorType, PageHorLabelPosition } from './EditChart';
import { PageTypeLink, PageSheet } from './EditLink';
import { PageEditTypeLink, PageEditSheet } from './EditLink';
const routes = [
@ -282,11 +282,11 @@ const routes = [
{
path: '/edit-link-type/',
component: PageTypeLink
component: PageEditTypeLink
},
{
path: '/edit-link-sheet',
component: PageSheet
component: PageEditSheet
}

View file

@ -1,10 +1,10 @@
import React, {useState, useEffect, Fragment} from 'react';
import {observer, inject} from "mobx-react";
import {f7, List, ListItem, Page, Navbar, NavRight, Icon, ListButton, ListInput, Link} from 'framework7-react';
import {f7, List, ListItem, Page, Navbar, NavRight, Icon, ListButton, ListInput, Link, NavLeft, NavTitle} from 'framework7-react';
import { useTranslation } from 'react-i18next';
import {Device} from "../../../../../common/mobile/utils/device";
const PageTypeLink = ({curType, changeType, storeFocusObjects}) => {
const PageEditTypeLink = ({curType, changeType, storeFocusObjects}) => {
const { t } = useTranslation();
const _t = t('View.Edit', {returnObjects: true});
const [typeLink, setTypeLink] = useState(curType);
@ -17,10 +17,10 @@ const PageTypeLink = ({curType, changeType, storeFocusObjects}) => {
return (
<Page>
<Navbar title={_t.textLinkType} backLink={_t.textBack}>
<Navbar className="navbar-link-settings" title={_t.textLinkType} backLink={_t.textBack}>
{Device.phone &&
<NavRight>
<Link icon='icon-expand-down' sheetClose></Link>
<Link icon='icon-close' popupClose="#edit-link-popup"></Link>
</NavRight>
}
</Navbar>
@ -32,7 +32,7 @@ const PageTypeLink = ({curType, changeType, storeFocusObjects}) => {
)
};
const PageSheet = ({curSheet, sheets, changeSheet, storeFocusObjects}) => {
const PageEditSheet = ({curSheet, sheets, changeSheet, storeFocusObjects}) => {
const { t } = useTranslation();
const _t = t('View.Edit', {returnObjects: true});
const [stateSheet, setSheet] = useState(curSheet);
@ -45,10 +45,10 @@ const PageSheet = ({curSheet, sheets, changeSheet, storeFocusObjects}) => {
return (
<Page>
<Navbar title={_t.textSheet} backLink={_t.textBack}>
<Navbar className="navbar-link-settings" title={_t.textSheet} backLink={_t.textBack}>
{Device.phone &&
<NavRight>
<Link icon='icon-expand-down' sheetClose></Link>
<Link icon='icon-close' popupClose="#edit-link-popup"></Link>
</NavRight>
}
</Navbar>
@ -110,7 +110,27 @@ const EditLink = props => {
const [range, setRange] = useState(valueRange || 'A1');
return (
<Fragment>
<Page>
<Navbar className="navbar-link-settings">
<NavLeft>
<Link text={Device.ios ? t('View.Edit.textCancel') : ''} onClick={() => {
props.isNavigate ? f7.views.current.router.back() : props.closeModal();
}}>
{Device.android && <Icon icon='icon-close' />}
</Link>
</NavLeft>
<NavTitle>{t('View.Edit.textLinkSettings')}</NavTitle>
<NavRight>
<Link className={`${(typeLink === 1 && !link.length) || (typeLink === 2 && (!range.length || !curSheet.length)) && 'disabled'}`} onClick={() => {
props.onEditLink(typeLink === 1 ?
{type: 1, url: link, text: stateDisplayText, tooltip: screenTip} :
{type: 2, url: range, sheet: curSheet, text: stateDisplayText, tooltip: screenTip});
}} text={Device.ios ? t('View.Edit.textDone') : ''}>
{Device.android && <Icon icon={link.length < 1 ? 'icon-done-disabled' : 'icon-done'} />}
</Link>
</NavRight>
</Navbar>
<List inlineLabels className='inputs-list'>
<ListItem link={'/edit-link-type/'} title={_t.textLinkType} after={textType} routeProps={{
changeType: changeType,
@ -144,7 +164,7 @@ const EditLink = props => {
}
<ListInput label={_t.textDisplay}
type="text"
placeholder={_t.textDisplay}
placeholder={t('View.Edit.textRecommended')}
value={stateDisplayText}
disabled={isLock}
onChange={(event) => {setDisplayText(event.target.value)}}
@ -159,26 +179,24 @@ const EditLink = props => {
/>
</List>
<List className="buttons-list">
<ListButton title={_t.textEditLink}
className={`button-fill button-raised ${(typeLink === 1 && !link.length) || (typeLink === 2 && (!range.length || !curSheet.length)) ? 'disabled' : ''}`}
onClick={() => {props.onEditLink(typeLink === 1 ?
{type: 1, url: link, text: stateDisplayText, tooltip: screenTip} :
{type: 2, url: range, sheet: curSheet, text: stateDisplayText, tooltip: screenTip})}}
/>
<ListButton title={_t.textRemoveLink}
className={`button-red button-fill button-raised`}
onClick={() => props.onRemoveLink()}
<ListButton
title={t('View.Edit.textDeleteLink')}
className={`button-red button-fill button-raised`}
onClick={() => {
props.onRemoveLink();
props.isNavigate ? f7.views.current.router.back() : props.closeModal();
}}
/>
</List>
</Fragment>
</Page>
)
};
const _PageTypeLink = inject("storeFocusObjects")(observer(PageTypeLink));
const _PageSheet = inject("storeFocusObjects")(observer(PageSheet));
const _PageEditTypeLink = inject("storeFocusObjects")(observer(PageEditTypeLink));
const _PageEditSheet = inject("storeFocusObjects")(observer(PageEditSheet));
export {
EditLink,
_PageTypeLink as PageTypeLink,
_PageSheet as PageSheet
_PageEditTypeLink as PageEditTypeLink,
_PageEditSheet as PageEditSheet
};