From bbe6b343713e7e3bfe7f9acb253271dbe6d51806 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Fri, 24 Jan 2020 11:35:04 +0200 Subject: [PATCH] Unfocus chat input when pressing escape --- client/components/ChatInput.vue | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client/components/ChatInput.vue b/client/components/ChatInput.vue index 481575e1..63732206 100644 --- a/client/components/ChatInput.vue +++ b/client/components/ChatInput.vue @@ -101,6 +101,8 @@ export default { }, }, mounted() { + this.$root.$on("escapekey", this.blurInput); + if (this.$store.state.settings.autocomplete) { autocompletionRef = autocompletion(this.$refs.input); } @@ -161,6 +163,8 @@ export default { } }, destroyed() { + this.$root.$off("escapekey", this.blurInput); + if (autocompletionRef) { autocompletionRef.destroy(); autocompletionRef = null; @@ -255,6 +259,9 @@ export default { openFileUpload() { this.$refs.uploadInput.click(); }, + blurInput() { + this.$refs.input.blur(); + }, }, };