mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-18 04:58:06 +01:00
🎨 Supports searching database blocks by the view title https://github.com/siyuan-note/siyuan/issues/9348
This commit is contained in:
parent
5e38fe4335
commit
3c67701681
9 changed files with 73 additions and 41 deletions
|
|
@ -25,18 +25,19 @@ import (
|
|||
)
|
||||
|
||||
type Search struct {
|
||||
Document bool `json:"document"`
|
||||
Heading bool `json:"heading"`
|
||||
List bool `json:"list"`
|
||||
ListItem bool `json:"listItem"`
|
||||
CodeBlock bool `json:"codeBlock"`
|
||||
MathBlock bool `json:"mathBlock"`
|
||||
Table bool `json:"table"`
|
||||
Blockquote bool `json:"blockquote"`
|
||||
SuperBlock bool `json:"superBlock"`
|
||||
Paragraph bool `json:"paragraph"`
|
||||
HTMLBlock bool `json:"htmlBlock"`
|
||||
EmbedBlock bool `json:"embedBlock"`
|
||||
Document bool `json:"document"`
|
||||
Heading bool `json:"heading"`
|
||||
List bool `json:"list"`
|
||||
ListItem bool `json:"listItem"`
|
||||
CodeBlock bool `json:"codeBlock"`
|
||||
MathBlock bool `json:"mathBlock"`
|
||||
Table bool `json:"table"`
|
||||
Blockquote bool `json:"blockquote"`
|
||||
SuperBlock bool `json:"superBlock"`
|
||||
Paragraph bool `json:"paragraph"`
|
||||
HTMLBlock bool `json:"htmlBlock"`
|
||||
EmbedBlock bool `json:"embedBlock"`
|
||||
DatabaseBlock bool `json:"databaseBlock"`
|
||||
|
||||
Limit int `json:"limit"`
|
||||
CaseSensitive bool `json:"caseSensitive"`
|
||||
|
|
@ -62,18 +63,19 @@ type Search struct {
|
|||
|
||||
func NewSearch() *Search {
|
||||
return &Search{
|
||||
Document: true,
|
||||
Heading: true,
|
||||
List: true,
|
||||
ListItem: true,
|
||||
CodeBlock: true,
|
||||
MathBlock: true,
|
||||
Table: true,
|
||||
Blockquote: true,
|
||||
SuperBlock: true,
|
||||
Paragraph: true,
|
||||
HTMLBlock: true,
|
||||
EmbedBlock: false,
|
||||
Document: true,
|
||||
Heading: true,
|
||||
List: true,
|
||||
ListItem: true,
|
||||
CodeBlock: true,
|
||||
MathBlock: true,
|
||||
Table: true,
|
||||
Blockquote: true,
|
||||
SuperBlock: true,
|
||||
Paragraph: true,
|
||||
HTMLBlock: true,
|
||||
EmbedBlock: false,
|
||||
DatabaseBlock: true,
|
||||
|
||||
Limit: 64,
|
||||
CaseSensitive: false,
|
||||
|
|
|
|||
|
|
@ -604,6 +604,7 @@ func buildTypeFilter(types map[string]bool) string {
|
|||
s.Paragraph = types["paragraph"]
|
||||
s.HTMLBlock = types["htmlBlock"]
|
||||
s.EmbedBlock = types["embedBlock"]
|
||||
s.DatabaseBlock = types["databaseBlock"]
|
||||
} else {
|
||||
s.Document = Conf.Search.Document
|
||||
s.Heading = Conf.Search.Heading
|
||||
|
|
@ -617,6 +618,7 @@ func buildTypeFilter(types map[string]bool) string {
|
|||
s.Paragraph = Conf.Search.Paragraph
|
||||
s.HTMLBlock = Conf.Search.HTMLBlock
|
||||
s.EmbedBlock = Conf.Search.EmbedBlock
|
||||
s.DatabaseBlock = Conf.Search.DatabaseBlock
|
||||
}
|
||||
return s.TypeFilter()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -203,6 +203,8 @@ func getRefText(defBlockID string) string {
|
|||
return block.Content
|
||||
case "query_embed":
|
||||
return "Query Embed Block " + block.Markdown
|
||||
case "av":
|
||||
return "Database " + block.Markdown
|
||||
case "iframe":
|
||||
return "IFrame " + block.Markdown
|
||||
case "tb":
|
||||
|
|
|
|||
|
|
@ -145,8 +145,6 @@ func NodeStaticContent(node *ast.Node, excludeTypes []string, includeTextMarkATi
|
|||
attrView, err := av.ParseAttributeView(node.AttributeViewID)
|
||||
if nil == err {
|
||||
buf := bytes.Buffer{}
|
||||
buf.WriteString(attrView.Name)
|
||||
buf.WriteString(" ")
|
||||
for _, v := range attrView.Views {
|
||||
buf.WriteString(v.Name)
|
||||
buf.WriteString(" ")
|
||||
|
|
@ -393,6 +391,7 @@ var typeAbbrMap = map[string]string{
|
|||
"NodeParagraph": "p",
|
||||
"NodeHTMLBlock": "html",
|
||||
"NodeBlockQueryEmbed": "query_embed",
|
||||
"NodeAttributeView": "av",
|
||||
"NodeKramdownBlockIAL": "ial",
|
||||
"NodeIFrame": "iframe",
|
||||
"NodeWidget": "widget",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue