diff --git a/static/js/bin.js b/static/js/bin.js
index 9e8d1a8..6e1bbcc 100644
--- a/static/js/bin.js
+++ b/static/js/bin.js
@@ -5,7 +5,6 @@ var navlist = document.getElementById("info").getElementsByClassName("right")[0]
init();
function init() {
-
var editA = document.createElement('a');
editA.setAttribute("href", "#");
@@ -23,8 +22,8 @@ function init() {
document.getElementById('wordwrap').addEventListener('click', wrap);
}
-
function edit(ev) {
+ ev.preventDefault();
navlist.remove();
document.getElementById("filename").remove();
@@ -35,9 +34,9 @@ function edit(ev) {
var editordiv = document.getElementById("editor");
editordiv.style.display = "block";
+ editordiv.addEventListener('keydown', handleTab);
}
-
function paste(ev) {
var editordiv = document.getElementById("editor");
document.getElementById("newcontent").value = editordiv.value;
diff --git a/static/js/paste.js b/static/js/paste.js
new file mode 100644
index 0000000..bd9448a
--- /dev/null
+++ b/static/js/paste.js
@@ -0,0 +1,3 @@
+// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later
+document.getElementById('content').addEventListener('keydown', handleTab);
+// @license-end
diff --git a/static/js/util.js b/static/js/util.js
new file mode 100644
index 0000000..cef4eca
--- /dev/null
+++ b/static/js/util.js
@@ -0,0 +1,18 @@
+// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later
+
+function handleTab(ev) {
+ // change tab key behavior to insert tab instead of change focus
+ if(ev.keyCode == 9) {
+ ev.preventDefault();
+
+ var val = this.value;
+ var start = this.selectionStart;
+ var end = this.selectionEnd;
+
+ this.value = val.substring(0, start) + '\t' + val.substring(end);
+ this.selectionStart = start + 1;
+ this.selectionEnd = end + 1;
+ }
+}
+
+// @license-end
diff --git a/templates/display/bin.html b/templates/display/bin.html
index 49826d1..9c6382e 100644
--- a/templates/display/bin.html
+++ b/templates/display/bin.html
@@ -52,5 +52,6 @@
{% endif %}
+
{% endblock %}
diff --git a/templates/paste.html b/templates/paste.html
index b7adaf4..1b31aac 100644
--- a/templates/paste.html
+++ b/templates/paste.html
@@ -33,4 +33,7 @@
+
+
+
{% endblock %}