Skip to content

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

fix: opening directories in the desktop app

Ilian Sapundshievc789be655673
diff --git a/app/components/EntryContainer.tsx b/app/components/EntryContainer.tsx
index eab999613..d3f5d8a38 100644
--- a/app/components/EntryContainer.tsx
+++ b/app/components/EntryContainer.tsx
@@ -189,6 +189,7 @@ interface Props {
openNextFile: (path: string) => void;
openFileNatively: (path: string) => void;
openLink: (url: string) => void;
+ openDirectory: (path: string) => void;
showNotification: (
text: string,
notificationType?: string, // NotificationTypes
@@ -614,7 +615,11 @@ const EntryContainer = (props: Props) => {
const openNatively = () => {
if (openedFile.path) {
- props.openFileNatively(openedFile.path);
+ if (openedFile.isFile) {
+ props.openFileNatively(openedFile.path);
+ } else {
+ props.openDirectory(openedFile.path);
+ }
}
};
@@ -656,7 +661,6 @@ const EntryContainer = (props: Props) => {
<div className={classes.flexLeft}>
<Tooltip title={i18n.t('core:toggleProperties')}>
<IconButton
- // title={i18n.t('core:toggleProperties')}
aria-label={i18n.t('core:toggleProperties')}
onClick={togglePanel}
data-tid="fileContainerToggleProperties"
@@ -666,7 +670,6 @@ const EntryContainer = (props: Props) => {
</Tooltip>
<Tooltip title={i18n.t('core:switchToFullscreen')}>
<IconButton
- // title={i18n.t('core:switchToFullscreen')}
aria-label={i18n.t('core:switchToFullscreen')}
data-tid="fileContainerSwitchToFullScreen"
onClick={toggleFullScreen}
@@ -677,7 +680,6 @@ const EntryContainer = (props: Props) => {
{AppConfig.isCordova && (
<Tooltip title={i18n.t('core:shareFile')}>
<IconButton
- // title={i18n.t('core:shareFile')}
aria-label={i18n.t('core:shareFile')}
data-tid="shareFile"
onClick={() => shareFile(`file:///${openedFile.path}`)}
@@ -689,7 +691,6 @@ const EntryContainer = (props: Props) => {
{!(PlatformIO.haveObjectStoreSupport() || AppConfig.isWeb) && (
<Tooltip title={i18n.t('core:openFileExternally')}>
<IconButton
- // title={i18n.t('core:openFileExternally')}
aria-label={i18n.t('core:openFileExternally')}
onClick={openNatively}
>
@@ -699,7 +700,6 @@ const EntryContainer = (props: Props) => {
)}
<Tooltip title={i18n.t('core:downloadFile')}>
<IconButton
- // title={i18n.t('core:downloadFile')}
aria-label={i18n.t('core:downloadFile')}
onClick={() => {
const entryName = `${baseName(
@@ -761,7 +761,6 @@ const EntryContainer = (props: Props) => {
<Tooltip title={i18n.t('core:deleteEntry')}>
<IconButton
data-tid="deleteEntryTID"
- // title={i18n.t('core:deleteEntry')}
aria-label={i18n.t('core:deleteEntry')}
onClick={() => setDeleteEntryModalOpened(true)}
>
@@ -772,7 +771,6 @@ const EntryContainer = (props: Props) => {
<Tooltip title={i18n.t('core:reloadFile')}>
<IconButton
data-tid="reloadFileTID"
- // title={i18n.t('core:reloadFile')}
aria-label={i18n.t('core:reloadFile')}
onClick={reloadDocument}
>
@@ -783,7 +781,6 @@ const EntryContainer = (props: Props) => {
<Tooltip title={i18n.t('core:openInFullWidth')}>
<IconButton
data-tid="openInFullWidthTID"
- // title={i18n.t('core:openInFullWidth')}
aria-label={i18n.t('core:openInFullWidth')}
onClick={props.toggleEntryFullWidth}
>
@@ -795,7 +792,6 @@ const EntryContainer = (props: Props) => {
<div className={classes.entryNavigationSection}>
<Tooltip title={i18n.t('core:openPrevFileTooltip')}>
<IconButton
- // title={i18n.t('core:openPrevFileTooltip')}
aria-label={i18n.t('core:openPrevFileTooltip')}
data-tid="fileContainerPrevFile"
onClick={openPrevFile}
@@ -805,7 +801,6 @@ const EntryContainer = (props: Props) => {
</Tooltip>
<Tooltip title={i18n.t('core:openNextFileTooltip')}>
<IconButton
- // title={i18n.t('core:openNextFileTooltip')}
aria-label={i18n.t('core:openNextFileTooltip')}
data-tid="fileContainerNextFile"
onClick={openNextFile}
@@ -823,7 +818,6 @@ const EntryContainer = (props: Props) => {
{!(PlatformIO.haveObjectStoreSupport() || AppConfig.isWeb) && (
<Tooltip title={i18n.t('core:openDirectoryExternally')}>
<IconButton
- // title={i18n.t('core:openDirectoryExternally')}
aria-label={i18n.t('core:openDirectoryExternally')}
onClick={openNatively}
>
@@ -833,7 +827,6 @@ const EntryContainer = (props: Props) => {
)}
<Tooltip title={i18n.t('core:reloadDirectory')}>
<IconButton
- // title={i18n.t('core:reloadDirectory')}
aria-label={i18n.t('core:reloadDirectory')}
onClick={reloadDocument}
>
@@ -843,7 +836,6 @@ const EntryContainer = (props: Props) => {
{!props.isReadOnlyMode && (
<Tooltip title={i18n.t('core:deleteDirectory')}>
<IconButton
- // title={i18n.t('core:deleteDirectory')}
aria-label={i18n.t('core:deleteDirectory')}
onClick={() => setDeleteEntryModalOpened(true)}
>
@@ -856,20 +848,6 @@ const EntryContainer = (props: Props) => {
);
const renderFileView = fileOpenerURL => (
- // if (AppConfig.isElectron) {
- // return (
- // <webview
- // id="webViewer"
- // ref={fileViewer => {
- // this.fileViewer = fileViewer;
- // }}
- // className={this.props.classes.fileOpener}
- // src={fileOpenerURL}
- // allowFullScreen
- // preload="./node_modules/@tagspaces/legacy-ext/webview-preload.js"
- // />
- // );
- // }
<iframe
ref={fileViewer}
className={props.classes.fileOpener}
@@ -967,7 +945,6 @@ const EntryContainer = (props: Props) => {
editDocument: editFile,
nextDocument: openNextFile,
prevDocument: openPrevFile
- // reloadDocument: this.reloadDocument,
}}
keyMap={{
nextDocument: keyBindings.nextDocument,
@@ -975,7 +952,6 @@ const EntryContainer = (props: Props) => {
closeViewer: keyBindings.closeViewer,
saveDocument: keyBindings.saveDocument,
editDocument: keyBindings.editDocument
- // reloadDocument: settings.keyBindings.reloadDocument,
}}
>
{isSaveBeforeCloseConfirmDialogOpened && (
@@ -1012,8 +988,6 @@ const EntryContainer = (props: Props) => {
setSaveBeforeReloadConfirmDialogOpened(false);
startSavingFile();
} else {
- // isChanged = false;
- // shouldReload = true;
setSaveBeforeReloadConfirmDialogOpened(false);
props.updateOpenedFile(openedFile.path, {
...openedFile,
@@ -1080,10 +1054,6 @@ const EntryContainer = (props: Props) => {
backgroundColor: props.theme.palette.divider
}}
style={{ zIndex: 1300 }}
- // size={this.state.entryPropertiesSplitSize}
- // minSize={defaultSplitSize}
- // maxSize={fullSplitSize}
- // defaultSize={this.state.entryPropertiesSplitSize}
size={getSplitPanelSize()}
minSize={openedFile.isFile ? defaultSplitSize : '100%'}
maxSize={openedFile.isFile ? fullSplitSize : '100%'}
@@ -1302,6 +1272,7 @@ function mapActionCreatorsToProps(dispatch) {
renameDirectory: AppActions.renameDirectory,
openFsEntry: AppActions.openFsEntry,
openFileNatively: AppActions.openFileNatively,
+ openDirectory: AppActions.openDirectory,
openLink: AppActions.openLink,
showNotification: AppActions.showNotification,
openNextFile: AppActions.openNextFile,
@@ -1311,10 +1282,8 @@ function mapActionCreatorsToProps(dispatch) {
addTags: TaggingActions.addTags,
removeTags: TaggingActions.removeTags,
removeAllTags: TaggingActions.removeAllTags,
- // editTagForEntry: TaggingActions.editTagForEntry,
updateOpenedFile: AppActions.updateOpenedFile,
updateThumbnailUrl: AppActions.updateThumbnailUrl,
- // setLastSelectedEntry: AppActions.setLastSelectedEntry,
setSelectedEntries: AppActions.setSelectedEntries
},
dispatch