1 | define([ |
---|
2 | "dojo/_base/declare", // declare |
---|
3 | "dojo/dom-style", // domStyle.set |
---|
4 | "./_ExpandingTextAreaMixin", |
---|
5 | "./SimpleTextarea" |
---|
6 | ], function(declare, domStyle, _ExpandingTextAreaMixin, SimpleTextarea){ |
---|
7 | |
---|
8 | /*===== |
---|
9 | var _ExpandingTextAreaMixin = dijit.form._ExpandingTextAreaMixin; |
---|
10 | var SimpleTextarea = dijit.form.SimpleTextarea; |
---|
11 | =====*/ |
---|
12 | |
---|
13 | // module: |
---|
14 | // dijit/form/Textarea |
---|
15 | // summary: |
---|
16 | // A textarea widget that adjusts it's height according to the amount of data. |
---|
17 | |
---|
18 | |
---|
19 | return declare("dijit.form.Textarea", [SimpleTextarea, _ExpandingTextAreaMixin], { |
---|
20 | // summary: |
---|
21 | // A textarea widget that adjusts it's height according to the amount of data. |
---|
22 | // |
---|
23 | // description: |
---|
24 | // A textarea that dynamically expands/contracts (changing it's height) as |
---|
25 | // the user types, to display all the text without requiring a scroll bar. |
---|
26 | // |
---|
27 | // Takes nearly all the parameters (name, value, etc.) that a vanilla textarea takes. |
---|
28 | // Rows is not supported since this widget adjusts the height. |
---|
29 | // |
---|
30 | // example: |
---|
31 | // | <textarea data-dojo-type="dijit.form.TextArea">...</textarea> |
---|
32 | |
---|
33 | |
---|
34 | // TODO: for 2.0, rename this to ExpandingTextArea, and rename SimpleTextarea to TextArea |
---|
35 | |
---|
36 | baseClass: "dijitTextBox dijitTextArea dijitExpandingTextArea", |
---|
37 | |
---|
38 | // Override SimpleTextArea.cols to default to width:100%, for backward compatibility |
---|
39 | cols: "", |
---|
40 | |
---|
41 | buildRendering: function(){ |
---|
42 | this.inherited(arguments); |
---|
43 | |
---|
44 | // tweak textarea style to reduce browser differences |
---|
45 | domStyle.set(this.textbox, { overflowY: 'hidden', overflowX: 'auto', boxSizing: 'border-box', MsBoxSizing: 'border-box', WebkitBoxSizing: 'border-box', MozBoxSizing: 'border-box' }); |
---|
46 | } |
---|
47 | }); |
---|
48 | |
---|
49 | }); |
---|