fix(responseBody): json response highlighting (#6871)

Refs #6508 

* Add language prop to HighlightCode component

* Use language prop for JSON HighlightCode responses in response-body.jsx
This commit is contained in:
Nicolas
2021-02-03 17:56:29 -03:00
committed by GitHub
parent 5c4dfc2da8
commit 13fea13397
2 changed files with 6 additions and 2 deletions

View File

@@ -12,6 +12,7 @@ export default class HighlightCode extends Component {
className: PropTypes.string,
downloadable: PropTypes.bool,
fileName: PropTypes.string,
language: PropTypes.string,
canCopy: PropTypes.bool
}
@@ -39,7 +40,7 @@ export default class HighlightCode extends Component {
}
render () {
let { value, className, downloadable, getConfigs, canCopy } = this.props
let { value, className, downloadable, getConfigs, canCopy, language } = this.props
const config = getConfigs ? getConfigs() : {syntaxHighlight: {activated: true, theme: "agate"}}
@@ -47,6 +48,7 @@ export default class HighlightCode extends Component {
const codeBlock = get(config, "syntaxHighlight.activated")
? <SyntaxHighlighter
language={language}
className={className + " microlight"}
onWheel={this.preventYScrollingBeyondElement}
style={getStyle(get(config, "syntaxHighlight.theme"))}