From 44b09af0a166cfbf1743517686feacb506e13b1d Mon Sep 17 00:00:00 2001 From: Andrei Draganescu Date: Tue, 1 Oct 2024 08:12:37 +0300 Subject: [PATCH] limit zoom out toggle to specific post types (#65732) Co-authored-by: draganescu Co-authored-by: youknowriad Co-authored-by: richtabor Co-authored-by: ajlende --- packages/editor/src/components/header/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/editor/src/components/header/index.js b/packages/editor/src/components/header/index.js index b5ec9032aac596..f49ada48997ce5 100644 --- a/packages/editor/src/components/header/index.js +++ b/packages/editor/src/components/header/index.js @@ -57,15 +57,18 @@ function Header( { showIconLabels, hasFixedToolbar, isNestedEntity, + postType, } = useSelect( ( select ) => { const { get: getPreference } = select( preferencesStore ); const { getEditorMode, getEditorSettings, + getCurrentPostType, isPublishSidebarOpened: _isPublishSidebarOpened, } = select( editorStore ); return { + postType: getCurrentPostType(), isTextEditor: getEditorMode() === 'text', isPublishSidebarOpened: _isPublishSidebarOpened(), showIconLabels: getPreference( 'core', 'showIconLabels' ), @@ -75,6 +78,10 @@ function Header( { }; }, [] ); + const canBeZoomedOut = [ 'post', 'page', 'wp_template' ].includes( + postType + ); + const [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] = useState( true ); @@ -135,7 +142,9 @@ function Header( { ) } - { isEditorIframed && isWideViewport && } + { canBeZoomedOut && isEditorIframed && isWideViewport && ( + + ) }