aboutsummaryrefslogtreecommitdiff
path: root/src/components/emoji-input/emoji-input.js
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2019-07-03 23:08:51 +0300
committerHenry Jameson <me@hjkos.com>2019-07-03 23:08:51 +0300
commitf86f4b514fcbb03bc2b156a8e6f302d8eb76a106 (patch)
tree390b3658ac9d18ba4f442755b0952d3489ae1972 /src/components/emoji-input/emoji-input.js
parent69eff65130170c0cd8fffda45b952d3bec49c218 (diff)
Support compositionupdate event to properly show autocomplete popup for IMEs and
android
Diffstat (limited to 'src/components/emoji-input/emoji-input.js')
-rw-r--r--src/components/emoji-input/emoji-input.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/components/emoji-input/emoji-input.js b/src/components/emoji-input/emoji-input.js
index 0955a37e..fde99320 100644
--- a/src/components/emoji-input/emoji-input.js
+++ b/src/components/emoji-input/emoji-input.js
@@ -104,6 +104,7 @@ const EmojiInput = {
input.elm.addEventListener('keyup', this.onKeyUp)
input.elm.addEventListener('keydown', this.onKeyDown)
input.elm.addEventListener('transitionend', this.onTransition)
+ input.elm.addEventListener('compositionupdate', this.onCompositionUpdate)
},
unmounted () {
const { input } = this
@@ -114,6 +115,7 @@ const EmojiInput = {
input.elm.removeEventListener('keyup', this.onKeyUp)
input.elm.removeEventListener('keydown', this.onKeyDown)
input.elm.removeEventListener('transitionend', this.onTransition)
+ input.elm.removeEventListener('compositionupdate', this.onCompositionUpdate)
}
},
methods: {
@@ -216,6 +218,12 @@ const EmojiInput = {
}
},
onInput (e) {
+ this.setCaret(e)
+ this.$emit('input', e.target.value)
+ },
+ onCompositionUpdate (e) {
+ this.setCaret(e)
+ this.resize()
this.$emit('input', e.target.value)
},
setCaret ({ target: { selectionStart } }) {