mirror of
				https://github.com/TeamPiped/Piped.git
				synced 2024-08-14 23:57:27 +00:00 
			
		
		
		
	Make ConfirmModal emit confirm if Enter is pressed
This commit is contained in:
		
							parent
							
								
									c8c1fab373
								
							
						
					
					
						commit
						28dc5abf55
					
				
					 1 changed files with 14 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -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>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue