|
@@ -23,6 +23,7 @@ import (
|
|
"strings"
|
|
"strings"
|
|
|
|
|
|
"github.com/88250/lute/parse"
|
|
"github.com/88250/lute/parse"
|
|
|
|
+ "github.com/siyuan-note/logging"
|
|
"github.com/siyuan-note/siyuan/kernel/cache"
|
|
"github.com/siyuan-note/siyuan/kernel/cache"
|
|
"github.com/siyuan-note/siyuan/kernel/sql"
|
|
"github.com/siyuan-note/siyuan/kernel/sql"
|
|
"github.com/siyuan-note/siyuan/kernel/treenode"
|
|
"github.com/siyuan-note/siyuan/kernel/treenode"
|
|
@@ -162,16 +163,26 @@ func BuildBookmark() (ret *Bookmarks) {
|
|
|
|
|
|
ret = &Bookmarks{}
|
|
ret = &Bookmarks{}
|
|
sqlBlocks := sql.QueryBookmarkBlocks()
|
|
sqlBlocks := sql.QueryBookmarkBlocks()
|
|
|
|
+
|
|
labelBlocks := map[BookmarkLabel]BookmarkBlocks{}
|
|
labelBlocks := map[BookmarkLabel]BookmarkBlocks{}
|
|
blocks := fromSQLBlocks(&sqlBlocks, "", 0)
|
|
blocks := fromSQLBlocks(&sqlBlocks, "", 0)
|
|
|
|
+ luteEngine := NewLute()
|
|
for _, block := range blocks {
|
|
for _, block := range blocks {
|
|
- label := BookmarkLabel(block.IAL["bookmark"])
|
|
|
|
-
|
|
|
|
if "" != block.Name {
|
|
if "" != block.Name {
|
|
// Blocks in the bookmark panel display their name instead of content https://github.com/siyuan-note/siyuan/issues/8514
|
|
// Blocks in the bookmark panel display their name instead of content https://github.com/siyuan-note/siyuan/issues/8514
|
|
block.Content = block.Name
|
|
block.Content = block.Name
|
|
|
|
+ } else {
|
|
|
|
+ // Improve bookmark panel rendering https://github.com/siyuan-note/siyuan/issues/9361
|
|
|
|
+ tree, err := loadTreeByBlockID(block.ID)
|
|
|
|
+ if nil != err {
|
|
|
|
+ logging.LogErrorf("parse block [%s] failed: %s", block.ID, err)
|
|
|
|
+ } else {
|
|
|
|
+ n := treenode.GetNodeInTree(tree, block.ID)
|
|
|
|
+ block.Content = renderOutline(n, luteEngine)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ label := BookmarkLabel(block.IAL["bookmark"])
|
|
if bs, ok := labelBlocks[label]; ok {
|
|
if bs, ok := labelBlocks[label]; ok {
|
|
bs = append(bs, block)
|
|
bs = append(bs, block)
|
|
labelBlocks[label] = bs
|
|
labelBlocks[label] = bs
|