aboutsummaryrefslogtreecommitdiff
path: root/src/components/emoji-input/emoji-input.js
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2019-06-09 21:17:24 +0300
committerHenry Jameson <me@hjkos.com>2019-06-09 21:17:24 +0300
commit8a02647de45d5629cbfd0359e9b0a3e1522851d9 (patch)
tree45d10e0c9bdbb1d9b7251d846d14adf3e17d7e13 /src/components/emoji-input/emoji-input.js
parent20923d590c399d7d29fbf5a6c6c140d981256fa1 (diff)
more bugfixes related to keybinds and nonworking stuff
Diffstat (limited to 'src/components/emoji-input/emoji-input.js')
-rw-r--r--src/components/emoji-input/emoji-input.js9
1 files changed, 5 insertions, 4 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)
}