An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: The insertion position is wrong after converting the list to paragraph block in the floating window https://github.com/siyuan-note/siyuan/issues/15396
Danielbe684aee76de
diff --git a/kernel/api/block.go b/kernel/api/block.goindex 0213aa0a6c..310f9b72d5 100644--- a/kernel/api/block.go+++ b/kernel/api/block.go@@ -86,6 +86,31 @@ func getBlockSiblingID(c *gin.Context) {}}+func getBlockIDs(c *gin.Context) {+ ret := gulu.Ret.NewResult()+ defer c.JSON(http.StatusOK, ret)++ arg, ok := util.JsonArg(c, ret)+ if !ok {+ return+ }++ id := arg["id"].(string)+ parentID, previousID, nextID, err := model.GetBlockIDs(id)+ if nil != err {+ ret.Code = -1+ ret.Msg = err.Error()+ ret.Data = map[string]interface{}{"closeTimeout": 7000}+ return+ }++ ret.Data = map[string]string{+ "parentID": parentID,+ "previousID": previousID,+ "nextID": nextID,+ }+}+func transferBlockRef(c *gin.Context) {ret := gulu.Ret.NewResult()defer c.JSON(http.StatusOK, ret)diff --git a/kernel/api/router.go b/kernel/api/router.goindex 4c508adcf8..43a8f03cf4 100644--- a/kernel/api/router.go+++ b/kernel/api/router.go@@ -217,6 +217,7 @@ func ServeAPI(ginServer *gin.Engine) {ginServer.Handle("POST", "/api/block/swapBlockRef", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, swapBlockRef)ginServer.Handle("POST", "/api/block/transferBlockRef", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, transferBlockRef)ginServer.Handle("POST", "/api/block/getBlockSiblingID", model.CheckAuth, getBlockSiblingID)+ ginServer.Handle("POST", "/api/block/getBlockIDs", model.CheckAuth, getBlockIDs)ginServer.Handle("POST", "/api/block/getBlockTreeInfos", model.CheckAuth, getBlockTreeInfos)ginServer.Handle("POST", "/api/block/checkBlockRef", model.CheckAuth, checkBlockRef)diff --git a/kernel/model/block.go b/kernel/model/block.goindex 2fcd8d856f..723d75aecb 100644--- a/kernel/model/block.go+++ b/kernel/model/block.go@@ -280,6 +280,42 @@ func GetBlockSiblingID(id string) (parent, previous, next string) {return}+func GetBlockIDs(id string) (parentID, previousID, nextID string, err error) {+ tree, err := LoadTreeByBlockID(id)+ if err != nil {+ return+ }++ node := treenode.GetNodeInTree(tree, id)+ if nil == node {+ err = ErrBlockNotFound+ return+ }++ if nil != node.Parent {+ parentID = node.Parent.ID+ }+ if nil != node.Previous {+ previous := node.Previous+ if ast.NodeKramdownBlockIAL == previous.Type {+ previous = previous.Previous+ }+ if nil != previous {+ previousID = previous.ID+ }+ }+ if nil != node.Next {+ next := node.Next+ if ast.NodeKramdownBlockIAL == next.Type {+ next = next.Next+ }+ if nil != next {+ nextID = next.ID+ }+ }+ return+}+func GetUnfoldedParentID(id string) (parentID string) {tree, err := LoadTreeByBlockID(id)if err != nil {