Add keyboard shortcut for editing note
authorAdam Dullage <redacted>
Sun, 5 May 2024 11:49:58 +0000 (12:49 +0100)
committerAdam Dullage <redacted>
Sun, 5 May 2024 11:49:58 +0000 (12:49 +0100)
client/views/Note.vue

index 08c2d4683ee46daf39e777eae39e80248683b9b7..2a9579e4328f61eab38576a72582ab1a92e492b6 100644 (file)
@@ -73,6 +73,7 @@ import {
   mdilDelete,
   mdilPencil,
 } from "@mdi/light-js";
+import Mousetrap from "mousetrap";
 import { useToast } from "primevue/usetoast";
 import { computed, ref, watch } from "vue";
 import { useRouter } from "vue-router";
@@ -103,6 +104,14 @@ const newTitle = ref();
 const toast = useToast();
 const toastEditor = ref();
 
+// 'e' to edit
+Mousetrap.bind("e", function () {
+  console.log("edit");
+  if (editMode.value === false) {
+    editHandler();
+  }
+});
+
 function init() {
   // Return if we already have the note
   if (props.title == note.value.title) {
git clone https://git.99rst.org/PROJECT