Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix: Impossible to drag & drop blocks if the user has no permission t…
…o upload files
  • Loading branch information
jorgefilipecosta committed Apr 18, 2019
1 parent 58da78c commit c5821e1
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions packages/block-editor/src/components/block-drop-zone/index.js
Expand Up @@ -15,7 +15,7 @@ import {
getBlockTransforms,
findTransform,
} from '@wordpress/blocks';
import { Component } from '@wordpress/element';
import { cloneElement, Component } from '@wordpress/element';
import { withDispatch, withSelect } from '@wordpress/data';
import { compose } from '@wordpress/compose';

Expand Down Expand Up @@ -116,17 +116,20 @@ class BlockDropZone extends Component {
return null;
}
const isAppender = index === undefined;

const dropZone = (
<DropZone
className={ classnames( 'editor-block-drop-zone block-editor-block-drop-zone', {
'is-appender': isAppender,
} ) }
onHTMLDrop={ this.onHTMLDrop }
onDrop={ this.onDrop }
/>
);
return (
<MediaUploadCheck>
<DropZone
className={ classnames( 'editor-block-drop-zone block-editor-block-drop-zone', {
'is-appender': isAppender,
} ) }
onFilesDrop={ this.onFilesDrop }
onHTMLDrop={ this.onHTMLDrop }
onDrop={ this.onDrop }
/>
<MediaUploadCheck
fallback={ dropZone }
>
{ cloneElement( dropZone, { onFilesDrop: this.onFilesDrop } ) }
</MediaUploadCheck>
);
}
Expand Down

0 comments on commit c5821e1

Please sign in to comment.