From 1a2476609c0bea8505063eae00a08b5c37930c68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Sat, 25 Sep 2021 07:55:40 +0200 Subject: [PATCH] Fix code to be equivalent to the previous one MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/usercontent/index.ts | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/usercontent/index.ts b/src/usercontent/index.ts index 82e8ee0d81..eaa8c86ec6 100644 --- a/src/usercontent/index.ts +++ b/src/usercontent/index.ts @@ -24,16 +24,19 @@ function remoteRender(event: MessageEvent): void { // Apply image style after so we can steal the anchor's colour. // Style copied from a rendered version of mx_MFileBody_download_icon - // @ts-ignore - img.style = data.imgStyle ?? ""; - img.style.width = "12px"; - img.style.height = "12px"; - img.style.webkitMaskSize = "12px"; - img.style.webkitMaskPosition = "center"; - img.style.webkitMaskRepeat = "no-repeat"; - img.style.display = "inline-block"; - img.style.webkitMaskImage = `url('${data.imgSrc}')`; - img.style.backgroundColor = `${a.style.color}`; + if (data.imgStyle) { + // @ts-ignore + img.style = data.imgStyle; + } else { + img.style.width = "12px"; + img.style.height = "12px"; + img.style.webkitMaskSize = "12px"; + img.style.webkitMaskPosition = "center"; + img.style.webkitMaskRepeat = "no-repeat"; + img.style.display = "inline-block"; + img.style.webkitMaskImage = `url('${data.imgSrc}')`; + img.style.backgroundColor = `${a.style.color}`; + } const body = document.body; // Don't display scrollbars if the link takes more than one line to display.