Fix duplication of codeblock elements

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
pull/21833/head
Šimon Brandner 2021-02-09 19:46:30 +01:00
parent 59069f95e9
commit 4a7bc74e99
No known key found for this signature in database
GPG Key ID: 9760693FDD98A790
1 changed files with 3 additions and 0 deletions

View File

@ -96,6 +96,9 @@ 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++) {
// 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;
// Wrap a div around <pre> so that the copy button can be correctly positioned
// when the <pre> overflows and is scrolled horizontally.
const div = this._wrapInDiv(pres[i]);