export default function parseDataTransfer ( e , callback ) { const { items } = e . clipboardData ; if ( items && items . length ) { for ( let i = 0 ; i < items . length ; i ++ ) { const item = items [ i ] ; if ( item . type . indexOf ( 'image' ) !== - 1 ) { const file = item . getAsFile ( ) ; if ( file ) { callback ( file ) ; } e . preventDefault ( ) ; break ; } } } }