mirror of
				https://github.com/TeamPiped/Piped.git
				synced 2024-08-14 23:57:27 +00:00 
			
		
		
		
	feat: make CreatePlaylistModal handle Enter key
This commit is contained in:
		
							parent
							
								
									de0b0d1e5a
								
							
						
					
					
						commit
						34f52c953e
					
				
					 2 changed files with 13 additions and 1 deletions
				
			
		| 
						 | 
					@ -24,7 +24,19 @@ export default {
 | 
				
			||||||
            playlistName: "",
 | 
					            playlistName: "",
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    mounted() {
 | 
				
			||||||
 | 
					        window.addEventListener("keydown", this.handleKeyDown);
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    unmounted() {
 | 
				
			||||||
 | 
					        window.removeEventListener("keydown", this.handleKeyDown);
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
    methods: {
 | 
					    methods: {
 | 
				
			||||||
 | 
					        handleKeyDown(event) {
 | 
				
			||||||
 | 
					            if (event.code === "Enter") {
 | 
				
			||||||
 | 
					                this.onCreatePlaylist();
 | 
				
			||||||
 | 
					                event.preventDefault();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
        onCreatePlaylist() {
 | 
					        onCreatePlaylist() {
 | 
				
			||||||
            if (!this.playlistName) return;
 | 
					            if (!this.playlistName) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -65,7 +65,7 @@ export default {
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    methods: {
 | 
					    methods: {
 | 
				
			||||||
        handleKeyDown(event) {
 | 
					        handleKeyDown(event) {
 | 
				
			||||||
            if (event.code === "Enter") {
 | 
					            if (event.code === "Enter" && !this.showCreatePlaylistModal) {
 | 
				
			||||||
                this.handleClick(this.selectedPlaylist);
 | 
					                this.handleClick(this.selectedPlaylist);
 | 
				
			||||||
                event.preventDefault();
 | 
					                event.preventDefault();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue