Skip to content

Commit

Permalink
Style Book: Show tabs and make blocks clickable when entering edit mo…
Browse files Browse the repository at this point in the history
…de from the Styles menu (#52222)

* Style Book: Show tabs and make blocks clickable when entering edit mode from the Styles menu

* Move lines
  • Loading branch information
t-hamano authored Jul 5, 2023
1 parent 09bf154 commit e244388
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -261,7 +263,7 @@ export default function SidebarNavigationScreenGlobalStyles() {
</>
}
/>
{ isStyleBookOpened && ! isMobileViewport && (
{ isStyleBookOpened && ! isMobileViewport && isViewMode && (
<StyleBook
enableResizing={ false }
isSelected={ () => false }
Expand Down

0 comments on commit e244388

Please sign in to comment.