From 5df9d426b79098fc0a366847af5d87dc933a7d0c Mon Sep 17 00:00:00 2001 From: Peter Wilson <519727+peterwilsoncc@users.noreply.github.com> Date: Thu, 3 Nov 2022 16:59:15 +1100 Subject: [PATCH] Link to homeUrl from site editor view menu. (#45475) --- packages/edit-site/src/components/header/index.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/edit-site/src/components/header/index.js b/packages/edit-site/src/components/header/index.js index 2056339bed7bd..e6169be943bac 100644 --- a/packages/edit-site/src/components/header/index.js +++ b/packages/edit-site/src/components/header/index.js @@ -8,6 +8,7 @@ import classnames from 'classnames'; */ import { useCallback, useRef } from '@wordpress/element'; import { useViewportMatch } from '@wordpress/compose'; +import { store as coreStore } from '@wordpress/core-data'; import { ToolSelector, __experimentalPreviewOptions as PreviewOptions, @@ -60,8 +61,8 @@ export default function Header( { listViewShortcut, isLoaded, isVisualMode, - settings, blockEditorMode, + homeUrl, } = useSelect( ( select ) => { const { __experimentalGetPreviewDeviceType, @@ -70,7 +71,6 @@ export default function Header( { isInserterOpened, isListViewOpened, getEditorMode, - getSettings, } = select( editSiteStore ); const { getEditedEntityRecord } = select( coreStore ); const { __experimentalGetTemplateInfo: getTemplateInfo } = @@ -83,6 +83,10 @@ export default function Header( { const record = getEditedEntityRecord( 'postType', postType, postId ); const _isLoaded = !! postId; + const { + getUnstableBase, // Site index. + } = select( coreStore ); + return { deviceType: __experimentalGetPreviewDeviceType(), entityTitle: getTemplateInfo( record ).title, @@ -95,8 +99,8 @@ export default function Header( { 'core/edit-site/toggle-list-view' ), isVisualMode: getEditorMode() === 'visual', - settings: getSettings(), blockEditorMode: __unstableGetEditorMode(), + homeUrl: getUnstableBase()?.home, }; }, [] ); @@ -256,7 +260,7 @@ export default function Header( { >