mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-05-08 08:58:38 +01:00
Pressing escape closes the lightbox
// FREEBIE
This commit is contained in:
@@ -131,6 +131,12 @@
|
|||||||
Whisper.LightboxView = Whisper.View.extend({
|
Whisper.LightboxView = Whisper.View.extend({
|
||||||
templateName: 'lightbox',
|
templateName: 'lightbox',
|
||||||
className: 'modal lightbox',
|
className: 'modal lightbox',
|
||||||
|
initialize: function() {
|
||||||
|
this.window = extension.windows.getWindow();
|
||||||
|
this.$document = $(this.window.document);
|
||||||
|
this.listener = this.onkeyup.bind(this);
|
||||||
|
this.$document.on('keyup', this.listener);
|
||||||
|
},
|
||||||
events: {
|
events: {
|
||||||
'click .save': 'save',
|
'click .save': 'save',
|
||||||
'click .close': 'remove',
|
'click .close': 'remove',
|
||||||
@@ -147,6 +153,12 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
onkeyup: function(e) {
|
||||||
|
if (e.keyCode === 27) {
|
||||||
|
this.remove();
|
||||||
|
this.$document.off('keyup', this.listener);
|
||||||
|
}
|
||||||
|
},
|
||||||
render_attributes: function() {
|
render_attributes: function() {
|
||||||
return { url: this.model.objectUrl };
|
return { url: this.model.objectUrl };
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user