Skip to content

Commit

Permalink
limit zoom out toggle to specific post types (WordPress#65732)
Browse files Browse the repository at this point in the history
Co-authored-by: draganescu <[email protected]>
Co-authored-by: youknowriad <[email protected]>
Co-authored-by: richtabor <[email protected]>
Co-authored-by: ajlende <[email protected]>
  • Loading branch information
5 people authored and huubl committed Oct 2, 2024
1 parent 40eae5a commit 44b09af
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/editor/src/components/header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' ),
Expand All @@ -75,6 +78,10 @@ function Header( {
};
}, [] );

const canBeZoomedOut = [ 'post', 'page', 'wp_template' ].includes(
postType
);

const [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =
useState( true );

Expand Down Expand Up @@ -135,7 +142,9 @@ function Header( {
<PostSavedState forceIsDirty={ forceIsDirty } />
) }

{ isEditorIframed && isWideViewport && <ZoomOutToggle /> }
{ canBeZoomedOut && isEditorIframed && isWideViewport && (
<ZoomOutToggle />
) }

<PreviewDropdown
forceIsAutosaveable={ forceIsDirty }
Expand Down

0 comments on commit 44b09af

Please sign in to comment.