From c9baff1e101afb216fe75d56e1fa523cc8b1bfa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Tue, 23 Feb 2021 07:46:03 +0100 Subject: [PATCH] Move the _addCodeElement() call down a bit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We can skip this if the first if statement is true Signed-off-by: Šimon Brandner --- src/components/views/messages/TextualBody.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/views/messages/TextualBody.js b/src/components/views/messages/TextualBody.js index c6352e0e67..5be4a6bbb4 100644 --- a/src/components/views/messages/TextualBody.js +++ b/src/components/views/messages/TextualBody.js @@ -96,11 +96,13 @@ export default class TextualBody extends React.Component { const pres = ReactDOM.findDOMNode(this).getElementsByTagName("pre"); if (pres.length > 0) { for (let i = 0; i < pres.length; i++) { - // Add code element if it's missing - if (!pres[i].getElementsByTagName("code")[0]) this._addCodeElement(pres[i]); // If there already is a div wrapping the codeblock we want to skip this. // This happens after the codeblock was edited. if (pres[i].parentNode.className == "mx_EventTile_pre_container") continue; + // Add code element if it's missing + if (!pres[i].getElementsByTagName("code")[0]) { + this._addCodeElement(pres[i]); + } // Wrap a div around
 so that the copy button can be correctly positioned
                     // when the 
 overflows and is scrolled horizontally.
                     const div = this._wrapInDiv(pres[i]);