feat(preferences): update user theme settings and add new preferences

- Updated preferences configuration with new user theme options including font family and code font family.
- Added new preferences for chat and export menus.
- Adjusted default preferences to include new settings for user theme.
- Enhanced useUserTheme hook to manage new font family preferences.
This commit is contained in:
fullex 2025-09-14 17:05:31 +08:00
parent 57fd73e51a
commit 78a8ebc777
3 changed files with 33 additions and 13 deletions

View File

@ -1,6 +1,6 @@
/**
* Auto-generated preferences configuration
* Generated at: 2025-09-03T13:39:01.110Z
* Generated at: 2025-09-14T09:02:01.333Z
*
* This file is automatically generated from classification.json
* To update this file, modify classification.json and run:
@ -91,6 +91,8 @@ export interface PreferencesType {
'chat.code.execution.enabled': boolean
// redux/settings/codeExecution.timeoutMinutes
'chat.code.execution.timeout_minutes': number
// redux/settings/codeFancyBlock
'chat.code.fancy_block': boolean
// redux/settings/codeImageTools
'chat.code.image_tools': boolean
// redux/settings/codePreview.themeDark
@ -241,6 +243,8 @@ export interface PreferencesType {
'data.export.menus.markdown': boolean
// redux/settings/exportMenuOptions.markdown_reason
'data.export.menus.markdown_reason': boolean
// redux/settings/exportMenuOptions.notes
'data.export.menus.notes': boolean
// redux/settings/exportMenuOptions.notion
'data.export.menus.notion': boolean
// redux/settings/exportMenuOptions.obsidian
@ -297,14 +301,18 @@ export interface PreferencesType {
'feature.minapp.show_opened_in_sidebar': boolean
// redux/note/settings.defaultEditMode
'feature.notes.default_edit_mode': string
// redux/note/settings.fontFamily
'feature.notes.default_font_family': string
// redux/note/settings.defaultViewMode
'feature.notes.default_view_mode': string
// redux/note/settings.fontFamily
'feature.notes.font_family': string
// redux/note/settings.fontSize
'feature.notes.font_size': number
// redux/note/settings.isFullWidth
'feature.notes.full_width': boolean
// redux/note/settings.showTabStatus
'feature.notes.show_tab_status': boolean
// redux/note/settings.showTableOfContents
'feature.notes.show_table_of_contents': boolean
// redux/note/settings.showWorkspace
'feature.notes.show_workspace': boolean
// redux/settings/clickTrayToShowQuickAssistant
@ -393,8 +401,12 @@ export interface PreferencesType {
'ui.sidebar.icons.visible': PreferenceTypes.SidebarIcon[]
// redux/settings/theme
'ui.theme_mode': PreferenceTypes.ThemeMode
// redux/settings/userTheme.userCodeFontFamily
'ui.theme_user.code_font_family': string
// redux/settings/userTheme.colorPrimary
'ui.theme_user.color_primary': string
// redux/settings/userTheme.userFontFamily
'ui.theme_user.font_family': string
// redux/settings/windowStyle
'ui.window_style': PreferenceTypes.WindowStyle
}
@ -439,6 +451,7 @@ export const DefaultPreferences: PreferencesType = {
'chat.code.editor.theme_light': 'auto',
'chat.code.execution.enabled': false,
'chat.code.execution.timeout_minutes': 1,
'chat.code.fancy_block': true,
'chat.code.image_tools': false,
'chat.code.preview.theme_dark': 'auto',
'chat.code.preview.theme_light': 'auto',
@ -514,6 +527,7 @@ export const DefaultPreferences: PreferencesType = {
'data.export.menus.joplin': true,
'data.export.menus.markdown': true,
'data.export.menus.markdown_reason': true,
'data.export.menus.notes': true,
'data.export.menus.notion': true,
'data.export.menus.obsidian': true,
'data.export.menus.plain_text': true,
@ -542,10 +556,12 @@ export const DefaultPreferences: PreferencesType = {
'feature.minapp.open_link_external': false,
'feature.minapp.show_opened_in_sidebar': true,
'feature.notes.default_edit_mode': 'preview',
'feature.notes.default_font_family': 'default',
'feature.notes.default_view_mode': 'edit',
'feature.notes.font_family': 'default',
'feature.notes.font_size': 16,
'feature.notes.full_width': true,
'feature.notes.show_tab_status': true,
'feature.notes.show_table_of_contents': true,
'feature.notes.show_workspace': true,
'feature.quick_assistant.click_tray_to_show': false,
'feature.quick_assistant.enabled': false,
@ -647,7 +663,9 @@ export const DefaultPreferences: PreferencesType = {
'notes'
],
'ui.theme_mode': PreferenceTypes.ThemeMode.system,
'ui.theme_user.code_font_family': '',
'ui.theme_user.color_primary': '#00b96b',
'ui.theme_user.font_family': '',
'ui.window_style': 'opaque'
}
}
@ -656,8 +674,8 @@ export const DefaultPreferences: PreferencesType = {
/**
* :
* - 总配置项: 189
* - 总配置项: 195
* - electronStore项: 1
* - redux项: 188
* - redux项: 194
* - localStorage项: 0
*/

View File

@ -6,6 +6,8 @@ import Color from 'color'
export default function useUserTheme() {
const [colorPrimary, setColorPrimary] = usePreference('ui.theme_user.color_primary')
const [userFontFamily, setUserFontFamily] = usePreference('ui.theme_user.font_family')
const [userCodeFontFamily, setUserCodeFontFamily] = usePreference('ui.theme_user.code_font_family')
const initUserTheme = (theme: { colorPrimary: string } = { colorPrimary }) => {
const colorPrimary = Color(theme.colorPrimary)
@ -17,8 +19,8 @@ export default function useUserTheme() {
document.body.style.setProperty('--color-primary-mute', colorPrimary.alpha(0.3).toString())
// Set font family CSS variables
document.documentElement.style.setProperty('--user-font-family', `'${theme.userFontFamily}'`)
document.documentElement.style.setProperty('--user-code-font-family', `'${theme.userCodeFontFamily}'`)
document.documentElement.style.setProperty('--user-font-family', `'${userFontFamily}'`)
document.documentElement.style.setProperty('--user-code-font-family', `'${userCodeFontFamily}'`)
}
return {
@ -26,10 +28,12 @@ export default function useUserTheme() {
initUserTheme,
userTheme: { colorPrimary },
userTheme: { colorPrimary, userFontFamily, userCodeFontFamily },
setUserTheme(userTheme: { colorPrimary: string }) {
setUserTheme(userTheme: { colorPrimary: string; userFontFamily: string; userCodeFontFamily: string }) {
setColorPrimary(userTheme.colorPrimary)
setUserFontFamily(userTheme.userFontFamily)
setUserCodeFontFamily(userTheme.userCodeFontFamily)
initUserTheme(userTheme)
}
}

View File

@ -62,9 +62,7 @@ export interface SettingsState {
trayOnClose: boolean
tray: boolean
theme: ThemeMode
userTheme: {
colorPrimary: string
}
userTheme: UserTheme
windowStyle: 'transparent' | 'opaque'
fontSize: number
topicPosition: 'left' | 'right'