Skip to content

Commit

Permalink
Add zoom-out mode check to showFixedToolbar, remove unnecessary check…
Browse files Browse the repository at this point in the history
…s from edit headers
  • Loading branch information
jeryj committed Feb 14, 2024
1 parent d223610 commit d01277f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ export function useShowBlockTools() {
! isEmptyDefaultBlock &&
! maybeShowBreadcrumb,
showFixedToolbar:
hasBlockToolbar && getSettings().hasFixedToolbar,
editorMode !== 'zoom-out' &&
hasBlockToolbar &&
getSettings().hasFixedToolbar,
};
},
[ hasBlockToolbar ]
Expand Down
5 changes: 1 addition & 4 deletions packages/edit-post/src/components/header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ function Header( { setEntitiesSavedStatesCallback, initialPost } ) {
isTextEditor,
hasBlockSelection,
hasActiveMetaboxes,
hasFixedToolbar,
isPublishSidebarOpened,
showIconLabels,
hasHistory,
Expand All @@ -83,14 +82,12 @@ function Header( { setEntitiesSavedStatesCallback, initialPost } ) {
.onNavigateToPreviousEntityRecord,
isPublishSidebarOpened:
select( editPostStore ).isPublishSidebarOpened(),
hasFixedToolbar: getPreference( 'core', 'fixedToolbar' ),
showIconLabels: getPreference( 'core', 'showIconLabels' ),
};
}, [] );

const { showFixedToolbar } = useShowBlockTools();
const hasTopToolbar =
hasFixedToolbar && isLargeViewport && showFixedToolbar;
const hasTopToolbar = isLargeViewport && showFixedToolbar;

const [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =
useState( true );
Expand Down
10 changes: 1 addition & 9 deletions packages/edit-site/src/components/header-edit-mode/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ export default function HeaderEditMode() {
blockSelectionStart,
showIconLabels,
editorCanvasView,
hasFixedToolbar,
isZoomOutMode,
} = useSelect( ( select ) => {
const { getEditedPostType } = select( editSiteStore );
const { getBlockSelectionStart, __unstableGetEditorMode } =
Expand All @@ -72,19 +70,13 @@ export default function HeaderEditMode() {
editorCanvasView: unlock(
select( editSiteStore )
).getEditorCanvasContainerView(),
hasFixedToolbar: getPreference( 'core', 'fixedToolbar' ),
isDistractionFree: getPreference( 'core', 'distractionFree' ),
isZoomOutMode: __unstableGetEditorMode() === 'zoom-out',
};
}, [] );

const isLargeViewport = useViewportMatch( 'medium' );
const { showFixedToolbar } = useShowBlockTools();
const hasTopToolbar =
! isZoomOutMode &&
hasFixedToolbar &&
isLargeViewport &&
showFixedToolbar;
const hasTopToolbar = isLargeViewport && showFixedToolbar;
const blockToolbarRef = useRef();
const disableMotion = useReducedMotion();

Expand Down

0 comments on commit d01277f

Please sign in to comment.