TagSpaces is an offline, open source, document manager with tagging support
fix perspective should stay (#2032)
Stanimir9b4133cf7f70
diff --git a/src/renderer/components/EntryProperties.tsx b/src/renderer/components/EntryProperties.tsxindex ff9f54b09..25b02e0c5 100644--- a/src/renderer/components/EntryProperties.tsx+++ b/src/renderer/components/EntryProperties.tsx@@ -61,7 +61,6 @@ import {import TagDropContainer from './TagDropContainer';import MoveCopyFilesDialog from './dialogs/MoveCopyFilesDialog';import {- enhanceOpenedEntry,fileNameValidation,dirNameValidation,normalizeUrl,@@ -73,13 +72,11 @@ import PlatformIO from '../services/platform-facade';import TagsSelect from './TagsSelect';import TransparentBackground from './TransparentBackground';import { getThumbnailURLPromise } from '-/services/thumbsgenerator';-import { getTagDelimiter } from '-/reducers/settings';import {+ AppDispatch,getLastBackgroundImageChange,getLastThumbnailImageChange,- OpenedEntry,} from '-/reducers/app';-import { savePerspective } from '-/utils/metaoperations';import MarkerIcon from '-/assets/icons/marker-icon.png';import Marker2xIcon from '-/assets/icons/marker-icon-2x.png';import MarkerShadowIcon from '-/assets/icons/marker-shadow.png';@@ -89,10 +86,8 @@ import NoTileServer from '-/components/NoTileServer';import InfoIcon from '-/components/InfoIcon';import { ProTooltip } from '-/components/HelperComponents';import PerspectiveSelector from '-/components/PerspectiveSelector';-import { connect } from 'react-redux';+import { useDispatch, useSelector } from 'react-redux';import FormHelperText from '@mui/material/FormHelperText';-import { bindActionCreators } from 'redux';-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';@@ -188,15 +183,7 @@ const BgndImgChooserDialog =Pro && Pro.UI ? Pro.UI.BgndImgChooserDialog : false;interface Props {- locations: Array<TS.Location>;- tagDelimiter: string;tileServer: TS.MapTileServer;- lastBackgroundImageChange: any;- lastThumbnailImageChange: any;- setLastBackgroundColorChange: (- folderPath: string,- lastBackgroundColorChange: number,- ) => void;}const defaultBackgrounds = [@@ -209,36 +196,39 @@ const defaultBackgrounds = [function EntryProperties(props: Props) {const { t } = useTranslation();const theme = useTheme();- const { openedEntries, updateOpenedFile, sharingLink } =+ const { currentEntry, dirProps, updateOpenedFile, sharingLink } =useOpenedEntryContext();const { renameDirectory, renameFile } = useFsActionsContext();const { addTags, removeTags, removeAllTags } = useTaggingActionsContext();- const { currentDirectoryPath, updateThumbnailUrl, setDirectoryMeta } =- useDirectoryContentContext();+ const {+ currentDirectoryPath,+ updateThumbnailUrl,+ setDirectoryMeta,+ setDirectoryPerspective,+ } = useDirectoryContentContext();const { switchLocationTypeByID, switchCurrentLocationType, readOnlyMode } =useCurrentLocationContext();const { showNotification } = useNotificationContext();+ const dispatch: AppDispatch = useDispatch();const fileNameRef = useRef<HTMLInputElement>(null);const sharingLinkRef = useRef<HTMLInputElement>(null);// const fileDescriptionRef = useRef<MilkdownRef>(null);const disableConfirmButton = useRef<boolean>(true);const fileNameError = useRef<boolean>(false);- const openedEntry = openedEntries[0];- /*const directoryPath = openedEntry.isFile- ? extractContainingDirectoryPath(- openedEntry.path,- PlatformIO.getDirSeparator()- )- : openedEntry.path;*/+ //const openedEntry = openedEntries[0];+ const lastBackgroundImageChange = useSelector(getLastBackgroundImageChange);+ const lastThumbnailImageChange = useSelector(getLastThumbnailImageChange);- const entryName = openedEntry.isFile- ? extractFileName(openedEntry.path, PlatformIO.getDirSeparator())- : extractDirectoryName(openedEntry.path, PlatformIO.getDirSeparator());+ const entryName = currentEntry+ ? currentEntry.isFile+ ? extractFileName(currentEntry.path, PlatformIO.getDirSeparator())+ : extractDirectoryName(currentEntry.path, PlatformIO.getDirSeparator())+ : '';- const currentEntry = useRef<OpenedEntry>(+ /*const currentEntry = useRef<OpenedEntry>(enhanceOpenedEntry(openedEntry, props.tagDelimiter),- );+ );*/const [editName, setEditName] = useState<string>(undefined);const [isMoveCopyFilesDialogOpened, setMoveCopyFilesDialogOpened] =useState<boolean>(false);@@ -253,26 +243,10 @@ function EntryProperties(props: Props) {const [displayColorPicker, setDisplayColorPicker] = useState<boolean>(false);const bgndUrl = useRef<string>(getBgndUrl());const thumbUrl = useRef<string>(getThumbUrl());- const dirProps = useRef<TS.DirProp>();+const [ignored, forceUpdate] = useReducer((x) => x + 1, 0);const firstRender = useFirstRender();- useEffect(() => {- if (- !currentEntry.current.isFile &&- !PlatformIO.haveObjectStoreSupport() &&- !PlatformIO.haveWebDavSupport()- ) {- PlatformIO.getDirProperties(currentEntry.current.path)- .then((dProps: TS.DirProp) => {- dirProps.current = dProps;- currentEntry.current.size = dProps.totalSize;- forceUpdate();- })- .catch((ex) => console.debug('getDirProperties:', ex.message));- }- }, []);-useEffect(() => {if (editName === entryName && fileNameRef.current) {fileNameRef.current.focus();@@ -284,53 +258,34 @@ function EntryProperties(props: Props) {bgndUrl.current = getBgndUrl();forceUpdate();}- }, [props.lastBackgroundImageChange]);+ }, [lastBackgroundImageChange]);useEffect(() => {if (!firstRender) {thumbUrl.current = getThumbUrl();forceUpdate();}- }, [props.lastThumbnailImageChange]);-- useEffect(() => {- if (- !firstRender &&- openedEntry != undefined- // && currentEntry.current.description !== props.openedEntry.description- ) {- // update description- currentEntry.current = enhanceOpenedEntry(- openedEntry,- props.tagDelimiter,- );- forceUpdate();- // currentEntry.current.description = editDescription.current;- /*const { current } = fileDescriptionRef;- if (!current) return;- current.update(currentEntry.current.description);*/- }- }, [openedEntries]);+ }, [lastThumbnailImageChange]);const renameEntry = () => {if (editName !== undefined) {const path = extractContainingDirectoryPath(- currentEntry.current.path,+ currentEntry.path,PlatformIO.getDirSeparator(),);const nextPath = path + PlatformIO.getDirSeparator() + editName;- switchLocationTypeByID(openedEntry.locationId).then(+ switchLocationTypeByID(currentEntry.locationId).then((currentLocationId) => {- if (currentEntry.current.isFile) {- renameFile(currentEntry.current.path, nextPath)+ if (currentEntry.isFile) {+ renameFile(currentEntry.path, nextPath).then(() => switchCurrentLocationType()).catch(() => {switchCurrentLocationType();fileNameRef.current.value = entryName;});} else {- renameDirectory(currentEntry.current.path, editName)+ renameDirectory(currentEntry.path, editName).then((newDirPath) => switchCurrentLocationType()).catch(() => {switchCurrentLocationType();@@ -372,7 +327,7 @@ function EntryProperties(props: Props) {showNotification(t('core:thisFunctionalityIsAvailableInPro'));return true;}- if (!currentEntry.current.editMode && editName === undefined) {+ if (!currentEntry.editMode && editName === undefined) {setFileThumbChooseDialogOpened(!isFileThumbChooseDialogOpened);}};@@ -382,21 +337,21 @@ function EntryProperties(props: Props) {showNotification(t('core:thisFunctionalityIsAvailableInPro'));return true;}- if (!currentEntry.current.editMode && editName === undefined) {+ if (!currentEntry.editMode && editName === undefined) {setBgndImgChooseDialogOpened(!isBgndImgChooseDialogOpened);}};const setThumb = (filePath, thumbFilePath) => {if (filePath !== undefined) {- return switchLocationTypeByID(openedEntry.locationId).then(+ return switchLocationTypeByID(currentEntry.locationId).then((currentLocationId) => {if (PlatformIO.haveObjectStoreSupport() ||PlatformIO.haveWebDavSupport()) {updateThumbnailUrl(- currentEntry.current.path,+ currentEntry.path,PlatformIO.getURLforPath(thumbFilePath),);return true;@@ -404,7 +359,7 @@ function EntryProperties(props: Props) {/*return replaceThumbnailURLPromise(filePath, thumbFilePath).then(objUrl => {*/updateThumbnailUrl(- currentEntry.current.path,+ currentEntry.path,thumbFilePath,// objUrl.tmbPath/*(props.lastThumbnailImageChange@@ -416,9 +371,9 @@ function EntryProperties(props: Props) {);} else {// reset Thumbnail- return getThumbnailURLPromise(currentEntry.current.path)+ return getThumbnailURLPromise(currentEntry.path).then((objUrl) => {- updateThumbnailUrl(currentEntry.current.path, objUrl.tmbPath);+ updateThumbnailUrl(currentEntry.path, objUrl.tmbPath);return true;}).catch((err) => {@@ -448,34 +403,38 @@ function EntryProperties(props: Props) {// eslint-disable-next-line no-param-reassigncolor = 'transparent';}- currentEntry.current.color = color;- switchLocationTypeByID(openedEntry.locationId).then((currentLocationId) => {- Pro.MetaOperations.saveFsEntryMeta(currentEntry.current.path, { color })- .then((entryMeta) => {- if (currentEntry.current.path === currentDirectoryPath) {- setDirectoryMeta(entryMeta);- }- // for KanBan- props.setLastBackgroundColorChange(- currentEntry.current.path,- new Date().getTime(),- );- // todo handle LastBackgroundColorChange and skip updateOpenedFile- updateOpenedFile(currentEntry.current.path, entryMeta).then(() =>- switchCurrentLocationType(),- );+ currentEntry.color = color;+ switchLocationTypeByID(currentEntry.locationId).then(+ (currentLocationId) => {+ Pro.MetaOperations.saveFsEntryMeta(currentEntry.path, { color })+ .then((entryMeta) => {+ if (currentEntry.path === currentDirectoryPath) {+ setDirectoryMeta(entryMeta);+ }+ // for KanBan+ dispatch(+ AppActions.setLastBackgroundColorChange(+ currentEntry.path,+ new Date().getTime(),+ ),+ );+ // todo handle LastBackgroundColorChange and skip updateOpenedFile+ updateOpenedFile(currentEntry.path, entryMeta).then(() =>+ switchCurrentLocationType(),+ );- /* } else {+ /* } else {setCurrentEntry({ ...currentEntry, color });} */- return true;- })- .catch((error) => {- switchCurrentLocationType();- console.warn('Error saving color for folder ' + error);- showNotification(t('Error saving color for folder'));- });- });+ return true;+ })+ .catch((error) => {+ switchCurrentLocationType();+ console.warn('Error saving color for folder ' + error);+ showNotification(t('Error saving color for folder'));+ });+ },+ );};const handleFileNameChange = (event: ChangeEvent<HTMLInputElement>) => {@@ -485,7 +444,7 @@ function EntryProperties(props: Props) {if (name === 'name') {const initValid = disableConfirmButton.current;let noValid;- if (currentEntry.current.isFile) {+ if (currentEntry.isFile) {noValid = fileNameValidation(value);} else {noValid = dirNameValidation(value);@@ -508,57 +467,53 @@ function EntryProperties(props: Props) {};*/const handleChange = (name: string, value: Array<TS.Tag>, action: string) => {- switchLocationTypeByID(openedEntry.locationId).then((currentLocationId) => {- if (action === 'remove-value') {- if (!value) {- // no tags left in the select element- removeAllTags([currentEntry.current.path]).then(() => {- updateOpenedFile(currentEntry.current.path, {- id: '',- tags: [],- }).then(() => {- switchCurrentLocationType();+ switchLocationTypeByID(currentEntry.locationId).then(+ (currentLocationId) => {+ if (action === 'remove-value') {+ if (!value) {+ // no tags left in the select element+ removeAllTags([currentEntry.path]).then(() => {+ updateOpenedFile(currentEntry.path, {+ id: '',+ tags: [],+ }).then(() => {+ switchCurrentLocationType();+ });});- });+ } else {+ removeTags([currentEntry.path], value).then(() =>+ switchCurrentLocationType(),+ );+ }+ } else if (action === 'clear') {+ removeAllTags([currentEntry.path]).then(() =>+ switchCurrentLocationType(),+ );} else {- removeTags([currentEntry.current.path], value).then(() =>+ // create-option or select-option+ const tags =+ currentEntry.tags === undefined+ ? value+ : value.filter(+ (tag) =>+ !currentEntry.tags.some((obj) => obj.title === tag.title),+ );+ return addTags([currentEntry.path], tags).then(() =>switchCurrentLocationType(),);}- } else if (action === 'clear') {- removeAllTags([currentEntry.current.path]).then(() =>- switchCurrentLocationType(),- );- } else {- // create-option or select-option- const tags =- currentEntry.current.tags === undefined- ? value- : value.filter(- (tag) =>- !currentEntry.current.tags.some(- (obj) => obj.title === tag.title,- ),- );- return addTags([currentEntry.current.path], tags).then(() =>- switchCurrentLocationType(),- );- }- });+ },+ );};- if (- !currentEntry ||- !currentEntry.current.path ||- currentEntry.current.path === ''- ) {+ if (!currentEntry || !currentEntry.path || currentEntry.path === '') {return <div />;}function getBgndUrl() {- if (!currentEntry.current.isFile) {+ if (currentEntry && !currentEntry.isFile) {const bgndPath = getBgndFileLocationForDirectory(- currentEntry.current.path,+ currentEntry.path,PlatformIO.getDirSeparator(),);if (bgndPath !== undefined) {@@ -570,9 +525,9 @@ function EntryProperties(props: Props) {} else {return (normalizeUrl(bgndPath) +- (props.lastBackgroundImageChange &&- props.lastBackgroundImageChange.folderPath === bgndPath- ? '?' + props.lastBackgroundImageChange.dt+ (lastBackgroundImageChange &&+ lastBackgroundImageChange.folderPath === bgndPath+ ? '?' + lastBackgroundImageChange.dt: ''));}@@ -582,15 +537,18 @@ function EntryProperties(props: Props) {}function getThumbPath() {- if (currentEntry.current.isFile) {+ if (!currentEntry) {+ return undefined;+ }+ if (currentEntry.isFile) {return getThumbFileLocationForFile(- currentEntry.current.path,+ currentEntry.path,PlatformIO.getDirSeparator(),false,);}return getThumbFileLocationForDirectory(- currentEntry.current.path,+ currentEntry.path,PlatformIO.getDirSeparator(),);}@@ -607,9 +565,9 @@ function EntryProperties(props: Props) {} else {return (normalizeUrl(thumbPath) +- (props.lastThumbnailImageChange &&- props.lastThumbnailImageChange.thumbPath === thumbPath- ? '?' + props.lastThumbnailImageChange.dt+ (lastThumbnailImageChange &&+ lastThumbnailImageChange.thumbPath === thumbPath+ ? '?' + lastThumbnailImageChange.dt: ''));}@@ -617,8 +575,8 @@ function EntryProperties(props: Props) {return undefined;}- const ldtm = currentEntry.current.lmdt- ? new Date(currentEntry.current.lmdt)+ const ldtm = currentEntry.lmdt+ ? new Date(currentEntry.lmdt).toISOString().substring(0, 19).split('T')@@ -627,10 +585,11 @@ function EntryProperties(props: Props) {const changePerspective = (event: any) => {const perspective = event.target.value;- savePerspective(currentEntry.current.path, perspective)+ setDirectoryPerspective(perspective, currentEntry.path, false).then((entryMeta: TS.FileSystemEntryMeta) => {- updateOpenedFile(currentEntry.current.path, entryMeta);- return true;+ // currentEntry = {...currentEntry, perspective: perspective}+ return updateOpenedFile(currentEntry.path, entryMeta);+ // return true;}).catch((error) => {console.warn('Error saving perspective for folder ' + error);@@ -639,8 +598,8 @@ function EntryProperties(props: Props) {};let perspectiveDefault;- if (currentEntry.current.perspective) {- perspectiveDefault = currentEntry.current.perspective; // props.perspective;+ if (currentEntry.perspective) {+ perspectiveDefault = currentEntry.perspective; // props.perspective;} else {perspectiveDefault = 'unspecified'; // perspectives.DEFAULT;}@@ -672,12 +631,11 @@ function EntryProperties(props: Props) {}}- const geoLocation: any = getGeoLocation(currentEntry.current.tags);+ const geoLocation: any = getGeoLocation(currentEntry.tags);- const isCloudLocation =- currentEntry.current.url && currentEntry.current.url.length > 5;+ const isCloudLocation = currentEntry.url && currentEntry.url.length > 5;- const showLinkForDownloading = isCloudLocation && currentEntry.current.isFile;+ const showLinkForDownloading = isCloudLocation && currentEntry.isFile;return (<Root>@@ -686,15 +644,13 @@ function EntryProperties(props: Props) {<TextFielderror={fileNameError.current}label={- currentEntry.current.isFile- ? t('core:fileName')- : t('core:folderName')+ currentEntry.isFile ? t('core:fileName') : t('core:folderName')}InputProps={{readOnly: editName === undefined,endAdornment: (<InputAdornment position="end">- {!readOnlyMode && !currentEntry.current.editMode && (+ {!readOnlyMode && !currentEntry.editMode && (<div style={{ textAlign: 'right' }}>{editName !== undefined ? (<div>@@ -734,7 +690,7 @@ function EntryProperties(props: Props) {defaultValue={entryName} // currentEntry.current.name}inputRef={fileNameRef}onClick={() => {- if (!currentEntry.current.editMode && editName === undefined) {+ if (!currentEntry.editMode && editName === undefined) {activateEditNameField();}}}@@ -749,15 +705,13 @@ function EntryProperties(props: Props) {<FormHelperText>{t('core:' +- (currentEntry.current.isFile- ? 'fileNameHelp'- : 'directoryNameHelp'),+ (currentEntry.isFile ? 'fileNameHelp' : 'directoryNameHelp'),)}</FormHelperText>)}</Grid><Grid item xs={12} style={{ marginTop: 10 }}>- <TagDropContainer entryPath={currentEntry.current.path}>+ <TagDropContainer entryPath={currentEntry.path}><TagsSelectlabel={t('core:fileTags')}dataTid="PropertiesTagsSelectTID"@@ -767,10 +721,10 @@ function EntryProperties(props: Props) {currentEntry.current.editMode ||editName !== undefined}*/- tags={currentEntry.current.tags}+ tags={currentEntry.tags}tagMode="default"handleChange={handleChange}- selectedEntryPath={currentEntry.current.path}+ selectedEntryPath={currentEntry.path}/></TagDropContainer></Grid>@@ -888,13 +842,13 @@ function EntryProperties(props: Props) {<Tooltiptitle={!PlatformIO.haveObjectStoreSupport() &&- dirProps.current &&- !currentEntry.current.isFile &&- dirProps.current.dirsCount ++ dirProps &&+ !currentEntry.isFile &&+ dirProps.dirsCount +' ' +t('core:directories') +', ' +- dirProps.current.filesCount ++ dirProps.filesCount +' ' +t('core:files')}@@ -903,8 +857,8 @@ function EntryProperties(props: Props) {margin="dense"fullWidth={true}value={- currentEntry.current.size- ? formatBytes(currentEntry.current.size)+ currentEntry.size+ ? formatBytes(currentEntry.size): t(PlatformIO.haveObjectStoreSupport()? 'core:notAvailable'@@ -925,11 +879,11 @@ function EntryProperties(props: Props) {<TextFieldmargin="dense"name="path"- title={currentEntry.current.url || currentEntry.current.path}+ title={currentEntry.url || currentEntry.path}fullWidth={true}label={t('core:filePath')}data-tid="filePathProperties"- value={currentEntry.current.path || ''}+ value={currentEntry.path || ''}InputProps={{readOnly: true,startAdornment: (@@ -948,7 +902,7 @@ function EntryProperties(props: Props) {endAdornment: (<InputAdornment position="end">{!readOnlyMode &&- !currentEntry.current.editMode &&+ !currentEntry.editMode &&editName === undefined && (<Buttondata-tid="moveCopyEntryTID"@@ -1059,7 +1013,7 @@ function EntryProperties(props: Props) {)}</Grid>- {!currentEntry.current.isFile && (+ {!currentEntry.isFile && (<Grid item xs={12} style={{ marginTop: 10 }}><PerspectiveSelectoronChange={changePerspective}@@ -1070,7 +1024,7 @@ function EntryProperties(props: Props) {</Grid>)}- {!currentEntry.current.isFile && (+ {!currentEntry.isFile && (<Grid item xs={12} style={{ marginTop: 5 }}><TextFieldmargin="dense"@@ -1096,7 +1050,7 @@ function EntryProperties(props: Props) {fullWidthstyle={{width: 100,- background: currentEntry.current.color,+ background: currentEntry.color,}}onClick={toggleBackgroundColorPicker}>@@ -1123,7 +1077,7 @@ function EntryProperties(props: Props) {</IconButton></ProTooltip>))}- {currentEntry.current.color && (+ {currentEntry.color && (<><ProTooltip tooltip={t('clearFolderColor')}><span>@@ -1150,7 +1104,7 @@ function EntryProperties(props: Props) {</Grid>)}<Grid container item xs={12} spacing={1}>- <Grid item xs={currentEntry.current.isFile ? 12 : 6}>+ <Grid item xs={currentEntry.isFile ? 12 : 6}><ThumbnailTextFieldmargin="dense"label={t('core:thumbnail')}@@ -1165,7 +1119,7 @@ function EntryProperties(props: Props) {style={{ alignItems: 'center' }}>{!readOnlyMode &&- !currentEntry.current.editMode &&+ !currentEntry.editMode &&editName === undefined && (<ProTooltip tooltip={t('changeThumbnail')}><Button fullWidth onClick={toggleThumbFilesDialog}>@@ -1207,7 +1161,7 @@ function EntryProperties(props: Props) {}}/></Grid>- {!currentEntry.current.isFile && (+ {!currentEntry.isFile && (<Grid item xs={6}><ThumbnailTextFieldmargin="dense"@@ -1223,7 +1177,7 @@ function EntryProperties(props: Props) {style={{ alignItems: 'center' }}>{!readOnlyMode &&- !currentEntry.current.editMode &&+ !currentEntry.editMode &&editName === undefined && (<ProTooltip tooltip={t('changeBackgroundImage')}><Button fullWidth onClick={toggleBgndImgDialog}>@@ -1296,8 +1250,8 @@ function EntryProperties(props: Props) {onClose={toggleMoveCopyFilesDialog}entries={[{- ...currentEntry.current,- isFile: currentEntry.current.isFile,+ ...currentEntry,+ isFile: currentEntry.isFile,name: entryName,tags: [],},@@ -1308,7 +1262,7 @@ function EntryProperties(props: Props) {<ThumbnailChooserDialogopen={isFileThumbChooseDialogOpened}onClose={toggleThumbFilesDialog}- selectedFile={currentEntry.current.path}+ selectedFile={currentEntry.path}thumbPath={getThumbPath()}setThumb={setThumb}/>@@ -1317,24 +1271,24 @@ function EntryProperties(props: Props) {<LinkGeneratorDialogopen={showSharingLinkDialog}onClose={() => setShowSharingLinkDialog(false)}- path={currentEntry.current.path}- locationId={currentEntry.current.locationId}+ path={currentEntry.path}+ locationId={currentEntry.locationId}/>)}{BgndImgChooserDialog && (<BgndImgChooserDialogopen={isBgndImgChooseDialogOpened}onClose={toggleBgndImgDialog}- currentDirectoryPath={currentEntry.current.path}+ currentDirectoryPath={currentEntry.path}/>)}{CustomBackgroundDialog && (<CustomBackgroundDialog- color={currentEntry.current.color}+ color={currentEntry.color}open={displayColorPicker}setColor={handleChangeColor}onClose={toggleBackgroundColorPicker}- currentDirectoryPath={currentEntry.current.path}+ currentDirectoryPath={currentEntry.path}/*presetColors={['transparent','#FFFFFF44',@@ -1365,34 +1319,4 @@ function EntryProperties(props: Props) {);}-function mapStateToProps(state) {- return {- tagDelimiter: getTagDelimiter(state),- lastBackgroundImageChange: getLastBackgroundImageChange(state),- lastThumbnailImageChange: getLastThumbnailImageChange(state),- locations: getLocations(state),- };-}--function mapActionCreatorsToProps(dispatch) {- return bindActionCreators(- {- setLastBackgroundColorChange: AppActions.setLastBackgroundColorChange,- },- dispatch,- );-}--const areEqual = (prevProp: Props, nextProp: Props) =>- JSON.stringify(nextProp.lastThumbnailImageChange) ===- JSON.stringify(prevProp.lastThumbnailImageChange) &&- JSON.stringify(nextProp.lastBackgroundImageChange) ===- JSON.stringify(prevProp.lastBackgroundImageChange);--export default connect(- mapStateToProps,- mapActionCreatorsToProps,-)(- // @ts-ignore- React.memo(EntryProperties, areEqual),-);+export default EntryProperties;diff --git a/src/renderer/components/FolderContainer.tsx b/src/renderer/components/FolderContainer.tsxindex 082653938..a5b20f808 100644--- a/src/renderer/components/FolderContainer.tsx+++ b/src/renderer/components/FolderContainer.tsx@@ -18,8 +18,7 @@import React, { useCallback, useState } from 'react';import { useTheme } from '@mui/material/styles';-import { connect } from 'react-redux';-import { bindActionCreators } from 'redux';+import { useDispatch, useSelector } from 'react-redux';import IconButton from '@mui/material/IconButton';import Box from '@mui/material/Box';import CircularProgress from '@mui/material/CircularProgress';@@ -28,13 +27,12 @@ import Typography from '@mui/material/Typography';import ToggleButton from '@mui/material/ToggleButton';import ToggleButtonGroup from '@mui/material/ToggleButtonGroup';import AppConfig from '-/AppConfig';-// import LocationMenu from './menus/LocationMenu';+import { getDesktopMode } from '-/reducers/settings';import {- getMaxSearchResults,- getDesktopMode,- getDefaultPerspective,-} from '-/reducers/settings';-import { actions as AppActions, getProgress } from '../reducers/app';+ actions as AppActions,+ AppDispatch,+ getProgress,+} from '../reducers/app';import {GoBackIcon,GoForwardIcon,@@ -51,44 +49,30 @@ import { useTranslation } from 'react-i18next';import { useOpenedEntryContext } from '-/hooks/useOpenedEntryContext';import { useDirectoryContentContext } from '-/hooks/useDirectoryContentContext';import RenderPerspective from '-/components/RenderPerspective';-import { useLocationIndexContext } from '-/hooks/useLocationIndexContext';import { adjustKeyBinding } from '-/components/dialogs/KeyboardDialog';interface Props {- isDesktopMode: boolean;toggleDrawer?: () => void;toggleProTeaser: (slidePage?: string) => void;drawerOpened: boolean;- maxSearchResults: number;- defaultPerspective: string;- toggleUploadDialog: () => void;- progress?: Array<any>;goBack: () => void;goForward: () => void;}function FolderContainer(props: Props) {- const {- toggleDrawer,- toggleProTeaser,- isDesktopMode,- defaultPerspective,- goBack,- goForward,- drawerOpened,- progress,- toggleUploadDialog,- } = props;+ const { toggleDrawer, toggleProTeaser, goBack, goForward, drawerOpened } =+ props;const { t } = useTranslation();+ const dispatch: AppDispatch = useDispatch();const theme = useTheme();const { openedEntries } = useOpenedEntryContext();const {setSearchQuery,currentDirectoryEntries,currentDirectoryPath,- currentDirectoryPerspective,- setCurrentDirectoryPerspective,+ perspective,+ setDirectoryPerspective,enterSearchMode,isSearchMode,} = useDirectoryContentContext();@@ -96,12 +80,15 @@ function FolderContainer(props: Props) {const [isRenameEntryDialogOpened, setRenameEntryDialogOpened] =useState<boolean>(false);- let currentPerspective =- currentDirectoryPerspective || defaultPerspective || PerspectiveIDs.GRID;+ const isDesktopMode = useSelector(getDesktopMode);+ const progress = useSelector(getProgress);++ //let currentPerspective = getPerspective();+ // currentDirectoryPerspective || defaultPerspective || PerspectiveIDs.GRID;- if (currentPerspective === PerspectiveIDs.UNSPECIFIED) {+ /*if (currentPerspective === PerspectiveIDs.UNSPECIFIED) {currentPerspective = defaultPerspective;- }+ }*/const showWelcomePanel =!currentDirectoryPath && currentDirectoryEntries.length < 1;@@ -154,7 +141,7 @@ function FolderContainer(props: Props) {perspectiveId === PerspectiveIDs.GRID ||perspectiveId === PerspectiveIDs.LIST) {- setCurrentDirectoryPerspective(perspectiveId);+ setDirectoryPerspective(perspectiveId, undefined, true);} else if (perspectiveId === PerspectiveIDs.GALLERY) {toggleProTeaser(PerspectiveIDs.GALLERY);} else if (perspectiveId === PerspectiveIDs.MAPIQUE) {@@ -304,7 +291,7 @@ function FolderContainer(props: Props) {id="progressButton"title={t('core:progress')}data-tid="uploadProgress"- onClick={() => toggleUploadDialog()}+ onClick={() => dispatch(AppActions.toggleUploadDialog())}style={{position: 'relative',padding: '8px 12px 6px 8px',@@ -341,7 +328,7 @@ function FolderContainer(props: Props) {</div>{isDesktopMode && (<ToggleButtonGroup- value={currentPerspective}+ value={perspective}size="small"data-tid="floatingPerspectiveSwitcher"disabled={showWelcomePanel}@@ -363,34 +350,4 @@ function FolderContainer(props: Props) {);}-function mapStateToProps(state) {- return {- maxSearchResults: getMaxSearchResults(state),- isDesktopMode: getDesktopMode(state),- progress: getProgress(state),- defaultPerspective: getDefaultPerspective(state),- };-}--function mapActionCreatorsToProps(dispatch) {- return bindActionCreators(- {- toggleUploadDialog: AppActions.toggleUploadDialog,- },- dispatch,- );-}--const areEqual = (prevProp: Props, nextProp: Props) =>- nextProp.drawerOpened === prevProp.drawerOpened &&- nextProp.isDesktopMode === prevProp.isDesktopMode &&- /* this props is set before currentDirectoryEntries is loaded and will reload FolderContainer */- JSON.stringify(nextProp.progress) === JSON.stringify(prevProp.progress);--export default connect(- mapStateToProps,- mapActionCreatorsToProps,-)(- // @ts-ignore- React.memo(FolderContainer, areEqual),-);+export default FolderContainer;diff --git a/src/renderer/components/RenderPerspective.tsx b/src/renderer/components/RenderPerspective.tsxindex e495f9ef4..f98499c4d 100644--- a/src/renderer/components/RenderPerspective.tsx+++ b/src/renderer/components/RenderPerspective.tsx@@ -23,8 +23,6 @@ import AppConfig from '-/AppConfig';import { Pro } from '-/pro';import { PerspectiveIDs } from '-/perspectives';import { useDirectoryContentContext } from '-/hooks/useDirectoryContentContext';-import { useSelector } from 'react-redux';-import { getDefaultPerspective } from '-/reducers/settings';import LoadingLazy from '-/components/LoadingLazy';import { SortedDirContextProvider } from '-/perspectives/grid-perspective/hooks/SortedDirContextProvider';import { PaginationContextProvider } from '-/hooks/PaginationContextProvider';@@ -151,20 +149,17 @@ interface Props {function RenderPerspective(props: Props) {const { openRenameEntryDialog } = props;- const {- currentDirectoryEntries,- currentDirectoryPath,- currentDirectoryPerspective,- } = useDirectoryContentContext();+ const { currentDirectoryEntries, currentDirectoryPath, perspective } =+ useDirectoryContentContext();- const defaultPerspective = useSelector(getDefaultPerspective);+ /*const defaultPerspective = useSelector(getDefaultPerspective);let currentPerspective =currentDirectoryPerspective || defaultPerspective || PerspectiveIDs.GRID;if (currentPerspective === PerspectiveIDs.UNSPECIFIED) {currentPerspective = defaultPerspective;- }+ }*/const showWelcomePanel =!currentDirectoryPath && currentDirectoryEntries.length < 1;@@ -172,23 +167,23 @@ function RenderPerspective(props: Props) {if (showWelcomePanel) {return AppConfig.showWelcomePanel ? <WelcomePanelAsync /> : null;}- if (currentPerspective === PerspectiveIDs.LIST) {+ if (perspective === PerspectiveIDs.LIST) {return (<ListPerspectiveAsync openRenameEntryDialog={openRenameEntryDialog} />);}- if (Pro && currentPerspective === PerspectiveIDs.GALLERY) {+ if (Pro && perspective === PerspectiveIDs.GALLERY) {return <GalleryPerspectiveAsync />;}- if (Pro && currentPerspective === PerspectiveIDs.MAPIQUE) {+ if (Pro && perspective === PerspectiveIDs.MAPIQUE) {return <MapiquePerspectiveAsync />;}- if (Pro && currentPerspective === PerspectiveIDs.KANBAN) {+ if (Pro && perspective === PerspectiveIDs.KANBAN) {return (<KanBanPerspectiveAsync openRenameEntryDialog={openRenameEntryDialog} />);}- if (Pro && currentPerspective === PerspectiveIDs.FOLDERVIZ) {+ if (Pro && perspective === PerspectiveIDs.FOLDERVIZ) {return <FolderVizPerspectiveAsync />;}diff --git a/src/renderer/components/menus/DirectoryMenu.tsx b/src/renderer/components/menus/DirectoryMenu.tsxindex d4211564f..1e3e18081 100644--- a/src/renderer/components/menus/DirectoryMenu.tsx+++ b/src/renderer/components/menus/DirectoryMenu.tsx@@ -76,7 +76,7 @@ function DirectoryMenu(props: Props) {const {openDirectory,currentDirectoryPath,- setCurrentDirectoryPerspective,+ setDirectoryPerspective,openCurrentDirectory,} = useDirectoryContentContext();const { reflectCreateEntry } = useLocationIndexContext();@@ -171,7 +171,7 @@ function DirectoryMenu(props: Props) {if (switchPerspective) {switchPerspective(perspectiveId);} else {- setCurrentDirectoryPerspective(perspectiveId);+ setDirectoryPerspective(perspectiveId, undefined, true);}} else if (perspectiveId === PerspectiveIDs.GALLERY) {toggleProTeaser(PerspectiveIDs.GALLERY);diff --git a/src/renderer/hooks/DirectoryContentContextProvider.tsx b/src/renderer/hooks/DirectoryContentContextProvider.tsxindex 1e0535959..251750a9c 100644--- a/src/renderer/hooks/DirectoryContentContextProvider.tsx+++ b/src/renderer/hooks/DirectoryContentContextProvider.tsx@@ -52,6 +52,7 @@ import AppConfig from '-/AppConfig';import { PerspectiveIDs } from '-/perspectives';import { updateHistory } from '-/utils/dom';import {+ getDefaultPerspective,getShowUnixHiddenEntries,getTagColor,getTagTextColor,@@ -67,12 +68,13 @@ import { defaultTitle } from '-/services/search';import { Pro } from '-/pro';import { defaultSettings as defaultGridSettings } from '-/perspectives/grid-perspective';import { defaultSettings as defaultListSettings } from '-/perspectives/list';+import { savePerspective } from '-/utils/metaoperations';type DirectoryContentContextData = {currentLocationPath: string;currentDirectoryEntries: TS.FileSystemEntry[];directoryMeta: TS.FileSystemEntryMeta;- currentDirectoryPerspective: string;+ currentDirectoryPerspective: TS.PerspectiveType;currentDirectoryPath: string;/*** used for reorder files in KanBan@@ -110,7 +112,13 @@ type DirectoryContentContextData = {) => Promise<boolean>;openCurrentDirectory: (showHiddenEntries?: boolean) => Promise<boolean>;clearDirectoryContent: () => void;- setCurrentDirectoryPerspective: (perspective: string) => void;+ perspective: TS.PerspectiveType;+ setDirectoryPerspective: (+ perspective: string,+ dir?: string,+ isManual?: boolean,+ reload?: boolean,+ ) => Promise<TS.FileSystemEntryMeta | null>;setCurrentDirectoryColor: (color: string) => void;setCurrentDirectoryDirs: (dirs: TS.OrderVisibilitySettings[]) => void;setCurrentDirectoryFiles: (files: TS.OrderVisibilitySettings[]) => void;@@ -149,7 +157,8 @@ export const DirectoryContentContext =openDirectory: undefined,openCurrentDirectory: undefined,clearDirectoryContent: () => {},- setCurrentDirectoryPerspective: () => {},+ perspective: undefined,+ setDirectoryPerspective: undefined,setCurrentDirectoryColor: () => {},setCurrentDirectoryDirs: () => {},setCurrentDirectoryFiles: () => {},@@ -188,7 +197,8 @@ export const DirectoryContentContextProvider = ({const { selectedEntries, setSelectedEntries } = useSelectedEntriesContext();//const useGenerateThumbnails = useSelector(getUseGenerateThumbnails);const showUnixHiddenEntries = useSelector(getShowUnixHiddenEntries);- const editedEntryPaths = useSelector(getEditedEntryPaths);+ const defaultPerspective = useSelector(getDefaultPerspective);+ //const editedEntryPaths = useSelector(getEditedEntryPaths);const searches = useSelector(getSearches);const defaultBackgroundColor = useSelector(getTagColor);const defaultTextColor = useSelector(getTagTextColor);@@ -202,6 +212,7 @@ export const DirectoryContentContextProvider = ({const searchQuery = useRef<TS.SearchQuery>({});const isSearchMode = useRef<boolean>(false);const currentPerspective = useRef<TS.PerspectiveType>('unspecified');+ const manualPerspective = useRef<TS.PerspectiveType>('unspecified');const directoryMeta = useRef<TS.FileSystemEntryMeta>(getDefaultDirMeta());/*** isMetaLoaded boolean if thumbs and description from meta are loaded@@ -282,12 +293,6 @@ export const DirectoryContentContextProvider = ({}}, [editedEntryPaths]);*/- function getPerspective(): TS.PerspectiveType {- return currentPerspective.current === 'unspecified'- ? 'grid'- : currentPerspective.current;- }-function getDefaultDirMeta(): TS.FileSystemEntryMeta {const perspective = getPerspective();const settings: TS.PerspectiveSettings = {@@ -763,21 +768,49 @@ export const DirectoryContentContextProvider = ({};}, [showUnixHiddenEntries]);- function setCurrentDirectoryPerspective(+ const perspective = useMemo(+ () => getPerspective(),+ [currentPerspective.current, manualPerspective.current],+ );++ function getPerspective(): TS.PerspectiveType {+ if (currentPerspective.current === 'unspecified') {+ if (manualPerspective.current === 'unspecified') {+ return defaultPerspective;+ }+ return manualPerspective.current;+ }+ return currentPerspective.current;+ }++ function setDirectoryPerspective(perspective: TS.PerspectiveType,+ directory: string = undefined,+ isManual: boolean = false,reload: boolean = true,- ) {- currentPerspective.current = perspective;- setSelectedEntries([]);- /*if (PerspectiveIDs.KANBAN === perspective) {- // many items can't be selected in KanBan- if (selectedEntries.length > 1) {- setSelectedEntries([selectedEntries[selectedEntries.length - 1]]);+ ): Promise<TS.FileSystemEntryMeta | null> {+ return new Promise((resolve) => {+ if (isManual && currentPerspective.current === 'unspecified') {+ manualPerspective.current = perspective;+ resolve(null);+ } else {+ if (+ directory === undefined ||+ directory === currentDirectoryPath.current+ ) {+ currentPerspective.current = perspective;+ manualPerspective.current = 'unspecified';+ }+ savePerspective(+ directory ? directory : currentDirectoryPath.current,+ perspective,+ ).then((entryMeta: TS.FileSystemEntryMeta) => resolve(entryMeta));}- }*/- if (reload) {- forceUpdate();- }+ setSelectedEntries([]);+ if (reload) {+ forceUpdate();+ }+ });}/*const currentDirectoryPerspective: string = useMemo(@@ -918,7 +951,8 @@ export const DirectoryContentContextProvider = ({openDirectory,openCurrentDirectory,clearDirectoryContent,- setCurrentDirectoryPerspective,+ setDirectoryPerspective,+ perspective,setCurrentDirectoryColor,setCurrentDirectoryDirs,setCurrentDirectoryFiles,@@ -942,6 +976,7 @@ export const DirectoryContentContextProvider = ({currentDirectoryPath.current,directoryMeta.current,currentPerspective.current,+ perspective,currentDirectoryFiles.current,currentDirectoryDirs.current,isSearchMode.current,diff --git a/src/renderer/hooks/OpenedEntryContextProvider.tsx b/src/renderer/hooks/OpenedEntryContextProvider.tsxindex 63bd401ea..7c4395e6f 100644--- a/src/renderer/hooks/OpenedEntryContextProvider.tsx+++ b/src/renderer/hooks/OpenedEntryContextProvider.tsx@@ -20,6 +20,7 @@ import React, {createContext,useEffect,useMemo,+ useReducer,useRef,useState,} from 'react';@@ -34,6 +35,7 @@ import { Pro } from '-/pro';import { TS } from '-/tagspaces.namespace';import PlatformIO from '-/services/platform-facade';import {+ enhanceOpenedEntry,findExtensionsForEntry,getAllPropertiesPromise,getNextFile,@@ -47,6 +49,7 @@ import {actions as SettingsActions,getNewHTMLFileContent,getSupportedFileTypes,+ getTagDelimiter,} from '-/reducers/settings';import { getLocations } from '-/reducers/locations';import { clearURLParam, getURLParameter, updateHistory } from '-/utils/dom';@@ -77,6 +80,8 @@ import { usePlatformFacadeContext } from '-/hooks/usePlatformFacadeContext';type OpenedEntryContextData = {openedEntries: OpenedEntry[];+ currentEntry: OpenedEntry;+ dirProps: TS.DirProp;isEntryInFullWidth: boolean;sharingLink: string;sharingParentFolderLink: string;@@ -115,6 +120,8 @@ type OpenedEntryContextData = {export const OpenedEntryContext = createContext<OpenedEntryContextData>({openedEntries: [],+ currentEntry: undefined,+ dirProps: undefined,isEntryInFullWidth: false,sharingLink: undefined,sharingParentFolderLink: undefined,@@ -154,6 +161,7 @@ export const OpenedEntryContextProvider = ({const {currentDirectoryEntries,currentDirectoryPath,+ currentDirectoryPerspective,currentLocationPath,openDirectory,addDirectoryEntries,@@ -176,15 +184,19 @@ export const OpenedEntryContextProvider = ({const newHTMLFileContent = useSelector(getNewHTMLFileContent);//const initOpenLink = useSelector(getOpenLink);const editedEntryPaths = useSelector(getEditedEntryPaths);+ const tagDelimiter = useSelector(getTagDelimiter);/* const checkForUpdates = useSelector(getCheckForUpdateOnStartup);const firstRun = useSelector(isFirstRun);const enableGlobalKeyboardShortcuts = useSelector(isGlobalKeyBindingEnabled);*/- const [openedEntries, setOpenedEntries] = useState([]);- const [isEntryInFullWidth, setEntryInFullWidth] = useState(false);+ const [openedEntries, setOpenedEntries] = useState<OpenedEntry[]>([]);+ const currentEntry = useRef<OpenedEntry>(openedEntries[0]); //enhanceOpenedEntry(openedEntries[0], tagDelimiter));+ const dirProps = useRef<TS.DirProp>();+ const isEntryInFullWidth = useRef<boolean>(false);const sharingLink = useRef<string>(undefined);const sharingParentFolderLink = useRef<string>(undefined);//const havePrevOpenedFile = React.useRef<boolean>(false);const firstRender = useFirstRender();+ const [ignored, forceUpdate] = useReducer((x) => x + 1, 0, undefined);/*** Handle openLink from initApp@@ -210,14 +222,31 @@ export const OpenedEntryContextProvider = ({);}, 1000);}+ } else if (+ currentEntry.current &&+ !currentEntry.current.isFile &&+ !PlatformIO.haveObjectStoreSupport() &&+ !PlatformIO.haveWebDavSupport()+ ) {+ PlatformIO.getDirProperties(currentEntry.current.path)+ .then((dProps: TS.DirProp) => {+ dirProps.current = dProps;+ currentEntry.current.size = dProps.totalSize;+ forceUpdate();+ })+ .catch((ex) => console.debug('getDirProperties:', ex.message));}/*if (initOpenLink && initOpenLink.url) {openLink(initOpenLink.url, initOpenLink.options);}*/}, []);- /*useEffect(() => {- if (+ useEffect(() => {+ currentEntry.current = openedEntries[0];+ if (currentEntry.current) {+ forceUpdate();+ }+ /*if (!firstRender &&havePrevOpenedFile.current// && selectedEntries.length < 2@@ -243,8 +272,22 @@ export const OpenedEntryContextProvider = ({}}}- havePrevOpenedFile.current = openedEntries.length > 0;- }, [openedEntries]);*/+ havePrevOpenedFile.current = openedEntries.length > 0;*/+ }, [openedEntries]);++ useEffect(() => {+ if (+ currentEntry.current &&+ currentEntry.current.path === currentDirectoryPath+ ) {+ currentEntry.current = {+ ...currentEntry.current,+ perspective: currentDirectoryPerspective,+ };+ setOpenedEntries([currentEntry.current]);+ // forceUpdate();+ }+ }, [currentDirectoryPerspective]);/*** HANDLE REFLECT_RENAME_ENTRY@@ -444,8 +487,9 @@ export const OpenedEntryContextProvider = ({}clearURLParam('tsepath');closeOpenedEntries(); // [...openedEntries, fsEntry] // TODO uncomment for multiple file support- if (isEntryInFullWidth) {- setEntryInFullWidth(false);+ if (isEntryInFullWidth.current) {+ isEntryInFullWidth.current = false;+ forceUpdate();}}@@ -482,19 +526,23 @@ export const OpenedEntryContextProvider = ({shouldReload: !openedFile.shouldReload,});})- .catch(() =>- updateOpenedFile(openedFile.path, {+ .catch(() => {+ // @ts-ignore+ const entryMeta: TS.FileSystemEntryMeta = {...openedFile,editMode: false,shouldReload: !openedFile.shouldReload,- }),- );+ };+ return updateOpenedFile(openedFile.path, entryMeta);+ });} catch (e) {- return updateOpenedFile(openedFile.path, {+ // @ts-ignore+ const entryMeta: TS.FileSystemEntryMeta = {...openedFile,editMode: false,shouldReload: !openedFile.shouldReload,- });+ };+ return updateOpenedFile(openedFile.path, entryMeta);}}return Promise.resolve(false);@@ -547,6 +595,8 @@ export const OpenedEntryContextProvider = ({}if (fsEntryMeta.perspective) {entryForOpening.perspective = fsEntryMeta.perspective;+ } else {+ entryForOpening.perspective = 'unspecified';}if (fsEntryMeta.tags) {entryForOpening.tags = fsEntryMeta.tags;@@ -741,7 +791,13 @@ export const OpenedEntryContextProvider = ({}function toggleEntryFullWidth() {- setEntryInFullWidth(!isEntryInFullWidth);+ isEntryInFullWidth.current = !isEntryInFullWidth.current;+ forceUpdate();+ }++ function setEntryInFullWidth(fullWidth) {+ isEntryInFullWidth.current = fullWidth;+ forceUpdate();}function goForward() {@@ -1032,7 +1088,7 @@ export const OpenedEntryContextProvider = ({closeAllFiles();}};- }, [openedEntries, isEntryInFullWidth]);+ }, [openedEntries, isEntryInFullWidth.current]);const reflectDeleteFile = useMemo(() => {return (filePath: string) => {@@ -1044,12 +1100,14 @@ export const OpenedEntryContextProvider = ({closeAllFiles();}};- }, [openedEntries, isEntryInFullWidth]);+ }, [openedEntries, isEntryInFullWidth.current]);const context = useMemo(() => {return {openedEntries,- isEntryInFullWidth,+ currentEntry: currentEntry.current,+ dirProps: dirProps.current,+ isEntryInFullWidth: isEntryInFullWidth.current,sharingLink: sharingLink.current,sharingParentFolderLink: sharingParentFolderLink.current,setEntryInFullWidth,@@ -1074,7 +1132,9 @@ export const OpenedEntryContextProvider = ({};}, [openedEntries,- isEntryInFullWidth,+ currentEntry.current,+ isEntryInFullWidth.current,+ dirProps.current,currentLocation,currentDirectoryPath,fileOpenHistory,diff --git a/src/renderer/reducers/app.ts b/src/renderer/reducers/app.tsindex 1a7139243..965a55655 100644--- a/src/renderer/reducers/app.ts+++ b/src/renderer/reducers/app.ts@@ -129,7 +129,7 @@ export type OpenedEntry = {isAutoSaveEnabled?: boolean;color?: string;description?: string;- perspective?: string;+ perspective?: TS.PerspectiveType;editMode?: boolean;// changed?: boolean;/**diff --git a/src/renderer/tagspaces.namespace.d.ts b/src/renderer/tagspaces.namespace.d.tsindex c223c70c8..aa3951e0a 100644--- a/src/renderer/tagspaces.namespace.d.ts+++ b/src/renderer/tagspaces.namespace.d.ts@@ -144,7 +144,7 @@ export namespace TS {extension?: string;thumbPath?: string;color?: string;- perspective?: string;+ perspective?: TS.PerspectiveType;textContent?: string;description?: string;tags: Array<TS.Tag>;@@ -166,7 +166,7 @@ export namespace TS {tags?: Array<TS.Tag>;tagGroups?: Array<TS.TagGroup>;color?: string;- perspective?: string;+ perspective?: TS.PerspectiveType;appName?: string;appVersion?: string;lastUpdated?: number;diff --git a/src/renderer/utils/metaoperations.ts b/src/renderer/utils/metaoperations.tsindex 4d8542887..cfe84b3e6 100644--- a/src/renderer/utils/metaoperations.ts+++ b/src/renderer/utils/metaoperations.ts@@ -8,7 +8,7 @@ import { TS } from '-/tagspaces.namespace';// eslint-disable-next-line import/prefer-default-exportexport function savePerspective(path: string,- perspective: string,+ perspective: TS.PerspectiveType,): Promise<TS.FileSystemEntryMeta> {return new Promise((resolve, reject) => {loadMetaDataPromise(path)