1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Prevent error whilst drag/drop importing from leaving dropTarget visible

Fixes #2982
This commit is contained in:
Nick O'Leary 2021-05-11 14:10:40 +01:00
parent e641b0a965
commit 3e43597617
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -1260,6 +1260,7 @@ RED.clipboard = (function() {
hideDropTarget();
})
.on("drop",function(event) {
try {
if ($.inArray("text/plain",event.originalEvent.dataTransfer.types) != -1) {
var data = event.originalEvent.dataTransfer.getData("text/plain");
data = data.substring(data.indexOf('['),data.lastIndexOf(']')+1);
@ -1277,6 +1278,10 @@ RED.clipboard = (function() {
reader.readAsText(file);
}
}
} catch(err) {
// Ensure any errors throw above doesn't stop the drop target from
// being hidden.
}
hideDropTarget();
event.preventDefault();
});