mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🧑💻 Add a kernel API /api/filetree/removeDocByID
This commit is contained in:
parent
30ea789fd3
commit
2fb42c5b8c
4 changed files with 74 additions and 0 deletions
|
|
@ -502,6 +502,31 @@ func removeDoc(c *gin.Context) {
|
|||
model.RemoveDoc(notebook, p)
|
||||
}
|
||||
|
||||
func removeDocByID(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
|
||||
}
|
||||
|
||||
tree, err := model.LoadTreeByBlockID(id)
|
||||
if err != nil {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
ret.Data = map[string]interface{}{"closeTimeout": 7000}
|
||||
return
|
||||
}
|
||||
|
||||
model.RemoveDoc(tree.Box, tree.Path)
|
||||
}
|
||||
|
||||
func removeDocs(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
|
@ -558,6 +583,10 @@ func renameDocByID(c *gin.Context) {
|
|||
}
|
||||
|
||||
id := arg["id"].(string)
|
||||
if util.InvalidIDPattern(id, ret) {
|
||||
return
|
||||
}
|
||||
|
||||
title := arg["title"].(string)
|
||||
|
||||
tree, err := model.LoadTreeByBlockID(id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue