incorporate kegan PR feedback

This commit is contained in:
Matthew Hodgson 2016-01-18 14:00:47 +00:00
parent 2a64d0feb3
commit 17fdfa0c8f
2 changed files with 25 additions and 8 deletions

View file

@ -41,9 +41,6 @@ module.exports = React.createClass({
Edit: "edit",
},
value: '',
placeholder: false,
getDefaultProps: function() {
return {
onValueChanged: function() {},
@ -69,6 +66,13 @@ module.exports = React.createClass({
}
},
componentWillMount: function() {
// we track value as an JS object field rather than in React state
// as React doesn't play nice with contentEditable.
this.value = '';
this.placeholder = false;
},
componentDidMount: function() {
this.value = this.props.initialValue;
if (this.refs.editable_div) {
@ -76,9 +80,6 @@ module.exports = React.createClass({
}
},
componentDidUpdate: function() {
},
showPlaceholder: function(show) {
if (show) {
this.refs.editable_div.textContent = this.props.placeholder;