From 1eb824ef8ec57f0e1d78fb56b262210933b7a708 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sun, 10 Aug 2025 16:22:10 +0800 Subject: [PATCH] :art: Improve av https://github.com/siyuan-note/siyuan/issues/14511 --- kernel/model/attribute_view.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index becf6b2dd..d44555617 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -3938,9 +3938,25 @@ func replaceAttributeViewBlock(avID, oldBlockID, newBlockID string, isDetached b func replaceAttributeViewBlock0(attrView *av.AttributeView, oldBlockID, newBlockID string, isDetached bool, tx *Transaction) (err error) { avID := attrView.ID + var tree *parse.Tree var node *ast.Node if !isDetached { - node, _, _ = getNodeByBlockID(tx, newBlockID) + node, tree, _ = getNodeByBlockID(tx, newBlockID) + } + + now := util.CurrentTimeMillis() + // 检查是否已经存在绑定块,如果存在的话则重新绑定 + for _, blockVal := range attrView.GetBlockKeyValues().Values { + if !isDetached && blockVal.Block.ID == newBlockID && nil != node && nil != tree { + bindBlockAv0(tx, avID, node, tree) + blockVal.IsDetached = false + icon, content := getNodeAvBlockText(node) + content = util.UnescapeHTML(content) + blockVal.Block.Icon, blockVal.Block.Content = icon, content + blockVal.UpdatedAt = now + regenAttrViewGroups(attrView, "force") + return + } } var changedAvIDs []string