Skip to content

Commit

Permalink
Zoom Out: Enhance ZoomOutModeInserters to support distraction-free mode
Browse files Browse the repository at this point in the history
  • Loading branch information
yogeshbhutkar committed Nov 15, 2024
1 parent d0a190b commit d69ae8f
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -20,6 +21,7 @@ function ZoomOutModeInserters() {
setInserterIsOpened,
sectionRootClientId,
selectedBlockClientId,
isDistractionFree,
} = useSelect( ( select ) => {
const {
getSettings,
Expand All @@ -30,6 +32,7 @@ function ZoomOutModeInserters() {
} = unlock( select( blockEditorStore ) );

const root = getSectionRootClientId();
const { get } = select( preferencesStore );

return {
hasSelection: !! getSelectionStart().clientId,
Expand All @@ -38,6 +41,7 @@ function ZoomOutModeInserters() {
setInserterIsOpened:
getSettings().__experimentalSetIsInserterOpened,
selectedBlockClientId: getSelectedBlockClientId(),
isDistractionFree: get( 'core', 'distractionFree' ),
};
}, [] );

Expand All @@ -54,7 +58,7 @@ function ZoomOutModeInserters() {
};
}, [] );

if ( ! isReady || ! hasSelection ) {
if ( ! isReady || ! hasSelection || isDistractionFree ) {
return null;
}

Expand Down

0 comments on commit d69ae8f

Please sign in to comment.