🎨 Supports searching database blocks by the view title https://github.com/siyuan-note/siyuan/issues/9348

This commit is contained in:
Daniel 2023-10-05 12:02:17 +08:00
parent cf154dcaa1
commit d38311c48c
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
5 changed files with 40 additions and 28 deletions

View file

@ -18,6 +18,7 @@ package treenode
import (
"bytes"
"github.com/siyuan-note/siyuan/kernel/av"
"strings"
"sync"
@ -139,6 +140,19 @@ func NodeStaticContent(node *ast.Node, excludeTypes []string, includeTextMarkATi
if ast.NodeDocument == node.Type {
return node.IALAttr("title")
} else if ast.NodeAttributeView == node.Type {
if "" != node.AttributeViewID {
attrView, err := av.ParseAttributeView(node.AttributeViewID)
if nil == err {
buf := bytes.Buffer{}
for _, v := range attrView.Views {
buf.WriteString(v.Name)
buf.WriteString(" ")
}
return strings.TrimSpace(buf.String())
}
}
return ""
}
buf := bytes.Buffer{}