diff --git a/apps/documenteditor/mobile/src/components/edit/Edit.jsx b/apps/documenteditor/mobile/src/components/edit/Edit.jsx index bca095cd1..a68ad898a 100644 --- a/apps/documenteditor/mobile/src/components/edit/Edit.jsx +++ b/apps/documenteditor/mobile/src/components/edit/Edit.jsx @@ -1,26 +1,61 @@ import React, {useState, useEffect} from 'react'; import {observer, inject} from "mobx-react"; -import { Page, Navbar, NavRight, NavLeft, NavTitle, Link, Sheet, Tabs, Tab, View } from 'framework7-react'; +import { Popover, Sheet, View, Page, Navbar, NavRight, NavLeft, NavTitle, Tabs, Tab, Link } from 'framework7-react'; import { f7 } from 'framework7-react'; import { useTranslation } from 'react-i18next'; +import {Device} from '../../../../../common/mobile/utils/device'; + import EditTextController from "./controller/EditText"; import EditParagraphController from "./controller/EditParagraph"; +import {PageAdditionalFormatting, PageBullets, PageFonts, PageLineSpacing, PageNumbers} from "./EditText"; +import {PageAdvancedSettings} from "./EditParagraph"; + +const routes = [ + //Edit text + { + path: '/edit-text-fonts/', + component: PageFonts, + }, + { + path: '/edit-text-add-formatting/', + component: PageAdditionalFormatting, + }, + { + path: '/edit-text-bullets/', + component: PageBullets, + }, + { + path: '/edit-text-numbers/', + component: PageNumbers, + }, + { + path: '/edit-text-line-spacing/', + component: PageLineSpacing, + }, + //Edit paragraph + { + path: '/edit-paragraph-adv/', + component: PageAdvancedSettings, + } +]; const EmptyEditLayout = () => { const { t } = useTranslation(); + const _t = t('Edit', {returnObjects: true}); return ( - {t("Edit.textSelectObjectToEdit")} + {_t.textSelectObjectToEdit} ) }; -const EditLayoutNavbar = ({ editors }) => { +const EditLayoutNavbar = ({ editors, inPopover }) => { const { t } = useTranslation(); + const _t = t('Edit', {returnObjects: true}); return ( { @@ -30,9 +65,7 @@ const EditLayoutNavbar = ({ editors }) => { : { editors[0].caption } } - - {t("Edit.textClose")} - + { !inPopover && {_t.textClose} } ) }; @@ -57,70 +90,71 @@ const EditLayoutContent = ({ editors }) => { } }; -const EditSheet = props => { +const EditTabs = props => { const { t } = useTranslation(); + const _t = t('Edit', {returnObjects: true}); const settings = props.storeFocusObjects.settings; const headerType = props.storeFocusObjects.headerType; let editors = []; if (settings.length < 1) { editors.push({ - caption: t("Edit.textSettings"), + caption: _t.textSettings, component: }); } else { if (settings.indexOf('text') > -1) { editors.push({ - caption: t("Edit.textText"), + caption: _t.textText, id: 'edit-text', component: }) } if (settings.indexOf('paragraph') > -1) { editors.push({ - caption: t("Edit.textParagraph"), + caption: _t.textParagraph, id: 'edit-paragraph', component: }) } /*if (settings.indexOf('table') > -1) { editors.push({ - caption: t("Edit.textTable"), + caption: _t.textTable, id: 'edit-table', component: }) } if (settings.indexOf('header') > -1) { editors.push({ - caption: headerType==2 ? t("Edit.textFooter") : t("Edit.textHeader"), + caption: headerType==2 ? _t.textFooter : _t.textHeader, id: 'edit-header', component: }) } if (settings.indexOf('shape') > -1) { editors.push({ - caption: t("Edit.textShape"), + caption: _t.textShape, id: 'edit-shape', component: }) } if (settings.indexOf('image') > -1) { editors.push({ - caption: t("Edit.textImage"), + caption: _t.textImage, id: 'edit-image', component: }) } if (settings.indexOf('chart') > -1) { editors.push({ - caption: t("Edit.textChart"), + caption: _t.textChart, id: 'edit-chart', component: }) } if (settings.indexOf('hyperlink') > -1) { editors.push({ - caption: t("Edit.textHyperlink"), + caption: _t.textHyperlink, id: 'edit-link', component: }) @@ -128,34 +162,52 @@ const EditSheet = props => { } return ( - props.onclosed()}> - - - - - - - + + + + + + + ) }; -const HOC_EditSheet = inject("storeFocusObjects")(observer(EditSheet)); +const EditTabsContainer = inject("storeFocusObjects")(observer(EditTabs)); + +const EditView = props => { + const onOptionClick = (page) => { + $f7.views.current.router.navigate(page); + }; + const show_popover = props.usePopover; + return ( + show_popover ? + props.onClosed()}> + + : + props.onClosed()}> + + + ) +}; const EditOptions = props => { useEffect(() => { - f7.sheet.open('.edit__sheet'); + if ( Device.phone ) + f7.sheet.open('#edit-sheet'); + else f7.popover.open('#edit-popover', '#btn-edit'); return () => { // component will unmount } }); - const onsheetclosed = () => { - if ( props.onclosed ) props.onclosed(); + const onviewclosed = () => { + if ( props.onclosed ) + props.onclosed(); }; return ( - + ) }; diff --git a/apps/documenteditor/mobile/src/js/routes.js b/apps/documenteditor/mobile/src/js/routes.js index ba53467eb..b87918978 100644 --- a/apps/documenteditor/mobile/src/js/routes.js +++ b/apps/documenteditor/mobile/src/js/routes.js @@ -8,40 +8,10 @@ import RequestAndLoad from '../pages/request-and-load.jsx'; import { PageCollaboration, PageUsers } from '../../../../common/mobile/lib/view/Collaboration.jsx'; -// Edit -import { PageFonts, PageAdditionalFormatting, PageBullets, PageNumbers, PageLineSpacing } from "../components/edit/EditText"; -import { PageAdvancedSettings } from "../components/edit/EditParagraph"; - var routes = [ { path: '/', component: HomePage, - }, - //Edit text - { - path: '/edit-text-fonts/', - component: PageFonts, - }, - { - path: '/edit-text-add-formatting/', - component: PageAdditionalFormatting, - }, - { - path: '/edit-text-bullets/', - component: PageBullets, - }, - { - path: '/edit-text-numbers/', - component: PageNumbers, - }, - { - path: '/edit-text-line-spacing/', - component: PageLineSpacing, - }, - //Edit paragraph - { - path: '/edit-paragraph-adv/', - component: PageAdvancedSettings, }, { path: '/users/', diff --git a/apps/documenteditor/mobile/src/pages/home.jsx b/apps/documenteditor/mobile/src/pages/home.jsx index 978b6ff00..9c8d2f5bf 100644 --- a/apps/documenteditor/mobile/src/pages/home.jsx +++ b/apps/documenteditor/mobile/src/pages/home.jsx @@ -55,8 +55,8 @@ export default class Home extends Component { Redo - this.handleClickToOpenOptions('edit')}>Edit this.handleClickToOpenOptions('coauth')}>Users + this.handleClickToOpenOptions('edit')} id='btn-edit'>Edit this.handleClickToOpenOptions('settings')} id='btn-settings'>Settings
{t("Edit.textSelectObjectToEdit")}
{_t.textSelectObjectToEdit}