Skip to content

Commit 1c76620

Browse files
committed
feat: cleanup
1 parent 6767b26 commit 1c76620

2 files changed

Lines changed: 7 additions & 25 deletions

File tree

src/web/usePressInteractions.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,16 @@ export function usePressInteractions(
2222
const handleInteraction = (e: MouseEvent) => {
2323
const target = e.target as HTMLElement;
2424

25-
const image = target.closest('img');
25+
const anchor = target.closest('a');
26+
if (anchor && container.contains(anchor)) {
27+
e.preventDefault();
28+
}
2629

30+
const image = target.closest('img');
2731
if (image && container.contains(image)) {
2832
e.preventDefault();
2933

30-
const imageAttributes = parseImageAttributs(image);
34+
const imageAttributes = parseImageAttributes(image);
3135

3236
if (imageAttributes) {
3337
onImagePressRef.current?.({
@@ -42,7 +46,7 @@ export function usePressInteractions(
4246
}, [containerRef, onImagePressRef]);
4347
}
4448

45-
function parseImageAttributs(image: HTMLElement): ImageAttributes | undefined {
49+
function parseImageAttributes(image: HTMLElement): ImageAttributes | undefined {
4650
const uri = image.getAttribute('src');
4751
const rawWidth = image.getAttribute('width');
4852
const rawHeight = image.getAttribute('height');

src/web/usePressInteractions.tsx

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)