Skip to content

TagSpaces is an offline, open source, document manager with tagging support

Fix position of the directory context menu according to the mouse click

sytolk0a0fdbdfbd57
diff --git a/app/perspectives/common/main-container.tsx b/app/perspectives/common/main-container.tsx
index e26bef957..955e345ea 100644
--- a/app/perspectives/common/main-container.tsx
+++ b/app/perspectives/common/main-container.tsx
@@ -36,7 +36,7 @@ export const renderCell = (
fsEntry: TS.FileSystemEntry,
selectedEntries: Array<TS.FileSystemEntry>,
index: number,
- handleGridContextMenu,
+ handleGridContextMenu: (event: React.MouseEvent<HTMLDivElement>, fsEntry: TS.FileSystemEntry) => void,
handleGridCellClick,
handleGridCellDblClick,
isLast?: boolean
diff --git a/app/perspectives/grid-perspective/components/MainContainer.tsx b/app/perspectives/grid-perspective/components/MainContainer.tsx
index 30328692a..6ed82afe6 100644
--- a/app/perspectives/grid-perspective/components/MainContainer.tsx
+++ b/app/perspectives/grid-perspective/components/MainContainer.tsx
@@ -568,7 +568,10 @@ function GridPerspective(props: Props) {
fsEntry: TS.FileSystemEntry,
selectedEntries: Array<TS.FileSystemEntry>,
index: number,
- handleGridContextMenu,
+ handleGridContextMenu: (
+ event: React.MouseEvent<HTMLDivElement>,
+ fsEntry: TS.FileSystemEntry
+ ) => void,
handleGridCellClick,
handleGridCellDblClick,
isLast?: boolean
@@ -616,7 +619,14 @@ function GridPerspective(props: Props) {
layoutType={layoutType.current}
showTags={showTags.current}
openFsEntry={props.openFsEntry}
- handleGridContextMenu={handleGridContextMenu}
+ handleGridContextMenu={(
+ event: React.MouseEvent<HTMLDivElement>,
+ fsEntry: TS.FileSystemEntry
+ ) => {
+ setMouseX(event.clientX);
+ setMouseY(event.clientY);
+ handleGridContextMenu(event, fsEntry);
+ }}
handleGridCellDblClick={handleGridCellDblClick}
handleGridCellClick={handleGridCellClick}
/>