mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-13 04:08:54 +01:00
🎨 Supports exporting a code block as a file https://github.com/siyuan-note/siyuan/pull/16774
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
7221367334
commit
58bb751cd4
3 changed files with 68 additions and 0 deletions
|
|
@ -37,6 +37,29 @@ import (
|
|||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
func exportCodeBlock(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
arg, ok := util.JsonArg(c, ret)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
id := arg["id"].(string)
|
||||
filePath, err := model.ExportCodeBlock(id)
|
||||
if err != nil {
|
||||
ret.Code = 1
|
||||
ret.Msg = err.Error()
|
||||
ret.Data = map[string]interface{}{"closeTimeout": 7000}
|
||||
return
|
||||
}
|
||||
|
||||
ret.Data = map[string]interface{}{
|
||||
"path": filePath,
|
||||
}
|
||||
}
|
||||
|
||||
func exportAttributeView(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue