mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-09 06:02:33 +01:00
This commit is contained in:
parent
c76b1f3252
commit
28e8675a21
4 changed files with 73 additions and 101 deletions
|
|
@ -161,32 +161,12 @@ export const appearance = {
|
|||
lang: (appearance.element.querySelector("#lang") as HTMLSelectElement).value,
|
||||
closeButtonBehavior: (appearance.element.querySelector("#closeButtonBehavior") as HTMLInputElement).checked ? 1 : 0,
|
||||
hideStatusBar: (appearance.element.querySelector("#hideStatusBar") as HTMLInputElement).checked,
|
||||
}, response => {
|
||||
if (window.siyuan.config.appearance.themeJS) {
|
||||
if (!response.data.modeOS && (
|
||||
response.data.mode !== window.siyuan.config.appearance.mode ||
|
||||
window.siyuan.config.appearance.themeLight !== response.data.themeLight ||
|
||||
window.siyuan.config.appearance.themeDark !== response.data.themeDark
|
||||
)) {
|
||||
exportLayout({
|
||||
errorExit: false,
|
||||
cb() {
|
||||
window.location.reload();
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
const OSTheme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
||||
if (response.data.modeOS && (
|
||||
(response.data.mode === 1 && OSTheme === "light") || (response.data.mode === 0 && OSTheme === "dark")
|
||||
)) {
|
||||
exportLayout({
|
||||
cb() {
|
||||
window.location.reload();
|
||||
},
|
||||
errorExit: false,
|
||||
});
|
||||
return;
|
||||
}, async response => {
|
||||
if (window.siyuan.config.appearance.themeJS && window.destroyTheme) {
|
||||
try {
|
||||
await window.destroyTheme();
|
||||
} catch (e) {
|
||||
console.error("destroyTheme error: " + e);
|
||||
}
|
||||
}
|
||||
appearance.onSetappearance(response.data);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue