🎨 Subdocuments created by the database are not displayed in the doc tree https://github.com/siyuan-note/siyuan/issues/9091

This commit is contained in:
Daniel 2023-09-05 16:42:15 +08:00
parent d6fa43c153
commit 682415ae80
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
4 changed files with 21 additions and 8 deletions

View file

@ -111,7 +111,7 @@ func loadTreeNodes(box string, p string, level int) (ret []*ast.Node, err error)
}
func buildBlockChildren(block *Block) (err error) {
files, _, err := ListDocTree(block.Box, block.Path, util.SortModeUnassigned, false, Conf.FileTree.MaxListCount)
files, _, err := ListDocTree(block.Box, block.Path, util.SortModeUnassigned, false, false, Conf.FileTree.MaxListCount)
if nil != err {
return
}

View file

@ -66,6 +66,7 @@ type File struct {
HCtime string `json:"hCtime"`
Sort int `json:"sort"`
SubFileCount int `json:"subFileCount"`
Hidden bool `json:"hidden"`
NewFlashcardCount int `json:"newFlashcardCount"`
DueFlashcardCount int `json:"dueFlashcardCount"`
@ -231,7 +232,7 @@ type FileInfo struct {
isdir bool
}
func ListDocTree(boxID, path string, sortMode int, flashcard bool, maxListCount int) (ret []*File, totals int, err error) {
func ListDocTree(boxID, path string, sortMode int, flashcard, showHidden bool, maxListCount int) (ret []*File, totals int, err error) {
//os.MkdirAll("pprof", 0755)
//cpuProfile, _ := os.Create("pprof/cpu_profile_list_doc_tree")
//pprof.StartCPUProfile(cpuProfile)
@ -290,6 +291,10 @@ func ListDocTree(boxID, path string, sortMode int, flashcard bool, maxListCount
continue
}
if ial := box.docIAL(parentDocPath); nil != ial {
if !showHidden && "true" == ial["custom-hidden"] {
continue
}
doc := box.docFromFileInfo(parentDocFile, ial)
subFiles, err := os.ReadDir(filepath.Join(boxLocalPath, file.path))
if nil == err {
@ -323,6 +328,10 @@ func ListDocTree(boxID, path string, sortMode int, flashcard bool, maxListCount
}
if ial := box.docIAL(file.path); nil != ial {
if !showHidden && "true" == ial["custom-hidden"] {
continue
}
doc := box.docFromFileInfo(file, ial)
if flashcard {

View file

@ -194,7 +194,7 @@ func Mount(boxID string) (alreadyMount bool, err error) {
box.Index()
// 缓存根一级的文档树展开
ListDocTree(box.ID, "/", util.SortModeUnassigned, false, Conf.FileTree.MaxListCount)
ListDocTree(box.ID, "/", util.SortModeUnassigned, false, false, Conf.FileTree.MaxListCount)
treenode.SaveBlockTree(false)
util.ClearPushProgress(100)