From 05a6905d685c447d950d86d9a9c3c8a4b2cb3c93 Mon Sep 17 00:00:00 2001 From: Mike Fix Date: Sat, 23 Sep 2017 17:53:33 -0700 Subject: [PATCH] Add more emoji --- components/ReadFileDropContainer.js | 14 ++++++++------ pages/editor.js | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/components/ReadFileDropContainer.js b/components/ReadFileDropContainer.js index c635b38..b7b318a 100644 --- a/components/ReadFileDropContainer.js +++ b/components/ReadFileDropContainer.js @@ -6,13 +6,15 @@ const spec = { drop(props, monitor, component) { const bundle = monitor.getItem() Promise.all( - bundle.files.map(file => { - const reader = new FileReader() - return new Promise((resolve, reject) => { - reader.onload = event => resolve(event.target.result) - reader.readAsText(file, 'UTF-8'); + bundle.files + .filter(props.filter || (i => i)) + .map(file => { + const reader = new FileReader() + return new Promise((resolve, reject) => { + reader.onload = event => resolve(event.target.result) + reader.readAsText(file, 'UTF-8'); + }) }) - }) ).then(contents => { bundle.contents = contents component.setState(state => ({ diff --git a/pages/editor.js b/pages/editor.js index 775c6ac..684ecca 100644 --- a/pages/editor.js +++ b/pages/editor.js @@ -123,8 +123,8 @@ class Editor extends React.Component { this.setState({ code })}> { - ({ isOver }) => ( - + ({ isOver, canDrop }) => ( + {this.state.code}