mirror of
https://github.com/fmhy/edit.git
synced 2026-01-12 15:01:06 +11:00
Fix for preset themes not saving (#4465)
* shitty (probably not working) fix for preset themes * tf * i saved theme data locally fuck * 99% chance this wont work * make default christmas
This commit is contained in:
parent
09e43b4954
commit
968a775e7b
2 changed files with 11 additions and 5 deletions
|
|
@ -21,6 +21,7 @@ import { themeRegistry } from './configs'
|
|||
const STORAGE_KEY_THEME = 'vitepress-theme-name'
|
||||
const STORAGE_KEY_MODE = 'vitepress-display-mode'
|
||||
const STORAGE_KEY_AMOLED = 'vitepress-amoled-enabled'
|
||||
const STORAGE_KEY_THEME_DATA = 'vitepress-theme-data'
|
||||
|
||||
export class ThemeHandler {
|
||||
private state = ref<ThemeState>({
|
||||
|
|
@ -42,7 +43,6 @@ export class ThemeHandler {
|
|||
const savedMode = localStorage.getItem(STORAGE_KEY_MODE) as DisplayMode | null
|
||||
const savedAmoled = localStorage.getItem(STORAGE_KEY_AMOLED) === 'true'
|
||||
|
||||
// Set theme
|
||||
if (themeRegistry[savedTheme]) {
|
||||
this.state.value.currentTheme = savedTheme
|
||||
this.state.value.theme = themeRegistry[savedTheme]
|
||||
|
|
@ -74,7 +74,7 @@ export class ThemeHandler {
|
|||
})
|
||||
}
|
||||
|
||||
private applyTheme() {
|
||||
public applyTheme() {
|
||||
if (typeof document === 'undefined') return
|
||||
|
||||
const { currentMode, theme } = this.state.value
|
||||
|
|
@ -390,4 +390,4 @@ export function useTheme() {
|
|||
toggleAmoled: () => handler.toggleAmoled(),
|
||||
state
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue