Skip to content

Commit

Permalink
Fix footer toolbar not appearing
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed May 27, 2022
1 parent 8baea42 commit 22c8786
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ import { InsertionPointOpenRef } from '../block-tools/insertion-point';

export function useInBetweenInserter() {
const openRef = useContext( InsertionPointOpenRef );
const hasReducedUI = useSelect(
( select ) => select( blockEditorStore ).getSettings().hasReducedUI,
const isInBetweenInserterDisabled = useSelect(
( select ) =>
select( blockEditorStore ).getSettings().hasReducedUI ||
select( blockEditorStore ).__unstableGetEditorMode() === 'zoom-out',
[]
);
const {
Expand All @@ -33,7 +35,7 @@ export function useInBetweenInserter() {

return useRefEffect(
( node ) => {
if ( hasReducedUI ) {
if ( isInBetweenInserterDisabled ) {
return;
}

Expand Down Expand Up @@ -110,7 +112,7 @@ export function useInBetweenInserter() {
// Don't show the insertion point if a parent block has an "overlay"
// See https://github.com/WordPress/gutenberg/pull/34012#pullrequestreview-727762337
const parentOverlay = element.parentElement?.closest(
'.block-editor-block-content-overlay'
'.block-editor-block-list__block.has-block-overlay'
);
if ( parentOverlay ) {
return;
Expand All @@ -127,7 +129,6 @@ export function useInBetweenInserter() {
if ( getSelectedBlockClientIds().includes( clientId ) ) {
return;
}

const elementRect = element.getBoundingClientRect();

if (
Expand Down Expand Up @@ -176,6 +177,7 @@ export function useInBetweenInserter() {
showInsertionPoint,
hideInsertionPoint,
getSelectedBlockClientIds,
isInBetweenInserterDisabled,
]
);
}

0 comments on commit 22c8786

Please sign in to comment.