mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-21 15:56:10 +01:00
🎨 Mouse hover notebook to display some information https://github.com/siyuan-note/siyuan/issues/12615
This commit is contained in:
parent
5932b68ad8
commit
af73dc1130
3 changed files with 92 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue