Skip to content

Commit e83c92e

Browse files
authored
Add support for hiding breadcrumbs in the Site Editor (#49518)
* Add support for hiding breadcrumbs in the Site Editor * Use preferencesStore * Add default showBlockBreadcrumbs as true Matches functionality of the post editor
1 parent bb5b306 commit e83c92e

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

packages/edit-site/src/components/editor/index.js

+11-3
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export default function Editor() {
6767
isInserterOpen,
6868
isListViewOpen,
6969
showIconLabels,
70+
showBlockBreadcrumbs,
7071
} = useSelect( ( select ) => {
7172
const {
7273
getEditedPostContext,
@@ -94,15 +95,22 @@ export default function Editor() {
9495
'core/edit-site',
9596
'showIconLabels'
9697
),
98+
showBlockBreadcrumbs: select( preferencesStore ).get(
99+
'core/edit-site',
100+
'showBlockBreadcrumbs'
101+
),
97102
};
98103
}, [] );
99104
const { setEditedPostContext } = useDispatch( editSiteStore );
100105

101106
const isViewMode = canvasMode === 'view';
102107
const isEditMode = canvasMode === 'edit';
103108
const showVisualEditor = isViewMode || editorMode === 'visual';
104-
const showBlockBreakcrumb =
105-
isEditMode && showVisualEditor && blockEditorMode !== 'zoom-out';
109+
const shouldShowBlockBreakcrumbs =
110+
showBlockBreadcrumbs &&
111+
isEditMode &&
112+
showVisualEditor &&
113+
blockEditorMode !== 'zoom-out';
106114
const shouldShowInserter = isEditMode && showVisualEditor && isInserterOpen;
107115
const shouldShowListView = isEditMode && showVisualEditor && isListViewOpen;
108116
const secondarySidebarLabel = isListViewOpen
@@ -205,7 +213,7 @@ export default function Editor() {
205213
)
206214
}
207215
footer={
208-
showBlockBreakcrumb && (
216+
shouldShowBlockBreakcrumbs && (
209217
<BlockBreadcrumb
210218
rootLabelText={ __( 'Template' ) }
211219
/>

packages/edit-site/src/components/preferences-modal/index.js

+7
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ export default function EditSitePreferencesModal( {
4848
) }
4949
label={ __( 'Always open list view' ) }
5050
/>
51+
<EnableFeature
52+
featureName="showBlockBreadcrumbs"
53+
help={ __(
54+
'Shows block breadcrumbs at the bottom of the editor.'
55+
) }
56+
label={ __( 'Display block breadcrumbs' ) }
57+
/>
5158
</PreferencesModalSection>
5259
),
5360
},

packages/edit-site/src/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export function initializeEditor( id, settings ) {
6767
welcomeGuide: true,
6868
welcomeGuideStyles: true,
6969
showListViewByDefault: false,
70+
showBlockBreadcrumbs: true,
7071
} );
7172

7273
dispatch( interfaceStore ).setDefaultComplementaryArea(

0 commit comments

Comments
 (0)