An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Improve av https://github.com/siyuan-note/siyuan/issues/14511
Daniela0e98ea35d4d
diff --git a/kernel/av/av.go b/kernel/av/av.goindex 78f62a425d..207e9ac04b 100644--- a/kernel/av/av.go+++ b/kernel/av/av.go@@ -565,17 +565,19 @@ func (av *AttributeView) GetCurrentView(viewID string) (ret *View, err error) {}func (av *AttributeView) ExistBlock(blockID string) bool {- for _, kv := range av.KeyValues {- if KeyTypeBlock != kv.Key.Type {- continue+ for _, blockVal := range av.GetBlockKeyValues().Values {+ if blockVal.BlockID == blockID {+ return true}+ }+ return false+}- for _, v := range kv.Values {- if v.BlockID == blockID {- return true- }+func (av *AttributeView) ExistBoundBlock(nodeID string) bool {+ for _, blockVal := range av.GetBlockKeyValues().Values {+ if blockVal.Block.ID == nodeID {+ return true}- return false}return false}diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.goindex 264306d5c0..fd7e62ca83 100644--- a/kernel/model/attribute_view.go+++ b/kernel/model/attribute_view.go@@ -1289,9 +1289,7 @@ func GetBlockAttributeViewKeys(blockID string) (ret []*BlockAttributeViewKeys) {attrViewCache[avID] = attrView}- // TODO 待测试-- if !attrView.ExistBlock(blockID) {+ if !attrView.ExistBoundBlock(blockID) {// 比如剪切后粘贴,块 ID 会变,但是属性还在块上,这里做一次数据订正// Auto verify the database name when clicking the block superscript icon https://github.com/siyuan-note/siyuan/issues/10861unbindBlockAv(nil, avID, blockID)