Skip to content

Instantly share code, notes, and snippets.

@ryo1kato
Created May 6, 2013 10:43
Show Gist options
  • Select an option

  • Save ryo1kato/5524415 to your computer and use it in GitHub Desktop.

Select an option

Save ryo1kato/5524415 to your computer and use it in GitHub Desktop.
function disableCtrlKeyCombination(e)
{
var key;
var isCtrl;
key = e.which;
if( e.ctrlKey ){
console.log('Ctrl+ASCII shortcut hooked.')
if (String.fromCharCode(key).toLowerCase() == 'b') { //debug
console.log('Ctrl+b')
}
e.stopPropagation()
e.stopImmediatePropagation()
return false;
} else {
return true;
}
}
//$("[contenteditable='true'], textarea, input[type=text]").on('focus',function(e){
$(document).on('focus', "[contenteditable='true'], textarea, input[type=text]", function(e) {
$(this).off('keydown')
$(this).on('keydown', function(e){ disableCtrlKeyCombination(e) } )
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment