mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-02 14:58:49 +01:00
🐛 导入 .sy.zip 后查询嵌入块失效 Fix https://github.com/siyuan-note/siyuan/issues/5316
This commit is contained in:
parent
bde581c8ad
commit
8d933b5669
1 changed files with 6 additions and 1 deletions
|
|
@ -116,7 +116,7 @@ func ImportSY(zipPath, boxID, toPath string) (err error) {
|
|||
trees[tree.ID] = tree
|
||||
}
|
||||
|
||||
// 引用指向重新生成的块 ID
|
||||
// 引用和嵌入指向重新生成的块 ID
|
||||
for _, tree := range trees {
|
||||
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
|
||||
if !entering {
|
||||
|
|
@ -129,6 +129,11 @@ func ImportSY(zipPath, boxID, toPath string) (err error) {
|
|||
} else {
|
||||
util.LogWarnf("not found def [" + n.TokensStr() + "]")
|
||||
}
|
||||
} else if ast.NodeBlockQueryEmbedScript == n.Type {
|
||||
for oldID, newID := range blockIDs {
|
||||
// 导入 `.sy.zip` 后查询嵌入块失效 https://github.com/siyuan-note/siyuan/issues/5316
|
||||
n.Tokens = bytes.ReplaceAll(n.Tokens, []byte(oldID), []byte(newID))
|
||||
}
|
||||
}
|
||||
return ast.WalkContinue
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue