summaryrefslogtreecommitdiffstats
path: root/webapp/components/suggestion/emoticon_provider.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/components/suggestion/emoticon_provider.jsx')
-rw-r--r--webapp/components/suggestion/emoticon_provider.jsx20
1 files changed, 7 insertions, 13 deletions
diff --git a/webapp/components/suggestion/emoticon_provider.jsx b/webapp/components/suggestion/emoticon_provider.jsx
index b7f4cd513..a110796e1 100644
--- a/webapp/components/suggestion/emoticon_provider.jsx
+++ b/webapp/components/suggestion/emoticon_provider.jsx
@@ -1,14 +1,16 @@
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-import SuggestionStore from 'stores/suggestion_store.jsx';
+import React from 'react';
+
import * as Emoticons from 'utils/emoticons.jsx';
+import SuggestionStore from 'stores/suggestion_store.jsx';
-const MAX_EMOTICON_SUGGESTIONS = 40;
+import Suggestion from './suggestion.jsx';
-import React from 'react';
+const MAX_EMOTICON_SUGGESTIONS = 40;
-class EmoticonSuggestion extends React.Component {
+class EmoticonSuggestion extends Suggestion {
render() {
const text = this.props.term;
const emoticon = this.props.item;
@@ -39,13 +41,6 @@ class EmoticonSuggestion extends React.Component {
}
}
-EmoticonSuggestion.propTypes = {
- item: React.PropTypes.object.isRequired,
- term: React.PropTypes.string.isRequired,
- isSelection: React.PropTypes.bool,
- onClick: React.PropTypes.func
-};
-
export default class EmoticonProvider {
handlePretextChanged(suggestionId, pretext) {
const captured = (/(?:^|\s)(:([a-zA-Z0-9_+\-]*))$/g).exec(pretext);
@@ -82,8 +77,7 @@ export default class EmoticonProvider {
const terms = matched.map((emoticon) => ':' + emoticon.alias + ':');
if (terms.length > 0) {
- SuggestionStore.setMatchedPretext(suggestionId, text);
- SuggestionStore.addSuggestions(suggestionId, terms, matched, EmoticonSuggestion);
+ SuggestionStore.addSuggestions(suggestionId, terms, matched, EmoticonSuggestion, text);
// force the selection to be cleared since the order of elements may have changed
SuggestionStore.clearSelection(suggestionId);