mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-11-10 02:08:21 +00:00
Merge pull request #3410 from AndyRusso/confirmmodal-handle-enter
feat: make `ConfirmModal` emit `"confirm"` if Enter is pressed
This commit is contained in:
commit
5ad5e8588f
@ -24,5 +24,19 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
emits: ["close", "confirm"],
|
emits: ["close", "confirm"],
|
||||||
|
mounted() {
|
||||||
|
window.addEventListener("keydown", this.handleKeyDown);
|
||||||
|
},
|
||||||
|
unmounted() {
|
||||||
|
window.removeEventListener("keydown", this.handleKeyDown);
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleKeyDown(event) {
|
||||||
|
if (event.code === "Enter") {
|
||||||
|
this.$emit("confirm");
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user