Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/16236

Vanessaf90a4d2e418a
diff --git a/app/src/config/appearance.ts b/app/src/config/appearance.ts
index ee7dccc18a..dc4a67e021 100644
--- a/app/src/config/appearance.ts
+++ b/app/src/config/appearance.ts
@@ -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();
});
diff --git a/app/src/config/search.ts b/app/src/config/search.ts
index 9f0751a842..a4fab9d427 100644
--- a/app/src/config/search.ts
+++ b/app/src/config/search.ts
@@ -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"]),
// 集市
diff --git a/app/src/types/config.d.ts b/app/src/types/config.d.ts
index 3c0d60b6d6..a285d45a05 100644
--- a/app/src/types/config.d.ts
+++ b/app/src/types/config.d.ts
@@ -260,6 +260,10 @@ declare namespace Config {
* The version number of the theme currently in use
*/
themeVer: string;
+ statusBar: {
+ msgTaskHistoryDatabaseIndexCommitDisabled: boolean
+ msgTaskAssetDatabaseIndexCommitDisabled: boolean
+ };
}
/**