ImageZoom: Fix when multiple images with carrousel (#2966)

Co-authored-by: Nuckyz <61953774+Nuckyz@users.noreply.github.com>
This commit is contained in:
sadan4 2024-10-24 07:08:02 -04:00 committed by GitHub
parent e620431210
commit a6ea03bacc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -179,6 +179,11 @@ export default definePlugin({
{ {
match: /componentWillUnmount\(\){/, match: /componentWillUnmount\(\){/,
replace: "$&$self.unMountMagnifier();" replace: "$&$self.unMountMagnifier();"
},
{
match: /componentDidUpdate\(\i\){/,
replace: "$&$self.updateMagnifier(this);"
} }
] ]
} }
@ -215,6 +220,11 @@ export default definePlugin({
} }
}, },
updateMagnifier(instance) {
this.unMountMagnifier();
this.renderMagnifier(instance);
},
unMountMagnifier() { unMountMagnifier() {
this.root?.unmount(); this.root?.unmount();
this.currentMagnifierElement = null; this.currentMagnifierElement = null;