🎨 Display the database title on the block superscript https://github.com/siyuan-note/siyuan/issues/10545

This commit is contained in:
Daniel 2024-03-08 21:17:38 +08:00
parent cc8841cc8c
commit 00a8703191
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
4 changed files with 13 additions and 9 deletions

View file

@ -734,7 +734,7 @@ func GetDoc(startID, endID, id string, index int, query string, queryTypes map[s
}
if avs := n.IALAttr(av.NodeAttrNameAvs); "" != avs {
// 填充属性视图名称
// 填充属性视图角标 Display the database title on the block superscript https://github.com/siyuan-note/siyuan/issues/10545
avNames := bytes.Buffer{}
avIDs := strings.Split(avs, ",")
for _, avID := range avIDs {
@ -746,11 +746,15 @@ func GetDoc(startID, endID, id string, index int, query string, queryTypes map[s
if "" == avName {
avName = "Untitled"
}
avNames.WriteString(avName)
avNames.WriteString(",")
tpl := `<span data-av-id="${avID}" data-popover-url="/api/av/getMirrorDatabaseBlocks" class="popover__block">${avName}</span>`
tpl = strings.ReplaceAll(tpl, "${avID}", avID)
tpl = strings.ReplaceAll(tpl, "${avName}", avName)
avNames.WriteString(tpl)
avNames.WriteString("&nbsp;")
}
if 0 < avNames.Len() {
avNames.Truncate(avNames.Len() - 1)
avNames.Truncate(avNames.Len() - 6)
n.SetIALAttr("av-names", avNames.String())
}
}