Browse Source

fix: prevent image context menu and drag

imwald
codytseng 5 months ago committed by Silberengel
parent
commit
1133b63073
  1. 3
      src/components/Emoji/index.tsx
  2. 4
      src/components/Image/index.tsx

3
src/components/Emoji/index.tsx

@ -33,7 +33,8 @@ export default function Emoji({ @@ -33,7 +33,8 @@ export default function Emoji({
<img
src={emoji.url}
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={() => {
setHasError(false)
}}

4
src/components/Image/index.tsx

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

Loading…
Cancel
Save