summaryrefslogtreecommitdiffstats
path: root/web/react/components/search_results_item.jsx
diff options
context:
space:
mode:
authorhmhealey <harrisonmhealey@gmail.com>2015-09-14 11:48:07 -0400
committerhmhealey <harrisonmhealey@gmail.com>2015-09-14 12:22:02 -0400
commit15aa853da5f6be8a95970d73a700afc6b626c572 (patch)
tree76295c2eca6a3218466292127e68626adfdf6a76 /web/react/components/search_results_item.jsx
parent3e3b52554a49b8c2d9c242061bfc82be2948b645 (diff)
downloadchat-15aa853da5f6be8a95970d73a700afc6b626c572.tar.gz
chat-15aa853da5f6be8a95970d73a700afc6b626c572.tar.bz2
chat-15aa853da5f6be8a95970d73a700afc6b626c572.zip
Removed all calls to textToJsx and replaced them with calls to TextFormatting
Diffstat (limited to 'web/react/components/search_results_item.jsx')
-rw-r--r--web/react/components/search_results_item.jsx16
1 files changed, 13 insertions, 3 deletions
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
+};