Add docstring to should_prevent_hotkey.
This commit is contained in:
parent
08a8095efb
commit
6fad61d49a
1 changed files with 9 additions and 1 deletions
|
@ -44,6 +44,10 @@ function register_hotkey(hotkey, action, description)
|
||||||
hotkeys.should_prevent_hotkey =
|
hotkeys.should_prevent_hotkey =
|
||||||
function should_prevent_hotkey(event)
|
function should_prevent_hotkey(event)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
If the user is currently in an input element, then the registered hotkey
|
||||||
|
will be ignored and the browser will use its default behavior.
|
||||||
|
*/
|
||||||
if (event.target.tagName == "INPUT" && event.target.type == "checkbox")
|
if (event.target.tagName == "INPUT" && event.target.type == "checkbox")
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -71,7 +75,11 @@ function show_all_hotkeys()
|
||||||
hotkeys.hotkeys_listener =
|
hotkeys.hotkeys_listener =
|
||||||
function hotkeys_listener(event)
|
function hotkeys_listener(event)
|
||||||
{
|
{
|
||||||
if (hotkeys.should_prevent_hotkey(event)) { return; }
|
if (hotkeys.should_prevent_hotkey(event))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
identifier = hotkeys.hotkey_identifier(event.key, event.ctrlKey, event.shiftKey, event.altKey);
|
identifier = hotkeys.hotkey_identifier(event.key, event.ctrlKey, event.shiftKey, event.altKey);
|
||||||
//console.log(identifier);
|
//console.log(identifier);
|
||||||
if (identifier in hotkeys.HOTKEYS)
|
if (identifier in hotkeys.HOTKEYS)
|
||||||
|
|
Loading…
Reference in a new issue