🎨 调用 API setBlockAttrs 后推送 Transaction Fix https://github.com/siyuan-note/siyuan/issues/5847

自定义属性更改与删除异常 Fix https://github.com/siyuan-note/siyuan/issues/5841
This commit is contained in:
Liang Ding 2022-09-09 11:03:37 +08:00
parent cc52aff0cb
commit f15361bdd7
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 22 additions and 11 deletions

View file

@ -904,17 +904,6 @@ func (tx *Transaction) doUpdate(operation *Operation) (ret *TxErr) {
treenode.MoveFoldHeading(updatedNode, oldNode)
}
// 挂件移动或设置大小后属性丢失 https://github.com/siyuan-note/siyuan/issues/4885
// 这里需要把旧节点的属性复制到新节点上,避免属性丢失
oldIAL := parse.IAL2Map(oldNode.KramdownIAL)
newIAL := parse.IAL2Map(updatedNode.KramdownIAL)
for oldIALKey, oldIALVal := range oldIAL {
if strings.HasPrefix(oldIALKey, "custom-") {
newIAL[oldIALKey] = oldIALVal
}
}
updatedNode.KramdownIAL = parse.Map2IAL(newIAL)
cache.PutBlockIAL(updatedNode.ID, parse.IAL2Map(updatedNode.KramdownIAL))
// 替换为新节点