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.jsx21
1 files changed, 10 insertions, 11 deletions
diff --git a/webapp/components/suggestion/emoticon_provider.jsx b/webapp/components/suggestion/emoticon_provider.jsx
index 7a45c5b4e..af8cac070 100644
--- a/webapp/components/suggestion/emoticon_provider.jsx
+++ b/webapp/components/suggestion/emoticon_provider.jsx
@@ -3,6 +3,7 @@
import React from 'react';
+import EmojiStore from 'stores/emoji_store.jsx';
import * as Emoticons from 'utils/emoticons.jsx';
import SuggestionStore from 'stores/suggestion_store.jsx';
@@ -29,7 +30,7 @@ class EmoticonSuggestion extends Suggestion {
<img
alt={text}
className='emoticon-suggestion__image'
- src={emoticon.path}
+ src={EmojiStore.getEmojiImageUrl(emoticon)}
title={text}
/>
</div>
@@ -53,21 +54,19 @@ export default class EmoticonProvider {
const matched = [];
- const emoticons = Emoticons.getEmoticonsByName();
-
// check for text emoticons
for (const emoticon of Object.keys(Emoticons.emoticonPatterns)) {
if (Emoticons.emoticonPatterns[emoticon].test(text)) {
- SuggestionStore.addSuggestion(suggestionId, text, emoticons.get(emoticon), EmoticonSuggestion, text);
+ SuggestionStore.addSuggestion(suggestionId, text, EmojiStore.get(emoticon), EmoticonSuggestion, text);
hasSuggestions = true;
}
}
- // checked for named emoji
- for (const [name, emoticon] of emoticons) {
+ // check for named emoji
+ for (const [name, emoji] of EmojiStore.getEmojis()) {
if (name.indexOf(partialName) !== -1) {
- matched.push(emoticon);
+ matched.push(emoji);
if (matched.length >= MAX_EMOTICON_SUGGESTIONS) {
break;
@@ -77,11 +76,11 @@ export default class EmoticonProvider {
// sort the emoticons so that emoticons starting with the entered text come first
matched.sort((a, b) => {
- const aPrefix = a.alias.startsWith(partialName);
- const bPrefix = b.alias.startsWith(partialName);
+ const aPrefix = a.name.startsWith(partialName);
+ const bPrefix = b.name.startsWith(partialName);
if (aPrefix === bPrefix) {
- return a.alias.localeCompare(b.alias);
+ return a.name.localeCompare(b.name);
} else if (aPrefix) {
return -1;
}
@@ -89,7 +88,7 @@ export default class EmoticonProvider {
return 1;
});
- const terms = matched.map((emoticon) => ':' + emoticon.alias + ':');
+ const terms = matched.map((emoticon) => ':' + emoticon.name + ':');
if (terms.length > 0) {
SuggestionStore.addSuggestions(suggestionId, terms, matched, EmoticonSuggestion, text);