From 0218f2b19013dd1843b4716b35c01b33a7f9e022 Mon Sep 17 00:00:00 2001 From: martwypoeta Date: Fri, 20 Mar 2026 16:50:53 +0100 Subject: [PATCH] CopyFileContents: fix icon being in wrong place (#4064) --- src/plugins/copyFileContents/index.tsx | 25 +++++++++++++++++++------ src/plugins/copyFileContents/style.css | 9 +++------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/plugins/copyFileContents/index.tsx b/src/plugins/copyFileContents/index.tsx index 5305c0389..be7ec07a2 100644 --- a/src/plugins/copyFileContents/index.tsx +++ b/src/plugins/copyFileContents/index.tsx @@ -14,7 +14,7 @@ import definePlugin from "@utils/types"; import { Tooltip, useState } from "@webpack/common"; const CheckMarkIcon = () => { - return + return ; }; @@ -26,10 +26,18 @@ export default definePlugin({ patches: [ { find: "#{intl::PREVIEW_BYTES_LEFT}", - replacement: { - match: /fileName:\i,fileSize:\i}\),(?=.{0,75}?setLanguage:)(?<=fileContents:(\i),bytesLeft:(\i).+?)/g, - replace: "$&$self.addCopyButton({fileContents:$1,bytesLeft:$2})," - } + replacement: [ + // Inline preview + { + match: /fileContents:(\i),bytesLeft:(\i)\}\):null,/, + replace: "$&$self.addCopyButton({fileContents:$1,bytesLeft:$2})," + }, + // Modal + { + match: /align:"\i"\}\),(?=\(0,\i\.jsx\)\(\i,\{wordWrap:\i,setWordWrap:\i)/, + replace: "$&$self.addCopyButton(arguments[0])," + } + ] } ], @@ -51,7 +59,12 @@ export default definePlugin({ } }} > - {recentlyCopied ? : bytesLeft > 0 ? : } + {recentlyCopied + ? + : bytesLeft > 0 + ? + : + } )} diff --git a/src/plugins/copyFileContents/style.css b/src/plugins/copyFileContents/style.css index 818652539..df6855b3a 100644 --- a/src/plugins/copyFileContents/style.css +++ b/src/plugins/copyFileContents/style.css @@ -1,9 +1,6 @@ .vc-cfc-button { - color: var(--interactive-icon-default); + display: flex; + align-items: center; + margin-left: 16px; cursor: pointer; - padding-left: 4px; -} - -.vc-cfc-button:hover { - color: var(--interactive-icon-hover); } \ No newline at end of file