Unfocus chat input when pressing escape

This commit is contained in:
Pavel Djundik 2020-01-24 11:35:04 +02:00
parent 2451f222e8
commit bbe6b34371

View File

@ -101,6 +101,8 @@ export default {
}, },
}, },
mounted() { mounted() {
this.$root.$on("escapekey", this.blurInput);
if (this.$store.state.settings.autocomplete) { if (this.$store.state.settings.autocomplete) {
autocompletionRef = autocompletion(this.$refs.input); autocompletionRef = autocompletion(this.$refs.input);
} }
@ -161,6 +163,8 @@ export default {
} }
}, },
destroyed() { destroyed() {
this.$root.$off("escapekey", this.blurInput);
if (autocompletionRef) { if (autocompletionRef) {
autocompletionRef.destroy(); autocompletionRef.destroy();
autocompletionRef = null; autocompletionRef = null;
@ -255,6 +259,9 @@ export default {
openFileUpload() { openFileUpload() {
this.$refs.uploadInput.click(); this.$refs.uploadInput.click();
}, },
blurInput() {
this.$refs.input.blur();
},
}, },
}; };
</script> </script>