mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-21 14:34:06 +01:00
🎨 查询嵌入块支持设置是否显示面包屑 https://github.com/siyuan-note/siyuan/issues/6184
This commit is contained in:
parent
c5e3a6ecf4
commit
25432c6912
8 changed files with 25 additions and 8 deletions
|
|
@ -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) (block *Block, blockPaths []*BlockPath) {
|
||||
func getEmbeddedBlock(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)
|
||||
|
|
@ -434,8 +434,15 @@ 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 Conf.Editor.EmbedBlockBreadcrumb {
|
||||
blockPaths = buildBlockBreadcrumb(def)
|
||||
defBreadCrumb := def.IALAttr("breadcrumb")
|
||||
if "" != defBreadCrumb {
|
||||
if "true" == defBreadCrumb {
|
||||
blockPaths = buildBlockBreadcrumb(def)
|
||||
}
|
||||
} else {
|
||||
if Conf.Editor.EmbedBlockBreadcrumb {
|
||||
blockPaths = buildBlockBreadcrumb(def)
|
||||
}
|
||||
}
|
||||
if 1 > len(blockPaths) {
|
||||
blockPaths = []*BlockPath{}
|
||||
|
|
|
|||
|
|
@ -43,12 +43,12 @@ type EmbedBlock struct {
|
|||
BlockPaths []*BlockPath `json:"blockPaths"`
|
||||
}
|
||||
|
||||
func SearchEmbedBlock(stmt string, excludeIDs []string, headingMode int) (ret []*EmbedBlock) {
|
||||
func SearchEmbedBlock(stmt string, excludeIDs []string, headingMode int, breadcrumb bool) (ret []*EmbedBlock) {
|
||||
WaitForWritingFiles()
|
||||
return searchEmbedBlock(stmt, excludeIDs, headingMode)
|
||||
return searchEmbedBlock(stmt, excludeIDs, headingMode, breadcrumb)
|
||||
}
|
||||
|
||||
func searchEmbedBlock(stmt string, excludeIDs []string, headingMode int) (ret []*EmbedBlock) {
|
||||
func searchEmbedBlock(stmt string, excludeIDs []string, headingMode int, breadcrumb bool) (ret []*EmbedBlock) {
|
||||
sqlBlocks := sql.SelectBlocksRawStmtNoParse(stmt, Conf.Search.Limit)
|
||||
var tmp []*sql.Block
|
||||
for _, b := range sqlBlocks {
|
||||
|
|
@ -76,7 +76,7 @@ func searchEmbedBlock(stmt string, excludeIDs []string, headingMode int) (ret []
|
|||
}
|
||||
|
||||
for _, sb := range sqlBlocks {
|
||||
block, blockPaths := getEmbeddedBlock(trees, sb, headingMode)
|
||||
block, blockPaths := getEmbeddedBlock(trees, sb, headingMode, breadcrumb)
|
||||
if nil == block {
|
||||
continue
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue