mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-25 18:22:42 +00:00
Moved codemirror in the shared dir, new codeeditor seems to be working
This commit is contained in:
39
shared/naturalCrit/codeEditor/codeEditor.jsx
Normal file
39
shared/naturalCrit/codeEditor/codeEditor.jsx
Normal file
@@ -0,0 +1,39 @@
|
||||
var React = require('react');
|
||||
var _ = require('lodash');
|
||||
var cx = require('classnames');
|
||||
|
||||
|
||||
var CodeMirror;
|
||||
if(typeof navigator !== 'undefined'){
|
||||
var CodeMirror = require('codemirror');
|
||||
|
||||
//Language Modes
|
||||
require('codemirror/mode/gfm/gfm.js'); //Github flavoured markdown
|
||||
require('codemirror/mode/javascript/javascript.js');
|
||||
}
|
||||
|
||||
|
||||
var CodeEditor = React.createClass({
|
||||
getDefaultProps: function() {
|
||||
return {
|
||||
language : 'javascript',
|
||||
text : 'yo dawg',
|
||||
onChange : function(){}
|
||||
};
|
||||
},
|
||||
|
||||
componentDidMount: function() {
|
||||
this.editor = CodeMirror(this.refs.editor,{
|
||||
lineNumbers: true,
|
||||
mode : this.props.language
|
||||
});
|
||||
},
|
||||
|
||||
render : function(){
|
||||
return <div className='codeEditor' ref='editor'>
|
||||
CodeEditor Ready!
|
||||
</div>
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = CodeEditor;
|
||||
Reference in New Issue
Block a user