Skip to content

Commit 8049c5c

Browse files
committed
🎨 Improve tag panel refresh #14593
1 parent 59c4794 commit 8049c5c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

kernel/model/search.go

+6
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import (
3535
"github.com/88250/gulu"
3636
"github.com/88250/lute"
3737
"github.com/88250/lute/ast"
38+
"github.com/88250/lute/editor"
3839
"github.com/88250/lute/html"
3940
"github.com/88250/lute/lex"
4041
"github.com/88250/lute/parse"
@@ -572,6 +573,7 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
572573
replacement = strings.TrimPrefix(replacement, "#")
573574
replacement = strings.TrimSuffix(replacement, "#")
574575
tags = strings.ReplaceAll(tags, keyword, replacement)
576+
tags = strings.ReplaceAll(tags, editor.Zwsp, "")
575577
node.SetIALAttr("tags", tags)
576578
ReloadTag()
577579
}
@@ -586,6 +588,7 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
586588
replacement = strings.TrimPrefix(replacement, "#")
587589
replacement = strings.TrimSuffix(replacement, "#")
588590
tags = r.ReplaceAllString(tags, replacement)
591+
tags = strings.ReplaceAll(tags, editor.Zwsp, "")
589592
node.SetIALAttr("tags", tags)
590593
ReloadTag()
591594
}
@@ -971,6 +974,7 @@ func replaceNodeTextMarkTextContent(n *ast.Node, method int, keyword, escapedKey
971974
} else if strings.Contains(content, keyword) {
972975
content = strings.ReplaceAll(content, keyword, replacement)
973976
}
977+
content = strings.ReplaceAll(content, editor.Zwsp, "")
974978

975979
tree := parse.Inline("", []byte(content), luteEngine.ParseOptions)
976980
if nil == tree.Root.FirstChild {
@@ -1009,10 +1013,12 @@ func replaceNodeTextMarkTextContent(n *ast.Node, method int, keyword, escapedKey
10091013
} else if strings.Contains(n.TextMarkTextContent, keyword) {
10101014
n.TextMarkTextContent = strings.ReplaceAll(n.TextMarkTextContent, keyword, replacement)
10111015
}
1016+
n.TextMarkTextContent = strings.ReplaceAll(n.TextMarkTextContent, editor.Zwsp, "")
10121017
} else if 3 == method {
10131018
if nil != r && r.MatchString(n.TextMarkTextContent) {
10141019
n.TextMarkTextContent = r.ReplaceAllString(n.TextMarkTextContent, replacement)
10151020
}
1021+
n.TextMarkTextContent = strings.ReplaceAll(n.TextMarkTextContent, editor.Zwsp, "")
10161022
}
10171023
}
10181024

0 commit comments

Comments
 (0)