diff --git a/packages/editor/CHANGELOG.md b/packages/editor/CHANGELOG.md index 0a5c92529c16be..be736a5155a963 100644 --- a/packages/editor/CHANGELOG.md +++ b/packages/editor/CHANGELOG.md @@ -1,4 +1,10 @@ -## 7.0.0 (Unreleased) +## 7.0.1 (Unreleased) + +### Bug Fixes + +- Fix multi-selection triggering too often when using floated blocks. + +## 7.0.0 (2018-11-12) ### Breaking Changes diff --git a/packages/editor/src/components/block-list/index.js b/packages/editor/src/components/block-list/index.js index 7d589a329fca37..b8e7e2926225fc 100644 --- a/packages/editor/src/components/block-list/index.js +++ b/packages/editor/src/components/block-list/index.js @@ -22,6 +22,7 @@ import { compose } from '@wordpress/compose'; */ import BlockListBlock from './block'; import BlockListAppender from '../block-list-appender'; +import { getBlockDOMNode } from '../../utils/dom'; class BlockList extends Component { constructor( props ) { @@ -78,8 +79,15 @@ class BlockList extends Component { this.props.onStartMultiSelect(); } - const boundaries = this.nodes[ this.selectionAtStart ].getBoundingClientRect(); - const y = clientY - boundaries.top; + const blockContentBoundaries = getBlockDOMNode( this.selectionAtStart ).getBoundingClientRect(); + + // prevent multi-selection from triggering when the selected block is a float + // and the cursor is still between the top and the bottom of the block. + if ( clientY >= blockContentBoundaries.top && clientY <= blockContentBoundaries.bottom ) { + return; + } + + const y = clientY - blockContentBoundaries.top; const key = findLast( this.coordMapKeys, ( coordY ) => coordY < y ); this.onSelectionChange( this.coordMap[ key ] );