diff --git a/zerobin/static/js/behavior.js b/zerobin/static/js/behavior.js index 554eb6d..6213869 100644 --- a/zerobin/static/js/behavior.js +++ b/zerobin/static/js/behavior.js @@ -844,3 +844,15 @@ if (app.support.history && zerobin.paste_not_found) { } }) } + +/* Autofit text area height */ +const tx = document.getElementsByTagName('textarea'); +for (let i = 0; i < tx.length; i++) { + tx[i].setAttribute('style', 'height:' + (tx[i].scrollHeight) + 'px;overflow-y:hidden;'); + tx[i].addEventListener("input", OnInput, false); +} + +function OnInput() { + this.style.height = 'auto'; + this.style.height = (this.scrollHeight) + 'px'; +} diff --git a/zerobin/views/home.tpl b/zerobin/views/home.tpl index b7def8d..2661949 100644 --- a/zerobin/views/home.tpl +++ b/zerobin/views/home.tpl @@ -32,7 +32,7 @@
+ @keydown.ctrl.enter="encryptAndSendPaste()">