diff --git a/kernel/model/import.go b/kernel/model/import.go index 583f06c49..6d09ed4ad 100644 --- a/kernel/model/import.go +++ b/kernel/model/import.go @@ -312,6 +312,25 @@ func ImportSY(zipPath, boxID, toPath string) (err error) { attrViewIDs = append(attrViewIDs, avID) } updateBoundBlockAvsAttribute(attrViewIDs) + + // 插入关联关系 https://github.com/siyuan-note/siyuan/issues/11628 + relationAvs := map[string]string{} + for _, avID := range avIDs { + attrView, _ := av.ParseAttributeView(avID) + if nil == attrView { + continue + } + + for _, keyValues := range attrView.KeyValues { + if nil != keyValues.Key && av.KeyTypeRelation == keyValues.Key.Type && nil != keyValues.Key.Relation { + relationAvs[avID] = keyValues.Key.Relation.AvID + } + } + } + + for srcAvID, destAvID := range relationAvs { + av.UpsertAvBackRel(srcAvID, destAvID) + } } // 将关联的闪卡数据合并到默认卡包 data/storage/riff/20230218211946-2kw8jgx 中