mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-18 07:30:12 +01:00
This commit is contained in:
parent
3f8b08fbd4
commit
f90a4d2e41
3 changed files with 73 additions and 9 deletions
|
|
@ -11,6 +11,7 @@ import {loadAssets} from "../util/assets";
|
||||||
import {resetFloatDockSize} from "../layout/dock/util";
|
import {resetFloatDockSize} from "../layout/dock/util";
|
||||||
import {confirmDialog} from "../dialog/confirmDialog";
|
import {confirmDialog} from "../dialog/confirmDialog";
|
||||||
import {useShell} from "../util/pathName";
|
import {useShell} from "../util/pathName";
|
||||||
|
import {Dialog} from "../dialog";
|
||||||
|
|
||||||
export const appearance = {
|
export const appearance = {
|
||||||
element: undefined as Element,
|
element: undefined as Element,
|
||||||
|
|
@ -150,14 +151,27 @@ export const appearance = {
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<label class="fn__flex b3-label">
|
<div class="b3-label">
|
||||||
<div class="fn__flex-1">
|
|
||||||
${window.siyuan.languages.appearance16}
|
${window.siyuan.languages.appearance16}
|
||||||
<div class="b3-label__text">${window.siyuan.languages.appearance17}</div>
|
<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>
|
</div>
|
||||||
<span class="fn__space"></span>
|
<span class="fn__space"></span>
|
||||||
<input class="b3-switch fn__flex-center" id="hideStatusBar" type="checkbox"${window.siyuan.config.appearance.hideStatusBar ? " checked" : ""}>
|
<input class="b3-switch fn__flex-center" id="hideStatusBar" type="checkbox"${window.siyuan.config.appearance.hideStatusBar ? " checked" : ""}>
|
||||||
</label>
|
</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>
|
||||||
|
</div>
|
||||||
<label class="fn__flex b3-label">
|
<label class="fn__flex b3-label">
|
||||||
<div class="fn__flex-1">
|
<div class="fn__flex-1">
|
||||||
${window.siyuan.languages.appearance10}
|
${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"}>
|
<input class="b3-switch fn__flex-center" id="closeButtonBehavior" type="checkbox"${window.siyuan.config.appearance.closeButtonBehavior === 0 ? "" : " checked"}>
|
||||||
</label>`;
|
</label>`;
|
||||||
},
|
},
|
||||||
_send: () => {
|
_send: (statusBar: {
|
||||||
|
msgTaskHistoryDatabaseIndexCommitDisabled: boolean
|
||||||
|
msgTaskAssetDatabaseIndexCommitDisabled: boolean
|
||||||
|
}) => {
|
||||||
const themeLight = (appearance.element.querySelector("#themeLight") as HTMLSelectElement).value;
|
const themeLight = (appearance.element.querySelector("#themeLight") as HTMLSelectElement).value;
|
||||||
const themeDark = (appearance.element.querySelector("#themeDark") as HTMLSelectElement).value;
|
const themeDark = (appearance.element.querySelector("#themeDark") as HTMLSelectElement).value;
|
||||||
const modeElementValue = parseInt((appearance.element.querySelector("#mode") 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,
|
lang: (appearance.element.querySelector("#lang") as HTMLSelectElement).value,
|
||||||
closeButtonBehavior: (appearance.element.querySelector("#closeButtonBehavior") as HTMLInputElement).checked ? 1 : 0,
|
closeButtonBehavior: (appearance.element.querySelector("#closeButtonBehavior") as HTMLInputElement).checked ? 1 : 0,
|
||||||
hideStatusBar: (appearance.element.querySelector("#hideStatusBar") as HTMLInputElement).checked,
|
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 => {
|
}, async response => {
|
||||||
if (window.siyuan.config.appearance.themeJS) {
|
if (window.siyuan.config.appearance.themeJS) {
|
||||||
if (response.data.mode !== window.siyuan.config.appearance.mode ||
|
if (response.data.mode !== window.siyuan.config.appearance.mode ||
|
||||||
|
|
@ -223,6 +244,45 @@ export const appearance = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
bindEvent: () => {
|
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", () => {
|
appearance.element.querySelector("#codeSnippet").addEventListener("click", () => {
|
||||||
openSnippets();
|
openSnippets();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ export const initConfigSearch = (element: HTMLElement, app: App) => {
|
||||||
// 外观
|
// 外观
|
||||||
getLang(["language", "language1", "appearance", "appearance1", "appearance2", "appearance3", "appearance4",
|
getLang(["language", "language1", "appearance", "appearance1", "appearance2", "appearance3", "appearance4",
|
||||||
"appearance5", "appearance6", "appearance8", "appearance9", "appearance10", "appearance11", "appearance16",
|
"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"]),
|
"theme2", "theme11", "theme12", "customEmoji", "customEmojiTip", "refresh"]),
|
||||||
|
|
||||||
// 集市
|
// 集市
|
||||||
|
|
|
||||||
4
app/src/types/config.d.ts
vendored
4
app/src/types/config.d.ts
vendored
|
|
@ -260,6 +260,10 @@ declare namespace Config {
|
||||||
* The version number of the theme currently in use
|
* The version number of the theme currently in use
|
||||||
*/
|
*/
|
||||||
themeVer: string;
|
themeVer: string;
|
||||||
|
statusBar: {
|
||||||
|
msgTaskHistoryDatabaseIndexCommitDisabled: boolean
|
||||||
|
msgTaskAssetDatabaseIndexCommitDisabled: boolean
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue