feat: auto expand textarea

pull/26/head
adldotori 1 year ago
parent a5c5ba358f
commit cae5ea60b7

@ -9,3 +9,19 @@ const highlightActiveNavItem = () => {
};
highlightActiveNavItem();
const getNumber = (str) => Number(str.replace("px", ""));
function expandTextarea(id) {
document.getElementById(id).addEventListener(
"keyup",
function () {
this.style.overflow = "hidden";
this.style.height =
Math.max(getNumber(this.style.height), this.scrollHeight) + "px";
},
false
);
}
expandTextarea("prompt");

Loading…
Cancel
Save