Skip to content

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

:sparkles: fix https://github.com/siyuan-note/siyuan/issues/2098

Vanessaca8d6d0dc356
diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.json
index 0fe8f83e64..83a1385dc8 100644
--- a/app/appearance/langs/en_US.json
+++ b/app/appearance/langs/en_US.json
@@ -1,4 +1,6 @@
{
+ "tabLimit": "Tab Limit",
+ "tabLimit1": "Sort by opening time, close the earliest opened tab",
"pasteEscaped": "Paste escaped text",
"resetRepoTip": "Resetting the data repository will completely delete the key and all snapshots, are you sure you want to reset?",
"resetRepo": "Reset data repo",
diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.json
index 93ae7caeee..02cbf623b4 100644
--- a/app/appearance/langs/fr_FR.json
+++ b/app/appearance/langs/fr_FR.json
@@ -1,4 +1,6 @@
{
+ "tabLimit": "Nombre maximum d'onglets ouverts",
+ "tabLimit1": "Trier par heure d'ouverture, fermer le premier onglet ouvert",
"pasteEscaped": "Coller le texte échappé",
"resetRepoTip": "La réinitialisation du référentiel de données supprimera complètement la clé et tous les instantanés, êtes-vous sûr de vouloir réinitialiser ?",
"resetRepo": "Réinitialiser le référentiel de données",
diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.json
index c07b6c70c8..127a47bf5a 100644
--- a/app/appearance/langs/zh_CHT.json
+++ b/app/appearance/langs/zh_CHT.json
@@ -1,4 +1,6 @@
{
+ "tabLimit": "頁簽打開最大數量",
+ "tabLimit1": "按照打開時間排序,關閉最早打開的頁簽",
"pasteEscaped": "粘貼轉義文本",
"resetRepoTip": "重置數據倉庫會徹底刪除密鑰和所有快照,確定進行重置嗎?",
"resetRepo": "重置數據倉庫",
diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.json
index 9648674d2d..392ae34863 100644
--- a/app/appearance/langs/zh_CN.json
+++ b/app/appearance/langs/zh_CN.json
@@ -1,4 +1,6 @@
{
+ "tabLimit": "页签打开最大数量",
+ "tabLimit1": "按照打开时间排序,关闭最早打开的页签",
"pasteEscaped": "粘贴转义文本",
"resetRepoTip": "重置数据仓库会彻底删除密钥和所有快照,确定进行重置吗?",
"resetRepo": "重置数据仓库",
diff --git a/app/src/config/fileTree.ts b/app/src/config/fileTree.ts
index 728e17512a..b38e9bb83a 100644
--- a/app/src/config/fileTree.ts
+++ b/app/src/config/fileTree.ts
@@ -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);
});
diff --git a/app/src/config/search.ts b/app/src/config/search.ts
index 95099c9932..111d26116a 100644
--- a/app/src/config/search.ts
+++ b/app/src/config/search.ts
@@ -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"]),
// 图片
diff --git a/app/src/layout/Wnd.ts b/app/src/layout/Wnd.ts
index eaa34ea195..534a9b7a3f 100644
--- a/app/src/layout/Wnd.ts
+++ b/app/src/layout/Wnd.ts
@@ -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) => {
diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts
index d974df1c04..bb65f65da2 100644
--- a/app/src/types/index.d.ts
+++ b/app/src/types/index.d.ts
@@ -231,6 +231,7 @@ declare interface IFileTree {
refCreateSavePath: string
createDocNameTemplate: string
sort: number
+ maxOpenTabCount: number
maxListCount: number
}