@@ -6,6 +6,7 @@ const CodeMirror = React.createClass({
66 propTypes : {
77 onChange : React . PropTypes . func ,
88 onFocusChange : React . PropTypes . func ,
9+ onScroll : React . PropTypes . func ,
910 options : React . PropTypes . object ,
1011 path : React . PropTypes . string ,
1112 value : React . PropTypes . string ,
@@ -27,6 +28,7 @@ const CodeMirror = React.createClass({
2728 this . codeMirror . on ( 'change' , this . codemirrorValueChanged ) ;
2829 this . codeMirror . on ( 'focus' , this . focusChanged . bind ( this , true ) ) ;
2930 this . codeMirror . on ( 'blur' , this . focusChanged . bind ( this , false ) ) ;
31+ this . codeMirror . on ( 'scroll' , this . scrollChanged ) ;
3032 this . codeMirror . setValue ( this . props . defaultValue || this . props . value || '' ) ;
3133 } ,
3234 componentWillUnmount ( ) {
@@ -61,6 +63,9 @@ const CodeMirror = React.createClass({
6163 } ) ;
6264 this . props . onFocusChange && this . props . onFocusChange ( focused ) ;
6365 } ,
66+ scrollChanged ( cm ) {
67+ this . props . onScroll && this . props . onScroll ( cm . getScrollInfo ( ) ) ;
68+ } ,
6469 codemirrorValueChanged ( doc , change ) {
6570 if ( this . props . onChange && change . origin != 'setValue' ) {
6671 this . props . onChange ( doc . getValue ( ) ) ;
0 commit comments