Skip to content

Commit

Permalink
Explain some of the dynamics with comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mtias committed Feb 1, 2021
1 parent 18759ed commit fb83d1e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ function BlockContextualToolbar( { focusOnMount, ...props } ) {
}
}

// Shifts the toolbar to make room for the parent block selector.
const classes = classnames( 'block-editor-block-contextual-toolbar', {
'with-offset': hasParents,
} );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ export default function BlockParentSelector() {
};
}, [] );

// Allows highlighting the parent block outline when focusing or hovering
// the parent block selector within the child.
const nodeRef = useRef();
const { gestures: showMoversGestures } = useShowMoversGestures( {
ref: nodeRef,
Expand Down
5 changes: 4 additions & 1 deletion packages/block-editor/src/components/block-toolbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ export default function BlockToolbar( { hideDragHandle } ) {
};
}, [] );

// Handles highlighting the current block outline on hover or focus of the
// block type toolbar area.
const { toggleBlockHighlight } = useDispatch( 'core/block-editor' );
const nodeRef = useRef();

const { showMovers, gestures: showMoversGestures } = useShowMoversGestures(
{
ref: nodeRef,
Expand All @@ -79,6 +80,8 @@ export default function BlockToolbar( { hideDragHandle } ) {
}
);

// Account for the cases where the block toolbar is rendered within the
// header are and not contextually to the block.
const displayHeaderToolbar =
useViewportMatch( 'medium', '<' ) || hasFixedToolbar;

Expand Down

0 comments on commit fb83d1e

Please sign in to comment.