mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 09:00:12 +01:00
🐛 The new database entry after binding block is lost in some cases https://github.com/siyuan-note/siyuan/issues/11269
This commit is contained in:
parent
cf23dea440
commit
7b2d8c8bd0
1 changed files with 7 additions and 9 deletions
|
|
@ -33,13 +33,16 @@ import (
|
||||||
"github.com/siyuan-note/siyuan/kernel/util"
|
"github.com/siyuan-note/siyuan/kernel/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
func createDocsByHPath(boxID, hPath, content, parentID, id string /* id 参数仅在 parentID 不为空的情况下使用 */) (retID string, err error) {
|
func createDocsByHPath(boxID, hPath, content, parentID, id string) (retID string, err error) {
|
||||||
hPath = strings.TrimSuffix(hPath, ".sy")
|
if "" == id {
|
||||||
if "" != parentID {
|
id = ast.NewNodeID()
|
||||||
|
}
|
||||||
retID = id
|
retID = id
|
||||||
|
|
||||||
|
hPath = strings.TrimSuffix(hPath, ".sy")
|
||||||
|
if "" != parentID {
|
||||||
// The save path is incorrect when creating a sub-doc by ref in a doc with the same name https://github.com/siyuan-note/siyuan/issues/8138
|
// The save path is incorrect when creating a sub-doc by ref in a doc with the same name https://github.com/siyuan-note/siyuan/issues/8138
|
||||||
// 在指定父文档 ID 的情况下优先查找父文档
|
// 在指定了父文档 ID 的情况下优先查找父文档
|
||||||
parentHPath, name := path.Split(hPath)
|
parentHPath, name := path.Split(hPath)
|
||||||
parentHPath = strings.TrimSuffix(parentHPath, "/")
|
parentHPath = strings.TrimSuffix(parentHPath, "/")
|
||||||
preferredParent := treenode.GetBlockTreeRootByHPathPreferredParentID(boxID, parentHPath, parentID)
|
preferredParent := treenode.GetBlockTreeRootByHPathPreferredParentID(boxID, parentHPath, parentID)
|
||||||
|
|
@ -51,11 +54,6 @@ func createDocsByHPath(boxID, hPath, content, parentID, id string /* id 参数
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
retID = ast.NewNodeID()
|
|
||||||
if "" == id {
|
|
||||||
id = retID
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
root := treenode.GetBlockTreeRootByPath(boxID, hPath)
|
root := treenode.GetBlockTreeRootByPath(boxID, hPath)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue