An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Subdocuments created by the database are not displayed in the doc tree https://github.com/siyuan-note/siyuan/issues/9091
Danielf80ae732b979
diff --git a/kernel/api/filetree.go b/kernel/api/filetree.goindex 938dd04950..f451d026fc 100644--- a/kernel/api/filetree.go+++ b/kernel/api/filetree.go@@ -481,10 +481,10 @@ func createDocWithMd(c *gin.Context) {parentID = parentIDArg.(string)}- showInDocTree := true- showInDocTreeArg := arg["showInDocTree"]- if nil != showInDocTreeArg {- showInDocTree = showInDocTreeArg.(bool)+ hidden := true+ hiddenArg := arg["hidden"]+ if nil != hiddenArg {+ hidden = hiddenArg.(bool)}hPath := arg["path"].(string)@@ -502,7 +502,7 @@ func createDocWithMd(c *gin.Context) {hPath = "/" + hPath}- id, err := model.CreateWithMarkdown(notebook, hPath, markdown, parentID, showInDocTree)+ id, err := model.CreateWithMarkdown(notebook, hPath, markdown, parentID, hidden)if nil != err {ret.Code = -1ret.Msg = err.Error()@@ -510,7 +510,7 @@ func createDocWithMd(c *gin.Context) {}ret.Data = id- if !showInDocTree {+ if !hidden {return}diff --git a/kernel/model/file.go b/kernel/model/file.goindex 224c15d8e3..69112be922 100644--- a/kernel/model/file.go+++ b/kernel/model/file.go@@ -1011,7 +1011,7 @@ func CreateDocByMd(boxID, p, title, md string, sorts []string) (tree *parse.Treereturn}-func CreateWithMarkdown(boxID, hPath, md, parentID string, showInDocTree bool) (id string, err error) {+func CreateWithMarkdown(boxID, hPath, md, parentID string, hidden bool) (id string, err error) {box := Conf.Box(boxID)if nil == box {err = errors.New(Conf.Language(0))@@ -1021,7 +1021,7 @@ func CreateWithMarkdown(boxID, hPath, md, parentID string, showInDocTree bool) (WaitForWritingFiles()luteEngine := util.NewLute()dom := luteEngine.Md2BlockDOM(md, false)- id, _, err = createDocsByHPath(box.ID, hPath, dom, parentID, showInDocTree)+ id, _, err = createDocsByHPath(box.ID, hPath, dom, parentID, hidden)return}@@ -1469,7 +1469,7 @@ func CreateDailyNote(boxID string) (p string, existed bool, err error) {return}-func createDoc(boxID, p, title, dom string, showInDocTree bool) (tree *parse.Tree, err error) {+func createDoc(boxID, p, title, dom string, hidden bool) (tree *parse.Tree, err error) {title = gulu.Str.RemoveInvisible(title)if 512 < utf8.RuneCountInString(title) {// 限制笔记本名和文档名最大长度为 `512` https://github.com/siyuan-note/siyuan/issues/6299@@ -1541,7 +1541,7 @@ func createDoc(boxID, p, title, dom string, showInDocTree bool) (tree *parse.Tretree.Root.AppendChild(treenode.NewParagraph())}- if !showInDocTree {+ if !hidden {tree.Root.SetIALAttr("custom-hidden", "true")}diff --git a/kernel/model/path.go b/kernel/model/path.goindex 5e23996c34..3cfc184208 100644--- a/kernel/model/path.go+++ b/kernel/model/path.go@@ -33,7 +33,7 @@ import ("github.com/siyuan-note/siyuan/kernel/util")-func createDocsByHPath(boxID, hPath, content, parentID string, showInDocTree bool) (id string, existed bool, err error) {+func createDocsByHPath(boxID, hPath, content, parentID string, hidden bool) (id string, existed bool, err error) {hPath = strings.TrimSuffix(hPath, ".sy")pathBuilder := bytes.Buffer{}pathBuilder.WriteString("/")@@ -51,7 +51,7 @@ func createDocsByHPath(boxID, hPath, content, parentID string, showInDocTree boo// 如果父文档存在且 ID 一致,则直接在父文档下创建id = ast.NewNodeID()p := strings.TrimSuffix(preferredParent.Path, ".sy") + "/" + id + ".sy"- if _, err = createDoc(boxID, p, name, content, showInDocTree); nil != err {+ if _, err = createDoc(boxID, p, name, content, hidden); nil != err {return}}@@ -68,11 +68,11 @@ func createDocsByHPath(boxID, hPath, content, parentID string, showInDocTree boopathBuilder.WriteString(id)docP := pathBuilder.String() + ".sy"if isNotLast {- if _, err = createDoc(boxID, docP, part, "", showInDocTree); nil != err {+ if _, err = createDoc(boxID, docP, part, "", hidden); nil != err {return}} else {- if _, err = createDoc(boxID, docP, part, content, showInDocTree); nil != err {+ if _, err = createDoc(boxID, docP, part, content, hidden); nil != err {return}}