Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for hiding breadcrumbs in the Site Editor #49518

Merged
merged 3 commits into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 11 additions & 3 deletions packages/edit-site/src/components/editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export default function Editor() {
isInserterOpen,
isListViewOpen,
showIconLabels,
showBlockBreadcrumbs,
} = useSelect( ( select ) => {
const {
getEditedPostContext,
Expand Down Expand Up @@ -94,15 +95,22 @@ export default function Editor() {
'core/edit-site',
'showIconLabels'
),
showBlockBreadcrumbs: select( preferencesStore ).get(
'core/edit-site',
'showBlockBreadcrumbs'
),
};
}, [] );
const { setEditedPostContext } = useDispatch( editSiteStore );

const isViewMode = canvasMode === 'view';
const isEditMode = canvasMode === 'edit';
const showVisualEditor = isViewMode || editorMode === 'visual';
const showBlockBreakcrumb =
isEditMode && showVisualEditor && blockEditorMode !== 'zoom-out';
const shouldShowBlockBreakcrumbs =
showBlockBreadcrumbs &&
isEditMode &&
showVisualEditor &&
blockEditorMode !== 'zoom-out';
const shouldShowInserter = isEditMode && showVisualEditor && isInserterOpen;
const shouldShowListView = isEditMode && showVisualEditor && isListViewOpen;
const secondarySidebarLabel = isListViewOpen
Expand Down Expand Up @@ -205,7 +213,7 @@ export default function Editor() {
)
}
footer={
showBlockBreakcrumb && (
shouldShowBlockBreakcrumbs && (
<BlockBreadcrumb
rootLabelText={ __( 'Template' ) }
/>
Expand Down
7 changes: 7 additions & 0 deletions packages/edit-site/src/components/preferences-modal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ export default function EditSitePreferencesModal( {
) }
label={ __( 'Always open list view' ) }
/>
<EnableFeature
featureName="showBlockBreadcrumbs"
help={ __(
'Shows block breadcrumbs at the bottom of the editor.'
) }
label={ __( 'Display block breadcrumbs' ) }
/>
</PreferencesModalSection>
),
},
Expand Down
1 change: 1 addition & 0 deletions packages/edit-site/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export function initializeEditor( id, settings ) {
welcomeGuide: true,
welcomeGuideStyles: true,
showListViewByDefault: false,
showBlockBreadcrumbs: true,
} );

dispatch( interfaceStore ).setDefaultComplementaryArea(
Expand Down