mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-21 07:46:09 +01:00
🎨 Support listing for invalid block references in the search dialog https://github.com/siyuan-note/siyuan/issues/10396
This commit is contained in:
parent
892d166acf
commit
a02ed0b5cc
3 changed files with 164 additions and 0 deletions
|
|
@ -158,6 +158,7 @@ func ServeAPI(ginServer *gin.Engine) {
|
|||
ginServer.Handle("POST", "/api/search/findReplace", model.CheckAuth, findReplace)
|
||||
ginServer.Handle("POST", "/api/search/fullTextSearchAssetContent", model.CheckAuth, fullTextSearchAssetContent)
|
||||
ginServer.Handle("POST", "/api/search/getAssetContent", model.CheckAuth, getAssetContent)
|
||||
ginServer.Handle("POST", "/api/search/listInvalidBlockRefs", model.CheckAuth, listInvalidBlockRefs)
|
||||
|
||||
ginServer.Handle("POST", "/api/block/getBlockInfo", model.CheckAuth, getBlockInfo)
|
||||
ginServer.Handle("POST", "/api/block/getBlockDOM", model.CheckAuth, getBlockDOM)
|
||||
|
|
|
|||
|
|
@ -26,6 +26,40 @@ import (
|
|||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
func listInvalidBlockRefs(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
arg, ok := util.JsonArg(c, ret)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
page := 1
|
||||
if nil != arg["page"] {
|
||||
page = int(arg["page"].(float64))
|
||||
}
|
||||
if 0 >= page {
|
||||
page = 1
|
||||
}
|
||||
|
||||
pageSize := 32
|
||||
if nil != arg["pageSize"] {
|
||||
pageSize = int(arg["pageSize"].(float64))
|
||||
}
|
||||
if 0 >= pageSize {
|
||||
pageSize = 32
|
||||
}
|
||||
|
||||
blocks, matchedBlockCount, matchedRootCount, pageCount := model.ListInvalidBlockRefs(page, pageSize)
|
||||
ret.Data = map[string]interface{}{
|
||||
"blocks": blocks,
|
||||
"matchedBlockCount": matchedBlockCount,
|
||||
"matchedRootCount": matchedRootCount,
|
||||
"pageCount": pageCount,
|
||||
}
|
||||
}
|
||||
|
||||
func getAssetContent(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue