From 44a8678975ef85b53199e8161f554479ca1041c0 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Fri, 25 Aug 2023 09:28:56 +0100 Subject: [PATCH] Register the block editor keyboard shortcuts automatically when using BlockEditorProvider (#53910) --- packages/block-editor/src/components/provider/index.js | 8 +++++++- .../src/components/sidebar-block-editor/index.js | 2 -- .../src/components/block-editor/site-editor-canvas.js | 2 -- .../widget-areas-block-editor-provider/index.js | 2 -- storybook/stories/playground/index.story.js | 2 -- test/integration/helpers/integration-test-editor.js | 2 -- 6 files changed, 7 insertions(+), 11 deletions(-) diff --git a/packages/block-editor/src/components/provider/index.js b/packages/block-editor/src/components/provider/index.js index 13d25aafd8c832..57cc34b44bfea4 100644 --- a/packages/block-editor/src/components/provider/index.js +++ b/packages/block-editor/src/components/provider/index.js @@ -12,6 +12,7 @@ import useBlockSync from './use-block-sync'; import { store as blockEditorStore } from '../../store'; import { BlockRefsProvider } from './block-refs-provider'; import { unlock } from '../../lock-unlock'; +import KeyboardShortcuts from '../keyboard-shortcuts'; /** @typedef {import('@wordpress/data').WPDataRegistry} WPDataRegistry */ @@ -42,7 +43,12 @@ export const ExperimentalBlockEditorProvider = withRegistryProvider( // Syncs the entity provider with changes in the block-editor store. useBlockSync( props ); - return { children }; + return ( + <> + + { children } + + ); } ); diff --git a/packages/customize-widgets/src/components/sidebar-block-editor/index.js b/packages/customize-widgets/src/components/sidebar-block-editor/index.js index 4e651bc2bb8dfb..116c8684c89809 100644 --- a/packages/customize-widgets/src/components/sidebar-block-editor/index.js +++ b/packages/customize-widgets/src/components/sidebar-block-editor/index.js @@ -11,7 +11,6 @@ import { BlockInspector, CopyHandler, WritingFlow, - BlockEditorKeyboardShortcuts, __unstableBlockSettingsMenuFirstItem, __unstableEditorStyles as EditorStyles, } from '@wordpress/block-editor'; @@ -94,7 +93,6 @@ export default function SidebarBlockEditor( { return ( <> - diff --git a/packages/edit-site/src/components/block-editor/site-editor-canvas.js b/packages/edit-site/src/components/block-editor/site-editor-canvas.js index aa4c2e7c5e13d6..6693a1380ac83f 100644 --- a/packages/edit-site/src/components/block-editor/site-editor-canvas.js +++ b/packages/edit-site/src/components/block-editor/site-editor-canvas.js @@ -11,7 +11,6 @@ import { BlockList, BlockTools, __unstableUseClipboardHandler as useClipboardHandler, - BlockEditorKeyboardShortcuts, store as blockEditorStore, } from '@wordpress/block-editor'; import { @@ -116,7 +115,6 @@ export default function SiteEditorCanvas() { } } } > - -
- diff --git a/test/integration/helpers/integration-test-editor.js b/test/integration/helpers/integration-test-editor.js index d57a3d0395532c..58229c19ba0256 100644 --- a/test/integration/helpers/integration-test-editor.js +++ b/test/integration/helpers/integration-test-editor.js @@ -9,7 +9,6 @@ import userEvent from '@testing-library/user-event'; */ import { useState, useEffect } from '@wordpress/element'; import { - BlockEditorKeyboardShortcuts, BlockEditorProvider, BlockList, BlockTools, @@ -78,7 +77,6 @@ export function Editor( { testBlocks, settings = {} } ) { > -