From c7f7006400c774a2064b422c5620bc23ebca5f29 Mon Sep 17 00:00:00 2001 From: SergeyEzhin Date: Thu, 10 Dec 2020 23:02:25 +0300 Subject: [PATCH 1/4] [PE mobile] Make Presentation Settings --- apps/presentationeditor/mobile/locale/en.json | 6 +- .../mobile/src/controller/Main.jsx | 11 ++ .../settings/PresentationSettings.jsx | 24 ++++ .../mobile/src/store/mainStore.js | 4 +- .../mobile/src/store/presentationSettings.js | 38 +++++++ .../view/settings/PresentationSettings.jsx | 103 ++++++++++++++++++ .../mobile/src/view/settings/Settings.jsx | 10 ++ 7 files changed, 194 insertions(+), 2 deletions(-) create mode 100644 apps/presentationeditor/mobile/src/controller/settings/PresentationSettings.jsx create mode 100644 apps/presentationeditor/mobile/src/store/presentationSettings.js create mode 100644 apps/presentationeditor/mobile/src/view/settings/PresentationSettings.jsx diff --git a/apps/presentationeditor/mobile/locale/en.json b/apps/presentationeditor/mobile/locale/en.json index 4988d8b44..075e88334 100644 --- a/apps/presentationeditor/mobile/locale/en.json +++ b/apps/presentationeditor/mobile/locale/en.json @@ -48,7 +48,11 @@ "textShowNotification": "Show Notification", "textDisableAllMacrosWithNotification": "Disable all macros with notification", "textEnableAll": "Enable All", - "textEnableAllMacrosWithoutNotification": "Enable all macros without notification" + "textEnableAllMacrosWithoutNotification": "Enable all macros without notification", + "textSlideSize": "Slide Size", + "mniSlideStandard": "Standard (4:3)", + "mniSlideWide": "Widescreen (16:9)", + "textColorSchemes": "Color Schemes" } } } \ No newline at end of file diff --git a/apps/presentationeditor/mobile/src/controller/Main.jsx b/apps/presentationeditor/mobile/src/controller/Main.jsx index 06c2b87c1..678c493bd 100644 --- a/apps/presentationeditor/mobile/src/controller/Main.jsx +++ b/apps/presentationeditor/mobile/src/controller/Main.jsx @@ -4,6 +4,7 @@ import { inject } from "mobx-react"; import { withTranslation } from 'react-i18next'; import CollaborationController from '../../../../common/mobile/lib/controller/Collaboration.jsx' +@inject("storePresentationSettings") class MainController extends Component { constructor(props) { super(props) @@ -160,9 +161,19 @@ class MainController extends Component { bindEvents() { const me = this; + // me.api.asc_registerCallback('asc_onError', _.bind(me.onError, me)); me.api.asc_registerCallback('asc_onDocumentContentReady', me._onDocumentContentReady.bind(me)); me.api.asc_registerCallback('asc_onOpenDocumentProgress', me._onOpenDocumentProgress.bind(me)); + + const storePresentationSettings = this.props.storePresentationSettings; + + me.api.asc_registerCallback('asc_onPresentationSize', (width, height) => { + // const api = Common.EditorApi.get(); + storePresentationSettings.changeSlideSize(width, height); + }); + + // api.asc_registerCallback('asc_onSendThemeColorSchemes', _.bind(this.onSendThemeColorSchemes, this)); // me.api.asc_registerCallback('asc_onDocumentUpdateVersion', _.bind(me.onUpdateVersion, me)); // me.api.asc_registerCallback('asc_onServerVersion', _.bind(me.onServerVersion, me)); // me.api.asc_registerCallback('asc_onAdvancedOptions', _.bind(me.onAdvancedOptions, me)); diff --git a/apps/presentationeditor/mobile/src/controller/settings/PresentationSettings.jsx b/apps/presentationeditor/mobile/src/controller/settings/PresentationSettings.jsx new file mode 100644 index 000000000..86d6ee3a0 --- /dev/null +++ b/apps/presentationeditor/mobile/src/controller/settings/PresentationSettings.jsx @@ -0,0 +1,24 @@ +import React, {Component} from 'React'; +import {PresentationSettings} from '../../view/settings/PresentationSettings'; + +class PresentationSettingsController extends Component { + constructor(props) { + super(props); + // this.onSlideSize = this.onSlideSize.bind(this); + } + + onSlideSize(value, slideSizeArr) { + const api = Common.EditorApi.get(); + api.changeSlideSize(slideSizeArr[value][0], slideSizeArr[value][1]); + } + + render() { + return ( + + ) + } +} + +export default PresentationSettingsController; \ No newline at end of file diff --git a/apps/presentationeditor/mobile/src/store/mainStore.js b/apps/presentationeditor/mobile/src/store/mainStore.js index 3a22172b7..63a6bc6f6 100644 --- a/apps/presentationeditor/mobile/src/store/mainStore.js +++ b/apps/presentationeditor/mobile/src/store/mainStore.js @@ -3,6 +3,7 @@ // import {storeFocusObjects} from "./focusObjects"; import {storeUsers} from '../../../../common/mobile/lib/store/users'; import {storeApplicationSettings} from './applicationSettings'; +import {storePresentationSettings} from './presentationSettings'; // import {storeTextSettings} from "./textSettings"; // import {storeParagraphSettings} from "./paragraphSettings"; // import {storeShapeSettings} from "./shapeSettings"; @@ -14,7 +15,8 @@ export const stores = { // storeFocusObjects: new storeFocusObjects(), // storeDocumentSettings: new storeDocumentSettings(), users: new storeUsers(), - storeApplicationSettings: new storeApplicationSettings() + storeApplicationSettings: new storeApplicationSettings(), + storePresentationSettings: new storePresentationSettings() // storeTextSettings: new storeTextSettings(), // storeParagraphSettings: new storeParagraphSettings(), // storeShapeSettings: new storeShapeSettings(), diff --git a/apps/presentationeditor/mobile/src/store/presentationSettings.js b/apps/presentationeditor/mobile/src/store/presentationSettings.js new file mode 100644 index 000000000..e582d1693 --- /dev/null +++ b/apps/presentationeditor/mobile/src/store/presentationSettings.js @@ -0,0 +1,38 @@ +import {action, observable, computed} from 'mobx'; + +export class storePresentationSettings { + @observable widthSlide; + @observable heightSlide; + @observable slideSize = 0; + + @action changeSlideSize(width, height) { + this.widthSlide = width; + this.heightSlide = height; + } + + getSlideSizes() { + const slideSizeArr = [[254, 190.5], [254, 143]]; + return slideSizeArr; + } + + @action changeSlideFormat(value) { + this.slideSize = value; + } + + @computed get pageSizesIndex() { + const slideSizes = this.getSlideSizes(); + let ind = -1; + + slideSizes.forEach((size, index) => { + if(Math.abs(size[0] - this.widthSlide) < 0.001 && Math.abs(size[1] - this.heightSlide) < 0.001) { + ind = index; + } + }); + + if (ind === -1) { + ind = -1; + } + + return ind; + } +} \ No newline at end of file diff --git a/apps/presentationeditor/mobile/src/view/settings/PresentationSettings.jsx b/apps/presentationeditor/mobile/src/view/settings/PresentationSettings.jsx new file mode 100644 index 000000000..6b47b1112 --- /dev/null +++ b/apps/presentationeditor/mobile/src/view/settings/PresentationSettings.jsx @@ -0,0 +1,103 @@ +import React, {Fragment} from "react"; +import { observer, inject } from "mobx-react"; +import { Page, Navbar, List, ListItem, BlockTitle, Toggle } from "framework7-react"; +import { useTranslation } from "react-i18next"; + +const PagePresentationSettings = props => { + const { t } = useTranslation(); + const _t = t("View.Settings", { returnObjects: true }); + const store = props.storePresentationSettings; + const slideSizeArr = store.getSlideSizes(); + console.log(slideSizeArr); + const widthSlide = store.widthSlide; + const heightSlide = store.heightSlide; + const slideSize = store.slideSize; + console.log(widthSlide, heightSlide); + + return ( + + + {slideSizeArr.length ? ( + + {_t.textSlideSize} + + {/* {slideSizeArr.map((size, index) => { + if(Math.abs(size[0] - widthSlide) < 0.001 && Math.abs(size[1] - heightSlide) < 0.001) { + console.log(true); + return ( + + ) + } + })} */} + { + props.onSlideSize(0, slideSizeArr); + store.changeSlideFormat(0); + }} title={_t.mniSlideStandard}> + { + props.onSlideSize(1, slideSizeArr); + store.changeSlideFormat(1); + }} title={_t.mniSlideWide}> + + + ): null} + + + + + + ) +} + +const PagePresentationColorSchemes = props => { + const { t } = useTranslation(); + // const curScheme = props.initPageColorSchemes(); + // const [stateScheme, setScheme] = useState(curScheme); + const _t = t('View.Settings', {returnObjects: true}); + // const storeSettings = props.storeDocumentSettings; + // const allSchemes = storeSettings.allSchemes; + + return ( + + + {/* + { + allSchemes ? allSchemes.map((scheme, index) => { + return ( + { + if(index !== curScheme) { + setScheme(index); + props.onColorSchemeChange(index); + }; + }}> +
+ + { + scheme.get_colors().map((elem, index) => { + if(index >=2 && index < 7) { + let clr = {background: "#" + Common.Utils.ThemeColor.getHexColor(elem.get_r(), elem.get_g(), elem.get_b())}; + return ( + + ) + } + }) + } + + +
+
+ ) + }) : null + } +
*/} +
+ + ) +}; + +const PresentationSettings = inject("storePresentationSettings")(observer(PagePresentationSettings)); +const PresentationColorSchemes = inject("storePresentationSettings")(observer(PagePresentationColorSchemes)); + +export { PresentationSettings, PresentationColorSchemes } \ No newline at end of file diff --git a/apps/presentationeditor/mobile/src/view/settings/Settings.jsx b/apps/presentationeditor/mobile/src/view/settings/Settings.jsx index fb1e66dbf..edda8fc9e 100644 --- a/apps/presentationeditor/mobile/src/view/settings/Settings.jsx +++ b/apps/presentationeditor/mobile/src/view/settings/Settings.jsx @@ -5,6 +5,8 @@ import {f7} from 'framework7-react'; import {Device} from '../../../../../common/mobile/utils/device'; import ApplicationSettingsController from "../../controller/settings/ApplicationSettings"; import { MacrosSettings } from "./ApplicationSettings"; +import PresentationSettingsController from "../../controller/settings/PresentationSettings"; +import { PresentationColorSchemes } from "./PresentationSettings"; const routes = [ { @@ -18,6 +20,14 @@ const routes = [ { path: '/macros-settings/', component: MacrosSettings + }, + { + path: '/presentation-settings/', + component: PresentationSettingsController + }, + { + path: '/color-schemes/', + component: PresentationColorSchemes } /*{ path: '/presentation-settings/', From ea7c1dbd4572293d839b5719e4e0b2f622ed92d0 Mon Sep 17 00:00:00 2001 From: SergeyEzhin Date: Fri, 11 Dec 2020 23:14:14 +0300 Subject: [PATCH 2/4] [PE mobile] Maked Presentation Settings --- .../mobile/src/controller/Main.jsx | 7 +- .../settings/PresentationSettings.jsx | 21 +++++- .../mobile/src/less/app-ios.less | 24 +++++++ .../mobile/src/less/app-material.less | 24 +++++++ .../mobile/src/store/presentationSettings.js | 38 ++++------ .../view/settings/PresentationSettings.jsx | 70 ++++++++----------- 6 files changed, 115 insertions(+), 69 deletions(-) diff --git a/apps/presentationeditor/mobile/src/controller/Main.jsx b/apps/presentationeditor/mobile/src/controller/Main.jsx index 678c493bd..af08919e5 100644 --- a/apps/presentationeditor/mobile/src/controller/Main.jsx +++ b/apps/presentationeditor/mobile/src/controller/Main.jsx @@ -161,7 +161,7 @@ class MainController extends Component { bindEvents() { const me = this; - + // me.api.asc_registerCallback('asc_onError', _.bind(me.onError, me)); me.api.asc_registerCallback('asc_onDocumentContentReady', me._onDocumentContentReady.bind(me)); me.api.asc_registerCallback('asc_onOpenDocumentProgress', me._onOpenDocumentProgress.bind(me)); @@ -169,10 +169,13 @@ class MainController extends Component { const storePresentationSettings = this.props.storePresentationSettings; me.api.asc_registerCallback('asc_onPresentationSize', (width, height) => { - // const api = Common.EditorApi.get(); storePresentationSettings.changeSlideSize(width, height); }); + me.api.asc_registerCallback('asc_onSendThemeColorSchemes', (arr) => { + storePresentationSettings.addSchemes(arr); + }); + // api.asc_registerCallback('asc_onSendThemeColorSchemes', _.bind(this.onSendThemeColorSchemes, this)); // me.api.asc_registerCallback('asc_onDocumentUpdateVersion', _.bind(me.onUpdateVersion, me)); // me.api.asc_registerCallback('asc_onServerVersion', _.bind(me.onServerVersion, me)); diff --git a/apps/presentationeditor/mobile/src/controller/settings/PresentationSettings.jsx b/apps/presentationeditor/mobile/src/controller/settings/PresentationSettings.jsx index 86d6ee3a0..de1a0dd7d 100644 --- a/apps/presentationeditor/mobile/src/controller/settings/PresentationSettings.jsx +++ b/apps/presentationeditor/mobile/src/controller/settings/PresentationSettings.jsx @@ -4,18 +4,33 @@ import {PresentationSettings} from '../../view/settings/PresentationSettings'; class PresentationSettingsController extends Component { constructor(props) { super(props); - // this.onSlideSize = this.onSlideSize.bind(this); } - onSlideSize(value, slideSizeArr) { + onSlideSize(slideSizeArr) { const api = Common.EditorApi.get(); - api.changeSlideSize(slideSizeArr[value][0], slideSizeArr[value][1]); + // api.changeSlideSize(slideSizeArr[value][0], slideSizeArr[value][1]); + api.changeSlideSize(slideSizeArr[0], slideSizeArr[1]); } + // Color Schemes + + initPageColorSchemes() { + const api = Common.EditorApi.get(); + return api.asc_GetCurrentColorSchemeIndex(); + } + + onColorSchemeChange(newScheme) { + const api = Common.EditorApi.get(); + api.asc_ChangeColorSchemeByIdx(+newScheme); + } + + render() { return ( ) } diff --git a/apps/presentationeditor/mobile/src/less/app-ios.less b/apps/presentationeditor/mobile/src/less/app-ios.less index a1575794a..55a23a31e 100644 --- a/apps/presentationeditor/mobile/src/less/app-ios.less +++ b/apps/presentationeditor/mobile/src/less/app-ios.less @@ -3,3 +3,27 @@ } + +// Color Schemes + +.color-schemes-menu { + cursor: pointer; + display: block; + background-color: #fff; + .item-inner { + justify-content: flex-start; + } + .color-schema-block { + display: flex; + } + .color { + min-width: 26px; + min-height: 26px; + margin: 0 2px 0 0; + box-shadow: 0 0 0 1px rgba(0,0,0,.15) inset; + } + .item-title { + margin-left: 20px; + color: #212121; + } +} diff --git a/apps/presentationeditor/mobile/src/less/app-material.less b/apps/presentationeditor/mobile/src/less/app-material.less index 879f3a67c..3a7fb97e7 100644 --- a/apps/presentationeditor/mobile/src/less/app-material.less +++ b/apps/presentationeditor/mobile/src/less/app-material.less @@ -21,4 +21,28 @@ align-items: center; width: auto; } +} + +// Color Schemes + +.color-schemes-menu { + cursor: pointer; + display: block; + background-color: #fff; + .item-inner { + justify-content: flex-start; + } + .color-schema-block { + display: flex; + } + .color { + min-width: 26px; + min-height: 26px; + margin: 0 2px 0 0; + box-shadow: 0 0 0 1px rgba(0,0,0,.15) inset; + } + .item-title { + margin-left: 20px; + color: #212121; + } } \ No newline at end of file diff --git a/apps/presentationeditor/mobile/src/store/presentationSettings.js b/apps/presentationeditor/mobile/src/store/presentationSettings.js index e582d1693..ce06a4582 100644 --- a/apps/presentationeditor/mobile/src/store/presentationSettings.js +++ b/apps/presentationeditor/mobile/src/store/presentationSettings.js @@ -1,38 +1,28 @@ -import {action, observable, computed} from 'mobx'; +import {action, observable} from 'mobx'; export class storePresentationSettings { - @observable widthSlide; - @observable heightSlide; - @observable slideSize = 0; + @observable slideSize = []; + @observable slideSizeValue; - @action changeSlideSize(width, height) { - this.widthSlide = width; - this.heightSlide = height; + get getSlideSizes() { + return [[254, 190.5], [254, 143]]; } - getSlideSizes() { - const slideSizeArr = [[254, 190.5], [254, 143]]; - return slideSizeArr; + @action changeSlideSize(width, height) { + this.slideSize[0] = width; + this.slideSize[1] = height; } @action changeSlideFormat(value) { - this.slideSize = value; + this.slideSizeValue = +value; } - @computed get pageSizesIndex() { - const slideSizes = this.getSlideSizes(); - let ind = -1; + // Color Schemes - slideSizes.forEach((size, index) => { - if(Math.abs(size[0] - this.widthSlide) < 0.001 && Math.abs(size[1] - this.heightSlide) < 0.001) { - ind = index; - } - }); + @observable allSchemes; - if (ind === -1) { - ind = -1; - } - - return ind; + @action addSchemes(arr) { + this.allSchemes = arr; } + } \ No newline at end of file diff --git a/apps/presentationeditor/mobile/src/view/settings/PresentationSettings.jsx b/apps/presentationeditor/mobile/src/view/settings/PresentationSettings.jsx index 6b47b1112..a635eaaea 100644 --- a/apps/presentationeditor/mobile/src/view/settings/PresentationSettings.jsx +++ b/apps/presentationeditor/mobile/src/view/settings/PresentationSettings.jsx @@ -1,50 +1,40 @@ -import React, {Fragment} from "react"; +import React, {useState} from "react"; import { observer, inject } from "mobx-react"; -import { Page, Navbar, List, ListItem, BlockTitle, Toggle } from "framework7-react"; +import { Page, Navbar, List, ListItem, BlockTitle } from "framework7-react"; import { useTranslation } from "react-i18next"; const PagePresentationSettings = props => { const { t } = useTranslation(); const _t = t("View.Settings", { returnObjects: true }); const store = props.storePresentationSettings; - const slideSizeArr = store.getSlideSizes(); - console.log(slideSizeArr); - const widthSlide = store.widthSlide; - const heightSlide = store.heightSlide; + const slideSizeArr = store.getSlideSizes; const slideSize = store.slideSize; - console.log(widthSlide, heightSlide); + const slideSizeValue = store.slideSizeValue; + console.log(slideSize); return ( - {slideSizeArr.length ? ( - - {_t.textSlideSize} - - {/* {slideSizeArr.map((size, index) => { - if(Math.abs(size[0] - widthSlide) < 0.001 && Math.abs(size[1] - heightSlide) < 0.001) { - console.log(true); - return ( - - ) - } - })} */} - { - props.onSlideSize(0, slideSizeArr); - store.changeSlideFormat(0); - }} title={_t.mniSlideStandard}> - { - props.onSlideSize(1, slideSizeArr); - store.changeSlideFormat(1); - }} title={_t.mniSlideWide}> - - - ): null} - + + {_t.textSlideSize} + + { + props.onSlideSize(slideSizeArr[e.target.value]); + store.changeSlideFormat(e.target.value); + }} title={_t.mniSlideStandard}> + { + props.onSlideSize(slideSizeArr[e.target.value]); + store.changeSlideFormat(e.target.value); + }} title={_t.mniSlideWide}> + + - + ) @@ -52,16 +42,16 @@ const PagePresentationSettings = props => { const PagePresentationColorSchemes = props => { const { t } = useTranslation(); - // const curScheme = props.initPageColorSchemes(); - // const [stateScheme, setScheme] = useState(curScheme); + const curScheme = props.initPageColorSchemes(); + const [stateScheme, setScheme] = useState(curScheme); const _t = t('View.Settings', {returnObjects: true}); - // const storeSettings = props.storeDocumentSettings; - // const allSchemes = storeSettings.allSchemes; + const store = props.storePresentationSettings; + const allSchemes = store.allSchemes; return ( - {/* + { allSchemes ? allSchemes.map((scheme, index) => { return ( @@ -91,7 +81,7 @@ const PagePresentationColorSchemes = props => { ) }) : null } - */} + ) From 44532dc8bd8b4293c4e74acbce3dc83326f8b06f Mon Sep 17 00:00:00 2001 From: SergeyEzhin Date: Thu, 17 Dec 2020 00:50:03 +0300 Subject: [PATCH 3/4] [PE mobile] Edited Presentation Settings and added Print --- .../mobile/src/controller/Main.jsx | 7 ++++++- .../settings/PresentationSettings.jsx | 3 +-- .../mobile/src/store/presentationSettings.js | 13 ++++-------- .../view/settings/PresentationSettings.jsx | 20 ++++++------------- .../mobile/src/view/settings/Settings.jsx | 17 +++++++++++++++- 5 files changed, 33 insertions(+), 27 deletions(-) diff --git a/apps/presentationeditor/mobile/src/controller/Main.jsx b/apps/presentationeditor/mobile/src/controller/Main.jsx index af08919e5..d846d0345 100644 --- a/apps/presentationeditor/mobile/src/controller/Main.jsx +++ b/apps/presentationeditor/mobile/src/controller/Main.jsx @@ -169,7 +169,12 @@ class MainController extends Component { const storePresentationSettings = this.props.storePresentationSettings; me.api.asc_registerCallback('asc_onPresentationSize', (width, height) => { - storePresentationSettings.changeSlideSize(width, height); + const slideSizeArr = storePresentationSettings.getSlideSizes; + slideSizeArr.forEach((array, index) => { + if(Math.abs(array[0] - width) < 0.001 && Math.abs((array[1] - height)) < 0.001) { + storePresentationSettings.changeSizeIndex(index); + } + }) }); me.api.asc_registerCallback('asc_onSendThemeColorSchemes', (arr) => { diff --git a/apps/presentationeditor/mobile/src/controller/settings/PresentationSettings.jsx b/apps/presentationeditor/mobile/src/controller/settings/PresentationSettings.jsx index de1a0dd7d..f12ca84d4 100644 --- a/apps/presentationeditor/mobile/src/controller/settings/PresentationSettings.jsx +++ b/apps/presentationeditor/mobile/src/controller/settings/PresentationSettings.jsx @@ -8,7 +8,6 @@ class PresentationSettingsController extends Component { onSlideSize(slideSizeArr) { const api = Common.EditorApi.get(); - // api.changeSlideSize(slideSizeArr[value][0], slideSizeArr[value][1]); api.changeSlideSize(slideSizeArr[0], slideSizeArr[1]); } @@ -21,7 +20,7 @@ class PresentationSettingsController extends Component { onColorSchemeChange(newScheme) { const api = Common.EditorApi.get(); - api.asc_ChangeColorSchemeByIdx(+newScheme); + api.asc_ChangeColorSchemeByIdx(newScheme); } diff --git a/apps/presentationeditor/mobile/src/store/presentationSettings.js b/apps/presentationeditor/mobile/src/store/presentationSettings.js index ce06a4582..c4754813f 100644 --- a/apps/presentationeditor/mobile/src/store/presentationSettings.js +++ b/apps/presentationeditor/mobile/src/store/presentationSettings.js @@ -1,20 +1,15 @@ import {action, observable} from 'mobx'; export class storePresentationSettings { - @observable slideSize = []; - @observable slideSizeValue; + + @observable slideSizeIndex; get getSlideSizes() { return [[254, 190.5], [254, 143]]; } - @action changeSlideSize(width, height) { - this.slideSize[0] = width; - this.slideSize[1] = height; - } - - @action changeSlideFormat(value) { - this.slideSizeValue = +value; + @action changeSizeIndex(value) { + this.slideSizeIndex = +value; } // Color Schemes diff --git a/apps/presentationeditor/mobile/src/view/settings/PresentationSettings.jsx b/apps/presentationeditor/mobile/src/view/settings/PresentationSettings.jsx index a635eaaea..08029d0a9 100644 --- a/apps/presentationeditor/mobile/src/view/settings/PresentationSettings.jsx +++ b/apps/presentationeditor/mobile/src/view/settings/PresentationSettings.jsx @@ -8,26 +8,18 @@ const PagePresentationSettings = props => { const _t = t("View.Settings", { returnObjects: true }); const store = props.storePresentationSettings; const slideSizeArr = store.getSlideSizes; - const slideSize = store.slideSize; - const slideSizeValue = store.slideSizeValue; - console.log(slideSize); - + const slideSizeIndex = store.slideSizeIndex; + return ( {_t.textSlideSize} - { - props.onSlideSize(slideSizeArr[e.target.value]); - store.changeSlideFormat(e.target.value); - }} title={_t.mniSlideStandard}> - { - props.onSlideSize(slideSizeArr[e.target.value]); - store.changeSlideFormat(e.target.value); - }} title={_t.mniSlideWide}> + props.onSlideSize(slideSizeArr[0])} title={_t.mniSlideStandard}> + props.onSlideSize(slideSizeArr[1])} title={_t.mniSlideWide}> diff --git a/apps/presentationeditor/mobile/src/view/settings/Settings.jsx b/apps/presentationeditor/mobile/src/view/settings/Settings.jsx index edda8fc9e..81fd433bf 100644 --- a/apps/presentationeditor/mobile/src/view/settings/Settings.jsx +++ b/apps/presentationeditor/mobile/src/view/settings/Settings.jsx @@ -52,6 +52,21 @@ const SettingsList = withTranslation()(props => { props.onOptionClick(page) }; + const closeModal = () => { + if (Device.phone) { + f7.sheet.close('.settings-popup', true); + } else { + f7.popover.close('#settings-popover'); + } + } + + const onPrint = () => { + closeModal(); + const api = Common.EditorApi.get(); + api.asc_Print(); + } + + return ( @@ -71,7 +86,7 @@ const SettingsList = withTranslation()(props => { - + From 55f08657499cd577e2f9ed000fb8552ead8f9d91 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Thu, 17 Dec 2020 22:52:25 +0300 Subject: [PATCH 4/4] [PE mobile] Fixed slide size settings into presentation settings --- .../mobile/src/controller/Main.jsx | 7 +------ .../controller/settings/PresentationSettings.jsx | 15 +++++++++++++-- .../mobile/src/store/presentationSettings.js | 12 ++++++++---- .../src/view/settings/PresentationSettings.jsx | 1 + 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/apps/presentationeditor/mobile/src/controller/Main.jsx b/apps/presentationeditor/mobile/src/controller/Main.jsx index d846d0345..9dc26fcf9 100644 --- a/apps/presentationeditor/mobile/src/controller/Main.jsx +++ b/apps/presentationeditor/mobile/src/controller/Main.jsx @@ -169,12 +169,7 @@ class MainController extends Component { const storePresentationSettings = this.props.storePresentationSettings; me.api.asc_registerCallback('asc_onPresentationSize', (width, height) => { - const slideSizeArr = storePresentationSettings.getSlideSizes; - slideSizeArr.forEach((array, index) => { - if(Math.abs(array[0] - width) < 0.001 && Math.abs((array[1] - height)) < 0.001) { - storePresentationSettings.changeSizeIndex(index); - } - }) + storePresentationSettings.changeSizeIndex(width, height); }); me.api.asc_registerCallback('asc_onSendThemeColorSchemes', (arr) => { diff --git a/apps/presentationeditor/mobile/src/controller/settings/PresentationSettings.jsx b/apps/presentationeditor/mobile/src/controller/settings/PresentationSettings.jsx index f12ca84d4..144d4a66e 100644 --- a/apps/presentationeditor/mobile/src/controller/settings/PresentationSettings.jsx +++ b/apps/presentationeditor/mobile/src/controller/settings/PresentationSettings.jsx @@ -1,9 +1,19 @@ import React, {Component} from 'React'; +import { observer, inject } from "mobx-react"; import {PresentationSettings} from '../../view/settings/PresentationSettings'; class PresentationSettingsController extends Component { constructor(props) { super(props); + this.initSlideSize = this.initSlideSize.bind(this); + } + + initSlideSize() { + if (!this.init) { + const api = Common.EditorApi.get(); + this.props.storePresentationSettings.changeSizeIndex(api.get_PresentationWidth(), api.get_PresentationHeight()); + this.init = true; + } } onSlideSize(slideSizeArr) { @@ -26,7 +36,8 @@ class PresentationSettingsController extends Component { render() { return ( - { + if(Math.abs(array[0] - width) < 0.001 && Math.abs((array[1] - height)) < 0.001) { + this.slideSizeIndex = index; + } + }) } // Color Schemes diff --git a/apps/presentationeditor/mobile/src/view/settings/PresentationSettings.jsx b/apps/presentationeditor/mobile/src/view/settings/PresentationSettings.jsx index 08029d0a9..e6da2e822 100644 --- a/apps/presentationeditor/mobile/src/view/settings/PresentationSettings.jsx +++ b/apps/presentationeditor/mobile/src/view/settings/PresentationSettings.jsx @@ -6,6 +6,7 @@ import { useTranslation } from "react-i18next"; const PagePresentationSettings = props => { const { t } = useTranslation(); const _t = t("View.Settings", { returnObjects: true }); + props.initSlideSize(); const store = props.storePresentationSettings; const slideSizeArr = store.getSlideSizes; const slideSizeIndex = store.slideSizeIndex;