From 8a02647de45d5629cbfd0359e9b0a3e1522851d9 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Sun, 9 Jun 2019 21:17:24 +0300 Subject: [PATCH] more bugfixes related to keybinds and nonworking stuff --- src/components/emoji-input/emoji-input.js | 9 +++++---- src/components/user_settings/user_settings.js | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/emoji-input/emoji-input.js b/src/components/emoji-input/emoji-input.js index e6c26106..9e8605bc 100644 --- a/src/components/emoji-input/emoji-input.js +++ b/src/components/emoji-input/emoji-input.js @@ -31,10 +31,10 @@ const EmojiInput = { computed: { suggestions () { const firstchar = this.textAtCaret.charAt(0) - if (this.textAtCaret === firstchar) { return } + if (this.textAtCaret === firstchar) { return [] } const matchedSuggestions = this.suggest(this.textAtCaret) if (matchedSuggestions.length <= 0) { - return false + return [] } return take(matchedSuggestions, 5) .map(({ imageUrl, ...rest }, index) => ({ @@ -89,7 +89,7 @@ const EmojiInput = { this.caret = 0 }, replaceText (e) { - const len = (this.suggestions && this.suggestions.length) || 0 + const len = this.suggestions.length || 0 if (this.textAtCaret.length === 1) { return } if (len > 0) { const suggestion = this.suggestions[this.highlighted] @@ -108,6 +108,7 @@ const EmojiInput = { if (this.highlighted < 0) { this.highlighted = this.suggestions.length - 1 } + e.preventDefault() } else { this.highlighted = 0 } @@ -119,6 +120,7 @@ const EmojiInput = { if (this.highlighted >= len) { this.highlighted = 0 } + e.preventDefault() } else { this.highlighted = 0 } @@ -158,7 +160,6 @@ const EmojiInput = { } if (key === 'ArrowUp') { this.cycleBackward(e) - e.preventDefault() } else if (key === 'ArrowDown') { this.cycleForward(e) } diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js index ca7c23ec..d5db4c2d 100644 --- a/src/components/user_settings/user_settings.js +++ b/src/components/user_settings/user_settings.js @@ -92,7 +92,7 @@ const UserSettings = { }) }, emojiSuggestor () { - suggestor({ emoji: [ + return suggestor({ emoji: [ ...this.$store.state.instance.emoji, ...this.$store.state.instance.customEmoji ]})