Textarea.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved.
  3. Available via Academic Free License >= 2.1 OR the modified BSD license.
  4. see: http://dojotoolkit.org/license for details
  5. */
  6. if(!dojo._hasResource["dijit.form.Textarea"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
  7. dojo._hasResource["dijit.form.Textarea"] = true;
  8. dojo.provide("dijit.form.Textarea");
  9. dojo.require("dijit.form.SimpleTextarea");
  10. dojo.require("dijit.form._ExpandingTextAreaMixin");
  11. /*=====
  12. var _ExpandingTextAreaMixin = dijit.form._ExpandingTextAreaMixin;
  13. var SimpleTextarea = dijit.form.SimpleTextarea;
  14. =====*/
  15. // module:
  16. // dijit/form/Textarea
  17. // summary:
  18. // A textarea widget that adjusts it's height according to the amount of data.
  19. dojo.declare("dijit.form.Textarea", [dijit.form.SimpleTextarea, dijit.form._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. // TODO: for 2.0, rename this to ExpandingTextArea, and rename SimpleTextarea to TextArea
  33. baseClass: "dijitTextBox dijitTextArea dijitExpandingTextArea",
  34. // Override SimpleTextArea.cols to default to width:100%, for backward compatibility
  35. cols: "",
  36. buildRendering: function(){
  37. this.inherited(arguments);
  38. // tweak textarea style to reduce browser differences
  39. dojo.style(this.textbox, { overflowY: 'hidden', overflowX: 'auto', boxSizing: 'border-box', MsBoxSizing: 'border-box', WebkitBoxSizing: 'border-box', MozBoxSizing: 'border-box' });
  40. }
  41. });
  42. }