Explorar o código

:sparkles: fix https://github.com/siyuan-note/siyuan/issues/5854

Vanessa %!s(int64=2) %!d(string=hai) anos
pai
achega
af56b6d4d4

+ 3 - 3
app/src/config/appearance.ts

@@ -320,15 +320,15 @@ export const appearance = {
             }
             const themeLightElement = appearance.element.querySelector("#themeLight") as HTMLSelectElement;
             if (themeLightElement) {
-                themeLightElement.value = data.themeLight;
+                themeLightElement.innerHTML = genOptions(window.siyuan.config.appearance.lightThemes, window.siyuan.config.appearance.themeLight)
             }
             const themeDarkElement = appearance.element.querySelector("#themeDark") as HTMLSelectElement;
             if (themeDarkElement) {
-                themeDarkElement.value = data.themeDark;
+                themeDarkElement.innerHTML = genOptions(window.siyuan.config.appearance.darkThemes, window.siyuan.config.appearance.themeDark)
             }
             const iconElement = appearance.element.querySelector("#icon") as HTMLSelectElement;
             if (iconElement) {
-                iconElement.value = data.icon;
+                iconElement.innerHTML = genOptions(window.siyuan.config.appearance.icons, window.siyuan.config.appearance.icon)
             }
             if (data.customCSS) {
                 fetchPost("/api/setting/getCustomCSS", {

+ 2 - 1
app/src/config/bazaar.ts

@@ -483,6 +483,7 @@ export const bazaar = {
                         fetchPost("/api/setting/setAppearance", {
                             icon: packageName,
                             mode: window.siyuan.config.appearance.mode,
+                            modeOS: window.siyuan.config.appearance.modeOS,
                             codeBlockThemeDark: window.siyuan.config.appearance.codeBlockThemeDark,
                             codeBlockThemeLight: window.siyuan.config.appearance.codeBlockThemeLight,
                             themeDark: window.siyuan.config.appearance.themeDark,
@@ -501,7 +502,6 @@ export const bazaar = {
                                 switchElement.classList.remove("fn__none");
                                 switchElement.previousElementSibling.classList.remove("fn__none");
                             });
-                            appearance.onSetappearance(response.data);
                             bazaar.element.querySelectorAll(`[data-name="${packageName}"]`).forEach(item => {
                                 item.parentElement.classList.add("b3-card--current");
                                 const switchElement = item.querySelector('[data-type="switch"]');
@@ -514,6 +514,7 @@ export const bazaar = {
                         fetchPost("/api/setting/setAppearance", {
                             icon: window.siyuan.config.appearance.icon,
                             mode,
+                            modeOS: false,
                             codeBlockThemeDark: window.siyuan.config.appearance.codeBlockThemeDark,
                             codeBlockThemeLight: window.siyuan.config.appearance.codeBlockThemeLight,
                             themeDark: mode === 1 ? packageName : window.siyuan.config.appearance.themeDark,

+ 2 - 1
app/src/mobile/settings/appearance.ts

@@ -55,7 +55,7 @@ export const initAppearance = (modelElement: HTMLElement, modelMainElement: HTML
         modelMainElement.querySelector("#fontSize").textContent = event.target.value + "px";
         fetchPost("/api/setting/setEditor", {
             displayBookmarkIcon: window.siyuan.config.editor.displayBookmarkIcon,
-            displayNetImgMark:  window.siyuan.config.editor.displayNetImgMark,
+            displayNetImgMark: window.siyuan.config.editor.displayNetImgMark,
             codeLineWrap: window.siyuan.config.editor.codeLineWrap,
             codeSyntaxHighlightLineNum: window.siyuan.config.editor.codeSyntaxHighlightLineNum,
             virtualBlockRef: window.siyuan.config.editor.virtualBlockRef,
@@ -79,6 +79,7 @@ export const initAppearance = (modelElement: HTMLElement, modelMainElement: HTML
             fetchPost("/api/setting/setAppearance", {
                 icon: (modelMainElement.querySelector("#icon") as HTMLSelectElement).value,
                 mode: parseInt((modelMainElement.querySelector("#mode") as HTMLSelectElement).value),
+                modeOS: window.siyuan.config.appearance.modeOS,
                 codeBlockThemeDark: window.siyuan.config.appearance.codeBlockThemeDark,
                 codeBlockThemeLight: window.siyuan.config.appearance.codeBlockThemeLight,
                 themeDark: (modelMainElement.querySelector("#themeDark") as HTMLSelectElement).value,