Last active
July 1, 2018 08:00
-
-
Save levvsha/2e7f032c0fc9a57f796c9f2739da1cf8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
handleDroppedFiles(selection, files) { | |
const filteredFiles = files | |
.filter(file => (file.type.indexOf('image/') === 0)); // <-- [1] | |
if (!filteredFiles.length) { | |
return 'not_handled'; | |
} | |
this.onChange(addNewBlockAt( // <-- [2] | |
this.state.editorState, | |
selection.getAnchorKey(), | |
'SLIDER', | |
new Map({ slides: _map( | |
filteredFiles, | |
file => ({ url: urlCreator.createObjectURL(file) }) // <-- [3] | |
)}) | |
)); | |
return 'handled'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment