UNPKG

@nathanaelregesdev/autoresizetextarea

Version:
3 lines (2 loc) 682 B
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.autoresizetextarea=t()}(this,function(){return function(e){var t=e.ele,n=e.minHeight,o=e.maxHeight,i={},r=0;return t.addEventListener("keydown",a),i.forceTest=a,i.reset=function(){t.style.height=n+"px"},i;function a(){requestAnimationFrame(function(){var e=!1;i.onTypedNewLine&&0!=t.scrollTop&&(e=!0),t.style.height="10px",t.style.marginBottom=r-10+"px";var a=t.scrollHeight;n&&a<n&&(a=n),o&&a>o&&(a=o),t.style.height=a+"px",t.style.marginBottom="",r=a,e&&i.onTypedNewLine(),i.callBack&&i.callBack()})}}}); //# sourceMappingURL=index.umd.js.map