Improve downloadable HighlightCode filename (#4508)
* Update highlight-code.jsx * improve filename no more response.txt * use new `fileName` prop for file names * use template strings for `fileName` prop values * fall back to old "response.txt" file name if none is provided
This commit is contained in:
@@ -7,7 +7,8 @@ export default class HighlightCode extends Component {
|
||||
static propTypes = {
|
||||
value: PropTypes.string.isRequired,
|
||||
className: PropTypes.string,
|
||||
downloadable: PropTypes.bool
|
||||
downloadable: PropTypes.bool,
|
||||
fileName: PropTypes.string
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
@@ -23,7 +24,7 @@ export default class HighlightCode extends Component {
|
||||
}
|
||||
|
||||
downloadText = () => {
|
||||
saveAs(this.props.value, "response.txt")
|
||||
saveAs(this.props.value, this.props.fileName || "response.txt")
|
||||
}
|
||||
|
||||
preventYScrollingBeyondElement = (e) => {
|
||||
|
||||
Reference in New Issue
Block a user