diff --git a/src/components/views/messages/TextualBody.js b/src/components/views/messages/TextualBody.js index 71f7572a25..e3cd9d8f51 100644 --- a/src/components/views/messages/TextualBody.js +++ b/src/components/views/messages/TextualBody.js @@ -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
so that the copy button can be correctly positioned // when theoverflows and is scrolled horizontally. const div = this._wrapInDiv(pres[i]);