diff options
author | Joram Wilander <jwawilander@gmail.com> | 2016-12-26 09:44:20 -0500 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-12-26 09:44:20 -0500 |
commit | 1539730ac1c3c512bf3e528c28ffd50b9adf7afd (patch) | |
tree | 1777b5448b9b6e3d10cdce7834479869c8635aad /webapp/components/suggestion | |
parent | 282f1601e373b0a11e0f6a1fae01abba98cf8a48 (diff) | |
download | chat-1539730ac1c3c512bf3e528c28ffd50b9adf7afd.tar.gz chat-1539730ac1c3c512bf3e528c28ffd50b9adf7afd.tar.bz2 chat-1539730ac1c3c512bf3e528c28ffd50b9adf7afd.zip |
Only show emoji autocomplete after two typed characters (#4895)
Diffstat (limited to 'webapp/components/suggestion')
-rw-r--r-- | webapp/components/suggestion/emoticon_provider.jsx | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/webapp/components/suggestion/emoticon_provider.jsx b/webapp/components/suggestion/emoticon_provider.jsx index d04750159..6bb0aee3b 100644 --- a/webapp/components/suggestion/emoticon_provider.jsx +++ b/webapp/components/suggestion/emoticon_provider.jsx @@ -9,7 +9,7 @@ import SuggestionStore from 'stores/suggestion_store.jsx'; import Suggestion from './suggestion.jsx'; -const MAX_EMOTICON_SUGGESTIONS = 40; +const MIN_EMOTICON_LENGTH = 2; class EmoticonSuggestion extends Suggestion { render() { @@ -53,6 +53,11 @@ export default class EmoticonProvider { const text = captured[2]; const partialName = captured[3]; + if (partialName.length < MIN_EMOTICON_LENGTH) { + SuggestionStore.clearSuggestions(suggestionId); + return; + } + const matched = []; // check for text emoticons if this isn't for an emoji reaction @@ -70,10 +75,6 @@ export default class EmoticonProvider { for (const [name, emoji] of EmojiStore.getEmojis()) { if (name.indexOf(partialName) !== -1) { matched.push(emoji); - - if (matched.length >= MAX_EMOTICON_SUGGESTIONS) { - break; - } } } |