Fixed emoticon code to use an ES6 map properly
Этот коммит содержится в:
@@ -116,19 +116,19 @@ function initializeEmoticonMap() {
|
||||
const out = new Map();
|
||||
|
||||
for (let i = 0; i < emoticonNames.length; i++) {
|
||||
out[emoticonNames[i]] = true;
|
||||
out.set(emoticonNames[i], true);
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
const emoticonMap = initializeEmoticonMap();
|
||||
export const emoticonMap = initializeEmoticonMap();
|
||||
|
||||
export function handleEmoticons(text, tokens) {
|
||||
let output = text;
|
||||
|
||||
function replaceEmoticonWithToken(fullMatch, prefix, matchText, name) {
|
||||
if (emoticonMap[name]) {
|
||||
if (emoticonMap.has(name)) {
|
||||
const index = tokens.size;
|
||||
const alias = `MM_EMOTICON${index}`;
|
||||
|
||||
@@ -159,4 +159,4 @@ export function getImagePathForEmoticon(name) {
|
||||
return `/static/images/emoji/${name}.png`;
|
||||
}
|
||||
return `/static/images/emoji`;
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user