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:
parent
0320d2e4b2
commit
9cea2733ca
@ -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: {
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user