Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
initial commit
  • Loading branch information
ramonjd committed May 2, 2022
commit 3dcdcc7a01bd84199740edffac0e53bdb2860230
12 changes: 12 additions & 0 deletions packages/edit-post/src/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ function Layout( { styles } ) {
setIsInserterOpened,
} = useDispatch( editPostStore );
const { createErrorNotice } = useDispatch( noticesStore );
const { setIsListViewOpened } = useDispatch( editPostStore );
const {
mode,
isFullscreenActive,
Expand All @@ -89,6 +90,7 @@ function Layout( { styles } ) {
showBlockBreadcrumbs,
isTemplateMode,
documentLabel,
isListViewOpenByDefault,
} = useSelect( ( select ) => {
const { getEditorSettings, getPostTypeLabel } = select( editorStore );
const editorSettings = getEditorSettings();
Expand Down Expand Up @@ -129,6 +131,9 @@ function Layout( { styles } ) {
),
// translators: Default label for the Document in the Block Breadcrumb.
documentLabel: postTypeLabel || _x( 'Document', 'noun' ),
isListViewOpenByDefault: select( editPostStore ).isFeatureActive(
'listView'
),
};
}, [] );
const className = classnames( 'edit-post-layout', 'is-mode-' + mode, {
Expand All @@ -142,6 +147,12 @@ function Layout( { styles } ) {
hasBlockSelected ? 'edit-post/block' : 'edit-post/document'
);

useEffect( () => {
if ( isListViewOpenByDefault ) {
setIsListViewOpened( true );
}
}, [] );

// Inserter and Sidebars are mutually exclusive
useEffect( () => {
if ( sidebarIsOpened && ! isHugeViewport ) {
Expand Down Expand Up @@ -181,6 +192,7 @@ function Layout( { styles } ) {
if ( mode === 'visual' && isListViewOpened ) {
return <ListViewSidebar />;
}

return null;
};

Expand Down
7 changes: 7 additions & 0 deletions packages/edit-post/src/components/preferences-modal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ export default function EditPostPreferencesModal() {
) }
label={ __( 'Spotlight mode' ) }
/>
<EnableFeature
featureName="listView"
help={ __(
'Opens the block list view sidebar in the editor by default.'
) }
label={ __( 'Always open list view' ) }
/>
<EnableFeature
featureName="showIconLabels"
help={ __( 'Shows text instead of icons.' ) }
Expand Down