Skip to content

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

fix: deselect file by click on empty space, select all now selects also the folders, partial fix for #1571

Ilian Sapundshiev48cd1c9958a2
diff --git a/app/perspectives/grid-perspective/components/CellContent.tsx b/app/perspectives/grid-perspective/components/CellContent.tsx
index a30ccfe0e..8235d2fa9 100644
--- a/app/perspectives/grid-perspective/components/CellContent.tsx
+++ b/app/perspectives/grid-perspective/components/CellContent.tsx
@@ -143,7 +143,13 @@ const CellContent = (props: Props) => {
tagTitles = tagTitles.substring(0, tagTitles.length - 2);
const tagPlaceholder =
tagTitles.length > 0 ? (
- <IconButton title={tagTitles} onClick={() => openFsEntry(fsEntry)}>
+ <IconButton
+ title={tagTitles}
+ onClick={e => {
+ e.stopPropagation();
+ openFsEntry(fsEntry);
+ }}
+ >
<TagIcon />
</IconButton>
) : null;
@@ -436,11 +442,12 @@ const CellContent = (props: Props) => {
}}
onContextMenu={event => handleGridContextMenu(event, fsEntry)}
onDoubleClick={event => handleGridCellDblClick(event, fsEntry)}
- onClick={event =>
+ onClick={event => {
+ event.stopPropagation();
AppConfig.isCordovaiOS // TODO DoubleClick not fired in Cordova IOS
? handleGridCellDblClick(event, fsEntry)
- : handleGridCellClick(event, fsEntry)
- }
+ : handleGridCellClick(event, fsEntry);
+ }}
>
{gridCell}
</Paper>
diff --git a/app/perspectives/grid-perspective/components/GridPagination.tsx b/app/perspectives/grid-perspective/components/GridPagination.tsx
index 5a65f7dc3..cb8c8fad0 100644
--- a/app/perspectives/grid-perspective/components/GridPagination.tsx
+++ b/app/perspectives/grid-perspective/components/GridPagination.tsx
@@ -45,7 +45,8 @@ interface Props {
currentLocationPath: string;
currentDirectoryPath: string;
searchResultCount: number;
- onContextMenu: (e: React.MouseEvent<HTMLDivElement>) => void;
+ onContextMenu: (event: React.MouseEvent<HTMLDivElement>) => void;
+ onClick: (event: React.MouseEvent<HTMLDivElement>) => void;
}
const GridPagination = (props: Props) => {
@@ -98,8 +99,11 @@ const GridPagination = (props: Props) => {
return (
<div
ref={containerEl}
- onContextMenu={(e: React.MouseEvent<HTMLDivElement>) =>
- props.onContextMenu(e)
+ onContextMenu={(event: React.MouseEvent<HTMLDivElement>) =>
+ props.onContextMenu(event)
+ }
+ onClick={(event: React.MouseEvent<HTMLDivElement>) =>
+ props.onClick(event)
}
style={{
height: '100%',
diff --git a/app/perspectives/grid-perspective/components/MainContainer.tsx b/app/perspectives/grid-perspective/components/MainContainer.tsx
index a6404c777..8086df2d1 100644
--- a/app/perspectives/grid-perspective/components/MainContainer.tsx
+++ b/app/perspectives/grid-perspective/components/MainContainer.tsx
@@ -361,9 +361,9 @@ const GridPerspective = (props: Props) => {
} else {
const selectedEntries = [];
props.directoryContent.map(entry => {
- if (entry.isFile) {
- selectedEntries.push(entry);
- }
+ // if (entry.isFile) {
+ selectedEntries.push(entry);
+ // }
return true;
});
props.setSelectedEntries(selectedEntries);
@@ -668,6 +668,13 @@ const GridPerspective = (props: Props) => {
setDirContextMenuAnchorEl(event.currentTarget);
};
+ const onClick = (event: React.MouseEvent<HTMLDivElement>) => {
+ event.preventDefault();
+ if (props.selectedEntries.length > 0) {
+ props.setSelectedEntries([]);
+ }
+ };
+
const getSelEntryPath = () => {
if (props.lastSelectedEntry) {
return props.lastSelectedEntry.path;
@@ -775,6 +782,7 @@ const GridPerspective = (props: Props) => {
currentPage={1}
currentLocationPath={locationPath}
currentDirectoryPath={props.currentDirectoryPath}
+ onClick={onClick}
onContextMenu={onContextMenu}
/>
</GlobalHotKeys>