aboutsummaryrefslogtreecommitdiff
path: root/lib/render.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/render.js')
-rw-r--r--lib/render.js21
1 files changed, 18 insertions, 3 deletions
diff --git a/lib/render.js b/lib/render.js
index 2c2278c..0135205 100644
--- a/lib/render.js
+++ b/lib/render.js
@@ -88,13 +88,26 @@ function Render(app, opts) {
Render.prototype.emoji = function (emoji) {
var name = ':' + emoji + ':'
- return emoji in emojis ?
- h('img.ssb-emoji', {
+ if (emoji in emojis) {
+ return h('img.ssb-emoji', {
src: this.opts.emoji_base + emoji + '.png',
alt: name,
height: 17,
title: name,
- }) : name
+ })
+ }
+ var link = this._mentions[name]
+ if (link && link.link) {
+ this.app.reverseEmojiNameCache.set(emoji, link.link)
+ return h('img.ssb-emoji', {
+ src: this.opts.img_base + link.link,
+ alt: name
+ + (link.size != null ? ' (' + this.formatSize(link.size) + ')' : ''),
+ height: 17,
+ title: name,
+ })
+ }
+ return name
}
/* disabled until it can be done safely without breaking html
@@ -113,6 +126,8 @@ Render.prototype.markdown = function (text, mentions) {
var mentionsByLink = this._mentionsByLink = {}
if (Array.isArray(mentions)) mentions.forEach(function (link) {
if (!link) return
+ else if (link.emoji)
+ mentionsObj[':' + link.name + ':'] = link
else if (link.name)
mentionsObj['@' + link.name] = link.link
else if (link.host === 'http://localhost:7777')