frontend: ignore drop event in form, trigger upload instead of file input dialog (fixes #74, maybe)
This commit is contained in:
parent
5193acd9cd
commit
798ff9fb1b
|
@ -160,6 +160,7 @@ export default class FileDrop extends React.PureComponent<FileDropProps, FileDro
|
||||||
}
|
}
|
||||||
|
|
||||||
handleDrop: ReactDragEventHandler<HTMLDivElement> = (event) => {
|
handleDrop: ReactDragEventHandler<HTMLDivElement> = (event) => {
|
||||||
|
event.preventDefault?.()
|
||||||
if (this.props.onDrop && FileDrop.eventHasFiles(event)) {
|
if (this.props.onDrop && FileDrop.eventHasFiles(event)) {
|
||||||
const files = event.dataTransfer ? event.dataTransfer.files : null
|
const files = event.dataTransfer ? event.dataTransfer.files : null
|
||||||
this.props.onDrop(files, event)
|
this.props.onDrop(files, event)
|
||||||
|
|
|
@ -18,6 +18,8 @@ export default function FileUploadField({onSelect: onSelect_, multiple}) {
|
||||||
)
|
)
|
||||||
|
|
||||||
function onChangeField(e) {
|
function onChangeField(e) {
|
||||||
|
e.preventDefault?.()
|
||||||
|
|
||||||
if (e.target.files && e.target.files.length) {
|
if (e.target.files && e.target.files.length) {
|
||||||
onSelect(e.target.files)
|
onSelect(e.target.files)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue