🎨 支持列出和切换最近打开的文档 https://github.com/siyuan-note/siyuan/issues/3293

This commit is contained in:
Liang Ding 2022-12-12 22:27:48 +08:00
parent d679bedd77
commit 3b1b62fb7e
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -80,17 +80,14 @@ func SetRecentDoc(doc *RecentDoc) (err error) {
return
}
update := false
for i, c := range recentDocs {
if c.RootID == doc.RootID {
recentDocs[i] = doc
update = true
recentDocs = append(recentDocs[:i], recentDocs[i+1:]...)
break
}
}
if !update {
recentDocs = append([]*RecentDoc{doc}, recentDocs...)
}
recentDocs = append([]*RecentDoc{doc}, recentDocs...)
if 32 < len(recentDocs) {
recentDocs = recentDocs[:32]
}