mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-25 16:34:06 +01:00
This commit is contained in:
parent
7a68c8ad1b
commit
f06a2e62a5
11 changed files with 175 additions and 71 deletions
|
|
@ -323,23 +323,33 @@ export const about = {
|
|||
const networkServeElement = about.element.querySelector("#networkServe") as HTMLInputElement;
|
||||
networkServeElement.addEventListener("change", () => {
|
||||
fetchPost("/api/system/setNetworkServe", {networkServe: networkServeElement.checked}, () => {
|
||||
exportLayout(false, () => {
|
||||
exitSiYuan();
|
||||
}, false, true);
|
||||
exportLayout({
|
||||
reload: false,
|
||||
onlyData: false,
|
||||
errorExit: true,
|
||||
cb: exitSiYuan
|
||||
});
|
||||
});
|
||||
});
|
||||
const googleAnalyticsElement = about.element.querySelector("#googleAnalytics") as HTMLInputElement;
|
||||
googleAnalyticsElement.addEventListener("change", () => {
|
||||
fetchPost("/api/system/setGoogleAnalytics", {googleAnalytics: googleAnalyticsElement.checked}, () => {
|
||||
exportLayout(true);
|
||||
exportLayout({
|
||||
reload: true,
|
||||
onlyData: false,
|
||||
errorExit: false,
|
||||
});
|
||||
});
|
||||
});
|
||||
const uploadErrLogElement = about.element.querySelector("#uploadErrLog") as HTMLInputElement;
|
||||
uploadErrLogElement.addEventListener("change", () => {
|
||||
fetchPost("/api/system/setUploadErrLog", {uploadErrLog: uploadErrLogElement.checked}, () => {
|
||||
exportLayout(false, () => {
|
||||
exitSiYuan();
|
||||
}, false, true);
|
||||
exportLayout({
|
||||
reload: false,
|
||||
onlyData: false,
|
||||
errorExit: true,
|
||||
cb: exitSiYuan
|
||||
});
|
||||
});
|
||||
});
|
||||
const downloadInstallPkgElement = about.element.querySelector("#downloadInstallPkg") as HTMLInputElement;
|
||||
|
|
|
|||
|
|
@ -177,14 +177,22 @@ export const appearance = {
|
|||
window.siyuan.config.appearance.themeLight !== response.data.themeLight ||
|
||||
window.siyuan.config.appearance.themeDark !== response.data.themeDark
|
||||
)) {
|
||||
exportLayout(true);
|
||||
exportLayout({
|
||||
reload: true,
|
||||
onlyData: false,
|
||||
errorExit: false,
|
||||
});
|
||||
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(true);
|
||||
exportLayout({
|
||||
reload: true,
|
||||
onlyData: false,
|
||||
errorExit: false,
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -215,7 +223,11 @@ export const appearance = {
|
|||
shell.openPath(path.join(window.siyuan.config.system.dataDir, "emojis"));
|
||||
});
|
||||
appearance.element.querySelector("#appearanceRefresh").addEventListener("click", () => {
|
||||
exportLayout(true);
|
||||
exportLayout({
|
||||
reload: true,
|
||||
onlyData: false,
|
||||
errorExit: false,
|
||||
});
|
||||
});
|
||||
/// #endif
|
||||
appearance.element.querySelectorAll("select").forEach(item => {
|
||||
|
|
@ -231,7 +243,11 @@ export const appearance = {
|
|||
},
|
||||
onSetappearance(data: IAppearance) {
|
||||
if (data.lang !== window.siyuan.config.appearance.lang || data.nativeEmoji !== window.siyuan.config.appearance.nativeEmoji) {
|
||||
exportLayout(true);
|
||||
exportLayout({
|
||||
reload: true,
|
||||
onlyData: false,
|
||||
errorExit: false,
|
||||
});
|
||||
return;
|
||||
}
|
||||
window.siyuan.config.appearance = data;
|
||||
|
|
|
|||
|
|
@ -482,7 +482,11 @@ export const bazaar = {
|
|||
mode: dataObj.themeMode === "dark" ? 1 : 0,
|
||||
}, response => {
|
||||
if (window.siyuan.config.appearance.themeJS && bazaarType === "themes") {
|
||||
exportLayout(true);
|
||||
exportLayout({
|
||||
reload: true,
|
||||
onlyData: false,
|
||||
errorExit: false,
|
||||
});
|
||||
return;
|
||||
}
|
||||
bazaar._genMyHTML(bazaarType, app);
|
||||
|
|
@ -525,7 +529,11 @@ export const bazaar = {
|
|||
(window.siyuan.config.appearance.mode === 1 && window.siyuan.config.appearance.themeDark === dataObj.name)
|
||||
)) {
|
||||
if (window.siyuan.config.appearance.themeJS) {
|
||||
exportLayout(true);
|
||||
exportLayout({
|
||||
reload: true,
|
||||
onlyData: false,
|
||||
errorExit: false,
|
||||
});
|
||||
} else {
|
||||
const linkElement = (document.getElementById("themeDefaultStyle") as HTMLLinkElement);
|
||||
linkElement.href = linkElement.href + "1";
|
||||
|
|
@ -563,7 +571,11 @@ export const bazaar = {
|
|||
bazaar._onBazaar(response, bazaarType, ["themes", "icons"].includes(bazaarType));
|
||||
// TODO destroy plugin
|
||||
if (bazaarType === "plugins") {
|
||||
exportLayout(true);
|
||||
exportLayout({
|
||||
reload: true,
|
||||
onlyData: false,
|
||||
errorExit: false,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -596,7 +608,11 @@ export const bazaar = {
|
|||
(mode === 1 && window.siyuan.config.appearance.themeDark !== packageName) ||
|
||||
(mode === 0 && window.siyuan.config.appearance.themeLight !== packageName)) &&
|
||||
window.siyuan.config.appearance.themeJS) {
|
||||
exportLayout(true);
|
||||
exportLayout({
|
||||
reload: true,
|
||||
onlyData: false,
|
||||
errorExit: false,
|
||||
});
|
||||
} else {
|
||||
this._genMyHTML("themes", app);
|
||||
fetchPost("/api/bazaar/getBazaarTheme", {}, response => {
|
||||
|
|
@ -628,7 +644,11 @@ export const bazaar = {
|
|||
enabled: (target as HTMLInputElement).checked
|
||||
}, () => {
|
||||
// TODO destroy plugin
|
||||
exportLayout(true);
|
||||
exportLayout({
|
||||
reload: true,
|
||||
onlyData: false,
|
||||
errorExit: false,
|
||||
});
|
||||
});
|
||||
}
|
||||
event.stopPropagation();
|
||||
|
|
|
|||
|
|
@ -196,7 +196,11 @@ export const keymap = {
|
|||
},
|
||||
bindEvent() {
|
||||
keymap.element.querySelector("#keymapRefreshBtn").addEventListener("click", () => {
|
||||
exportLayout(true);
|
||||
exportLayout({
|
||||
reload: true,
|
||||
onlyData: false,
|
||||
errorExit: false,
|
||||
});
|
||||
});
|
||||
const searchElement = keymap.element.querySelector("#keymapInput") as HTMLInputElement;
|
||||
const searchKeymapElement = keymap.element.querySelector("#searchByKey") as HTMLInputElement;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue