From 90255be4992d27f2070a0b19c32b2ac6a003fa34 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 7 Apr 2020 11:17:19 +0100 Subject: [PATCH] Fix copy button on code blocks when there is no code just pre Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/messages/TextualBody.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/messages/TextualBody.js b/src/components/views/messages/TextualBody.js index c1de376385..27514d0e23 100644 --- a/src/components/views/messages/TextualBody.js +++ b/src/components/views/messages/TextualBody.js @@ -278,7 +278,7 @@ export default createReactClass({ const button = document.createElement("span"); button.className = "mx_EventTile_copyButton"; button.onclick = (e) => { - const copyCode = button.parentNode.getElementsByTagName("code")[0]; + const copyCode = button.parentNode.getElementsByTagName("pre")[0]; const successful = this.copyToClipboard(copyCode.textContent); const buttonRect = e.target.getBoundingClientRect();