mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 01:50:12 +01:00
⚡ 改进多个功能点的性能 https://github.com/siyuan-note/siyuan/issues/7177
This commit is contained in:
parent
5da5ae8818
commit
2b09ea75f0
7 changed files with 56 additions and 63 deletions
|
|
@ -327,7 +327,7 @@ func duplicateDoc(c *gin.Context) {
|
|||
}
|
||||
|
||||
id := arg["id"].(string)
|
||||
newTree, err := model.DuplicateDoc(id)
|
||||
tree, err := model.LoadTreeByID(id)
|
||||
if nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
|
|
@ -335,24 +335,17 @@ func duplicateDoc(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
block, _ := model.GetBlock(id)
|
||||
p := block.Path
|
||||
notebook := block.Box
|
||||
p := tree.Path
|
||||
notebook := tree.Box
|
||||
box := model.Conf.Box(notebook)
|
||||
tree, err := model.LoadTree(box.ID, p)
|
||||
if nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
|
||||
model.DuplicateDoc(tree)
|
||||
pushCreate(box, p, tree.Root.ID, arg)
|
||||
|
||||
ret.Data = map[string]interface{}{
|
||||
"id": newTree.Root.ID,
|
||||
"id": tree.Root.ID,
|
||||
"notebook": notebook,
|
||||
"path": newTree.Path,
|
||||
"hPath": newTree.HPath,
|
||||
"path": tree.Path,
|
||||
"hPath": tree.HPath,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -478,7 +471,7 @@ func createDocWithMd(c *gin.Context) {
|
|||
ret.Data = id
|
||||
|
||||
box := model.Conf.Box(notebook)
|
||||
b, _ := model.GetBlock(id)
|
||||
b, _ := model.GetBlock(id, nil)
|
||||
p := b.Path
|
||||
pushCreate(box, p, id, arg)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue