Skip to content

Commit

Permalink
don't proceed with image drop unless on change and on image drop are …
Browse files Browse the repository at this point in the history
…defined
  • Loading branch information
Jonathon Kelly committed Apr 8, 2016
1 parent 0736f8a commit dbc178c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/index.js
Expand Up @@ -32,6 +32,10 @@ class MarkdownEditor extends React.Component {

this.setState({ draggingOver: false });

if (!this.props.onImageDrop || !this.props.onChange) {
return;
}

const files = event.dataTransfer ? event.dataTransfer.files : event.target.files;
const filesArray = [...files];
const images = filesArray.filter(o => imageType.test(o.type));
Expand Down Expand Up @@ -102,9 +106,4 @@ MarkdownEditor.propTypes = {
onImageDrop: React.PropTypes.func,
};

MarkdownEditor.defaultProps = {
onChange: () => {},
onImageDrop: () => {},
};

export default MarkdownEditor;

0 comments on commit dbc178c

Please sign in to comment.