diff --git a/packages/pl-fe/src/components/still-image.tsx b/packages/pl-fe/src/components/still-image.tsx index 92ab71e67..2ed9d9998 100644 --- a/packages/pl-fe/src/components/still-image.tsx +++ b/packages/pl-fe/src/components/still-image.tsx @@ -12,6 +12,8 @@ interface IStillImage { innerClassName?: string; /** URL to the image */ src: string; + /** URL to the static image */ + staticSrc?: string; /** Extra CSS styles on the outer
element. */ style?: React.CSSProperties; /** Whether to display the image contained vs filled in its container. */ @@ -30,19 +32,17 @@ interface IStillImage { /** Renders images on a canvas, only playing GIFs if autoPlayGif is enabled. */ const StillImage: React.FC = ({ - alt, className, innerClassName, src, style, letterboxed = false, showExt = false, onError, onLoad, isGif, noGroup, + alt, className, innerClassName, src, staticSrc, style, letterboxed = false, showExt = false, onError, onLoad, isGif, noGroup, }) => { const { autoPlayGif } = useSettings(); const canvas = useRef(null); const img = useRef(null); - const hoverToPlay = ( - src && !autoPlayGif && ((isGif) || src.endsWith('.gif') || src.startsWith('blob:')) - ); + const hoverToPlay = src && !autoPlayGif && ((isGif) || src.endsWith('.gif') || src.startsWith('blob:') || (src && staticSrc && src !== staticSrc)); const handleImageLoad: React.ReactEventHandler = (e) => { - if (hoverToPlay && canvas.current && img.current) { + if (hoverToPlay && !staticSrc && canvas.current && img.current) { canvas.current.width = img.current.naturalWidth; canvas.current.height = img.current.naturalHeight; const context = canvas.current.getContext('2d'); @@ -80,14 +80,18 @@ const StillImage: React.FC = ({ })} /> - {hoverToPlay && ( + {hoverToPlay && (staticSrc ? ( + {alt} + ) : ( - )} + ))} {(hoverToPlay && showExt) && (
diff --git a/packages/pl-fe/src/components/ui/emoji.tsx b/packages/pl-fe/src/components/ui/emoji.tsx index 367a3ac71..1a79e2626 100644 --- a/packages/pl-fe/src/components/ui/emoji.tsx +++ b/packages/pl-fe/src/components/ui/emoji.tsx @@ -9,12 +9,13 @@ interface IEmoji extends Pick, 'alt' | /** Unicode emoji character. */ emoji?: string; noGroup?: boolean; + staticSrc?: string; } /** A single emoji image. */ const Emoji: React.FC = (props): JSX.Element | null => { const { disableUserProvidedMedia, systemEmojiFont } = useSettings(); - const { emoji, alt, src, noGroup, ...rest } = props; + const { emoji, alt, src, staticSrc, noGroup, ...rest } = props; let filename; @@ -35,6 +36,7 @@ const Emoji: React.FC = (props): JSX.Element | null => {