🎨 块引用与所引用的内容块进行交换 https://github.com/siyuan-note/siyuan/issues/4981

This commit is contained in:
Liang Ding 2022-10-02 20:40:26 +08:00
parent 8b8859bc54
commit 875ffca004
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
3 changed files with 75 additions and 0 deletions

View file

@ -31,6 +31,26 @@ import (
"github.com/siyuan-note/siyuan/kernel/util"
)
func swapBlockRef(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
arg, ok := util.JsonArg(c, ret)
if !ok {
return
}
refID := arg["refID"].(string)
defID := arg["defID"].(string)
err := model.SwapBlockRef(refID, defID)
if nil != err {
ret.Code = -1
ret.Msg = err.Error()
ret.Data = map[string]interface{}{"closeTimeout": 7000}
return
}
}
func getHeadingChildrenDOM(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)

View file

@ -149,6 +149,7 @@ func ServeAPI(ginServer *gin.Engine) {
ginServer.Handle("POST", "/api/block/setBlockReminder", model.CheckAuth, setBlockReminder)
ginServer.Handle("POST", "/api/block/getHeadingLevelTransaction", model.CheckAuth, getHeadingLevelTransaction)
ginServer.Handle("POST", "/api/block/getHeadingChildrenDOM", model.CheckAuth, getHeadingChildrenDOM)
ginServer.Handle("POST", "/api/block/swapBlockRef", model.CheckAuth, swapBlockRef)
ginServer.Handle("POST", "/api/file/getFile", model.CheckAuth, getFile)
ginServer.Handle("POST", "/api/file/putFile", model.CheckAuth, putFile)