Skip to content

Commit c2debf1

Browse files
committed
Fixing happiness errors
1 parent 54d0956 commit c2debf1

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

example/src/example.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ var React = require('react');
22
var Codemirror = require('react-codemirror');
33

44
var App = React.createClass({
5-
getInitialState: function() {
5+
getInitialState () {
66
return {
7-
code: "# Heading\n\nSome **bold** and _italic_ text\nBy [Jed Watson](https://github.com/JedWatson)"
7+
code: '# Heading\n\nSome **bold** and _italic_ text\nBy [Jed Watson](https://github.com/JedWatson)'
88
};
99
},
10-
updateCode: function(newCode) {
10+
updateCode (newCode) {
1111
this.setState({
1212
code: newCode
1313
});
1414
},
15-
render: function() {
15+
render () {
1616
var options = {
1717
lineNumbers: true
1818
};
19-
return <Codemirror value={this.state.code} onChange={this.updateCode} options={options} />
19+
return <Codemirror value={this.state.code} onChange={this.updateCode} options={options} />;
2020
}
2121
});
2222

src/Codemirror.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,57 +2,57 @@ var CM = require('codemirror');
22
var React = require('react');
33

44
var CodeMirror = React.createClass({
5-
6-
getInitialState: function() {
5+
6+
getInitialState () {
77
return {
88
isFocused: false
99
};
1010
},
11-
12-
componentDidMount: function() {
11+
12+
componentDidMount () {
1313
this.codeMirror = CM.fromTextArea(this.refs.codemirror.getDOMNode(), this.props.options);
1414
this.codeMirror.on('change', this.codemirrorValueChanged);
1515
this.codeMirror.on('focus', this.focusChanged.bind(this, true));
1616
this.codeMirror.on('blur', this.focusChanged.bind(this, false));
1717
this._currentCodemirrorValue = this.props.value;
1818
},
19-
20-
componentWillUnmount: function() {
19+
20+
componentWillUnmount () {
2121
// todo: is there a lighter-weight way to remove the cm instance?
2222
if (this.codeMirror) {
2323
this.codeMirror.toTextArea();
2424
}
2525
},
26-
27-
componentWillReceiveProps: function(nextProps) {
26+
27+
componentWillReceiveProps (nextProps) {
2828
if (this.codeMirror && this._currentCodemirrorValue !== nextProps.value) {
2929
this.codeMirror.setValue(nextProps.value);
3030
}
3131
},
3232

33-
getCodeMirror: function() {
33+
getCodeMirror () {
3434
return this.codeMirror;
3535
},
36-
37-
focus: function() {
36+
37+
focus () {
3838
if (this.codeMirror) {
3939
this.codeMirror.focus();
4040
}
4141
},
42-
43-
focusChanged: function(focused) {
42+
43+
focusChanged (focused) {
4444
this.setState({
4545
isFocused: focused
4646
});
4747
},
48-
49-
codemirrorValueChanged: function(doc, change) {
48+
49+
codemirrorValueChanged (doc, change) {
5050
var newValue = doc.getValue();
5151
this._currentCodemirrorValue = newValue;
5252
this.props.onChange && this.props.onChange(newValue);
5353
},
54-
55-
render: function() {
54+
55+
render () {
5656
var className = 'ReactCodeMirror';
5757
if (this.state.isFocused) {
5858
className += ' ReactCodeMirror--focused';
@@ -63,7 +63,7 @@ var CodeMirror = React.createClass({
6363
</div>
6464
);
6565
}
66-
66+
6767
});
6868

6969
module.exports = CodeMirror;

0 commit comments

Comments
 (0)