🧑‍💻 Add an internal kernel API /api/outline/getDocOutlineAndStorage https://github.com/siyuan-note/siyuan/issues/16206

Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2025-10-27 17:14:25 +08:00
parent ea95d62801
commit d154b05083
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 39 additions and 1 deletions

View file

@ -25,6 +25,41 @@ import (
"github.com/siyuan-note/siyuan/kernel/util"
)
func getDocOutlineAndStorage(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
arg, ok := util.JsonArg(c, ret)
if !ok {
return
}
if nil == arg["id"] {
return
}
preview := false
if previewArg := arg["preview"]; nil != previewArg {
preview = previewArg.(bool)
}
rootID := arg["id"].(string)
data, err := model.GetOutlineStorage(rootID)
if err != nil {
ret.Code = -1
ret.Msg = err.Error()
return
}
headings, err := model.Outline(rootID, preview)
if err != nil {
ret.Code = 1
ret.Msg = err.Error()
return
}
ret.Data = map[string]any{
"headings": headings,
"storage": data,
}
}
func getDocOutline(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)