Attempt to intercept cancellation

This commit is contained in:
Manav Rathi 2025-02-20 11:20:54 +05:30
parent ca28a3c595
commit 8618babc11
No known key found for this signature in database

View File

@ -851,13 +851,33 @@ const Inputs: React.FC<InputsProps> = ({
getFileSelectorInputProps,
getFolderSelectorInputProps,
getZipFileSelectorInputProps,
}) => (
<>
<input {...getFileSelectorInputProps()} />
<input {...getFolderSelectorInputProps()} />
<input {...getZipFileSelectorInputProps()} />
</>
);
}) => {
const refFile = useRef(null);
const refFolder = useRef(null);
const refZip = useRef(null);
useEffect(() => {
const handleCancel = () => {
console.log("cancel");
};
[refFile, refFolder, refZip].map((ref) =>
ref.current?.addEventListener("cancel", handleCancel),
);
return () => {
[refFile, refFolder, refZip].map((ref) =>
ref.current?.removeEventListener("cancel", handleCancel),
);
};
}, []);
return (
<>
<input ref={refFile} {...getFileSelectorInputProps()} />
<input ref={refFolder} {...getFolderSelectorInputProps()} />
<input ref={refZip} {...getZipFileSelectorInputProps()} />
</>
);
};
const desktopFilesAndZipItems = async (electron: Electron, files: File[]) => {
const fileAndPaths: FileAndPath[] = [];