mirror of
https://github.com/Tygs/0bin.git
synced 2023-08-10 21:13:00 +03:00
Autofit textarea
This commit is contained in:
@ -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';
|
||||
}
|
||||
|
Reference in New Issue
Block a user