mirror of
				https://github.com/BookStackApp/BookStack.git
				synced 2025-11-03 02:13:16 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			19 lines
		
	
	
		
			374 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			19 lines
		
	
	
		
			374 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
/**
 | 
						|
 * Submit on change
 | 
						|
 * Simply submits a parent form when this input is changed.
 | 
						|
 * @extends {Component}
 | 
						|
 */
 | 
						|
class SubmitOnChange {
 | 
						|
 | 
						|
    setup() {
 | 
						|
        this.$el.addEventListener('change', () => {
 | 
						|
            const form = this.$el.closest('form');
 | 
						|
            if (form) {
 | 
						|
                form.submit();
 | 
						|
            }
 | 
						|
        });
 | 
						|
    }
 | 
						|
 | 
						|
}
 | 
						|
 | 
						|
export default SubmitOnChange; |