Skip to content

Commit

Permalink
Use count for selection state
Browse files Browse the repository at this point in the history
  • Loading branch information
noahtallen committed Aug 20, 2020
1 parent fac8e69 commit 98a35ef
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions packages/edit-site/src/components/editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function Editor() {
page,
template,
select,
hasSelectedBlock,
hasBlockSelection,
} = useSelect( ( _select ) => {
const {
isFeatureActive,
Expand Down Expand Up @@ -97,9 +97,8 @@ function Editor() {
: null,
select: _select,
entityId: _entityId,
hasSelectedBlock: !! _select(
'core/block-editor'
).getSelectedBlock(),
hasBlockSelection:
_select( 'core/block-editor' ).getSelectedBlockCount() > 0,
};
}, [] );
const { editEntityRecord } = useDispatch( 'core' );
Expand All @@ -109,10 +108,10 @@ function Editor() {

// Set editor to navigation mode whenever no blocks are selected.
useEffect( () => {
if ( ! hasSelectedBlock ) {
if ( ! hasBlockSelection ) {
setNavigationMode( true );
}
}, [ hasSelectedBlock ] );
}, [ hasBlockSelection ] );

const inlineStyles = useResizeCanvas( deviceType );

Expand Down

0 comments on commit 98a35ef

Please sign in to comment.