Skip to content

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

Add button in front of the location name to load subdirs without changing to the location (#1544)

Stanimir931b12870cd4
diff --git a/app/components/DirectoryTreeView.tsx b/app/components/DirectoryTreeView.tsx
index c5662c62d..b36696da2 100644
--- a/app/components/DirectoryTreeView.tsx
+++ b/app/components/DirectoryTreeView.tsx
@@ -64,7 +64,7 @@ const DirectoryTreeView = forwardRef(
PlatformIO.enableObjectStoreSupport(location)
.then(() => {
loadSubDirectories(location, 1);
- props.loadDirectoryContent(getLocationPath(location), true);
+ // props.loadDirectoryContent(getLocationPath(location), true);
})
.catch(error => {
console.log('enableObjectStoreSupport', error);
@@ -72,7 +72,7 @@ const DirectoryTreeView = forwardRef(
} else if (location.type === locationType.TYPE_LOCAL) {
PlatformIO.disableObjectStoreSupport();
loadSubDirectories(location, 1);
- props.loadDirectoryContent(getLocationPath(location), true);
+ // props.loadDirectoryContent(getLocationPath(location), true);
}
}
},
diff --git a/app/components/LocationView.tsx b/app/components/LocationView.tsx
index c2f331c91..1dc860190 100644
--- a/app/components/LocationView.tsx
+++ b/app/components/LocationView.tsx
@@ -94,10 +94,15 @@ const LocationView = (props: Props) => {
const { location } = props;
const isCloudLocation = location.type === locationType.TYPE_CLOUD;
- const handleLocationClick = () => {
+ const handleLocationIconClick = (event) => {
+ event.preventDefault();
+ event.stopPropagation();
if (directoryTreeRef.current) {
directoryTreeRef.current.changeLocation(location);
}
+ };
+
+ const handleLocationClick = () => {
if (location.uuid === props.currentLocationId) {
// the same location click
props.loadDirectoryContent(getLocationPath(location), false);
@@ -230,7 +235,7 @@ const LocationView = (props: Props) => {
}
title={getLocationPath(location)}
button
- onClick={() => handleLocationClick()}
+ onClick={handleLocationClick}
onContextMenu={event => handleLocationContextMenuClick(event)}
>
<ListItemIcon
@@ -241,6 +246,7 @@ const LocationView = (props: Props) => {
style={{
minWidth: 'auto'
}}
+ onClick={handleLocationIconClick}
>
{isCloudLocation ? (
<CloudLocationIcon className={props.classes.icon} />