Skip to content

Commit cd4ce81

Browse files
committed
Hide grid visualizer when distraction free mode is enabled
1 parent 74c2e05 commit cd4ce81

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/block-editor/src/components/grid-visualizer/grid-visualizer.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,28 @@
22
* WordPress dependencies
33
*/
44
import { useState, useEffect } from '@wordpress/element';
5+
import { useSelect } from '@wordpress/data';
56

67
/**
78
* Internal dependencies
89
*/
910
import { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';
1011
import BlockPopoverCover from '../block-popover/cover';
12+
import { store as blockEditorStore } from '../../store';
1113
import { getComputedCSS } from './utils';
1214

1315
export function GridVisualizer( { clientId } ) {
16+
const isDistractionFree = useSelect(
17+
( select ) =>
18+
select( blockEditorStore ).getSettings().isDistractionFree,
19+
[]
20+
);
1421
const blockElement = useBlockElement( clientId );
15-
if ( ! blockElement ) {
22+
23+
if ( isDistractionFree || ! blockElement ) {
1624
return null;
1725
}
26+
1827
return (
1928
<BlockPopoverCover
2029
className="block-editor-grid-visualizer"

0 commit comments

Comments
 (0)