ImageZoom: Fix for new media viewer

This commit is contained in:
Nuckyz 2025-02-27 21:05:43 -03:00
parent aab09ac249
commit 8f65d3cae9
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9

View file

@ -165,8 +165,35 @@ export default definePlugin({
{
find: ".contain,SCALE_DOWN:",
replacement: {
match: /\.slide,\i\),/g,
replace: `$&id:"${ELEMENT_ID}",`
match: /imageClassName:/,
replace: `id:"${ELEMENT_ID}",$&`
}
},
{
find: ".dimensionlessImage,",
replacement: [
{
match: /className:\i\.media,/,
replace: `id:"${ELEMENT_ID}",$&`
},
{
// This patch needs to be above the next one as it uses the zoomed class as an anchor
match: /\.zoomed]:.+?,(?=children:)/,
replace: "$&onClick:()=>{},"
},
{
match: /className:\i\(\)\(\i\.wrapper,.+?}\),/,
replace: ""
},
]
},
// Make media viewer options not hide when zoomed in with the default Discord feature
{
find: '="FOCUS_SENSITIVE",',
replacement: {
match: /(?<=\.hidden]:)\i/,
replace: "false"
}
},