mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-28 04:18:48 +01:00
🎨 The database-bound block is automatically added to the database after being copied as a replica https://github.com/siyuan-note/siyuan/issues/11959
This commit is contained in:
parent
74c6b9ba00
commit
9cc334698b
4 changed files with 23 additions and 6 deletions
|
|
@ -1093,9 +1093,24 @@ func DuplicateDoc(tree *parse.Tree) {
|
|||
msgId := util.PushMsg(Conf.Language(116), 30000)
|
||||
defer util.PushClearMsg(msgId)
|
||||
|
||||
resetTree(tree, "Duplicated")
|
||||
previousID := tree.Root.ID
|
||||
resetTree(tree, "Duplicated", false)
|
||||
createTreeTx(tree)
|
||||
WaitForWritingFiles()
|
||||
|
||||
// 复制为副本时将该副本块插入到数据库中 https://github.com/siyuan-note/siyuan/issues/11959
|
||||
avs := tree.Root.IALAttr(av.NodeAttrNameAvs)
|
||||
for _, avID := range strings.Split(avs, ",") {
|
||||
if !ast.IsNodeIDPattern(avID) {
|
||||
continue
|
||||
}
|
||||
|
||||
AddAttributeViewBlock(nil, []map[string]interface{}{{
|
||||
"id": tree.Root.ID,
|
||||
"isDetached": false,
|
||||
}}, avID, "", previousID, false)
|
||||
util.PushReloadAttrView(avID)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue