🎨 Preview mode supports jumping through the outline panel https://github.com/siyuan-note/siyuan/issues/3059

This commit is contained in:
Daniel 2023-06-17 15:49:16 +08:00
parent 78ff4a0963
commit f4982d2cd6
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
7 changed files with 28 additions and 14 deletions

View file

@ -25,6 +25,7 @@ import (
"strings"
"github.com/88250/lute/ast"
"github.com/88250/lute/parse"
"github.com/siyuan-note/logging"
"github.com/siyuan-note/siyuan/kernel/search"
"github.com/siyuan-note/siyuan/kernel/sql"
@ -99,12 +100,12 @@ func createDocsByHPath(boxID, hPath, content, parentID string) (id string, exist
return
}
func toFlatTree(blocks []*Block, baseDepth int, typ string) (ret []*Path) {
func toFlatTree(blocks []*Block, baseDepth int, typ string, tree *parse.Tree) (ret []*Path) {
var blockRoots []*Block
for _, block := range blocks {
root := getBlockIn(blockRoots, block.RootID)
if nil == root {
root, _ = getBlock(block.RootID, nil)
root, _ = getBlock(block.RootID, tree)
blockRoots = append(blockRoots, root)
}
if nil == root {