diff --git a/Changelog.md b/Changelog.md index 7a1d7ff1..b2f69d75 100644 --- a/Changelog.md +++ b/Changelog.md @@ -8,6 +8,8 @@ - Valid Modem Firmware for Thingy:91 was previously detected as incorrect. - Show the device family in the Memory layout title for MCUboot devices. +- Windows and Linux: Dragging and dropping a file into the file memory layout + opened the file in an editor. ### Removed diff --git a/src/components/ControlPanel.tsx b/src/components/ControlPanel.tsx index 0543eb20..07a5d3c7 100644 --- a/src/components/ControlPanel.tsx +++ b/src/components/ControlPanel.tsx @@ -51,6 +51,9 @@ const useRegisterDragEvents = () => { const onDrop = async (event: DragEvent) => { if (!event.dataTransfer) return; + // calling this after our code would result in opening the file in an editor (atleast this was the case on linux) + event.preventDefault(); + // eslint-disable-next-line no-restricted-syntax for (const file of event.dataTransfer.files) { // eslint-disable-next-line no-await-in-loop @@ -60,8 +63,6 @@ const useRegisterDragEvents = () => { ) ); } - - event.preventDefault(); }; document.body.addEventListener('drop', onDrop);