浏览代码

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

Liang Ding 2 年之前
父节点
当前提交
0d3bd719aa
共有 2 个文件被更改,包括 4 次插入2 次删除
  1. 1 1
      kernel/model/file.go
  2. 3 1
      kernel/model/storage.go

+ 1 - 1
kernel/model/file.go

@@ -660,7 +660,7 @@ func GetDoc(startID, endID, id string, index int, keyword string, mode int, size
 	luteEngine.RenderOptions.NodeIndexStart = index
 	luteEngine.RenderOptions.NodeIndexStart = index
 	dom = luteEngine.Tree2BlockDOM(subTree, luteEngine.RenderOptions)
 	dom = luteEngine.Tree2BlockDOM(subTree, luteEngine.RenderOptions)
 
 
-	SetRecentDocByTree(tree)
+	SetRecentDocByTree(id, tree)
 	return
 	return
 }
 }
 
 

+ 3 - 1
kernel/model/storage.go

@@ -30,6 +30,7 @@ import (
 
 
 type RecentDoc struct {
 type RecentDoc struct {
 	RootID     string `json:"rootID"`
 	RootID     string `json:"rootID"`
+	ID         string `json:"id"`
 	Icon       string `json:"icon"`
 	Icon       string `json:"icon"`
 	Title      string `json:"title"`
 	Title      string `json:"title"`
 	ScrollAttr string `json:"scrollAttr"`
 	ScrollAttr string `json:"scrollAttr"`
@@ -63,9 +64,10 @@ func RemoveRecentDoc(ids []string) {
 	return
 	return
 }
 }
 
 
-func SetRecentDocByTree(tree *parse.Tree) {
+func SetRecentDocByTree(id string, tree *parse.Tree) {
 	recentDoc := &RecentDoc{
 	recentDoc := &RecentDoc{
 		RootID:     tree.Root.ID,
 		RootID:     tree.Root.ID,
+		ID:         id,
 		Icon:       tree.Root.IALAttr("icon"),
 		Icon:       tree.Root.IALAttr("icon"),
 		Title:      tree.Root.IALAttr("title"),
 		Title:      tree.Root.IALAttr("title"),
 		ScrollAttr: tree.Root.IALAttr("scroll"),
 		ScrollAttr: tree.Root.IALAttr("scroll"),