🎨 Supports configuring the maximum number of Recent documents to be listed https://github.com/siyuan-note/siyuan/issues/16720

Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2025-12-29 22:24:37 +08:00
parent cde0840bf7
commit 827c7a5bf6
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
27 changed files with 61 additions and 7 deletions

View file

@ -36,6 +36,7 @@ type FileTree struct {
LargeFileWarningSize int `json:"largeFileWarningSize"` // 大文件警告大小单位MB
CreateDocAtTop *bool `json:"createDocAtTop"` // 在顶部创建新文档 https://github.com/siyuan-note/siyuan/issues/16327
Sort int `json:"sort"` // 排序方式
RecentDocsMaxListCount int `json:"recentDocsMaxListCount"` // 最近的文档最大列出数量
}
func NewFileTree() *FileTree {

View file

@ -8,7 +8,7 @@ require (
github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48
github.com/88250/go-humanize v0.0.0-20240424102817-4f78fac47ea7
github.com/88250/gulu v1.2.3-0.20251208021445-f93f2666eaac
github.com/88250/lute v1.7.7-0.20251228092920-c286e7a47b32
github.com/88250/lute v1.7.7-0.20251229120557-04624d6f8b0f
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
github.com/ClarkThan/ahocorasick v0.0.0-20231011042242-30d1ef1347f4
github.com/ConradIrwin/font v0.2.1

View file

@ -14,8 +14,8 @@ github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950 h1:Pa5hMiBceT
github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/88250/gulu v1.2.3-0.20251208021445-f93f2666eaac h1:EC80pY8zyR0gbL8ZLIBB4IPG/ia3ZHScrR/xt8zU8qU=
github.com/88250/gulu v1.2.3-0.20251208021445-f93f2666eaac/go.mod h1:IQ5dXW9CjVmx6B7OfK1Y4ZBKTPMe9q1AkVoLGGzRbS8=
github.com/88250/lute v1.7.7-0.20251228092920-c286e7a47b32 h1:g8nFH1W11S/mE2UMarHr3h3M8ZVHnlqGJntwTk+gwgA=
github.com/88250/lute v1.7.7-0.20251228092920-c286e7a47b32/go.mod h1:WYyUw//5yVw9BJnoVjx7rI/3szsISxNZCYGOqTIrV0o=
github.com/88250/lute v1.7.7-0.20251229120557-04624d6f8b0f h1:EcvPctrQy2qfk5Sq2W45GDyrzbbHKeTGlJGYCYxZvrI=
github.com/88250/lute v1.7.7-0.20251229120557-04624d6f8b0f/go.mod h1:WYyUw//5yVw9BJnoVjx7rI/3szsISxNZCYGOqTIrV0o=
github.com/88250/pdfcpu v0.3.14-0.20250424122812-f10e8d9d8d46 h1:Bq1JsDfVbHKUxNL/B2JXd8cC/1h6aFjrlXpGycnh0Hk=
github.com/88250/pdfcpu v0.3.14-0.20250424122812-f10e8d9d8d46/go.mod h1:fVfOloBzs2+W2VJCCbq60XIxc3yJHAZ0Gahv1oO0gyI=
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=

View file

@ -236,6 +236,13 @@ func InitConf() {
Conf.FileTree.CreateDocAtTop = func() *bool { b := true; return &b }()
}
if 1 > Conf.FileTree.RecentDocsMaxListCount {
Conf.FileTree.RecentDocsMaxListCount = 32
}
if 256 < Conf.FileTree.RecentDocsMaxListCount {
Conf.FileTree.RecentDocsMaxListCount = 256
}
util.CurrentCloudRegion = Conf.CloudRegion
if nil == Conf.Tag {

View file

@ -99,8 +99,8 @@ func setRecentDocByTree(tree *parse.Tree) {
}
recentDocs = append([]*RecentDoc{recentDoc}, recentDocs...)
if 32 < len(recentDocs) {
recentDocs = recentDocs[:32]
if Conf.FileTree.RecentDocsMaxListCount < len(recentDocs) {
recentDocs = recentDocs[:Conf.FileTree.RecentDocsMaxListCount]
}
err = setRecentDocs(recentDocs)