[mobile] added dark theme switch to DE
This commit is contained in:
parent
8bef7f6c15
commit
fbd70b7b7b
|
@ -24,6 +24,20 @@ class ApplicationSettingsController extends Component {
|
||||||
Common.EditorApi.get().asc_setSpellCheck(value);
|
Common.EditorApi.get().asc_setSpellCheck(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switchDarkTheme(value) {
|
||||||
|
const theme = value ? {id:'theme-dark', type:'dark'} : {id:'theme-light', type:'light'};
|
||||||
|
LocalStorage.setItem("ui-theme", JSON.stringify(theme));
|
||||||
|
|
||||||
|
const $body = $$('body');
|
||||||
|
$body.attr('class', $body.attr('class').replace(/\s?theme-type-(?:dark|light)/, ''));
|
||||||
|
$body.addClass(`theme-type-${theme.type}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
isThemeDark() {
|
||||||
|
const obj = LocalStorage.getItem("ui-theme");
|
||||||
|
return !!obj ? JSON.parse(obj).type === 'dark' : false;
|
||||||
|
}
|
||||||
|
|
||||||
switchNoCharacters(value) {
|
switchNoCharacters(value) {
|
||||||
LocalStorage.setBool("de-mobile-no-characters", value);
|
LocalStorage.setBool("de-mobile-no-characters", value);
|
||||||
Common.EditorApi.get().put_ShowParaMarks(value);
|
Common.EditorApi.get().put_ShowParaMarks(value);
|
||||||
|
@ -67,11 +81,13 @@ class ApplicationSettingsController extends Component {
|
||||||
<ApplicationSettings
|
<ApplicationSettings
|
||||||
setUnitMeasurement={this.setUnitMeasurement}
|
setUnitMeasurement={this.setUnitMeasurement}
|
||||||
switchSpellCheck={this.switchSpellCheck}
|
switchSpellCheck={this.switchSpellCheck}
|
||||||
|
switchDarkTheme={this.switchDarkTheme}
|
||||||
switchNoCharacters={this.switchNoCharacters}
|
switchNoCharacters={this.switchNoCharacters}
|
||||||
switchShowTableEmptyLine={this.switchShowTableEmptyLine}
|
switchShowTableEmptyLine={this.switchShowTableEmptyLine}
|
||||||
switchDisplayComments={this.switchDisplayComments}
|
switchDisplayComments={this.switchDisplayComments}
|
||||||
switchDisplayResolved={this.switchDisplayResolved}
|
switchDisplayResolved={this.switchDisplayResolved}
|
||||||
setMacrosSettings={this.setMacrosSettings}
|
setMacrosSettings={this.setMacrosSettings}
|
||||||
|
isThemeDark={this.isThemeDark}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import React, {Fragment} from "react";
|
import React, {Fragment, useState} from "react";
|
||||||
import { observer, inject } from "mobx-react";
|
import { observer, inject } from "mobx-react";
|
||||||
import { Page, Navbar, List, ListItem, BlockTitle, Toggle } from "framework7-react";
|
import { Page, Navbar, List, ListItem, BlockTitle, Toggle } from "framework7-react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
@ -14,6 +14,7 @@ const PageApplicationSettings = props => {
|
||||||
const isHiddenTableBorders = store.isHiddenTableBorders;
|
const isHiddenTableBorders = store.isHiddenTableBorders;
|
||||||
const isComments = store.isComments;
|
const isComments = store.isComments;
|
||||||
const isResolvedComments = store.isResolvedComments;
|
const isResolvedComments = store.isResolvedComments;
|
||||||
|
const [isThemeDark, setIsThemeDark] = useState(props.isThemeDark);
|
||||||
|
|
||||||
const changeMeasureSettings = value => {
|
const changeMeasureSettings = value => {
|
||||||
store.changeUnitMeasurement(value);
|
store.changeUnitMeasurement(value);
|
||||||
|
@ -48,6 +49,11 @@ const PageApplicationSettings = props => {
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
|
<ListItem title={'Dark theme'}>
|
||||||
|
<Toggle checked={isThemeDark}
|
||||||
|
onToggleChange={toggle => {props.switchDarkTheme(!toggle), setIsThemeDark(!toggle)}}>
|
||||||
|
</Toggle>
|
||||||
|
</ListItem>
|
||||||
</List>
|
</List>
|
||||||
<List>
|
<List>
|
||||||
<ListItem title={_t.textNoCharacters} disabled={displayMode !== 'markup'}>{/*ToDo: if (DisplayMode == "final" || DisplayMode == "original") {disabled} */}
|
<ListItem title={_t.textNoCharacters} disabled={displayMode !== 'markup'}>{/*ToDo: if (DisplayMode == "final" || DisplayMode == "original") {disabled} */}
|
||||||
|
|
Loading…
Reference in a new issue