Refactor to reduce nesting

This commit is contained in:
Andrew Lorente 2014-07-23 13:27:03 -07:00
parent f9558a34fa
commit cfff6616e6
2 changed files with 30 additions and 29 deletions

View File

@ -361,9 +361,11 @@ haste.prototype.configureShortcuts = function() {
///// Tab behavior in the textarea - 2 spaces per tab ///// Tab behavior in the textarea - 2 spaces per tab
$(function() { $(function() {
$('textarea').keydown(function(evt) { $('textarea').keydown(function(evt) {
if (evt.keyCode === 9 && ! evt.ctrlKey) { if (evt.ctrlKey || evt.keyCode !== 9) {
return true;
}
evt.preventDefault(); evt.preventDefault();
var myValue = ' '; var myValue = ' ';
// http://stackoverflow.com/questions/946534/insert-text-into-textarea-with-jquery // http://stackoverflow.com/questions/946534/insert-text-into-textarea-with-jquery
@ -390,7 +392,6 @@ $(function() {
this.value += myValue; this.value += myValue;
this.focus(); this.focus();
} }
}
}); });
}); });

File diff suppressed because one or more lines are too long