mirror of
https://github.com/evennia/evennia.git
synced 2026-03-29 20:17:16 +02:00
Modal dialogs should capture all keystrokes but not interfere with other onKeydowns
This commit is contained in:
parent
21451d0f9b
commit
57551c791d
1 changed files with 25 additions and 0 deletions
|
|
@ -365,6 +365,30 @@ let splithandler_plugin = (function () {
|
|||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// onKeydown check for 'ESC' key.
|
||||
var onKeydown = function (event) {
|
||||
var code = event.which;
|
||||
|
||||
if (code === 27) { // Escape key
|
||||
if ($('#splitdialogcontent').is(':visible')) {
|
||||
plugins['popups'].closePopup("#splitdialogcontent");
|
||||
return true;
|
||||
}
|
||||
if ($('#panedialogcontent').is(':visible')) {
|
||||
plugins['popups'].closePopup("#panedialogcontent");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// capture all keys while one of our "modal" dialogs is open
|
||||
if ($('#splitdialogcontent').is(':visible') || $('#panedialogcontent').is(':visible')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// Required plugin "init" function
|
||||
var init = function(settings) {
|
||||
|
|
@ -408,6 +432,7 @@ let splithandler_plugin = (function () {
|
|||
dynamic_split: dynamic_split,
|
||||
undo_split: undo_split,
|
||||
set_pane_types: set_pane_types,
|
||||
onKeydown: onKeydown,
|
||||
}
|
||||
})()
|
||||
plugin_handler.add('splithandler', splithandler_plugin);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue