react-textarea-autosize
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -6,2 +6,2 @@ var React = require('react'); | ||
new TextareaAutosize({defaultValue: (new Array(15)).join('\nLine.')}), | ||
document.body); | ||
document.getElementById('main')); |
26
index.js
@@ -40,15 +40,19 @@ var React = require('react'); | ||
getDiffSize: function() { | ||
var styles = window.getComputedStyle(this.getDOMNode()); | ||
if (window.getComputedStyle) { | ||
var styles = window.getComputedStyle(this.getDOMNode()); | ||
// If the textarea is set to border-box, it's not necessary to | ||
// subtract the padding. | ||
if (styles.getPropertyValue('box-sizing') === "border-box" || | ||
styles.getPropertyValue('-moz-box-sizing') === "border-box" || | ||
styles.getPropertyValue('-webkit-box-sizing') === "border-box") { | ||
// If the textarea is set to border-box, it's not necessary to | ||
// subtract the padding. | ||
if (styles.getPropertyValue('box-sizing') === "border-box" || | ||
styles.getPropertyValue('-moz-box-sizing') === "border-box" || | ||
styles.getPropertyValue('-webkit-box-sizing') === "border-box") { | ||
this.diff = 0; | ||
} else { | ||
this.diff = ( | ||
parseInt(styles.getPropertyValue('padding-bottom') || 0, 10) + | ||
parseInt(styles.getPropertyValue('padding-top') || 0, 10) | ||
); | ||
} | ||
} else { | ||
this.diff = 0; | ||
} else { | ||
this.diff = ( | ||
parseInt(styles.getPropertyValue('padding-bottom') || 0, 10) + | ||
parseInt(styles.getPropertyValue('padding-top') || 0, 10) | ||
); | ||
} | ||
@@ -55,0 +59,0 @@ }, |
{ | ||
"name": "react-textarea-autosize", | ||
"description": "textarea component for React which grows with content", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Andrey Popp", |
# react-textarea-autosize | ||
Replacement for textarea component which automatically grows textarea as content grows: | ||
Drop-in replacement for the textarea component which automatically resizes textarea as content changes. | ||
A native React version of the popular [jQuery | ||
Autosize](http://www.jacklmoore.com/autosize/)! | ||
var Textarea = require('react-textarea-autosize'); | ||
This module supports IE9 and above. PR welcome to add IE8 support. | ||
React.renderComponent( | ||
<div> | ||
<Textarea></Textarea> | ||
</div>, | ||
document.body); | ||
```javascript | ||
var Textarea = require('react-textarea-autosize'); | ||
React.renderComponent( | ||
<div> | ||
<Textarea></Textarea> | ||
</div>, | ||
document.body); | ||
``` | ||
## Install | ||
`npm install react-textarea-autosize` | ||
## Demo | ||
http://andreypopp.github.io/react-textarea-autosize/ | ||
## Development | ||
@@ -14,0 +26,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5702
9
64
36