diff --git a/apps/documenteditor/mobile/locale/en.json b/apps/documenteditor/mobile/locale/en.json index d8e847909..f0991d942 100644 --- a/apps/documenteditor/mobile/locale/en.json +++ b/apps/documenteditor/mobile/locale/en.json @@ -57,7 +57,10 @@ "textStartAt": "Start At", "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\"", + "textTableContents": "Table of Contents", + "textWithPageNumbers": "With Page Numbers", + "textWithBlueLinks": "With Blue Links" }, "Common": { "Collaboration": { diff --git a/apps/documenteditor/mobile/src/controller/add/AddTableContents.jsx b/apps/documenteditor/mobile/src/controller/add/AddTableContents.jsx new file mode 100644 index 000000000..fc8067d03 --- /dev/null +++ b/apps/documenteditor/mobile/src/controller/add/AddTableContents.jsx @@ -0,0 +1,61 @@ +import React, {Component} from 'react'; +import { f7 } from 'framework7-react'; +import {Device} from '../../../../../common/mobile/utils/device'; +import {AddTableContents} from '../../view/add/AddTableContents'; + +class AddTableContentsController extends Component { + constructor (props) { + super(props); + } + + closeModal () { + if ( Device.phone ) { + f7.sheet.close('.add-popup', true); + } else { + f7.popover.close('#add-popover'); + } + } + + componentDidMount () { + const api = Common.EditorApi.get(); + api.asc_getButtonsTOC('toc1', 'toc2'); + } + + onTableContents(type, currentTOC) { + const api = Common.EditorApi.get(); + let props = api.asc_GetTableOfContentsPr(currentTOC); + + switch (type) { + case 0: + if (!props) { + props = new Asc.CTableOfContentsPr(); + props.put_OutlineRange(1, 9); + } + props.put_Hyperlink(true); + props.put_ShowPageNumbers(true); + props.put_RightAlignTab(true); + props.put_TabLeader(Asc.c_oAscTabLeader.Dot); + api.asc_AddTableOfContents(null, props); + break; + case 1: + if (!props) { + props = new Asc.CTableOfContentsPr(); + props.put_OutlineRange(1, 9); + } + props.put_Hyperlink(true); + props.put_ShowPageNumbers(false); + props.put_TabLeader(Asc.c_oAscTabLeader.None); + props.put_StylesType(Asc.c_oAscTOCStylesType.Web); + api.asc_AddTableOfContents(null, props); + break; + } + } + + render () { + return ( + + ) + } +} + +export default AddTableContentsController; \ No newline at end of file diff --git a/apps/documenteditor/mobile/src/less/app.less b/apps/documenteditor/mobile/src/less/app.less index a4c192194..e73ec6778 100644 --- a/apps/documenteditor/mobile/src/less/app.less +++ b/apps/documenteditor/mobile/src/less/app.less @@ -157,4 +157,10 @@ height: 50px; } +// Table of Contents + +.item-contents { + padding: 0 16px; +} + diff --git a/apps/documenteditor/mobile/src/less/icons-ios.less b/apps/documenteditor/mobile/src/less/icons-ios.less index 99205059b..cb91ca965 100644 --- a/apps/documenteditor/mobile/src/less/icons-ios.less +++ b/apps/documenteditor/mobile/src/less/icons-ios.less @@ -398,6 +398,11 @@ height: 24px; .encoded-svg-mask('', @toolbar-segment); } + &.icon-table-contents { + width: 24px; + height: 24px; + .encoded-svg-mask(''); + } &.icon-insert-comment { width: 24px; diff --git a/apps/documenteditor/mobile/src/less/icons-material.less b/apps/documenteditor/mobile/src/less/icons-material.less index bc3b9c640..a36c1aa15 100644 --- a/apps/documenteditor/mobile/src/less/icons-material.less +++ b/apps/documenteditor/mobile/src/less/icons-material.less @@ -136,6 +136,11 @@ height: 22px; .encoded-svg-mask(''); } + &.icon-table-contents { + width: 24px; + height: 24px; + .encoded-svg-mask(''); + } // Download diff --git a/apps/documenteditor/mobile/src/view/add/Add.jsx b/apps/documenteditor/mobile/src/view/add/Add.jsx index 365bcc566..83da3a2ee 100644 --- a/apps/documenteditor/mobile/src/view/add/Add.jsx +++ b/apps/documenteditor/mobile/src/view/add/Add.jsx @@ -13,6 +13,7 @@ import {AddOtherController} from "../../controller/add/AddOther"; import {PageImageLinkSettings} from "../add/AddImage"; import {PageAddNumber, PageAddBreak, PageAddSectionBreak, PageAddFootnote} from "../add/AddOther"; +import AddTableContentsController from '../../controller/add/AddTableContents'; const routes = [ // Image @@ -41,6 +42,10 @@ const routes = [ path: '/add-footnote/', component: PageAddFootnote, }, + { + path: '/add-table-contents/', + component: AddTableContentsController + } ]; 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 7823f05e9..1f48b8685 100644 --- a/apps/documenteditor/mobile/src/view/add/AddOther.jsx +++ b/apps/documenteditor/mobile/src/view/add/AddOther.jsx @@ -209,6 +209,9 @@ const AddOther = props => { } + + + {(isShape || isChart) || (isText && disabledAddFootnote) ? null : { + const { t } = useTranslation(); + const _t = t('Add', {returnObjects: true}); + + return ( + + + {_t.textWithPageNumbers} +
props.onTableContents(0)}>
+ {_t.textWithBlueLinks} +
props.onTableContents(1)}>
+
+ ) +}; + +export {AddTableContents}