Skip to content

Commit

Permalink
Fix media placeholder drag over state
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Dec 3, 2020
1 parent e51ac7e commit ed23aec
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/components/src/drop-zone/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@ const { Provider } = Context;

function getDragEventType( { dataTransfer } ) {
if ( dataTransfer ) {
if ( getFilesFromDataTransfer( dataTransfer ).length > 0 ) {
return 'file';
}

// Use lodash `includes` here as in the Edge browser `types` is implemented
// as a DomStringList, whereas in other browsers it's an array. `includes`
// happily works with both types.
if (
includes( dataTransfer.types, 'Files' ) ||
getFilesFromDataTransfer( dataTransfer ).length > 0
) {
return 'file';
}

if ( includes( dataTransfer.types, 'text/html' ) ) {
return 'html';
}
Expand Down

0 comments on commit ed23aec

Please sign in to comment.