mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-18 07:30:12 +01:00
🎨 Database-bound block primary key supports setting static anchor text https://github.com/siyuan-note/siyuan/issues/10049
This commit is contained in:
parent
78745006a7
commit
bd91c04eeb
1 changed files with 8 additions and 7 deletions
|
|
@ -3107,20 +3107,17 @@ func UpdateAttributeViewCell(tx *Transaction, avID, keyID, rowID string, valueDa
|
||||||
bindBlockAv(tx, avID, val.BlockID)
|
bindBlockAv(tx, avID, val.BlockID)
|
||||||
} else { // 之前绑定的块和现在绑定的块一样
|
} else { // 之前绑定的块和现在绑定的块一样
|
||||||
content := strings.TrimSpace(val.Block.Content)
|
content := strings.TrimSpace(val.Block.Content)
|
||||||
node, tree, getErr := getNodeByBlockID(tx, val.BlockID)
|
node, tree, _ := getNodeByBlockID(tx, val.BlockID)
|
||||||
if "" == content {
|
if "" == content {
|
||||||
_, val.Block.Content = getNodeAvBlockText(node)
|
_, val.Block.Content = getNodeAvBlockText(node)
|
||||||
} else {
|
}
|
||||||
|
|
||||||
// 设置静态锚文本 Database-bound block primary key supports setting static anchor text https://github.com/siyuan-note/siyuan/issues/10049
|
// 设置静态锚文本 Database-bound block primary key supports setting static anchor text https://github.com/siyuan-note/siyuan/issues/10049
|
||||||
if nil != getErr || nil == node {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
updateBlockValueStaticText(tx, node, tree, avID, content)
|
updateBlockValueStaticText(tx, node, tree, avID, content)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if nil != blockVal {
|
if nil != blockVal {
|
||||||
blockVal.Block.Updated = now
|
blockVal.Block.Updated = now
|
||||||
|
|
@ -3286,6 +3283,10 @@ func bindBlockAv0(tx *Transaction, avID string, node *ast.Node, tree *parse.Tree
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateBlockValueStaticText(tx *Transaction, node *ast.Node, tree *parse.Tree, avID, text string) {
|
func updateBlockValueStaticText(tx *Transaction, node *ast.Node, tree *parse.Tree, avID, text string) {
|
||||||
|
if nil == node {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
attrs := parse.IAL2Map(node.KramdownIAL)
|
attrs := parse.IAL2Map(node.KramdownIAL)
|
||||||
attrs[av.NodeAttrViewStaticText+"-"+avID] = text
|
attrs[av.NodeAttrViewStaticText+"-"+avID] = text
|
||||||
var err error
|
var err error
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue