From f5221236cf8812179316b5a6cb202338d36c60e2 Mon Sep 17 00:00:00 2001 From: zenoamaro Date: Sun, 30 Jul 2017 04:49:39 +0200 Subject: [PATCH] Logging focus events in demo --- demo/index.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/demo/index.js b/demo/index.js index 90931d93..12527024 100644 --- a/demo/index.js +++ b/demo/index.js @@ -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 }); }, @@ -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, }) ) );