From 4052b681dd3b4fb804b10a31850f9d499fc4bed5 Mon Sep 17 00:00:00 2001 From: James Fenn Date: Sat, 23 Aug 2025 15:43:30 -0400 Subject: [PATCH] add crossorigin=anonymous attributes to most image elements --- src/components/iframe-placeholder/iframe-placeholder.tsx | 1 + src/components/image/picture.tsx | 7 ++++++- .../markdown/components/link-preview/link-preview.astro | 6 +++++- src/utils/markdown/picture/picture.tsx | 1 + 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/components/iframe-placeholder/iframe-placeholder.tsx b/src/components/iframe-placeholder/iframe-placeholder.tsx index 2fd4448602..72067857bd 100644 --- a/src/components/iframe-placeholder/iframe-placeholder.tsx +++ b/src/components/iframe-placeholder/iframe-placeholder.tsx @@ -37,6 +37,7 @@ export function IFramePlaceholder({ alt="" loading="lazy" decoding="async" + crossorigin="anonymous" data-nozoom="true" data-dont-round="true" onError={() => setPageIconError(true)} diff --git a/src/components/image/picture.tsx b/src/components/image/picture.tsx index 0cb3f31979..7cf1018345 100644 --- a/src/components/image/picture.tsx +++ b/src/components/image/picture.tsx @@ -30,7 +30,12 @@ export const Picture = ({ {pictureResult.sources.map((attrs) => ( ))} - {alt} + {alt} ); }; diff --git a/src/utils/markdown/components/link-preview/link-preview.astro b/src/utils/markdown/components/link-preview/link-preview.astro index b5b907841d..a4136ceb93 100644 --- a/src/utils/markdown/components/link-preview/link-preview.astro +++ b/src/utils/markdown/components/link-preview/link-preview.astro @@ -21,6 +21,10 @@ const props = Astro.props; href={props.href} alt={props.alt} > - {props.picture && } + { + props.picture && ( + + ) + } {props.children && } diff --git a/src/utils/markdown/picture/picture.tsx b/src/utils/markdown/picture/picture.tsx index 1642deb97d..6e8def25f1 100644 --- a/src/utils/markdown/picture/picture.tsx +++ b/src/utils/markdown/picture/picture.tsx @@ -22,6 +22,7 @@ export function Picture(props: PictureProps): Element { alt={props.alt} loading="lazy" decoding="async" + crossorigin="anonymous" data-zoom-src={props.zoomSrc} data-nozoom={props.noZoom} {...props.imgAttrs}