mirror of
https://github.com/aljazceru/njump.git
synced 2025-12-18 14:54:24 +01:00
inline emojis
This commit is contained in:
committed by
fiatjaf_
parent
4dda52cfb9
commit
d7dc4b2976
@@ -23,7 +23,11 @@ templ headCommonTemplate(params HeadParams) {
|
||||
} else {
|
||||
<link rel="stylesheet" type="text/css" href={ "/njump/static/tailwind-bundle.min.css?t=" + compileTimeTs }/>
|
||||
}
|
||||
<style> @media print { @page { margin: 2cm 3cm; } } </style>
|
||||
<style>
|
||||
.note { line-height: 0px; }
|
||||
.note img { width: 1em; height: 1em; display: inline; margin: 0px; }
|
||||
@media print { @page { margin: 2cm 3cm; } }
|
||||
</style>
|
||||
<meta name="theme-color" content="#e42a6d"/>
|
||||
if params.NaddrNaked != "" {
|
||||
<link rel="canonical" href={ "https://njump.me/" + params.NaddrNaked }/>
|
||||
|
||||
@@ -19,7 +19,7 @@ templ noteTemplate(params NotePageParams) {
|
||||
</h1>
|
||||
}
|
||||
<!-- main content -->
|
||||
<div dir="auto">
|
||||
<div dir="auto" class="note">
|
||||
@templ.Raw(params.Content)
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -347,6 +347,12 @@ func renderEvent(w http.ResponseWriter, r *http.Request) {
|
||||
enhancedCode = data.naddr
|
||||
}
|
||||
|
||||
content := data.content
|
||||
for _, tag := range data.event.Tags.GetAll([]string{"emoji"}) {
|
||||
if len(tag) >= 3 {
|
||||
content = strings.ReplaceAll(content, ":"+tag[1]+":", `<img src="`+tag[2]+`"/>`)
|
||||
}
|
||||
}
|
||||
component = noteTemplate(NotePageParams{
|
||||
BaseEventPageParams: baseEventPageParams,
|
||||
OpenGraphParams: opengraph,
|
||||
@@ -359,7 +365,7 @@ func renderEvent(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
Clients: generateClientList(data.event.Kind, enhancedCode),
|
||||
Details: detailsData,
|
||||
Content: template.HTML(data.content),
|
||||
Content: template.HTML(content),
|
||||
Subject: subject,
|
||||
TitleizedContent: titleizedContent,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user