mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-31 13:58:49 +01:00
🎨 Display the database title on the block superscript https://github.com/siyuan-note/siyuan/issues/10545
This commit is contained in:
parent
c61d412fea
commit
71b8ddb2e8
2 changed files with 6 additions and 29 deletions
|
|
@ -1695,23 +1695,18 @@ func setAttributeViewName(operation *Operation) (err error) {
|
|||
|
||||
nodes := getAttrViewBoundNodes(attrView)
|
||||
for _, node := range nodes {
|
||||
avNames := getAvNames(node.IALAttr(av.NodeAttrNameAvs))
|
||||
oldAttrs := parse.IAL2Map(node.KramdownIAL)
|
||||
avNames := getNodeIALAvNames(node)
|
||||
if "" == avNames {
|
||||
continue
|
||||
}
|
||||
node.SetIALAttr("av-names", avNames)
|
||||
pushBroadcastAttrTransactions(oldAttrs, node)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func getNodeIALAvNames(node *ast.Node) (ret string) {
|
||||
avIDs := parse.IAL2Map(node.KramdownIAL)[av.NodeAttrNameAvs]
|
||||
func getAvNames(avIDs string) (ret string) {
|
||||
if "" == avIDs {
|
||||
return
|
||||
}
|
||||
|
||||
avNames := bytes.Buffer{}
|
||||
nodeAvIDs := strings.Split(avIDs, ",")
|
||||
for _, nodeAvID := range nodeAvIDs {
|
||||
|
|
@ -2056,7 +2051,7 @@ func addAttributeViewBlock(avID, blockID, previousBlockID, addingBlockID string,
|
|||
attrs[av.NodeAttrNameAvs] = strings.Join(avIDs, ",")
|
||||
}
|
||||
|
||||
avNames := getNodeIALAvNames(node)
|
||||
avNames := getAvNames(attrs[av.NodeAttrNameAvs])
|
||||
if "" != avNames {
|
||||
attrs["av-names"] = avNames
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue