From e6ab47ff764b28cdbbba2e190345f95435b5319d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=A0imon=20Brandner?= <simon.bra.ag@gmail.com>
Date: Tue, 19 Jan 2021 17:30:02 +0100
Subject: [PATCH] Fix bug
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
---
 res/css/views/rooms/_EventTile.scss          | 33 --------------------
 src/components/views/messages/TextualBody.js |  5 +--
 2 files changed, 3 insertions(+), 35 deletions(-)

diff --git a/res/css/views/rooms/_EventTile.scss b/res/css/views/rooms/_EventTile.scss
index c587251d3e..83aa3ec294 100644
--- a/res/css/views/rooms/_EventTile.scss
+++ b/res/css/views/rooms/_EventTile.scss
@@ -501,10 +501,6 @@ $left-gutter: 64px;
     }
 }
 
-.mx_EventTile_expandedCodeBlock {
-    max-height: 100vh;
-}
-
 .mx_EventTile_collapsedCodeBlock {
     max-height: 30vh;
 }
@@ -533,35 +529,6 @@ $left-gutter: 64px;
     background-color: $message-action-bar-fg-color;
 }
 
-
-// Inserted adjacent to <pre> blocks, (See TextualBody)
-.mx_EventTile_expandButton {
-    position: absolute;
-    display: inline-block;
-    visibility: hidden;
-    cursor: pointer;
-    top: 6px;
-    right: 6px;
-    width: 19px;
-    height: 19px;
-    mask-image: url($copy-button-url);
-    background-color: $message-action-bar-fg-color;
-}
-
-// Inserted adjacent to <pre> blocks, (See TextualBody)
-.mx_EventTile_collapseButton {
-    position: absolute;
-    display: inline-block;
-    visibility: hidden;
-    cursor: pointer;
-    top: 6px;
-    right: 6px;
-    width: 19px;
-    height: 19px;
-    mask-image: url($copy-button-url);
-    background-color: $message-action-bar-fg-color;
-}
-
 .mx_EventTile_body .mx_EventTile_pre_container:focus-within .mx_EventTile_copyButton,
 .mx_EventTile_body .mx_EventTile_pre_container:hover .mx_EventTile_copyButton {
     visibility: visible;
diff --git a/src/components/views/messages/TextualBody.js b/src/components/views/messages/TextualBody.js
index 8d341e4a63..84a21c0da3 100644
--- a/src/components/views/messages/TextualBody.js
+++ b/src/components/views/messages/TextualBody.js
@@ -139,8 +139,9 @@ export default class TextualBody extends React.Component {
     }
 
     _handleCodeBlockExpansion(codeBlock) {
-        const expandCodeBlock = SettingsStore.getValue("expandCodeByDefault");
-        codeBlock.className = expandCodeBlock ? "mx_EventTile_expandedCodeBlock" : "mx_EventTile_collapsedCodeBlock";
+        if (!SettingsStore.getValue("expandCodeByDefault")) {
+            codeBlock.className = "mx_EventTile_collapsedCodeBlock";
+        }
     }
 
     _highlightCode(codeBlock) {