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

This commit is contained in:
Liang Ding 2022-12-10 22:50:02 +08:00
parent 72419c9075
commit bcf3422080
No known key found for this signature in database
GPG Key ID: 136F30F901A2231D
2 changed files with 4 additions and 3 deletions

View File

@ -350,7 +350,8 @@ func (box *Box) Unindex() {
sql.RemoveBoxHash(tx, box.ID) sql.RemoveBoxHash(tx, box.ID)
sql.DeleteByBoxTx(tx, box.ID) sql.DeleteByBoxTx(tx, box.ID)
sql.CommitTx(tx) sql.CommitTx(tx)
treenode.RemoveBlockTreesByBoxID(box.ID) ids := treenode.RemoveBlockTreesByBoxID(box.ID)
RemoveRecentDoc(ids)
} }
func (box *Box) ListFiles(path string) (ret []*FileInfo) { func (box *Box) ListFiles(path string) (ret []*FileInfo) {

View File

@ -175,11 +175,10 @@ func RemoveBlockTreesByPathPrefix(pathPrefix string) {
blockTreesChanged = true blockTreesChanged = true
} }
func RemoveBlockTreesByBoxID(boxID string) { func RemoveBlockTreesByBoxID(boxID string) (ids []string) {
blockTreesLock.Lock() blockTreesLock.Lock()
defer blockTreesLock.Unlock() defer blockTreesLock.Unlock()
var ids []string
for _, b := range blockTrees { for _, b := range blockTrees {
if b.BoxID == boxID { if b.BoxID == boxID {
ids = append(ids, b.ID) ids = append(ids, b.ID)
@ -189,6 +188,7 @@ func RemoveBlockTreesByBoxID(boxID string) {
delete(blockTrees, id) delete(blockTrees, id)
} }
blockTreesChanged = true blockTreesChanged = true
return
} }
func RemoveBlockTree(id string) { func RemoveBlockTree(id string) {