diff --git a/src/lib/componentManager.js b/src/lib/componentManager.js index 3b88a51a..ced27d2b 100644 --- a/src/lib/componentManager.js +++ b/src/lib/componentManager.js @@ -131,7 +131,7 @@ export default class ComponentManager extends SNComponentManager { } if (editor) { - if (note.content.mobilePrefersPlainEditor == true) { + if (note.content.mobilePrefersPlainEditor === true) { note.content.mobilePrefersPlainEditor = false; note.setDirty(true); } diff --git a/src/style/StyleKit.js b/src/style/StyleKit.js index 4e1c165a..82f5d94f 100644 --- a/src/style/StyleKit.js +++ b/src/style/StyleKit.js @@ -49,12 +49,20 @@ export default class StyleKit { this.activeTheme.isSwapIn = false; } } + + const activeUuid = this.activeTheme.uuid; + for (const theme of deletedItems) { + if (activeUuid === theme.uuid) { + this.resetToSystemTheme(); + return; + } + } } ); this.signoutObserver = Auth.get().addEventHandler(event => { if (event === SFAuthManager.DidSignOutEvent) { - this.activateTheme(this.systemThemes[0]); + this.resetToSystemTheme(); } }); } @@ -92,10 +100,10 @@ export default class StyleKit { /** * If we're changing the theme for a specific mode and we're currently on - * that mode, then set this theme as active + * that mode, then activate this theme. */ if (this.currentDarkMode === mode && this.activeTheme.uuid !== theme.uuid) { - this.setActiveTheme(theme); + this.activateTheme(theme); } } @@ -149,6 +157,13 @@ export default class StyleKit { } } + /** + * @private + */ + resetToSystemTheme() { + this.activateTheme(this.systemThemes[0]); + } + async resolveInitialTheme() { const currentMode = this.currentDarkMode; const runDefaultTheme = () => { @@ -275,6 +290,7 @@ export default class StyleKit { activateTheme(theme) { const performActivation = () => { + this.setActiveTheme(theme); this.assignThemeForMode({ theme: theme, mode: this.currentDarkMode }); };