Migrate highlight.js API call in TextualBody (#9923)

Co-authored-by: Michael Weimann <michaelw@matrix.org>
Fixes https://github.com/vector-im/element-web/issues/22233
This commit is contained in:
Harnoor Singh 2023-01-31 04:48:34 -05:00 committed by GitHub
parent 39f5fc034f
commit 97f6431d60
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -265,7 +265,7 @@ export default class TextualBody extends React.Component<IBodyProps, IState> {
// We don't use highlightElement here because we can't force language detection // We don't use highlightElement here because we can't force language detection
// off. It should use the one we've found in the CSS class but we'd rather pass // off. It should use the one we've found in the CSS class but we'd rather pass
// it in explicitly to make sure. // it in explicitly to make sure.
code.innerHTML = highlight.highlight(advertisedLang, code.textContent).value; code.innerHTML = highlight.highlight(code.textContent, { language: advertisedLang }).value;
} else if ( } else if (
SettingsStore.getValue("enableSyntaxHighlightLanguageDetection") && SettingsStore.getValue("enableSyntaxHighlightLanguageDetection") &&
code.parentElement instanceof HTMLPreElement code.parentElement instanceof HTMLPreElement