fix ImageZoom patch (#2181)

main
Syncx 9 months ago committed by GitHub
parent a501da692f
commit 7b96071643
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -123,14 +123,13 @@ export const Magnifier: React.FC<MagnifierProps> = ({ instance, size: initialSiz
waitFor(() => instance.state.readyState === "READY", () => {
const elem = document.getElementById(ELEMENT_ID) as HTMLDivElement;
element.current = elem;
elem.firstElementChild!.setAttribute("draggable", "false");
elem.querySelector("img,video")?.setAttribute("draggable", "false");
if (instance.props.animated) {
originalVideoElementRef.current = elem!.querySelector("video")!;
originalVideoElementRef.current.addEventListener("timeupdate", syncVideos);
setReady(true);
} else {
setReady(true);
}
setReady(true);
});
document.addEventListener("keydown", onKeyDown);
document.addEventListener("keyup", onKeyUp);
@ -155,7 +154,9 @@ export const Magnifier: React.FC<MagnifierProps> = ({ instance, size: initialSiz
if (!ready) return null;
const box = element.current!.getBoundingClientRect();
const box = element.current?.getBoundingClientRect();
if (!box) return null;
return (
<div

@ -171,7 +171,7 @@ export default definePlugin({
find: "handleImageLoad=",
replacement: [
{
match: /showThumbhashPlaceholder:\i,/,
match: /placeholderVersion:\i,/,
replace: "...$self.makeProps(this),$&"
},

Loading…
Cancel
Save