Skip to content

Commit

Permalink
allow tabs in the textarea
Browse files Browse the repository at this point in the history
  • Loading branch information
schollz committed Sep 19, 2018
1 parent 96eef12 commit 7e7548f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions static/js/rwtxt.js
Expand Up @@ -144,6 +144,16 @@ CY.loadEditor = function () {

document.getElementById("editable").addEventListener('input', CY.debounce(CY.contentEdited, 200));

// allow tabs
document.getElementById("editable").onkeydown = function(e) {
if(e.keyCode==9 || e.which==9 || e.key == "Tab"){
e.preventDefault();
var s = this.selectionStart;
this.value = this.value.substring(0,this.selectionStart) + "\t" + this.value.substring(this.selectionEnd);
this.selectionEnd = s+1;
}
}

editlink = document.getElementById("editlink")
if (editlink != null) {
editlink.addEventListener("click", CY.loadEditor);
Expand Down

0 comments on commit 7e7548f

Please sign in to comment.