-
Notifications
You must be signed in to change notification settings - Fork 2
/
taggedAutogrow.min.js
1 lines (1 loc) · 1.03 KB
/
taggedAutogrow.min.js
1
!function(a,b){"function"==typeof define&&define.amd?define(["angular"],b):a.taggedAutogrow=b(a.angular)}(this,function(a){"use strict";var b=a.module("tagged.directives.autogrow",[]);return b.directive("taggedAutogrow",["$window","$document","$timeout",function(b,c,d){var e=a.element("<div></div>").css({position:"absolute",top:"-10000px",left:"-10000px",whiteSpace:"pre-wrap",wordWrap:"break-word"});return a.element(c[0].body).append(e),{require:"ngModel",scope:{noPadding:"=?"},link:function(c,f,g,h){c.noPadding=c.noPadding||!1,d(function(){var d=f[0].offsetHeight,g=b.getComputedStyle(f[0]),i=["width","boxSizing","paddingTop","paddingRight","paddingBottom","paddingLeft","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","lineHeight","fontSize"];c.$watch(function(){return h.$modelValue},function(){var h,j,k={},l=" oooooo";g=b.getComputedStyle(f[0]),a.forEach(i,function(a){k[a]=g[a]}),e.css(k),h=f.val().replace(/\n$/g,"\n."),c.noPadding||(h+=l),e.text(h),j=Math.max(e[0].offsetHeight,d),f.css("height",j+"px")})})}}}]),b});