diff options
| author | Jason <jason.daurus@gmail.com> | 2016-06-17 21:54:31 +0800 |
|---|---|---|
| committer | Jason <jason.daurus@gmail.com> | 2016-06-17 21:54:31 +0800 |
| commit | e4addd60f1ffbb445a8c05f3fb2b6c6e61bd7b93 (patch) | |
| tree | cb5e3be10e8bb813c1ade3aa88204460317d2548 /web/src/js/components/ValueEditor.jsx | |
| parent | 16a28eca258e07d45c7e2a8ee95368d4eb077d4d (diff) | |
| parent | 9c6199db9be34fad18eaedb86463333671ae190a (diff) | |
| download | mitmproxy-e4addd60f1ffbb445a8c05f3fb2b6c6e61bd7b93.tar.gz mitmproxy-e4addd60f1ffbb445a8c05f3fb2b6c6e61bd7b93.tar.bz2 mitmproxy-e4addd60f1ffbb445a8c05f3fb2b6c6e61bd7b93.zip | |
Merge branch 'master' into websocket
Conflicts:
mitmproxy/web/static/app.css
mitmproxy/web/static/app.js
web/src/js/components/ProxyApp.jsx
Diffstat (limited to 'web/src/js/components/ValueEditor.jsx')
| -rwxr-xr-x | web/src/js/components/ValueEditor.jsx | 36 |
1 files changed, 36 insertions, 0 deletions
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(); + } +} |
