0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-25 22:42:41 +00:00

fix refs in codeEditor.jsx

This commit is contained in:
Gazook89
2024-05-16 23:15:54 -05:00
parent 46c14ef23b
commit 8ae22bdc27

View File

@@ -63,6 +63,8 @@ const CodeEditor = createClass({
};
},
editor : React.createRef(null),
componentDidMount : function() {
this.buildEditor();
const newDoc = CodeMirror.Doc(this.props.value, this.props.language);
@@ -102,7 +104,7 @@ const CodeEditor = createClass({
},
buildEditor : function() {
this.codeMirror = CodeMirror(this.refs.editor, {
this.codeMirror = CodeMirror(this.editor.current, {
lineNumbers : true,
lineWrapping : this.props.wrap,
indentWithTabs : false,
@@ -443,7 +445,7 @@ const CodeEditor = createClass({
render : function(){
return <>
<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}/>
</>;
}
});