Make esc key close mentions window (#4365)

* Mentions: rename method to what it's doing
* Mentions: make <esc> dismiss the window
This commit is contained in:
Reto 2021-11-19 02:54:44 +01:00 committed by GitHub
parent 6dfd51bb57
commit 9dbf647f7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -185,10 +185,12 @@ export default {
}, },
}, },
mounted() { mounted() {
eventbus.on("mentions:toggle", this.openPopup); eventbus.on("mentions:toggle", this.togglePopup);
eventbus.on("escapekey", this.closePopup);
}, },
destroyed() { destroyed() {
eventbus.off("mentions:toggle", this.openPopup); eventbus.off("mentions:toggle", this.togglePopup);
eventbus.off("escapekey", this.closePopup);
}, },
methods: { methods: {
messageTime(time) { messageTime(time) {
@ -211,7 +213,7 @@ export default {
this.isOpen = false; this.isOpen = false;
} }
}, },
openPopup() { togglePopup() {
this.isOpen = !this.isOpen; this.isOpen = !this.isOpen;
if (this.isOpen) { if (this.isOpen) {
@ -219,6 +221,9 @@ export default {
socket.emit("mentions:get"); socket.emit("mentions:get");
} }
}, },
closePopup() {
this.isOpen = false;
},
}, },
}; };
</script> </script>