mirror of
https://github.com/DustinBrett/daedalOS.git
synced 2026-01-15 12:15:02 +00:00
Focus on right click file
This commit is contained in:
@@ -70,7 +70,14 @@ const FileEntry = ({
|
||||
<Button
|
||||
ref={buttonRef}
|
||||
{...useDoubleClick(() => openFile(pid), singleClick)}
|
||||
{...useFileContextMenu(url, pid, path, setRenaming, fileActions)}
|
||||
{...useFileContextMenu(
|
||||
url,
|
||||
pid,
|
||||
path,
|
||||
setRenaming,
|
||||
fileActions,
|
||||
focusEntry
|
||||
)}
|
||||
>
|
||||
<figure>
|
||||
<Icon src={icon} alt={name} {...FileEntryIconSize[view]} />
|
||||
|
||||
@@ -18,7 +18,8 @@ const useFileContextMenu = (
|
||||
pid: string,
|
||||
path: string,
|
||||
setRenaming: React.Dispatch<React.SetStateAction<string>>,
|
||||
{ deleteFile, downloadFile }: FileActions
|
||||
{ deleteFile, downloadFile }: FileActions,
|
||||
focusEntry: (entry: string) => void
|
||||
): { onContextMenuCapture: React.MouseEventHandler<HTMLElement> } => {
|
||||
const { open } = useProcesses();
|
||||
const { setWallpaper } = useSession();
|
||||
@@ -104,7 +105,10 @@ const useFileContextMenu = (
|
||||
}
|
||||
|
||||
return {
|
||||
onContextMenuCapture: contextMenu?.(menuItems),
|
||||
onContextMenuCapture: (event) => {
|
||||
focusEntry(basename(path));
|
||||
contextMenu?.(menuItems)(event);
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user