Simplifie

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2021-01-20 13:03:05 +01:00
parent 8535a11dd2
commit 072cbe98b5
No known key found for this signature in database
GPG key ID: 9760693FDD98A790

View file

@ -100,7 +100,7 @@ export default class TextualBody extends React.Component {
const div = this._wrapInDiv(pres[i]);
this._handleCodeBlockExpansion(pres[i]);
this._addCodeCopyButton(div);
this._addCodeExpansionButton(div);
this._addCodeExpansionButton(div, pres[i]);
}
}
// Highlight code
@ -120,10 +120,9 @@ export default class TextualBody extends React.Component {
}
}
_addCodeExpansionButton(div) {
_addCodeExpansionButton(div, pre) {
// TODO: What if the block is small and the we don't need the icon?
const pre = div.getElementsByTagName("pre")[0];
const button = document.createElement("span");
if (pre.className == "mx_EventTile_collapsedCodeBlock") {
button.className = "mx_EventTile_expandButton";