Add custom emoji support (#16004)

This commit is contained in:
6543 authored and GitHub committed 2021-06-29 16:28:38 +02:00
1 parent aac663e0da
commit 65548359cc
11 files changed
+57 -23

No files matched your search

+4 -3
View File
@@ -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);
}