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({
<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)
}} }}

4
src/components/Image/index.tsx

@ -129,10 +129,12 @@ export default function Image({
alt={finalAlt} alt={finalAlt}
decoding="async" decoding="async"
loading="lazy" loading="lazy"
draggable={false}
onLoad={handleLoad} onLoad={handleLoad}
onError={handleError} onError={handleError}
className={cn( 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 className
)} )}
width={dim?.width} width={dim?.width}

Loading…
Cancel
Save