diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e994305826..4884c800766 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.md). - The welcome header will now also show on the default page if there are no existing organisations. [#3133](https://github.com/scalableminds/webknossos/pull/3133) - Simplified the sharing of tracings. Users can simply copy the active URL from the browser's URL bar to share a tracing (assuming the tracing is public). [#3176](https://github.com/scalableminds/webknossos/pull/3176) - Improved general performance of the tracing view by leveraging web workers. [#3162](https://github.com/scalableminds/webknossos/pull/3162) +- Improved overall drag-and-drop behavior by preventing the browser from opening the dragged file when the actual drag target was missed. [#3222](https://github.com/scalableminds/webknossos/pull/3222) - The checkboxes in the user list view will clear now after the experience domains of users have been changed. [#3178](https://github.com/scalableminds/webknossos/pull/3178) - Resetting a user's task requires a confirmation now. [#3181](https://github.com/scalableminds/webknossos/pull/3181) diff --git a/app/assets/javascripts/components/disable_generic_dnd.js b/app/assets/javascripts/components/disable_generic_dnd.js new file mode 100644 index 00000000000..8e570e4c901 --- /dev/null +++ b/app/assets/javascripts/components/disable_generic_dnd.js @@ -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; + } +} diff --git a/app/assets/javascripts/router.js b/app/assets/javascripts/router.js index 2a4df4c4c28..b1779a123f0 100644 --- a/app/assets/javascripts/router.js +++ b/app/assets/javascripts/router.js @@ -12,6 +12,7 @@ import { ControlModeEnum } from "oxalis/constants"; import { APITracingTypeEnum } from "admin/api_flow_types"; import { getAnnotationInformation } from "admin/admin_rest_api"; import SecuredRoute from "components/secured_route"; +import DisableGenericDnd from "components/disable_generic_dnd"; import Navbar from "navbar"; import { Imprint, Privacy } from "components/legal"; @@ -113,6 +114,7 @@ class ReactRouter extends React.Component { return ( +