Skip to content

Commit

Permalink
fix: stop stopPropagation on Media Imag
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Aug 1, 2024
1 parent a931e85 commit a92f96b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/renderer/src/components/ui/media.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ const MediaImpl: FC<MediaProps> = ({
const previewMedia = usePreviewMedia()
const handleClick = useEventCallback((e: React.MouseEvent) => {
if (popper && src) {
e.stopPropagation()
previewMedia(
[
{
Expand Down
10 changes: 8 additions & 2 deletions src/renderer/src/components/ui/media/swipe-media.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ export function SwipeMedia({
height: 600,
}}
disableContextMenu
onClick={() => onPreview?.(uniqMedia, i)}
onClick={(e) => {
e.stopPropagation()
onPreview?.(uniqMedia, i)
}}
/>
</SwiperSlide>
))}
Expand All @@ -105,7 +108,10 @@ export function SwipeMedia({
) : uniqMedia?.length >= 1 ?
(
<Media
onClick={() => onPreview?.(uniqMedia)}
onClick={(e) => {
e.stopPropagation()
onPreview?.(uniqMedia)
}}
className="size-full rounded-none object-cover sm:transition-transform sm:duration-300 sm:ease-in-out sm:group-hover:scale-105"
alt="cover"
src={uniqMedia[0].url}
Expand Down
11 changes: 6 additions & 5 deletions src/renderer/src/modules/entry-column/social-media-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ export const SocialMediaItem: EntryListItemFC = ({
height: 224,
}}
onClick={(e) => {
previewMedia(mediaList, i)
e.stopPropagation()
previewMedia(mediaList, i)
}}
/>
))}
Expand Down Expand Up @@ -119,14 +119,15 @@ const ActionBar = ({ entryId }: { entryId: string }) => {
return (
<div className="flex origin-right scale-90 items-center gap-1">
{items
.filter((item) => !item.disabled && (item.key !== "read" && item.key !== "unread"))
.filter(
(item) =>
!item.disabled && item.key !== "read" && item.key !== "unread",
)
.map((item) => (
<ActionButton
icon={
item.icon ? (
<Slot className="size-4">
{item.icon}
</Slot>
<Slot className="size-4">{item.icon}</Slot>
) : (
<i className={item.className} />
)
Expand Down

0 comments on commit a92f96b

Please sign in to comment.