[DE mobile] Refactoring Application Settings and continue block Download
This commit is contained in:
parent
d1a412d6a0
commit
258426f8af
|
@ -56,7 +56,7 @@ class ApplicationSettingsController extends Component {
|
|||
}
|
||||
|
||||
setMacrosSettings(value) {
|
||||
Common.Utils.InternalSettings.set("de-mobile-macros-mode", +value);
|
||||
// Common.Utils.InternalSettings.set("de-mobile-macros-mode", +value);
|
||||
// Common.localStorage.setItem("de-mobile-macros-mode", +value);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,51 @@
|
|||
import React, { Component } from "react";
|
||||
import Download from "../../view/settings/Download";
|
||||
import { Device } from '../../../../../common/mobile/utils/device';
|
||||
import { f7 } from 'framework7-react';
|
||||
// import { observer } from "mobx-react";
|
||||
// import { withTranslation } from 'react-i18next';
|
||||
|
||||
class DownloadController extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.onSaveFormat = this.onSaveFormat.bind(this);
|
||||
}
|
||||
|
||||
closeModal() {
|
||||
if (Device.phone) {
|
||||
f7.sheet.close('#edit-sheet', true);
|
||||
} else {
|
||||
f7.popover.close('#edit-popover');
|
||||
}
|
||||
}
|
||||
|
||||
onSaveFormat(format) {
|
||||
// const api = Common.EditorApi.get();
|
||||
console.log(format);
|
||||
if(format) {
|
||||
// if (format == Asc.c_oAscFileType.TXT || format == Asc.c_oAscFileType.RTF) {
|
||||
// // const { t } = this.props;
|
||||
// // f7.dialog.alert(t('Edit.textNotUrl'), t('Edit.notcriticalErrorTitle'));
|
||||
// if (format == Asc.c_oAscFileType.TXT) {
|
||||
// // Common.NotificationCenter.trigger('download:advanced', Asc.c_oAscAdvancedOptionsID.TXT, api.asc_getAdvancedOptions(), 2, new Asc.asc_CDownloadOptions(format));
|
||||
|
||||
// asc_CDownloadOptions(format);
|
||||
// }
|
||||
// else {
|
||||
// api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format));
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format));
|
||||
// }
|
||||
|
||||
this.closeModal();
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Download />
|
||||
<Download onSaveFormat={this.onSaveFormat} />
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import {action, observable} from 'mobx';
|
||||
|
||||
export class storeApplicationSettings {
|
||||
@observable isActiveUnitCentimeter = false;
|
||||
@observable isActiveUnitPoint = true;
|
||||
@observable isActiveUnitInch = false;
|
||||
|
||||
@observable unitMeasurement = 1;
|
||||
|
||||
@observable isSpellChecking = true;
|
||||
|
||||
|
@ -13,28 +12,10 @@ export class storeApplicationSettings {
|
|||
@observable isComments = true;
|
||||
@observable isResolvedComments = true;
|
||||
|
||||
@observable isDisabledAllMacros = false;
|
||||
@observable isShowNotification = true;
|
||||
@observable isEnabledAllMacros = false;
|
||||
@observable macrosMode = 0;
|
||||
|
||||
@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;
|
||||
this.isActiveUnitInch = true;
|
||||
}
|
||||
else if(value === Common.Utils.Metric.c_MetricUnits.pt) {
|
||||
this.isActiveUnitCentimeter = false;
|
||||
this.isActiveUnitPoint = true;
|
||||
this.isActiveUnitInch = false;
|
||||
}
|
||||
else {
|
||||
this.isActiveUnitCentimeter = true;
|
||||
this.isActiveUnitPoint = false;
|
||||
this.isActiveUnitInch = false;
|
||||
}
|
||||
this.unitMeasurement = +value;
|
||||
}
|
||||
|
||||
@action changeSpellCheck(value) {
|
||||
|
@ -59,20 +40,6 @@ export class storeApplicationSettings {
|
|||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
this.macrosMode = +value;
|
||||
}
|
||||
}
|
|
@ -7,9 +7,7 @@ const PageApplicationSettings = props => {
|
|||
const { t } = useTranslation();
|
||||
const _t = t("Settings", { returnObjects: true });
|
||||
const store = props.storeApplicationSettings;
|
||||
const isActiveUnitCentimeter = store.isActiveUnitCentimeter;
|
||||
const isActiveUnitPoint = store.isActiveUnitPoint;
|
||||
const isActiveUnitInch = store.isActiveUnitInch;
|
||||
const unitMeasurement = store.unitMeasurement;
|
||||
const isSpellChecking = store.isSpellChecking;
|
||||
const isNonprintingCharacters = store.isNonprintingCharacters;
|
||||
const isHiddenTableBorders = store.isHiddenTableBorders;
|
||||
|
@ -26,11 +24,11 @@ const PageApplicationSettings = props => {
|
|||
<Navbar title={_t.textApplicationSettings} backLink={_t.textBack} />
|
||||
<BlockTitle>{_t.textUnitOfMeasurement}</BlockTitle>
|
||||
<List>
|
||||
<ListItem radio radioIcon="end" title={_t.textCentimeter} value="0" name="unit-of-measurement" checked={isActiveUnitCentimeter}
|
||||
<ListItem radio radioIcon="end" title={_t.textCentimeter} value="0" name="unit-of-measurement" checked={unitMeasurement === 0}
|
||||
onChange={e => changeMeasureSettings(e.target.value)}></ListItem>
|
||||
<ListItem radio radioIcon="end" title={_t.textPoint} value="1" name="unit-of-measurement" checked={isActiveUnitPoint}
|
||||
<ListItem radio radioIcon="end" title={_t.textPoint} value="1" name="unit-of-measurement" checked={unitMeasurement === 1}
|
||||
onChange={e => changeMeasureSettings(e.target.value)}></ListItem>
|
||||
<ListItem radio radioIcon="end" title={_t.textInch} value="2" name="unit-of-measurement" checked={isActiveUnitInch}
|
||||
<ListItem radio radioIcon="end" title={_t.textInch} value="2" name="unit-of-measurement" checked={unitMeasurement === 2}
|
||||
onChange={e => changeMeasureSettings(e.target.value)}></ListItem>
|
||||
</List>
|
||||
<List>
|
||||
|
@ -98,13 +96,11 @@ 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 macrosMode = store.macrosMode;
|
||||
|
||||
const changeMacros = value => {
|
||||
store.changeMacrosSettings(value);
|
||||
props.setMacrosSettings(value);
|
||||
// props.setMacrosSettings(value);
|
||||
};
|
||||
|
||||
return (
|
||||
|
@ -112,11 +108,11 @@ const PageMacrosSettings = props => {
|
|||
<Navbar title={_t.textMacrosSettings} backLink={_t.textBack} />
|
||||
<List mediaList>
|
||||
<ListItem radio name="macros-settings" value="2" title={_t.textDisableAll} text={_t.textDisableAllMacrosWithoutNotification}
|
||||
checked={isDisabledAllMacros} onChange={e => changeMacros(e.target.value)}></ListItem>
|
||||
checked={macrosMode === 2} onChange={e => changeMacros(e.target.value)}></ListItem>
|
||||
<ListItem radio name="macros-settings" value="0" title={_t.textShowNotification} text={_t.textDisableAllMacrosWithNotification}
|
||||
checked={isShowNotification} onChange={e => changeMacros(e.target.value)}></ListItem>
|
||||
checked={macrosMode === 0} onChange={e => changeMacros(e.target.value)}></ListItem>
|
||||
<ListItem radio name="macros-settings" value="1" title={_t.textEnableAll} text={_t.textEnableAllMacrosWithoutNotification}
|
||||
checked={isEnabledAllMacros} onChange={e => changeMacros(e.target.value)}></ListItem>
|
||||
checked={macrosMode === 1} onChange={e => changeMacros(e.target.value)}></ListItem>
|
||||
</List>
|
||||
</Page>
|
||||
);
|
||||
|
|
|
@ -12,31 +12,31 @@ const PageDownload = props => {
|
|||
<Navbar title={_t.textDownload} backLink={_t.textBack} />
|
||||
<BlockTitle>{_t.textDownloadAs}</BlockTitle>
|
||||
<List>
|
||||
<ListItem title="DOCX">
|
||||
<ListItem title="DOCX" radio={true} value="65" data-format="65" onChange={e => props.onSaveFormat(e.target.value)}>
|
||||
<Icon slot="media" icon="icon-format-docx"></Icon>
|
||||
</ListItem>
|
||||
<ListItem title="PDF">
|
||||
<ListItem title="PDF" radio={true} value="513" data-format="513" onChange={e => props.onSaveFormat(e.target.value)}>
|
||||
<Icon slot="media" icon="icon-format-pdf"></Icon>
|
||||
</ListItem>
|
||||
<ListItem title="PDF/A">
|
||||
<ListItem title="PDF/A" radio={true} value="2305" data-format="2305" onChange={e => props.onSaveFormat(e.target.value)}>
|
||||
<Icon slot="media" icon="icon-format-pdfa"></Icon>
|
||||
</ListItem>
|
||||
<ListItem title="TXT">
|
||||
<ListItem title="TXT" radio={true} value="69" data-format="69" onChange={e => props.onSaveFormat(e.target.value)}>
|
||||
<Icon slot="media" icon="icon-format-txt"></Icon>
|
||||
</ListItem>
|
||||
<ListItem title="RTF">
|
||||
<ListItem title="RTF" radio={true} value="68" data-format="68" onChange={e => props.onSaveFormat(e.target.value)}>
|
||||
<Icon slot="media" icon="icon-format-rtf"></Icon>
|
||||
</ListItem>
|
||||
<ListItem title="ODT">
|
||||
<ListItem title="ODT" radio={true} value="67" data-format="67" onChange={e => props.onSaveFormat(e.target.value)}>
|
||||
<Icon slot="media" icon="icon-format-odt"></Icon>
|
||||
</ListItem>
|
||||
<ListItem title="HTML">
|
||||
<ListItem title="HTML" radio={true} value="2051" data-format="2051" onChange={e => props.onSaveFormat(e.target.value)}>
|
||||
<Icon slot="media" icon="icon-format-html"></Icon>
|
||||
</ListItem>
|
||||
<ListItem title="DOTX">
|
||||
<ListItem title="DOTX" radio={true} value="76" data-format="76" onChange={e => props.onSaveFormat(e.target.value)}>
|
||||
<Icon slot="media" icon="icon-format-dotx"></Icon>
|
||||
</ListItem>
|
||||
<ListItem title="OTT">
|
||||
<ListItem title="OTT" radio={true} value="79" data-format="79" onChange={e => props.onSaveFormat(e.target.value)}>
|
||||
<Icon slot="media" icon="icon-format-ott"></Icon>
|
||||
</ListItem>
|
||||
</List>
|
||||
|
|
Loading…
Reference in a new issue