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