fix: resolve theme switching conflicts and layout shaking by refining Font CSS and ForceTheme logic

This commit is contained in:
Bot
2026-04-16 17:10:54 +08:00
parent cb436904ea
commit b668063c52
2 changed files with 5 additions and 3 deletions
+3 -1
View File
@@ -47,7 +47,9 @@ const MainApp: React.FC = () => {
window.ForceTheme as string !== "" ? window.ForceTheme : undefined; window.ForceTheme as string !== "" ? window.ForceTheme : undefined;
useEffect(() => { useEffect(() => {
if (forceTheme === "dark" || forceTheme === "light") { const savedTheme = localStorage.getItem("vite-ui-theme");
// Only auto-apply ForceTheme if the user hasn't manually picked one (or picked 'system')
if ((!savedTheme || savedTheme === "system") && (forceTheme === "dark" || forceTheme === "light")) {
setTheme(forceTheme); setTheme(forceTheme);
} }
}, [forceTheme, setTheme]); }, [forceTheme, setTheme]);
+2 -2
View File
@@ -190,7 +190,6 @@
@layer base { @layer base {
* { * {
@apply border-border; @apply border-border;
font-family: 'LXGW WenKai Screen', sans-serif !important;
} }
html { html {
@apply scroll-smooth; @apply scroll-smooth;
@@ -200,9 +199,10 @@
/* font-feature-settings: "rlig" 1, "calt" 1; */ /* font-feature-settings: "rlig" 1, "calt" 1; */
font-synthesis-weight: none; font-synthesis-weight: none;
text-rendering: optimizeLegibility; text-rendering: optimizeLegibility;
font-family: 'LXGW WenKai Screen', sans-serif;
} }
h1, h2, h3, h4, h5, h6 { h1, h2, h3, h4, h5, h6 {
font-family: 'LXGW WenKai Screen', sans-serif !important; font-family: 'LXGW WenKai Screen', sans-serif;
} }
} }