1
0
mirror of https://github.com/stolksdorf/homebrewery.git synced 2025-12-21 16:01:30 +00:00

Editor pane looks finished, injecting snippet text is workign and snippet group structure done

This commit is contained in:
Scott Tolksdorf
2016-05-06 13:59:41 -04:00
parent c418ea5b42
commit ad02f99ebe
7 changed files with 192 additions and 115 deletions

View File

@@ -34,20 +34,35 @@ var CodeEditor = React.createClass({
this.codeMirror.on('change', this.handleChange);
this.codeMirror.on('cursorActivity', this.handleCursorActivity);
this.updateSize();
},
componentWillReceiveProps: _.debounce(function(nextProps){
componentWillReceiveProps: function(nextProps){
if(this.codeMirror && nextProps.value !== undefined && this.codeMirror.getValue() != nextProps.value) {
this.codeMirror.setValue(nextProps.value);
}
}, 0),
},
shouldComponentUpdate: function(nextProps, nextState) {
return false;
},
setCursorPosition : function(line, char){
setTimeout(()=>{
this.codeMirror.focus();
this.codeMirror.doc.setCursor(line, char);
}, 10);
},
updateSize : function(){
this.codeMirror.refresh();
},
handleChange : function(editor){
this.props.onChange(editor.getValue());
},
handleCursorActivity : function(){
this.props.onCursorActivity(this.codeMirror.getCursor());
this.props.onCursorActivity(this.codeMirror.doc.getCursor());
},
render : function(){