From 3172b4e7c18d07a36477a77fcebe6b521cfa15d0 Mon Sep 17 00:00:00 2001 From: jared Date: Fri, 29 Mar 2019 15:56:50 -0400 Subject: #101 - insert emoji from emoji selector --- src/components/emoji-input/emoji-input.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/components/emoji-input/emoji-input.js') diff --git a/src/components/emoji-input/emoji-input.js b/src/components/emoji-input/emoji-input.js index 48e89409..8f7598ca 100644 --- a/src/components/emoji-input/emoji-input.js +++ b/src/components/emoji-input/emoji-input.js @@ -105,6 +105,11 @@ const EmojiInput = { }, setCaret ({target: {selectionStart}}) { this.caret = selectionStart + }, + onEmoji (emoji) { + const newValue = this.value.substr(0, this.caret) + emoji + this.value.substr(this.caret) + this.$refs.input.focus() + this.$emit('input', newValue) } } } -- cgit v1.2.3-70-g09d2