Allow event defaults on index for text data transfer (#9840)

th-downstream
tmm576 6 years ago committed by Thibaut Girka
parent a847f3bec6
commit 30f3dad8e8

@ -166,6 +166,7 @@ export default class UI extends React.Component {
}
handleDragOver = (e) => {
if (this.dataTransferIsText(e.dataTransfer)) return false;
e.preventDefault();
e.stopPropagation();
@ -179,6 +180,7 @@ export default class UI extends React.Component {
}
handleDrop = (e) => {
if (this.dataTransferIsText(e.dataTransfer)) return;
e.preventDefault();
this.setState({ draggingOver: false });
@ -202,6 +204,10 @@ export default class UI extends React.Component {
this.setState({ draggingOver: false });
}
dataTransferIsText = (dataTransfer) => {
return (dataTransfer && Array.from(dataTransfer.types).includes('text/plain') && dataTransfer.items.length === 1);
}
closeUploadModal = () => {
this.setState({ draggingOver: false });
}

Loading…
Cancel
Save