mirror of
https://github.com/zadam/trilium.git
synced 2025-10-27 08:16:40 +01:00
fix(react/dialog): delete note not working properly
This commit is contained in:
@@ -38,7 +38,6 @@ function DeleteNotesDialogComponent({ forceDeleteAllClones, branchIdsToDelete, c
|
|||||||
const [ eraseNotes, setEraseNotes ] = useState(!!forceDeleteAllClones);
|
const [ eraseNotes, setEraseNotes ] = useState(!!forceDeleteAllClones);
|
||||||
const [ brokenRelations, setBrokenRelations ] = useState<DeleteNotesPreview["brokenRelations"]>([]);
|
const [ brokenRelations, setBrokenRelations ] = useState<DeleteNotesPreview["brokenRelations"]>([]);
|
||||||
const [ noteIdsToBeDeleted, setNoteIdsToBeDeleted ] = useState<DeleteNotesPreview["noteIdsToBeDeleted"]>([]);
|
const [ noteIdsToBeDeleted, setNoteIdsToBeDeleted ] = useState<DeleteNotesPreview["noteIdsToBeDeleted"]>([]);
|
||||||
const [ proceed, setProceed ] = useState(false);
|
|
||||||
const okButtonRef = useRef<HTMLButtonElement>(null);
|
const okButtonRef = useRef<HTMLButtonElement>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -62,14 +61,14 @@ function DeleteNotesDialogComponent({ forceDeleteAllClones, branchIdsToDelete, c
|
|||||||
scrollable
|
scrollable
|
||||||
title={t("delete_notes.delete_notes_preview")}
|
title={t("delete_notes.delete_notes_preview")}
|
||||||
onShown={() => okButtonRef.current?.focus()}
|
onShown={() => okButtonRef.current?.focus()}
|
||||||
onHidden={() => callback?.({ proceed, deleteAllClones, eraseNotes })}
|
onHidden={() => callback?.({ proceed: false })}
|
||||||
footer={<>
|
footer={<>
|
||||||
<Button text={t("delete_notes.cancel")}
|
<Button text={t("delete_notes.cancel")}
|
||||||
onClick={() => closeActiveDialog()} />
|
onClick={() => closeActiveDialog()} />
|
||||||
<Button text={t("delete_notes.ok")} primary
|
<Button text={t("delete_notes.ok")} primary
|
||||||
buttonRef={okButtonRef}
|
buttonRef={okButtonRef}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setProceed(true);
|
callback?.({ proceed: true, deleteAllClones, eraseNotes });
|
||||||
closeActiveDialog();
|
closeActiveDialog();
|
||||||
}} />
|
}} />
|
||||||
</>}
|
</>}
|
||||||
|
|||||||
Reference in New Issue
Block a user