Forráskód Böngészése

:art: Display database title in bookmark panel https://github.com/siyuan-note/siyuan/issues/11666

Daniel 1 éve
szülő
commit
511a4bdd8a
3 módosított fájl, 9 hozzáadás és 3 törlés
  1. 1 1
      kernel/go.mod
  2. 2 2
      kernel/go.sum
  3. 6 0
      kernel/model/bookmark.go

+ 1 - 1
kernel/go.mod

@@ -7,7 +7,7 @@ require (
 	github.com/88250/clipboard v0.1.5
 	github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48
 	github.com/88250/go-humanize v0.0.0-20240424102817-4f78fac47ea7
-	github.com/88250/gulu v1.2.3-0.20240505150113-bc43bd50f866
+	github.com/88250/gulu v1.2.3-0.20240612021457-b8e8cadd87f3
 	github.com/88250/lute v1.7.7-0.20240611024745-53a7d0cc6568
 	github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c
 	github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1

+ 2 - 2
kernel/go.sum

@@ -10,8 +10,8 @@ github.com/88250/go-humanize v0.0.0-20240424102817-4f78fac47ea7 h1:MafIFwSS0x6A4
 github.com/88250/go-humanize v0.0.0-20240424102817-4f78fac47ea7/go.mod h1:HrKCCTin3YNDSLBD02K0AOljjV6eNwc3/zyEI+xyV1I=
 github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950 h1:Pa5hMiBceTVVqrYaDlLio2QSKbXMUmAZPbzCwT5eNCw=
 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.20240505150113-bc43bd50f866 h1:RFfNFS0hv6TbOuwET6xZAfGlV4hNlXiWTnfbLN1eF6k=
-github.com/88250/gulu v1.2.3-0.20240505150113-bc43bd50f866/go.mod h1:MUfzyfmbPrRDZLqxc7aPrVYveatTHRfoUa5TynPS0i8=
+github.com/88250/gulu v1.2.3-0.20240612021457-b8e8cadd87f3 h1:vgVJ0e9hrdEpHOkKcSe45+ht1+O13PWi2ssq8yDVAvQ=
+github.com/88250/gulu v1.2.3-0.20240612021457-b8e8cadd87f3/go.mod h1:MUfzyfmbPrRDZLqxc7aPrVYveatTHRfoUa5TynPS0i8=
 github.com/88250/lute v1.7.7-0.20240611024745-53a7d0cc6568 h1:1TwBQATNCmPi4XvEZReYDam8aouz3DZPXUciciTITdg=
 github.com/88250/lute v1.7.7-0.20240611024745-53a7d0cc6568/go.mod h1:VDAzL8b+oCh+e3NAlmwwLzC53ten0rZlS8NboB7ljtk=
 github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c h1:Dl/8S9iLyPMTElnWIBxmjaLiWrkI5P4a21ivwAn5pU0=

+ 6 - 0
kernel/model/bookmark.go

@@ -22,8 +22,10 @@ import (
 	"sort"
 	"strings"
 
+	"github.com/88250/gulu"
 	"github.com/88250/lute/parse"
 	"github.com/siyuan-note/logging"
+	"github.com/siyuan-note/siyuan/kernel/av"
 	"github.com/siyuan-note/siyuan/kernel/cache"
 	"github.com/siyuan-note/siyuan/kernel/sql"
 	"github.com/siyuan-note/siyuan/kernel/treenode"
@@ -171,6 +173,10 @@ func BuildBookmark() (ret *Bookmarks) {
 		if "" != block.Name {
 			// Blocks in the bookmark panel display their name instead of content https://github.com/siyuan-note/siyuan/issues/8514
 			block.Content = block.Name
+		} else if "NodeAttributeView" == block.Type {
+			// Display database title in bookmark panel https://github.com/siyuan-note/siyuan/issues/11666
+			avID := gulu.Str.SubStringBetween(block.Markdown, "av-id=\"", "\"")
+			block.Content, _ = av.GetAttributeViewName(avID)
 		} else {
 			// Improve bookmark panel rendering https://github.com/siyuan-note/siyuan/issues/9361
 			tree, err := LoadTreeByBlockID(block.ID)