mirror of
				https://github.com/TeamPiped/Piped.git
				synced 2025-11-03 22:21:55 +00:00 
			
		
		
		
	Make ConfirmModal emit confirm if Enter is pressed
This commit is contained in:
		@@ -24,5 +24,19 @@ export default {
 | 
			
		||||
        },
 | 
			
		||||
    },
 | 
			
		||||
    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>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user