fix: code style init value
This commit is contained in:
parent
8491141edc
commit
612b39a878
@ -24,8 +24,11 @@ export const SyntaxHighlighterProvider: React.FC<PropsWithChildren> = ({ childre
|
|||||||
const { codeStyle } = useSettings()
|
const { codeStyle } = useSettings()
|
||||||
|
|
||||||
const highlighterTheme = useMemo(() => {
|
const highlighterTheme = useMemo(() => {
|
||||||
if (codeStyle === 'auto') return theme === ThemeMode.light ? 'one-light' : 'material-theme-darker'
|
if (!codeStyle || codeStyle === 'auto') {
|
||||||
else return codeStyle
|
return theme === ThemeMode.light ? 'one-light' : 'material-theme-darker'
|
||||||
|
}
|
||||||
|
|
||||||
|
return codeStyle
|
||||||
}, [theme, codeStyle])
|
}, [theme, codeStyle])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@ -24,7 +24,7 @@ const persistedReducer = persistReducer(
|
|||||||
{
|
{
|
||||||
key: 'cherry-studio',
|
key: 'cherry-studio',
|
||||||
storage,
|
storage,
|
||||||
version: 38,
|
version: 39,
|
||||||
blacklist: ['runtime'],
|
blacklist: ['runtime'],
|
||||||
migrate
|
migrate
|
||||||
},
|
},
|
||||||
|
|||||||
@ -669,6 +669,10 @@ const migrateConfig = {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
'39': (state: RootState) => {
|
||||||
|
state.settings.codeStyle = 'auto'
|
||||||
|
return state
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user