From 6cc5bae310a580257945fab05d94b2a239d76398 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Fri, 22 Jan 2021 14:33:00 +0300 Subject: [PATCH] [DE mobile] Added the ability to insert break --- apps/documenteditor/mobile/locale/en.json | 9 ++- .../mobile/src/controller/add/AddOther.jsx | 34 +++++++++++ .../mobile/src/css/icons-ios.less | 10 +++ .../mobile/src/css/icons-material.less | 10 +++ .../mobile/src/view/add/Add.jsx | 10 ++- .../mobile/src/view/add/AddOther.jsx | 61 ++++++++++++++++++- 6 files changed, 130 insertions(+), 4 deletions(-) diff --git a/apps/documenteditor/mobile/locale/en.json b/apps/documenteditor/mobile/locale/en.json index 01e15bc60..612cb2a27 100644 --- a/apps/documenteditor/mobile/locale/en.json +++ b/apps/documenteditor/mobile/locale/en.json @@ -254,6 +254,13 @@ "textLeftBottom": "Left Bottom", "textCenterBottom": "Center Bottom", "textRightBottom": "Right Bottom", - "textCurrentPosition": "Current Position" + "textCurrentPosition": "Current Position", + "textPageBreak": "Page Break", + "textColumnBreak": "Column Break", + "textSectionBreak": "Section Break", + "textNextPage": "Next Page", + "textContinuousPage": "Continuous Page", + "textEvenPage": "Even Page", + "textOddPage": "Odd Page" } } \ No newline at end of file diff --git a/apps/documenteditor/mobile/src/controller/add/AddOther.jsx b/apps/documenteditor/mobile/src/controller/add/AddOther.jsx index 19412ca62..f4e68ef1b 100644 --- a/apps/documenteditor/mobile/src/controller/add/AddOther.jsx +++ b/apps/documenteditor/mobile/src/controller/add/AddOther.jsx @@ -10,6 +10,9 @@ class AddOtherController extends Component { super(props); this.onInsertLink = this.onInsertLink.bind(this); this.onInsertPageNumber = this.onInsertPageNumber.bind(this); + this.onPageBreak = this.onPageBreak.bind(this); + this.onColumnBreak = this.onColumnBreak.bind(this); + this.onInsertSectionBreak = this.onInsertSectionBreak.bind(this); } closeModal () { @@ -93,11 +96,42 @@ class AddOtherController extends Component { this.closeModal(); } + onPageBreak () { + const api = Common.EditorApi.get(); + api.put_AddPageBreak(); + this.closeModal(); + } + + onColumnBreak () { + const api = Common.EditorApi.get(); + api.put_AddColumnBreak(); + this.closeModal(); + } + + onInsertSectionBreak (type) { + const api = Common.EditorApi.get(); + let value; + if ('next' == type) { + value = Asc.c_oAscSectionBreakType.NextPage; + } else if ('continuous' == type) { + value = Asc.c_oAscSectionBreakType.Continuous; + } else if ('even' == type) { + value = Asc.c_oAscSectionBreakType.EvenPage; + } else if ('odd' == type) { + value = Asc.c_oAscSectionBreakType.OddPage; + } + api.add_SectionBreak(value); + this.closeModal(); + } + render () { return ( ) } diff --git a/apps/documenteditor/mobile/src/css/icons-ios.less b/apps/documenteditor/mobile/src/css/icons-ios.less index 466081665..a2aca5059 100644 --- a/apps/documenteditor/mobile/src/css/icons-ios.less +++ b/apps/documenteditor/mobile/src/css/icons-ios.less @@ -419,6 +419,16 @@ height: 24px; .encoded-svg-background(''); } + &.icon-pagebreak { + width: 22px; + height: 22px; + .encoded-svg-background(''); + } + &.icon-stringbreak { + width: 22px; + height: 22px; + .encoded-svg-background(''); + } } .tab-link-active { i.icon { diff --git a/apps/documenteditor/mobile/src/css/icons-material.less b/apps/documenteditor/mobile/src/css/icons-material.less index b338e904f..d309b0bf9 100644 --- a/apps/documenteditor/mobile/src/css/icons-material.less +++ b/apps/documenteditor/mobile/src/css/icons-material.less @@ -362,5 +362,15 @@ height: 24px; .encoded-svg-background(''); } + &.icon-pagebreak { + width: 22px; + height: 22px; + .encoded-svg-background(''); + } + &.icon-stringbreak { + width: 22px; + height: 22px; + .encoded-svg-background(''); + } } } \ No newline at end of file diff --git a/apps/documenteditor/mobile/src/view/add/Add.jsx b/apps/documenteditor/mobile/src/view/add/Add.jsx index df4d740e6..fbc47f05f 100644 --- a/apps/documenteditor/mobile/src/view/add/Add.jsx +++ b/apps/documenteditor/mobile/src/view/add/Add.jsx @@ -11,7 +11,7 @@ import {AddImageController} from "../../controller/add/AddImage"; import {AddOtherController} from "../../controller/add/AddOther"; import {PageImageLinkSettings} from "../add/AddImage"; -import {PageAddLink, PageAddNumber} from "../add/AddOther"; +import {PageAddLink, PageAddNumber, PageAddBreak, PageAddSectionBreak} from "../add/AddOther"; const routes = [ // Image @@ -28,6 +28,14 @@ const routes = [ path: '/add-page-number/', component: PageAddNumber, }, + { + path: '/add-break/', + component: PageAddBreak, + }, + { + path: '/add-section-break/', + component: PageAddSectionBreak, + }, ]; const AddLayoutNavbar = ({ tabs, inPopover }) => { diff --git a/apps/documenteditor/mobile/src/view/add/AddOther.jsx b/apps/documenteditor/mobile/src/view/add/AddOther.jsx index f24f930ea..e50a23ad5 100644 --- a/apps/documenteditor/mobile/src/view/add/AddOther.jsx +++ b/apps/documenteditor/mobile/src/view/add/AddOther.jsx @@ -67,6 +67,57 @@ const PageNumber = props => { ) }; +const PageBreak = props => { + const { t } = useTranslation(); + const _t = t('Add', {returnObjects: true}); + return ( + + + + { + props.onPageBreak() + }}> + + + { + props.onColumnBreak(); + }}> + + + + + + + + ) +}; + +const PageSectionBreak = props => { + const { t } = useTranslation(); + const _t = t('Add', {returnObjects: true}); + return ( + + + + { + props.onInsertSectionBreak('next') + }}> + { + props.onInsertSectionBreak('continuous') + }}> + { + props.onInsertSectionBreak('even') + }}> + { + props.onInsertSectionBreak('odd') + }}> + + + ) +}; + const AddOther = props => { const { t } = useTranslation(); const _t = t('Add', {returnObjects: true}); @@ -86,7 +137,11 @@ const AddOther = props => { }}> - + @@ -98,4 +153,6 @@ const AddOther = props => { export {AddOther, PageLink as PageAddLink, - PageNumber as PageAddNumber}; \ No newline at end of file + PageNumber as PageAddNumber, + PageBreak as PageAddBreak, + PageSectionBreak as PageAddSectionBreak}; \ No newline at end of file