mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 21:24:59 +08: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',
|
||||
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() {
|
||||
|
||||
// XXX: can't we just do max-width: 80%, max-height: 80% on the CSS?
|
||||
|
Loading…
Reference in New Issue
Block a user