mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-20 14:04:06 +01:00
🎨 Support find replace block ref anchor text https://github.com/siyuan-note/siyuan/issues/11978
This commit is contained in:
parent
498cb1ba85
commit
509beee56d
9 changed files with 28 additions and 0 deletions
|
|
@ -747,6 +747,22 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
|
|||
}
|
||||
|
||||
replaceNodeTextMarkTextContent(n, method, keyword, replacement, r, "text")
|
||||
} else if n.IsTextMarkType("block-ref") {
|
||||
if !replaceTypes["blockRef"] {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
|
||||
if 0 == method {
|
||||
if strings.Contains(n.TextMarkTextContent, keyword) {
|
||||
n.TextMarkTextContent = strings.ReplaceAll(n.TextMarkTextContent, keyword, replacement)
|
||||
n.TextMarkBlockRefSubtype = "s"
|
||||
}
|
||||
} else if 3 == method {
|
||||
if nil != r && r.MatchString(n.TextMarkTextContent) {
|
||||
n.TextMarkTextContent = r.ReplaceAllString(n.TextMarkTextContent, replacement)
|
||||
n.TextMarkBlockRefSubtype = "s"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ast.WalkContinue
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue