From 15aa853da5f6be8a95970d73a700afc6b626c572 Mon Sep 17 00:00:00 2001
From: hmhealey <harrisonmhealey@gmail.com>
Date: Mon, 14 Sep 2015 11:48:07 -0400
Subject: Removed all calls to textToJsx and replaced them with calls to
 TextFormatting

---
 web/react/components/search_results_item.jsx | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

(limited to 'web/react/components/search_results_item.jsx')

diff --git a/web/react/components/search_results_item.jsx b/web/react/components/search_results_item.jsx
index aa56f1174..0e951f5c6 100644
--- a/web/react/components/search_results_item.jsx
+++ b/web/react/components/search_results_item.jsx
@@ -10,6 +10,7 @@ var client = require('../utils/client.jsx');
 var AsyncClient = require('../utils/async_client.jsx');
 var AppDispatcher = require('../dispatcher/app_dispatcher.jsx');
 var Constants = require('../utils/constants.jsx');
+var TextFormatting = require('../utils/text_formatting.jsx');
 var ActionTypes = Constants.ActionTypes;
 
 export default class SearchResultsItem extends React.Component {
@@ -56,7 +57,6 @@ export default class SearchResultsItem extends React.Component {
     }
 
     render() {
-        var message = utils.textToJsx(this.props.post.message, {searchTerm: this.props.term, noMentionHighlight: !this.props.isMentionSearch});
         var channelName = '';
         var channel = ChannelStore.get(this.props.post.channel_id);
         var timestamp = UserStore.getCurrentUser().update_at;
@@ -68,6 +68,11 @@ export default class SearchResultsItem extends React.Component {
             }
         }
 
+        const formattingOptions = {
+            searchTerm: this.props.term,
+            mentionHighlight: this.props.isMentionSearch
+        };
+
         return (
             <div
                 className='search-item-container post'
@@ -91,7 +96,12 @@ export default class SearchResultsItem extends React.Component {
                             </time>
                         </li>
                     </ul>
-                    <div className='search-item-snippet'><span>{message}</span></div>
+                    <div className='search-item-snippet'>
+                        <span
+                            onClick={this.handleClick}
+                            dangerouslySetInnerHTML={{__html: TextFormatting.formatText(this.props.post.message, formattingOptions)}}
+                        />
+                    </div>
                 </div>
             </div>
         );
@@ -102,4 +112,4 @@ SearchResultsItem.propTypes = {
     post: React.PropTypes.object,
     isMentionSearch: React.PropTypes.bool,
     term: React.PropTypes.string
-};
\ No newline at end of file
+};
-- 
cgit v1.2.3-1-g7c22

