From d69ae8f35aa3008b1b783ddf6af810a1b00d8c41 Mon Sep 17 00:00:00 2001 From: yogeshbhutkar Date: Fri, 15 Nov 2024 16:47:00 +0530 Subject: [PATCH] Zoom Out: Enhance ZoomOutModeInserters to support distraction-free mode --- .../src/components/block-tools/zoom-out-mode-inserters.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/block-editor/src/components/block-tools/zoom-out-mode-inserters.js b/packages/block-editor/src/components/block-tools/zoom-out-mode-inserters.js index 17af902bf9baf..3d77a5ef69675 100644 --- a/packages/block-editor/src/components/block-tools/zoom-out-mode-inserters.js +++ b/packages/block-editor/src/components/block-tools/zoom-out-mode-inserters.js @@ -3,6 +3,7 @@ */ import { useSelect, useDispatch } from '@wordpress/data'; import { useEffect, useState } from '@wordpress/element'; +import { store as preferencesStore } from '@wordpress/preferences'; /** * Internal dependencies @@ -20,6 +21,7 @@ function ZoomOutModeInserters() { setInserterIsOpened, sectionRootClientId, selectedBlockClientId, + isDistractionFree, } = useSelect( ( select ) => { const { getSettings, @@ -30,6 +32,7 @@ function ZoomOutModeInserters() { } = unlock( select( blockEditorStore ) ); const root = getSectionRootClientId(); + const { get } = select( preferencesStore ); return { hasSelection: !! getSelectionStart().clientId, @@ -38,6 +41,7 @@ function ZoomOutModeInserters() { setInserterIsOpened: getSettings().__experimentalSetIsInserterOpened, selectedBlockClientId: getSelectedBlockClientId(), + isDistractionFree: get( 'core', 'distractionFree' ), }; }, [] ); @@ -54,7 +58,7 @@ function ZoomOutModeInserters() { }; }, [] ); - if ( ! isReady || ! hasSelection ) { + if ( ! isReady || ! hasSelection || isDistractionFree ) { return null; }