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

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