Skip to content

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

chore: improving file deletion experience

Ilian Sapundshiev6e3b3b6f4cf9
diff --git a/src/renderer/components/EntryContainer.tsx b/src/renderer/components/EntryContainer.tsx
index 73fbd371f..29cdaf1d6 100644
--- a/src/renderer/components/EntryContainer.tsx
+++ b/src/renderer/components/EntryContainer.tsx
@@ -842,6 +842,7 @@ function EntryContainer() {
nextDocument: openNextFileAction,
prevDocument: openPrevFileAction,
reloadDocument: reloadDocument,
+ deleteDocument: () => {}, // TODO move delete functionality from entry container menu
openInFullWidth: toggleEntryFullWidth,
toggleFullScreen,
}}
@@ -852,6 +853,7 @@ function EntryContainer() {
nextDocument: keyBindings.nextDocument,
prevDocument: keyBindings.prevDocument,
reloadDocument: keyBindings.reloadDocument,
+ deleteDocument: keyBindings.deleteDocument,
openInFullWidth: keyBindings.openInFullWidth,
toggleFullScreen: keyBindings.toggleFullScreen,
}}
diff --git a/src/renderer/components/EntryContainerMenu.tsx b/src/renderer/components/EntryContainerMenu.tsx
index f82e8284a..ae6585d77 100644
--- a/src/renderer/components/EntryContainerMenu.tsx
+++ b/src/renderer/components/EntryContainerMenu.tsx
@@ -468,6 +468,10 @@ function EntryContainerMenu(props: Props) {
</MenuItem>,
);
+ const entryName = openedEntry.path
+ ? extractDirectoryName(openedEntry.path, PlatformIO.getDirSeparator())
+ : '';
+
return (
<>
<Menu
@@ -501,14 +505,10 @@ function EntryContainerMenu(props: Props) {
openedEntry.isFile
? t('core:doYouWantToDeleteFile')
: t('core:deleteDirectoryContentConfirm', {
- dirPath: openedEntry.path
- ? extractDirectoryName(
- openedEntry.path,
- PlatformIO.getDirSeparator(),
- )
- : '',
+ dirPath: entryName,
})
}
+ list={openedEntry.isFile && [entryName]}
confirmCallback={(result) => {
if (result) {
return deleteFile(openedEntry.path, openedEntry.uuid);