mirror of
https://github.com/zadam/trilium.git
synced 2025-10-31 19:49:01 +01:00
fix(client/import): file remains from previous instance (closes #7428)
This commit is contained in:
parent
00720ae58f
commit
8fc7a20220
@ -51,7 +51,10 @@ export default function ImportDialog() {
|
|||||||
setShown(false);
|
setShown(false);
|
||||||
await importService.uploadFiles("notes", parentNoteId, Array.from(files), options);
|
await importService.uploadFiles("notes", parentNoteId, Array.from(files), options);
|
||||||
}}
|
}}
|
||||||
onHidden={() => setShown(false)}
|
onHidden={() => {
|
||||||
|
setShown(false);
|
||||||
|
setFiles(null);
|
||||||
|
}}
|
||||||
footer={<Button text={t("import.import")} primary disabled={!files} />}
|
footer={<Button text={t("import.import")} primary disabled={!files} />}
|
||||||
show={shown}
|
show={shown}
|
||||||
>
|
>
|
||||||
|
|||||||
@ -47,7 +47,10 @@ export default function UploadAttachmentsDialog() {
|
|||||||
setIsUploading(false);
|
setIsUploading(false);
|
||||||
setShown(false);
|
setShown(false);
|
||||||
}}
|
}}
|
||||||
onHidden={() => setShown(false)}
|
onHidden={() => {
|
||||||
|
setShown(false);
|
||||||
|
setFiles(null);
|
||||||
|
}}
|
||||||
show={shown}
|
show={shown}
|
||||||
>
|
>
|
||||||
<FormGroup name="files" label={t("upload_attachments.choose_files")} description={description}>
|
<FormGroup name="files" label={t("upload_attachments.choose_files")} description={description}>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { Ref } from "preact";
|
import { Ref } from "preact";
|
||||||
import Button, { ButtonProps } from "./Button";
|
import Button, { ButtonProps } from "./Button";
|
||||||
import { useRef } from "preact/hooks";
|
import { useEffect, useRef } from "preact/hooks";
|
||||||
|
|
||||||
interface FormFileUploadProps {
|
interface FormFileUploadProps {
|
||||||
name?: string;
|
name?: string;
|
||||||
@ -11,6 +11,11 @@ interface FormFileUploadProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function FormFileUpload({ inputRef, name, onChange, multiple, hidden }: FormFileUploadProps) {
|
export default function FormFileUpload({ inputRef, name, onChange, multiple, hidden }: FormFileUploadProps) {
|
||||||
|
// Prevent accidental reuse of a file selected in a previous instance of the upload form.
|
||||||
|
useEffect(() => {
|
||||||
|
onChange(null);
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<label class="tn-file-input tn-input-field" style={hidden ? { display: "none" } : undefined}>
|
<label class="tn-file-input tn-input-field" style={hidden ? { display: "none" } : undefined}>
|
||||||
<input
|
<input
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user