diff --git a/apps/presentationeditor/mobile/src/controller/Main.jsx b/apps/presentationeditor/mobile/src/controller/Main.jsx index 634dcb24e..d864e977e 100644 --- a/apps/presentationeditor/mobile/src/controller/Main.jsx +++ b/apps/presentationeditor/mobile/src/controller/Main.jsx @@ -192,18 +192,28 @@ class MainController extends Component { // me.api.asc_registerCallback('asc_onMeta', _.bind(me.onMeta, me)); const storeFocusObjects = this.props.storeFocusObjects; - this.api.asc_registerCallback('asc_onFocusObject', objects => { - storeFocusObjects.resetFocusObjects(objects); - }); - - this.api.asc_registerCallback('asc_onUpdateThemeIndex', themeId => { - console.log(themeId); - }); - const storeLayout = this.props.storeLayout; + this.api.asc_registerCallback('asc_onFocusObject', objects => { + + console.log(objects); + storeFocusObjects.resetFocusObjects(objects); + + const settings = storeFocusObjects.settings; + console.log(settings); + + if(settings[0] === "slide") { + const slideObject = objects[0].get_ObjectValue(); + storeLayout.changeSlideLayoutIndex(slideObject.get_LayoutIndex()); + } + }); + + // this.api.asc_registerCallback('asc_onUpdateThemeIndex', themeId => { + // console.log(themeId); + // }); + this.api.asc_registerCallback('asc_onUpdateLayout', (layouts) => { - console.log(layouts); + // console.log(layouts); storeLayout.addArrayLayouts(layouts); }); } diff --git a/apps/presentationeditor/mobile/src/controller/edit/Layout.jsx b/apps/presentationeditor/mobile/src/controller/edit/Layout.jsx index a4c9c3dc2..572b47a70 100644 --- a/apps/presentationeditor/mobile/src/controller/edit/Layout.jsx +++ b/apps/presentationeditor/mobile/src/controller/edit/Layout.jsx @@ -6,9 +6,20 @@ class LayoutController extends Component { super(props); } + onLayoutClick(index) { + const api = Common.EditorApi.get(); + let props = new Asc.CAscSlideProps(); + console.log(api); + + props.LayoutIndex = index; + api.SetSlideProps(props); + + console.log(props); + } + render() { return ( - + ); } } diff --git a/apps/presentationeditor/mobile/src/less/app-ios.less b/apps/presentationeditor/mobile/src/less/app-ios.less index 08d52715d..62aa74165 100644 --- a/apps/presentationeditor/mobile/src/less/app-ios.less +++ b/apps/presentationeditor/mobile/src/less/app-ios.less @@ -28,8 +28,10 @@ // Layout - .list-layouts { - margin: auto; + .slide-layout { + .list { + margin: auto; + } ul { display: flex; flex-wrap: wrap; @@ -38,25 +40,32 @@ li { position: relative; z-index: 1; - margin: 0; margin-top: 12px; img { box-shadow: 0 0 0 1px rgba(0,0,0,.15); } } - li .item-inner:after { + .item-inner { + padding-top: 0; + } + .item-inner:after { display: none; } - li.active .item-inner:after { + .item-inner:before { + opacity: 0; content: ''; position: absolute; width: 22px; height: 22px; - right: -5px; - bottom: -5px; + right: 11px; + bottom: 0; + z-index: 1; background-repeat: no-repeat; .encoded-svg-background(''); } + .active .item-inner:before { + opacity: 1; + } } } diff --git a/apps/presentationeditor/mobile/src/less/app-material.less b/apps/presentationeditor/mobile/src/less/app-material.less index 8356510c0..8367a79ab 100644 --- a/apps/presentationeditor/mobile/src/less/app-material.less +++ b/apps/presentationeditor/mobile/src/less/app-material.less @@ -49,8 +49,10 @@ // Layout - .list-layouts { - margin: auto; + .slide-layout { + .list { + margin: auto; + } ul { display: flex; flex-wrap: wrap; @@ -59,24 +61,31 @@ li { position: relative; z-index: 1; - margin: 0; margin-top: 12px; img { box-shadow: 0 0 0 1px rgba(0,0,0,.15); } } - li .item-inner:after { + .item-inner { + padding-top: 0; + } + .item-inner:after { display: none; } - li.active .item-inner:after { + .item-inner:before { + opacity: 0; content: ''; position: absolute; width: 22px; height: 22px; - right: -5px; - bottom: -5px; + right: 11px; + bottom: 0; + z-index: 1; background-repeat: no-repeat; .encoded-svg-background(''); } + .active .item-inner:before { + opacity: 1; + } } } diff --git a/apps/presentationeditor/mobile/src/store/layout.js b/apps/presentationeditor/mobile/src/store/layout.js index 93e00b7e2..4992a5b79 100644 --- a/apps/presentationeditor/mobile/src/store/layout.js +++ b/apps/presentationeditor/mobile/src/store/layout.js @@ -3,9 +3,14 @@ import {action, observable} from 'mobx'; export class storeLayout { @observable arrayLayouts; + @observable slideLayoutIndex = -1; @action addArrayLayouts(array) { this.arrayLayouts = array; } + @action changeSlideLayoutIndex(index) { + this.slideLayoutIndex = index; + } + } \ No newline at end of file diff --git a/apps/presentationeditor/mobile/src/view/edit/Layout.jsx b/apps/presentationeditor/mobile/src/view/edit/Layout.jsx index bd111f555..0f05a8cde 100644 --- a/apps/presentationeditor/mobile/src/view/edit/Layout.jsx +++ b/apps/presentationeditor/mobile/src/view/edit/Layout.jsx @@ -1,6 +1,6 @@ -import React, {Fragment} from "react"; +import React from "react"; import { observer, inject } from "mobx-react"; -import { Page, Navbar, List, ListItem, BlockTitle } from "framework7-react"; +import { Page, Navbar, List, ListItem, NavRight, Link } from "framework7-react"; import { useTranslation } from "react-i18next"; const PageLayout = props => { @@ -8,18 +8,31 @@ const PageLayout = props => { const _t = t("View.Edit", { returnObjects: true }); const store = props.storeLayout; const arrayLayouts = JSON.parse(JSON.stringify(store.arrayLayouts)); + const slideLayoutIndex = store.slideLayoutIndex; + + console.log(slideLayoutIndex); console.log(arrayLayouts); console.log(store); + + return ( - - + + + + + + {arrayLayouts.length ? ( - + {arrayLayouts.map((elem, index) => { return ( - - + { + store.changeSlideLayoutIndex(index); + props.onLayoutClick(index); + }}> + ) })}