Skip to content

Commit

Permalink
Hide grid visualizer when distraction free mode is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
noisysocks committed May 9, 2024
1 parent 74c2e05 commit cd4ce81
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,28 @@
* WordPress dependencies
*/
import { useState, useEffect } from '@wordpress/element';
import { useSelect } from '@wordpress/data';

/**
* Internal dependencies
*/
import { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';
import BlockPopoverCover from '../block-popover/cover';
import { store as blockEditorStore } from '../../store';
import { getComputedCSS } from './utils';

export function GridVisualizer( { clientId } ) {
const isDistractionFree = useSelect(
( select ) =>
select( blockEditorStore ).getSettings().isDistractionFree,
[]
);
const blockElement = useBlockElement( clientId );
if ( ! blockElement ) {

if ( isDistractionFree || ! blockElement ) {
return null;
}

return (
<BlockPopoverCover
className="block-editor-grid-visualizer"
Expand Down

0 comments on commit cd4ce81

Please sign in to comment.