mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 09:00:12 +01:00
🎨 Improve av https://github.com/siyuan-note/siyuan/issues/14511
This commit is contained in:
parent
a0e98ea35d
commit
4154fd0150
1 changed files with 1 additions and 22 deletions
|
|
@ -3939,29 +3939,8 @@ func replaceAttributeViewBlock(avID, oldBlockID, newBlockID string, isDetached b
|
||||||
func replaceAttributeViewBlock0(attrView *av.AttributeView, oldBlockID, newBlockID string, isDetached bool, tx *Transaction) (err error) {
|
func replaceAttributeViewBlock0(attrView *av.AttributeView, oldBlockID, newBlockID string, isDetached bool, tx *Transaction) (err error) {
|
||||||
avID := attrView.ID
|
avID := attrView.ID
|
||||||
var node *ast.Node
|
var node *ast.Node
|
||||||
var tree *parse.Tree
|
|
||||||
if !isDetached {
|
if !isDetached {
|
||||||
node, tree, _ = getNodeByBlockID(tx, newBlockID)
|
node, _, _ = getNodeByBlockID(tx, newBlockID)
|
||||||
}
|
|
||||||
|
|
||||||
now := util.CurrentTimeMillis()
|
|
||||||
// 检查是否已经存在绑定块,如果存在的话则重新绑定
|
|
||||||
for _, keyValues := range attrView.KeyValues {
|
|
||||||
for _, value := range keyValues.Values {
|
|
||||||
if av.KeyTypeBlock == value.Type && nil != value.Block && value.Block.ID == newBlockID {
|
|
||||||
if !isDetached {
|
|
||||||
bindBlockAv0(tx, avID, node, tree)
|
|
||||||
value.IsDetached = false
|
|
||||||
icon, content := getNodeAvBlockText(node)
|
|
||||||
content = util.UnescapeHTML(content)
|
|
||||||
value.Block.Icon, value.Block.Content = icon, content
|
|
||||||
value.UpdatedAt = now
|
|
||||||
regenAttrViewGroups(attrView, "force")
|
|
||||||
err = av.SaveAttributeView(attrView)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var changedAvIDs []string
|
var changedAvIDs []string
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue