mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-22 00:06:09 +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
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"breadcrumb": "Breadcrumb",
|
||||
"embedBlockBreadcrumb": "Embed Block Breadcrumb",
|
||||
"embedBlockBreadcrumbTip": "After enabling embed block will show breadcrumbs",
|
||||
"appearanceMode": "Appearance Mode",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"miga de pan": "Miga de pan",
|
||||
"embedBlockBreadcrumb": "Incrustar migas de pan de bloque",
|
||||
"embedBlockBreadcrumbTip": "Después de habilitar el bloque incrustado, se mostrarán migas de pan",
|
||||
"appearanceMode": "Modo de apariencia",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"fil d'Ariane": "Fil d'Ariane",
|
||||
"embedBlockBreadcrumb": "Intégrer le fil d'Ariane du bloc",
|
||||
"embedBlockBreadcrumbTip": "Après avoir activé le bloc d'intégration, le fil d'Ariane s'affichera",
|
||||
"appearanceMode": "Mode d'apparence",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"breadcrumb": "麵包屑",
|
||||
"embedBlockBreadcrumb": "嵌入塊麵包屑",
|
||||
"embedBlockBreadcrumbTip": "啟用後嵌入塊將顯示麵包屑",
|
||||
"appearanceMode": "外觀模式",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"breadcrumb": "面包屑",
|
||||
"embedBlockBreadcrumb": "嵌入块面包屑",
|
||||
"embedBlockBreadcrumbTip": "启用后嵌入块将显示面包屑",
|
||||
"appearanceMode": "外观模式",
|
||||
|
|
|
|||
|
|
@ -138,8 +138,13 @@ func searchEmbedBlock(c *gin.Context) {
|
|||
if nil != headingModeArg {
|
||||
headingMode = int(headingModeArg.(float64))
|
||||
}
|
||||
breadcrumb := false
|
||||
breadcrumbArg := arg["breadcrumb"]
|
||||
if nil != breadcrumbArg {
|
||||
breadcrumb = breadcrumbArg.(bool)
|
||||
}
|
||||
|
||||
blocks := model.SearchEmbedBlock(stmt, excludeIDs, headingMode)
|
||||
blocks := model.SearchEmbedBlock(stmt, excludeIDs, headingMode, breadcrumb)
|
||||
ret.Data = map[string]interface{}{
|
||||
"blocks": blocks,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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