diff options
Diffstat (limited to 'src/components/emoji_input/emoji_input.js')
| -rw-r--r-- | src/components/emoji_input/emoji_input.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/components/emoji_input/emoji_input.js b/src/components/emoji_input/emoji_input.js index d32e19bf..3deeb6c8 100644 --- a/src/components/emoji_input/emoji_input.js +++ b/src/components/emoji_input/emoji_input.js @@ -175,13 +175,13 @@ const EmojiInput = { showSuggestions: function (newValue) { this.$emit('shown', newValue) }, - textAtCaret: async function (textAtCaret) { - const firstchar = textAtCaret.charAt(0) + textAtCaret: async function (newWord) { + const firstchar = newWord.charAt(0) this.suggestions = [] - if (textAtCaret === firstchar) return - const matchedSuggestions = await this.suggest(textAtCaret) - // Async, cancel if textAtCaret has been updated while waiting - if (this.textAtCaret !== textAtCaret) return + if (newWord === firstchar) return + const matchedSuggestions = await this.suggest(newWord) + // Async: cancel if textAtCaret has changed during wait + if (this.textAtCaret !== newWord) return if (matchedSuggestions.length <= 0) return this.suggestions = take(matchedSuggestions, 5) .map(({ imageUrl, ...rest }) => ({ |
