feat(空格处理): 规范空格转义,修复文字错位
build.yaml / build (push) Successful in 48s

This commit is contained in:
xiaoqidun committed 2026-10-12 23:39:27 +08:00
1 parent f8263f798f
commit 85fbb77d63
4 files changed
+25 -2

No files matched your search

+9
View File
@@ -239,10 +239,19 @@ func editorXMLTextValue(data []byte, node *editorXML, before, after string) ([]b
if before == after {
return data[node.start:node.end], nil
}
textCode := node.matchesOFD("TextCode")
if textCode {
after = textCodeXMLValue(after)
}
var content bytes.Buffer
if err := xml.EscapeText(&content, []byte(after)); err != nil {
return nil, err
}
if textCode && bytes.IndexByte(content.Bytes(), ' ') >= 0 {
escaped := bytes.ReplaceAll(content.Bytes(), []byte(" "), []byte(" "))
content.Reset()
content.Write(escaped)
}
if node.open < node.close {
inner := data[node.open:node.close]
decoder := xml.NewDecoder(bytes.NewReader(inner))