🎨 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

File diff suppressed because one or more lines are too long

View file

@ -9,7 +9,7 @@ require (
github.com/88250/clipboard v0.1.5
github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48
github.com/88250/gulu v1.2.3-0.20231209020950-b7b6994e395c
github.com/88250/lute v1.7.7-0.20240225141140-2acd83bfa5d5
github.com/88250/lute v1.7.7-0.20240308125612-93a1f4e75895
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
github.com/ClarkThan/ahocorasick v0.0.0-20231011042242-30d1ef1347f4

View file

@ -10,8 +10,8 @@ github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950 h1:Pa5hMiBceT
github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/88250/gulu v1.2.3-0.20231209020950-b7b6994e395c h1:Fas3hxqP33xA9KKDV50jUmppiiOukk5bdV00Hk5VSSk=
github.com/88250/gulu v1.2.3-0.20231209020950-b7b6994e395c/go.mod h1:pTWnjt+6qUqNnP9xltswsJxgCBVu3C7eW09u48LWX0k=
github.com/88250/lute v1.7.7-0.20240225141140-2acd83bfa5d5 h1:sUT5aPsnYCYjuNSnrx80JJdXOqHslw8KdmaSd/PrAPI=
github.com/88250/lute v1.7.7-0.20240225141140-2acd83bfa5d5/go.mod h1:+wUqx/1kdFDbWtxn9LYJlaCOAeol2pjSO6w+WJTVQsg=
github.com/88250/lute v1.7.7-0.20240308125612-93a1f4e75895 h1:9iQ0Hetjkl1iiqaHahe9uNEbg4z2WoRLLDDwvV45/JY=
github.com/88250/lute v1.7.7-0.20240308125612-93a1f4e75895/go.mod h1:+wUqx/1kdFDbWtxn9LYJlaCOAeol2pjSO6w+WJTVQsg=
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c h1:Dl/8S9iLyPMTElnWIBxmjaLiWrkI5P4a21ivwAn5pU0=
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c/go.mod h1:S5YT38L/GCjVjmB4PB84PymA1qfopjEhfhTNQilLpv4=
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=

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())
}
}