mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-03 23:31:21 +08:00
🎨 Support for exporting EPUB Fix https://github.com/siyuan-note/siyuan/issues/8134
This commit is contained in:
parent
05d2a5147d
commit
825e3767e7
@ -722,6 +722,17 @@ export const exportMd = (id: string) => {
|
|||||||
openByMobile(response.data.zip);
|
openByMobile(response.data.zip);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
label: "EPUB",
|
||||||
|
click: () => {
|
||||||
|
const msgId = showMessage(window.siyuan.languages.exporting, -1);
|
||||||
|
fetchPost("/api/export/exportEPUB", {
|
||||||
|
id,
|
||||||
|
}, response => {
|
||||||
|
hideMessage(msgId);
|
||||||
|
openByMobile(response.data.zip);
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,23 @@ import (
|
|||||||
"github.com/siyuan-note/siyuan/kernel/util"
|
"github.com/siyuan-note/siyuan/kernel/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func exportEPUB(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)
|
||||||
|
name, zipPath := model.ExportPandocConvertZip(id, "epub", ".epub")
|
||||||
|
ret.Data = map[string]interface{}{
|
||||||
|
"name": name,
|
||||||
|
"zip": zipPath,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func exportRTF(c *gin.Context) {
|
func exportRTF(c *gin.Context) {
|
||||||
ret := gulu.Ret.NewResult()
|
ret := gulu.Ret.NewResult()
|
||||||
defer c.JSON(http.StatusOK, ret)
|
defer c.JSON(http.StatusOK, ret)
|
||||||
|
@ -253,6 +253,7 @@ func ServeAPI(ginServer *gin.Engine) {
|
|||||||
ginServer.Handle("POST", "/api/export/exportMediaWiki", model.CheckAuth, exportMediaWiki)
|
ginServer.Handle("POST", "/api/export/exportMediaWiki", model.CheckAuth, exportMediaWiki)
|
||||||
ginServer.Handle("POST", "/api/export/exportODT", model.CheckAuth, exportODT)
|
ginServer.Handle("POST", "/api/export/exportODT", model.CheckAuth, exportODT)
|
||||||
ginServer.Handle("POST", "/api/export/exportRTF", model.CheckAuth, exportRTF)
|
ginServer.Handle("POST", "/api/export/exportRTF", model.CheckAuth, exportRTF)
|
||||||
|
ginServer.Handle("POST", "/api/export/exportEPUB", model.CheckAuth, exportEPUB)
|
||||||
|
|
||||||
ginServer.Handle("POST", "/api/import/importStdMd", model.CheckAuth, model.CheckReadonly, importStdMd)
|
ginServer.Handle("POST", "/api/import/importStdMd", model.CheckAuth, model.CheckReadonly, importStdMd)
|
||||||
ginServer.Handle("POST", "/api/import/importData", model.CheckAuth, model.CheckReadonly, importData)
|
ginServer.Handle("POST", "/api/import/importData", model.CheckAuth, model.CheckReadonly, importData)
|
||||||
|
Loading…
Reference in New Issue
Block a user