mirror of
https://github.com/glitch-soc/mastodon.git
synced 2024-11-28 19:10:22 -05:00
Allow event defaults on index for text data transfer (#9840)
This commit is contained in:
parent
a93cb340bd
commit
9b5810b3e9
@ -166,6 +166,7 @@ export default class UI extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleDragOver = (e) => {
|
handleDragOver = (e) => {
|
||||||
|
if (this.dataTransferIsText(e.dataTransfer)) return false;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
@ -179,6 +180,7 @@ export default class UI extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleDrop = (e) => {
|
handleDrop = (e) => {
|
||||||
|
if (this.dataTransferIsText(e.dataTransfer)) return;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
this.setState({ draggingOver: false });
|
this.setState({ draggingOver: false });
|
||||||
@ -202,6 +204,10 @@ export default class UI extends React.Component {
|
|||||||
this.setState({ draggingOver: false });
|
this.setState({ draggingOver: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dataTransferIsText = (dataTransfer) => {
|
||||||
|
return (dataTransfer && Array.from(dataTransfer.types).includes('text/plain') && dataTransfer.items.length === 1);
|
||||||
|
}
|
||||||
|
|
||||||
closeUploadModal = () => {
|
closeUploadModal = () => {
|
||||||
this.setState({ draggingOver: false });
|
this.setState({ draggingOver: false });
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user