Vanessa 2024-02-16 20:54:45 +08:00
parent 491f1f58dc
commit fd6153dcbc

View file

@ -40,8 +40,7 @@ export const loadAssets = (data: IAppearance) => {
const defaultThemeAddress = `/appearance/themes/${data.mode === 1 ? "midnight" : "daylight"}/theme.css?v=${Constants.SIYUAN_VERSION}`;
if (defaultStyleElement) {
if (!defaultStyleElement.getAttribute("href").startsWith(defaultThemeAddress)) {
defaultStyleElement.remove();
addStyle(defaultThemeAddress, "themeDefaultStyle");
defaultStyleElement.setAttribute("href", defaultThemeAddress)
}
} else {
addStyle(defaultThemeAddress, "themeDefaultStyle");
@ -51,8 +50,7 @@ export const loadAssets = (data: IAppearance) => {
const themeAddress = `/appearance/themes/${data.mode === 1 ? data.themeDark : data.themeLight}/theme.css?v=${data.themeVer}`;
if (styleElement) {
if (!styleElement.getAttribute("href").startsWith(themeAddress)) {
styleElement.remove();
addStyle(themeAddress, "themeStyle");
styleElement.setAttribute("href", themeAddress)
}
} else {
addStyle(themeAddress, "themeStyle");