Fix duplication caused by highlighting

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2021-02-10 14:20:19 +01:00
parent 895be6e7a6
commit 6b0b46b917
No known key found for this signature in database
GPG key ID: 9760693FDD98A790

View file

@ -118,6 +118,9 @@ export default class TextualBody extends React.Component {
setTimeout(() => {
if (this._unmounted) return;
for (let i = 0; i < codes.length; i++) {
// If the code already has the hljs class we want to skip this.
// This happens after the codeblock was edited.
if (codes[i].className.includes("hljs")) continue;
this._highlightCode(codes[i]);
}
}, 10);