|
|
@ -6,13 +6,15 @@ const spec = {
|
|
|
|
drop(props, monitor, component) {
|
|
|
|
drop(props, monitor, component) {
|
|
|
|
const bundle = monitor.getItem()
|
|
|
|
const bundle = monitor.getItem()
|
|
|
|
Promise.all(
|
|
|
|
Promise.all(
|
|
|
|
bundle.files.map(file => {
|
|
|
|
bundle.files
|
|
|
|
const reader = new FileReader()
|
|
|
|
.filter(props.filter || (i => i))
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
.map(file => {
|
|
|
|
reader.onload = event => resolve(event.target.result)
|
|
|
|
const reader = new FileReader()
|
|
|
|
reader.readAsText(file, 'UTF-8');
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
|
|
|
reader.onload = event => resolve(event.target.result)
|
|
|
|
|
|
|
|
reader.readAsText(file, 'UTF-8');
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
).then(contents => {
|
|
|
|
).then(contents => {
|
|
|
|
bundle.contents = contents
|
|
|
|
bundle.contents = contents
|
|
|
|
component.setState(state => ({
|
|
|
|
component.setState(state => ({
|
|
|
|