react-texteditable
v1.0.2
Published
React component representing a <div> with editable text content
Downloads
2
Maintainers
Readme
react-texteditable
Based off of https://github.com/lovasoa/react-contenteditable
The major difference is textContent
is being set rather than innerHTML
This change was done to prevent XSS
React component for a div with editable text content
Usage
var TextEditable = require("react-texteditable");
var MyComponent = React.createClass({
getInitialState: function(){
return {text: "<b>Hello <i>World</i></b>"};
},
handleChange: function(evt){
this.setState({text: evt.target.value});
},
render: function(){
return <TextEditable
text={this.state.text} // textContent of the editable div
disabled={false} // use true to disable edition
onChange={this.handleChange} // handle textContent change
/>
}
});