diff --git a/apps/documenteditor/mobile/src/controller/settings/ApplicationSettings.jsx b/apps/documenteditor/mobile/src/controller/settings/ApplicationSettings.jsx index 44b6b3724..2d71e7d27 100644 --- a/apps/documenteditor/mobile/src/controller/settings/ApplicationSettings.jsx +++ b/apps/documenteditor/mobile/src/controller/settings/ApplicationSettings.jsx @@ -18,8 +18,6 @@ class ApplicationSettingsController extends Component { const api = Common.EditorApi.get(); // let state = value === '1' ? true : false; // Common.localStorage.setItem("de-mobile-spellcheck", value ? 1 : 0); - // Common.Utils.InternalSettings.set("de-mobile-spellcheck", value); - Common.Utils.InternalSettings.set("de-mobile-spellcheck", value); api.asc_setSpellCheck(value); } @@ -57,6 +55,11 @@ class ApplicationSettingsController extends Component { // Common.localStorage.setBool("de-settings-resolvedcomment", value); } + setMacrosSettings(value) { + Common.Utils.InternalSettings.set("de-mobile-macros-mode", +value); + // Common.localStorage.setItem("de-mobile-macros-mode", +value); + } + render() { return ( ) } diff --git a/apps/documenteditor/mobile/src/store/applicationSettings.js b/apps/documenteditor/mobile/src/store/applicationSettings.js index 988e4eb91..fa3256570 100644 --- a/apps/documenteditor/mobile/src/store/applicationSettings.js +++ b/apps/documenteditor/mobile/src/store/applicationSettings.js @@ -13,10 +13,13 @@ export class storeApplicationSettings { @observable isComments = true; @observable isResolvedComments = true; - @action changeUnitMeasurement(value) { - value = (value !== null) ? parseInt(value) : Common.Utils.Metric.getDefaultMetric(); - console.log(value); + @observable isDisabledAllMacros = false; + @observable isShowNotification = true; + @observable isEnabledAllMacros = false; + @action changeUnitMeasurement(value) { + value = (value !== null) ? +value : Common.Utils.Metric.getDefaultMetric(); + if(value === Common.Utils.Metric.c_MetricUnits.inch) { this.isActiveUnitCentimeter = false; this.isActiveUnitPoint = false; @@ -36,27 +39,40 @@ export class storeApplicationSettings { @action changeSpellCheck(value) { this.isSpellChecking = value; - console.log(this.isSpellChecking); } @action changeNoCharacters(value) { this.isNonprintingCharacters = value; - console.log(this.isNonprintingCharacters); } @action changeShowTableEmptyLine(value) { this.isHiddenTableBorders = value; - console.log(this.isHiddenTableBorders); } @action changeDisplayComments(value) { this.isComments = value; if (!value) this.changeDisplayResolved(value); - console.log(this.isComments); } @action changeDisplayResolved(value) { this.isResolvedComments = value; - console.log(this.isResolvedComments); + } + + @action changeMacrosSettings(value) { + if(+value === 2) { + this.isDisabledAllMacros = true; + this.isShowNotification = false; + this.isEnabledAllMacros = false; + } + else if(+value === 1) { + this.isDisabledAllMacros = false; + this.isShowNotification = false; + this.isEnabledAllMacros = true; + } + else { + this.isDisabledAllMacros = false; + this.isShowNotification = true; + this.isEnabledAllMacros = false; + } } } \ No newline at end of file diff --git a/apps/documenteditor/mobile/src/view/settings/ApplicationSettings.jsx b/apps/documenteditor/mobile/src/view/settings/ApplicationSettings.jsx index ae5d2b1aa..7991e07fc 100644 --- a/apps/documenteditor/mobile/src/view/settings/ApplicationSettings.jsx +++ b/apps/documenteditor/mobile/src/view/settings/ApplicationSettings.jsx @@ -1,9 +1,9 @@ -import React, {Fragment} from "react"; +import React from "react"; import { observer, inject } from "mobx-react"; import { Page, Navbar, List, ListItem, BlockTitle, Toggle } from "framework7-react"; import { useTranslation } from "react-i18next"; -const PageApplicationSettings = (props) => { +const PageApplicationSettings = props => { const { t } = useTranslation(); const _t = t("Settings", { returnObjects: true }); const store = props.storeApplicationSettings; @@ -16,19 +16,22 @@ const PageApplicationSettings = (props) => { const isComments = store.isComments; const isResolvedComments = store.isResolvedComments; - const changeMeasure = (e) => { - store.changeUnitMeasurement(e.target.value); - props.setUnitMeasurement(e.target.value); - } + const changeMeasureSettings = value => { + store.changeUnitMeasurement(value); + props.setUnitMeasurement(value); + }; return ( {_t.textUnitOfMeasurement} - - - + changeMeasureSettings(e.target.value)}> + changeMeasureSettings(e.target.value)}> + changeMeasureSettings(e.target.value)}> @@ -69,7 +72,7 @@ const PageApplicationSettings = (props) => { onChange={() => { store.changeDisplayComments(!isComments); props.switchDisplayComments(!isComments); - }} + }} /> @@ -83,27 +86,41 @@ const PageApplicationSettings = (props) => { - + ); }; -const PageMacrosSettings = () => { +const PageMacrosSettings = props => { const { t } = useTranslation(); const _t = t("Settings", { returnObjects: true }); + const store = props.storeApplicationSettings; + const isDisabledAllMacros = store.isDisabledAllMacros; + const isShowNotification = store.isShowNotification; + const isEnabledAllMacros = store.isEnabledAllMacros; + + const changeMacros = value => { + store.changeMacrosSettings(value); + props.setMacrosSettings(value); + }; return ( - - - + changeMacros(e.target.value)}> + changeMacros(e.target.value)}> + changeMacros(e.target.value)}> - ) -} + ); +}; const ApplicationSettings = inject("storeApplicationSettings")(observer(PageApplicationSettings)); const MacrosSettings = inject("storeApplicationSettings")(observer(PageMacrosSettings)); diff --git a/apps/documenteditor/mobile/src/view/settings/Settings.jsx b/apps/documenteditor/mobile/src/view/settings/Settings.jsx index 6ff5b5cde..1ece64a98 100644 --- a/apps/documenteditor/mobile/src/view/settings/Settings.jsx +++ b/apps/documenteditor/mobile/src/view/settings/Settings.jsx @@ -32,7 +32,7 @@ const routes = [ component: DocumentInfoController, }, { - path: '/application-settings', + path: '/application-settings/', component: ApplicationSettingsController }, {