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

This commit is contained in:
Vanessa
2026-03-11 21:55:38 +08:00
9 changed files with 118 additions and 43 deletions
+3 -3
View File
@@ -14,10 +14,10 @@ Install pnpm: `npm install -g pnpm@10.30.3`
Set the Electron mirror environment variable and install Electron:
* macOS/Linux: `ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ pnpm install electron@39.7.0 -D`
* macOS/Linux: `ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ pnpm install electron@40.8.0 -D`
* Windows:
* `SET ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/`
* `pnpm install electron@39.7.0 -D`
* `pnpm install electron@40.8.0 -D`
NPM mirror:
@@ -27,7 +27,7 @@ NPM mirror:
Enter the app folder and execute:
* `pnpm install electron@39.7.0 -D`
* `pnpm install electron@40.8.0 -D`
* `pnpm run dev`
* `pnpm run start`
+3 -3
View File
@@ -14,10 +14,10 @@
设置 Electron 镜像环境变量并安装 Electron:
* macOS/Linux:`ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ pnpm install electron@39.7.0 -D`
* macOS/Linux:`ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ pnpm install electron@40.8.0 -D`
* Windows:
* `SET ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/`
* `pnpm install electron@39.7.0 -D`
* `pnpm install electron@40.8.0 -D`
NPM 镜像:
@@ -27,7 +27,7 @@ NPM 镜像:
进入 app 文件夹执行:
* `pnpm install electron@39.7.0 -D`
* `pnpm install electron@40.8.0 -D`
* `pnpm run dev`
* `pnpm run start`
+2 -2
View File
@@ -4,7 +4,7 @@
"description": "Refactor your thinking",
"homepage": "https://b3log.org/siyuan",
"main": "./electron/main.js",
"packageManager": "pnpm@10.30.3",
"packageManager": "pnpm@10.32.1",
"scripts": {
"lint": "eslint . --fix --cache",
"dev": "webpack --mode development",
@@ -57,7 +57,7 @@
"clean-webpack-plugin": "^4.0.0",
"css-loader": "^7.1.2",
"dayjs": "^1.11.5",
"electron": "39.7.0",
"electron": "40.8.0",
"electron-builder": "26.0.12",
"encoding": "^0.1.13",
"esbuild-loader": "^3.0.1",
+18 -29
View File
@@ -10,7 +10,7 @@ importers:
dependencies:
'@electron/remote':
specifier: ^2.1.3
version: 2.1.3(electron@39.7.0)
version: 2.1.3(electron@40.8.0)
devDependencies:
'@eslint/eslintrc':
specifier: ^3.3.1
@@ -40,8 +40,8 @@ importers:
specifier: ^1.11.5
version: 1.11.19
electron:
specifier: 39.7.0
version: 39.7.0
specifier: 40.8.0
version: 40.8.0
electron-builder:
specifier: 26.0.12
version: 26.0.12(electron-builder-squirrel-windows@26.0.12)
@@ -550,8 +550,8 @@ packages:
'@types/node@18.19.130':
resolution: {integrity: sha512-GRaXQx6jGfL8sKfaIDD6OupbIHBr9jv7Jnaml9tB7l4v068PAOXqfcujMMo5PhbIs6ggR1XODELqahT2R8v0fg==}
'@types/node@22.19.13':
resolution: {integrity: sha512-akNQMv0wW5uyRpD2v2IEyRSZiR+BeGuoB6L310EgGObO44HSMNT8z1xzio28V8qOrgYaopIDNA18YgdXd+qTiw==}
'@types/node@24.12.0':
resolution: {integrity: sha512-GYDxsZi3ChgmckRT9HPU0WEhKLP08ev/Yfcq2AstjrDASOYCSXeyjDsHg4v5t4jOj7cyDX3vmprafKlWIG9MXQ==}
'@types/plist@3.0.5':
resolution: {integrity: sha512-E6OCaRmAe4WDmWNsL/9RMqdkkzDCY1etutkflWk4c+AcjDU07Pcz1fQwTX0TQz+Pxqn9i4L1TU3UFpjnrcDgxA==}
@@ -1185,8 +1185,8 @@ packages:
resolution: {integrity: sha512-bO3y10YikuUwUuDUQRM4KfwNkKhnpVO7IPdbsrejwN9/AABJzzTQ4GeHwyzNSrVO+tEH3/Np255a3sVZpZDjvg==}
engines: {node: '>=8.0.0'}
electron@39.7.0:
resolution: {integrity: sha512-Rz5QvP1pTqoU1DPRrG3EeX2oWBtS3uRmd6Z/wzZsb2e/iIUsrT+XcBaAhFr4FW48gDc8uP2wYVyY5Aamha/5Zg==}
electron@40.8.0:
resolution: {integrity: sha512-WoPq0Nr9Yx3g7T6VnJXdwa/rr2+VRyH3a+K+ezfMKBlf6WjxE/LmhMQabKbb6yjm9RbZhJBRcYyoLph421O2mQ==}
engines: {node: '>= 12.20.55'}
hasBin: true
@@ -1411,10 +1411,6 @@ packages:
resolution: {integrity: sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==}
engines: {node: '>=12'}
fs-extra@11.3.3:
resolution: {integrity: sha512-VWSRii4t0AFm6ixFFmLLx1t7wS1gh+ckoa84aOeapGum0h+EZd1EhEumSB+ZdDLnEPuucsVB9oB7cxJHap6Afg==}
engines: {node: '>=14.14'}
fs-extra@11.3.4:
resolution: {integrity: sha512-CTXd6rk/M3/ULNQj8FBqBWHYBVYybQ3VPBw0xGKFe3tuH7ytT6ACnvzpIQ3UZtB8yvUKC2cXn1a+x+5EVQLovA==}
engines: {node: '>=14.14'}
@@ -1479,7 +1475,7 @@ packages:
glob@8.1.0:
resolution: {integrity: sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==}
engines: {node: '>=12'}
deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me
deprecated: Glob versions prior to v9 are no longer supported
global-agent@3.0.0:
resolution: {integrity: sha512-PT6XReJ+D07JvGoxQMkT6qji/jVNfX/h364XHZOWeRzy64sSFr+xJ5OX7LI3b4MPQzdL4H8Y8M0xzPpsVMwA8Q==}
@@ -2582,8 +2578,8 @@ packages:
undici-types@5.26.5:
resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==}
undici-types@6.21.0:
resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==}
undici-types@7.16.0:
resolution: {integrity: sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==}
unique-filename@2.0.1:
resolution: {integrity: sha512-ODWHtkkdx3IAR+veKxFV+VBkUMcN+FaqzUUd7IZzt+0zhDZFPFxhlqwPF3YQvMHx1TD0tdgYl+kuPnJ8E6ql7A==}
@@ -2835,9 +2831,9 @@ snapshots:
- bluebird
- supports-color
'@electron/remote@2.1.3(electron@39.7.0)':
'@electron/remote@2.1.3(electron@40.8.0)':
dependencies:
electron: 39.7.0
electron: 40.8.0
'@electron/universal@2.0.1':
dependencies:
@@ -2845,7 +2841,7 @@ snapshots:
'@malept/cross-spawn-promise': 2.0.0
debug: 4.4.3
dir-compare: 4.2.0
fs-extra: 11.3.3
fs-extra: 11.3.4
minimatch: 9.0.9
plist: 3.1.0
transitivePeerDependencies:
@@ -3167,9 +3163,9 @@ snapshots:
dependencies:
undici-types: 5.26.5
'@types/node@22.19.13':
'@types/node@24.12.0':
dependencies:
undici-types: 6.21.0
undici-types: 7.16.0
'@types/plist@3.0.5':
dependencies:
@@ -3964,10 +3960,10 @@ snapshots:
transitivePeerDependencies:
- supports-color
electron@39.7.0:
electron@40.8.0:
dependencies:
'@electron/get': 2.0.3
'@types/node': 22.19.13
'@types/node': 24.12.0
extract-zip: 2.0.1
transitivePeerDependencies:
- supports-color
@@ -4221,18 +4217,11 @@ snapshots:
jsonfile: 6.2.0
universalify: 2.0.1
fs-extra@11.3.3:
dependencies:
graceful-fs: 4.2.11
jsonfile: 6.2.0
universalify: 2.0.1
fs-extra@11.3.4:
dependencies:
graceful-fs: 4.2.11
jsonfile: 6.2.0
universalify: 2.0.1
optional: true
fs-extra@7.0.1:
dependencies:
@@ -5370,7 +5359,7 @@ snapshots:
undici-types@5.26.5: {}
undici-types@6.21.0: {}
undici-types@7.16.0: {}
unique-filename@2.0.1:
dependencies:
+3 -3
View File
@@ -1168,7 +1168,7 @@ func UnusedAssets(sorted bool) (ret []*UnusedItem) {
if strings.HasPrefix(p, "/") {
p = p[1:]
}
name := util.RemoveID(path.Base(p))
name := path.Base(p)
var modTime time.Time
if sorted {
@@ -1261,11 +1261,11 @@ func MissingAssets() (ret []*UnusedItem) {
if strings.HasPrefix(dest, "assets/.") {
// Assets starting with `.` should not be considered missing assets https://github.com/siyuan-note/siyuan/issues/8821
if !filelock.IsExist(filepath.Join(util.DataDir, dest)) {
name := util.RemoveID(path.Base(dest))
name := path.Base(dest)
ret = append(ret, &UnusedItem{Item: dest, Name: name})
}
} else {
name := util.RemoveID(path.Base(dest))
name := path.Base(dest)
ret = append(ret, &UnusedItem{Item: dest, Name: name})
}
continue
+14
View File
@@ -1259,8 +1259,22 @@ func closeUserGuide() {
unindex(boxID)
sql.FlushQueue()
if removeErr := filelock.Remove(boxDirPath); nil != removeErr {
logging.LogErrorf("remove corrupted user guide box [%s] failed: %s", boxDirPath, removeErr)
util.PushClearMsg(msgId)
continue
}
if avFiles, readAvErr := getUserGuideAVJSONFiles(boxID); nil == readAvErr {
for _, avName := range avFiles {
avFilePath := filepath.Join(util.DataDir, "storage", "av", avName)
if removeErr := filelock.Remove(avFilePath); nil != removeErr {
logging.LogErrorf("remove av file [%s] failed: %s", avFilePath, removeErr)
} else {
logging.LogInfof("removed av file [%s]", avFilePath)
}
}
}
util.PushClearMsg(msgId)
+25 -2
View File
@@ -2430,8 +2430,14 @@ func exportTree(tree *parse.Tree, wysiwyg, keepFold, avHiddenCol bool,
resolveEmbedR(ret.Root, blockEmbedMode, luteEngine, &[]string{}, &depth)
// 将块超链接转换为引用
depth = 0
blockLink2Ref(ret, ret.ID, &depth)
if 4 == blockRefMode {
// 脚注+锚点哈希模式下保持原有的全图递归逻辑
depth = 0
blockLink2Ref(ret, ret.ID, &depth)
} else {
// 锚文本块链(2)和仅锚文本(3)模式下,只在当前导出树中将块链接浅转换为块引用,不再做跨文档递归
blockLink2RefShallow(ret)
}
// 收集引用转脚注+锚点哈希
var refFootnotes []*refAsFootnotes
@@ -3262,6 +3268,23 @@ func blockLink2Ref0(currentTree *parse.Tree, node *ast.Node, depth *int) {
})
}
// blockLink2RefShallow 只在当前导出树中将块链接转换为块引用,不进行跨文档递归。
// 用于 blockRefMode 为 2/3 的场景,以避免在锚文本模式下遍历整个引用图。
func blockLink2RefShallow(currentTree *parse.Tree) {
ast.Walk(currentTree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
if !entering {
return ast.WalkContinue
}
if treenode.IsBlockLink(n) {
n.TextMarkType = strings.TrimSpace(strings.TrimPrefix(n.TextMarkType, "a") + " block-ref")
n.TextMarkBlockRefID = strings.TrimPrefix(n.TextMarkAHref, "siyuan://blocks/")
n.TextMarkBlockRefSubtype = "s"
}
return ast.WalkContinue
})
}
func collectFootnotesDefs(currentTree *parse.Tree, id string, refFootnotes *[]*refAsFootnotes, depth *int) {
*depth++
if 4096 < *depth {
+45
View File
@@ -271,3 +271,48 @@ func Mount(boxID string) (alreadyMount bool, err error) {
func IsUserGuide(boxID string) bool {
return "20210808180117-czj9bvb" == boxID || "20210808180117-6v0mkxr" == boxID || "20211226090932-5lcq56f" == boxID || "20240530133126-axarxgx" == boxID
}
func getUserGuideAVJSONFiles(boxID string) (ret []string, err error) {
guideAVDirPath := filepath.Join(util.WorkingDir, "guide", boxID, "storage", "av")
if !filelock.IsExist(guideAVDirPath) {
logging.LogErrorf("guide av dir [%s] not exist", guideAVDirPath)
return
}
avEntries, err := os.ReadDir(guideAVDirPath)
if nil != err {
logging.LogErrorf("read guide av dir [%s] failed: %s", guideAVDirPath, err)
return
}
for _, avEntry := range avEntries {
avName := avEntry.Name()
if avEntry.IsDir() || !strings.HasSuffix(avName, ".json") || !ast.IsNodeIDPattern(strings.TrimSuffix(avName, ".json")) {
continue
}
ret = append(ret, avName)
}
return
}
func getAllUserGuideAVJSONFiles() (ret []string) {
guideDirPath := filepath.Join(util.WorkingDir, "guide")
guideEntries, err := os.ReadDir(guideDirPath)
if nil != err {
return
}
for _, guideEntry := range guideEntries {
boxID := guideEntry.Name()
if !guideEntry.IsDir() || !IsUserGuide(boxID) {
continue
}
avFiles, err := getUserGuideAVJSONFiles(boxID)
if nil != err {
continue
}
ret = append(ret, avFiles...)
}
return
}
+5 -1
View File
@@ -702,11 +702,15 @@ func getSyncIgnoreLines() (ret []string) {
dataStr = strings.ReplaceAll(dataStr, "\r\n", "\n")
ret = strings.Split(dataStr, "\n")
// 默认忽略帮助文档
// 忽略用户指南
ret = append(ret, "20210808180117-6v0mkxr/**/*")
ret = append(ret, "20210808180117-czj9bvb/**/*")
ret = append(ret, "20211226090932-5lcq56f/**/*")
ret = append(ret, "20240530133126-axarxgx/**/*")
// 忽略用户指南的数据库 JSON 文件
for _, avName := range getAllUserGuideAVJSONFiles() {
ret = append(ret, "/storage/av/"+avName)
}
ret = gulu.Str.RemoveDuplicatedElem(ret)
return