Browse Source

Merge remote-tracking branch 'origin/dev' into dev

Vanessa 1 year ago
parent
commit
c75a4119e3

+ 1 - 1
.github/workflows/dockerimage.yml

@@ -33,4 +33,4 @@ jobs:
 
 
       - name: Build the Docker image
       - name: Build the Docker image
         run: |
         run: |
-          docker buildx build --push --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v8 -t b3log/siyuan:latest -t b3log/siyuan:v2.9.9 .
+          docker buildx build --push --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v8 -t b3log/siyuan:latest -t b3log/siyuan:v2.10.0 .

+ 1 - 1
app/appx/AppxManifest.xml

@@ -9,7 +9,7 @@
     <Identity Name="89C2A984.SiYuan"
     <Identity Name="89C2A984.SiYuan"
               ProcessorArchitecture="x64"
               ProcessorArchitecture="x64"
               Publisher='CN=087C656E-C1D9-42D8-8807-CED45A74FC0F'
               Publisher='CN=087C656E-C1D9-42D8-8807-CED45A74FC0F'
-              Version="2.9.9.0"/>
+              Version="2.10.0.0"/>
     <Properties>
     <Properties>
         <DisplayName>SiYuan</DisplayName>
         <DisplayName>SiYuan</DisplayName>
         <PublisherDisplayName>云南链滴科技有限公司</PublisherDisplayName>
         <PublisherDisplayName>云南链滴科技有限公司</PublisherDisplayName>

+ 2 - 0
app/changelogs/v2.10.0/v2.10.0.md

@@ -33,6 +33,8 @@ Below are the detailed changes in this version.
 * [Enable HTML-related features in KaTeX](https://github.com/siyuan-note/siyuan/pull/8951)
 * [Enable HTML-related features in KaTeX](https://github.com/siyuan-note/siyuan/pull/8951)
 * [Heading convert to doc does not use naming as doc name](https://github.com/siyuan-note/siyuan/issues/8959)
 * [Heading convert to doc does not use naming as doc name](https://github.com/siyuan-note/siyuan/issues/8959)
 * [Turn off math warnings in Chinese](https://github.com/siyuan-note/siyuan/pull/8963)
 * [Turn off math warnings in Chinese](https://github.com/siyuan-note/siyuan/pull/8963)
+* [Set the maximum height of the tooltip](https://github.com/siyuan-note/siyuan/issues/8978)
+* [Add the configuration of show/hide dock shortcut keys](https://github.com/siyuan-note/siyuan/issues/8979)
 
 
 ### Bugfix
 ### Bugfix
 
 

+ 2 - 1
app/changelogs/v2.10.0/v2.10.0_zh_CHT.md

@@ -33,7 +33,8 @@
 * [啟用 KaTex 的 HTML 相關特性](https://github.com/siyuan-note/siyuan/pull/8951)
 * [啟用 KaTex 的 HTML 相關特性](https://github.com/siyuan-note/siyuan/pull/8951)
 * [標題轉換文檔不再使用命名作為文檔名](https://github.com/siyuan-note/siyuan/issues/8959)
 * [標題轉換文檔不再使用命名作為文檔名](https://github.com/siyuan-note/siyuan/issues/8959)
 * [關閉公式中文警告](https://github.com/siyuan-note/siyuan/pull/8963)
 * [關閉公式中文警告](https://github.com/siyuan-note/siyuan/pull/8963)
-
+* [設置提示最大寬度](https://github.com/siyuan-note/siyuan/issues/8978)
+* [添加顯示和隱藏停靠欄快捷鍵配置](https://github.com/siyuan-note/siyuan/issues/8979)
 
 
 ### 修復缺陷
 ### 修復缺陷
 
 

+ 2 - 1
app/changelogs/v2.10.0/v2.10.0_zh_CN.md

@@ -33,7 +33,8 @@
 * [启用 KaTex 的 HTML 相关特性](https://github.com/siyuan-note/siyuan/pull/8951)
 * [启用 KaTex 的 HTML 相关特性](https://github.com/siyuan-note/siyuan/pull/8951)
 * [标题转换文档不再使用命名作为文档名](https://github.com/siyuan-note/siyuan/issues/8959)
 * [标题转换文档不再使用命名作为文档名](https://github.com/siyuan-note/siyuan/issues/8959)
 * [关闭公式中文警告](https://github.com/siyuan-note/siyuan/pull/8963)
 * [关闭公式中文警告](https://github.com/siyuan-note/siyuan/pull/8963)
-
+* [设置提示最大宽度](https://github.com/siyuan-note/siyuan/issues/8978)
+* [添加显示和隐藏停靠栏快捷键配置](https://github.com/siyuan-note/siyuan/issues/8979)
 
 
 ### 修复缺陷
 ### 修复缺陷
 
 

+ 1 - 1
app/package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "SiYuan",
   "name": "SiYuan",
-  "version": "2.9.9",
+  "version": "2.10.0",
   "description": "Refactor your thinking",
   "description": "Refactor your thinking",
   "homepage": "https://b3log.org/siyuan",
   "homepage": "https://b3log.org/siyuan",
   "main": "./electron/main.js",
   "main": "./electron/main.js",

+ 19 - 3
kernel/model/asset_content.go

@@ -32,6 +32,7 @@ import (
 	"github.com/siyuan-note/eventbus"
 	"github.com/siyuan-note/eventbus"
 	"github.com/siyuan-note/filelock"
 	"github.com/siyuan-note/filelock"
 	"github.com/siyuan-note/logging"
 	"github.com/siyuan-note/logging"
+	"github.com/siyuan-note/siyuan/kernel/search"
 	"github.com/siyuan-note/siyuan/kernel/sql"
 	"github.com/siyuan-note/siyuan/kernel/sql"
 	"github.com/siyuan-note/siyuan/kernel/task"
 	"github.com/siyuan-note/siyuan/kernel/task"
 	"github.com/siyuan-note/siyuan/kernel/util"
 	"github.com/siyuan-note/siyuan/kernel/util"
@@ -63,7 +64,7 @@ func GetAssetContent(id, query string, queryMethod int) (ret *AssetContent) {
 	}
 	}
 
 
 	projections := "id, name, ext, path, size, updated, " +
 	projections := "id, name, ext, path, size, updated, " +
-		"highlight(" + table + ", 6, '<mark>', '</mark>') AS content"
+		"highlight(" + table + ", 6, '" + search.SearchMarkLeft + "', '" + search.SearchMarkRight + "') AS content"
 	stmt := "SELECT " + projections + " FROM " + table + " WHERE " + filter
 	stmt := "SELECT " + projections + " FROM " + table + " WHERE " + filter
 	assetContents := sql.SelectAssetContentsRawStmt(stmt, 1, 1)
 	assetContents := sql.SelectAssetContentsRawStmt(stmt, 1, 1)
 	results := fromSQLAssetContents(&assetContents, 36)
 	results := fromSQLAssetContents(&assetContents, 36)
@@ -155,7 +156,7 @@ func fullTextSearchAssetContentCountByRegexp(exp, typeFilter string) (matchedAss
 func fullTextSearchAssetContentByFTS(query, typeFilter, orderBy string, beforeLen, page, pageSize int) (ret []*AssetContent, matchedAssetCount int) {
 func fullTextSearchAssetContentByFTS(query, typeFilter, orderBy string, beforeLen, page, pageSize int) (ret []*AssetContent, matchedAssetCount int) {
 	table := "asset_contents_fts_case_insensitive"
 	table := "asset_contents_fts_case_insensitive"
 	projections := "id, name, ext, path, size, updated, " +
 	projections := "id, name, ext, path, size, updated, " +
-		"snippet(" + table + ", 6, '<mark>', '</mark>', '...', 64) AS content"
+		"snippet(" + table + ", 6, '" + search.SearchMarkLeft + "', '" + search.SearchMarkRight + "', '...', 64) AS content"
 	stmt := "SELECT " + projections + " FROM " + table + " WHERE (`" + table + "` MATCH '" + buildAssetContentColumnFilter() + ":(" + query + ")'"
 	stmt := "SELECT " + projections + " FROM " + table + " WHERE (`" + table + "` MATCH '" + buildAssetContentColumnFilter() + ":(" + query + ")'"
 	stmt += ") AND ext IN " + typeFilter
 	stmt += ") AND ext IN " + typeFilter
 	stmt += " " + orderBy
 	stmt += " " + orderBy
@@ -215,6 +216,12 @@ func fromSQLAssetContents(assetContents *[]*sql.AssetContent, beforeLen int) (re
 }
 }
 
 
 func fromSQLAssetContent(assetContent *sql.AssetContent, beforeLen int) *AssetContent {
 func fromSQLAssetContent(assetContent *sql.AssetContent, beforeLen int) *AssetContent {
+	content := util.EscapeHTML(assetContent.Content)
+	if strings.Contains(content, search.SearchMarkLeft) {
+		content = strings.ReplaceAll(content, search.SearchMarkLeft, "<mark>")
+		content = strings.ReplaceAll(content, search.SearchMarkRight, "</mark>")
+	}
+
 	return &AssetContent{
 	return &AssetContent{
 		ID:      assetContent.ID,
 		ID:      assetContent.ID,
 		Name:    assetContent.Name,
 		Name:    assetContent.Name,
@@ -223,7 +230,7 @@ func fromSQLAssetContent(assetContent *sql.AssetContent, beforeLen int) *AssetCo
 		Size:    assetContent.Size,
 		Size:    assetContent.Size,
 		HSize:   humanize.Bytes(uint64(assetContent.Size)),
 		HSize:   humanize.Bytes(uint64(assetContent.Size)),
 		Updated: assetContent.Updated,
 		Updated: assetContent.Updated,
-		Content: assetContent.Content,
+		Content: content,
 	}
 	}
 }
 }
 
 
@@ -275,6 +282,8 @@ func buildAssetContentOrderBy(orderBy int) string {
 var assetContentSearcher = NewAssetsSearcher()
 var assetContentSearcher = NewAssetsSearcher()
 
 
 func IndexAssetContent(absPath string) {
 func IndexAssetContent(absPath string) {
+	defer logging.Recover()
+
 	assetsDir := util.GetDataAssetsAbsPath()
 	assetsDir := util.GetDataAssetsAbsPath()
 
 
 	ext := strings.ToLower(filepath.Ext(absPath))
 	ext := strings.ToLower(filepath.Ext(absPath))
@@ -346,6 +355,8 @@ type AssetsSearcher struct {
 }
 }
 
 
 func (searcher *AssetsSearcher) FullIndex() {
 func (searcher *AssetsSearcher) FullIndex() {
+	defer logging.Recover()
+
 	assetsDir := util.GetDataAssetsAbsPath()
 	assetsDir := util.GetDataAssetsAbsPath()
 	if !gulu.File.IsDir(assetsDir) {
 	if !gulu.File.IsDir(assetsDir) {
 		return
 		return
@@ -455,6 +466,11 @@ func copyTempAsset(absPath string) (ret string) {
 		return
 		return
 	}
 	}
 
 
+	baseName := filepath.Base(absPath)
+	if strings.HasPrefix(baseName, "~") {
+		return
+	}
+
 	filelock.RWLock.Lock()
 	filelock.RWLock.Lock()
 	defer filelock.RWLock.Unlock()
 	defer filelock.RWLock.Unlock()
 
 

+ 1 - 1
kernel/util/working.go

@@ -42,7 +42,7 @@ import (
 var Mode = "prod"
 var Mode = "prod"
 
 
 const (
 const (
-	Ver       = "2.9.9"
+	Ver       = "2.10.0"
 	IsInsider = false
 	IsInsider = false
 )
 )