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

This commit is contained in:
Vanessa 2025-04-25 17:00:52 +08:00
commit a7c989f064
14 changed files with 121 additions and 71 deletions

View File

@ -1217,7 +1217,7 @@
"copy": "Copie",
"copyText": "Copier le texte *",
"delete-column": "Supprimer une Colonne",
"delete-row": "Supprimer la rangée",
"delete-row": "Supprimer la ligne",
"down": "En bas",
"downloadTip": "Ce navigateur ne prend pas en charge la fonction de téléchargement",
"edit-mode": "Mode Toggle",
@ -1269,7 +1269,7 @@
"recording": "Enregistrement en cours...",
"redo": "Refaire",
"remove": "Supprimer",
"row": "Rangée",
"row": "Ligne",
"splitView": "Vue partagée",
"strike": "Strike",
"table": "Tableau",

View File

@ -1,4 +1,4 @@
import {getTextStar, paste} from "../util/paste";
import {enableLuteMarkdownSyntax, getTextStar, paste, restoreLuteMarkdownSyntax} from "../util/paste";
import {
hasClosestBlock,
hasClosestByAttribute,
@ -442,7 +442,9 @@ export class WYSIWYG {
.replace(new RegExp(Constants.ZWSP, "g"), "");
event.clipboardData.setData("text/plain", textPlain);
event.clipboardData.setData("text/html", selectTableElement ? html : protyle.lute.BlockDOM2HTML(selectAVElement ? textPlain : html));
enableLuteMarkdownSyntax(protyle);
event.clipboardData.setData("text/siyuan", selectTableElement ? protyle.lute.HTML2BlockDOM(html) : html);
restoreLuteMarkdownSyntax(protyle);
});
this.element.addEventListener("mousedown", (event: MouseEvent) => {
@ -1702,7 +1704,9 @@ export class WYSIWYG {
textPlain = textPlain.replace(/\u00A0/g, " "); // Replace non-breaking spaces with normal spaces when copying https://github.com/siyuan-note/siyuan/issues/9382
event.clipboardData.setData("text/plain", textPlain);
event.clipboardData.setData("text/html", selectTableElement ? html : protyle.lute.BlockDOM2HTML(selectAVElement ? textPlain : html));
enableLuteMarkdownSyntax(protyle);
event.clipboardData.setData("text/siyuan", selectTableElement ? protyle.lute.HTML2BlockDOM(html) : html);
restoreLuteMarkdownSyntax(protyle);
});
let beforeContextmenuRange: Range;

File diff suppressed because one or more lines are too long

8
kernel/cache/ial.go vendored
View File

@ -23,7 +23,7 @@ import (
"github.com/dgraph-io/ristretto"
)
var docIALCache, _ = ristretto.NewCache[string, map[string]string](&ristretto.Config[string, map[string]string]{
var docIALCache, _ = ristretto.NewCache(&ristretto.Config{
NumCounters: 1024 * 100,
MaxCost: 1024 * 1024 * 200,
BufferItems: 64,
@ -40,7 +40,7 @@ func GetDocIAL(p string) (ret map[string]string) {
}
ret = map[string]string{}
for k, v := range ial {
for k, v := range ial.(map[string]string) {
ret[k] = strings.ReplaceAll(v, editor.IALValEscNewLine, "\n")
}
return
@ -54,7 +54,7 @@ func ClearDocsIAL() {
docIALCache.Clear()
}
var blockIALCache, _ = ristretto.NewCache[string, map[string]string](&ristretto.Config[string, map[string]string]{
var blockIALCache, _ = ristretto.NewCache(&ristretto.Config{
NumCounters: 1024 * 1000,
MaxCost: 1024 * 1024 * 200,
BufferItems: 64,
@ -69,7 +69,7 @@ func GetBlockIAL(id string) (ret map[string]string) {
if nil == ial {
return
}
return ial
return ial.(map[string]string)
}
func RemoveBlockIAL(id string) {

View File

@ -1,8 +1,8 @@
module github.com/siyuan-note/siyuan/kernel
go 1.23.0
go 1.24
toolchain go1.24.0
toolchain go1.24.1
require (
code.sajari.com/docconv v1.3.8
@ -10,7 +10,7 @@ require (
github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48
github.com/88250/go-humanize v0.0.0-20240424102817-4f78fac47ea7
github.com/88250/gulu v1.2.3-0.20250227144607-7f4570b0d689
github.com/88250/lute v1.7.7-0.20250422121653-345debd8a77d
github.com/88250/lute v1.7.7-0.20250425050408-6d2c1888c1c0
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
github.com/ClarkThan/ahocorasick v0.0.0-20231011042242-30d1ef1347f4
github.com/ConradIrwin/font v0.2.1
@ -21,7 +21,7 @@ require (
github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef
github.com/common-nighthawk/go-figure v0.0.0-20210622060536-734e95fb86be
github.com/denisbrodbeck/machineid v1.0.1
github.com/dgraph-io/ristretto v1.0.0
github.com/dgraph-io/ristretto v0.2.0
github.com/djherbis/times v1.6.0
github.com/emersion/go-ical v0.0.0-20250329121855-f41e73efc392
github.com/emersion/go-vcard v0.0.0-20241024213814-c9703dde27ff
@ -41,7 +41,7 @@ require (
github.com/golang-jwt/jwt/v5 v5.2.2
github.com/gorilla/css v1.0.1
github.com/gorilla/websocket v1.5.3
github.com/imroc/req/v3 v3.50.0
github.com/imroc/req/v3 v3.51.0
github.com/jinzhu/copier v0.4.0
github.com/json-iterator/go v1.1.12
github.com/klippa-app/go-pdfium v1.14.1
@ -52,19 +52,19 @@ require (
github.com/open-spaced-repetition/go-fsrs/v3 v3.3.1
github.com/panjf2000/ants/v2 v2.11.3
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/pdfcpu/pdfcpu v0.9.1
github.com/pdfcpu/pdfcpu v0.10.2
github.com/radovskyb/watcher v1.0.7
github.com/rqlite/sql v0.0.0-20241111133259-a4122fabb196
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
github.com/sashabaranov/go-openai v1.38.2
github.com/shirou/gopsutil/v4 v4.25.3
github.com/siyuan-note/dejavu v0.0.0-20250418020730-e2cae0ebc147
github.com/siyuan-note/dejavu v0.0.0-20250425042657-7c914335a3d4
github.com/siyuan-note/encryption v0.0.0-20250326023622-24a67e6956ec
github.com/siyuan-note/eventbus v0.0.0-20240627125516-396fdb0f0f97
github.com/siyuan-note/filelock v0.0.0-20250227145141-7d111cdf3c57
github.com/siyuan-note/httpclient v0.0.0-20250418020443-47f8751fa913
github.com/siyuan-note/logging v0.0.0-20241218085028-6514639a9742
github.com/siyuan-note/riff v0.0.0-20250320123739-f668df17442b
github.com/siyuan-note/httpclient v0.0.0-20250425040344-7322dc6847d4
github.com/siyuan-note/logging v0.0.0-20250425042449-b96c40249b54
github.com/siyuan-note/riff v0.0.0-20250424035337-0a1e91809f6d
github.com/spf13/cast v1.7.1
github.com/steambap/captcha v1.4.1
github.com/studio-b12/gowebdav v0.10.0
@ -130,7 +130,7 @@ require (
github.com/go-resty/resty/v2 v2.16.5 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
github.com/google/pprof v0.0.0-20250417201159-ae779711f5d1 // indirect
github.com/google/pprof v0.0.0-20250423184734-337e5dd93bb4 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gopherjs/gopherjs v1.17.2 // indirect
github.com/gorilla/context v1.1.2 // indirect
@ -165,8 +165,8 @@ require (
github.com/qiniu/go-sdk/v7 v7.25.3 // indirect
github.com/quasoft/memstore v0.0.0-20191010062613-2bce066d2b0b // indirect
github.com/quic-go/qpack v0.5.1 // indirect
github.com/quic-go/quic-go v0.50.1 // indirect
github.com/refraction-networking/utls v1.6.7 // indirect
github.com/quic-go/quic-go v0.51.0 // indirect
github.com/refraction-networking/utls v1.7.1 // indirect
github.com/restic/chunker v0.4.0 // indirect
github.com/richardlehane/mscfb v1.0.4 // indirect
github.com/richardlehane/msoleps v1.0.4 // indirect
@ -188,19 +188,19 @@ require (
go.uber.org/mock v0.5.1 // indirect
golang.org/x/arch v0.16.0 // indirect
golang.org/x/crypto v0.37.0 // indirect
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 // indirect
golang.org/x/sync v0.13.0 // indirect
golang.org/x/tools v0.32.0 // indirect
google.golang.org/protobuf v1.36.6 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
modernc.org/fileutil v1.3.0 // indirect
modernc.org/fileutil v1.3.1 // indirect
)
replace github.com/mattn/go-sqlite3 => github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950
replace github.com/pdfcpu/pdfcpu => github.com/88250/pdfcpu v0.3.14-0.20241201033812-5a93b7586a01
replace github.com/pdfcpu/pdfcpu => github.com/88250/pdfcpu v0.3.14-0.20250424122812-f10e8d9d8d46
replace github.com/88250/lute => F:\golang\gopath\src\github.com\88250\lute
//replace github.com/88250/lute => F:\golang\gopath\src\github.com\88250\lute
//replace github.com/siyuan-note/dejavu => D:\88250\dejavu
//replace github.com/siyuan-note/riff => D:\88250\riff
//replace github.com/siyuan-note/httpclient => D:\88250\httpclient

View File

@ -14,10 +14,8 @@ github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950 h1:Pa5hMiBceT
github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/88250/gulu v1.2.3-0.20250227144607-7f4570b0d689 h1:39y5g7vnFAIcXhTN3IXPk7h2xBhC4a9hBTykDhHJqRY=
github.com/88250/gulu v1.2.3-0.20250227144607-7f4570b0d689/go.mod h1:c8uVw25vW2W4dhJ/j4iYsX5H1hc19spim266jO5x2hU=
github.com/88250/lute v1.7.7-0.20250422121653-345debd8a77d h1:WhgmfYMjgALgicBE+9yoNLNfcNkAEYHgjIeX0TdYb5c=
github.com/88250/lute v1.7.7-0.20250422121653-345debd8a77d/go.mod h1:WYyUw//5yVw9BJnoVjx7rI/3szsISxNZCYGOqTIrV0o=
github.com/88250/pdfcpu v0.3.14-0.20241201033812-5a93b7586a01 h1:AcFe63RXjIh1XtX/dc4Es3U8bYKjlEkvavHd1nFBOHM=
github.com/88250/pdfcpu v0.3.14-0.20241201033812-5a93b7586a01/go.mod h1:fVfOloBzs2+W2VJCCbq60XIxc3yJHAZ0Gahv1oO0gyI=
github.com/88250/pdfcpu v0.3.14-0.20250424122812-f10e8d9d8d46 h1:Bq1JsDfVbHKUxNL/B2JXd8cC/1h6aFjrlXpGycnh0Hk=
github.com/88250/pdfcpu v0.3.14-0.20250424122812-f10e8d9d8d46/go.mod h1:fVfOloBzs2+W2VJCCbq60XIxc3yJHAZ0Gahv1oO0gyI=
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1/go.mod h1:U3pckKQIgxxkmZjV5yXQjHdGxQK0o/vEZeZ6cQsxfHw=
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
@ -113,8 +111,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/denisbrodbeck/machineid v1.0.1 h1:geKr9qtkB876mXguW2X6TU4ZynleN6ezuMSRhl4D7AQ=
github.com/denisbrodbeck/machineid v1.0.1/go.mod h1:dJUwb7PTidGDeYyUBmXZ2GphQBbjJCrnectwCyxcUSI=
github.com/dgraph-io/ristretto v1.0.0 h1:SYG07bONKMlFDUYu5pEu3DGAh8c2OFNzKm6G9J4Si84=
github.com/dgraph-io/ristretto v1.0.0/go.mod h1:jTi2FiYEhQ1NsMmA7DeBykizjOuY88NhKBkepyu1jPc=
github.com/dgraph-io/ristretto v0.2.0 h1:XAfl+7cmoUDWW/2Lx8TGZQjjxIQ2Ley9DSf52dru4WE=
github.com/dgraph-io/ristretto v0.2.0/go.mod h1:8uBHCU/PBV4Ag0CJrP47b9Ofby5dqWNh4FicAdoqFNU=
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y=
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
github.com/djherbis/times v1.6.0 h1:w2ctJ92J8fBvWPxugmXIv7Nz7Q3iDMKNx9v5ocVH20c=
@ -206,8 +204,8 @@ github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/pprof v0.0.0-20250417201159-ae779711f5d1 h1:ZehIDSjI9BX/Ntq1mt7UlZ8+fItakjJBf6TeQDV0i/0=
github.com/google/pprof v0.0.0-20250417201159-ae779711f5d1/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA=
github.com/google/pprof v0.0.0-20250423184734-337e5dd93bb4 h1:gD0vax+4I+mAj+jEChEf25Ia07Jq7kYOFO5PPhAxFl4=
github.com/google/pprof v0.0.0-20250423184734-337e5dd93bb4/go.mod h1:5hDyRhoBCxViHszMt12TnOpEI4VVi+U8Gm9iphldiMA=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gopherjs/gopherjs v1.17.2 h1:fQnZVsXk8uxXIStYb0N4bGk7jeyTalG/wsZjQ25dO0g=
@ -236,8 +234,8 @@ github.com/hhrutter/tiff v1.0.2/go.mod h1:pcOeuK5loFUE7Y/WnzGw20YxUdnqjY1P0Jlcie
github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI=
github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
github.com/imroc/req/v3 v3.50.0 h1:n3BVnZiTRpvkN5T1IB79LC/THhFU9iXksNRMH4ZNVaY=
github.com/imroc/req/v3 v3.50.0/go.mod h1:tsOk8K7zI6cU4xu/VWCZVtq9Djw9IWm4MslKzme5woU=
github.com/imroc/req/v3 v3.51.0 h1:GyJxJUrvTVkhGH3v5h2UC04hqU6P465kJQNa9QeyECg=
github.com/imroc/req/v3 v3.51.0/go.mod h1:sYQMvAjeoDrAdijR8ty71qiAHOBsF8XroF4YVddPdgQ=
github.com/jaytaylor/html2text v0.0.0-20180606194806-57d518f124b0/go.mod h1:CVKlgaMiht+LXvHG173ujK6JUhZXKb2u/BQtjPDIvyk=
github.com/jaytaylor/html2text v0.0.0-20230321000545-74c2419ad056 h1:iCHtR9CQyktQ5+f3dMVZfwD2KWJUgm7M0gdL9NGr8KA=
github.com/jaytaylor/html2text v0.0.0-20230321000545-74c2419ad056/go.mod h1:CVKlgaMiht+LXvHG173ujK6JUhZXKb2u/BQtjPDIvyk=
@ -342,12 +340,12 @@ github.com/quasoft/memstore v0.0.0-20191010062613-2bce066d2b0b h1:aUNXCGgukb4gtY
github.com/quasoft/memstore v0.0.0-20191010062613-2bce066d2b0b/go.mod h1:wTPjTepVu7uJBYgZ0SdWHQlIas582j6cn2jgk4DDdlg=
github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI=
github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg=
github.com/quic-go/quic-go v0.50.1 h1:unsgjFIUqW8a2oopkY7YNONpV1gYND6Nt9hnt1PN94Q=
github.com/quic-go/quic-go v0.50.1/go.mod h1:Vim6OmUvlYdwBhXP9ZVrtGmCMWa3wEqhq3NgYrI8b4E=
github.com/quic-go/quic-go v0.51.0 h1:K8exxe9zXxeRKxaXxi/GpUqYiTrtdiWP8bo1KFya6Wc=
github.com/quic-go/quic-go v0.51.0/go.mod h1:MFlGGpcpJqRAfmYi6NC2cptDPSxRWTOGNuP4wqrWmzQ=
github.com/radovskyb/watcher v1.0.7 h1:AYePLih6dpmS32vlHfhCeli8127LzkIgwJGcwwe8tUE=
github.com/radovskyb/watcher v1.0.7/go.mod h1:78okwvY5wPdzcb1UYnip1pvrZNIVEIh/Cm+ZuvsUYIg=
github.com/refraction-networking/utls v1.6.7 h1:zVJ7sP1dJx/WtVuITug3qYUq034cDq9B2MR1K67ULZM=
github.com/refraction-networking/utls v1.6.7/go.mod h1:BC3O4vQzye5hqpmDTWUqi4P5DDhzJfkV1tdqtawQIH0=
github.com/refraction-networking/utls v1.7.1 h1:dxg+jla3uocgN8HtX+ccwDr68uCBBO3qLrkZUbqkcw0=
github.com/refraction-networking/utls v1.7.1/go.mod h1:TUhh27RHMGtQvjQq+RyO11P6ZNQNBb3N0v7wsEjKAIQ=
github.com/restic/chunker v0.4.0 h1:YUPYCUn70MYP7VO4yllypp2SjmsRhRJaad3xKu1QFRw=
github.com/restic/chunker v0.4.0/go.mod h1:z0cH2BejpW636LXw0R/BGyv+Ey8+m9QGiOanDHItzyw=
github.com/richardlehane/mscfb v1.0.4 h1:WULscsljNPConisD5hR0+OyZjwK46Pfyr6mPu5ZawpM=
@ -377,20 +375,20 @@ github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+D
github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d h1:lvCTyBbr36+tqMccdGMwuEU+hjux/zL6xSmf5S9ITaA=
github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw=
github.com/simplereach/timeutils v1.2.0/go.mod h1:VVbQDfN/FHRZa1LSqcwo4kNZ62OOyqLLGQKYB3pB0Q8=
github.com/siyuan-note/dejavu v0.0.0-20250418020730-e2cae0ebc147 h1:ZWVexwotuCxioBsLKpF8ZyYhLQFvzpEySVsSaYFxgj0=
github.com/siyuan-note/dejavu v0.0.0-20250418020730-e2cae0ebc147/go.mod h1:jjVOPCCS46Ahn4fecndxB56+pxlIl4AV9/PwP0rc4is=
github.com/siyuan-note/dejavu v0.0.0-20250425042657-7c914335a3d4 h1:guaR4LHkrxeSMdu+b41eLJenfWyODW0co72wgXC/XoA=
github.com/siyuan-note/dejavu v0.0.0-20250425042657-7c914335a3d4/go.mod h1:WbW1Cs0ZPjvHDAizIU85Ucp9J6i3bTmSAma1lO0WaWY=
github.com/siyuan-note/encryption v0.0.0-20250326023622-24a67e6956ec h1:D8Sjwa+7WxP3XrIBscT4PxBZZddZ83/O+5nX1sq6g6g=
github.com/siyuan-note/encryption v0.0.0-20250326023622-24a67e6956ec/go.mod h1:6iAxXPOOAG3+M4bCiKQZTQ+n4gSUx/OyHhsP57dJlS8=
github.com/siyuan-note/eventbus v0.0.0-20240627125516-396fdb0f0f97 h1:lM5v8BfNtbOL5jYwhCdMYBcYtr06IYBKjjSLAPMKTM8=
github.com/siyuan-note/eventbus v0.0.0-20240627125516-396fdb0f0f97/go.mod h1:1/nGgthl89FPA7GzAcEWKl6zRRnfgyTjzLZj9bW7kuw=
github.com/siyuan-note/filelock v0.0.0-20250227145141-7d111cdf3c57 h1:gRFbRUgTFP+XcV6vfiblGB9oHI/UwzD7cSUNwE1TrpE=
github.com/siyuan-note/filelock v0.0.0-20250227145141-7d111cdf3c57/go.mod h1:oJhBKYrxS8WRsTZhOafG3FfGgCSOyxFzboBvQxcDX9s=
github.com/siyuan-note/httpclient v0.0.0-20250418020443-47f8751fa913 h1:XAZBapgM8A0G8pa8XZyCUu81yQ0a/QMiNvy3JaAY10o=
github.com/siyuan-note/httpclient v0.0.0-20250418020443-47f8751fa913/go.mod h1:oqWzFm6mj2wplQx7+0zfthBay/nrlusElgTtY+xgDog=
github.com/siyuan-note/logging v0.0.0-20241218085028-6514639a9742 h1:PPiRvQDZ6bhXqvQRkOLNyNICZ/gvDuDide6gswoGsAg=
github.com/siyuan-note/logging v0.0.0-20241218085028-6514639a9742/go.mod h1:uszawhOtHHcCLZN7CZDM40J/IiwprO2lJZP4Nf4FJ14=
github.com/siyuan-note/riff v0.0.0-20250320123739-f668df17442b h1:PQGYhSUxjcll4M9tAIpPeZc4V4GtY+x0kc2K/aGpjbI=
github.com/siyuan-note/riff v0.0.0-20250320123739-f668df17442b/go.mod h1:afkzeVgkXWJkkp3LRDuBqUjv1z49+LDThOdwAsCP2Fw=
github.com/siyuan-note/httpclient v0.0.0-20250425040344-7322dc6847d4 h1:Sub/eE2I4mDyCWBEG1LsWN7KNJaTu75qf1eTLY4c4Y4=
github.com/siyuan-note/httpclient v0.0.0-20250425040344-7322dc6847d4/go.mod h1:to8y1GbT7/YKZZo4UnS8m/Y3ILRFdHiSYixwUQiDydc=
github.com/siyuan-note/logging v0.0.0-20250425042449-b96c40249b54 h1:bNfLBxasCNYNIiE8YwIDDq0DxFjQ3aDbp25w8F5aShM=
github.com/siyuan-note/logging v0.0.0-20250425042449-b96c40249b54/go.mod h1:9lb3q2RCdpjoQk7nDQwLSArNtCLafHwWtl8+kNkSISM=
github.com/siyuan-note/riff v0.0.0-20250424035337-0a1e91809f6d h1:VJ/DuLIx4FE7MZtlX2Gahx2m9tr4YCXPxZxUXZIWRx4=
github.com/siyuan-note/riff v0.0.0-20250424035337-0a1e91809f6d/go.mod h1:oz+GggNPu23prmW5/8aqpu9Zs5eQBgN+YQJzFLxbT4g=
github.com/spf13/cast v1.7.1 h1:cuNEagBQEHWN1FnbGEjCXL2szYEXqfJPbP2HNUaca9Y=
github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf h1:pvbZ0lM0XWPBqUKqFU8cmavspvIl9nulOYwdy6IFRRo=
@ -462,8 +460,6 @@ golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
golang.org/x/crypto v0.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE=
golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc=
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 h1:R84qjqJb5nVJMxqWYb3np9L5ZsaDtB+a39EqjV0JSUM=
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0/go.mod h1:S9Xr4PYopiDyqSyp5NjCrhFrqg6A5zA2E/iPHPhqnS8=
golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
golang.org/x/image v0.26.0 h1:4XjIFEZWQmCZi6Wv8BoxsDhRU3RVnLX04dToTDAEPlY=
golang.org/x/image v0.26.0/go.mod h1:lcxbMFAovzpnJxzXS3nyL83K27tmqtKzIJpctK8YO5c=
@ -575,6 +571,6 @@ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
modernc.org/fileutil v1.0.0/go.mod h1:JHsWpkrk/CnVV1H/eGlFf85BEpfkrp56ro8nojIq9Q8=
modernc.org/fileutil v1.3.0 h1:gQ5SIzK3H9kdfai/5x41oQiKValumqNTDXMvKo62HvE=
modernc.org/fileutil v1.3.0/go.mod h1:XatxS8fZi3pS8/hKG2GH/ArUogfxjpEKs3Ku3aK4JyQ=
modernc.org/fileutil v1.3.1 h1:8vq5fe7jdtEvoCf3Zf9Nm0Q05sH6kGx0Op2CPx1wTC8=
modernc.org/fileutil v1.3.1/go.mod h1:HxmghZSZVAz/LXcMNwZPA/DRrQZEVP9VX0V4LQGQFOc=
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=

View File

@ -32,7 +32,7 @@ func StartCron() {
go every(5*time.Second, task.StatusJob)
go every(5*time.Second, model.SyncDataJob)
go every(2*time.Hour, model.StatJob)
go every(6*time.Hour, util.RefreshRhyResultJob)
go every(6*time.Hour, util.RefreshRhyResultJob, "RefreshRhyResultJob")
go every(2*time.Hour, model.RefreshCheckJob)
go every(3*time.Second, model.FlushUpdateRefTextRenameDocJob)
go every(util.SQLFlushInterval, sql.FlushTxJob)
@ -50,14 +50,17 @@ func StartCron() {
//go every(3*time.Second, model.WatchLocalShorthands)
}
func every(interval time.Duration, f func()) {
func every(interval time.Duration, f func(), name ...string) {
util.RandomSleep(50, 200)
for {
ticker := time.NewTicker(interval)
defer ticker.Stop()
for range ticker.C {
func() {
defer logging.Recover()
f()
if 0 < len(name) {
logging.LogInfof("cron job [%s] executed", name)
}
}()
time.Sleep(interval)
}
}

View File

@ -1041,6 +1041,10 @@ func ProcessPDF(id, p string, merge, removeAssets, watermark bool) (err error) {
logging.LogErrorf("mkdir [%s] failed: %s", font.UserFontDir, mkdirErr)
return
}
if loadErr := api.LoadUserFonts(); nil != loadErr {
logging.LogErrorf("load user fonts failed: %s", loadErr)
}
pdfCtx, ctxErr := api.ReadContextFile(p)
if nil != ctxErr {
logging.LogErrorf("read pdf context failed: %s", ctxErr)
@ -1098,7 +1102,43 @@ func processPDFWatermark(pdfCtx *model.Context, watermark bool) {
}
m[kv[0]] = kv[1]
}
m["fontname"] = "LXGWWenKaiLite-Regular"
useDefaultFont := true
if "" != m["fontname"] {
listFonts, e := api.ListFonts()
var builtInFontNames []string
if nil != e {
logging.LogInfof("listFont failed: %s", e)
} else {
for _, f := range listFonts {
if strings.Contains(f, "(") {
f = f[:strings.Index(f, "(")]
}
f = strings.TrimSpace(f)
if strings.Contains(f, ":") || "" == f || strings.Contains(f, "Corefonts") || strings.Contains(f, "Userfonts") {
continue
}
builtInFontNames = append(builtInFontNames, f)
}
for _, font := range builtInFontNames {
if font == m["fontname"] {
useDefaultFont = false
break
}
}
}
}
if useDefaultFont {
m["fontname"] = "LXGWWenKaiLite-Regular"
fontPath := filepath.Join(util.AppearancePath, "fonts", "LxgwWenKai-Lite-1.501", "LXGWWenKaiLite-Regular.ttf")
err := api.InstallFonts([]string{fontPath})
if err != nil {
logging.LogErrorf("install font [%s] failed: %s", fontPath, err)
}
}
descBuilder := bytes.Buffer{}
for k, v := range m {
descBuilder.WriteString(k)
@ -1108,12 +1148,6 @@ func processPDFWatermark(pdfCtx *model.Context, watermark bool) {
}
desc = descBuilder.String()
desc = desc[:len(desc)-1]
fontPath := filepath.Join(util.AppearancePath, "fonts", "LxgwWenKai-Lite-1.501", "LXGWWenKaiLite-Regular.ttf")
err := api.InstallFonts([]string{fontPath})
if err != nil {
logging.LogErrorf("install font [%s] failed: %s", fontPath, err)
}
}
logging.LogInfof("add PDF watermark [mode=%s, str=%s, desc=%s]", mode, str, desc)

View File

@ -81,6 +81,7 @@ func HTML2Tree(htmlStr string, luteEngine *lute.Lute) (tree *parse.Tree, withMat
if n.ParentIs(ast.NodeTableCell) {
n.Tokens = bytes.ReplaceAll(n.Tokens, []byte("\\|"), []byte("|"))
n.Tokens = bytes.ReplaceAll(n.Tokens, []byte("|"), []byte("\\|"))
n.Tokens = bytes.ReplaceAll(n.Tokens, []byte("\\<br /\\>"), []byte("<br />"))
}
}

View File

@ -308,6 +308,11 @@ func SearchTags(keyword string) (ret []string) {
labels := labelBlocksByKeyword(keyword)
keyword = strings.Join(strings.Split(keyword, " "), search.TermSep)
for label := range labels {
if "" == keyword {
ret = append(ret, util.EscapeHTML(label))
continue
}
_, t := search.MarkText(label, keyword, 1024, Conf.Search.CaseSensitive)
ret = append(ret, t)
}

View File

@ -38,7 +38,7 @@ import (
// virtualBlockRefCache 用于保存块关联的虚拟引用关键字。
// 改进打开虚拟引用后加载文档的性能 https://github.com/siyuan-note/siyuan/issues/7378
var virtualBlockRefCache, _ = ristretto.NewCache[string, []string](&ristretto.Config[string, []string]{
var virtualBlockRefCache, _ = ristretto.NewCache(&ristretto.Config{
NumCounters: 102400,
MaxCost: 10240,
BufferItems: 64,
@ -61,7 +61,7 @@ func getBlockVirtualRefKeywords(root *ast.Node) (ret []string) {
ret = putBlockVirtualRefKeywords(content, root)
return
}
ret = val
ret = val.([]string)
return
}
@ -217,7 +217,7 @@ func getVirtualRefKeywords(root *ast.Node) (ret []string) {
}
if val, ok := virtualBlockRefCache.Get("virtual_ref"); ok {
ret = val
ret = val.([]string)
}
if "" != strings.TrimSpace(Conf.Editor.VirtualBlockRefInclude) {

View File

@ -112,9 +112,15 @@ func EncloseHighlighting(text string, keywords []string, openMark, closeMark str
re += ")"
ret = util.EscapeHTML(text)
ret = strings.ReplaceAll(ret, "&#34;", "\ue000")
ret = strings.ReplaceAll(ret, "&lt;", "\ue001")
ret = strings.ReplaceAll(ret, "&gt;", "\ue002")
if reg, err := regexp.Compile(re); err == nil {
ret = reg.ReplaceAllStringFunc(ret, func(s string) string { return openMark + s + closeMark })
}
ret = strings.ReplaceAll(ret, "\ue000", "&#34;")
ret = strings.ReplaceAll(ret, "\ue001", "&lt;")
ret = strings.ReplaceAll(ret, "\ue002", "&gt;")
// 搜索结果预览包含转义符问题 Search results preview contains escape character issue https://github.com/siyuan-note/siyuan/issues/9790
ret = strings.ReplaceAll(ret, "\\<span", "\\\\<span")

View File

@ -39,7 +39,7 @@ func disableCache() {
cacheDisabled = true
}
var blockCache, _ = ristretto.NewCache[string, *Block](&ristretto.Config[string, *Block]{
var blockCache, _ = ristretto.NewCache(&ristretto.Config{
NumCounters: 102400,
MaxCost: 10240,
BufferItems: 64,
@ -71,7 +71,7 @@ func getBlockCache(id string) (ret *Block) {
b, _ := blockCache.Get(id)
if nil != b {
ret = b
ret = b.(*Block)
}
return
}

View File

@ -80,6 +80,7 @@ func NewLute() (ret *lute.Lute) {
ret.SetLinkRef(false)
ret.SetCodeSyntaxHighlight(false)
ret.SetSanitize(true)
ret.SetUnorderedListMarker("-")
return
}