Fix BetterGifAltText
This commit is contained in:
parent
aa2a57b733
commit
cbc23b1bdd
1 changed files with 5 additions and 4 deletions
|
@ -34,17 +34,18 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: ".embedGallerySide",
|
find: ".Messages.GIF,",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<==(.{1,3})\.alt.{0,20})\?.{0,5}\.Messages\.GIF/,
|
match: /alt:(\i)=(\i\.default\.Messages\.GIF)(?=,[^}]*\}=(\i))/,
|
||||||
replace:
|
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) {
|
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;
|
let url: string = props.original || props.src;
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue