mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-03-01 16:20:25 +00:00
Refactor theme font handling and preview logic
Moved font configuration to be managed via theme.css, eliminating the need for separate font initialization and caching. Updated backend to generate @font-face rules and font variables in theme.css. Frontend now uses a dedicated style tag for real-time font preview in the theme config page, and removes legacy font cache logic for improved consistency.
This commit is contained in:
@@ -268,15 +268,17 @@ const ThemeConfigCard = () => {
|
||||
|
||||
// 找到已保存的主题名称
|
||||
const savedThemeName = useMemo(() => {
|
||||
if (!originalDataRef.current) return null;
|
||||
return themes.find(t => isThemeColorsEqual(t.theme, originalDataRef.current!))?.name || '自定义';
|
||||
}, [dataLoaded, hasUnsavedChanges]);
|
||||
const savedData = originalDataRef.current || data;
|
||||
if (!savedData) return null;
|
||||
return themes.find(t => isThemeColorsEqual(t.theme, savedData))?.name || '自定义';
|
||||
}, [data, dataLoaded, hasUnsavedChanges]);
|
||||
|
||||
// 已保存的字体模式显示名称
|
||||
const savedFontModeDisplayName = useMemo(() => {
|
||||
const mode = originalDataRef.current?.fontMode || 'aacute';
|
||||
const savedData = originalDataRef.current || data;
|
||||
const mode = savedData?.fontMode || 'aacute';
|
||||
return fontModeNames[mode] || mode;
|
||||
}, [dataLoaded, hasUnsavedChanges]);
|
||||
}, [data, dataLoaded, hasUnsavedChanges]);
|
||||
|
||||
if (loading) return <PageLoading loading />;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user