mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-10 11:22:40 +00:00
fix refs in codeEditor.jsx
This commit is contained in:
@@ -63,6 +63,8 @@ const CodeEditor = createClass({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
editor : React.createRef(null),
|
||||||
|
|
||||||
componentDidMount : function() {
|
componentDidMount : function() {
|
||||||
this.buildEditor();
|
this.buildEditor();
|
||||||
const newDoc = CodeMirror.Doc(this.props.value, this.props.language);
|
const newDoc = CodeMirror.Doc(this.props.value, this.props.language);
|
||||||
@@ -102,7 +104,7 @@ const CodeEditor = createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
buildEditor : function() {
|
buildEditor : function() {
|
||||||
this.codeMirror = CodeMirror(this.refs.editor, {
|
this.codeMirror = CodeMirror(this.editor.current, {
|
||||||
lineNumbers : true,
|
lineNumbers : true,
|
||||||
lineWrapping : this.props.wrap,
|
lineWrapping : this.props.wrap,
|
||||||
indentWithTabs : false,
|
indentWithTabs : false,
|
||||||
@@ -443,7 +445,7 @@ const CodeEditor = createClass({
|
|||||||
render : function(){
|
render : function(){
|
||||||
return <>
|
return <>
|
||||||
<link href={`../homebrew/cm-themes/${this.props.editorTheme}.css`} type='text/css' rel='stylesheet' />
|
<link href={`../homebrew/cm-themes/${this.props.editorTheme}.css`} type='text/css' rel='stylesheet' />
|
||||||
<div className='codeEditor' ref='editor' style={this.props.style}/>
|
<div className='codeEditor' ref={this.editor} style={this.props.style}/>
|
||||||
</>;
|
</>;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user