Vanessa 2025-11-12 23:47:37 +08:00
parent 3f8b08fbd4
commit f90a4d2e41
3 changed files with 73 additions and 9 deletions

View file

@ -11,6 +11,7 @@ import {loadAssets} from "../util/assets";
import {resetFloatDockSize} from "../layout/dock/util";
import {confirmDialog} from "../dialog/confirmDialog";
import {useShell} from "../util/pathName";
import {Dialog} from "../dialog";
export const appearance = {
element: undefined as Element,
@ -150,14 +151,27 @@ export const appearance = {
</button>
</div>
</div>
<label class="fn__flex b3-label">
<div class="fn__flex-1">
${window.siyuan.languages.appearance16}
<div class="b3-label__text">${window.siyuan.languages.appearance17}</div>
<div class="b3-label">
${window.siyuan.languages.appearance16}
<div class="fn__hr"></div>
<label class="fn__flex">
<div class="fn__flex-center fn__flex-1 ft__on-surface">
${window.siyuan.languages.appearance17}
</div>
<span class="fn__space"></span>
<input class="b3-switch fn__flex-center" id="hideStatusBar" type="checkbox"${window.siyuan.config.appearance.hideStatusBar ? " checked" : ""}>
</label>
<div class="fn__hr"></div>
<div class="fn__flex config__item">
<div class="fn__flex-center fn__flex-1 ft__on-surface">
${window.siyuan.languages.appearance18}
</div>
<span class="fn__space"></span>
<button class="b3-button b3-button--outline fn__flex-center fn__size200" id="statusBarSetting">
<svg><use xlink:href="#iconSettings"></use></svg>${window.siyuan.languages.config}
</button>
</div>
<span class="fn__space"></span>
<input class="b3-switch fn__flex-center" id="hideStatusBar" type="checkbox"${window.siyuan.config.appearance.hideStatusBar ? " checked" : ""}>
</label>
</div>
<label class="fn__flex b3-label">
<div class="fn__flex-1">
${window.siyuan.languages.appearance10}
@ -167,7 +181,10 @@ export const appearance = {
<input class="b3-switch fn__flex-center" id="closeButtonBehavior" type="checkbox"${window.siyuan.config.appearance.closeButtonBehavior === 0 ? "" : " checked"}>
</label>`;
},
_send: () => {
_send: (statusBar: {
msgTaskHistoryDatabaseIndexCommitDisabled: boolean
msgTaskAssetDatabaseIndexCommitDisabled: boolean
}) => {
const themeLight = (appearance.element.querySelector("#themeLight") as HTMLSelectElement).value;
const themeDark = (appearance.element.querySelector("#themeDark") as HTMLSelectElement).value;
const modeElementValue = parseInt((appearance.element.querySelector("#mode") as HTMLSelectElement).value);
@ -186,6 +203,10 @@ 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,
statusBar: {
msgTaskHistoryDatabaseIndexCommitDisabled: statusBar ? statusBar.msgTaskHistoryDatabaseIndexCommitDisabled : window.siyuan.config.appearance.statusBar.msgTaskAssetDatabaseIndexCommitDisabled,
msgTaskAssetDatabaseIndexCommitDisabled: statusBar ? statusBar.msgTaskAssetDatabaseIndexCommitDisabled : window.siyuan.config.appearance.statusBar.msgTaskAssetDatabaseIndexCommitDisabled,
}
}, async response => {
if (window.siyuan.config.appearance.themeJS) {
if (response.data.mode !== window.siyuan.config.appearance.mode ||
@ -223,6 +244,45 @@ export const appearance = {
});
},
bindEvent: () => {
appearance.element.querySelector("#statusBarSetting").addEventListener("click", () => {
const dialog = new Dialog({
transparent: true,
width: "360px",
height: "80vh",
title: window.siyuan.languages.appearance18,
content: `<div class="fn__hr"></div>
<div class="b3-tab-bar b3-list b3-list--background">
<label class="b3-list-item">
<div class="b3-list-item__text">
${window.siyuan.languages["_taskAction"]["task.asset.database.index.commit"]}
</div>
<span class="fn__space"></span>
<input class="b3-switch fn__flex-center" id="asset" type="checkbox"${window.siyuan.config.appearance.statusBar.msgTaskAssetDatabaseIndexCommitDisabled ? " checked" : ""}>
</label>
<label class="b3-list-item">
<div class="b3-list-item__text">
${window.siyuan.languages["_taskAction"]["task.history.database.index.commit"]}
</div>
<span class="fn__space"></span>
<input class="b3-switch fn__flex-center" id="history" type="checkbox"${window.siyuan.config.appearance.statusBar.msgTaskHistoryDatabaseIndexCommitDisabled ? " checked" : ""}>
</label>
</div>`
});
const assetElement = dialog.element.querySelector("#asset") as HTMLInputElement;
const historyElement = dialog.element.querySelector("#history") as HTMLInputElement;
assetElement.addEventListener("change", () => {
appearance._send({
msgTaskHistoryDatabaseIndexCommitDisabled: historyElement.checked,
msgTaskAssetDatabaseIndexCommitDisabled: assetElement.checked
});
});
historyElement.addEventListener("change", () => {
appearance._send({
msgTaskHistoryDatabaseIndexCommitDisabled: historyElement.checked,
msgTaskAssetDatabaseIndexCommitDisabled: assetElement.checked
});
});
});
appearance.element.querySelector("#codeSnippet").addEventListener("click", () => {
openSnippets();
});

View file

@ -60,7 +60,7 @@ export const initConfigSearch = (element: HTMLElement, app: App) => {
// 外观
getLang(["language", "language1", "appearance", "appearance1", "appearance2", "appearance3", "appearance4",
"appearance5", "appearance6", "appearance8", "appearance9", "appearance10", "appearance11", "appearance16",
"appearance17", "resetLayout", "reset", "icon", "themeLight", "themeDark", "close", "themeOS", "theme",
"appearance17", "appearance18", "resetLayout", "reset", "icon", "themeLight", "themeDark", "close", "themeOS", "theme",
"theme2", "theme11", "theme12", "customEmoji", "customEmojiTip", "refresh"]),
// 集市

View file

@ -260,6 +260,10 @@ declare namespace Config {
* The version number of the theme currently in use
*/
themeVer: string;
statusBar: {
msgTaskHistoryDatabaseIndexCommitDisabled: boolean
msgTaskAssetDatabaseIndexCommitDisabled: boolean
};
}
/**