From f5c597a9e351b8dfb84f0fe3f09046e772482fc6 Mon Sep 17 00:00:00 2001
From: Jason <jason.daurus@gmail.com>
Date: Wed, 15 Jun 2016 00:46:59 +0800
Subject: [web] Editor & Prompt

---
 web/src/js/components/ValueEditor.jsx | 36 +++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100755 web/src/js/components/ValueEditor.jsx

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

diff --git a/web/src/js/components/ValueEditor.jsx b/web/src/js/components/ValueEditor.jsx
new file mode 100755
index 00000000..0316924f
--- /dev/null
+++ b/web/src/js/components/ValueEditor.jsx
@@ -0,0 +1,36 @@
+import React, { Component, PropTypes } from 'react'
+import ReactDOM from 'react-dom'
+import ValidateEditor from './ValueEditor/ValidateEditor'
+
+export default class ValueEditor extends Component {
+
+    static contextTypes = {
+        returnFocus: PropTypes.func,
+    }
+
+    static propTypes = {
+        content: PropTypes.string.isRequired,
+        onDone: PropTypes.func.isRequired,
+        inline: PropTypes.bool,
+    }
+
+    constructor(props) {
+        super(props)
+        this.focus = this.focus.bind(this)
+    }
+
+    render() {
+        var tag = this.props.inline ? "span" : 'div'
+        return (
+            <ValidateEditor
+                {...this.props}
+                onStop={() => this.context.returnFocus()}
+                tag={tag}
+            />
+        )
+    }
+
+    focus() {
+        ReactDOM.findDOMNode(this).focus();
+    }
+}
-- 
cgit v1.2.3

