🎨 Double quotes in inline elements are no longer converted to HTML entities when pasting Markdown https://github.com/siyuan-note/siyuan/issues/14503

This commit is contained in:
Daniel 2025-04-03 15:45:57 +08:00
parent 94fe712efd
commit 17de3bc8b1
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
4 changed files with 20 additions and 10 deletions

View file

@ -667,8 +667,11 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
} else if n.IsTextMarkType("a") {
if replaceTypes["aText"] {
if 0 == method {
if strings.Contains(n.TextMarkTextContent, keyword) {
n.TextMarkTextContent = strings.ReplaceAll(n.TextMarkTextContent, keyword, replacement)
content := util.UnescapeHTML(n.TextMarkTextContent)
if strings.Contains(content, escapedKey) {
n.TextMarkTextContent = strings.ReplaceAll(content, escapedKey, replacement)
} else if strings.Contains(content, keyword) {
n.TextMarkTextContent = strings.ReplaceAll(content, keyword, replacement)
}
} else if 3 == method {
if nil != r && r.MatchString(n.TextMarkTextContent) {
@ -683,8 +686,11 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
if replaceTypes["aTitle"] {
if 0 == method {
if strings.Contains(n.TextMarkATitle, keyword) {
n.TextMarkATitle = strings.ReplaceAll(n.TextMarkATitle, keyword, replacement)
title := util.UnescapeHTML(n.TextMarkATitle)
if strings.Contains(title, escapedKey) {
n.TextMarkATitle = strings.ReplaceAll(title, escapedKey, replacement)
} else if strings.Contains(n.TextMarkATitle, keyword) {
n.TextMarkATitle = strings.ReplaceAll(title, keyword, replacement)
}
} else if 3 == method {
if nil != r && r.MatchString(n.TextMarkATitle) {
@ -695,8 +701,11 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
if replaceTypes["aHref"] {
if 0 == method {
if strings.Contains(n.TextMarkAHref, keyword) {
n.TextMarkAHref = strings.ReplaceAll(n.TextMarkAHref, keyword, strings.TrimSpace(replacement))
href := util.UnescapeHTML(n.TextMarkAHref)
if strings.Contains(href, escapedKey) {
n.TextMarkAHref = strings.ReplaceAll(href, escapedKey, util.EscapeHTML(replacement))
} else if strings.Contains(href, keyword) {
n.TextMarkAHref = strings.ReplaceAll(href, keyword, strings.TrimSpace(replacement))
}
} else if 3 == method {
if nil != r && r.MatchString(n.TextMarkAHref) {