Browse Source

fix: Esc closeModal shortcut not emitting closed event

Owen Diffey 3 năm trước cách đây
mục cha
commit
d466263e31
2 tập tin đã thay đổi với 11 bổ sung11 xóa
  1. 0 11
      frontend/src/App.vue
  2. 11 0
      frontend/src/components/Modal.vue

+ 0 - 11
frontend/src/App.vue

@@ -134,16 +134,6 @@ export default {
 			handler: () => this.toggleNightMode()
 		});
 
-		keyboardShortcuts.registerShortcut("closeModal", {
-			keyCode: 27,
-			shift: false,
-			ctrl: false,
-			handler: () => {
-				if (Object.keys(this.currentlyActive).length !== 0)
-					this.closeCurrentModal();
-			}
-		});
-
 		this.disconnectedMessage = new Toast({
 			content: "Could not connect to the server.",
 			persistent: true,
@@ -623,7 +613,6 @@ strong {
 	color: inherit;
 }
 
-
 p,
 button,
 input,

+ 11 - 0
frontend/src/components/Modal.vue

@@ -29,6 +29,8 @@
 <script>
 import { mapActions } from "vuex";
 
+import keyboardShortcuts from "@/keyboardShortcuts";
+
 export default {
 	props: {
 		title: { type: String, default: "Modal" },
@@ -38,6 +40,15 @@ export default {
 	emits: ["closed"],
 	mounted() {
 		this.type = this.toCamelCase(this.title);
+
+		keyboardShortcuts.registerShortcut("closeModal", {
+			keyCode: 27,
+			shift: false,
+			ctrl: false,
+			handler: () => {
+				this.closeThisModal();
+			}
+		});
 	},
 	methods: {
 		toCamelCase: str =>