Skip to content

Commit 3cecf93

Browse files
committed
Add cursorActivity event, closes JedWatson#103
1 parent c896af2 commit 3cecf93

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Codemirror.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const CodeMirror = createReactClass({
1818
codeMirrorInstance: PropTypes.func,
1919
defaultValue: PropTypes.string,
2020
onChange: PropTypes.func,
21+
onCursorActivity: PropTypes.func,
2122
onFocusChange: PropTypes.func,
2223
onScroll: PropTypes.func,
2324
options: PropTypes.object,
@@ -46,6 +47,7 @@ const CodeMirror = createReactClass({
4647
const codeMirrorInstance = this.getCodeMirrorInstance();
4748
this.codeMirror = codeMirrorInstance.fromTextArea(textareaNode, this.props.options);
4849
this.codeMirror.on('change', this.codemirrorValueChanged);
50+
this.codeMirror.on('cursorActivity', this.cursorActivity);
4951
this.codeMirror.on('focus', this.focusChanged.bind(this, true));
5052
this.codeMirror.on('blur', this.focusChanged.bind(this, false));
5153
this.codeMirror.on('scroll', this.scrollChanged);
@@ -95,6 +97,9 @@ const CodeMirror = createReactClass({
9597
});
9698
this.props.onFocusChange && this.props.onFocusChange(focused);
9799
},
100+
cursorActivity (cm) {
101+
this.props.onCursorActivity && this.props.onCursorActivity(cm);
102+
},
98103
scrollChanged (cm) {
99104
this.props.onScroll && this.props.onScroll(cm.getScrollInfo());
100105
},

0 commit comments

Comments
 (0)