diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.json index 0fe8f83e6..83a1385dc 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 93ae7caee..02cbf623b 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 c07b6c70c..127a47bf5 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 9648674d2..392ae3486 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 728e17512..b38e9bb83 100644 --- a/app/src/config/fileTree.ts +++ b/app/src/config/fileTree.ts @@ -58,6 +58,14 @@ export const fileTree = { + +`; }, _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 95099c993..111d26116 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 eaa34ea19..534a9b7a3 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 d974df1c0..bb65f65da 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 }