From a2d64e10585d3eca64b1584dbf18a4ea25b07035 Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Thu, 18 Jan 2018 12:52:56 -0500 Subject: [PATCH] Block: Move drag handling to instance-bound handler (#4582) --- editor/components/block-list/block.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/editor/components/block-list/block.js b/editor/components/block-list/block.js index d057cf2ed8c93..8ed784acc3ecc 100644 --- a/editor/components/block-list/block.js +++ b/editor/components/block-list/block.js @@ -104,6 +104,7 @@ export class BlockListBlock extends Component { this.stopTypingOnMouseMove = this.stopTypingOnMouseMove.bind( this ); this.mergeBlocks = this.mergeBlocks.bind( this ); this.onFocus = this.onFocus.bind( this ); + this.preventDrag = this.preventDrag.bind( this ); this.onPointerDown = this.onPointerDown.bind( this ); this.onKeyDown = this.onKeyDown.bind( this ); this.onBlockError = this.onBlockError.bind( this ); @@ -280,6 +281,18 @@ export class BlockListBlock extends Component { } } + /** + * Prevents default dragging behavior within a block to allow for multi- + * selection to take effect unhampered. + * + * @param {DragEvent} event Drag event. + * + * @returns {void} + */ + preventDrag( event ) { + event.preventDefault(); + } + onPointerDown( event ) { // Not the main button. // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button @@ -407,7 +420,7 @@ export class BlockListBlock extends Component {
event.preventDefault() } + onDragStart={ this.preventDrag } onMouseDown={ this.onPointerDown } onKeyDown={ this.onKeyDown } onFocus={ this.onFocus }