mirror of
				https://github.com/vector-im/element-web.git
				synced 2025-11-04 10:11:03 +01:00 
			
		
		
		
	escape key to cancel imageview popup
This commit is contained in:
		
							parent
							
								
									24630f598f
								
							
						
					
					
						commit
						1176168960
					
				@ -24,6 +24,23 @@ module.exports = React.createClass({
 | 
				
			|||||||
    displayName: 'ImageView',
 | 
					    displayName: 'ImageView',
 | 
				
			||||||
    mixins: [ImageViewController],
 | 
					    mixins: [ImageViewController],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // XXX: keyboard shortcuts for managing dialogs should be done by the modal dialog base class omehow, surely...
 | 
				
			||||||
 | 
					    componentDidMount: function() {
 | 
				
			||||||
 | 
					        document.addEventListener("keydown", this.onKeyDown);
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    componentWillUnmount: function() {
 | 
				
			||||||
 | 
					        document.removeEventListener("keydown", this.onKeyDown);
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    onKeyDown: function(ev) {
 | 
				
			||||||
 | 
					        if (ev.keyCode == 27) { // escape
 | 
				
			||||||
 | 
					            ev.stopPropagation();
 | 
				
			||||||
 | 
					            ev.preventDefault();
 | 
				
			||||||
 | 
					            this.props.onFinished();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    render: function() {
 | 
					    render: function() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // XXX: can't we just do max-width: 80%, max-height: 80% on the CSS?
 | 
					        // XXX: can't we just do max-width: 80%, max-height: 80% on the CSS?
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user