`;
/// #if !BROWSER
@@ -1601,8 +1601,8 @@ export class Toolbar {
k: inputElement.value,
}, (response) => {
let searchHTML = "";
- response.data.blocks.forEach((item: { path: string, content: string, name: string }, index: number) => {
- searchHTML += `
+ response.data.widgets.forEach((item: { content: string, name: string }, index: number) => {
+ searchHTML += `
${item.name}
${item.content}
`;
@@ -1627,7 +1627,7 @@ export class Toolbar {
k: "",
}, (response) => {
let html = "";
- response.data.blocks.forEach((item: { content: string, name: string }, index: number) => {
+ response.data.widgets.forEach((item: { content: string, name: string }, index: number) => {
html += `
${item.name}
${item.content}
diff --git a/kernel/api/search.go b/kernel/api/search.go
index 767e81606..eecb05479 100644
--- a/kernel/api/search.go
+++ b/kernel/api/search.go
@@ -188,10 +188,10 @@ func searchWidget(c *gin.Context) {
}
keyword := arg["k"].(string)
- blocks := model.SearchWidget(keyword)
+ widgets := model.SearchWidget(keyword)
ret.Data = map[string]interface{}{
- "blocks": blocks,
- "k": keyword,
+ "widgets": widgets,
+ "k": keyword,
}
}
@@ -223,10 +223,10 @@ func searchTemplate(c *gin.Context) {
}
keyword := arg["k"].(string)
- blocks := model.SearchTemplate(keyword)
+ templates := model.SearchTemplate(keyword)
ret.Data = map[string]interface{}{
- "blocks": blocks,
- "k": keyword,
+ "templates": templates,
+ "k": keyword,
}
}
diff --git a/kernel/model/template.go b/kernel/model/template.go
index ad92d1081..25cb9688c 100644
--- a/kernel/model/template.go
+++ b/kernel/model/template.go
@@ -42,6 +42,12 @@ import (
"github.com/xrash/smetrics"
)
+// TemplateSearchResult 描述了模板搜索结果。
+type TemplateSearchResult struct {
+ Path string `json:"path"`
+ Content string `json:"content"`
+}
+
func RenderGoTemplate(templateContent string) (ret string, err error) {
tmpl := template.New("")
tplFuncMap := filesys.BuiltInTemplateFuncs()
@@ -70,8 +76,8 @@ func RemoveTemplate(p string) (err error) {
return
}
-func SearchTemplate(keyword string) (ret []*Block) {
- ret = []*Block{}
+func SearchTemplate(keyword string) (ret []*TemplateSearchResult) {
+ ret = []*TemplateSearchResult{}
templates := filepath.Join(util.DataDir, "templates")
if !util.IsPathRegularDirOrSymlinkDir(templates) {
@@ -90,7 +96,7 @@ func SearchTemplate(keyword string) (ret []*Block) {
keyword = strings.TrimSpace(keyword)
type result struct {
- block *Block
+ item *TemplateSearchResult
score float64
}
var results []*result
@@ -133,8 +139,8 @@ func SearchTemplate(keyword string) (ret []*Block) {
content = strings.TrimSuffix(content, ".md")
content = filepath.ToSlash(content)
_, content = search.MarkText(content, strings.Join(keywords, search.TermSep), 32, Conf.Search.CaseSensitive)
- b := &Block{Path: path, Content: content}
- results = append(results, &result{block: b, score: score})
+ b := &TemplateSearchResult{Path: path, Content: content}
+ results = append(results, &result{item: b, score: score})
}
return nil
})
@@ -159,8 +165,8 @@ func SearchTemplate(keyword string) (ret []*Block) {
if hit {
content = filepath.ToSlash(content)
_, content = search.MarkText(content, strings.Join(keywords, search.TermSep), 32, Conf.Search.CaseSensitive)
- b := &Block{Path: filepath.Join(templates, group.Name()), Content: content}
- results = append(results, &result{block: b, score: score})
+ b := &TemplateSearchResult{Path: filepath.Join(templates, group.Name()), Content: content}
+ results = append(results, &result{item: b, score: score})
}
}
}
@@ -169,7 +175,7 @@ func SearchTemplate(keyword string) (ret []*Block) {
return results[i].score > results[j].score
})
for _, r := range results {
- ret = append(ret, r.block)
+ ret = append(ret, r.item)
}
return
}
diff --git a/kernel/model/widget.go b/kernel/model/widget.go
index 5ca7d6043..851b887db 100644
--- a/kernel/model/widget.go
+++ b/kernel/model/widget.go
@@ -26,8 +26,14 @@ import (
"github.com/siyuan-note/siyuan/kernel/util"
)
-func SearchWidget(keyword string) (ret []*Block) {
- ret = []*Block{}
+// WidgetSearchResult 描述了挂件搜索结果。
+type WidgetSearchResult struct {
+ Name string `json:"name"`
+ Content string `json:"content"`
+}
+
+func SearchWidget(keyword string) (ret []*WidgetSearchResult) {
+ ret = []*WidgetSearchResult{}
widgetsDir := filepath.Join(util.DataDir, "widgets")
entries, err := os.ReadDir(widgetsDir)
if err != nil {
@@ -55,7 +61,7 @@ func SearchWidget(keyword string) (ret []*Block) {
widgets = filterWidgets(widgets, k)
for _, widget := range widgets {
- b := &Block{
+ b := &WidgetSearchResult{
Name: bazaar.GetPreferredName(widget.Package),
Content: widget.Name,
}
From c449ca7ed8f0fc0f7ae3ee7725d7a90a143b5916 Mon Sep 17 00:00:00 2001
From: Daniel <845765@qq.com>
Date: Thu, 5 Mar 2026 21:24:11 +0800
Subject: [PATCH 2/2] :bug: Can't show windows on some Linux desktop systems
https://github.com/siyuan-note/siyuan/issues/17141
Signed-off-by: Daniel <845765@qq.com>
---
app/electron/main.js | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/app/electron/main.js b/app/electron/main.js
index 13fd50813..675fe36c0 100644
--- a/app/electron/main.js
+++ b/app/electron/main.js
@@ -71,11 +71,12 @@ if (process.platform === "linux") {
"KYLIN", // 麒麟备用标识
"NEWSTART" // 中兴新支点
].some(key => desktop.includes(key));
- const isKylinFile = fs.existsSync("/etc/kylin-release");
+ const isKylinFile = fs.existsSync("/etc/kylin-version");
const isUosFile = fs.existsSync("/etc/uos-version");
- const isDeepinFile = fs.existsSync("/etc/deepin-release");
+ const isDeepinFile = fs.existsSync("/etc/deepin-version");
if (isChineseOS || isKylinFile || isUosFile || isDeepinFile) {
- app.commandLine.appendSwitch("ozone-platform", "x11");
+ app.commandLine.appendSwitch("enable-wayland-ime");
+ app.commandLine.appendSwitch("wayland-text-input-version", "3");
}
}