(null);
const onOutFormatLockedClick = useCallback(() => setOutFormatLocked((v) => (v ? undefined : fileFormat)), [fileFormat, setOutFormatLocked]);
@@ -55,6 +58,22 @@ function TopMenu({
return ;
}
+ // Convenience for drag and drop: https://github.com/mifi/lossless-cut/issues/2147
+ useEffect(() => {
+ async function onDrop(ev: DragEvent) {
+ ev.preventDefault();
+ if (!ev.dataTransfer) return;
+ const paths = [...ev.dataTransfer.files].map((f) => f.path);
+ const [firstPath] = paths;
+ if (paths.length === 1 && firstPath && (await stat(firstPath)).isDirectory()) {
+ setCustomOutDir(firstPath);
+ }
+ }
+ const element = workingDirButtonRef.current;
+ element?.addEventListener('drop', onDrop);
+ return () => element?.removeEventListener('drop', onDrop);
+ }, [setCustomOutDir]);
+
return (
) {
- return (
- // eslint-disable-next-line react/jsx-props-no-spreading, react/button-has-type
-
- );
-}
+// eslint-disable-next-line react/display-name
+const Button = forwardRef, HTMLButtonElement>>(({ type = 'button', ...props }, ref) => (
+ // eslint-disable-next-line react/jsx-props-no-spreading, react/button-has-type
+
+));
-export default memo(Button);
+export default Button;