Support for tab key

This commit is contained in:
benweet 2013-04-21 17:27:52 +01:00
parent 469e664d74
commit 301c51f6ac
4 changed files with 17 additions and 1 deletions

1
css/main-min.css vendored
View File

@ -5347,6 +5347,7 @@ li.L7,
li.L9 { background: #eee }
body {
background-color: #f5f5f5;
tab-size: 4;
}
.working {
cursor: progress;

View File

@ -4,6 +4,7 @@
body {
background-color: #f5f5f5;
tab-size: 4;
}
.working {

View File

@ -620,6 +620,20 @@ define(
$("#wmd-input").css({
"font-size": core.settings.editorFontSize + "px",
"line-height": Math.round(core.settings.editorFontSize * (20/14)) + "px"
}).keydown(function(e) {
// Manage tab key
if(e.keyCode === 9) {
var value = $(this).val();
var start = this.selectionStart;
var end = this.selectionEnd;
// IE8 does not support selection attributes
if(start === undefined || end === undefined) {
return;
}
$(this).val(value.substring(0, start) + "\t" + value.substring(end));
this.selectionStart = this.selectionEnd = start + 1;
e.preventDefault();
}
});
$(".action-load-settings").click(function() {

2
js/main-min.js vendored

File diff suppressed because one or more lines are too long