From e244388d8669618b76c966cc33d48df9156c2db6 Mon Sep 17 00:00:00 2001 From: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Date: Wed, 5 Jul 2023 20:41:45 +0900 Subject: [PATCH] Style Book: Show tabs and make blocks clickable when entering edit mode from the Styles menu (#52222) * Style Book: Show tabs and make blocks clickable when entering edit mode from the Styles menu * Move lines --- .../index.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js index 4d98b235ac81c4..1e9200bf0af019 100644 --- a/packages/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js +++ b/packages/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js @@ -171,13 +171,15 @@ export default function SidebarNavigationScreenGlobalStyles() { const { createNotice } = useDispatch( noticesStore ); const { set: setPreference } = useDispatch( preferencesStore ); const { get: getPrefference } = useSelect( preferencesStore ); - - const isStyleBookOpened = useSelect( - ( select ) => - 'style-book' === - unlock( select( editSiteStore ) ).getEditorCanvasContainerView(), - [] - ); + const { isViewMode, isStyleBookOpened } = useSelect( ( select ) => { + const { getCanvasMode, getEditorCanvasContainerView } = unlock( + select( editSiteStore ) + ); + return { + isViewMode: 'view' === getCanvasMode(), + isStyleBookOpened: 'style-book' === getEditorCanvasContainerView(), + }; + }, [] ); const turnOffDistractionFreeMode = useCallback( () => { const isDistractionFree = getPrefference( @@ -261,7 +263,7 @@ export default function SidebarNavigationScreenGlobalStyles() { } /> - { isStyleBookOpened && ! isMobileViewport && ( + { isStyleBookOpened && ! isMobileViewport && isViewMode && ( false }