mirror of
https://github.com/PeWu/topola-viewer.git
synced 2026-08-02 00:51:47 +00:00
Fix for File Selector not being able to select .ged files on mobile devices (#293)
This commit is contained in:
@@ -13,6 +13,14 @@ interface Props {
|
|||||||
menuType: MenuType;
|
menuType: MenuType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On touch devices (iOS, Android) the browser's file picker ignores unknown
|
||||||
|
* extensions like .ged and may restrict selection to photos when image types
|
||||||
|
* are listed. Omitting the `accept` attribute lets the OS file browser show
|
||||||
|
* all files without filtering.
|
||||||
|
*/
|
||||||
|
const isMobileDevice = /Android|iPhone|iPad|iPod/i.test(navigator.userAgent);
|
||||||
|
|
||||||
/** Displays and handles the "Open file" menu. */
|
/** Displays and handles the "Open file" menu. */
|
||||||
export function UploadMenu(props: Props) {
|
export function UploadMenu(props: Props) {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@@ -84,7 +92,11 @@ export function UploadMenu(props: Props) {
|
|||||||
<input
|
<input
|
||||||
className="hidden"
|
className="hidden"
|
||||||
type="file"
|
type="file"
|
||||||
accept=".ged,.gdz,.gedzip,.zip,.webp,image/*"
|
accept={
|
||||||
|
isMobileDevice
|
||||||
|
? undefined
|
||||||
|
: '.ged,.gdz,.gedzip,.zip,.jpg,.jpeg,.png,.gif,.webp'
|
||||||
|
}
|
||||||
id="fileInput"
|
id="fileInput"
|
||||||
multiple
|
multiple
|
||||||
onChange={handleUpload}
|
onChange={handleUpload}
|
||||||
|
|||||||
Reference in New Issue
Block a user