Skip to content

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

Redesign entry container be adding tabs and other ui changes (#1974)

Stanimir4357ac7686d3
diff --git a/app/components/EditDescription.tsx b/app/components/EditDescription.tsx
index bc5829b2f..1d19b571a 100644
--- a/app/components/EditDescription.tsx
+++ b/app/components/EditDescription.tsx
@@ -1,22 +1,48 @@
import React, { useRef, useState, useEffect } from 'react';
-import { useTheme } from '@mui/material/styles';
+import { styled, useTheme } from '@mui/material/styles';
import Button from '@mui/material/Button';
import Typography from '@mui/material/Typography';
import { MilkdownEditor, MilkdownRef } from '@tagspaces/tagspaces-md';
import i18n from '-/services/i18n';
import { ProTooltip } from '-/components/HelperComponents';
import { Pro } from '-/pro';
+import { convertMarkDown } from '-/services/utils-io';
interface Props {
- primaryColor: string;
- classes: any;
toggleEditDescriptionField: () => void;
- printHTML: () => void;
// fileDescriptionRef: MutableRefObject<MilkdownRef>;
description: string;
setEditDescription: (md: string) => void;
currentFolder: string;
}
+const PREFIX = 'EditDescription';
+
+const classes = {
+ button: `${PREFIX}-button`,
+ mdHelpers: `${PREFIX}-mdHelpers`,
+ formControl: `${PREFIX}-formControl`
+};
+
+const Root = styled('div')(({ theme }) => ({
+ height: 250,
+ [`& .${classes.button}`]: {
+ position: 'relative',
+ padding: '8px 12px 6px 8px',
+ margin: '0'
+ },
+
+ [`& .${classes.mdHelpers}`]: {
+ borderRadius: '0.25rem',
+ paddingLeft: '0.25rem',
+ paddingRight: '0.25rem',
+ backgroundColor: '#bcc0c561'
+ },
+ [`& .${classes.formControl}`]: {
+ marginLeft: theme.spacing(0),
+ width: '100%'
+ }
+}));
+
function EditDescription(props: Props) {
const theme = useTheme();
const fileDescriptionRef = useRef<MilkdownRef>(null);
@@ -24,10 +50,7 @@ function EditDescription(props: Props) {
currentFolder,
description,
setEditDescription,
- classes,
- printHTML,
- toggleEditDescriptionField,
- primaryColor
+ toggleEditDescriptionField
} = props;
const [editMode, setEditMode] = useState<boolean>(false);
const descriptionFocus = useRef<boolean>(false);
@@ -50,6 +73,25 @@ function EditDescription(props: Props) {
current.update(markdown);*/
}, []);
+ const printHTML = () => {
+ const sanitizedDescription = description
+ ? convertMarkDown(description, currentFolder)
+ : i18n.t('core:addMarkdownDescription');
+
+ const printWin = window.open('', 'PRINT', 'height=400,width=600');
+ printWin.document.write(
+ '<html><head><title>' + currentFolder + ' description</title>'
+ );
+ printWin.document.write('</head><body >');
+ printWin.document.write(sanitizedDescription);
+ printWin.document.write('</body></html>');
+ printWin.document.close(); // necessary for IE >= 10
+ printWin.focus(); // necessary for IE >= 10*/
+ printWin.print();
+ // printWin.close();
+ return true;
+ };
+
const editSaveActions = (
<span style={{ float: 'right' }}>
{editMode && (
@@ -86,11 +128,25 @@ function EditDescription(props: Props) {
const noDescription = !description || description.length < 1;
return (
- <>
+ <Root>
<span style={{ verticalAlign: 'sub', paddingLeft: 5 }}>
- <Typography style={{ color: primaryColor }} variant="caption">
- {i18n.t('core:filePropertiesDescription')}
+ <Typography
+ variant="caption"
+ style={{
+ color: theme.palette.text.primary
+ }}
+ >
+ Markdown help: <i className={classes.mdHelpers}>_italic_</i>{' '}
+ <b className={classes.mdHelpers}>**bold**</b>{' '}
+ <span className={classes.mdHelpers}>* list item</span>{' '}
+ <span className={classes.mdHelpers}>[Link text](http://...)</span>
</Typography>
+ {/*<Typography
+ style={{ color: theme.palette.text.primary }}
+ variant="caption"
+ >
+ {i18n.t('core:filePropertiesDescription')}
+ </Typography>*/}
</span>
{toggleEditDescriptionField && editSaveActions}
<div
@@ -104,8 +160,10 @@ function EditDescription(props: Props) {
style={{
border: '1px solid lightgray',
borderRadius: 5,
- minHeight: 50,
- maxHeight: noDescription && !editMode ? 100 : 250,
+ //minHeight: 150,
+ //maxHeight: 200,
+ // maxHeight: noDescription && !editMode ? 100 : 250,
+ height: '100%',
width: 'calc(100% - 8px)',
overflowY: 'auto'
}}
@@ -114,7 +172,7 @@ function EditDescription(props: Props) {
<Typography
variant="caption"
style={{
- color: primaryColor,
+ color: theme.palette.text.primary,
padding: 10,
lineHeight: 4
}}
@@ -146,18 +204,7 @@ function EditDescription(props: Props) {
</div>
)}
</div>
- <Typography
- variant="caption"
- style={{
- color: primaryColor
- }}
- >
- Markdown help: <i className={classes.mdHelpers}>_italic_</i>{' '}
- <b className={classes.mdHelpers}>**bold**</b>{' '}
- <span className={classes.mdHelpers}>* list item</span>{' '}
- <span className={classes.mdHelpers}>[Link text](http://...)</span>
- </Typography>
- </>
+ </Root>
);
}
diff --git a/app/components/EntryContainer.tsx b/app/components/EntryContainer.tsx
index 43c5bd05b..64a519006 100644
--- a/app/components/EntryContainer.tsx
+++ b/app/components/EntryContainer.tsx
@@ -31,7 +31,7 @@ import fscreen from 'fscreen';
import Button from '@mui/material/Button';
import LoadingButton from '@mui/lab/LoadingButton';
import Tooltip from '-/components/Tooltip';
-import Divider from '@mui/material/Divider';
+import MoreVertIcon from '@mui/icons-material/MoreVert';
import IconButton from '@mui/material/IconButton';
import BookmarkIcon from '@mui/icons-material/BookmarkTwoTone';
import BookmarkAddIcon from '@mui/icons-material/BookmarkAddTwoTone';
@@ -39,9 +39,6 @@ import EditIcon from '@mui/icons-material/Edit';
import SaveIcon from '@mui/icons-material/Save';
import CloseIcon from '@mui/icons-material/Close';
import FullScreenIcon from '@mui/icons-material/ZoomOutMap';
-import OpenNativelyIcon from '@mui/icons-material/Launch';
-import PrevDocumentIcon from '@mui/icons-material/KeyboardArrowUp';
-import NextDocumentIcon from '@mui/icons-material/KeyboardArrowDown';
import FileDownloadIcon from '@mui/icons-material/AssignmentReturned';
import DetailsIcon from '@mui/icons-material/Info';
import ExpandIcon from '@mui/icons-material/SettingsEthernet';
@@ -67,15 +64,11 @@ import {
extractContainingDirectoryPath,
extractTitle,
extractFileExtension,
- baseName,
extractFileName,
extractDirectoryName,
- generateSharingLink,
- getBackupFileLocation,
- cleanRootPath
+ getBackupFileLocation
} from '@tagspaces/tagspaces-common/paths';
import { ProTooltip } from '-/components/HelperComponents';
-import EntryProperties from '-/components/EntryProperties';
import TagsPreview from '-/components/TagsPreview';
import ConfirmDialog from '-/components/dialogs/ConfirmDialog';
import PlatformIO from '-/services/platform-facade';
@@ -85,11 +78,9 @@ import {
actions as SettingsActions,
isDesktopMode,
getKeyBindingObject,
- getMapTileServer,
getCurrentLanguage,
isRevisionsEnabled
} from '-/reducers/settings';
-import TaggingActions from '-/reducers/tagging-actions';
import {
OpenedEntry,
NotificationTypes,
@@ -102,12 +93,15 @@ import FileView from '-/components/FileView';
import { Pro } from '-/pro';
import { actions as LocationActions, getLocations } from '-/reducers/locations';
import Revisions from '-/components/Revisions';
-import { Switch } from '@mui/material';
+import { Grid, Switch } from '@mui/material';
import useFirstRender from '-/utils/useFirstRender';
import ResolveConflictDialog from '-/components/dialogs/ResolveConflictDialog';
import { dataTidFormat } from '-/services/test';
-import { loadJSONFile } from '-/services/utils-io';
+import { getSharingLink, loadJSONFile } from '-/services/utils-io';
import { styled, useTheme } from '@mui/material/styles';
+import EntryContainerTabs from '-/components/EntryContainerTabs';
+import EntryContainerNav from '-/components/EntryContainerNav';
+import EntryContainerMenu from '-/components/EntryContainerMenu';
const defaultSplitSize = '7.86%'; // '7.2%'; // 103;
// const openedSplitSize = AppConfig.isElectron ? 560 : 360;
@@ -132,7 +126,7 @@ const Root = styled(Box)(({ theme }) => ({
flex: '1 1 100%',
display: 'flex',
backgroundColor: theme.palette.background.default,
- height: '100%', // filePropsHeight ||
+ // height: '100%', // filePropsHeight ||
[`& .${classes.toolbar2}`]: {
width: '100%',
paddingLeft: 0,
@@ -169,10 +163,6 @@ interface Props {
settings: any;
keyBindings: any;
closeAllFiles: () => void;
- renameFile: () => void;
- renameDirectory: () => void;
- addTags: () => void;
- removeTags: () => void;
openPrevFile: (path: string) => void;
openNextFile: (path: string) => void;
openFileNatively: (path: string) => void;
@@ -183,7 +173,6 @@ interface Props {
notificationType?: string, // NotificationTypes
autohide?: boolean
) => void;
- removeAllTags: () => void;
deleteFile: (path: string, uuid: string) => void;
toggleEntryFullWidth: () => void;
isReadOnlyMode: boolean;
@@ -193,7 +182,6 @@ interface Props {
fsEntryMeta: any // FileSystemEntryMeta
) => Promise<boolean>;
// reflectUpdateSidecarMeta: (path: string, entryMeta: Object) => void;
- updateThumbnailUrl: (path: string, thumbUrl: string) => void;
// setLastSelectedEntry: (path: string) => void;
loadDirectoryContent: (
path: string,
@@ -201,8 +189,7 @@ interface Props {
loadDirMeta?: boolean
) => void;
currentDirectoryPath: string | null;
- isDesktopMode: boolean;
- tileServer: TS.MapTileServer;
+ desktopMode: boolean;
switchLocationType: (locationId: string) => Promise<string | null>;
switchCurrentLocationType: (currentLocationId) => Promise<boolean>;
revisionsEnabled: boolean;
@@ -217,26 +204,20 @@ function EntryContainer(props: Props) {
settings,
openedFiles,
currentDirectoryPath,
- isDesktopMode,
+ desktopMode,
toggleEntryFullWidth,
isReadOnlyMode,
updateOpenedFile,
- updateThumbnailUrl,
- renameFile,
- renameDirectory,
- addTags,
- removeTags,
- removeAllTags,
deleteFile,
openLink,
closeAllFiles,
openFileNatively,
openDirectory,
setEntryPropertiesSplitSize,
- showNotification,
- tileServer
+ showNotification
} = props;
+ const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
const theme = useTheme();
// const [percent, setPercent] = React.useState<number | undefined>(undefined);
const percent = useRef<number | undefined>(undefined);
@@ -249,6 +230,10 @@ function EntryContainer(props: Props) {
boolean
>(false);
+ const [propertiesStyles, setPropertiesStyles] = useState<React.CSSProperties>(
+ { display: 'flex', flexDirection: 'column' }
+ );
+
const [isRevisionPanelVisible, setRevisionPanelVisible] = useState<boolean>(
false
);
@@ -270,9 +255,6 @@ function EntryContainer(props: Props) {
const [isConflictDialogOpen, setConflictDialogOpen] = useState<boolean>(
false
);
- const [isDeleteEntryModalOpened, setDeleteEntryModalOpened] = useState<
- boolean
- >(false);
const [isSavingInProgress, setSavingInProgress] = useState<boolean>(false);
const fileViewer: MutableRefObject<HTMLIFrameElement> = useRef<
HTMLIFrameElement
@@ -434,44 +416,10 @@ function EntryContainer(props: Props) {
const haveBookmark =
Pro && Pro.bookmarks && Pro.bookmarks.haveBookmark(openedFile.path);
- let sharingLink = '';
- let sharingParentFolderLink = '';
- if (window.location.href.indexOf('?') > 0) {
- const sharingURL = new URL(window.location.href);
- const params = new URLSearchParams(sharingURL.search);
- if (params.has('tslid')) {
- const locationId = params.get('tslid');
- //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,
- cleanRootPath(
- folderPath,
- folderLocation.path,
- PlatformIO.getDirSeparator()
- )
- );
- }
-
- //}
- if (params.has('tsepath')) {
- const entryPath = params.get('tsepath');
- if (openedFile.isFile) {
- sharingLink = generateSharingLink(locationId, entryPath);
- } else {
- sharingLink = generateSharingLink(locationId, undefined, entryPath);
- }
- } else {
- sharingLink = generateSharingLink(locationId);
- }
- }
- }
+ const { sharingLink, sharingParentFolderLink } = getSharingLink(
+ openedFile,
+ props.locations
+ );
const handleMessage = (data: any) => {
let message;
@@ -489,7 +437,7 @@ function EntryContainer(props: Props) {
break;
case 'editDocument':
if (editingSupported) {
- editFile();
+ editOpenedFile();
}
break;
case 'playbackEnded':
@@ -796,7 +744,7 @@ function EntryContainer(props: Props) {
});
}
- const editFile = () => {
+ const editOpenedFile = () => {
props.switchLocationType(openedFile.locationId).then(currentLocationId => {
updateOpenedFile(openedFile.path, {
...openedFile,
@@ -808,10 +756,6 @@ function EntryContainer(props: Props) {
});
};
- const shareFile = (filePath: string) => {
- PlatformIO.shareFiles([filePath]);
- };
-
const setPercent = (p: number | undefined) => {
percent.current = p;
// console.log('Percent ' + percent.current);
@@ -833,21 +777,27 @@ function EntryContainer(props: Props) {
};
const openPanel = () => {
- if (!isPropertiesPanelVisible) {
+ setPropertiesStyles({ display: 'flex', flexDirection: 'column' });
+ /*if (!isPropertiesPanelVisible) {
percent.current = parseFloat(settings.entrySplitSize);
setPropertiesPanelVisible(true);
- }
+ }*/
};
const closePanel = () => {
- if (isPropertiesPanelVisible) {
+ /*if (isPropertiesPanelVisible) {
percent.current = undefined;
setPropertiesPanelVisible(false);
- }
+ }*/
};
const toggleProperties = () => {
- if (isPropPanelVisible && !isRevisionPanelVisible) {
+ if (propertiesStyles !== undefined) {
+ setPropertiesStyles(undefined);
+ } else {
+ setPropertiesStyles({ display: 'flex', flexDirection: 'column' });
+ }
+ /*if (isPropPanelVisible && !isRevisionPanelVisible) {
closePanel();
} else {
openPanel();
@@ -855,7 +805,7 @@ function EntryContainer(props: Props) {
if (isRevisionPanelVisible) {
setRevisionPanelVisible(false);
- }
+ }*/
};
const toggleRevisions = () => {
@@ -894,65 +844,6 @@ function EntryContainer(props: Props) {
}
};
- const openNatively = () => {
- if (openedFile.path) {
- if (openedFile.isFile) {
- openFileNatively(openedFile.path);
- } else {
- openDirectory(openedFile.path);
- }
- }
- };
-
- const navigateToFolder = () => {
- // let folderPath = '';
- if (openedFile.isFile) {
- // folderPath = extractContainingDirectoryPath(openedFile.path);
- openLink(sharingParentFolderLink);
- } else {
- openLink(sharingLink);
- // folderPath = openedFile.path;
- }
- // loadDirectoryContent(folderPath, false, true);
- };
-
- const openInNewWindow = () => {
- PlatformIO.createNewInstance(window.location.href);
- };
-
- const downloadCordova = (uri, filename) => {
- const { Downloader } = window.plugins;
-
- const downloadSuccessCallback = result => {
- // result is an object
- /* {
- path: "file:///storage/sdcard0/documents/My Pdf.pdf", // Returns full file path
- file: "My Pdf.pdf", // Returns Filename
- folder: "documents" // Returns folder name
- } */
- console.log(result.file); // My Pdf.pdf
- };
-
- const downloadErrorCallback = error => {
- console.log(error);
- };
-
- const options = {
- title: 'Downloading File:' + filename, // Download Notification Title
- url: uri, // File Url
- path: filename, // The File Name with extension
- description: 'The file is downloading', // Download description Notification String
- visible: true, // This download is visible and shows in the notifications while in progress and after completion.
- folder: 'documents' // Folder to save the downloaded file, if not exist it will be created
- };
-
- Downloader.download(
- options,
- downloadSuccessCallback,
- downloadErrorCallback
- );
- };
-
const isEditable = AppConfig.editableFiles.some(ext =>
openedFile.path.endsWith(ext)
);
@@ -979,312 +870,6 @@ function EntryContainer(props: Props) {
}
};
- const renderFileToolbar = () => (
- <div className={classes.toolbar2}>
- <div className={classes.flexLeft}>
- <Tooltip title={i18n.t('core:toggleProperties')}>
- <IconButton
- aria-label={i18n.t('core:toggleProperties')}
- onClick={toggleProperties}
- data-tid="fileContainerToggleProperties"
- size="large"
- >
- <DetailsIcon
- color={
- isPropPanelVisible && !isRevisionPanelVisible
- ? 'primary'
- : 'action'
- }
- />
- </IconButton>
- </Tooltip>
- {Pro && isEditable && props.revisionsEnabled && (
- <Tooltip title={i18n.t('core:revisions')}>
- <IconButton
- aria-label={i18n.t('core:revisions')}
- onClick={toggleRevisions}
- data-tid="revisionsTID"
- size="large"
- >
- <HistoryIcon
- color={isRevisionPanelVisible ? 'primary' : 'action'}
- />
- </IconButton>
- </Tooltip>
- )}
- <Divider orientation="vertical" flexItem />
- <Tooltip title={i18n.t('core:downloadFile')}>
- <IconButton
- aria-label={i18n.t('core:downloadFile')}
- onClick={() => {
- const entryName = `${baseName(
- openedFile.path,
- PlatformIO.getDirSeparator()
- )}`;
- const fileName = extractFileName(
- entryName,
- PlatformIO.getDirSeparator()
- );
-
- if (AppConfig.isCordova) {
- if (openedFile.url) {
- downloadCordova(openedFile.url, entryName);
- } else {
- console.log('Can only download HTTP/HTTPS URIs');
- showNotification(
- i18n.t('core:cantDownloadLocalFile'),
- NotificationTypes.default
- );
- }
- } else {
- const downloadLink = document.getElementById('downloadFile');
- if (downloadLink) {
- if (AppConfig.isWeb) {
- // eslint-disable-next-line no-restricted-globals
- const { protocol } = location;
- // eslint-disable-next-line no-restricted-globals
- const { hostname } = location;
- // eslint-disable-next-line no-restricted-globals
- const { port } = location;
- const link = `${protocol}//${hostname}${
- port !== '' ? `:${port}` : ''
- }/${openedFile.path}`;
- downloadLink.setAttribute('href', link);
- } else {
- downloadLink.setAttribute(
- 'href',
- `file:///${openedFile.path}`
- );
- }
-
- if (openedFile.url) {
- // mostly the s3 case
- downloadLink.setAttribute('target', '_blank');
- downloadLink.setAttribute('href', openedFile.url);
- }
-
- downloadLink.setAttribute('download', fileName); // works only for same origin
- downloadLink.click();
- }
- }
- }}
- size="large"
- >
- <FileDownloadIcon />
- </IconButton>
- </Tooltip>
- <Tooltip title={i18n.t('core:switchToFullscreen')}>
- <IconButton
- aria-label={i18n.t('core:switchToFullscreen')}
- data-tid="fileContainerSwitchToFullScreen"
- onClick={toggleFullScreen}
- size="large"
- >
- <FullScreenIcon />
- </IconButton>
- </Tooltip>
- {isDesktopMode && (
- <Tooltip title={i18n.t('core:openInFullWidth')}>
- <IconButton
- data-tid="openInFullWidthTID"
- aria-label={i18n.t('core:openInFullWidth')}
- onClick={() => {
- toggleEntryFullWidth();
- closePanel();
- }}
- size="large"
- >
- <ExpandIcon />
- </IconButton>
- </Tooltip>
- )}
- <Tooltip title={i18n.t('core:navigateToParentDirectory')}>
- <IconButton
- aria-label={i18n.t('core:navigateToParentDirectory')}
- onClick={navigateToFolder}
- size="large"
- >
- <ParentFolderIcon />
- </IconButton>
- </Tooltip>
- {!AppConfig.isCordova && (
- <Tooltip title={i18n.t('core:openInWindow')}>
- <IconButton
- aria-label={i18n.t('core:openInWindow')}
- onClick={openInNewWindow}
- size="large"
- >
- <OpenNewWindowIcon />
- </IconButton>
- </Tooltip>
- )}
- {AppConfig.isCordova && (
- <Tooltip title={i18n.t('core:shareFile')}>
- <IconButton
- aria-label={i18n.t('core:shareFile')}
- data-tid="shareFile"
- onClick={() => shareFile(`file:///${openedFile.path}`)}
- size="large"
- >
- <LinkIcon />
- </IconButton>
- </Tooltip>
- )}
- {!(
- PlatformIO.haveObjectStoreSupport() ||
- PlatformIO.haveWebDavSupport() ||
- AppConfig.isWeb
- ) && (
- <Tooltip title={i18n.t('core:openFileExternally')}>
- <IconButton
- aria-label={i18n.t('core:openFileExternally')}
- onClick={openNatively}
- size="large"
- >
- <OpenNativelyIcon />
- </IconButton>
- </Tooltip>
- )}
- <Tooltip title={i18n.t('core:reloadFile')}>
- <IconButton
- data-tid="reloadPropertiesTID"
- aria-label={i18n.t(
- openedFile.isFile
- ? 'core:reloadFileProperties'
- : 'core:reloadFolderProperties'
- )}
- onClick={reloadDocument}
- size="large"
- >
- <ReloadIcon />
- </IconButton>
- </Tooltip>
- {!isReadOnlyMode && (
- <Tooltip title={i18n.t('core:deleteEntry')}>
- <IconButton
- data-tid="deleteEntryTID"
- aria-label={i18n.t('core:deleteEntry')}
- onClick={() => setDeleteEntryModalOpened(true)}
- size="large"
- >
- <DeleteIcon />
- </IconButton>
- </Tooltip>
- )}
- </div>
- <div
- style={{
- position: 'absolute',
- top: 50,
- right: 0,
- backgroundColor: theme.palette.background.default,
- boxShadow: '-11px -2px 20px 3px ' + theme.palette.background.default
- }}
- >
- <Tooltip title={i18n.t('core:openPrevFileTooltip')}>
- <IconButton
- aria-label={i18n.t('core:openPrevFileTooltip')}
- data-tid="fileContainerPrevFile"
- onClick={openPrevFile}
- size="large"
- >
- <PrevDocumentIcon />
- </IconButton>
- </Tooltip>
- <Tooltip title={i18n.t('core:openNextFileTooltip')}>
- <IconButton
- aria-label={i18n.t('core:openNextFileTooltip')}
- data-tid="fileContainerNextFile"
- onClick={openNextFile}
- size="large"
- >
- <NextDocumentIcon />
- </IconButton>
- </Tooltip>
- </div>
- </div>
- );
-
- const renderFolderToolbar = () => (
- <div className={classes.toolbar2}>
- <div className={classes.flexLeft}>
- <Tooltip title={i18n.t('core:openInMainArea')}>
- <IconButton
- data-tid="openInMainAreaTID"
- aria-label={i18n.t('core:openInMainArea')}
- onClick={navigateToFolder}
- size="large"
- >
- <NavigateToFolderIcon />
- </IconButton>
- </Tooltip>
- {!AppConfig.isCordova && (
- <Tooltip title={i18n.t('core:openInWindow')}>
- <IconButton
- aria-label={i18n.t('core:openInWindow')}
- onClick={openInNewWindow}
- size="large"
- >
- <OpenNewWindowIcon />
- </IconButton>
- </Tooltip>
- )}
- {!(
- PlatformIO.haveObjectStoreSupport() ||
- PlatformIO.haveWebDavSupport() ||
- AppConfig.isWeb
- ) && (
- <Tooltip title={i18n.t('core:openDirectoryExternally')}>
- <IconButton
- aria-label={i18n.t('core:openDirectoryExternally')}
- onClick={openNatively}
- size="large"
- >
- <OpenNativelyIcon />
- </IconButton>
- </Tooltip>
- )}
- <Tooltip title={i18n.t('core:reloadDirectory')}>
- <IconButton
- data-tid="reloadFolderTID"
- aria-label={i18n.t('core:reloadDirectory')}
- onClick={reloadDocument}
- size="large"
- >
- <ReloadIcon />
- </IconButton>
- </Tooltip>
- {isDesktopMode && (
- <Tooltip title={i18n.t('core:openInFullWidth')}>
- <IconButton
- data-tid="openInFullWidthTID"
- aria-label={i18n.t('core:openInFullWidth')}
- onClick={() => {
- toggleEntryFullWidth();
- closePanel();
- }}
- size="large"
- >
- <ExpandIcon />
- </IconButton>
- </Tooltip>
- )}
- {!isReadOnlyMode && (
- <Tooltip title={i18n.t('core:deleteDirectory')}>
- <IconButton
- data-tid="deleteFolderTID"
- aria-label={i18n.t('core:deleteDirectory')}
- onClick={() => setDeleteEntryModalOpened(true)}
- size="large"
- >
- <DeleteIcon />
- </IconButton>
- </Tooltip>
- )}
- </div>
- </div>
- );
-
let fileTitle: string = openedFile.path
? extractTitle(
openedFile.path,
@@ -1314,288 +899,299 @@ function EntryContainer(props: Props) {
}
const renderPanels = () => {
- const closeButton = (
- <Tooltip title={i18n.t('core:closeEntry')}>
- <IconButton
- onClick={startClosingFile}
- aria-label={i18n.t('core:closeEntry')}
- data-tid="fileContainerCloseOpenedFile"
- size="large"
- >
- <CloseIcon />
- </IconButton>
- </Tooltip>
- );
-
const toolbarButtons = () => {
- if (openedFile.path !== undefined) {
- return (
- <>
- <Box
- style={{
- paddingLeft: 0,
- paddingRight: 50,
- paddingTop: 0,
- minHeight: 50,
- display: 'flex',
- flexDirection: 'row',
- justifyContent: 'flex-start'
+ return (
+ <Box
+ style={{
+ paddingLeft: 0,
+ paddingRight: 50,
+ paddingTop: 0,
+ minHeight: 50,
+ display: 'flex',
+ flexDirection: 'row',
+ justifyContent: 'flex-start'
+ }}
+ >
+ <Box
+ className={classes.flexLeft}
+ style={{
+ paddingLeft: 5,
+ display: 'flex',
+ alignItems: 'center',
+ paddingRight: editingSupported ? 85 : 5
+ }}
+ >
+ <Button
+ id="actions-button"
+ data-tid="propsActionsMenuTID"
+ aria-controls={Boolean(anchorEl) ? 'basic-menu' : undefined}
+ aria-haspopup="true"
+ aria-expanded={Boolean(anchorEl) ? 'true' : undefined}
+ endIcon={<MoreVertIcon sx={{ fontSize: 20 }} />}
+ onClick={(event: React.MouseEvent<HTMLElement>) => {
+ setAnchorEl(event.currentTarget);
}}
>
+ {openedFile.isFile ? (
+ <>
+ {fileChanged.current ? (
+ <Tooltip title={i18n.t('core:fileChanged')}>
+ <span
+ style={{
+ color: theme.palette.text.primary,
+ margin: 3
+ }}
+ >
+ {String.fromCharCode(0x25cf)}
+ </span>
+ </Tooltip>
+ ) : (
+ ''
+ )}
+ <span
+ className={classes.fileBadge}
+ style={{
+ backgroundColor: openedFile.color,
+ textTransform: 'uppercase'
+ }}
+ >
+ {'.' +
+ extractFileExtension(
+ openedFile.path,
+ PlatformIO.getDirSeparator()
+ )}
+ </span>
+ </>
+ ) : (
+ <span
+ className={classes.fileBadge}
+ title={i18n.t('core:toggleEntryProperties')}
+ style={{
+ backgroundColor: AppConfig.defaultFolderColor
+ }}
+ >
+ {i18n.t('core:folder')}
+ </span>
+ )}
+ </Button>
+ <EntryContainerMenu
+ anchorEl={anchorEl}
+ handleClose={() => setAnchorEl(null)}
+ openedEntry={openedFile}
+ reloadDocument={reloadDocument}
+ sharingLink={sharingLink}
+ sharingParentFolderLink={sharingParentFolderLink}
+ toggleFullScreen={toggleFullScreen}
+ />
+ <Tooltip title={fileName}>
<Box
- className={classes.flexLeft}
+ data-tid={'OpenedTID' + dataTidFormat(fileName)}
style={{
- paddingLeft: 10,
- display: 'flex',
- alignItems: 'center',
- paddingRight: editingSupported ? 85 : 5
+ color: theme.palette.text.primary,
+ display: 'inline',
+ fontSize: 17,
+ maxHeight: 40,
+ overflowY: 'auto'
}}
>
- <Tooltip title={fileName}>
- <Box
- data-tid={'OpenedTID' + dataTidFormat(fileName)}
+ {fileTitle}
+ </Box>
+ </Tooltip>
+ <ProTooltip tooltip={i18n.t('core:toggleBookmark')}>
+ <IconButton
+ data-tid="toggleBookmarkTID"
+ aria-label="bookmark"
+ size="small"
+ onClick={bookmarkClick}
+ >
+ {haveBookmark ? (
+ <BookmarkIcon
style={{
- color: theme.palette.text.primary,
- display: 'inline',
- fontSize: 17,
- maxHeight: 40,
- overflowY: 'auto'
+ color: theme.palette.primary.main
}}
- >
- {fileTitle}
- </Box>
- </Tooltip>
- {openedFile.isFile ? (
- <>
- {fileChanged.current ? (
- <Tooltip title={i18n.t('core:fileChanged')}>
- <span
- style={{
- color: theme.palette.text.primary,
- margin: 3
- }}
- >
- {String.fromCharCode(0x25cf)}
- </span>
- </Tooltip>
- ) : (
- ''
- )}
- <span
- className={classes.fileBadge}
- style={{
- backgroundColor: openedFile.color,
- textTransform: 'uppercase'
- }}
- >
- {'.' +
- extractFileExtension(
- openedFile.path,
- PlatformIO.getDirSeparator()
- )}
- </span>
- </>
+ />
) : (
- <span
- className={classes.fileBadge}
- title={i18n.t('core:toggleEntryProperties')}
+ <BookmarkAddIcon
style={{
- backgroundColor: AppConfig.defaultFolderColor
+ color: theme.palette.text.secondary
}}
- >
- {i18n.t('core:folder')}
- </span>
+ />
)}
- <ProTooltip tooltip={i18n.t('core:toggleBookmark')}>
- <IconButton
- data-tid="toggleBookmarkTID"
- aria-label="bookmark"
- size="small"
- onClick={bookmarkClick}
- >
- {haveBookmark ? (
- <BookmarkIcon
- style={{
- color: theme.palette.primary.main
- }}
- />
- ) : (
- <BookmarkAddIcon
- style={{
- color: theme.palette.text.secondary
- }}
- />
- )}
- </IconButton>
- </ProTooltip>
- <TagsPreview tags={openedFile.tags} />
- </Box>
- <div
- style={{
- zIndex: 1,
- position: 'absolute',
- right: 0,
- backgroundColor: theme.palette.background.default,
- display: 'flex',
- alignItems: 'center'
- }}
+ </IconButton>
+ </ProTooltip>
+ <TagsPreview tags={openedFile.tags} />
+ </Box>
+ <EntryContainerNav
+ isFile={openedFile.isFile}
+ startClosingFile={startClosingFile}
+ />
+ </Box>
+ );
+ };
+
+ const tabs = () => {
+ const autoSave = isEditable && props.revisionsEnabled && (
+ <Tooltip
+ title={
+ i18n.t('core:autosave') +
+ (!Pro
+ ? ' - ' + i18n.t('core:thisFunctionalityIsAvailableInPro')
+ : '')
+ }
+ >
+ <Switch
+ data-tid="autoSaveTID"
+ checked={
+ openedFile.isAutoSaveEnabled !== undefined &&
+ openedFile.isAutoSaveEnabled
+ }
+ onChange={toggleAutoSave}
+ name="autoSave"
+ color="primary"
+ />
+ </Tooltip>
+ );
+
+ let editFile = null;
+ if (editingSupported) {
+ if (openedFile.editMode) {
+ editFile = (
+ <ButtonGroup>
+ <Tooltip title={i18n.t('core:cancelEditing')}>
+ <Button
+ onClick={reloadDocument}
+ aria-label={i18n.t('core:cancelEditing')}
+ size="small"
+ variant="outlined"
+ color="primary"
+ startIcon={desktopMode && <CancelIcon />}
+ >
+ {fileChanged.current
+ ? i18n.t('core:cancel')
+ : i18n.t('core:closeButton')}
+ </Button>
+ </Tooltip>
+ <Tooltip
+ title={
+ i18n.t('core:saveFile') +
+ ' (' +
+ (AppConfig.isMaclike ? '⌘' : 'CTRL') +
+ ' + S)'
+ }
>
- {isEditable && props.revisionsEnabled && (
- <Tooltip
- title={
- i18n.t('core:autosave') +
- (!Pro
- ? ' - ' +
- i18n.t('core:thisFunctionalityIsAvailableInPro')
- : '')
- }
- >
- <Switch
- data-tid="autoSaveTID"
- checked={
- openedFile.isAutoSaveEnabled !== undefined &&
- openedFile.isAutoSaveEnabled
- }
- onChange={toggleAutoSave}
- name="autoSave"
- color="primary"
- />
- </Tooltip>
- )}
+ <LoadingButton
+ disabled={false}
+ onClick={startSavingFile}
+ aria-label={i18n.t('core:saveFile')}
+ data-tid="fileContainerSaveFile"
+ size="small"
+ variant="outlined"
+ color="primary"
+ startIcon={desktopMode && <SaveIcon />}
+ loading={isSavingInProgress}
+ >
+ {i18n.t('core:save')}
+ </LoadingButton>
+ </Tooltip>
+ </ButtonGroup>
+ );
+ } else {
+ editFile = (
+ <Tooltip title={i18n.t('core:editFile')}>
+ <Button
+ disabled={false}
+ size="small"
+ variant="outlined"
+ color="primary"
+ onClick={editOpenedFile}
+ aria-label={i18n.t('core:editFile')}
+ data-tid="fileContainerEditFile"
+ startIcon={<EditIcon />}
+ >
+ {i18n.t('core:edit')}
+ </Button>
+ </Tooltip>
+ );
+ }
+ }
+ const tabsComponent = (marginRight = undefined) => (
+ <EntryContainerTabs
+ openedFile={openedFile}
+ openPanel={openPanel}
+ toggleProperties={toggleProperties}
+ marginRight={marginRight}
+ />
+ );
- {editingSupported && openedFile.editMode && (
- <ButtonGroup>
- <Tooltip title={i18n.t('core:cancelEditing')}>
- <Button
- onClick={reloadDocument}
- aria-label={i18n.t('core:cancelEditing')}
- size="small"
- variant="outlined"
- color="primary"
- startIcon={isDesktopMode && <CancelIcon />}
- >
- {fileChanged.current
- ? i18n.t('core:cancel')
- : i18n.t('core:closeButton')}
- </Button>
- </Tooltip>
- <Tooltip
- title={
- i18n.t('core:saveFile') +
- ' (' +
- (AppConfig.isMaclike ? '⌘' : 'CTRL') +
- ' + S)'
- }
- >
- <LoadingButton
- disabled={false}
- onClick={startSavingFile}
- aria-label={i18n.t('core:saveFile')}
- data-tid="fileContainerSaveFile"
- size="small"
- variant="outlined"
- color="primary"
- startIcon={isDesktopMode && <SaveIcon />}
- loading={isSavingInProgress}
- >
- {i18n.t('core:save')}
- </LoadingButton>
- </Tooltip>
- </ButtonGroup>
- )}
- {editingSupported && !openedFile.editMode && (
- <Tooltip title={i18n.t('core:editFile')}>
- <Button
- disabled={false}
- size="small"
- variant="outlined"
- color="primary"
- onClick={editFile}
- aria-label={i18n.t('core:editFile')}
- data-tid="fileContainerEditFile"
- startIcon={<EditIcon />}
- >
- {i18n.t('core:edit')}
- </Button>
- </Tooltip>
- )}
- {closeButton}
- </div>
- </Box>
- {entryProperties}
- </>
- );
+ if (!autoSave && !editFile) {
+ return tabsComponent();
}
- return <div>{i18n.t('core:noEntrySelected')}</div>;
+
+ return (
+ <div
+ style={{
+ position: 'relative'
+ }}
+ >
+ {tabsComponent('160px')}
+ <div
+ style={{
+ zIndex: 1,
+ position: 'absolute',
+ right: 10,
+ top: 8,
+ backgroundColor: theme.palette.background.default,
+ display: 'flex',
+ alignItems: 'center'
+ }}
+ >
+ {autoSave}
+ {editFile}
+ </div>
+ </div>
+ );
};
+ /*let initSize;
+ if (isPropPanelVisible) {
+ initSize = openedFile.isFile ? settings.entrySplitSize : '100%';
+ } else {
+ initSize = defaultSplitSize; // '0%';
+ }*/
- const entryProperties = (
+ return (
<div
style={{
- display: 'inline',
- flex: '1 1 100%',
- backgroundColor: theme.palette.background.default,
- padding: '0',
- height: '100%'
+ height: 'calc(100% - 47px)',
+ //height: '100%',
+ //minHeight: '100%',
+ ...propertiesStyles
}}
>
- {openedFile.isFile ? renderFileToolbar() : renderFolderToolbar()}
- {isRevisionPanelVisible &&
- openedFile.isFile &&
- Pro &&
- isEditable &&
- props.revisionsEnabled ? (
- <Revisions />
- ) : (
- <EntryProperties
- key={openedFile.path}
- openedEntry={openedFile}
- tagDelimiter={settings.tagDelimiter}
- renameFile={renameFile}
- renameDirectory={renameDirectory}
- addTags={addTags}
- removeTags={removeTags}
- removeAllTags={removeAllTags}
- updateOpenedFile={updateOpenedFile}
- updateThumbnailUrl={updateThumbnailUrl}
- showNotification={showNotification}
- isReadOnlyMode={isReadOnlyMode}
- currentDirectoryPath={currentDirectoryPath}
- tileServer={tileServer}
- sharingLink={sharingLink}
+ <Root>
+ {openedFile.path !== undefined ? (
+ <>
+ {toolbarButtons()}
+ {tabs()}
+ </>
+ ) : (
+ <div>{i18n.t('core:noEntrySelected')}</div>
+ )}
+ </Root>
+ {openedFile.isFile && (
+ <FileView
+ key="FileViewID"
+ openedFile={openedFile}
+ isFullscreen={isFullscreen}
+ fileViewer={fileViewer}
+ fileViewerContainer={fileViewerContainer}
+ toggleFullScreen={toggleFullScreen}
+ currentTheme={settings.currentTheme}
+ eventID={eventID.current}
+ height={propertiesStyles ? '100%' : 'calc(100% - 100px)'}
/>
)}
</div>
);
-
- let initSize;
- if (isPropPanelVisible) {
- initSize = openedFile.isFile ? settings.entrySplitSize : '100%';
- } else {
- initSize = defaultSplitSize; // '0%';
- }
-
- return (
- <Split
- horizontal
- minPrimarySize="98px"
- initialPrimarySize={initSize}
- percent={percent.current}
- setPercent={setPercent}
- >
- <Root>{toolbarButtons()}</Root>
- <FileView
- key="FileViewID"
- openedFile={openedFiles[0]}
- isFullscreen={isFullscreen}
- fileViewer={fileViewer}
- fileViewerContainer={fileViewerContainer}
- toggleFullScreen={toggleFullScreen}
- currentTheme={settings.currentTheme}
- eventID={eventID.current}
- />
- </Split>
- );
};
return (
@@ -1603,7 +1199,7 @@ function EntryContainer(props: Props) {
handlers={{
closeViewer: startClosingFile,
saveDocument: startSavingFile,
- editDocument: editFile,
+ editDocument: editOpenedFile,
nextDocument: openNextFile,
prevDocument: openPrevFile,
toggleFullScreen
@@ -1666,45 +1262,10 @@ function EntryContainer(props: Props) {
confirmDialogContentTID="confirmDialogContent"
/>
)}
- {isDeleteEntryModalOpened && (
- <ConfirmDialog
- open={isDeleteEntryModalOpened}
- onClose={() => {
- setDeleteEntryModalOpened(false);
- }}
- title={
- openedFile.isFile
- ? i18n.t('core:deleteConfirmationTitle')
- : i18n.t('core:deleteDirectory')
- }
- content={
- openedFile.isFile
- ? i18n.t('core:doYouWantToDeleteFile')
- : i18n.t('core:deleteDirectoryContentConfirm', {
- dirPath: openedFile.path
- ? extractDirectoryName(
- openedFile.path,
- PlatformIO.getDirSeparator()
- )
- : ''
- })
- }
- confirmCallback={result => {
- if (result) {
- deleteFile(openedFile.path, openedFile.uuid);
- }
- }}
- cancelDialogTID="cancelSaveBeforeCloseDialog"
- confirmDialogTID="confirmSaveBeforeCloseDialog"
- confirmDialogContentTID="confirmDialogContent"
- />
- )}
{isEditTagsModalOpened && (
<AddRemoveTagsDialog
open={isEditTagsModalOpened}
onClose={() => setEditTagsModalOpened(false)}
- removeTags={removeTags}
- removeAllTags={removeAllTags}
selectedEntries={openedFile ? [openedFile] : []}
/>
)}
@@ -1715,11 +1276,9 @@ function EntryContainer(props: Props) {
saveAs={saveAs}
override={override}
/>
- <div style={{ height: 'calc(100% - 47px)' }}>
- {/* eslint-disable-next-line jsx-a11y/anchor-has-content,jsx-a11y/anchor-is-valid */}
- <a href="#" id="downloadFile" />
- {renderPanels()}
- </div>
+ {/* eslint-disable-next-line jsx-a11y/anchor-has-content,jsx-a11y/anchor-is-valid */}
+ <a href="#" id="downloadFile" />
+ {renderPanels()}
</GlobalHotKeys>
);
}
@@ -1729,8 +1288,7 @@ function mapStateToProps(state) {
settings: state.settings,
isReadOnlyMode: isReadOnlyMode(state),
keyBindings: getKeyBindingObject(state),
- isDesktopMode: isDesktopMode(state),
- tileServer: getMapTileServer(state),
+ desktopMode: isDesktopMode(state),
revisionsEnabled: isRevisionsEnabled(state),
language: getCurrentLanguage(state),
locations: getLocations(state)
@@ -1742,8 +1300,6 @@ function mapActionCreatorsToProps(dispatch) {
{
setEntryPropertiesSplitSize: SettingsActions.setEntryPropertiesSplitSize,
closeAllFiles: AppActions.closeAllFiles,
- renameFile: AppActions.renameFile,
- renameDirectory: AppActions.renameDirectory,
openFileNatively: AppActions.openFileNatively,
openDirectory: AppActions.openDirectory,
openLink: AppActions.openLink,
@@ -1752,11 +1308,7 @@ function mapActionCreatorsToProps(dispatch) {
openPrevFile: AppActions.openPrevFile,
deleteFile: AppActions.deleteFile,
toggleEntryFullWidth: AppActions.toggleEntryFullWidth,
- addTags: TaggingActions.addTags,
- removeTags: TaggingActions.removeTags,
- removeAllTags: TaggingActions.removeAllTags,
updateOpenedFile: AppActions.updateOpenedFile,
- updateThumbnailUrl: AppActions.updateThumbnailUrl,
switchLocationType: LocationActions.switchLocationType,
switchCurrentLocationType: AppActions.switchCurrentLocationType
},
diff --git a/app/components/EntryContainerMenu.tsx b/app/components/EntryContainerMenu.tsx
new file mode 100644
index 000000000..9a18e8330
--- /dev/null
+++ b/app/components/EntryContainerMenu.tsx
@@ -0,0 +1,476 @@
+import React, { useState } from 'react';
+import {
+ baseName,
+ extractFileName,
+ extractDirectoryName
+} from '@tagspaces/tagspaces-common/paths';
+import PlatformIO from '-/services/platform-facade';
+import {
+ ListItemIcon,
+ ListItemText,
+ Menu,
+ MenuItem,
+ Typography
+} from '@mui/material';
+import {
+ actions as AppActions,
+ AppDispatch,
+ isReadOnlyMode,
+ NotificationTypes,
+ OpenedEntry
+} from '-/reducers/app';
+import { useDispatch, useSelector } from 'react-redux';
+import AppConfig from '-/AppConfig';
+import i18n from '-/services/i18n';
+import {
+ DeleteIcon,
+ LinkIcon,
+ NavigateToFolderIcon,
+ OpenNewWindowIcon,
+ ParentFolderIcon,
+ ReloadIcon
+} from '-/components/CommonIcons';
+import ExpandIcon from '@mui/icons-material/SettingsEthernet';
+import OpenNativelyIcon from '@mui/icons-material/Launch';
+import FullScreenIcon from '@mui/icons-material/ZoomOutMap';
+import FileDownloadIcon from '@mui/icons-material/AssignmentReturned';
+import ConfirmDialog from '-/components/dialogs/ConfirmDialog';
+import { isDesktopMode } from '-/reducers/settings';
+
+interface Props {
+ anchorEl: null | HTMLElement;
+ handleClose: () => void;
+ openedEntry: OpenedEntry;
+ toggleFullScreen: () => void;
+ reloadDocument: () => void;
+ sharingLink: string;
+ sharingParentFolderLink: string;
+}
+
+function EntryContainerMenu(props: Props) {
+ const {
+ anchorEl,
+ handleClose,
+ openedEntry,
+ toggleFullScreen,
+ sharingLink,
+ sharingParentFolderLink,
+ reloadDocument
+ } = props;
+ // const theme = useTheme();
+ const readOnlyMode = useSelector(isReadOnlyMode);
+ const desktopMode = useSelector(isDesktopMode);
+ const dispatch: AppDispatch = useDispatch();
+
+ const [isDeleteEntryModalOpened, setDeleteEntryModalOpened] = useState<
+ boolean
+ >(false);
+
+ const downloadCordova = (uri, filename) => {
+ const { Downloader } = window.plugins;
+
+ const downloadSuccessCallback = result => {
+ // result is an object
+ /* {
+ path: "file:///storage/sdcard0/documents/My Pdf.pdf", // Returns full file path
+ file: "My Pdf.pdf", // Returns Filename
+ folder: "documents" // Returns folder name
+ } */
+ console.log(result.file); // My Pdf.pdf
+ };
+
+ const downloadErrorCallback = error => {
+ console.log(error);
+ };
+
+ const options = {
+ title: 'Downloading File:' + filename, // Download Notification Title
+ url: uri, // File Url
+ path: filename, // The File Name with extension
+ description: 'The file is downloading', // Download description Notification String
+ visible: true, // This download is visible and shows in the notifications while in progress and after completion.
+ folder: 'documents' // Folder to save the downloaded file, if not exist it will be created
+ };
+
+ Downloader.download(
+ options,
+ downloadSuccessCallback,
+ downloadErrorCallback
+ );
+ };
+
+ function downloadFile() {
+ const entryName = `${baseName(
+ openedEntry.path,
+ PlatformIO.getDirSeparator()
+ )}`;
+ const fileName = extractFileName(entryName, PlatformIO.getDirSeparator());
+
+ if (AppConfig.isCordova) {
+ if (openedEntry.url) {
+ downloadCordova(openedEntry.url, entryName);
+ } else {
+ console.log('Can only download HTTP/HTTPS URIs');
+ dispatch(
+ AppActions.showNotification(
+ i18n.t('core:cantDownloadLocalFile'),
+ NotificationTypes.default
+ )
+ );
+ }
+ } else {
+ const downloadLink = document.getElementById('downloadFile');
+ if (downloadLink) {
+ if (AppConfig.isWeb) {
+ // eslint-disable-next-line no-restricted-globals
+ const { protocol } = location;
+ // eslint-disable-next-line no-restricted-globals
+ const { hostname } = location;
+ // eslint-disable-next-line no-restricted-globals
+ const { port } = location;
+ const link = `${protocol}//${hostname}${
+ port !== '' ? `:${port}` : ''
+ }/${openedEntry.path}`;
+ downloadLink.setAttribute('href', link);
+ } else {
+ downloadLink.setAttribute('href', `file:///${openedEntry.path}`);
+ }
+
+ if (openedEntry.url) {
+ // mostly the s3 case
+ downloadLink.setAttribute('target', '_blank');
+ downloadLink.setAttribute('href', openedEntry.url);
+ }
+
+ downloadLink.setAttribute('download', fileName); // works only for same origin
+ downloadLink.click();
+ }
+ }
+ handleClose();
+ }
+
+ const navigateToFolder = () => {
+ if (openedEntry.isFile) {
+ dispatch(AppActions.openLink(sharingParentFolderLink));
+ } else {
+ dispatch(AppActions.openLink(sharingLink));
+ }
+ handleClose();
+ };
+
+ const openInNewWindow = () => {
+ PlatformIO.createNewInstance(window.location.href);
+ handleClose();
+ };
+
+ const shareFile = (filePath: string) => {
+ PlatformIO.shareFiles([filePath]);
+ handleClose();
+ };
+
+ const openNatively = () => {
+ if (openedEntry.path) {
+ if (openedEntry.isFile) {
+ dispatch(AppActions.openFileNatively(openedEntry.path));
+ } else {
+ dispatch(AppActions.openDirectory(openedEntry.path));
+ }
+ }
+ handleClose();
+ };
+
+ const menuItems = [];
+ if (openedEntry.isFile) {
+ menuItems.push(
+ <MenuItem
+ data-tid="downloadFileTID"
+ aria-label={i18n.t('core:downloadFile')}
+ onClick={() => downloadFile()}
+ >
+ <ListItemIcon>
+ <FileDownloadIcon />
+ </ListItemIcon>
+ <ListItemText primary={i18n.t('core:downloadFile')} />
+ </MenuItem>
+ );
+ menuItems.push(
+ <MenuItem
+ data-tid="fileContainerSwitchToFullScreen"
+ aria-label={i18n.t('core:switchToFullscreen')}
+ onClick={() => {
+ toggleFullScreen();
+ handleClose();
+ }}
+ >
+ <ListItemIcon>
+ <FullScreenIcon />
+ </ListItemIcon>
+ <ListItemText primary={i18n.t('core:switchToFullscreen')} />
+ </MenuItem>
+ );
+ if (desktopMode) {
+ menuItems.push(
+ <MenuItem
+ data-tid="openInFullWidthTID"
+ aria-label={i18n.t('core:openInFullWidth')}
+ onClick={() => {
+ dispatch(AppActions.toggleEntryFullWidth());
+ handleClose();
+ }}
+ >
+ <ListItemIcon>
+ <ExpandIcon />
+ </ListItemIcon>
+ <ListItemText primary={i18n.t('core:openInFullWidth')} />
+ </MenuItem>
+ );
+ }
+ menuItems.push(
+ <MenuItem
+ data-tid="navigateToParentTID"
+ aria-label={i18n.t('core:navigateToParentDirectory')}
+ onClick={navigateToFolder}
+ >
+ <ListItemIcon>
+ <ParentFolderIcon />
+ </ListItemIcon>
+ <ListItemText primary={i18n.t('core:navigateToParentDirectory')} />
+ </MenuItem>
+ );
+ if (!AppConfig.isCordova) {
+ menuItems.push(
+ <MenuItem
+ data-tid="openInWindowTID"
+ aria-label={i18n.t('core:openInWindow')}
+ onClick={openInNewWindow}
+ >
+ <ListItemIcon>
+ <OpenNewWindowIcon />
+ </ListItemIcon>
+ <ListItemText primary={i18n.t('core:openInWindow')} />
+ </MenuItem>
+ );
+ }
+ if (AppConfig.isCordova) {
+ menuItems.push(
+ <MenuItem
+ data-tid="shareFileTID"
+ aria-label={i18n.t('core:shareFile')}
+ onClick={() => shareFile(`file:///${openedEntry.path}`)}
+ >
+ <ListItemIcon>
+ <LinkIcon />
+ </ListItemIcon>
+ <ListItemText primary={i18n.t('core:shareFile')} />
+ </MenuItem>
+ );
+ }
+ if (
+ !(
+ PlatformIO.haveObjectStoreSupport() ||
+ PlatformIO.haveWebDavSupport() ||
+ AppConfig.isWeb
+ )
+ ) {
+ menuItems.push(
+ <MenuItem
+ data-tid="openFileExternallyTID"
+ aria-label={i18n.t('core:openFileExternally')}
+ onClick={openNatively}
+ >
+ <ListItemIcon>
+ <OpenNativelyIcon />
+ </ListItemIcon>
+ <ListItemText primary={i18n.t('core:openFileExternally')} />
+ </MenuItem>
+ );
+ }
+ menuItems.push(
+ <MenuItem
+ data-tid="reloadPropertiesTID"
+ aria-label={i18n.t('core:reloadFile')}
+ onClick={() => {
+ reloadDocument();
+ handleClose();
+ }}
+ >
+ <ListItemIcon>
+ <ReloadIcon />
+ </ListItemIcon>
+ <ListItemText primary={i18n.t('core:reloadFile')} />
+ </MenuItem>
+ );
+ if (!readOnlyMode) {
+ menuItems.push(
+ <MenuItem
+ data-tid="deleteEntryTID"
+ aria-label={i18n.t('core:deleteEntry')}
+ onClick={() => {
+ setDeleteEntryModalOpened(true);
+ handleClose();
+ }}
+ >
+ <ListItemIcon>
+ <DeleteIcon />
+ </ListItemIcon>
+ <ListItemText primary={i18n.t('core:deleteEntry')} />
+ </MenuItem>
+ );
+ }
+ } else {
+ // folder
+ menuItems.push(
+ <MenuItem
+ data-tid="openInMainAreaTID"
+ aria-label={i18n.t('core:openInMainArea')}
+ onClick={navigateToFolder}
+ >
+ <ListItemIcon>
+ <NavigateToFolderIcon />
+ </ListItemIcon>
+ <ListItemText primary={i18n.t('core:openInMainArea')} />
+ </MenuItem>
+ );
+ if (!AppConfig.isCordova) {
+ menuItems.push(
+ <MenuItem
+ data-tid="openInWindowTID"
+ aria-label={i18n.t('core:openInWindow')}
+ onClick={openInNewWindow}
+ >
+ <ListItemIcon>
+ <OpenNewWindowIcon />
+ </ListItemIcon>
+ <ListItemText primary={i18n.t('core:openInWindow')} />
+ </MenuItem>
+ );
+ }
+ if (
+ !(
+ PlatformIO.haveObjectStoreSupport() ||
+ PlatformIO.haveWebDavSupport() ||
+ AppConfig.isWeb
+ )
+ ) {
+ menuItems.push(
+ <MenuItem
+ data-tid="openDirectoryExternallyTID"
+ aria-label={i18n.t('core:openDirectoryExternally')}
+ onClick={openNatively}
+ >
+ <ListItemIcon>
+ <OpenNativelyIcon />
+ </ListItemIcon>
+ <ListItemText primary={i18n.t('core:openDirectoryExternally')} />
+ </MenuItem>
+ );
+ }
+ menuItems.push(
+ <MenuItem
+ data-tid="reloadFolderTID"
+ aria-label={i18n.t('core:reloadDirectory')}
+ onClick={() => {
+ reloadDocument();
+ handleClose();
+ }}
+ >
+ <ListItemIcon>
+ <ReloadIcon />
+ </ListItemIcon>
+ <ListItemText primary={i18n.t('core:reloadDirectory')} />
+ </MenuItem>
+ );
+ if (desktopMode) {
+ menuItems.push(
+ <MenuItem
+ data-tid="openInFullWidthTID"
+ aria-label={i18n.t('core:openInFullWidth')}
+ onClick={() => {
+ dispatch(AppActions.toggleEntryFullWidth());
+ handleClose();
+ }}
+ >
+ <ListItemIcon>
+ <ExpandIcon />
+ </ListItemIcon>
+ <ListItemText primary={i18n.t('core:openInFullWidth')} />
+ </MenuItem>
+ );
+ }
+ if (!readOnlyMode) {
+ menuItems.push(
+ <MenuItem
+ data-tid="deleteFolderTID"
+ aria-label={i18n.t('core:deleteDirectory')}
+ onClick={() => {
+ setDeleteEntryModalOpened(true);
+ handleClose();
+ }}
+ >
+ <ListItemIcon>
+ <DeleteIcon />
+ </ListItemIcon>
+ <ListItemText primary={i18n.t('core:deleteDirectory')} />
+ </MenuItem>
+ );
+ }
+ }
+
+ return (
+ <>
+ <Menu
+ id="basic-menu"
+ anchorEl={anchorEl}
+ open={Boolean(anchorEl)}
+ onClose={handleClose}
+ anchorOrigin={{
+ vertical: 'bottom',
+ horizontal: 'left'
+ }}
+ transformOrigin={{
+ vertical: 'top',
+ horizontal: 'left'
+ }}
+ >
+ {menuItems}
+ </Menu>
+ {isDeleteEntryModalOpened && (
+ <ConfirmDialog
+ open={isDeleteEntryModalOpened}
+ onClose={() => {
+ setDeleteEntryModalOpened(false);
+ }}
+ title={
+ openedEntry.isFile
+ ? i18n.t('core:deleteConfirmationTitle')
+ : i18n.t('core:deleteDirectory')
+ }
+ content={
+ openedEntry.isFile
+ ? i18n.t('core:doYouWantToDeleteFile')
+ : i18n.t('core:deleteDirectoryContentConfirm', {
+ dirPath: openedEntry.path
+ ? extractDirectoryName(
+ openedEntry.path,
+ PlatformIO.getDirSeparator()
+ )
+ : ''
+ })
+ }
+ confirmCallback={result => {
+ if (result) {
+ dispatch(
+ AppActions.deleteFile(openedEntry.path, openedEntry.uuid)
+ );
+ }
+ }}
+ cancelDialogTID="cancelSaveBeforeCloseDialog"
+ confirmDialogTID="confirmSaveBeforeCloseDialog"
+ confirmDialogContentTID="confirmDialogContent"
+ />
+ )}
+ </>
+ );
+}
+
+export default EntryContainerMenu;
diff --git a/app/components/EntryContainerNav.tsx b/app/components/EntryContainerNav.tsx
new file mode 100644
index 000000000..85544b94b
--- /dev/null
+++ b/app/components/EntryContainerNav.tsx
@@ -0,0 +1,70 @@
+import React from 'react';
+import { useTheme } from '@mui/material/styles';
+import i18n from '-/services/i18n';
+import { IconButton, Tooltip } from '@mui/material';
+import CloseIcon from '@mui/icons-material/Close';
+import PrevDocumentIcon from '@mui/icons-material/KeyboardArrowUp';
+import NextDocumentIcon from '@mui/icons-material/KeyboardArrowDown';
+import { actions as AppActions, AppDispatch } from '-/reducers/app';
+import { useDispatch } from 'react-redux';
+
+interface Props {
+ isFile: boolean;
+ startClosingFile: (event) => void;
+}
+
+function EntryContainerNav(props: Props) {
+ const { isFile, startClosingFile } = props;
+ const theme = useTheme();
+ const dispatch: AppDispatch = useDispatch();
+
+ return (
+ <div
+ style={{
+ zIndex: 1,
+ position: 'absolute',
+ right: 0,
+ backgroundColor: theme.palette.background.default,
+ display: 'flex',
+ alignItems: 'center'
+ }}
+ >
+ {isFile && (
+ <>
+ <Tooltip title={i18n.t('core:openPrevFileTooltip')}>
+ <IconButton
+ aria-label={i18n.t('core:openPrevFileTooltip')}
+ data-tid="fileContainerPrevFile"
+ onClick={() => dispatch(AppActions.openPrevFile())}
+ size="large"
+ >
+ <PrevDocumentIcon />
+ </IconButton>
+ </Tooltip>
+ <Tooltip title={i18n.t('core:openNextFileTooltip')}>
+ <IconButton
+ aria-label={i18n.t('core:openNextFileTooltip')}
+ data-tid="fileContainerNextFile"
+ onClick={() => dispatch(AppActions.openNextFile())}
+ size="large"
+ >
+ <NextDocumentIcon />
+ </IconButton>
+ </Tooltip>
+ </>
+ )}
+ <Tooltip title={i18n.t('core:closeEntry')}>
+ <IconButton
+ onClick={startClosingFile}
+ aria-label={i18n.t('core:closeEntry')}
+ data-tid="fileContainerCloseOpenedFile"
+ size="large"
+ >
+ <CloseIcon />
+ </IconButton>
+ </Tooltip>
+ </div>
+ );
+}
+
+export default EntryContainerNav;
diff --git a/app/components/EntryContainerTabs.tsx b/app/components/EntryContainerTabs.tsx
new file mode 100644
index 000000000..e5621f116
--- /dev/null
+++ b/app/components/EntryContainerTabs.tsx
@@ -0,0 +1,280 @@
+/**
+ * TagSpaces - universal file and folder organizer
+ * Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License (version 3) as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+import React, { useRef } from 'react';
+import { styled, useTheme } from '@mui/material/styles';
+import { useSelector, useDispatch } from 'react-redux';
+import Tabs from '@mui/material/Tabs';
+import Tab from '@mui/material/Tab';
+import Typography from '@mui/material/Typography';
+import Box from '@mui/material/Box';
+import {
+ actions as AppActions,
+ AppDispatch,
+ getDirectoryPath,
+ isReadOnlyMode,
+ OpenedEntry
+} from '-/reducers/app';
+import i18n from '-/services/i18n';
+import { Pro } from '-/pro';
+import Revisions from '-/components/Revisions';
+import EntryProperties from '-/components/EntryProperties';
+import TaggingActions from '-/reducers/tagging-actions';
+import { TS } from '-/tagspaces.namespace';
+import { getMapTileServer } from '-/reducers/settings';
+import EditDescription from '-/components/EditDescription';
+
+interface StyledTabsProps {
+ children?: React.ReactNode;
+ value: number;
+ onChange: (event: React.SyntheticEvent, newValue: number) => void;
+}
+
+const StyledTabs = styled((props: StyledTabsProps) => (
+ <Tabs
+ {...props}
+ variant="scrollable"
+ scrollButtons="auto"
+ TabIndicatorProps={{ children: <span className="MuiTabs-indicatorSpan" /> }}
+ />
+))(({ theme }) => ({
+ '& .MuiTabs-indicator': {
+ display: 'flex',
+ justifyContent: 'center',
+ backgroundColor: 'transparent'
+ },
+ '& .MuiTabs-indicatorSpan': {
+ maxWidth: 40,
+ width: '100%',
+ backgroundColor: theme.palette.text.primary //theme.palette.background.default //'#635ee7',
+ }
+}));
+
+interface StyledTabProps {
+ label: string;
+ onClick: (event: React.SyntheticEvent) => void;
+}
+
+const StyledTab = styled((props: StyledTabProps) => (
+ <Tab disableRipple {...props} />
+))(({ theme }) => ({
+ textTransform: 'none',
+ fontWeight: theme.typography.fontWeightRegular,
+ fontSize: theme.typography.pxToRem(15),
+ marginRight: theme.spacing(1)
+ // color: 'rgba(255, 255, 255, 0.7)',
+ /*'&.Mui-selected': {
+ color: '#fff',
+ },*/
+ /*'&.Mui-focusVisible': {
+ backgroundColor: 'rgba(100, 95, 228, 0.32)',
+ },*/
+}));
+
+function a11yProps(index: number) {
+ return {
+ id: `tab-${index}`,
+ 'aria-controls': `simple-tabpanel-${index}`
+ };
+}
+
+interface Props {
+ openedFile: OpenedEntry;
+ openPanel: () => void;
+ toggleProperties: () => void;
+ marginRight: string;
+}
+
+interface TabPanelProps {
+ children?: React.ReactNode;
+ index: number;
+ value: number;
+}
+
+function EntryContainerTabs(props: Props) {
+ const [value, setValue] = React.useState(0);
+ const { openedFile, openPanel, toggleProperties, marginRight } = props;
+ const editDescription = useRef<string>(undefined);
+ //const theme = useTheme();
+ const readOnlyMode = useSelector(isReadOnlyMode);
+ const directoryPath = useSelector(getDirectoryPath);
+ const tileServer = useSelector(getMapTileServer);
+ const dispatch: AppDispatch = useDispatch();
+
+ function TsTabPanel(tprops: TabPanelProps) {
+ const { children, value, index, ...other } = tprops;
+
+ return (
+ <div
+ role="tabpanel"
+ hidden={value !== index}
+ id={`simple-tabpanel-${index}`}
+ aria-labelledby={`simple-tab-${index}`}
+ {...other}
+ style={{
+ height: '100%',
+ overflowY: 'auto',
+ padding: 10,
+ ...(openedFile.isFile && { maxHeight: 400 })
+ }}
+ >
+ {value === index && children}
+ </div>
+ );
+ }
+
+ // Create functions that dispatch actions
+ const handleRenameFile = (filePath: string, newFilePath: string) =>
+ dispatch(AppActions.renameFile(filePath, newFilePath));
+
+ const handleRenameDirectory = (
+ directoryPath: string,
+ newDirectoryName: string
+ ) => dispatch(AppActions.renameDirectory(directoryPath, newDirectoryName));
+
+ const handleAddTags = (
+ paths: Array<string>,
+ tags: Array<TS.Tag>,
+ updateIndex = true
+ ) => dispatch(TaggingActions.addTags(paths, tags, updateIndex));
+
+ const handleChange = (event: React.SyntheticEvent, newValue: number) => {
+ setValue(newValue);
+ openPanel();
+ };
+ const handleTabClick = (event: React.SyntheticEvent) => {
+ if (
+ openedFile.isFile &&
+ value === parseInt(event.currentTarget.id.split('-')[1], 10)
+ ) {
+ // when selected tab is clicked...
+ setValue(undefined);
+ toggleProperties();
+ }
+ };
+
+ const toggleEditDescriptionField = () => {
+ if (readOnlyMode) {
+ editDescription.current = undefined;
+ return;
+ }
+ if (!Pro) {
+ dispatch(
+ AppActions.showNotification(
+ i18n.t('core:thisFunctionalityIsAvailableInPro')
+ )
+ );
+ return;
+ }
+ if (!Pro.MetaOperations) {
+ dispatch(
+ AppActions.showNotification(i18n.t('Saving description not supported'))
+ );
+ return;
+ }
+ if (editDescription.current !== undefined) {
+ dispatch(AppActions.switchLocationTypeByID(openedFile.locationId)).then(
+ currentLocationId => {
+ Pro.MetaOperations.saveFsEntryMeta(openedFile.path, {
+ description: editDescription.current
+ })
+ .then(entryMeta => {
+ editDescription.current = undefined;
+ dispatch(AppActions.updateOpenedFile(openedFile.path, entryMeta));
+ dispatch(AppActions.switchCurrentLocationType(currentLocationId));
+ return true;
+ })
+ .catch(error => {
+ console.warn('Error saving description ' + error);
+ editDescription.current = undefined;
+ dispatch(AppActions.switchCurrentLocationType(currentLocationId));
+ dispatch(
+ AppActions.showNotification(i18n.t('Error saving description'))
+ );
+ });
+ }
+ );
+ } else if (openedFile.description) {
+ editDescription.current = openedFile.description;
+ } else {
+ editDescription.current = '';
+ }
+ };
+
+ return (
+ <Box sx={{ width: '100%', height: '100%' }}>
+ <Box sx={{ ...(marginRight && { marginRight }) }}>
+ <StyledTabs
+ value={value}
+ onChange={handleChange}
+ aria-label="basic tabs example"
+ >
+ <StyledTab
+ data-tid="detailsTabTID"
+ label={i18n.t('core:details')}
+ {...a11yProps(0)}
+ onClick={handleTabClick}
+ />
+ <StyledTab
+ data-tid="descriptionTabTID"
+ label={i18n.t('core:filePropertiesDescription')}
+ {...a11yProps(1)}
+ onClick={handleTabClick}
+ />
+ {openedFile.isFile && (
+ <StyledTab
+ data-tid="revisionsTabTID"
+ label={i18n.t('core:revisions')}
+ {...a11yProps(2)}
+ onClick={handleTabClick}
+ />
+ )}
+ </StyledTabs>
+ </Box>
+ <TsTabPanel value={value} index={0}>
+ <EntryProperties
+ key={openedFile.path}
+ openedEntry={openedFile}
+ renameFile={handleRenameFile}
+ renameDirectory={handleRenameDirectory}
+ addTags={handleAddTags}
+ isReadOnlyMode={readOnlyMode}
+ currentDirectoryPath={directoryPath}
+ tileServer={tileServer}
+ />
+ </TsTabPanel>
+ <TsTabPanel value={value} index={1}>
+ <EditDescription
+ toggleEditDescriptionField={
+ !readOnlyMode && !openedFile.editMode && toggleEditDescriptionField
+ }
+ description={openedFile.description}
+ setEditDescription={md => (editDescription.current = md)}
+ currentFolder={directoryPath}
+ />
+ </TsTabPanel>
+ {openedFile.isFile && (
+ <TsTabPanel value={value} index={2}>
+ <Revisions />
+ </TsTabPanel>
+ )}
+ </Box>
+ );
+}
+
+export default EntryContainerTabs;
diff --git a/app/components/EntryProperties.tsx b/app/components/EntryProperties.tsx
index d94062887..25fdaef7e 100644
--- a/app/components/EntryProperties.tsx
+++ b/app/components/EntryProperties.tsx
@@ -67,7 +67,8 @@ import {
convertMarkDown,
fileNameValidation,
dirNameValidation,
- normalizeUrl
+ normalizeUrl,
+ getSharingLink
} from '-/services/utils-io';
import { getUuid } from '@tagspaces/tagspaces-common/utils-io';
import { parseGeoLocation } from '-/utils/geo';
@@ -76,7 +77,7 @@ import PlatformIO from '../services/platform-facade';
import TagsSelect from './TagsSelect';
import TransparentBackground from './TransparentBackground';
import { getThumbnailURLPromise } from '-/services/thumbsgenerator';
-import { getCurrentLanguage } from '-/reducers/settings';
+import { getCurrentLanguage, getTagDelimiter } from '-/reducers/settings';
import {
getLastBackgroundImageChange,
getLastThumbnailImageChange,
@@ -94,14 +95,13 @@ import { ProTooltip } from '-/components/HelperComponents';
import PerspectiveSelector from '-/components/PerspectiveSelector';
import { connect } from 'react-redux';
import FormHelperText from '@mui/material/FormHelperText';
-import { MilkdownRef } from '@tagspaces/tagspaces-md';
-import EditDescription from '-/components/EditDescription';
import { bindActionCreators } from 'redux';
-import { actions as LocationActions } from '-/reducers/locations';
+import { actions as LocationActions, getLocations } from '-/reducers/locations';
import { actions as AppActions } from '-/reducers/app';
import useFirstRender from '-/utils/useFirstRender';
import LinkGeneratorDialog from '-/components/dialogs/LinkGeneratorDialog';
import { LinkIcon } from '-/components/CommonIcons';
+import TaggingActions from '-/reducers/tagging-actions';
const PREFIX = 'EntryProperties';
@@ -122,8 +122,6 @@ const Root = styled('div')(({ theme }) => ({
overflowY: 'auto',
overflowX: 'hidden',
flexGrow: 1,
- padding: 7,
- paddingRight: 2,
height: '100%',
[`& .${classes.tags}`]: {
@@ -194,6 +192,7 @@ const BgndImgChooserDialog =
interface Props {
language: string;
openedEntry: OpenedEntry;
+ locations: Array<TS.Location>;
renameFile: (path: string, nextPath: string) => Promise<boolean>;
renameDirectory: (path: string, nextPath: string) => Promise<boolean>;
showNotification: (message: string) => void;
@@ -207,7 +206,6 @@ interface Props {
isReadOnlyMode: boolean;
// currentDirectoryPath: string | null;
tagDelimiter: string;
- sharingLink: string;
tileServer: TS.MapTileServer;
lastBackgroundImageChange: any;
lastThumbnailImageChange: any;
@@ -240,25 +238,6 @@ function EntryProperties(props: Props) {
)
: props.openedEntry.path;
- const printHTML = () => {
- const sanitizedDescription = currentEntry.current.description
- ? convertMarkDown(currentEntry.current.description, directoryPath)
- : i18n.t('core:addMarkdownDescription');
-
- const printWin = window.open('', 'PRINT', 'height=400,width=600');
- printWin.document.write(
- '<html><head><title>' + entryName + ' description</title>'
- );
- printWin.document.write('</head><body >');
- printWin.document.write(sanitizedDescription);
- printWin.document.write('</body></html>');
- printWin.document.close(); // necessary for IE >= 10
- printWin.focus(); // necessary for IE >= 10*/
- printWin.print();
- // printWin.close();
- return true;
- };
-
const entryName = props.openedEntry.isFile
? extractFileName(props.openedEntry.path, PlatformIO.getDirSeparator())
: extractDirectoryName(
@@ -270,7 +249,6 @@ function EntryProperties(props: Props) {
enhanceOpenedEntry(props.openedEntry, props.tagDelimiter)
);
const [editName, setEditName] = useState<string>(undefined);
- const editDescription = useRef<string>(undefined);
const [isMoveCopyFilesDialogOpened, setMoveCopyFilesDialogOpened] = useState<
boolean
>(false);
@@ -402,46 +380,6 @@ function EntryProperties(props: Props) {
}
};
- const toggleEditDescriptionField = () => {
- if (props.isReadOnlyMode) {
- editDescription.current = undefined;
- return;
- }
- if (!Pro) {
- props.showNotification(i18n.t('core:thisFunctionalityIsAvailableInPro'));
- return;
- }
- if (!Pro.MetaOperations) {
- props.showNotification(i18n.t('Saving description not supported'));
- return;
- }
- if (editDescription.current !== undefined) {
- props
- .switchLocationType(props.openedEntry.locationId)
- .then(currentLocationId => {
- Pro.MetaOperations.saveFsEntryMeta(currentEntry.current.path, {
- description: editDescription.current
- })
- .then(entryMeta => {
- editDescription.current = undefined;
- props.updateOpenedFile(currentEntry.current.path, entryMeta);
- props.switchCurrentLocationType(currentLocationId);
- return true;
- })
- .catch(error => {
- console.warn('Error saving description ' + error);
- editDescription.current = undefined;
- props.switchCurrentLocationType(currentLocationId);
- props.showNotification(i18n.t('Error saving description'));
- });
- });
- } else if (currentEntry.current.description) {
- editDescription.current = currentEntry.current.description;
- } else {
- editDescription.current = '';
- }
- };
-
const toggleMoveCopyFilesDialog = () => {
/*props.setSelectedEntries([
{ name: '', isFile: true, tags: [], ...currentEntry.current }
@@ -454,11 +392,7 @@ function EntryProperties(props: Props) {
props.showNotification(i18n.t('core:thisFunctionalityIsAvailableInPro'));
return true;
}
- if (
- !currentEntry.current.editMode &&
- editName === undefined &&
- editDescription.current === undefined
- ) {
+ if (!currentEntry.current.editMode && editName === undefined) {
setFileThumbChooseDialogOpened(!isFileThumbChooseDialogOpened);
}
};
@@ -468,11 +402,7 @@ function EntryProperties(props: Props) {
props.showNotification(i18n.t('core:thisFunctionalityIsAvailableInPro'));
return true;
}
- if (
- !currentEntry.current.editMode &&
- editName === undefined &&
- editDescription.current === undefined
- ) {
+ if (!currentEntry.current.editMode && editName === undefined) {
setBgndImgChooseDialogOpened(!isBgndImgChooseDialogOpened);
}
};
@@ -641,7 +571,7 @@ function EntryProperties(props: Props) {
});
};
- const { isReadOnlyMode, sharingLink, language } = props;
+ const { isReadOnlyMode, language } = props;
if (
!currentEntry ||
@@ -774,6 +704,10 @@ function EntryProperties(props: Props) {
currentEntry.current.url && currentEntry.current.url.length > 5;
const showLinkForDownloading = isCloudLocation && currentEntry.current.isFile;
+ const { sharingLink, sharingParentFolderLink } = getSharingLink(
+ currentEntry.current,
+ props.locations
+ );
return (
<Root>
@@ -790,38 +724,36 @@ function EntryProperties(props: Props) {
readOnly: editName === undefined,
endAdornment: (
<InputAdornment position="end">
- {!isReadOnlyMode &&
- !currentEntry.current.editMode &&
- editDescription.current === undefined && (
- <div style={{ textAlign: 'right' }}>
- {editName !== undefined ? (
- <div>
- <Button
- data-tid="cancelRenameEntryTID"
- onClick={deactivateEditNameField}
- >
- {i18n.t('core:cancel')}
- </Button>
- <Button
- data-tid="confirmRenameEntryTID"
- color="primary"
- onClick={renameEntry}
- disabled={disableConfirmButton.current}
- >
- {i18n.t('core:confirmSaveButton')}
- </Button>
- </div>
- ) : (
+ {!isReadOnlyMode && !currentEntry.current.editMode && (
+ <div style={{ textAlign: 'right' }}>
+ {editName !== undefined ? (
+ <div>
+ <Button
+ data-tid="cancelRenameEntryTID"
+ onClick={deactivateEditNameField}
+ >
+ {i18n.t('core:cancel')}
+ </Button>
<Button
- data-tid="startRenameEntryTID"
+ data-tid="confirmRenameEntryTID"
color="primary"
- onClick={activateEditNameField}
+ onClick={renameEntry}
+ disabled={disableConfirmButton.current}
>
- {i18n.t('core:rename')}
+ {i18n.t('core:confirmSaveButton')}
</Button>
- )}
- </div>
- )}
+ </div>
+ ) : (
+ <Button
+ data-tid="startRenameEntryTID"
+ color="primary"
+ onClick={activateEditNameField}
+ >
+ {i18n.t('core:rename')}
+ </Button>
+ )}
+ </div>
+ )}
</InputAdornment>
)
}}
@@ -832,11 +764,7 @@ function EntryProperties(props: Props) {
defaultValue={entryName} // currentEntry.current.name}
inputRef={fileNameRef}
onClick={() => {
- if (
- !currentEntry.current.editMode &&
- editName === undefined &&
- editDescription.current === undefined
- ) {
+ if (!currentEntry.current.editMode && editName === undefined) {
activateEditNameField();
}
}}
@@ -867,7 +795,6 @@ function EntryProperties(props: Props) {
isReadOnlyMode={
isReadOnlyMode ||
currentEntry.current.editMode ||
- editDescription.current !== undefined ||
editName !== undefined
}
tags={currentEntry.current.tags}
@@ -976,23 +903,6 @@ function EntryProperties(props: Props) {
</Grid>
)}
- <Grid item xs={12}>
- <EditDescription
- classes={classes}
- primaryColor={theme.palette.text.primary}
- toggleEditDescriptionField={
- !isReadOnlyMode &&
- !currentEntry.current.editMode &&
- editName === undefined &&
- toggleEditDescriptionField
- }
- printHTML={printHTML}
- description={currentEntry.current.description}
- setEditDescription={md => (editDescription.current = md)}
- currentFolder={directoryPath}
- />
- </Grid>
-
<Grid container item xs={12} spacing={1}>
<Grid item xs={6}>
<TextField
@@ -1070,8 +980,7 @@ function EntryProperties(props: Props) {
<InputAdornment position="end">
{!isReadOnlyMode &&
!currentEntry.current.editMode &&
- editName === undefined &&
- editDescription.current === undefined && (
+ editName === undefined && (
<Button
data-tid="moveCopyEntryTID"
color="primary"
@@ -1290,8 +1199,7 @@ function EntryProperties(props: Props) {
>
{!isReadOnlyMode &&
!currentEntry.current.editMode &&
- editName === undefined &&
- editDescription.current === undefined && (
+ editName === undefined && (
<ProTooltip tooltip={i18n.t('changeThumbnail')}>
<Button fullWidth onClick={toggleThumbFilesDialog}>
{i18n.t('core:change')}
@@ -1349,8 +1257,7 @@ function EntryProperties(props: Props) {
>
{!isReadOnlyMode &&
!currentEntry.current.editMode &&
- editName === undefined &&
- editDescription.current === undefined && (
+ editName === undefined && (
<ProTooltip
tooltip={i18n.t('changeBackgroundImage')}
>
@@ -1395,7 +1302,7 @@ function EntryProperties(props: Props) {
</Grid>
)}
</Grid>
- <Grid container item xs={12} style={{ height: 150 }} />
+ {/*<Grid container item xs={12} style={{ height: 150 }} />*/}
</Grid>
{isConfirmResetColorDialogOpened && (
<ConfirmDialog
@@ -1498,8 +1405,10 @@ function EntryProperties(props: Props) {
function mapStateToProps(state) {
return {
+ tagDelimiter: getTagDelimiter(state),
lastBackgroundImageChange: getLastBackgroundImageChange(state),
lastThumbnailImageChange: getLastThumbnailImageChange(state),
+ locations: getLocations(state),
language: getCurrentLanguage(state)
};
}
@@ -1510,7 +1419,12 @@ function mapActionCreatorsToProps(dispatch) {
switchLocationType: LocationActions.switchLocationType,
switchCurrentLocationType: AppActions.switchCurrentLocationType,
setLastBackgroundColorChange: AppActions.setLastBackgroundColorChange,
- setSelectedEntries: AppActions.setSelectedEntries
+ setSelectedEntries: AppActions.setSelectedEntries,
+ removeTags: TaggingActions.removeTags,
+ removeAllTags: TaggingActions.removeAllTags,
+ updateOpenedFile: AppActions.updateOpenedFile,
+ updateThumbnailUrl: AppActions.updateThumbnailUrl,
+ showNotification: AppActions.showNotification
},
dispatch
);
diff --git a/app/components/FileView.tsx b/app/components/FileView.tsx
index cda96a6fd..4055117f5 100644
--- a/app/components/FileView.tsx
+++ b/app/components/FileView.tsx
@@ -134,9 +134,10 @@ function FileView(props: Props) {
style={{
width: '100%',
height: height || '100%',
- flex: '1 1 100%',
- display: 'flex',
- backgroundColor: theme.palette.background.default
+ //flex: '1 1 100%',
+ //display: 'flex',
+ backgroundColor: theme.palette.background.default,
+ borderTop: 'outset'
}}
>
{isFullscreen && (
@@ -162,6 +163,7 @@ function FileView(props: Props) {
ref={fileViewer}
style={{
width: '100%',
+ height: '100%',
zIndex: 3,
border: 0
}}
@@ -181,7 +183,8 @@ const areEqual = (prevProp, nextProp) =>
nextProp.openedFile.url === prevProp.openedFile.url &&
nextProp.openedFile.editMode === prevProp.openedFile.editMode &&
nextProp.openedFile.shouldReload === prevProp.openedFile.shouldReload &&
- nextProp.isFullscreen === prevProp.isFullscreen;
+ nextProp.isFullscreen === prevProp.isFullscreen &&
+ nextProp.height === prevProp.height;
// nextProp.currentTheme === prevProp.currentTheme; // Commented due to reloading of the editors with changed content
/* ((nextProp.openedFile.editMode === undefined &&
prevProp.openedFile.editMode === true) ||
diff --git a/app/components/HowToStart.tsx b/app/components/HowToStart.tsx
index 4fe1d7150..4d166ac5e 100644
--- a/app/components/HowToStart.tsx
+++ b/app/components/HowToStart.tsx
@@ -317,7 +317,7 @@ function HowToStart() {
</style>
<Typography
variant="inherit"
- sx={{
+ style={{
color: theme.palette.text.primary,
textTransform: 'uppercase',
textAlign: 'center',
diff --git a/app/components/TagsSelect.tsx b/app/components/TagsSelect.tsx
index 360951b8d..d25044b41 100644
--- a/app/components/TagsSelect.tsx
+++ b/app/components/TagsSelect.tsx
@@ -183,6 +183,7 @@ function TagsSelect(props: Props) {
<Box sx={{ flexGrow: 1 }}>
<Autocomplete
data-tid={props.dataTid}
+ disabled={isReadOnlyMode}
multiple
options={!props.isReadOnlyMode ? allTags.current : []}
getOptionLabel={(option: TS.Tag) => option.title}
@@ -216,7 +217,6 @@ function TagsSelect(props: Props) {
renderInput={params => (
<TextField
{...params}
- disabled={isReadOnlyMode}
// variant="filled"
label={label}
placeholder={placeholderText}
diff --git a/app/components/dialogs/AddRemoveTagsDialog.tsx b/app/components/dialogs/AddRemoveTagsDialog.tsx
index 6a6f6598f..ad6c643ea 100644
--- a/app/components/dialogs/AddRemoveTagsDialog.tsx
+++ b/app/components/dialogs/AddRemoveTagsDialog.tsx
@@ -49,8 +49,6 @@ interface Props {
open: boolean;
selectedEntries: Array<any>;
onClose: (clearSelection?: boolean) => void;
- removeTags: (paths: Array<string>, tags: Array<TS.Tag>) => void;
- removeAllTags: (paths: Array<string>) => void;
}
function AddRemoveTagsDialog(props: Props) {
@@ -92,9 +90,11 @@ function AddRemoveTagsDialog(props: Props) {
const removeTags = () => {
const { selectedEntries } = props;
if (selectedEntries && selectedEntries.length > 0) {
- props.removeTags(
- selectedEntries.map(entry => entry.path),
- newlyAddedTags
+ dispatch(
+ TaggingActions.removeTags(
+ selectedEntries.map(entry => entry.path),
+ newlyAddedTags
+ )
);
}
onCloseDialog(true);
@@ -103,7 +103,9 @@ function AddRemoveTagsDialog(props: Props) {
const removeAllTags = () => {
const { selectedEntries } = props;
if (selectedEntries && selectedEntries.length > 0) {
- props.removeAllTags(selectedEntries.map(entry => entry.path));
+ dispatch(
+ TaggingActions.removeAllTags(selectedEntries.map(entry => entry.path))
+ );
}
onCloseDialog(true);
};
diff --git a/app/components/dialogs/settings/SettingsExtensions.tsx b/app/components/dialogs/settings/SettingsExtensions.tsx
index 29357e8d6..4cbb06845 100644
--- a/app/components/dialogs/settings/SettingsExtensions.tsx
+++ b/app/components/dialogs/settings/SettingsExtensions.tsx
@@ -187,7 +187,7 @@ function SettingsExtensions() {
onClick={() => {
setRemoveExtDialogOpened(ext);
}}
- data-tid="revisionsTID"
+ data-tid="removeExtensionTID"
size="large"
>
<DeleteIcon color={'action'} />
diff --git a/app/locales/en/core.json b/app/locales/en/core.json
index 69a801e6b..85ca801cb 100644
--- a/app/locales/en/core.json
+++ b/app/locales/en/core.json
@@ -801,5 +801,6 @@
"copyToClipboard": "Copy to clipboard",
"generatedHTMLCopied": "Download links copied to clipboard",
"generatedHTMLFailed": "Error while copying to clipboard",
+ "details": "Details",
"-": "-"
}
diff --git a/app/perspectives/grid-perspective/components/GridPagination.tsx b/app/perspectives/grid-perspective/components/GridPagination.tsx
index 624a17c67..9b7ae28be 100644
--- a/app/perspectives/grid-perspective/components/GridPagination.tsx
+++ b/app/perspectives/grid-perspective/components/GridPagination.tsx
@@ -439,7 +439,8 @@ function GridPagination(props: Props) {
marginRight: 10,
marginTop: 0,
marginBottom: 0,
- height: 150,
+ height:
+ !showDescription && currentDirectoryDescription ? 150 : 110,
position: 'relative'
}}
>
@@ -465,7 +466,10 @@ function GridPagination(props: Props) {
>
<ButtonBase
style={{ fontSize: '1.5rem' }}
- onClick={openRenameEntryDialog}
+ onClick={() => {
+ setSelectedEntries([]);
+ openRenameEntryDialog();
+ }}
>
{folderName}
</ButtonBase>
@@ -508,16 +512,16 @@ function GridPagination(props: Props) {
{folderSummary}
</Typography>
{!showDescription && currentDirectoryDescription && (
- <Tooltip title={i18n.t('core:filePropertiesDescription')}>
- <Typography
- style={{
- fontSize: '0.8rem',
- wordBreak: 'break-all'
- }}
- >
- {currentDirectoryDescription}
- </Typography>
- </Tooltip>
+ <Typography
+ style={{
+ fontSize: '0.8rem',
+ wordBreak: 'break-all',
+ height: 45,
+ overflowY: 'auto'
+ }}
+ >
+ {currentDirectoryDescription}
+ </Typography>
)}
</Box>
<Tooltip title={i18n.t('core:thumbnail')}>
@@ -529,7 +533,7 @@ function GridPagination(props: Props) {
backgroundImage: 'url("' + folderTmbPath.current + '")',
backgroundSize: 'cover', // cover contain
backgroundRepeat: 'no-repeat',
- backgroundPosition: 'top center',
+ backgroundPosition: 'center center',
position: 'absolute',
top: 0,
right: 0
@@ -548,8 +552,8 @@ function GridPagination(props: Props) {
marginTop: showDetails ? 0 : 10,
marginLeft: 25,
marginRight: 10,
- padding: 2,
- borderRadius: 5
+ padding: 10,
+ borderRadius: 10
}}
>
<MilkdownEditor
diff --git a/app/perspectives/grid-perspective/components/MainContainer.tsx b/app/perspectives/grid-perspective/components/MainContainer.tsx
index 57c3e83ac..6571a09cc 100644
--- a/app/perspectives/grid-perspective/components/MainContainer.tsx
+++ b/app/perspectives/grid-perspective/components/MainContainer.tsx
@@ -72,7 +72,6 @@ interface Props {
showInFileManager: (path: string) => void;
loadParentDirectoryContent: () => void;
removeTags: (paths: Array<string>, tags: Array<TS.Tag>) => void;
- removeAllTags: () => void;
directoryContent: Array<TS.FileSystemEntry>;
lastSearchTimestamp: number;
}
@@ -101,7 +100,6 @@ function GridPerspective(props: Props) {
openEntry,
loadDirectoryContent,
removeTags,
- removeAllTags,
showInFileManager,
openDirectory
} = props;
@@ -838,8 +836,6 @@ function GridPerspective(props: Props) {
<AddRemoveTagsDialog
open={isAddRemoveTagsDialogOpened}
onClose={() => setIsAddRemoveTagsDialogOpened(false)}
- removeTags={removeTags}
- removeAllTags={removeAllTags}
selectedEntries={selectedEntries}
/>
)}
diff --git a/app/perspectives/grid-perspective/components/styles.css.tsx b/app/perspectives/grid-perspective/components/styles.css.tsx
index d0e62aaeb..9384b6746 100644
--- a/app/perspectives/grid-perspective/components/styles.css.tsx
+++ b/app/perspectives/grid-perspective/components/styles.css.tsx
@@ -152,6 +152,7 @@ export const GridStyles = styled('div')(({ theme }) => ({
backdropFilter: 'blur(5px)',
// borderBottom: '1px solid ' + theme.palette.divider,
width: 'calc(100% - 10px)',
- overflowX: 'auto'
+ overflowX: 'auto',
+ overflowY: 'hidden'
}
}));
diff --git a/app/perspectives/list/components/MainContainer.tsx b/app/perspectives/list/components/MainContainer.tsx
index f7a8e466f..28c13daa6 100644
--- a/app/perspectives/list/components/MainContainer.tsx
+++ b/app/perspectives/list/components/MainContainer.tsx
@@ -72,7 +72,6 @@ interface Props {
showInFileManager: (path: string) => void;
loadParentDirectoryContent: () => void;
removeTags: (paths: Array<string>, tags: Array<TS.Tag>) => void;
- removeAllTags: () => void;
directoryContent: Array<TS.FileSystemEntry>;
lastSearchTimestamp: number;
}
@@ -101,7 +100,6 @@ function ListPerspective(props: Props) {
openEntry,
loadDirectoryContent,
removeTags,
- removeAllTags,
showInFileManager,
openDirectory
} = props;
@@ -835,8 +833,6 @@ function ListPerspective(props: Props) {
<AddRemoveTagsDialog
open={isAddRemoveTagsDialogOpened}
onClose={() => setIsAddRemoveTagsDialogOpened(false)}
- removeTags={removeTags}
- removeAllTags={removeAllTags}
selectedEntries={selectedEntries}
/>
)}
diff --git a/app/reducers/app.ts b/app/reducers/app.ts
index bc2c36ae0..ed0940baa 100644
--- a/app/reducers/app.ts
+++ b/app/reducers/app.ts
@@ -556,10 +556,16 @@ export default (state: any = initialState, action: any) => {
};
}
case types.SET_CURRENT_DIRECTORY_DIRS: {
- return {
- ...state,
- currentDirectoryDirs: action.dirs
- };
+ if (
+ JSON.stringify(state.currentDirectoryDirs) !==
+ JSON.stringify(action.dirs)
+ ) {
+ return {
+ ...state,
+ currentDirectoryDirs: action.dirs
+ };
+ }
+ return state;
}
case types.CLEAR_UPLOAD_DIALOG: {
// if (PlatformIO.haveObjectStoreSupport()) {
@@ -1524,10 +1530,14 @@ export const actions = {
); */
// console.debug('Loading meta succeeded for:' + directoryPath);
dispatch(
- actions.loadDirectoryContentInt(directoryPath, generateThumbnails, {
+ actions.loadDirectoryContentInt(
+ directoryPath,
+ generateThumbnails,
+ fsEntryMeta /*{
...fsEntryMeta,
description: getDescriptionPreview(fsEntryMeta.description, 200)
- })
+ }*/
+ )
);
} catch (err) {
console.debug('Error loading meta of:' + directoryPath + ' ' + err);
diff --git a/app/services/utils-io.ts b/app/services/utils-io.ts
index 5f0177864..a6114bbef 100644
--- a/app/services/utils-io.ts
+++ b/app/services/utils-io.ts
@@ -46,7 +46,9 @@ import {
getThumbFileLocationForFile,
getThumbFileLocationForDirectory,
getBgndFileLocationForDirectory,
- cleanFrontDirSeparator
+ cleanFrontDirSeparator,
+ generateSharingLink,
+ cleanRootPath
} from '@tagspaces/tagspaces-common/paths';
import AppConfig from '-/AppConfig';
import PlatformIO from './platform-facade';
@@ -1036,23 +1038,26 @@ export async function loadLocationDataPromise(
/**
* if you have entryProperties.isFile prefer to use loadFileMetaDataPromise/loadDirMetaDataPromise
* @param path
+ * @param fullDescription
*/
export function loadMetaDataPromise(
- path: string
+ path: string,
+ fullDescription = false
): Promise<TS.FileSystemEntryMeta> {
return PlatformIO.getPropertiesPromise(path).then(entryProperties => {
if (entryProperties) {
if (entryProperties.isFile) {
- return loadFileMetaDataPromise(path);
+ return loadFileMetaDataPromise(path, fullDescription);
}
- return loadDirMetaDataPromise(path);
+ return loadDirMetaDataPromise(path, fullDescription);
}
throw new Error('loadMetaDataPromise not exist' + path);
});
}
export function loadFileMetaDataPromise(
- path: string
+ path: string,
+ fullDescription = false
): Promise<TS.FileSystemEntryMeta> {
const metaFilePath = getMetaFileLocationForFile(
path,
@@ -1065,7 +1070,9 @@ export function loadFileMetaDataPromise(
return {
...metaData,
isFile: true,
- description: getDescriptionPreview(metaData.description, 200),
+ description: fullDescription
+ ? metaData.description
+ : getDescriptionPreview(metaData.description, 200),
color: metaData.color || '',
tags: metaData.tags || [],
appName: metaData.appName || '',
@@ -1076,7 +1083,8 @@ export function loadFileMetaDataPromise(
}
export function loadDirMetaDataPromise(
- path: string
+ path: string,
+ fullDescription = false
): Promise<TS.FileSystemEntryMeta> {
const metaDirPath = getMetaFileLocationForDir(
path,
@@ -1090,7 +1098,9 @@ export function loadDirMetaDataPromise(
...metaData,
id: metaData.id || getUuid(),
isFile: false,
- description: getDescriptionPreview(metaData.description, 200),
+ description: fullDescription
+ ? metaData.description
+ : getDescriptionPreview(metaData.description, 200),
color: metaData.color || '',
perspective: metaData.perspective || '',
tags: metaData.tags || [],
@@ -1770,3 +1780,48 @@ export function openURLExternally(url: string, skipConfirmation = false) {
PlatformIO.openUrl(url);
}
}
+
+export function getSharingLink(
+ openedFile: OpenedEntry,
+ locations: Array<TS.Location>
+) {
+ let sharingLink = '';
+ let sharingParentFolderLink = '';
+ if (window.location.href.indexOf('?') > 0) {
+ const sharingURL = new URL(window.location.href);
+ const params = new URLSearchParams(sharingURL.search);
+ if (params.has('tslid')) {
+ const locationId = params.get('tslid');
+ //if (params.has('tsdpath')) {
+ // const folderPath2 = params.get('tsdpath');
+ const folderLocation = locations.find(
+ location => location.uuid === locationId
+ );
+ const folderPath = extractContainingDirectoryPath(openedFile.path);
+ if (folderPath.indexOf(folderLocation.path) === 0) {
+ sharingParentFolderLink = generateSharingLink(
+ locationId,
+ undefined,
+ cleanRootPath(
+ folderPath,
+ folderLocation.path,
+ PlatformIO.getDirSeparator()
+ )
+ );
+ }
+
+ //}
+ if (params.has('tsepath')) {
+ const entryPath = params.get('tsepath');
+ if (openedFile.isFile) {
+ sharingLink = generateSharingLink(locationId, entryPath);
+ } else {
+ sharingLink = generateSharingLink(locationId, undefined, entryPath);
+ }
+ } else {
+ sharingLink = generateSharingLink(locationId);
+ }
+ }
+ }
+ return { sharingLink, sharingParentFolderLink };
+}
diff --git a/tests/e2e/fileopener.pw.e2e.js b/tests/e2e/fileopener.pw.e2e.js
index 9d892758b..c919a27fd 100644
--- a/tests/e2e/fileopener.pw.e2e.js
+++ b/tests/e2e/fileopener.pw.e2e.js
@@ -68,7 +68,7 @@ test.describe('TST08 - File folder properties', () => {
// open fileProperties
await clickOn(selectorFile);
//Toggle Properties
- await clickOn('[data-tid=fileContainerToggleProperties]');
+ //await clickOn('[data-tid=fileContainerToggleProperties]');
const propsFileName = await getPropertiesFileName();
const firstFileName = await getGridFileName(0);
@@ -88,7 +88,7 @@ test.describe('TST08 - File folder properties', () => {
// open fileProperties
await clickOn(selectorFile);
//Toggle Properties
- await clickOn('[data-tid=fileContainerToggleProperties]');
+ //await clickOn('[data-tid=fileContainerToggleProperties]');
const propsFileName = await getPropertiesFileName();
const firstFileName = await getGridFileName(0);
@@ -105,7 +105,7 @@ test.describe('TST08 - File folder properties', () => {
// open fileProperties
await clickOn(selectorFile);
//Toggle Properties
- await clickOn('[data-tid=fileContainerToggleProperties]');
+ //await clickOn('[data-tid=fileContainerToggleProperties]');
const propsFileName = await getPropertiesFileName();
const firstFileName = await getGridFileName(0);
@@ -126,12 +126,15 @@ test.describe('TST08 - File folder properties', () => {
//await clickOn('[data-tid=location_supported-filestypes]');
// open fileProperties
await clickOn(selectorFile);
- //await clickOn('[data-tid=openInFullWidthTID]'); // dummy click -first click in openInFullWidthTID dont work
+ await clickOn('[data-tid=propsActionsMenuTID]');
await clickOn('[data-tid=openInFullWidthTID]');
const folderSelector = await global.client.$(
'[data-tid=folderContainerTID]'
); //.isHidden();
expect(await folderSelector.isHidden()).toBe(true);
+ await clickOn('[data-tid=propsActionsMenuTID]');
+ await clickOn('[data-tid=openInFullWidthTID]');
+ await clickOn('[id=mobileMenuButton]');
// expect(global.client).toHaveSelector('[data-tid=folderContainerTID]');
});
@@ -144,7 +147,7 @@ test.describe('TST08 - File folder properties', () => {
// open fileProperties
await clickOn(getGridFileSelector(fileName));
//Toggle Properties
- await clickOn('[data-tid=fileContainerToggleProperties]');
+ //await clickOn('[data-tid=fileContainerToggleProperties]');
await AddRemovePropertiesTags(['test-tag1', 'test-tag2'], {
add: true,
@@ -187,7 +190,7 @@ test.describe('TST08 - File folder properties', () => {
// open fileProperties
await clickOn(selectorFile);
//Toggle Properties
- await clickOn('[data-tid=fileContainerToggleProperties]');
+ //await clickOn('[data-tid=fileContainerToggleProperties]');
await AddRemovePropertiesTags(['test-tag1', 'test-tag2']);
});
@@ -199,7 +202,7 @@ test.describe('TST08 - File folder properties', () => {
// open fileProperties
await clickOn(selectorFile);
//Toggle Properties
- await clickOn('[data-tid=fileContainerToggleProperties]');
+ //await clickOn('[data-tid=fileContainerToggleProperties]');
await AddRemovePropertiesTags(['test-tag1', 'test-tag2']);
});
@@ -217,7 +220,7 @@ test.describe('TST08 - File folder properties', () => {
'[data-tid=perspectiveGridFileTable]'
);
await clickOn(getGridFileSelector('sample[' + tagName + '].txt'));
- await clickOn('[data-tid=fileContainerToggleProperties]');
+ //await clickOn('[data-tid=fileContainerToggleProperties]');
const propsTags = await getPropertiesTags();
expect(propsTags).toContain(tagName);
@@ -238,13 +241,14 @@ test.describe('TST08 - File folder properties', () => {
const fileSelector = getGridFileSelector('sample.pdf');
// open fileProperties
await clickOn(fileSelector);
- await clickOn('[data-tid=fileContainerToggleProperties]');
+ //await clickOn('[data-tid=fileContainerToggleProperties]');
+ await clickOn('[data-tid=descriptionTabTID]');
await clickOn('[data-tid=editDescriptionTID]');
//await global.client.dblclick('[data-tid=descriptionTID]');
await clickOn('[data-tid=descriptionTID]');
const editor = await global.client.waitForSelector(
- '[data-tid=descriptionTID] .milkdown'
+ '[data-tid=descriptionTID] [contenteditable=true]'
);
await editor.type(desc);
@@ -269,13 +273,13 @@ test.describe('TST08 - File folder properties', () => {
// open fileProperties
await clickOn(getGridFileSelector('sample.txt'));
//Toggle Properties
- await clickOn('[data-tid=fileContainerToggleProperties]');
+ //await clickOn('[data-tid=fileContainerToggleProperties]');
await expectFileContain();
const newFileContent = 'testing_file_content';
await createFile('sample.txt', newFileContent, '.');
-
+ await clickOn('[data-tid=propsActionsMenuTID]');
await clickOn('[data-tid=reloadPropertiesTID]');
await expectFileContain(newFileContent);
});
@@ -301,7 +305,7 @@ test.describe('TST08 - File folder properties', () => {
await clickOn(getGridFileSelector(fileName));
//Toggle Properties
- await clickOn('[data-tid=fileContainerToggleProperties]');
+ //await clickOn('[data-tid=fileContainerToggleProperties]');
// add meta json to file
await setSettings('[data-tid=settingsSetPersistTagsInSidecarFile]', true);
await AddRemovePropertiesTags(['test-tag1', 'test-tag2'], {
@@ -315,6 +319,7 @@ test.describe('TST08 - File folder properties', () => {
await expectMetaFilesExist(arrayMeta, true);
+ await clickOn('[data-tid=propsActionsMenuTID]');
await clickOn('[data-tid=deleteEntryTID]');
await clickOn('[data-tid=confirmSaveBeforeCloseDialog]');
await expectElementExist(getGridFileSelector(fileName), false, 5000);
@@ -330,13 +335,15 @@ test.describe('TST08 - File folder properties', () => {
await clickOn('[data-tid=fileContainerSaveFile]');
//Toggle Revisions
- await clickOn('[data-tid=revisionsTID]');
+ await clickOn('[data-tid=revisionsTabTID]');
+ //await clickOn('[data-tid=revisionsTID]');
await expectElementExist('[data-tid=viewRevisionTID]');
const revision = await getRevision(0);
expect(revision).not.toBeUndefined();
await expectMetaFilesExist([revision.file], true, revision.id);
+ await clickOn('[data-tid=propsActionsMenuTID]');
await clickOn('[data-tid=deleteEntryTID]');
await clickOn('[data-tid=confirmSaveBeforeCloseDialog]');
await expectElementExist(getGridFileSelector(fileName), false, 5000);
@@ -352,6 +359,7 @@ test.describe('TST08 - File folder properties', () => {
if (global.isWin) {
// open fileProperties
await clickOn(selectorFile);
+ await clickOn('[data-tid=propsActionsMenuTID]');
await clickOn('[data-tid=fileContainerSwitchToFullScreen]');
await expectElementExist('[data-tid=fullscreenTID]', true, 10000);
// await takeScreenshot('TST0814 fullscreenTID exist true');
@@ -382,7 +390,7 @@ test.describe('TST08 - File folder properties', () => {
test('TST0827 - Link for internal sharing + copy [web,minio,electron]', async () => {
const fileName = 'sample.jpg';
await clickOn(getGridFileSelector(fileName));
- await clickOn('[data-tid=fileContainerToggleProperties]');
+ //await clickOn('[data-tid=fileContainerToggleProperties]');
const sharingLink = await global.client.$(
'[data-tid=sharingLinkTID] input'
diff --git a/tests/e2e/folderprops.pw.e2e.js b/tests/e2e/folderprops.pw.e2e.js
index 43e06a791..9cd4e2c18 100644
--- a/tests/e2e/folderprops.pw.e2e.js
+++ b/tests/e2e/folderprops.pw.e2e.js
@@ -62,7 +62,7 @@ test.describe('TST02 - Folder properties', () => {
test('TST0201 - Open in main area [web,minio,electron]', async () => {
const testFile = 'file_in_empty_folder.txt';
await createFile(testFile);
-
+ await clickOn('[data-tid=propsActionsMenuTID]');
await clickOn('[data-tid=openInMainAreaTID]');
await expectElementExist(getGridFileSelector(testFile), true, 5000);
});
@@ -89,6 +89,7 @@ test.describe('TST02 - Folder properties', () => {
};
await createFile('tsm.json', JSON.stringify(tsmJson), 'empty_folder/.ts');
+ await clickOn('[data-tid=propsActionsMenuTID]');
await clickOn('[data-tid=reloadFolderTID]');
// propsTags = await getPropertiesTags();
@@ -101,8 +102,10 @@ test.describe('TST02 - Folder properties', () => {
4000
);
+ await clickOn('[data-tid=descriptionTabTID]');
+ // await clickOn('[data-tid=editDescriptionTID]');
const editor = await global.client.waitForSelector(
- '[data-tid=descriptionTID] .milkdown'
+ '[data-tid=descriptionTID] .milkdown' //[contenteditable=true]'
);
const description = await editor.innerText();
expect(description.replace(/[\s*#]/g, '')).toMatch(
@@ -111,6 +114,7 @@ test.describe('TST02 - Folder properties', () => {
});
test('TST0205 - Delete folder from toolbar [web,minio,electron]', async () => {
+ await clickOn('[data-tid=propsActionsMenuTID]');
await clickOn('[data-tid=deleteFolderTID]');
await clickOn('[data-tid=confirmSaveBeforeCloseDialog]');
await expectElementExist('OpenedTIDempty_folder', false, 5000);
@@ -182,11 +186,12 @@ test.describe('TST02 - Folder properties', () => {
test('TST0213 - Add description to folder [web,minio,electron,_pro]', async () => {
const desc = 'test description';
+ await clickOn('[data-tid=descriptionTabTID]');
await clickOn('[data-tid=editDescriptionTID]');
// await global.client.dblclick('[data-tid=descriptionTID]');
await clickOn('[data-tid=descriptionTID]');
const editor = await global.client.waitForSelector(
- '[data-tid=descriptionTID] .milkdown'
+ '[data-tid=descriptionTID] [contenteditable=true]'
);
await editor.type(desc);
const editorContent = await editor.innerText();
diff --git a/tests/e2e/key-bindings.pw.e2e.js b/tests/e2e/key-bindings.pw.e2e.js
index f63f10fb5..438ecafcf 100644
--- a/tests/e2e/key-bindings.pw.e2e.js
+++ b/tests/e2e/key-bindings.pw.e2e.js
@@ -64,7 +64,7 @@ test.describe('TST13 - Settings Key Bindings [electron]', () => {
test('TST1313 - Test open file [electron]', async () => {
await clickOn(selectorFile);
await global.client.keyboard.press('Enter');
- await expectElementExist('[data-tid=fileContainerToggleProperties]', true);
+ await expectElementExist('[data-tid=detailsTabTID]', true);
});
test('TST1315 - Test delete file [electron]', async () => {
diff --git a/tests/e2e/perspective-grid-right-button.pw.e2e.js b/tests/e2e/perspective-grid-right-button.pw.e2e.js
index 36f2d2a9e..e0304948f 100644
--- a/tests/e2e/perspective-grid-right-button.pw.e2e.js
+++ b/tests/e2e/perspective-grid-right-button.pw.e2e.js
@@ -158,7 +158,7 @@ test.describe('TST50** - Right button on a file', () => {
// Select file
await clickOn(selectorFile);
//Toggle Properties
- await clickOn('[data-tid=fileContainerToggleProperties]');
+ // await clickOn('[data-tid=fileContainerToggleProperties]');
await AddRemoveTagsToSelectedFiles('grid', [testTagName], true);
await expectElementExist(
'[data-tid=tagContainer_' + testTagName + ']',
@@ -208,7 +208,7 @@ test.describe('TST50** - Right button on a file', () => {
// select file
await clickOn(selectorFile);
//Toggle Properties
- await clickOn('[data-tid=fileContainerToggleProperties]');
+ //await clickOn('[data-tid=fileContainerToggleProperties]');
await AddRemoveTagsToSelectedFiles('grid', [testTagName], true);
await expectElementExist(
'[data-tid=tagContainer_' + testTagName + ']',
@@ -366,6 +366,7 @@ test.describe('TST50** - Right button on a file', () => {
// Copy file in parent directory
await openContextEntryMenu(fileSelector, 'fileMenuMoveCopyFile');
// await setInputKeys('targetPathInput', defaultLocationPath);
+ await clickOn('[data-tid=propsActionsMenuTID]');
await clickOn('[data-tid=navigateToParentTID]');
await clickOn('[data-tid=confirmCopyFiles]');
await clickOn('[data-tid=uploadCloseAndClearTID]');
diff --git a/tests/e2e/perspective-grid.pw.e2e.js b/tests/e2e/perspective-grid.pw.e2e.js
index df09588ed..6189dd3aa 100644
--- a/tests/e2e/perspective-grid.pw.e2e.js
+++ b/tests/e2e/perspective-grid.pw.e2e.js
@@ -69,7 +69,7 @@ test.describe('TST50 - Perspective Grid', () => {
// const firstFileName = await getGridFileName(0);
await clickOn(getGridFileSelector(fileName)); // perspectiveGridTable + firstFile);
// Toggle Properties
- await clickOn('[data-tid=fileContainerToggleProperties]');
+ //await clickOn('[data-tid=fileContainerToggleProperties]');
const propsFileName = await getPropertiesFileName();
expect(fileName).toBe(propsFileName);
// await checkFilenameForExist(testTestFilename);
@@ -176,7 +176,7 @@ test.describe('TST50 - Perspective Grid', () => {
const fileName = 'sample.svg';
await clickOn(getGridFileSelector(fileName));
//Toggle Properties
- await clickOn('[data-tid=fileContainerToggleProperties]');
+ //await clickOn('[data-tid=fileContainerToggleProperties]');
// add meta json to file
await setSettings('[data-tid=settingsSetPersistTagsInSidecarFile]', true);
await AddRemovePropertiesTags(['test-tag1', 'test-tag2'], {
@@ -211,7 +211,7 @@ test.describe('TST50 - Perspective Grid', () => {
const fileName = 'sample.svg';
await clickOn(getGridFileSelector(fileName));
//Toggle Properties
- await clickOn('[data-tid=fileContainerToggleProperties]');
+ //await clickOn('[data-tid=fileContainerToggleProperties]');
// add meta json to file
await setSettings('[data-tid=settingsSetPersistTagsInSidecarFile]', true);
await AddRemovePropertiesTags(['test-tag1', 'test-tag2'], {