Skip to content

Commit

Permalink
Use select mode whenever blocks are unselected
Browse files Browse the repository at this point in the history
  • Loading branch information
noahtallen committed Aug 6, 2020
1 parent 5460bcc commit 96f387f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/edit-site/src/components/editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ function Editor() {
page,
template,
select,
hasSelectedBlock,
} = useSelect( ( _select ) => {
const {
isFeatureActive,
Expand Down Expand Up @@ -96,17 +97,22 @@ function Editor() {
: null,
select: _select,
entityId: _entityId,
hasSelectedBlock: !! _select(
'core/block-editor'
).getSelectedBlock(),
};
}, [] );
const { editEntityRecord } = useDispatch( 'core' );
const { setPage } = useDispatch( 'core/edit-site' );

const { setNavigationMode } = useDispatch( 'core/block-editor' );

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

const inlineStyles = useResizeCanvas( deviceType );

Expand Down

0 comments on commit 96f387f

Please sign in to comment.