From ecbd6ceb1def6e18645ed906c109ee7cceb554bf Mon Sep 17 00:00:00 2001 From: TheGreenPig <67547385+TheGreenPig@users.noreply.github.com> Date: Sun, 15 Sep 2024 00:25:48 +0200 Subject: [PATCH] Improve patch regex --- src/plugins/fileViewer/index.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/fileViewer/index.tsx b/src/plugins/fileViewer/index.tsx index b30208a5f..4ed68f25d 100644 --- a/src/plugins/fileViewer/index.tsx +++ b/src/plugins/fileViewer/index.tsx @@ -66,7 +66,7 @@ function FilePreview({ attachment }: { attachment: Attachment; }) { if (!previewBlobUrl) return null; - return previewBlobUrl &&
; + return
; } async function buildCss() { @@ -151,8 +151,8 @@ export default definePlugin({ { find: "Messages.IMG_ALT_ATTACHMENT_FILE_TYPE.format", replacement: { - match: /function\((.+?)\)(.+Fragment.{0,500}newMosaicStyle.{0,500}?children:\[)(.+?\])/, - replace: "function($1)$2$self.renderPreviewButton($1),$3" + match: /newMosaicStyle,\i\),children:\[(?<=}=(\i);.+?)/, + replace: "$&$self.renderPreviewButton($1)," } } ],