Close search results with escape

This commit is contained in:
Max Leiter 2021-11-18 13:31:20 -08:00
parent c439e51617
commit 371ebfb810
No known key found for this signature in database
GPG Key ID: A3512F2F2F17EBDA

View File

@ -93,6 +93,7 @@
<script>
import socket from "../../js/socket";
import eventbus from "../../js/eventbus";
import SidebarToggle from "../SidebarToggle.vue";
import Message from "../Message.vue";
@ -171,11 +172,16 @@ export default {
mounted() {
this.setActiveChannel();
this.doSearch();
eventbus.on("escapekey", this.closeSearch);
this.$root.$on("re-search", this.doSearch); // Enable MessageSearchForm to search for the same query again
},
beforeDestroy() {
this.$root.$off("re-search");
},
destroyed() {
eventbus.off("escapekey", this.closeSearch);
},
methods: {
setActiveChannel() {
this.$store.commit("activeChannel", this.chan);