diff --git a/lib/client/menu.js b/lib/client/menu.js index ea93b3c0..0322dfa2 100644 --- a/lib/client/menu.js +++ b/lib/client/menu.js @@ -33,7 +33,7 @@ var CloudCmd, Util, DOM, CloudFunc, $; Menu.show ]); - Events.addKey( lListener ); + Events.addKey(listener); } this.show = function() { @@ -215,6 +215,8 @@ var CloudCmd, Util, DOM, CloudFunc, $; if (!event || !event.keyCode) clickProcessing(); + else if (event.keyCode) + listener(event); } } }; @@ -317,18 +319,20 @@ var CloudCmd, Util, DOM, CloudFunc, $; } } - function lListener(pEvent) { - var lCurrent, - lF9 = Key.F9, - lKey = pEvent.keyCode, - lIsBind = Key.isBind(); + function listener(event) { + var current, + F9 = Key.F9, + ESC = Key.ESC, + key = event.keyCode, + isBind = Key.isBind(); - if (lIsBind && lKey === lF9) { - lCurrent = DOM.getCurrentFile(); - $(lCurrent).contextmenu(); + if (isBind && key === F9) { + current = DOM.getCurrentFile(); + $(current).contextmenu(); - DOM.preventDefault(pEvent); - } + DOM.preventDefault(event); + } else if (key === ESC) + Key.setBind(); } init();