Skip to content

Commit

Permalink
ensure meta click works on desktop safari to select objects in explore
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkeye217 committed Jan 26, 2025
1 parent 6d8234f commit f90a334
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
13 changes: 12 additions & 1 deletion web/src/components/card/SearchThumbnail.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useMemo } from "react";
import { useCallback, useMemo } from "react";
import { useApiHost } from "@/api";
import { getIconForLabel } from "@/utils/iconUtil";
import useSWR from "swr";
Expand Down Expand Up @@ -33,6 +33,16 @@ export default function SearchThumbnail({
onClick(searchResult, true, false);
});

const handleOnClick = useCallback(
(e: React.MouseEvent<HTMLDivElement>) => {
if (e.metaKey) {
e.stopPropagation();
onClick(searchResult, true, false);
}
},
[searchResult, onClick],
);

const objectLabel = useMemo(() => {
if (
!config ||
Expand All @@ -57,6 +67,7 @@ export default function SearchThumbnail({
<div className={`size-full ${imgLoaded ? "visible" : "invisible"}`}>
<img
ref={imgRef}
onClick={handleOnClick}
className={cn(
"size-full select-none object-cover object-center opacity-100 transition-opacity",
)}
Expand Down
7 changes: 2 additions & 5 deletions web/src/views/search/SearchView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -554,13 +554,10 @@ export default function SearchView({
ctrl: boolean,
detail: boolean,
) => {
if (detail && selectedObjects.length == 0) {
if (detail) {
setSearchDetail(value);
} else {
onSelectSearch(
value,
ctrl || selectedObjects.length > 0,
);
onSelectSearch(value, ctrl);
}
}}
/>
Expand Down

0 comments on commit f90a334

Please sign in to comment.