Skip to content

Commit 06fbaed

Browse files
committed
Make the toggle-escape-button really a button
1 parent 09e277d commit 06fbaed

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

modules/markup/html.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,11 +1217,10 @@ func filePreviewPatternProcessor(ctx *RenderContext, node *html.Node) {
12171217

12181218
escapeBtn := &html.Node{
12191219
Type: html.ElementNode,
1220-
Data: atom.A.String(),
1220+
Data: atom.Button.String(),
12211221
Attr: []html.Attribute{
12221222
{Key: "class", Val: "toggle-escape-button btn interact-bg"},
12231223
{Key: "title", Val: btnTitle},
1224-
{Key: "href", Val: "javascript:void(0)"},
12251224
},
12261225
}
12271226
tdLinesEscape.AppendChild(escapeBtn)

modules/markup/sanitizer.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ func createDefaultPolicy() *bluemonday.Policy {
131131
policy.AllowAttrs("rel").Matching(regexp.MustCompile("^L[0-9]+$")).OnElements("td")
132132
policy.AllowAttrs("class").Matching(regexp.MustCompile("^file-preview*")).OnElements("table")
133133
policy.AllowAttrs("class").Matching(regexp.MustCompile("^lines-escape$")).OnElements("td")
134-
policy.AllowAttrs("class").Matching(regexp.MustCompile("^toggle-escape-button btn interact-bg$")).OnElements("a")
134+
policy.AllowAttrs("class").Matching(regexp.MustCompile("^toggle-escape-button btn interact-bg$")).OnElements("button")
135+
policy.AllowAttrs("title").OnElements("button")
136+
policy.AllowAttrs()
135137
policy.AllowAttrs("class").Matching(regexp.MustCompile("^ambiguous-code-point$")).OnElements("span")
136138
policy.AllowAttrs("data-tooltip-content").OnElements("span")
137139
policy.AllowAttrs("class").Matching(regexp.MustCompile("muted|(text black)")).OnElements("a")

0 commit comments

Comments
 (0)