From 5f3782dd5fb8be4c196f57cb07fd1cc2fd6b2f56 Mon Sep 17 00:00:00 2001 From: Clemens Date: Thu, 14 Jul 2016 23:01:34 +0200 Subject: change way to edit --- .../js/components/ContentView/ContentEditor.jsx | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 web/src/js/components/ContentView/ContentEditor.jsx (limited to 'web/src/js/components/ContentView/ContentEditor.jsx') diff --git a/web/src/js/components/ContentView/ContentEditor.jsx b/web/src/js/components/ContentView/ContentEditor.jsx new file mode 100644 index 00000000..a38e4d6f --- /dev/null +++ b/web/src/js/components/ContentView/ContentEditor.jsx @@ -0,0 +1,42 @@ +import React, { Component, PropTypes } from 'react' +import CodeEditor from '../common/CodeEditor' + +export default class ContentEditor extends Component { + + static propTypes = { + content: PropTypes.string.isRequired, + onSave: PropTypes.func.isRequired, + onClose: PropTypes.func.isRequired, + onOpen: PropTypes.func.isRequired, + isClosed: PropTypes.bool.isRequired + } + + constructor(props){ + super(props) + this.state = {content: this.props.content} + } + + render() { + return ( +
+ {this.props.isClosed ? + + + : + + + + + this.props.onSave(this.state.content)}> + + + + } + {!this.props.isClosed && + this.setState({content: content})}/> + } +
+ + ) + } +} -- cgit v1.2.3