From 360c6c8ddda414bb86f04996b837803c5ae67931 Mon Sep 17 00:00:00 2001 From: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Date: Tue, 24 Sep 2024 19:27:28 +0900 Subject: [PATCH] Don't show tooltip in zoom out toggle button when showIconLabels is true (#65573) Co-authored-by: t-hamano Co-authored-by: afercia Co-authored-by: draganescu --- packages/editor/src/components/zoom-out-toggle/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/editor/src/components/zoom-out-toggle/index.js b/packages/editor/src/components/zoom-out-toggle/index.js index 214b1c51fd6255..dd4669d04bec18 100644 --- a/packages/editor/src/components/zoom-out-toggle/index.js +++ b/packages/editor/src/components/zoom-out-toggle/index.js @@ -7,6 +7,7 @@ import { __ } from '@wordpress/i18n'; import { useDispatch, useSelect } from '@wordpress/data'; import { store as blockEditorStore } from '@wordpress/block-editor'; import { square as zoomOutIcon } from '@wordpress/icons'; +import { store as preferencesStore } from '@wordpress/preferences'; /** * Internal dependencies @@ -14,8 +15,12 @@ import { square as zoomOutIcon } from '@wordpress/icons'; import { unlock } from '../../lock-unlock'; const ZoomOutToggle = () => { - const { isZoomOut } = useSelect( ( select ) => ( { + const { isZoomOut, showIconLabels } = useSelect( ( select ) => ( { isZoomOut: unlock( select( blockEditorStore ) ).isZoomOut(), + showIconLabels: select( preferencesStore ).get( + 'core', + 'showIconLabels' + ), } ) ); const { resetZoomLevel, setZoomLevel, __unstableSetEditorMode } = unlock( @@ -38,6 +43,7 @@ const ZoomOutToggle = () => { label={ __( 'Toggle Zoom Out' ) } isPressed={ isZoomOut } size="compact" + showTooltip={ ! showIconLabels } /> ); };