mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-16 09:00:42 +08:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
c9b9761730
@ -649,6 +649,7 @@ func GetBlockAttributeViewKeys(blockID string) (ret []*BlockAttributeViewKeys) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 字段排序
|
// 字段排序
|
||||||
|
refreshAttrViewKeyIDs(attrView)
|
||||||
sorts := map[string]int{}
|
sorts := map[string]int{}
|
||||||
for i, k := range attrView.KeyIDs {
|
for i, k := range attrView.KeyIDs {
|
||||||
sorts[k] = i
|
sorts[k] = i
|
||||||
@ -2449,11 +2450,7 @@ func SortAttributeViewKey(avID, keyID, previousKeyID string) (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if 1 > len(attrView.KeyIDs) {
|
refreshAttrViewKeyIDs(attrView)
|
||||||
for _, keyValues := range attrView.KeyValues {
|
|
||||||
attrView.KeyIDs = append(attrView.KeyIDs, keyValues.Key.ID)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var currentKeyID string
|
var currentKeyID string
|
||||||
var idx, previousIndex int
|
var idx, previousIndex int
|
||||||
@ -2482,6 +2479,29 @@ func SortAttributeViewKey(avID, keyID, previousKeyID string) (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func refreshAttrViewKeyIDs(attrView *av.AttributeView) {
|
||||||
|
// 订正 keyIDs 数据
|
||||||
|
|
||||||
|
existKeyIDs := map[string]bool{}
|
||||||
|
for _, keyValues := range attrView.KeyValues {
|
||||||
|
existKeyIDs[keyValues.Key.ID] = true
|
||||||
|
}
|
||||||
|
|
||||||
|
for k, _ := range existKeyIDs {
|
||||||
|
if !gulu.Str.Contains(k, attrView.KeyIDs) {
|
||||||
|
attrView.KeyIDs = append(attrView.KeyIDs, k)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var tmp []string
|
||||||
|
for _, k := range attrView.KeyIDs {
|
||||||
|
if ok := existKeyIDs[k]; ok {
|
||||||
|
tmp = append(tmp, k)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
attrView.KeyIDs = tmp
|
||||||
|
}
|
||||||
|
|
||||||
func (tx *Transaction) doAddAttrViewColumn(operation *Operation) (ret *TxErr) {
|
func (tx *Transaction) doAddAttrViewColumn(operation *Operation) (ret *TxErr) {
|
||||||
var icon string
|
var icon string
|
||||||
if nil != operation.Data {
|
if nil != operation.Data {
|
||||||
|
@ -312,6 +312,25 @@ func ImportSY(zipPath, boxID, toPath string) (err error) {
|
|||||||
attrViewIDs = append(attrViewIDs, avID)
|
attrViewIDs = append(attrViewIDs, avID)
|
||||||
}
|
}
|
||||||
updateBoundBlockAvsAttribute(attrViewIDs)
|
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 中
|
// 将关联的闪卡数据合并到默认卡包 data/storage/riff/20230218211946-2kw8jgx 中
|
||||||
|
Loading…
Reference in New Issue
Block a user