mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 当自定义排序时支持在文档上/下新建同级文档 https://github.com/siyuan-note/siyuan/issues/5098
This commit is contained in:
parent
d4602433c5
commit
b40b460f0c
2 changed files with 16 additions and 3 deletions
|
|
@ -342,8 +342,15 @@ func createDoc(c *gin.Context) {
|
|||
p := arg["path"].(string)
|
||||
title := arg["title"].(string)
|
||||
md := arg["md"].(string)
|
||||
sortsArg := arg["sorts"]
|
||||
var sorts []string
|
||||
if nil != sortsArg {
|
||||
for _, sort := range sortsArg.([]interface{}) {
|
||||
sorts = append(sorts, sort.(string))
|
||||
}
|
||||
}
|
||||
|
||||
err := model.CreateDocByMd(notebook, p, title, md)
|
||||
err := model.CreateDocByMd(notebook, p, title, md, sorts)
|
||||
if nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
|
|
|
|||
|
|
@ -920,7 +920,7 @@ func DuplicateDoc(rootID string) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func CreateDocByMd(boxID, p, title, md string) (err error) {
|
||||
func CreateDocByMd(boxID, p, title, md string, sorts []string) (err error) {
|
||||
WaitForWritingFiles()
|
||||
|
||||
box := Conf.Box(boxID)
|
||||
|
|
@ -930,7 +930,13 @@ func CreateDocByMd(boxID, p, title, md string) (err error) {
|
|||
|
||||
luteEngine := NewLute()
|
||||
dom := luteEngine.Md2BlockDOM(md)
|
||||
return createDoc(box.ID, p, title, dom)
|
||||
err = createDoc(box.ID, p, title, dom)
|
||||
if nil != err {
|
||||
return
|
||||
}
|
||||
|
||||
ChangeFileTreeSort(box.ID, sorts)
|
||||
return
|
||||
}
|
||||
|
||||
func CreateWithMarkdown(boxID, hPath, md string) (id string, err error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue