1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-29 22:48:10 +02:00

Desktop: Load themes as CSS variables for use in custom themes and internal components

This commit is contained in:
Laurent Cozic
2021-09-06 16:57:07 +01:00
parent b8c941d2da
commit 478d4accf1
19 changed files with 441 additions and 58 deletions

View File

@@ -641,7 +641,7 @@ async function initialize(dispatch: Function) {
class AppComponent extends React.Component {
constructor() {
public constructor() {
super();
this.state = {
@@ -684,7 +684,7 @@ class AppComponent extends React.Component {
// https://github.com/laurent22/joplin/issues/3807
// https://discourse.joplinapp.org/t/webdav-config-encryption-config-randomly-lost-on-android/11364
// https://discourse.joplinapp.org/t/android-keeps-on-resetting-my-sync-and-theme/11443
async componentDidMount() {
public async componentDidMount() {
if (this.props.appState == 'starting') {
this.props.dispatch({
type: 'APP_STATE_SET',
@@ -737,13 +737,13 @@ class AppComponent extends React.Component {
// setTimeout(() => NavService.go('EncryptionConfig'), 2000);
}
componentWillUnmount() {
public componentWillUnmount() {
AppState.removeEventListener('change', this.onAppStateChange_);
Linking.removeEventListener('url', this.handleOpenURL_);
if (this.unsubscribeNetInfoHandler_) this.unsubscribeNetInfoHandler_();
}
componentDidUpdate(prevProps: any) {
public componentDidUpdate(prevProps: any) {
if (this.props.showSideMenu !== prevProps.showSideMenu) {
Animated.timing(this.state.sideMenuContentOpacity, {
toValue: this.props.showSideMenu ? 0.5 : 0,
@@ -752,7 +752,7 @@ class AppComponent extends React.Component {
}
}
async backButtonHandler() {
private async backButtonHandler() {
if (this.props.noteSelectionEnabled) {
this.props.dispatch({ type: 'NOTE_SELECTION_END' });
return true;
@@ -773,7 +773,7 @@ class AppComponent extends React.Component {
return false;
}
async handleShareData() {
private async handleShareData() {
const sharedData = await ShareExtension.data();
if (sharedData) {
reg.logger().info('Received shared data');
@@ -785,14 +785,14 @@ class AppComponent extends React.Component {
}
}
UNSAFE_componentWillReceiveProps(newProps: any) {
public UNSAFE_componentWillReceiveProps(newProps: any) {
if (newProps.syncStarted != this.lastSyncStarted_) {
if (!newProps.syncStarted) FoldersScreenUtils.refreshFolders();
this.lastSyncStarted_ = newProps.syncStarted;
}
}
sideMenu_change(isOpen: boolean) {
private sideMenu_change(isOpen: boolean) {
// Make sure showSideMenu property of state is updated
// when the menu is open/closed.
this.props.dispatch({
@@ -800,7 +800,7 @@ class AppComponent extends React.Component {
});
}
render() {
public render() {
if (this.props.appState != 'ready') return null;
const theme = themeStyle(this.props.themeId);