diff --git a/packages/sanity/src/core/form/studio/assetSource/image/AssetThumb.tsx b/packages/sanity/src/core/form/studio/assetSource/image/AssetThumb.tsx index 5af75b91660..70ddad7e992 100644 --- a/packages/sanity/src/core/form/studio/assetSource/image/AssetThumb.tsx +++ b/packages/sanity/src/core/form/studio/assetSource/image/AssetThumb.tsx @@ -93,6 +93,7 @@ export const AssetThumb = memo(function AssetThumb(props: AssetProps) { const [showUsageDialog, setShowUsageDialog] = useState(false) const [showDeleteDialog, setShowDeleteDialog] = useState(false) const [isDeleting, setIsDeleting] = useState(false) + const [isSelectedTemp, setIsSelectedTemp] = useState(false) const {t} = useTranslation() useEffect(() => { @@ -181,6 +182,16 @@ export const AssetThumb = memo(function AssetThumb(props: AssetProps) { ) }, [asset, handleDialogClose, showUsageDialog]) + const handleImageClick = useCallback( + (event: React.MouseEvent) => { + setIsSelectedTemp(!isSelectedTemp) + if (onClick) { + onClick(event) + } + }, + [onClick, setIsSelectedTemp, isSelectedTemp], + ) + const deleteDialog = useMemo(() => { return ( showDeleteDialog && ( @@ -208,21 +219,21 @@ export const AssetThumb = memo(function AssetThumb(props: AssetProps) { return ( - + {usageDialog || deleteDialog}