mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-11-25 08:13:24 +00:00
do not emojify tm, (R) and (C) (#4472)
This commit is contained in:
parent
4b6cd1dfdb
commit
e9ee249fd5
|
@ -3,6 +3,8 @@ import Trie from 'substring-trie';
|
||||||
|
|
||||||
const trie = new Trie(Object.keys(unicodeMapping));
|
const trie = new Trie(Object.keys(unicodeMapping));
|
||||||
|
|
||||||
|
const excluded = ['™', '©', '®'];
|
||||||
|
|
||||||
function emojify(str) {
|
function emojify(str) {
|
||||||
// This walks through the string from start to end, ignoring any tags (<p>, <br>, etc.)
|
// This walks through the string from start to end, ignoring any tags (<p>, <br>, etc.)
|
||||||
// and replacing valid unicode strings
|
// and replacing valid unicode strings
|
||||||
|
@ -19,7 +21,7 @@ function emojify(str) {
|
||||||
insideTag = true;
|
insideTag = true;
|
||||||
} else if (!insideTag && (match = trie.search(str.substring(i)))) {
|
} else if (!insideTag && (match = trie.search(str.substring(i)))) {
|
||||||
const unicodeStr = match;
|
const unicodeStr = match;
|
||||||
if (unicodeStr in unicodeMapping) {
|
if (unicodeStr in unicodeMapping && excluded.indexOf(unicodeStr) === -1) {
|
||||||
const [filename, shortCode] = unicodeMapping[unicodeStr];
|
const [filename, shortCode] = unicodeMapping[unicodeStr];
|
||||||
const alt = unicodeStr;
|
const alt = unicodeStr;
|
||||||
const replacement = `<img draggable="false" class="emojione" alt="${alt}" title=":${shortCode}:" src="/emoji/${filename}.svg" />`;
|
const replacement = `<img draggable="false" class="emojione" alt="${alt}" title=":${shortCode}:" src="/emoji/${filename}.svg" />`;
|
||||||
|
|
Loading…
Reference in a new issue