1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-02 07:47:32 +00:00

Add ESC handle for popover and dropdown (#1119)

* Add ESC handle for popover and dropdown
This commit is contained in:
Daniel Pan 2016-04-13 20:16:29 +08:00
parent 0320d2e4b2
commit 9cea2733ca
2 changed files with 23 additions and 0 deletions

View File

@ -30,6 +30,19 @@ define([
return true;
});
$(document).keydown(function(e) {
// ESCAPE key pressed
if (e.keyCode == 27) {
var view = app.ui.currentDropdown;
if (view) {
view.hide();
if (app.ui.currentHighlightedItem) {
app.ui.currentHighlightedItem.rmHighlight();
}
}
}
});
var DropdownView = Backbone.View.extend({
defaultOptions: {

View File

@ -27,6 +27,16 @@ define([
return true;
});
$(document).keydown(function(e) {
// ESCAPE key pressed
if (e.keyCode == 27) {
var view = app.ui.currentPopover;
if (view) {
view.hide();
}
}
});
$(window).resize(function() {
var view = app.ui.currentPopover;
if (!view) {