1 line
1.4 KiB
JavaScript
1 line
1.4 KiB
JavaScript
(()=>{function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(e,i){for(var o=0;o<i.length;o++){var r=i[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(n=r.key,l=void 0,l=function(e,i){if("object"!==t(e)||null===e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var r=o.call(e,i||"default");if("object"!==t(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===i?String:Number)(e)}(n,"string"),"symbol"===t(l)?l:String(l)),r)}var n,l}var i=function(){"use strict";function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.field=e,this.field.addEventListener("input",this.autogrow.bind(this)),this.autogrow()}var i,o,r;return i=t,(o=[{key:"autogrow",value:function(){this.field.style.overflow="hidden",this.field.style.resize="none",this.field.style.boxSizing="border-box",this.field.style.height="auto",this.field.scrollHeight>0&&(this.field.style.height=this.field.scrollHeight+"px")}}])&&e(i.prototype,o),r&&e(i,r),Object.defineProperty(i,"prototype",{writable:!1}),t}();document.addEventListener("DOMContentLoaded",(function(){document.querySelectorAll("[data-ea-textarea-field]").forEach((function(t){new i(t)}))}))})(); |