mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-30 05:18:49 +01:00
🎨 Query embed block supports executing JavaScript https://github.com/siyuan-note/siyuan/issues/9648
This commit is contained in:
parent
7a0aab7eac
commit
e24a724630
5 changed files with 59 additions and 3 deletions
|
|
@ -185,6 +185,39 @@ func searchTemplate(c *gin.Context) {
|
|||
}
|
||||
}
|
||||
|
||||
func getEmbedBlock(c *gin.Context) {
|
||||
// Query embed block supports executing JavaScript https://github.com/siyuan-note/siyuan/issues/9648
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
arg, ok := util.JsonArg(c, ret)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
embedBlockID := arg["embedBlockID"].(string)
|
||||
includeIDsArg := arg["includeIDs"].([]interface{})
|
||||
var includeIDs []string
|
||||
for _, includeID := range includeIDsArg {
|
||||
includeIDs = append(includeIDs, includeID.(string))
|
||||
}
|
||||
headingMode := 0 // 0:带标题下方块
|
||||
headingModeArg := arg["headingMode"]
|
||||
if nil != headingModeArg {
|
||||
headingMode = int(headingModeArg.(float64))
|
||||
}
|
||||
breadcrumb := false
|
||||
breadcrumbArg := arg["breadcrumb"]
|
||||
if nil != breadcrumbArg {
|
||||
breadcrumb = breadcrumbArg.(bool)
|
||||
}
|
||||
|
||||
blocks := model.GetEmbedBlock(embedBlockID, includeIDs, headingMode, breadcrumb)
|
||||
ret.Data = map[string]interface{}{
|
||||
"blocks": blocks,
|
||||
}
|
||||
}
|
||||
|
||||
func searchEmbedBlock(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue