mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-03 06:41:44 +08:00
🐛 Find-replace escaped characters will lose content https://github.com/siyuan-note/siyuan/issues/14438
This commit is contained in:
parent
5c1961cb7e
commit
86106d62c0
@ -592,8 +592,12 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
|
|||||||
unlinks = append(unlinks, n.Parent)
|
unlinks = append(unlinks, n.Parent)
|
||||||
|
|
||||||
prev, next := n.Parent.Previous, n.Parent.Next
|
prev, next := n.Parent.Previous, n.Parent.Next
|
||||||
|
for ; prev != nil && ast.NodeText == prev.Type && prev.Tokens == nil; prev = prev.Previous {
|
||||||
|
// Tokens 为空的节点是之前处理过的节点,需要跳过
|
||||||
|
}
|
||||||
if nil != prev && ast.NodeText == prev.Type && nil != next && ast.NodeText == next.Type {
|
if nil != prev && ast.NodeText == prev.Type && nil != next && ast.NodeText == next.Type {
|
||||||
prev.Tokens = append(prev.Tokens, next.Tokens...)
|
prev.Tokens = append(prev.Tokens, next.Tokens...)
|
||||||
|
next.Tokens = nil // 将 Tokens 设置为空,表示该节点已经被处理过
|
||||||
unlinks = append(unlinks, next)
|
unlinks = append(unlinks, next)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user