Skip to content

Commit

Permalink
Logging focus events in demo
Browse files Browse the repository at this point in the history
  • Loading branch information
zenoamaro committed Aug 4, 2017
1 parent 1b59cdf commit f522123
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion demo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,22 @@ var Editor = React.createClass({
});
},

onEditorFocus: function(range, source) {
this.setState({
events: [
'focus('+this.formatRange(range)+')'
].concat(this.state.events)
});
},

onEditorBlur: function(previousRange, source) {
this.setState({
events: [
'blur('+this.formatRange(previousRange)+')'
].concat(this.state.events)
});
},

onToggle: function() {
this.setState({ enabled: !this.state.enabled });
},
Expand All @@ -66,7 +82,9 @@ var Editor = React.createClass({
value: this.state.value,
readOnly: this.state.readOnly,
onChange: this.onEditorChange,
onChangeSelection: this.onEditorChangeSelection
onChangeSelection: this.onEditorChangeSelection,
onFocus: this.onEditorFocus,
onBlur: this.onEditorBlur,
})
)
);
Expand Down

0 comments on commit f522123

Please sign in to comment.