Vanessa 2022-06-23 11:43:46 +08:00
parent 35cf6d1b49
commit ca8d6d0dc3
8 changed files with 20 additions and 2 deletions

View file

@ -58,6 +58,14 @@ export const fileTree = {
</div>
<span class="fn__space"></span>
<input class="b3-text-field fn__flex-center fn__size200" id="maxListCount" type="number" min="1" max="10240" value="${window.siyuan.config.fileTree.maxListCount}">
</label>
<label class="fn__flex b3-label">
<div class="fn__flex-1">
${window.siyuan.languages.tabLimit}
<div class="b3-label__text">${window.siyuan.languages.tabLimit1}</div>
</div>
<span class="fn__space"></span>
<input class="b3-text-field fn__flex-center fn__size200" id="maxOpenTabCount" type="number" min="1" max="32" value="${window.siyuan.config.fileTree.maxOpenTabCount}">
</label>`;
},
_send() {
@ -70,6 +78,7 @@ export const fileTree = {
allowCreateDeeper: (fileTree.element.querySelector("#allowCreateDeeper") as HTMLInputElement).checked,
removeDocWithoutConfirm: (fileTree.element.querySelector("#removeDocWithoutConfirm") as HTMLInputElement).checked,
maxListCount: parseInt((fileTree.element.querySelector("#maxListCount") as HTMLInputElement).value),
maxOpenTabCount: parseInt((fileTree.element.querySelector("#maxOpenTabCount") as HTMLInputElement).value),
}, response => {
fileTree.onSetfiletree(response.data);
});

View file

@ -18,7 +18,7 @@ export const initConfigSearch = (element: HTMLElement) => {
]),
// 文档树
getLang(["selectOpen", "fileTree", "fileTree2", "fileTree3", "fileTree4",
getLang(["selectOpen", "tabLimit", "fileTree", "fileTree2", "fileTree3", "fileTree4",
"fileTree5", "fileTree6", "fileTree7", "fileTree8", "fileTree12", "fileTree13", "fileTree15", "fileTree16", "fileTree17"]),
// 图片

View file

@ -425,7 +425,7 @@ export class Wnd {
// 移除 centerLayout 中的 empty
if (this.parent.type === "center" && this.children.length === 2 && !this.children[0].headElement) {
this.removeTab(this.children[0].id);
} else if (this.children.length > 5) { // TODO: 需从后台设置中获取
} else if (this.children.length > window.siyuan.config.fileTree.maxOpenTabCount) {
let removeId: string;
let openTime: string;
this.children.forEach((item, index) => {

View file

@ -231,6 +231,7 @@ declare interface IFileTree {
refCreateSavePath: string
createDocNameTemplate: string
sort: number
maxOpenTabCount: number
maxListCount: number
}