Fixed keyboard shortcuts

This commit is contained in:
Tom Needham 2011-12-31 12:28:25 +00:00
parent 8efec8e900
commit e04951f8fd
1 changed files with 8 additions and 11 deletions

View File

@ -204,17 +204,14 @@ function hideFileEditor(){
// Keyboard Shortcuts // Keyboard Shortcuts
var ctrlBtn = false; var ctrlBtn = false;
function checkForCtrlKey(e){
if(e.which == 17 || e.which == 91) ctrlBtn=false;
}
function checkForSaveKeyPress(e){ function checkForSaveKeyPress(e){
if(e.which == 17 || e.which == 91) ctrlBtn=true; if(e.which == 17 || e.which == 91) ctrlBtn=true;
if(e.which == 83 && ctrlBtn == true) { if(e.which == 83 && ctrlBtn == true) {
e.preventDefault(); e.preventDefault();
$('#editor_save').trigger('click'); $('#editor_save').trigger('click');
return false; return false;
}
}
} }
$(window).resize(function() { $(window).resize(function() {
@ -247,5 +244,5 @@ $(document).ready(function(){
bindControlEvents(); bindControlEvents();
// Binds the save keyboard shortcut events // Binds the save keyboard shortcut events
$(document).unbind('keyup').bind('keyup',checkForCtrlKey).unbind('keydown').bind('keydown',checkForSaveKeyPress); $(document).unbind('keydown').bind('keydown',checkForSaveKeyPress);
}); });