1
0
mirror of https://github.com/Tygs/0bin.git synced 2023-08-10 21:13:00 +03:00

Autofit textarea

This commit is contained in:
ksamuel 2020-08-12 14:14:13 +02:00
parent 7bf0ba4ddd
commit 6a0370b1f5
3 changed files with 14 additions and 2 deletions

View File

@ -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';
}

View File

@ -32,7 +32,7 @@
<div class="progress-bar progress-bar-striped" role="progressbar"></div>
</div>
<textarea rows="10" style="width:100%;" class="form-control" id="content" name="content" autofocus
@keydown.prevent.ctrl.enter="encryptAndSendPaste()"></textarea>
@keydown.ctrl.enter="encryptAndSendPaste()"></textarea>
</div>
<div class="form-group select-date paste-option down" v-if="displayBottomToolBar">

View File

@ -121,7 +121,7 @@
</div>
<div>
<textarea rows="10" style="width:100%;" class=" form-control" @keydown.prevent.ctrl.enter="encryptAndSendPaste()"
<textarea rows="10" style="width:100%;" class=" form-control" @keydown.ctrl.enter="encryptAndSendPaste()"
id="content" name="content"></textarea>
</div>