- Fix emoji not being replaced in issue title change text - Make the image attributes consistent, add alt, remove align Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>tags/v1.13.0-rc1
@@ -481,6 +481,7 @@ func createCustomEmoji(alias, class string) *html.Node { | |||||
Attr: []html.Attribute{}, | Attr: []html.Attribute{}, | ||||
} | } | ||||
if class != "" { | if class != "" { | ||||
img.Attr = append(img.Attr, html.Attribute{Key: "alt", Val: fmt.Sprintf(`:%s:`, alias)}) | |||||
img.Attr = append(img.Attr, html.Attribute{Key: "src", Val: fmt.Sprintf(`%s/img/emoji/%s.png`, setting.StaticURLPrefix, alias)}) | img.Attr = append(img.Attr, html.Attribute{Key: "src", Val: fmt.Sprintf(`%s/img/emoji/%s.png`, setting.StaticURLPrefix, alias)}) | ||||
} | } | ||||
@@ -255,7 +255,7 @@ func TestRender_emoji(t *testing.T) { | |||||
//Text that should be turned into or recognized as emoji | //Text that should be turned into or recognized as emoji | ||||
test( | test( | ||||
":gitea:", | ":gitea:", | ||||
`<p><span class="emoji" aria-label="gitea"><img src="`+setting.StaticURLPrefix+`/img/emoji/gitea.png"/></span></p>`) | |||||
`<p><span class="emoji" aria-label="gitea"><img alt=":gitea:" src="`+setting.StaticURLPrefix+`/img/emoji/gitea.png"/></span></p>`) | |||||
test( | test( | ||||
"Some text with 😄 in the middle", | "Some text with 😄 in the middle", | ||||
@@ -607,7 +607,7 @@ func ReactionToEmoji(reaction string) template.HTML { | |||||
if val != nil { | if val != nil { | ||||
return template.HTML(val.Emoji) | return template.HTML(val.Emoji) | ||||
} | } | ||||
return template.HTML(fmt.Sprintf(`<img src=%s/img/emoji/%s.png></img>`, setting.StaticURLPrefix, reaction)) | |||||
return template.HTML(fmt.Sprintf(`<img alt=":%s:" src="%s/img/emoji/%s.png"></img>`, reaction, setting.StaticURLPrefix, reaction)) | |||||
} | } | ||||
// RenderNote renders the contents of a git-notes file as a commit message. | // RenderNote renders the contents of a git-notes file as a commit message. | ||||
@@ -218,7 +218,7 @@ | |||||
</a> | </a> | ||||
<span class="text grey"> | <span class="text grey"> | ||||
<a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> | <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> | ||||
{{$.i18n.Tr "repo.issues.change_title_at" (.OldTitle|Escape) (.NewTitle|Escape) $createdStr | Safe}} | |||||
{{$.i18n.Tr "repo.issues.change_title_at" (.OldTitle|RenderEmoji) (.NewTitle|RenderEmoji) $createdStr | Safe}} | |||||
</span> | </span> | ||||
</div> | </div> | ||||
{{else if eq .Type 11}} | {{else if eq .Type 11}} | ||||
@@ -24,7 +24,7 @@ for (const key of emojiKeys) { | |||||
export function emojiHTML(name) { | export function emojiHTML(name) { | ||||
let inner; | let inner; | ||||
if (name === 'gitea') { | if (name === 'gitea') { | ||||
inner = `<img class="emoji" alt=":${name}:" src="${StaticUrlPrefix}/img/emoji/gitea.png" align="absmiddle">`; | |||||
inner = `<img alt=":${name}:" src="${StaticUrlPrefix}/img/emoji/gitea.png">`; | |||||
} else { | } else { | ||||
inner = emojiString(name); | inner = emojiString(name); | ||||
} | } | ||||