-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent browser from loading dragged file when drag-area is missed (#…
…3222) * prevent browser from loading dragged file when drag-area is missed (fixes #3196) * update changelog * add missing type annotation
- Loading branch information
1 parent
9628dde
commit 73d81ad
Showing
3 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// @flow | ||
|
||
import React from "react"; | ||
|
||
export default class DisableGenericDnd extends React.Component<{}> { | ||
componentDidMount() { | ||
window.addEventListener("dragover", this.preventDefault, false); | ||
window.addEventListener("drop", this.preventDefault, false); | ||
} | ||
|
||
componentWillUnmount() { | ||
window.removeEventListener("dragover", this.preventDefault); | ||
window.removeEventListener("drop", this.preventDefault); | ||
} | ||
|
||
preventDefault = (e: Event) => { | ||
e.preventDefault(); | ||
}; | ||
|
||
render() { | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters