diff options
author | 6543 <6543@obermui.de> | 2021-06-29 16:28:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-29 16:28:38 +0200 |
commit | 65548359cc5c78455b638c5be6fdec3e321e717a (patch) | |
tree | 0236a4aaa8e0c2a781e0383a39a667cf03528a1e /web_src/js | |
parent | aac663e0da0af644ae1011d268d027160265dce3 (diff) | |
download | gitea-65548359cc5c78455b638c5be6fdec3e321e717a.tar.gz gitea-65548359cc5c78455b638c5be6fdec3e321e717a.zip |
Add custom emoji support (#16004)
Diffstat (limited to 'web_src/js')
-rw-r--r-- | web_src/js/features/emoji.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/web_src/js/features/emoji.js b/web_src/js/features/emoji.js index 7a522b95fc..254a0b5c4d 100644 --- a/web_src/js/features/emoji.js +++ b/web_src/js/features/emoji.js @@ -1,8 +1,9 @@ import emojis from '../../../assets/emoji.json'; const {AssetUrlPrefix} = window.config; +const {CustomEmojis} = window.config; -const tempMap = {gitea: ':gitea:'}; +const tempMap = {...CustomEmojis}; for (const {emoji, aliases} of emojis) { for (const alias of aliases || []) { tempMap[alias] = emoji; @@ -23,8 +24,8 @@ for (const key of emojiKeys) { // retrieve HTML for given emoji name export function emojiHTML(name) { let inner; - if (name === 'gitea') { - inner = `<img alt=":${name}:" src="${AssetUrlPrefix}/img/emoji/gitea.png">`; + if (Object.prototype.hasOwnProperty.call(CustomEmojis, name)) { + inner = `<img alt=":${name}:" src="${AssetUrlPrefix}/img/emoji/${name}.png">`; } else { inner = emojiString(name); } |