Skip to content

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

fix tmb of folder as tmb for parent folder

Stanimir5eb6fb36bf66
diff --git a/package-lock.json b/package-lock.json
index ecf174a77..56915d5a5 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -196,7 +196,7 @@
"yarn": "please-use-npm"
},
"optionalDependencies": {
- "@tagspacespro/tagspacespro": "5.0.33"
+ "@tagspacespro/tagspacespro": "5.0.34"
}
},
"node_modules/@aashutoshrathi/word-wrap": {
@@ -13529,9 +13529,9 @@
}
},
"node_modules/@tagspacespro/tagspacespro": {
- "version": "5.0.33",
- "resolved": "https://npm.pkg.github.com/download/@tagspacespro/tagspacespro/5.0.33/bd28bd4106917b4cd37039960bb33eac8fe4d6ca",
- "integrity": "sha512-/WupbWWAzZvZwu/zk0xDORTsaBcNqfRDouHx8RkDmNh07VGxWIfzeisW33t7aW70LEhQ+YlxIPIULhWN2kpkjA==",
+ "version": "5.0.34",
+ "resolved": "https://npm.pkg.github.com/download/@tagspacespro/tagspacespro/5.0.34/f93136bac5b4a58377f0f27c665600a3be022123",
+ "integrity": "sha512-TwIrJK+p05TwaoOlfFEFZd4Br4lj7oumXX/1hyVMGl3rvHrxcNy7vp44XfKd3Bw4u4j4yVbegk51FZhMiSCnwg==",
"license": "Proprietary",
"optional": true
},
@@ -59428,9 +59428,9 @@
}
},
"@tagspacespro/tagspacespro": {
- "version": "5.0.33",
- "resolved": "https://npm.pkg.github.com/download/@tagspacespro/tagspacespro/5.0.33/bd28bd4106917b4cd37039960bb33eac8fe4d6ca",
- "integrity": "sha512-/WupbWWAzZvZwu/zk0xDORTsaBcNqfRDouHx8RkDmNh07VGxWIfzeisW33t7aW70LEhQ+YlxIPIULhWN2kpkjA==",
+ "version": "5.0.34",
+ "resolved": "https://npm.pkg.github.com/download/@tagspacespro/tagspacespro/5.0.34/f93136bac5b4a58377f0f27c665600a3be022123",
+ "integrity": "sha512-TwIrJK+p05TwaoOlfFEFZd4Br4lj7oumXX/1hyVMGl3rvHrxcNy7vp44XfKd3Bw4u4j4yVbegk51FZhMiSCnwg==",
"optional": true
},
"@teamsupercell/typings-for-css-modules-loader": {
diff --git a/src/renderer/components/EntryProperties.tsx b/src/renderer/components/EntryProperties.tsx
index 91ad6700f..1185740f5 100644
--- a/src/renderer/components/EntryProperties.tsx
+++ b/src/renderer/components/EntryProperties.tsx
@@ -505,6 +505,10 @@ function EntryProperties(props: Props) {
openedEntry.meta?.thumbPath,
openedEntry.meta?.lastUpdated,
);
+ const backgroundUrl = location.getFolderBgndPath(
+ openedEntry.path,
+ openedEntry.meta?.lastUpdated,
+ );
return (
<Root>
@@ -1102,13 +1106,7 @@ function EntryProperties(props: Props) {
style={{
backgroundSize: 'cover',
backgroundRepeat: 'no-repeat',
- backgroundImage:
- 'url("' +
- location.getFolderBgndPath(
- openedEntry.path,
- openedEntry.meta?.lastUpdated,
- ) +
- '")',
+ backgroundImage: 'url("' + backgroundUrl + '")',
backgroundPosition: 'center',
borderRadius: 8,
minHeight: 150,
diff --git a/src/renderer/components/menus/DirectoryMenu.tsx b/src/renderer/components/menus/DirectoryMenu.tsx
index ede3cdc9a..ee0ec618f 100644
--- a/src/renderer/components/menus/DirectoryMenu.tsx
+++ b/src/renderer/components/menus/DirectoryMenu.tsx
@@ -22,7 +22,7 @@ import Menu from '@mui/material/Menu';
import { formatDateTime4Tag } from '@tagspaces/tagspaces-common/misc';
import AppConfig from '-/AppConfig';
import {
- extractContainingDirectoryPath,
+ extractParentDirectoryPath,
extractDirectoryName,
getThumbFileLocationForDirectory,
normalizePath,
@@ -52,6 +52,8 @@ import { usePlatformFacadeContext } from '-/hooks/usePlatformFacadeContext';
import { useThumbGenerationContext } from '-/hooks/useThumbGenerationContext';
import { generateClipboardLink } from '-/utils/dom';
import { useEditedEntryContext } from '-/hooks/useEditedEntryContext';
+import { TS } from '-/tagspaces.namespace';
+import { useIOActionsContext } from '-/hooks/useIOActionsContext';
interface Props {
open: boolean;
@@ -75,6 +77,7 @@ function DirectoryMenu(props: Props) {
const { addTags } = useTaggingActionsContext();
const { currentLocation, readOnlyMode, getLocationPath, findLocation } =
useCurrentLocationContext();
+ const { setThumbnailImageChange } = useIOActionsContext();
const { showNotification } = useNotificationContext();
const {
openDirectory,
@@ -355,7 +358,7 @@ Do you want to continue?`)
}
function setFolderThumbnail() {
- const parentDirectoryPath = extractContainingDirectoryPath(
+ const parentDirectoryPath = extractParentDirectoryPath(
directoryPath,
currentLocation?.getDirSeparator(),
);
@@ -363,19 +366,28 @@ Do you want to continue?`)
parentDirectoryPath,
currentLocation?.getDirSeparator(),
);
+ const targetThumbPath = getThumbFileLocationForDirectory(
+ parentDirectoryPath,
+ currentLocation?.getDirSeparator(),
+ );
copyFilePromise(
getThumbFileLocationForDirectory(
directoryPath,
currentLocation?.getDirSeparator(),
),
- getThumbFileLocationForDirectory(
- parentDirectoryPath,
- currentLocation?.getDirSeparator(),
- ),
+ targetThumbPath,
t('core:thumbAlreadyExists', { directoryName: parentDirectoryName }),
)
.then(() => {
+ const entry: TS.FileSystemEntry = currentLocation.toFsEntry(
+ parentDirectoryPath,
+ false,
+ );
+ setThumbnailImageChange({
+ ...entry,
+ meta: { id: entry.uuid, thumbPath: targetThumbPath },
+ });
showNotification(
'Thumbnail created for: ' + parentDirectoryPath,
'default',