Skip to content

Commit

Permalink
Also fix crossOrigin for images when zooming it
Browse files Browse the repository at this point in the history
  • Loading branch information
SamyPesse committed Mar 25, 2024
1 parent ad9e8f2 commit faa2378
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/components/utils/ZoomImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,12 @@ export function ZoomImage(
) : null}

{ReactDOM.createPortal(
<ZoomImageModal src={src} alt={alt ?? ''} onClose={onClose} />,
<ZoomImageModal
src={src}
crossOrigin={props.crossOrigin}
alt={alt ?? ''}
onClose={onClose}
/>,
document.body,
)}
</>
Expand Down Expand Up @@ -166,8 +171,13 @@ export function ZoomImage(
);
}

function ZoomImageModal(props: { src: string; alt: string; onClose: () => void }) {
const { src, alt, onClose } = props;
function ZoomImageModal(props: {
src: string;
alt: string;
crossOrigin: React.ComponentPropsWithoutRef<'img'>['crossOrigin'];
onClose: () => void;
}) {
const { src, alt, crossOrigin, onClose } = props;

const buttonRef = React.useRef<HTMLButtonElement>(null);

Expand Down Expand Up @@ -210,6 +220,7 @@ function ZoomImageModal(props: { src: string; alt: string; onClose: () => void }
<img
src={src}
alt={alt}
crossOrigin={crossOrigin}
className={tcls(
'max-w-full',
'max-h-full',
Expand Down

0 comments on commit faa2378

Please sign in to comment.