🎨 New a row in the database no longer require to create a relevant doc https://github.com/siyuan-note/siyuan/issues/9294

This commit is contained in:
Daniel 2023-09-28 00:15:46 +08:00
parent 26db301a12
commit ddffc27745
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
3 changed files with 22 additions and 10 deletions

View file

@ -26,6 +26,7 @@ import (
"unicode/utf8"
"github.com/88250/gulu"
"github.com/88250/lute/ast"
"github.com/gin-gonic/gin"
"github.com/siyuan-note/siyuan/kernel/filesys"
"github.com/siyuan-note/siyuan/kernel/model"
@ -481,6 +482,12 @@ func createDocWithMd(c *gin.Context) {
parentID = parentIDArg.(string)
}
id := ast.NewNodeID()
idArg := arg["id"]
if nil != idArg {
id = idArg.(string)
}
hPath := arg["path"].(string)
markdown := arg["markdown"].(string)
@ -496,7 +503,7 @@ func createDocWithMd(c *gin.Context) {
hPath = "/" + hPath
}
id, err := model.CreateWithMarkdown(notebook, hPath, markdown, parentID)
err := model.CreateWithMarkdown(notebook, hPath, markdown, parentID, id)
if nil != err {
ret.Code = -1
ret.Msg = err.Error()