mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-02-28 05:32:52 +00:00
🎨 Add kernel API /api/block/getChildBlocks Fix https://github.com/siyuan-note/siyuan/issues/8249
This commit is contained in:
@@ -481,3 +481,20 @@ func getBlockKramdown(c *gin.Context) {
|
||||
"kramdown": kramdown,
|
||||
}
|
||||
}
|
||||
|
||||
func getChildBlocks(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)
|
||||
if util.InvalidIDPattern(id, ret) {
|
||||
return
|
||||
}
|
||||
|
||||
ret.Data = model.GetChildBlocks(id)
|
||||
}
|
||||
|
||||
@@ -147,6 +147,7 @@ func ServeAPI(ginServer *gin.Engine) {
|
||||
ginServer.Handle("POST", "/api/block/getBlockInfo", model.CheckAuth, getBlockInfo)
|
||||
ginServer.Handle("POST", "/api/block/getBlockDOM", model.CheckAuth, getBlockDOM)
|
||||
ginServer.Handle("POST", "/api/block/getBlockKramdown", model.CheckAuth, getBlockKramdown)
|
||||
ginServer.Handle("POST", "/api/block/getChildBlocks", model.CheckAuth, getChildBlocks)
|
||||
ginServer.Handle("POST", "/api/block/getBlockBreadcrumb", model.CheckAuth, getBlockBreadcrumb)
|
||||
ginServer.Handle("POST", "/api/block/getBlockIndex", model.CheckAuth, getBlockIndex)
|
||||
ginServer.Handle("POST", "/api/block/getRefIDs", model.CheckAuth, getRefIDs)
|
||||
|
||||
Reference in New Issue
Block a user