🎨 Mouse hover notebook to display some information https://github.com/siyuan-note/siyuan/issues/12615

This commit is contained in:
Daniel 2024-09-28 16:36:28 +08:00
parent 5932b68ad8
commit af73dc1130
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
3 changed files with 92 additions and 2 deletions

View file

@ -28,6 +28,33 @@ import (
"github.com/siyuan-note/siyuan/kernel/util"
)
func getNotebookInfo(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
arg, ok := util.JsonArg(c, ret)
if !ok {
return
}
boxID := arg["notebook"].(string)
if util.InvalidIDPattern(boxID, ret) {
return
}
box := model.Conf.Box(boxID)
if nil == box {
ret.Code = -1
ret.Msg = "notebook [" + boxID + "] not found"
return
}
boxInfo := box.GetInfo()
ret.Data = map[string]interface{}{
"boxInfo": boxInfo,
}
}
func setNotebookIcon(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)

View file

@ -90,6 +90,7 @@ func ServeAPI(ginServer *gin.Engine) {
ginServer.Handle("POST", "/api/notebook/renameNotebook", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, renameNotebook)
ginServer.Handle("POST", "/api/notebook/changeSortNotebook", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, changeSortNotebook)
ginServer.Handle("POST", "/api/notebook/setNotebookIcon", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setNotebookIcon)
ginServer.Handle("POST", "/api/notebook/getNotebookInfo", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, getNotebookInfo)
ginServer.Handle("POST", "/api/filetree/searchDocs", model.CheckAuth, searchDocs)
ginServer.Handle("POST", "/api/filetree/listDocsByPath", model.CheckAuth, listDocsByPath)