Skip to content

Commit

Permalink
Distraction Free: Fix conflict with showListViewByDefault preference (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewserong authored and ramonjd committed Jul 25, 2023
1 parent 59b5d2e commit c4c8306
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/edit-post/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ export function initializeEditor(
dispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();

// Check if the block list view should be open by default.
if ( select( editPostStore ).isFeatureActive( 'showListViewByDefault' ) ) {
// If `distractionFree` mode is enabled, the block list view should not be open.
if (
select( editPostStore ).isFeatureActive( 'showListViewByDefault' ) &&
! select( editPostStore ).isFeatureActive( 'distractionFree' )
) {
dispatch( editPostStore ).setIsListViewOpened( true );
}

Expand Down
6 changes: 5 additions & 1 deletion packages/edit-site/src/store/private-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ export const setCanvasMode =
mode,
} );
// Check if the block list view should be open by default.
// If `distractionFree` mode is enabled, the block list view should not be open.
if (
mode === 'edit' &&
registry
.select( preferencesStore )
.get( 'core/edit-site', 'showListViewByDefault' )
.get( 'core/edit-site', 'showListViewByDefault' ) &&
! registry
.select( preferencesStore )
.get( 'core/edit-site', 'distractionFree' )
) {
dispatch.setIsListViewOpened( true );
}
Expand Down

0 comments on commit c4c8306

Please sign in to comment.