Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Improve refreshing of doc tree when creating doc https://github.com/siyuan-note/siyuan/issues/12109

Daniel5ddda02aba11
diff --git a/kernel/api/filetree.go b/kernel/api/filetree.go
index da84406d9a..ee6cb45fbc 100644
--- a/kernel/api/filetree.go
+++ b/kernel/api/filetree.go
@@ -695,16 +695,8 @@ func createDoc(c *gin.Context) {
}
model.FlushTxQueue()
-
- pushCreateEvt := false
- pushCreateEvtArg := arg["pushCreateEvt"]
- if nil != pushCreateEvtArg {
- pushCreateEvt = pushCreateEvtArg.(bool)
- }
- if pushCreateEvt {
- box := model.Conf.Box(notebook)
- pushCreate(box, p, arg)
- }
+ box := model.Conf.Box(notebook)
+ pushCreate(box, p, arg)
ret.Data = map[string]interface{}{
"id": tree.Root.ID,
@@ -837,17 +829,9 @@ func createDocWithMd(c *gin.Context) {
ret.Data = id
model.FlushTxQueue()
-
- pushCreateEvt := false
- pushCreateEvtArg := arg["pushCreateEvt"]
- if nil != pushCreateEvtArg {
- pushCreateEvt = pushCreateEvtArg.(bool)
- }
- if pushCreateEvt {
- box := model.Conf.Box(notebook)
- b, _ := model.GetBlock(id, nil)
- pushCreate(box, b.Path, arg)
- }
+ box := model.Conf.Box(notebook)
+ b, _ := model.GetBlock(id, nil)
+ pushCreate(box, b.Path, arg)
}
func getDocCreateSavePath(c *gin.Context) {
@@ -1157,9 +1141,16 @@ func getDoc(c *gin.Context) {
func pushCreate(box *model.Box, p string, arg map[string]interface{}) {
evt := util.NewCmdResult("create", 0, util.PushModeBroadcast)
+ listDocTree := false
+ listDocTreeArg := arg["listDocTree"]
+ if nil != listDocTreeArg {
+ listDocTree = listDocTreeArg.(bool)
+ }
+
evt.Data = map[string]interface{}{
- "box": box,
- "path": p,
+ "box": box,
+ "path": p,
+ "listDocTree": listDocTree,
}
evt.Callback = arg["callback"]
util.PushEvent(evt)