From 6b0b46b917350553771946628f8e102d040d62b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Wed, 10 Feb 2021 14:20:19 +0100 Subject: [PATCH] Fix duplication caused by highlighting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/components/views/messages/TextualBody.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/views/messages/TextualBody.js b/src/components/views/messages/TextualBody.js index e32f8b11e0..6b201f1b8e 100644 --- a/src/components/views/messages/TextualBody.js +++ b/src/components/views/messages/TextualBody.js @@ -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);