From 5f3782dd5fb8be4c196f57cb07fd1cc2fd6b2f56 Mon Sep 17 00:00:00 2001
From: Clemens <cle1000.cb@gmail.com>
Date: Thu, 14 Jul 2016 23:01:34 +0200
Subject: change way to edit

---
 web/src/js/components/common/CodeEditor.jsx | 24 ++++++------------------
 1 file changed, 6 insertions(+), 18 deletions(-)

(limited to 'web/src/js/components/common/CodeEditor.jsx')

diff --git a/web/src/js/components/common/CodeEditor.jsx b/web/src/js/components/common/CodeEditor.jsx
index 85da0507..b10b13ed 100644
--- a/web/src/js/components/common/CodeEditor.jsx
+++ b/web/src/js/components/common/CodeEditor.jsx
@@ -1,40 +1,28 @@
 import React, { Component, PropTypes } from 'react'
 import { render } from 'react-dom';
-import brace from 'brace';
 import AceEditor from 'react-ace';
-import Button from './Button'
-
 
 import 'brace/mode/javascript';
-import 'brace/mode/json';
 import 'brace/theme/kuroir';
 
-
-
-
 export default class CodeEditor extends Component{
-    constructor( props ) {
-        super(props)
-        this.state = {value: this.props.value}
-    }
-
-    onChange(newValue) {
-        this.setState({value: newValue})
+     static propTypes = {
+        value: PropTypes.string.isRequired,
+        onChange: PropTypes.func.isRequired,
     }
 
     render() {
         return (
             <div onKeyDown={e => e.stopPropagation()}>
                 <AceEditor
-                    onChange={e => this.onChange(e)}
                     mode="javascript"
                     theme="kuroir"
-                    value={this.state.value}
+                    onChange={this.props.onChange}
+                    name="rea"
+                    value={this.props.value}
                     width="100%"
-                    name="codeEditor"
                     editorProps={{$blockScrolling: Infinity}}
                 />
-                <Button onClick={(e) => this.props.onSave(this.state.value)} text="Update"/>
             </div>
         )
     }
-- 
cgit v1.2.3

