Skip to content

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

chore: disabling closing of the create new file dialogs on backdrop click

Ilian Sapundshievc71b119f999f
diff --git a/src/renderer/components/dialogs/NewEntryDialog.tsx b/src/renderer/components/dialogs/NewEntryDialog.tsx
index d63017360..b7127e799 100644
--- a/src/renderer/components/dialogs/NewEntryDialog.tsx
+++ b/src/renderer/components/dialogs/NewEntryDialog.tsx
@@ -36,7 +36,7 @@ import { useTranslation } from 'react-i18next';
interface Props {
open: boolean;
- onClose: () => void;
+ onClose: (event?: Object, reason?: string) => void;
}
function NewEntryDialog(props: Props) {
@@ -58,7 +58,10 @@ function NewEntryDialog(props: Props) {
>
<DialogTitle style={{ cursor: 'move' }} id="draggable-dialog-title">
{t('core:create') + '...'}
- <DialogCloseButton testId="closeCreateDialogTID" onClose={onClose} />
+ <DialogCloseButton
+ testId="closeCreateDialogTID"
+ onClose={() => onClose()}
+ />
</DialogTitle>
<DialogContent
style={{
@@ -67,7 +70,7 @@ function NewEntryDialog(props: Props) {
marginBottom: 20,
overflow: 'overlay',
}}
- data-tid="keyboardShortCutsDialog"
+ data-tid="newEntryDialog"
>
<Accordion style={{ marginTop: 5 }} defaultExpanded>
<AccordionDetails style={{ paddingTop: 16 }}>
diff --git a/src/renderer/components/dialogs/NewFileDialog.tsx b/src/renderer/components/dialogs/NewFileDialog.tsx
index 181d987e9..8ce46a3b8 100644
--- a/src/renderer/components/dialogs/NewFileDialog.tsx
+++ b/src/renderer/components/dialogs/NewFileDialog.tsx
@@ -32,7 +32,7 @@ import { useTranslation } from 'react-i18next';
interface Props {
open: boolean;
- onClose: () => void;
+ onClose: (event?: Object, reason?: string) => void;
}
function NewFileDialog(props: Props) {
@@ -63,7 +63,7 @@ function NewFileDialog(props: Props) {
marginBottom: 20,
overflow: 'overlay',
}}
- data-tid="keyboardShortCutsDialog"
+ data-tid="newFileDialog"
>
<CreateFile onClose={onClose} />
<TargetPath />
diff --git a/src/renderer/containers/MainPage.tsx b/src/renderer/containers/MainPage.tsx
index b8f8c17ee..1be04126d 100644
--- a/src/renderer/containers/MainPage.tsx
+++ b/src/renderer/containers/MainPage.tsx
@@ -650,12 +650,20 @@ function MainPage(props: Props) {
)}
<NewEntryDialog
open={props.isNewEntryDialogOpened}
- onClose={toggleNewEntryDialog}
+ onClose={(event, reason) => {
+ if (reason !== 'backdropClick') {
+ toggleNewEntryDialog();
+ }
+ }}
/>
{props.isNewFileDialogOpened && (
<NewFileDialog
open={props.isNewFileDialogOpened}
- onClose={toggleNewFileDialog}
+ onClose={(event, reason) => {
+ if (reason !== 'backdropClick') {
+ toggleNewFileDialog();
+ }
+ }}
/>
)}
{props.isNewAudioDialogOpened && (