1818
1919<script setup>
2020import Mousetrap from " mousetrap" ;
21+ import " Mousetrap/plugins/global-bind/mousetrap-global-bind" ;
2122import { useToast } from " primevue/usetoast" ;
2223import { computed , ref } from " vue" ;
2324import { RouterView , useRoute } from " vue-router" ;
@@ -30,6 +31,7 @@ import NavBar from "./partials/NavBar.vue";
3031import SearchModal from " ./partials/SearchModal.vue" ;
3132import { loadStoredToken } from " ./tokenStorage.js" ;
3233import LoadingIndicator from " ./components/LoadingIndicator.vue" ;
34+ import router from " ./router.js" ;
3335
3436const globalStore = useGlobalStore ();
3537const isSearchModalVisible = ref (false );
@@ -46,6 +48,22 @@ Mousetrap.bind("/", () => {
4648 }
4749});
4850
51+ // 'CTRL/CMD + SHIFT + N' to create new note
52+ Mousetrap .bindGlobal (" mod+shift+n" , () => {
53+ if (route .name !== " login" ) {
54+ router .push ({ name: " new" });
55+ return false ;
56+ }
57+ });
58+
59+ // 'CTRL/CMD + SHIFT + H' to go to home
60+ Mousetrap .bindGlobal (" mod+shift+h" , () => {
61+ if (route .name !== " login" ) {
62+ router .push ({ name: " home" });
63+ return false ;
64+ }
65+ });
66+
4967getConfig ()
5068 .then ((data ) => {
5169 globalStore .config = data;
0 commit comments