Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Support modifying the primary key value of the binding block https://github.com/siyuan-note/siyuan/issues/9892

Daniel2b201abb80a0
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go
index a4e34724f0..04327f2dee 100644
--- a/kernel/model/attribute_view.go
+++ b/kernel/model/attribute_view.go
@@ -1710,12 +1710,6 @@ func replaceAttributeViewBlock(operation *Operation, tx *Transaction) (err error
for _, v := range attrView.Views {
switch v.LayoutType {
case av.LayoutTypeTable:
- for _, rowID := range v.Table.RowIDs {
- if rowID == operation.NextID {
- return
- }
- }
-
for i, rowID := range v.Table.RowIDs {
if rowID == operation.PreviousID {
v.Table.RowIDs[i] = operation.NextID
@@ -1800,7 +1794,10 @@ func UpdateAttributeViewCell(tx *Transaction, avID, keyID, rowID, cellID string,
unbindBlockAv(tx, avID, oldBoundBlockID)
bindBlockAv(tx, avID, val.BlockID)
} else { // 之前绑定的块和现在绑定的块一样
- // 直接返回,因为锚文本不允许更改
+ if av.KeyTypeBlock == val.Type && nil != val.Block {
+ // 直接返回,因为锚文本不允许更改
+ return
+ }
}
}
}
@@ -1811,6 +1808,7 @@ func UpdateAttributeViewCell(tx *Transaction, avID, keyID, rowID, cellID string,
if rowID == v.Block.ID {
v.Block.Updated = time.Now().UnixMilli()
v.IsInitialized = true
+ v.IsDetached = val.IsDetached
break
}
}