Refactor to reduce nesting
This commit is contained in:
parent
f9558a34fa
commit
cfff6616e6
|
@ -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
Loading…
Reference in New Issue