aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/components/ValueEditor/ValidateEditor.jsx
diff options
context:
space:
mode:
authorJason <jason.daurus@gmail.com>2016-06-17 06:26:46 +0800
committerJason <jason.daurus@gmail.com>2016-06-17 06:26:46 +0800
commit4ce7a9ba7728e7988f4455723ba5fed4fcd8d149 (patch)
tree1ce5092add53c45656ffda088a2deceaaf9c84e5 /web/src/js/components/ValueEditor/ValidateEditor.jsx
parentf5c597a9e351b8dfb84f0fe3f09046e772482fc6 (diff)
downloadmitmproxy-4ce7a9ba7728e7988f4455723ba5fed4fcd8d149.tar.gz
mitmproxy-4ce7a9ba7728e7988f4455723ba5fed4fcd8d149.tar.bz2
mitmproxy-4ce7a9ba7728e7988f4455723ba5fed4fcd8d149.zip
[web] editor config for line endings
Diffstat (limited to 'web/src/js/components/ValueEditor/ValidateEditor.jsx')
-rwxr-xr-xweb/src/js/components/ValueEditor/ValidateEditor.jsx116
1 files changed, 58 insertions, 58 deletions
diff --git a/web/src/js/components/ValueEditor/ValidateEditor.jsx b/web/src/js/components/ValueEditor/ValidateEditor.jsx
index ea4e8803..2f362986 100755
--- a/web/src/js/components/ValueEditor/ValidateEditor.jsx
+++ b/web/src/js/components/ValueEditor/ValidateEditor.jsx
@@ -1,58 +1,58 @@
-import React, { Component, PropTypes } from 'react'
-import ReactDOM from 'react-dom'
-import EditorBase from './EditorBase'
-
-export default class ValidateEditor extends Component {
-
- static propTypes = {
- content: PropTypes.string.isRequired,
- onDone: PropTypes.func.isRequired,
- onInput: PropTypes.func,
- isValid: PropTypes.func,
- className: PropTypes.string,
- }
-
- constructor(props) {
- super(props)
- this.state = { currentContent: props.content }
- this.onInput = this.onInput.bind(this)
- this.onDone = this.onDone.bind(this)
- }
-
- componentWillReceiveProps(nextProps) {
- this.setState({ currentContent: nextProps.content })
- }
-
- onInput(currentContent) {
- this.setState({ currentContent })
- this.props.onInput && this.props.onInput(currentContent)
- }
-
- onDone(content) {
- if (this.props.isValid && !this.props.isValid(content)) {
- this.refs.editor.reset()
- content = this.props.content
- }
- this.props.onDone(content)
- }
-
- render() {
- let className = this.props.className || ''
- if (this.props.isValid) {
- if (this.props.isValid(this.state.currentContent)) {
- className += ' has-success'
- } else {
- className += ' has-warning'
- }
- }
- return (
- <EditorBase
- {...this.props}
- ref="editor"
- className={className}
- onDone={this.onDone}
- onInput={this.onInput}
- />
- )
- }
-}
+import React, { Component, PropTypes } from 'react'
+import ReactDOM from 'react-dom'
+import EditorBase from './EditorBase'
+
+export default class ValidateEditor extends Component {
+
+ static propTypes = {
+ content: PropTypes.string.isRequired,
+ onDone: PropTypes.func.isRequired,
+ onInput: PropTypes.func,
+ isValid: PropTypes.func,
+ className: PropTypes.string,
+ }
+
+ constructor(props) {
+ super(props)
+ this.state = { currentContent: props.content }
+ this.onInput = this.onInput.bind(this)
+ this.onDone = this.onDone.bind(this)
+ }
+
+ componentWillReceiveProps(nextProps) {
+ this.setState({ currentContent: nextProps.content })
+ }
+
+ onInput(currentContent) {
+ this.setState({ currentContent })
+ this.props.onInput && this.props.onInput(currentContent)
+ }
+
+ onDone(content) {
+ if (this.props.isValid && !this.props.isValid(content)) {
+ this.refs.editor.reset()
+ content = this.props.content
+ }
+ this.props.onDone(content)
+ }
+
+ render() {
+ let className = this.props.className || ''
+ if (this.props.isValid) {
+ if (this.props.isValid(this.state.currentContent)) {
+ className += ' has-success'
+ } else {
+ className += ' has-warning'
+ }
+ }
+ return (
+ <EditorBase
+ {...this.props}
+ ref="editor"
+ className={className}
+ onDone={this.onDone}
+ onInput={this.onInput}
+ />
+ )
+ }
+}