From 44532dc8bd8b4293c4e74acbce3dc83326f8b06f Mon Sep 17 00:00:00 2001 From: SergeyEzhin Date: Thu, 17 Dec 2020 00:50:03 +0300 Subject: [PATCH] [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 => { - +