@@ -9,8 +9,7 @@ import { CopyToClipboard } from "react-copy-to-clipboard"
|
|||||||
|
|
||||||
const HighlightCode = ({value, fileName, className, downloadable, getConfigs, canCopy, language}) => {
|
const HighlightCode = ({value, fileName, className, downloadable, getConfigs, canCopy, language}) => {
|
||||||
const config = isFunction(getConfigs) ? getConfigs() : null
|
const config = isFunction(getConfigs) ? getConfigs() : null
|
||||||
const canSyntaxHighlight = get(config, "syntaxHighlight.activated", true)
|
const canSyntaxHighlight = get(config, "syntaxHighlight") !== false && get(config, "syntaxHighlight.activated", true)
|
||||||
const highlighterStyle = getStyle(get(config, "syntaxHighlight.theme", "agate"))
|
|
||||||
const rootRef = useRef(null)
|
const rootRef = useRef(null)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -62,11 +61,11 @@ const HighlightCode = ({value, fileName, className, downloadable, getConfigs, ca
|
|||||||
? <SyntaxHighlighter
|
? <SyntaxHighlighter
|
||||||
language={language}
|
language={language}
|
||||||
className={cx(className, "microlight")}
|
className={cx(className, "microlight")}
|
||||||
style={highlighterStyle}
|
style={getStyle(get(config, "syntaxHighlight.theme", "agate"))}
|
||||||
>
|
>
|
||||||
{value}
|
{value}
|
||||||
</SyntaxHighlighter>
|
</SyntaxHighlighter>
|
||||||
: <pre className={cx(className + "microlight")}>{value}</pre>
|
: <pre className={cx(className, "microlight")}>{value}</pre>
|
||||||
}
|
}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user