Only show drop files message in details view when dragging a file

In testing, making labels draggable resulted in a lot of annoying,
flashing indications of drop targets in places where text cannot
be dropped. This change causes the details view to show the message
panel indicating that a file can be dropped only when the drag contains
a file.
This commit is contained in:
Coises 2018-08-16 00:56:04 -07:00
parent 150f258b70
commit 7a3cc9c863
1 changed files with 6 additions and 0 deletions

View File

@ -564,6 +564,12 @@ const DetailsView = Backbone.View.extend({
dragover: function(e) {
e.preventDefault();
const dt = e.originalEvent.dataTransfer;
if (!dt.types || (dt.types.indexOf ? dt.types.indexOf('Files') === -1 : !dt.types.contains('Files'))) {
dt.dropEffect = 'none';
return;
}
dt.dropEffect = 'copy';
if (this.dragTimeout) {
clearTimeout(this.dragTimeout);
}