summaryrefslogtreecommitdiff
path: root/lib/dijit/form/_ExpandingTextAreaMixin.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dijit/form/_ExpandingTextAreaMixin.js')
-rw-r--r--lib/dijit/form/_ExpandingTextAreaMixin.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/dijit/form/_ExpandingTextAreaMixin.js b/lib/dijit/form/_ExpandingTextAreaMixin.js
index d5071e7ca..8d97659f3 100644
--- a/lib/dijit/form/_ExpandingTextAreaMixin.js
+++ b/lib/dijit/form/_ExpandingTextAreaMixin.js
@@ -1,2 +1,2 @@
//>>built
-define("dijit/form/_ExpandingTextAreaMixin",["dojo/_base/declare","dojo/dom-construct","dojo/_base/lang","dojo/_base/window"],function(_1,_2,_3,_4){var _5;return _1("dijit.form._ExpandingTextAreaMixin",null,{_setValueAttr:function(){this.inherited(arguments);this.resize();},postCreate:function(){this.inherited(arguments);var _6=this.textbox;if(_5==undefined){var te=_2.create("textarea",{rows:"5",cols:"20",value:" ",style:{zoom:1,overflow:"hidden",visibility:"hidden",position:"absolute",border:"0px solid black",padding:"0px"}},_4.body(),"last");_5=te.scrollHeight>=te.clientHeight;_4.body().removeChild(te);}this.connect(_6,"onscroll","_resizeLater");this.connect(_6,"onresize","_resizeLater");this.connect(_6,"onfocus","_resizeLater");_6.style.overflowY="hidden";this._estimateHeight();this._resizeLater();},_onInput:function(e){this.inherited(arguments);this.resize();},_estimateHeight:function(){var _7=this.textbox;_7.style.height="auto";_7.rows=(_7.value.match(/\n/g)||[]).length+2;},_resizeLater:function(){this.defer("resize");},resize:function(){function _8(){var _9=false;if(_a.value===""){_a.value=" ";_9=true;}var sh=_a.scrollHeight;if(_9){_a.value="";}return sh;};var _a=this.textbox;if(_a.style.overflowY=="hidden"){_a.scrollTop=0;}if(this.busyResizing){return;}this.busyResizing=true;if(_8()||_a.offsetHeight){var _b=_a.style.height;if(!(/px/.test(_b))){_b=_8();_a.rows=1;_a.style.height=_b+"px";}var _c=Math.max(Math.max(_a.offsetHeight,parseInt(_b))-_a.clientHeight,0)+_8();var _d=_c+"px";if(_d!=_a.style.height){_a.rows=1;_a.style.height=_d;}if(_5){var _e=_8(),_f=_e,_10=_a.style.minHeight,_11=4,_12;_a.style.minHeight=_d;_a.style.height="auto";while(_c>0){_a.style.minHeight=Math.max(_c-_11,4)+"px";_12=_8();var _13=_f-_12;_c-=_13;if(_13<_11){break;}_f=_12;_11<<=1;}_a.style.height=_c+"px";_a.style.minHeight=_10;}_a.style.overflowY=_8()>_a.clientHeight?"auto":"hidden";}else{this._estimateHeight();}this.busyResizing=false;}});}); \ No newline at end of file
+define("dijit/form/_ExpandingTextAreaMixin",["dojo/_base/declare","dojo/dom-construct","dojo/has","dojo/_base/lang","dojo/on","dojo/_base/window","../Viewport"],function(_1,_2,_3,_4,on,_5,_6){_3.add("textarea-needs-help-shrinking",function(){var _7=_5.body(),te=_2.create("textarea",{rows:"5",cols:"20",value:" ",style:{zoom:1,fontSize:"12px",height:"96px",overflow:"hidden",visibility:"hidden",position:"absolute",border:"5px solid white",margin:"0",padding:"0",boxSizing:"border-box",MsBoxSizing:"border-box",WebkitBoxSizing:"border-box",MozBoxSizing:"border-box"}},_7,"last");var _8=te.scrollHeight>=te.clientHeight;_7.removeChild(te);return _8;});return _1("dijit.form._ExpandingTextAreaMixin",null,{_setValueAttr:function(){this.inherited(arguments);this.resize();},postCreate:function(){this.inherited(arguments);var _9=this.textbox;_9.style.overflowY="hidden";this.own(on(_9,"focus, resize",_4.hitch(this,"_resizeLater")));},startup:function(){this.inherited(arguments);this.own(_6.on("resize",_4.hitch(this,"_resizeLater")));this._resizeLater();},_onInput:function(e){this.inherited(arguments);this.resize();},_estimateHeight:function(){var _a=this.textbox;_a.rows=(_a.value.match(/\n/g)||[]).length+1;},_resizeLater:function(){this.defer("resize");},resize:function(){var _b=this.textbox;function _c(){var _d=false;if(_b.value===""){_b.value=" ";_d=true;}var sh=_b.scrollHeight;if(_d){_b.value="";}return sh;};if(_b.style.overflowY=="hidden"){_b.scrollTop=0;}if(this.busyResizing){return;}this.busyResizing=true;if(_c()||_b.offsetHeight){var _e=_c()+Math.max(_b.offsetHeight-_b.clientHeight,0);var _f=_e+"px";if(_f!=_b.style.height){_b.style.height=_f;_b.rows=1;}if(_3("textarea-needs-help-shrinking")){var _10=_c(),_11=_10,_12=_b.style.minHeight,_13=4,_14,_15=_b.scrollTop;_b.style.minHeight=_f;_b.style.height="auto";while(_e>0){_b.style.minHeight=Math.max(_e-_13,4)+"px";_14=_c();var _16=_11-_14;_e-=_16;if(_16<_13){break;}_11=_14;_13<<=1;}_b.style.height=_e+"px";_b.style.minHeight=_12;_b.scrollTop=_15;}_b.style.overflowY=_c()>_b.clientHeight?"auto":"hidden";if(_b.style.overflowY=="hidden"){_b.scrollTop=0;}}else{this._estimateHeight();}this.busyResizing=false;}});}); \ No newline at end of file