0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-27 00:42:40 +00:00

Trying out a reddit share button, looks promising

This commit is contained in:
Scott Tolksdorf
2016-05-04 15:25:27 -04:00
parent 1db6553365
commit 133dd7c144
5 changed files with 61 additions and 16 deletions

View File

@@ -18,6 +18,7 @@ var CodeEditor = React.createClass({
return {
language : '',
value : '',
wrap : false,
onChange : function(){},
onCursorActivity : function(){},
};
@@ -27,6 +28,7 @@ var CodeEditor = React.createClass({
this.codeMirror = CodeMirror(this.refs.editor,{
value : this.props.value,
lineNumbers: true,
lineWrapping : this.props.wrap,
mode : this.props.language
});
@@ -34,7 +36,7 @@ var CodeEditor = React.createClass({
this.codeMirror.on('cursorActivity', this.handleCursorActivity);
},
componentWillReceiveProps: _.debounce((nextProps)=>{
componentWillReceiveProps: _.debounce(function(nextProps){
if(this.codeMirror && nextProps.value !== undefined && this.codeMirror.getValue() != nextProps.value) {
this.codeMirror.setValue(nextProps.value);
}