]> cat aescling's git repositories - mastodon.git/commitdiff
do not emojify tm, (R) and (C) (#4472)
authorOndřej Hruška <ondra@ondrovo.com>
Mon, 31 Jul 2017 22:16:05 +0000 (00:16 +0200)
committerEugen Rochko <eugen@zeonfederated.com>
Mon, 31 Jul 2017 22:16:05 +0000 (00:16 +0200)
app/javascript/mastodon/emoji.js

index 9b58cacf59b3f62de6ea6028eb0afa29e2f30fdd..5695c86dd353538d9302d3e28840b91f10b829dc 100644 (file)
@@ -3,6 +3,8 @@ import Trie from 'substring-trie';
 
 const trie = new Trie(Object.keys(unicodeMapping));
 
+const excluded = ['™', '©', '®'];
+
 function emojify(str) {
   // This walks through the string from start to end, ignoring any tags (<p>, <br>, etc.)
   // and replacing valid unicode strings
@@ -19,7 +21,7 @@ function emojify(str) {
       insideTag = true;
     } else if (!insideTag && (match = trie.search(str.substring(i)))) {
       const unicodeStr = match;
-      if (unicodeStr in unicodeMapping) {
+      if (unicodeStr in unicodeMapping && excluded.indexOf(unicodeStr) === -1) {
         const [filename, shortCode] = unicodeMapping[unicodeStr];
         const alt      = unicodeStr;
         const replacement =  `<img draggable="false" class="emojione" alt="${alt}" title=":${shortCode}:" src="/emoji/${filename}.svg" />`;