Skip to content

Commit

Permalink
Enable drag and drop
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Nov 27, 2019
1 parent 8e1d5c3 commit ef48862
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/block-editor/src/components/block-list/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,14 @@ function BlockListBlock( {
placeCaretAtHorizontalEdge( target, isReverse );
};

useEffect( () => {
wrapper.current.addEventListener( 'dragstart', preventDrag );

return () => {
wrapper.current.removeEventListener( 'dragstart', preventDrag );
};
} );

// Focus the selected block's wrapper or inner input on mount and update
const isMounting = useRef( true );
useEffect( () => {
Expand Down Expand Up @@ -493,7 +501,6 @@ function BlockListBlock( {
onMouseOverHandled={ hideHoverEffects }
onMouseLeave={ hideHoverEffects }
onMouseDown={ onPointerDown }
onDragStart={ preventDrag }
className={ wrapperClassName }
data-type={ name }
data-block={ clientId }
Expand All @@ -503,7 +510,6 @@ function BlockListBlock( {
onKeyDown={ onKeyDown }
tabIndex="0"
aria-label={ blockLabel }
childHandledEvents={ [ 'onDragStart', 'onMouseDown' ] }
tagName={ animated.div }
{ ...wrapperProps }
style={
Expand Down

0 comments on commit ef48862

Please sign in to comment.