TagSpaces is an offline, open source, document manager with tagging support
Open current folder in the central panel, opens the last opened file (#1889)
Stanimir01cb5212d5db
diff --git a/app/components/EntryContainer.tsx b/app/components/EntryContainer.tsxindex 2342f0e2f..88e14c7cf 100644--- a/app/components/EntryContainer.tsx+++ b/app/components/EntryContainer.tsx@@ -70,7 +70,8 @@ import {extractFileName,extractDirectoryName,generateSharingLink,- getBackupFileLocation+ getBackupFileLocation,+ cleanRootPath} from '@tagspaces/tagspaces-common/paths';import { ProTooltip } from '-/components/HelperComponents';import EntryProperties from '-/components/EntryProperties';@@ -98,7 +99,7 @@ import useEventListener from '-/utils/useEventListener';import { TS } from '-/tagspaces.namespace';import FileView from '-/components/FileView';import { Pro } from '-/pro';-import { actions as LocationActions } from '-/reducers/locations';+import { actions as LocationActions, getLocations } from '-/reducers/locations';import Revisions from '-/components/Revisions';import { Switch } from '@mui/material';import useFirstRender from '-/utils/useFirstRender';@@ -191,6 +192,7 @@ interface Props {switchLocationType: (locationId: string) => Promise<string | null>;switchCurrentLocationType: (currentLocationId) => Promise<boolean>;revisionsEnabled: boolean;+ locations: Array<TS.Location>;}const historyKeys = Pro && Pro.history ? Pro.history.historyKeys : {};@@ -406,14 +408,25 @@ function EntryContainer(props: Props) {const params = new URLSearchParams(sharingURL.search);if (params.has('tslid')) {const locationId = params.get('tslid');- if (params.has('tsdpath')) {- const folderPath = params.get('tsdpath');+ //if (params.has('tsdpath')) {+ // const folderPath2 = params.get('tsdpath');+ const folderLocation = props.locations.find(+ location => location.uuid === locationId+ );+ const folderPath = extractContainingDirectoryPath(openedFile.path);+ if (folderPath.indexOf(folderLocation.path) === 0) {sharingParentFolderLink = generateSharingLink(locationId,undefined,- folderPath+ cleanRootPath(+ folderPath,+ folderLocation.path,+ PlatformIO.getDirSeparator()+ ));}++ //}if (params.has('tsepath')) {const entryPath = params.get('tsepath');if (openedFile.isFile) {@@ -1571,7 +1584,8 @@ function mapStateToProps(state) {isDesktopMode: isDesktopMode(state),tileServer: getMapTileServer(state),revisionsEnabled: isRevisionsEnabled(state),- language: getCurrentLanguage(state)+ language: getCurrentLanguage(state),+ locations: getLocations(state)};}diff --git a/app/reducers/app.ts b/app/reducers/app.tsindex f03346e70..8b7322db9 100644--- a/app/reducers/app.ts+++ b/app/reducers/app.ts@@ -2690,6 +2690,10 @@ export const actions = {dispatch(actions.loadDirectoryContent(dirFullPath, false, true));+ } else {+ dispatch(+ actions.loadDirectoryContent(locationPath, false, true)+ );}if (entryPath) {@@ -2733,6 +2737,10 @@ export const actions = {const dirFullPath =locationPath + PlatformIO.getDirSeparator() + directoryPath;dispatch(actions.loadDirectoryContent(dirFullPath, false, true));+ } else {+ dispatch(+ actions.loadDirectoryContent(locationPath, false, true)+ );}if (entryPath && entryPath.length > 0) {diff --git a/app/utils/dom.ts b/app/utils/dom.tsindex f07abc0d0..d64a053a8 100644--- a/app/utils/dom.ts+++ b/app/utils/dom.ts@@ -62,8 +62,8 @@ export function updateHistory(if (newRelDir) {const newEncRelDir = encodeURIComponent(newRelDir);urlParams += '&tsdpath=' + newEncRelDir;- diffFolderPath = newRelDir !== currentFolderPath;}+ diffFolderPath = newRelDir !== currentFolderPath;}if (newEntryPath && newEntryPath.length > 0) {@@ -71,8 +71,8 @@ export function updateHistory(if (entryRelPath) {const newEncEntryPath = encodeURIComponent(entryRelPath);urlParams += '&tsepath=' + newEncEntryPath;- diffEntryPath = entryRelPath !== currentEntryPath;}+ diffEntryPath = entryRelPath !== currentEntryPath;}const localePar = getURLParameter('locale');