diff --git a/packages/edit-post/src/components/header/header-toolbar/index.js b/packages/edit-post/src/components/header/header-toolbar/index.js index c479741317459..337c27bed00d9 100644 --- a/packages/edit-post/src/components/header/header-toolbar/index.js +++ b/packages/edit-post/src/components/header/header-toolbar/index.js @@ -26,6 +26,8 @@ import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts'; import { store as editPostStore } from '../../../store'; import { unlock } from '../../../private-apis'; +const { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis ); + const preventDefault = ( event ) => { event.preventDefault(); }; @@ -67,8 +69,6 @@ function HeaderToolbar() { }; }, [] ); - const { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis ); - const isLargeViewport = useViewportMatch( 'medium' ); const isWideViewport = useViewportMatch( 'wide' ); const { diff --git a/packages/edit-site/src/components/header-edit-mode/index.js b/packages/edit-site/src/components/header-edit-mode/index.js index 94ff901203e0c..0878cb4faae2d 100644 --- a/packages/edit-site/src/components/header-edit-mode/index.js +++ b/packages/edit-site/src/components/header-edit-mode/index.js @@ -45,6 +45,8 @@ import { } from '../editor-canvas-container'; import { unlock } from '../../private-apis'; +const { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis ); + const preventDefault = ( event ) => { event.preventDefault(); }; @@ -126,7 +128,6 @@ export default function HeaderEditMode() { [ setIsListViewOpened, isListViewOpen ] ); - const { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis ); const { shouldShowContextualToolbar, canFocusHiddenToolbar, diff --git a/packages/edit-widgets/src/components/header/index.js b/packages/edit-widgets/src/components/header/index.js index 8bd1e226aeda6..e2691f9c74c43 100644 --- a/packages/edit-widgets/src/components/header/index.js +++ b/packages/edit-widgets/src/components/header/index.js @@ -25,6 +25,8 @@ import useLastSelectedWidgetArea from '../../hooks/use-last-selected-widget-area import { store as editWidgetsStore } from '../../store'; import { unlock } from '../../private-apis'; +const { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis ); + function Header() { const isMediumViewport = useViewportMatch( 'medium' ); const inserterButton = useRef(); @@ -72,7 +74,6 @@ function Header() { [ setIsListViewOpened, isListViewOpen ] ); - const { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis ); const { shouldShowContextualToolbar, canFocusHiddenToolbar,