mirror of
				https://github.com/vector-im/element-web.git
				synced 2025-10-27 06:12:00 +01:00 
			
		
		
		
	cancel viewsource dialog with escape
This commit is contained in:
		
							parent
							
								
									05d96f4cfb
								
							
						
					
					
						commit
						80c04048d0
					
				| @ -21,6 +21,22 @@ var React = require('react'); | ||||
| module.exports = React.createClass({ | ||||
|     displayName: 'ViewSource', | ||||
| 
 | ||||
|     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() { | ||||
|         return ( | ||||
|             <div className="mx_ViewSource"> | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user