diff --git a/app/javascript/components/automate-method-form/codeMirror.js b/app/javascript/components/automate-method-form/automate-method-code-mirror/index.jsx similarity index 50% rename from app/javascript/components/automate-method-form/codeMirror.js rename to app/javascript/components/automate-method-form/automate-method-code-mirror/index.jsx index 17d0aaeff89..ff20cc2b04d 100644 --- a/app/javascript/components/automate-method-form/codeMirror.js +++ b/app/javascript/components/automate-method-form/automate-method-code-mirror/index.jsx @@ -3,7 +3,7 @@ import CodeMirror from 'codemirror'; import 'codemirror/lib/codemirror.css'; import 'codemirror/mode/javascript/javascript'; -const ReactCodeMirror = ({ code, onChange }) => { +const AutomateMethodCodeMirror = () => { const codeMirrorRef = useRef(null); useEffect(() => { @@ -14,22 +14,33 @@ const ReactCodeMirror = ({ code, onChange }) => { }); editor.on('change', (instance) => { - if (onChange) { - onChange(instance.getValue()); - } + console.log(instance) }); - editor.setValue(code); + + editor.setValue('test'); return () => { editor.toTextArea(); }; - }, [code, onChange]); + }, []); return (
-