TagSpaces is an offline, open source, document manager with tagging support
writing entry properties description in redux (#1968)
Stanimir050b25e233c6
diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.ymlindex 63508d928..e89e591c8 100644--- a/.github/workflows/pull_request.yml+++ b/.github/workflows/pull_request.yml@@ -78,7 +78,7 @@ jobs:- name: Checkout TagspacesProuses: actions/checkout@v2with:- ref: develop+ ref: Rethink-writing-entry-properties-description-in-reduxrepository: tagspaces/tagspacesprotoken: ${{ secrets.CHECKOUT_TSPRO }}path: extensions/tagspacesprodiff --git a/app/components/EntryContainer.tsx b/app/components/EntryContainer.tsxindex 895726a8a..c16fb6c22 100644--- a/app/components/EntryContainer.tsx+++ b/app/components/EntryContainer.tsx@@ -167,7 +167,6 @@ interface Props {renameDirectory: () => void;addTags: () => void;removeTags: () => void;- openFsEntry: (fsEntry: TS.FileSystemEntry) => void;openPrevFile: (path: string) => void;openNextFile: (path: string) => void;openFileNatively: (path: string) => void;@@ -346,6 +345,13 @@ function EntryContainer(props: Props) {}}, [isFullscreen]);+ /*useEffect(() => {+ // description is saved as Preview+ if (isPropertiesPanelVisible && openedFile.description) {+ reloadOpenedFile();+ }+ }, [isPropertiesPanelVisible]);*/+useEffect(() => {if (fscreen.fullscreenEnabled) {fscreen.addEventListener(@@ -576,44 +582,50 @@ function EntryContainer(props: Props) {}};+ const reloadOpenedFile = () => {+ if (openedFile) {+ const metaFilePath = openedFile.isFile+ ? getMetaFileLocationForFile(+ openedFile.path,+ PlatformIO.getDirSeparator()+ )+ : getMetaFileLocationForDir(+ openedFile.path,+ PlatformIO.getDirSeparator()+ );+ try {+ loadJSONFile(metaFilePath)+ .then(fsEntryMeta => {+ updateOpenedFile(openedFile.path, {+ ...fsEntryMeta,+ editMode: false,+ shouldReload: !openedFile.shouldReload+ });+ })+ .catch(() =>+ updateOpenedFile(openedFile.path, {+ ...openedFile,+ editMode: false,+ shouldReload: !openedFile.shouldReload+ })+ );+ } catch (e) {+ updateOpenedFile(openedFile.path, {+ ...openedFile,+ editMode: false,+ shouldReload: !openedFile.shouldReload+ });+ }+ }+ };+const reloadDocument = () => {if (openedFile) {if (openedFile.editMode && fileChanged.current) {// openedFile.changed) {setSaveBeforeReloadConfirmDialogOpened(true);} else {- const metaFilePath = openedFile.isFile- ? getMetaFileLocationForFile(- openedFile.path,- PlatformIO.getDirSeparator()- )- : getMetaFileLocationForDir(- openedFile.path,- PlatformIO.getDirSeparator()- );- try {- loadJSONFile(metaFilePath)- .then(fsEntryMeta => {- updateOpenedFile(openedFile.path, {- ...fsEntryMeta,- editMode: false,- shouldReload: !openedFile.shouldReload- });- })- .catch(() =>- updateOpenedFile(openedFile.path, {- ...openedFile,- editMode: false,- shouldReload: !openedFile.shouldReload- })- );- } catch (e) {- updateOpenedFile(openedFile.path, {- ...openedFile,- editMode: false,- shouldReload: !openedFile.shouldReload- });- }+ reloadOpenedFile();}}};@@ -1735,7 +1747,6 @@ function mapActionCreatorsToProps(dispatch) {closeAllFiles: AppActions.closeAllFiles,renameFile: AppActions.renameFile,renameDirectory: AppActions.renameDirectory,- openFsEntry: AppActions.openFsEntry,openFileNatively: AppActions.openFileNatively,openDirectory: AppActions.openDirectory,openLink: AppActions.openLink,diff --git a/app/components/FolderContainer.tsx b/app/components/FolderContainer.tsxindex 1f2bc4133..76cd4566e 100644--- a/app/components/FolderContainer.tsx+++ b/app/components/FolderContainer.tsx@@ -191,7 +191,6 @@ interface Props {renameFile: () => void;openDirectory: () => void;showInFileManager: () => void;- openFsEntry: (fsEntry: TS.FileSystemEntry) => void;openEntry: (path: string) => void;reflectCreateEntry: (path: string, isFile: boolean) => void;loadDirectoryContent: (@@ -305,7 +304,7 @@ function FolderContainer(props: Props) {setSelectedEntries,openDirectory,reflectCreateEntry,- openFsEntry,+ openEntry,defaultPerspective,goBack,goForward@@ -333,7 +332,7 @@ function FolderContainer(props: Props) {directoryContent={props.directoryContent}lastSearchTimestamp={props.lastSearchTimestamp}loadDirectoryContent={loadDirectoryContent}- openFsEntry={openFsEntry}+ openEntry={openEntry}openRenameEntryDialog={() => setIsRenameEntryDialogOpened(true)}loadParentDirectoryContent={props.loadParentDirectoryContent}renameFile={props.renameFile}@@ -353,7 +352,7 @@ function FolderContainer(props: Props) {<GalleryPerspectiveAsyncdirectoryContent={props.directoryContent}lastSearchTimestamp={props.lastSearchTimestamp}- openFsEntry={openFsEntry}+ openEntry={openEntry}currentDirectoryPath={props.currentDirectoryPath}windowWidth={props.windowWidth}switchPerspective={switchPerspective}@@ -378,7 +377,7 @@ function FolderContainer(props: Props) {directoryContent={props.directoryContent}lastSearchTimestamp={props.lastSearchTimestamp}loadDirectoryContent={props.loadDirectoryContent}- openFsEntry={props.openFsEntry}+ openEntry={props.openEntry}openRenameEntryDialog={() => setIsRenameEntryDialogOpened(true)}loadParentDirectoryContent={props.loadParentDirectoryContent}renameFile={props.renameFile}@@ -400,7 +399,7 @@ function FolderContainer(props: Props) {directoryContent={props.directoryContent}lastSearchTimestamp={props.lastSearchTimestamp}loadDirectoryContent={props.loadDirectoryContent}- openFsEntry={props.openFsEntry}+ openEntry={props.openEntry}openRenameEntryDialog={() => setIsRenameEntryDialogOpened(true)}loadParentDirectoryContent={props.loadParentDirectoryContent}renameFile={props.renameFile}@@ -626,7 +625,6 @@ function FolderContainer(props: Props) {setSelectedEntries={setSelectedEntries}openDirectory={openDirectory}reflectCreateEntry={reflectCreateEntry}- openFsEntry={openFsEntry}isDesktopMode={isDesktopMode}openRenameDirectoryDialog={() =>setIsRenameEntryDialogOpened(true)@@ -712,7 +710,6 @@ function mapActionCreatorsToProps(dispatch) {renameFile: AppActions.renameFile,openDirectory: AppActions.openDirectory,showInFileManager: AppActions.showInFileManager,- openFsEntry: AppActions.openFsEntry,openEntry: AppActions.openEntry,reflectCreateEntry: AppActions.reflectCreateEntry,loadDirectoryContent: AppActions.loadDirectoryContent,diff --git a/app/components/PathBreadcrumbs.tsx b/app/components/PathBreadcrumbs.tsxindex f432f2c2f..37bac74fc 100644--- a/app/components/PathBreadcrumbs.tsx+++ b/app/components/PathBreadcrumbs.tsx@@ -72,7 +72,6 @@ interface Props {setSelectedEntries: (selectedEntries: Array<Object>) => void;openDirectory: () => void;reflectCreateEntry: (path: string, isFile: boolean) => void;- openFsEntry: (fsEntry: TS.FileSystemEntry) => void;openRenameDirectoryDialog: () => void;openMoveCopyFilesDialog: () => void;isDesktopMode: boolean;@@ -94,7 +93,6 @@ function PathBreadcrumbs(props: Props) {setSelectedEntries,openDirectory,reflectCreateEntry,- openFsEntry,openRenameDirectoryDialog,openMoveCopyFilesDialog,isDesktopMode@@ -248,7 +246,6 @@ function PathBreadcrumbs(props: Props) {openMoveCopyFilesDialog={openMoveCopyFilesDialog}openDirectory={openDirectory}reflectCreateEntry={reflectCreateEntry}- openFsEntry={openFsEntry}/></>);diff --git a/app/components/RenderHistory.tsx b/app/components/RenderHistory.tsxindex 3611eb527..43659c144 100644--- a/app/components/RenderHistory.tsx+++ b/app/components/RenderHistory.tsx@@ -41,7 +41,7 @@ export const renderHistory = (currentLocationId: string,openLink: (url: string, options: any) => void,openLocationById: (locationId: string) => void,- openFsEntry: (fsEntry: TS.FileSystemEntry) => void,+ openEntry: (entryPath: string) => void,maxItems: number | undefined = undefined,showDelete: boolean = true) => (@@ -71,7 +71,7 @@ export const renderHistory = (currentLocationId,openLink,openLocationById,- openFsEntry+ openEntry)}>diff --git a/app/components/SearchAutocomplete.tsx b/app/components/SearchAutocomplete.tsxindex fc8f36389..e6450002f 100644--- a/app/components/SearchAutocomplete.tsx+++ b/app/components/SearchAutocomplete.tsx@@ -109,8 +109,8 @@ function SearchAutocomplete(props: Props) {dispatch(AppActions.openLink(link, options));const openLocationByIdDispatch = locationId =>dispatch(AppActions.openLocationById(locationId));- const openFsEntryDispatch = fsEntry =>- dispatch(AppActions.openFsEntry(fsEntry));+ const openEntryDispatch = entryPath =>+ dispatch(AppActions.openEntry(entryPath));const { setTextQuery, textQuery, open, setAnchorSearch } = props;// const [, forceUpdate] = useReducer(x => x + 1, 0);@@ -1014,7 +1014,7 @@ function SearchAutocomplete(props: Props) {currentLocation.uuid,openLinkDispatch,openLocationByIdDispatch,- openFsEntryDispatch+ openEntryDispatch);}searchOptions.current = getSearchOptions();@@ -1034,7 +1034,7 @@ function SearchAutocomplete(props: Props) {currentLocation.uuid,openLinkDispatch,openLocationByIdDispatch,- openFsEntryDispatch+ openEntryDispatch);}searchOptions.current = getSearchOptions();diff --git a/app/components/StoredSearches.tsx b/app/components/StoredSearches.tsxindex 7be757775..2acd60f69 100644--- a/app/components/StoredSearches.tsx+++ b/app/components/StoredSearches.tsx@@ -54,7 +54,6 @@ import { actions as SearchActions, getSearches } from '-/reducers/searches';import { TS } from '-/tagspaces.namespace';import SearchMenu from '-/components/menus/SearchMenu';import { actions as AppActions, getCurrentLocationId } from '-/reducers/app';-import { getAllPropertiesPromise } from '-/services/utils-io';import { Tooltip } from '@mui/material';import {extractFileName,@@ -76,7 +75,7 @@ interface Props {showUnixHiddenEntries: boolean;addSearches: (searches: Array<TS.SearchQuery>) => void;reduceHeightBy: number;- openFsEntry: (fsEntry: TS.FileSystemEntry) => void;+ openEntry: (entryPath: string) => void;openLink: (url: string, options: any) => void;openLocationById: (locationId: string) => void;currentLocationId: string;@@ -373,7 +372,7 @@ function StoredSearches(props: Props) {props.currentLocationId,props.openLink,props.openLocationById,- props.openFsEntry+ props.openEntry)}<Grid container direction="row"><Grid item xs={10} style={{ alignSelf: 'center' }}>@@ -423,7 +422,7 @@ function StoredSearches(props: Props) {props.currentLocationId,props.openLink,props.openLocationById,- props.openFsEntry+ props.openEntry)}<Grid container direction="row"><Grid item xs={10} style={{ alignSelf: 'center' }}>@@ -474,7 +473,7 @@ function StoredSearches(props: Props) {props.currentLocationId,props.openLink,props.openLocationById,- props.openFsEntry+ props.openEntry)}<Grid container direction="row"><Grid item xs={10} style={{ alignSelf: 'center' }}>@@ -552,7 +551,7 @@ function StoredSearches(props: Props) {props.currentLocationId,props.openLink,props.openLocationById,- props.openFsEntry+ props.openEntry)}{SaveSearchDialog && saveSearchDialogOpened !== undefined && (<SaveSearchDialog@@ -632,7 +631,7 @@ function mapDispatchToProps(dispatch) {setSearchQuery: LocationIndexActions.setSearchQuery,// searchAllLocations: LocationIndexActions.searchAllLocations,// searchLocationIndex: LocationIndexActions.searchLocationIndex,- openFsEntry: AppActions.openFsEntry,+ openEntry: AppActions.openEntry,openLink: AppActions.openLink,openLocationById: AppActions.openLocationById,setStoredSearchesVisible: SettingsActions.setStoredSearchesVisible,diff --git a/app/components/WelcomePanel.tsx b/app/components/WelcomePanel.tsxindex f85e135e2..4b9a38726 100644--- a/app/components/WelcomePanel.tsx+++ b/app/components/WelcomePanel.tsx@@ -97,8 +97,8 @@ function WelcomePanel() {dispatch(AppActions.toggleOpenLinkDialog());const toggleKeysDialogDispatch = () =>dispatch(AppActions.toggleKeysDialog());- const openFsEntryDispatch = fsEntry =>- dispatch(AppActions.openFsEntry(fsEntry));+ const openEntryDispatch = entryPath =>+ dispatch(AppActions.openEntry(entryPath));const openLinkDispatch = link => dispatch(AppActions.openLink(link));const openLocationByIdDispatch = locationId =>dispatch(AppActions.openLocationById(locationId));@@ -148,7 +148,7 @@ function WelcomePanel() {currentLocationId,openLinkDispatch,openLocationByIdDispatch,- openFsEntryDispatch,+ openEntryDispatch,maxRecentItems,showDelete)}@@ -170,7 +170,7 @@ function WelcomePanel() {currentLocationId,openLinkDispatch,openLocationByIdDispatch,- openFsEntryDispatch,+ openEntryDispatch,maxRecentItems,showDelete)}@@ -192,7 +192,7 @@ function WelcomePanel() {currentLocationId,openLinkDispatch,openLocationByIdDispatch,- openFsEntryDispatch,+ openEntryDispatch,maxRecentItems,showDelete)}diff --git a/app/components/menus/DirectoryMenu.tsx b/app/components/menus/DirectoryMenu.tsxindex e72bd39a9..ff880655c 100644--- a/app/components/menus/DirectoryMenu.tsx+++ b/app/components/menus/DirectoryMenu.tsx@@ -41,7 +41,6 @@ import {} from '-/reducers/app';import IOActions from '-/reducers/io-actions';import TaggingActions from '-/reducers/tagging-actions';-import { getAllPropertiesPromise } from '-/services/utils-io';import FileUploadContainer, {FileUploadContainerRef} from '-/components/FileUploadContainer';@@ -64,7 +63,6 @@ interface Props {loadDirMeta?: boolean) => void;openDirectory: (path: string) => void;- openFsEntry: (fsEntry: TS.FileSystemEntry) => void;openAddRemoveTagsDialog?: () => void;reflectCreateEntry?: (path: string, isFile: boolean) => void;switchPerspective?: (perspectiveId: string) => void;@@ -110,9 +108,7 @@ function DirectoryMenu(props: Props) {dispatch(AppActions.toggleCreateDirectoryDialog());};- const openFsEntry = fsEntry => {- dispatch(AppActions.openFsEntry(fsEntry));- };+ const openEntry = path => dispatch(AppActions.openEntry(path));const reflectCreateEntry = (path, isFile) => {dispatch(AppActions.reflectCreateEntry(path, isFile));@@ -210,16 +206,7 @@ function DirectoryMenu(props: Props) {}function showProperties() {- getAllPropertiesPromise(directoryPath)- .then((fsEntry: TS.FileSystemEntry) => {- openFsEntry(fsEntry);- return true;- })- .catch(error =>- console.warn(- 'Error getting properties for entry: ' + directoryPath + ' - ' + error- )- );+ return openEntry(directoryPath);}function switchPerspective(perspectiveId) {diff --git a/app/components/menus/FileMenu.tsx b/app/components/menus/FileMenu.tsxindex 520313187..a7b12bc83 100644--- a/app/components/menus/FileMenu.tsx+++ b/app/components/menus/FileMenu.tsx@@ -47,7 +47,6 @@ import i18n from '-/services/i18n';import PlatformIO from '-/services/platform-facade';import {generateFileName,- getAllPropertiesPromise,setFolderBackgroundPromise,setFolderThumbnailPromise,getRelativeEntryPath@@ -293,19 +292,7 @@ function FileMenu(props: Props) {function openFile() {onClose();if (selectedFilePath) {- getAllPropertiesPromise(selectedFilePath)- .then((fsEntry: TS.FileSystemEntry) => {- dispatch(AppActions.openFsEntry(fsEntry));- return true;- })- .catch(error =>- console.warn(- 'Error getting properties for entry: ' +- selectedFilePath +- ' - ' +- error- )- );+ return dispatch(AppActions.openEntry(selectedFilePath));}}diff --git a/app/perspectives/common/main-container.tsx b/app/perspectives/common/main-container.tsxindex 81416f3fd..fe744eeda 100644--- a/app/perspectives/common/main-container.tsx+++ b/app/perspectives/common/main-container.tsx@@ -54,7 +54,7 @@ export const renderCell = (setSelectedEntries,lastSelectedEntryPath,directoryContent,- openFsEntry,+ openEntry,openFileNatively,loadDirectoryContent,setFileContextMenuAnchorEl,@@ -132,7 +132,7 @@ export const renderCell = (const openLocation = (fsEntry: TS.FileSystemEntry) => {if (fsEntry.isFile) {setSelectedEntries([fsEntry]);- openFsEntry(fsEntry);+ openEntry(fsEntry.path);} else {console.log('Handle Grid cell db click, selected path : ', fsEntry.path);loadDirectoryContent(fsEntry.path, true, true);@@ -227,7 +227,7 @@ export const renderCell = (setSelectedEntries([fsEntry]);if (fsEntry.isFile) {if (singleClickAction === 'openInternal') {- openFsEntry(fsEntry);+ openEntry(fsEntry.path);} else if (singleClickAction === 'openExternal') {openFileNatively(fsEntry.path);}diff --git a/app/perspectives/grid-perspective/components/CellContent.tsx b/app/perspectives/grid-perspective/components/CellContent.tsxindex cd167f77f..e9f5312a3 100644--- a/app/perspectives/grid-perspective/components/CellContent.tsx+++ b/app/perspectives/grid-perspective/components/CellContent.tsx@@ -76,7 +76,6 @@ interface Props {entrySize: string;style?: any;thumbnailMode: any;- openFsEntry: (fsEntry: TS.FileSystemEntry) => void;selectedEntries: Array<TS.FileSystemEntry>;selectEntry: (fsEntry: TS.FileSystemEntry) => void;deselectEntry: (fsEntry: TS.FileSystemEntry) => void;@@ -103,7 +102,6 @@ function CellContent(props: Props) {handleGridCellClick,showEntriesDescription,showTags,- // openFsEntry,selectEntry,deselectEntry,isLastdiff --git a/app/perspectives/grid-perspective/components/GridPagination.tsx b/app/perspectives/grid-perspective/components/GridPagination.tsxindex 2a77a457f..624a17c67 100644--- a/app/perspectives/grid-perspective/components/GridPagination.tsx+++ b/app/perspectives/grid-perspective/components/GridPagination.tsx@@ -111,7 +111,7 @@ interface Props {currentLocation: TS.Location;lastSelectedEntryPath: string;directoryContent: Array<TS.FileSystemEntry>;- openFsEntry: (fsEntry?: TS.FileSystemEntry) => void;+ openEntry: (entryPath?: string) => void;openFileNatively: (path?: string) => void;loadDirectoryContent: (path: string,@@ -152,7 +152,7 @@ function GridPagination(props: Props) {openRenameEntryDialog,lastSelectedEntryPath,lastBackgroundImageChange,- openFsEntry,+ openEntry,openFileNatively,loadDirectoryContent,setFileContextMenuAnchorEl,@@ -402,13 +402,6 @@ function GridPagination(props: Props) {);}*/- let descriptionPreview = '';- if (currentDirectoryDescription) {- descriptionPreview = getDescriptionPreview(- currentDirectoryDescription,- 200- );- }const displayDescription = showDescription && currentDirectoryDescription;@@ -514,7 +507,7 @@ function GridPagination(props: Props) {>{folderSummary}</Typography>- {!showDescription && descriptionPreview && (+ {!showDescription && currentDirectoryDescription && (<Tooltip title={i18n.t('core:filePropertiesDescription')}><Typographystyle={{@@ -522,7 +515,7 @@ function GridPagination(props: Props) {wordBreak: 'break-all'}}>- {descriptionPreview}+ {currentDirectoryDescription}</Typography></Tooltip>)}@@ -585,7 +578,7 @@ function GridPagination(props: Props) {setSelectedEntries,lastSelectedEntryPath,directoryContent,- openFsEntry,+ openEntry,openFileNatively,loadDirectoryContent,setFileContextMenuAnchorEl,@@ -609,7 +602,7 @@ function GridPagination(props: Props) {setSelectedEntries,lastSelectedEntryPath,directoryContent,- openFsEntry,+ openEntry,openFileNatively,loadDirectoryContent,setFileContextMenuAnchorEl,diff --git a/app/perspectives/grid-perspective/components/MainContainer.tsx b/app/perspectives/grid-perspective/components/MainContainer.tsxindex a7994b2d4..57c3e83ac 100644--- a/app/perspectives/grid-perspective/components/MainContainer.tsx+++ b/app/perspectives/grid-perspective/components/MainContainer.tsx@@ -61,7 +61,7 @@ import { openURLExternally } from '-/services/utils-io';interface Props {currentDirectoryPath: string;- openFsEntry: (fsEntry?: TS.FileSystemEntry) => void;+ openEntry: (entryPath?: string) => void;openRenameEntryDialog: () => void;loadDirectoryContent: (path: string,@@ -98,7 +98,7 @@ function GridPerspective(props: Props) {openRenameEntryDialog,directoryContent,lastSearchTimestamp,- openFsEntry,+ openEntry,loadDirectoryContent,removeTags,removeAllTags,@@ -666,7 +666,7 @@ function GridPerspective(props: Props) {},openEntry: e => {e.preventDefault();- openFsEntry();+ openEntry();},openFileExternally: () => {handleOpenFileNatively();@@ -738,7 +738,6 @@ function GridPerspective(props: Props) {handleTagMenu={handleTagMenu}layoutType={layoutType.current}showTags={showTags.current}- openFsEntry={openFsEntry}handleGridContextMenu={(event: React.MouseEvent<HTMLDivElement>,fsEntry: TS.FileSystemEntry@@ -773,7 +772,6 @@ function GridPerspective(props: Props) {fileOperationsEnabled={fileOperationsEnabled(selectedEntries)}openMoveCopyFilesDialog={openMoveCopyFilesDialog}openDeleteFileDialog={openDeleteFileDialog}- openFsEntry={openFsEntry}handleSortingMenu={handleSortingMenu}handleExportCsvMenu={handleExportCsvMenu}openSettings={openSettings}@@ -826,7 +824,7 @@ function GridPerspective(props: Props) {? GlobalSearch.getInstance().getResults(): directoryContent}- openFsEntry={openFsEntry}+ openEntry={openEntry}openFileNatively={handleOpenFileNatively}loadDirectoryContent={loadDirectoryContent}setFileContextMenuAnchorEl={setFileContextMenuAnchorEl}@@ -941,7 +939,6 @@ function GridPerspective(props: Props) {openRenameDirectoryDialog={openRenameEntryDialog}openMoveCopyFilesDialog={openMoveCopyFilesDialog}openDirectory={openDirectory}- openFsEntry={openFsEntry}perspectiveMode={lastSelectedEntryPath !== currentDirectoryPath}currentLocation={currentLocation}openAddRemoveTagsDialog={openAddRemoveTagsDialog}diff --git a/app/perspectives/grid-perspective/components/MainToolbar.tsx b/app/perspectives/grid-perspective/components/MainToolbar.tsxindex a76d78507..d8e9dcd2f 100644--- a/app/perspectives/grid-perspective/components/MainToolbar.tsx+++ b/app/perspectives/grid-perspective/components/MainToolbar.tsx@@ -17,7 +17,7 @@*/import React from 'react';-import { useSelector } from 'react-redux';+import { useDispatch, useSelector } from 'react-redux';import Toolbar from '@mui/material/Toolbar';import Tooltip from '-/components/Tooltip';import IconButton from '@mui/material/IconButton';@@ -44,9 +44,12 @@ import {getSearchQuery} from '-/reducers/location-index';import { getKeyBindingObject } from '-/reducers/settings';-import { getAllPropertiesPromise } from '-/services/utils-io';import { TS } from '-/tagspaces.namespace';-import { actions as AppActions, isReadOnlyMode } from '-/reducers/app';+import {+ actions as AppActions,+ AppDispatch,+ isReadOnlyMode+} from '-/reducers/app';import {classes,GridStyles@@ -59,7 +62,6 @@ interface Props {toggleSelectAllFiles: (event: any) => void;someFileSelected: boolean;handleLayoutSwitch: (event: Object) => void;- openFsEntry: (fsEntry?: TS.FileSystemEntry) => void;openAddRemoveTagsDialog: () => void;fileOperationsEnabled: boolean;openMoveCopyFilesDialog: () => void;@@ -94,22 +96,11 @@ function MainToolbar(props: Props) {keyBindings,openShareFilesDialog} = props;+ const dispatch: AppDispatch = useDispatch();const readOnlyMode = useSelector(isReadOnlyMode);function showProperties() {- getAllPropertiesPromise(props.directoryPath)- .then((fsEntry: TS.FileSystemEntry) => {- props.openFsEntry(fsEntry);- return true;- })- .catch(error =>- console.warn(- 'Error getting properties for entry: ' +- props.directoryPath +- ' - ' +- error- )- );+ return dispatch(AppActions.openEntry(props.directoryPath));}return (diff --git a/app/perspectives/list/components/MainContainer.tsx b/app/perspectives/list/components/MainContainer.tsxindex 6d9694ecd..f7a8e466f 100644--- a/app/perspectives/list/components/MainContainer.tsx+++ b/app/perspectives/list/components/MainContainer.tsx@@ -61,7 +61,7 @@ import { openURLExternally } from '-/services/utils-io';interface Props {currentDirectoryPath: string;- openFsEntry: (fsEntry?: TS.FileSystemEntry) => void;+ openEntry: (entryPath?: string) => void;openRenameEntryDialog: () => void;loadDirectoryContent: (path: string,@@ -98,7 +98,7 @@ function ListPerspective(props: Props) {openRenameEntryDialog,directoryContent,lastSearchTimestamp,- openFsEntry,+ openEntry,loadDirectoryContent,removeTags,removeAllTags,@@ -666,7 +666,7 @@ function ListPerspective(props: Props) {},openEntry: e => {e.preventDefault();- openFsEntry();+ openEntry();},openFileExternally: () => {handleOpenFileNatively();@@ -738,7 +738,6 @@ function ListPerspective(props: Props) {handleTagMenu={handleTagMenu}layoutType={layoutType.current}showTags={showTags.current}- openFsEntry={openFsEntry}handleGridContextMenu={(event: React.MouseEvent<HTMLDivElement>,fsEntry: TS.FileSystemEntry@@ -773,7 +772,6 @@ function ListPerspective(props: Props) {fileOperationsEnabled={fileOperationsEnabled(selectedEntries)}openMoveCopyFilesDialog={openMoveCopyFilesDialog}openDeleteFileDialog={openDeleteFileDialog}- openFsEntry={openFsEntry}handleSortingMenu={handleSortingMenu}handleExportCsvMenu={handleExportCsvMenu}openSettings={openSettings}@@ -823,7 +821,7 @@ function ListPerspective(props: Props) {? GlobalSearch.getInstance().getResults(): directoryContent}- openFsEntry={openFsEntry}+ openEntry={openEntry}openFileNatively={handleOpenFileNatively}loadDirectoryContent={loadDirectoryContent}setFileContextMenuAnchorEl={setFileContextMenuAnchorEl}@@ -938,7 +936,6 @@ function ListPerspective(props: Props) {openRenameDirectoryDialog={openRenameEntryDialog}openMoveCopyFilesDialog={openMoveCopyFilesDialog}openDirectory={openDirectory}- openFsEntry={openFsEntry}perspectiveMode={lastSelectedEntryPath !== currentDirectoryPath}currentLocation={currentLocation}openAddRemoveTagsDialog={openAddRemoveTagsDialog}diff --git a/app/reducers/app.ts b/app/reducers/app.tsindex 5d917e3e3..f12e4a8ec 100644--- a/app/reducers/app.ts+++ b/app/reducers/app.ts@@ -60,7 +60,8 @@ import {loadMetaDataPromise,mergeByProp,toFsEntry,- openURLExternally+ openURLExternally,+ getDescriptionPreview} from '-/services/utils-io';import { getUuid } from '@tagspaces/tagspaces-common/utils-io';import i18n from '../services/i18n';@@ -663,10 +664,10 @@ export default (state: any = initialState, action: any) => {action.file// ...state.openedFiles // TODO uncomment for multiple file support],- ...(action.file.path === state.currentDirectoryPath &&+ /*...(action.file.path === state.currentDirectoryPath &&action.file.description && {currentDirectoryDescription: action.file.description- })+ })*/};}case types.TOGGLE_ENTRY_FULLWIDTH: {@@ -1523,11 +1524,10 @@ export const actions = {); */// console.debug('Loading meta succeeded for:' + directoryPath);dispatch(- actions.loadDirectoryContentInt(- directoryPath,- generateThumbnails,- fsEntryMeta- )+ actions.loadDirectoryContentInt(directoryPath, generateThumbnails, {+ ...fsEntryMeta,+ description: getDescriptionPreview(fsEntryMeta.description, 200)+ }));} catch (err) {console.debug('Error loading meta of:' + directoryPath + ' ' + err);@@ -1868,20 +1868,7 @@ export const actions = {true));- getAllPropertiesPromise(filePath)- .then((fsEntry: TS.FileSystemEntry) => {- dispatch(actions.openFsEntry(fsEntry)); // TODO return fsEntry from saveFilePromise and simplify- // dispatch(actions.setSelectedEntries([fsEntry])); -> moved in reflectCreateEntry- return true;- })- .catch(error =>- console.warn(- 'Error getting properties for entry: ' +- filePath +- ' - ' +- error- )- );+ dispatch(actions.openEntry(filePath));return true;}).catch(err => {@@ -1941,7 +1928,7 @@ export const actions = {PlatformIO.saveFilePromise({ path: filePath }, fileContent, false).then((fsEntry: TS.FileSystemEntry) => {dispatch(actions.reflectCreateEntry(filePath, true));- dispatch(actions.openFsEntry(fsEntry)); // TODO return fsEntry from saveFilePromise and simplify+ dispatch(actions.openFsEntry(fsEntry));// dispatch(actions.setSelectedEntries([fsEntry]));dispatch(@@ -2312,7 +2299,10 @@ export const actions = {}return Promise.resolve(false);},- openEntry: (path: string) => (dispatch: (action) => void) => {+ openEntry: (path?: string) => (dispatch: (action) => void) => {+ if (path === undefined) {+ return dispatch(actions.openFsEntry());+ }return getAllPropertiesPromise(path).then((fsEntry: TS.FileSystemEntry) =>dispatch(actions.openFsEntry(fsEntry))diff --git a/app/services/utils-io.ts b/app/services/utils-io.tsindex dccfeae21..5f0177864 100644--- a/app/services/utils-io.ts+++ b/app/services/utils-io.ts@@ -181,7 +181,13 @@ export async function getMetaForEntry(const meta: TS.FileSystemEntryMeta = await loadJSONFile(metaFilePath);if (meta) {const entryEnhanced = enhanceEntry(- { ...entry, meta },+ {+ ...entry,+ meta: {+ ...meta,+ description: getDescriptionPreview(meta.description, 200)+ }+ },AppConfig.tagDelimiter,PlatformIO.getDirSeparator());@@ -626,6 +632,9 @@ export function createDirectoryIndex(});}+/**+ * get full entry properties - with full description+ */export async function getAllPropertiesPromise(entryPath: string): Promise<TS.FileSystemEntry> {@@ -1012,6 +1021,10 @@ export async function loadLocationDataPromise(let metaData;try {metaData = await loadJSONFile(metaFilePath);+ metaData = {+ ...metaData,+ description: getDescriptionPreview(metaData.description, 200)+ };} catch (e) {console.debug('cannot load json:' + metaFilePath, e);}@@ -1052,7 +1065,7 @@ export function loadFileMetaDataPromise(return {...metaData,isFile: true,- description: metaData.description || '',+ description: getDescriptionPreview(metaData.description, 200),color: metaData.color || '',tags: metaData.tags || [],appName: metaData.appName || '',@@ -1077,7 +1090,7 @@ export function loadDirMetaDataPromise(...metaData,id: metaData.id || getUuid(),isFile: false,- description: metaData.description || '',+ description: getDescriptionPreview(metaData.description, 200),color: metaData.color || '',perspective: metaData.perspective || '',tags: metaData.tags || [],