diff --git a/apps/common/mobile/resources/less/common-ios.less b/apps/common/mobile/resources/less/common-ios.less index 1edd16cf5..5dcd68c1b 100644 --- a/apps/common/mobile/resources/less/common-ios.less +++ b/apps/common/mobile/resources/less/common-ios.less @@ -337,7 +337,7 @@ } } - .dataview { + .dataview, #add-table { &.page-content { background-color: @white; } diff --git a/apps/common/mobile/resources/less/common.less b/apps/common/mobile/resources/less/common.less index 31928ccde..7945fc977 100644 --- a/apps/common/mobile/resources/less/common.less +++ b/apps/common/mobile/resources/less/common.less @@ -388,7 +388,6 @@ .table-styles { width: 100%; .row { - padding: 0; &, li { margin-bottom: 12px; } diff --git a/apps/documenteditor/mobile/locale/en.json b/apps/documenteditor/mobile/locale/en.json index c1f50c070..9f0e76085 100644 --- a/apps/documenteditor/mobile/locale/en.json +++ b/apps/documenteditor/mobile/locale/en.json @@ -223,6 +223,10 @@ "textTable": "Table", "textShape": "Shape", "textImage": "Image", - "textOther": "Other" + "textOther": "Other", + "textTableSize": "Table Size", + "textColumns": "Columns", + "textRows": "Rows", + "textCancel": "Cancel" } } \ No newline at end of file diff --git a/apps/documenteditor/mobile/src/controller/add/AddTable.jsx b/apps/documenteditor/mobile/src/controller/add/AddTable.jsx index 93149252e..4a0a4bfd5 100644 --- a/apps/documenteditor/mobile/src/controller/add/AddTable.jsx +++ b/apps/documenteditor/mobile/src/controller/add/AddTable.jsx @@ -1,20 +1,93 @@ import React, {Component} from 'react'; import { f7 } from 'framework7-react'; import {Device} from '../../../../../common/mobile/utils/device'; -import {observer, inject} from "mobx-react"; +import { withTranslation} from 'react-i18next'; -import { AddTable } from '../../view/add/AddTable'; +import AddTable from '../../view/add/AddTable'; class AddTableController extends Component { constructor (props) { super(props); + this.onStyleClick = this.onStyleClick.bind(this); + + const api = Common.EditorApi.get(); + api.asc_GetDefaultTableStyles(); } + + closeModal () { + if ( Device.phone ) { + f7.sheet.close('.add-popup', true); + } else { + f7.popover.close('#add-popover'); + } + } + + onStyleClick (type) { + const api = Common.EditorApi.get(); + + this.closeModal(); + + const { t } = this.props; + const _t = t("Add", { returnObjects: true }); + + let picker; + + const dialog = f7.dialog.create({ + title: _t.textTableSize, + text: '', + content: + '
' + + '
' + + '
' + _t.textColumns + '
' + + '
' + _t.textRows + '
' + + '
' + + '
' + + '
', + buttons: [ + { + text: _t.textCancel + }, + { + text: 'OK', + bold: true, + onClick: function () { + const size = picker.value; + + api.put_Table(parseInt(size[0]), parseInt(size[1]), type.toString()); + } + } + ] + }).open(); + dialog.on('opened', () => { + picker = f7.picker.create({ + containerEl: document.getElementById('picker-table-size'), + cols: [ + { + textAlign: 'center', + width: '100%', + values: [1,2,3,4,5,6,7,8,9,10] + }, + { + textAlign: 'center', + width: '100%', + values: [1,2,3,4,5,6,7,8,9,10] + } + ], + toolbar: false, + rotateEffect: true, + value: [3, 3] + }); + }); + } + render () { return ( - ) } } -export default AddTableController; \ No newline at end of file +const AddTableWithTranslation = withTranslation()(AddTableController); + +export {AddTableWithTranslation as AddTableController}; \ 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 c6ed5e6e4..eeb7ab866 100644 --- a/apps/documenteditor/mobile/src/view/add/Add.jsx +++ b/apps/documenteditor/mobile/src/view/add/Add.jsx @@ -5,7 +5,7 @@ import {f7} from 'framework7-react'; import { observer, inject } from "mobx-react"; import {Device} from '../../../../../common/mobile/utils/device'; -import AddTableController from "../../controller/add/AddTable"; +import {AddTableController} from "../../controller/add/AddTable"; import AddShapeController from "../../controller/add/AddShape"; //import AddImageController from "../../controller/add/AddImage"; //import AddOtherController from "../../controller/add/AddOther"; diff --git a/apps/documenteditor/mobile/src/view/add/AddTable.jsx b/apps/documenteditor/mobile/src/view/add/AddTable.jsx index 0a71acac5..3e4635f43 100644 --- a/apps/documenteditor/mobile/src/view/add/AddTable.jsx +++ b/apps/documenteditor/mobile/src/view/add/AddTable.jsx @@ -5,11 +5,22 @@ import { useTranslation } from 'react-i18next'; import {Device} from '../../../../../common/mobile/utils/device'; const AddTable = props => { + const storeTableSettings = props.storeTableSettings; + const styles = storeTableSettings.styles; return ( - - - +
+ +
) }; -export {AddTable}; \ No newline at end of file +export default inject("storeTableSettings")(observer(AddTable)); \ No newline at end of file