Skip to content

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

making single file click configurable

Ilian Sapundshieve33ecc1ac7e0
diff --git a/app/locales/en/core.json b/app/locales/en/core.json
index 5643d6f0a..9a0c40dd8 100644
--- a/app/locales/en/core.json
+++ b/app/locales/en/core.json
@@ -385,5 +385,7 @@
"entrySizeSmall": "Compact mode",
"entrySizeNormal": "Default mode",
"entrySizeBig": "Large mode",
+ "singleClickOpenInternally": "Single click opens file internally",
+ "singleClickOpenExternally": "Single click opens file externally",
"-": "-"
}
diff --git a/app/perspectives/grid-perspective/src/index.js b/app/perspectives/grid-perspective/src/index.js
index 68529b66c..c494beed2 100644
--- a/app/perspectives/grid-perspective/src/index.js
+++ b/app/perspectives/grid-perspective/src/index.js
@@ -347,7 +347,13 @@ class GridPerspective extends React.Component<Props, State> {
);
this.props.setLastSelectedEntry(fsEntry.path);
if (fsEntry.isFile) {
- this.props.openFile(fsEntry.path, fsEntry.isFile);
+ if (this.state.singleClickAction === 'openInternal') {
+ this.props.openFile(fsEntry.path, fsEntry.isFile);
+ } else if (this.state.singleClickAction === 'openExternal') {
+ this.props.openFileNatively(fsEntry.path);
+ } else {
+ this.props.openFile(fsEntry.path, fsEntry.isFile);
+ }
}
}
};
@@ -414,6 +420,13 @@ class GridPerspective extends React.Component<Props, State> {
);
};
+ changeSingleClickAction = (singleClickAction) => {
+ this.closeOptionsMenu();
+ this.setState({ singleClickAction },
+ this.saveSettings
+ );
+ };
+
handleGridCellDblClick = (event, fsEntry: FileSystemEntry) => {
this.setState(
{
@@ -1118,6 +1131,29 @@ class GridPerspective extends React.Component<Props, State> {
</ListItemIcon>
<ListItemText inset primary={i18n.t('core:entrySizeBig')} />
</MenuItem>
+ <Divider />
+ <MenuItem
+ data-tid="gridPerspectiveSingleClickOpenInternally"
+ title={i18n.t('core:singleClickOpenInternally')}
+ aria-label={i18n.t('core:singleClickOpenInternally')}
+ onClick={() => this.changeSingleClickAction('openInternal')}
+ >
+ <ListItemIcon>
+ {this.state.singleClickAction === 'openInternal' ? <RadioCheckedIcon /> : <RadioUncheckedIcon />}
+ </ListItemIcon>
+ <ListItemText inset primary={i18n.t('core:singleClickOpenInternally')} />
+ </MenuItem>
+ <MenuItem
+ data-tid="gridPerspectiveSingleClickOpenExternally"
+ title={i18n.t('core:singleClickOpenExternally')}
+ aria-label={i18n.t('core:singleClickOpenExternally')}
+ onClick={() => this.changeSingleClickAction('openExternal')}
+ >
+ <ListItemIcon>
+ {this.state.singleClickAction === 'openExternal' ? <RadioCheckedIcon /> : <RadioUncheckedIcon />}
+ </ListItemIcon>
+ <ListItemText inset primary={i18n.t('core:singleClickOpenExternally')} />
+ </MenuItem>
</Menu>
</div>
);