Skip VS15 (Emoji textual presentation). (#8553)

Mastodon converts all Emoji to images, whether they have a VS15 after
them or not, but leaves the VS15 in the string, which is displayed as
a black box in Safari.
This commit is contained in:
M Somerville
2018-09-01 18:42:02 +01:00
committed by Eugen Rochko
parent 5c609c7419
commit a060beee72
2 changed files with 9 additions and 0 deletions

View File

@ -62,6 +62,10 @@ const emojify = (str, customEmojis = {}) => {
const title = shortCode ? `:${shortCode}:` : '';
replacement = `<img draggable="false" class="emojione" alt="${match}" title="${title}" src="${assetHost}/emoji/${filename}.svg" />`;
rend = i + match.length;
// If the matched character was followed by VS15 (for selecting text presentation), skip it.
if (str.codePointAt(rend) === 65038) {
rend += 1;
}
}
rtn += str.slice(0, i) + replacement;
str = str.slice(rend);