From cbc23b1bddf87e469bd6a585dd4a4e72a86ad0b1 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Wed, 25 Oct 2023 19:41:18 +0200 Subject: [PATCH] Fix BetterGifAltText --- src/plugins/betterGifAltText/index.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/plugins/betterGifAltText/index.ts b/src/plugins/betterGifAltText/index.ts index 4dd30f2d..f0729570 100644 --- a/src/plugins/betterGifAltText/index.ts +++ b/src/plugins/betterGifAltText/index.ts @@ -34,17 +34,18 @@ export default definePlugin({ }, }, { - find: ".embedGallerySide", + find: ".Messages.GIF,", replacement: { - match: /(?<==(.{1,3})\.alt.{0,20})\?.{0,5}\.Messages\.GIF/, + match: /alt:(\i)=(\i\.default\.Messages\.GIF)(?=,[^}]*\}=(\i))/, replace: - "?($1.alt='GIF',$self.altify($1))", + // rename prop so we can always use default value + "alt_$$:$1=$self.altify($3)||$2", }, }, ], altify(props: any) { - if (props.alt !== "GIF") return props.alt; + if (props.alt && props.alt !== "GIF") return props.alt; let url: string = props.original || props.src; try {