From ed3162a59d522981cd6b63e578d31e0a96b5d2ff Mon Sep 17 00:00:00 2001
From: Harrison Healey <harrisonmhealey@gmail.com>
Date: Thu, 5 May 2016 15:35:01 -0400
Subject: Moved twemoji parsing so that it doesn't occur inside of code blocks
 (#2896)

---
 webapp/utils/text_formatting.jsx | 9 +++++++++
 1 file changed, 9 insertions(+)

(limited to 'webapp/utils/text_formatting.jsx')

diff --git a/webapp/utils/text_formatting.jsx b/webapp/utils/text_formatting.jsx
index 88dc412ca..cb61ecc8d 100644
--- a/webapp/utils/text_formatting.jsx
+++ b/webapp/utils/text_formatting.jsx
@@ -7,6 +7,7 @@ import Constants from './constants.jsx';
 import * as Emoticons from './emoticons.jsx';
 import * as Markdown from './markdown.jsx';
 import UserStore from 'stores/user_store.jsx';
+import twemoji from 'twemoji';
 import * as Utils from './utils.jsx';
 
 // Performs formatting of user posts including highlighting mentions and search terms and converting urls, hashtags, and
@@ -62,6 +63,14 @@ export function doFormatText(text, options) {
     // reinsert tokens with formatted versions of the important words and phrases
     output = replaceTokens(output, tokens);
 
+    if (!('emoticons' in options) || options.emoticon) {
+        output = twemoji.parse(output, {
+            className: 'emoticon',
+            base: '',
+            folder: Constants.EMOJI_PATH
+        });
+    }
+
     return output;
 }
 
-- 
cgit v1.2.3-1-g7c22

