🎨 位于超级块中的嵌入块不显示面包屑 Fix https://github.com/siyuan-note/siyuan/issues/6258

This commit is contained in:
Liang Ding 2022-10-18 20:41:20 +08:00
parent 4b84d6abd1
commit 6352273052
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
5 changed files with 22 additions and 9 deletions

View file

@ -381,7 +381,7 @@ func getBlock(id string) (ret *Block, err error) {
return
}
func getEmbeddedBlock(trees map[string]*parse.Tree, sqlBlock *sql.Block, headingMode int, breadcrumb bool) (block *Block, blockPaths []*BlockPath) {
func getEmbeddedBlock(embedBlockID string, trees map[string]*parse.Tree, sqlBlock *sql.Block, headingMode int, breadcrumb bool) (block *Block, blockPaths []*BlockPath) {
tree, _ := trees[sqlBlock.RootID]
if nil == tree {
tree, _ = loadTreeByBlockID(sqlBlock.RootID)
@ -393,6 +393,14 @@ func getEmbeddedBlock(trees map[string]*parse.Tree, sqlBlock *sql.Block, heading
if nil == def {
return
}
embedNodeTree, _ := loadTreeByBlockID(embedBlockID)
if nil == embedNodeTree {
return
}
embedNode := treenode.GetNodeInTree(embedNodeTree, embedBlockID)
if nil == embedNode {
return
}
var unlinks, nodes []*ast.Node
ast.Walk(def, func(n *ast.Node, entering bool) ast.WalkStatus {
@ -434,9 +442,12 @@ func getEmbeddedBlock(trees map[string]*parse.Tree, sqlBlock *sql.Block, heading
luteEngine.RenderOptions.ProtyleContenteditable = false // 不可编辑
dom := renderBlockDOMByNodes(nodes, luteEngine)
block = &Block{Box: def.Box, Path: def.Path, HPath: b.HPath, ID: def.ID, Type: def.Type.String(), Content: dom}
if breadcrumb {
blockPaths = buildBlockBreadcrumb(def)
// 位于超级块中的嵌入块不显示面包屑 https://github.com/siyuan-note/siyuan/issues/6258
inSuperBlock := embedNode.ParentIs(ast.NodeSuperBlock)
if breadcrumb && !inSuperBlock {
blockPaths = buildBlockBreadcrumb(def)
}
if 1 > len(blockPaths) {
blockPaths = []*BlockPath{}