fix: prevent image context menu and drag

This commit is contained in:
codytseng 2025-10-24 22:59:53 +08:00
parent 1274942f64
commit 402bc91566
2 changed files with 4 additions and 2 deletions

View file

@ -33,7 +33,8 @@ export default function Emoji({
<img <img
src={emoji.url} src={emoji.url}
alt={emoji.shortcode} alt={emoji.shortcode}
className={cn('inline-block size-5 rounded-sm', classNames?.img)} draggable={false}
className={cn('inline-block size-5 rounded-sm pointer-events-none', classNames?.img)}
onLoad={() => { onLoad={() => {
setHasError(false) setHasError(false)
}} }}

View file

@ -90,11 +90,12 @@ export default function Image({
alt={alt} alt={alt}
decoding="async" decoding="async"
loading="lazy" loading="lazy"
draggable={false}
{...props} {...props}
onLoad={handleLoad} onLoad={handleLoad}
onError={handleError} onError={handleError}
className={cn( className={cn(
'object-cover rounded-lg w-full h-full transition-opacity', 'object-cover rounded-lg w-full h-full transition-opacity pointer-events-none',
isLoading ? 'opacity-0' : 'opacity-100', isLoading ? 'opacity-0' : 'opacity-100',
className className
)} )}