in with the new
This commit is contained in:
28
src/core/components/curl.jsx
Normal file
28
src/core/components/curl.jsx
Normal file
@@ -0,0 +1,28 @@
|
||||
import React, { PropTypes } from "react"
|
||||
import curlify from "core/curlify"
|
||||
|
||||
export default class Curl extends React.Component {
|
||||
static propTypes = {
|
||||
request: PropTypes.object.isRequired
|
||||
}
|
||||
|
||||
handleFocus(e) {
|
||||
e.target.select()
|
||||
document.execCommand("copy")
|
||||
}
|
||||
|
||||
render() {
|
||||
let { request } = this.props
|
||||
let curl = curlify(request)
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h4>Curl</h4>
|
||||
<div className="copy-paste">
|
||||
<textarea onFocus={this.handleFocus} className="curl" style={{ whiteSpace: "normal" }} defaultValue={curl}></textarea>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user