Skip to content

Commit

Permalink
Make BlockKeyboardShortcuts private.
Browse files Browse the repository at this point in the history
  • Loading branch information
afercia committed Apr 15, 2024
1 parent e80b714 commit 7b9bf8f
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 9 deletions.
4 changes: 0 additions & 4 deletions packages/block-library/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ _Parameters_

- _blocks_ `Array`: An optional array of the core blocks being registered.

### BlockKeyboardShortcuts

Undocumented declaration.

<!-- END TOKEN(Autogenerated API docs) -->

## Registering individual blocks
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,4 +331,4 @@ export const __experimentalRegisterExperimentalCoreBlocks = process.env
}
: undefined;

export { default as BlockKeyboardShortcuts } from './block-keyboard-shortcuts';
export { privateApis } from './private-apis';
13 changes: 13 additions & 0 deletions packages/block-library/src/private-apis.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* Internal dependencies
*/
import { default as BlockKeyboardShortcuts } from './block-keyboard-shortcuts';
import { lock } from './lock-unlock';

/**
* @private
*/
export const privateApis = {};
lock( privateApis, {
BlockKeyboardShortcuts,
} );
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import {
privateApis as blockEditorPrivateApis,
__unstableBlockSettingsMenuFirstItem,
} from '@wordpress/block-editor';
import { BlockKeyboardShortcuts } from '@wordpress/block-library';
import { uploadMedia } from '@wordpress/media-utils';
import { store as preferencesStore } from '@wordpress/preferences';
import { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';

/**
* Internal dependencies
Expand All @@ -32,6 +32,8 @@ const { ExperimentalBlockCanvas: BlockCanvas } = unlock(
blockEditorPrivateApis
);

const { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );

export default function SidebarBlockEditor( {
blockEditorSettings,
sidebar,
Expand Down
3 changes: 2 additions & 1 deletion packages/edit-post/src/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {
privateApis as blockEditorPrivateApis,
store as blockEditorStore,
} from '@wordpress/block-editor';
import { BlockKeyboardShortcuts } from '@wordpress/block-library';
import { Button, ScrollLock } from '@wordpress/components';
import { useViewportMatch } from '@wordpress/compose';
import { PluginArea } from '@wordpress/plugins';
Expand All @@ -41,6 +40,7 @@ import { store as noticesStore } from '@wordpress/notices';
import { store as preferencesStore } from '@wordpress/preferences';
import { privateApis as commandsPrivateApis } from '@wordpress/commands';
import { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';
import { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';

/**
* Internal dependencies
Expand All @@ -66,6 +66,7 @@ const { getLayoutStyles } = unlock( blockEditorPrivateApis );
const { useCommands } = unlock( coreCommandsPrivateApis );
const { useCommandContext } = unlock( commandsPrivateApis );
const { InserterSidebar, ListViewSidebar } = unlock( editorPrivateApis );
const { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );

const interfaceLabels = {
/* translators: accessibility text for the editor top bar landmark region. */
Expand Down
4 changes: 3 additions & 1 deletion packages/edit-site/src/components/editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {
store as blockEditorStore,
BlockInspector,
} from '@wordpress/block-editor';
import { BlockKeyboardShortcuts } from '@wordpress/block-library';
import {
InterfaceSkeleton,
ComplementaryArea,
Expand All @@ -40,6 +39,7 @@ import {
} from '@wordpress/editor';
import { __, sprintf } from '@wordpress/i18n';
import { store as coreDataStore } from '@wordpress/core-data';
import { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';

/**
* Internal dependencies
Expand Down Expand Up @@ -71,6 +71,8 @@ const {
ListViewSidebar,
} = unlock( editorPrivateApis );

const { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );

const interfaceLabels = {
/* translators: accessibility text for the editor content landmark region. */
body: __( 'Editor content' ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import {
} from '@wordpress/core-data';
import { useMemo } from '@wordpress/element';
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
import { BlockKeyboardShortcuts } from '@wordpress/block-library';
import { privateApis as editPatternsPrivateApis } from '@wordpress/patterns';
import { store as preferencesStore } from '@wordpress/preferences';
import { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';

/**
* Internal dependencies
Expand All @@ -28,6 +28,8 @@ import { unlock } from '../../lock-unlock';

const { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );
const { PatternsMenuItems } = unlock( editPatternsPrivateApis );
const { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );

export default function WidgetAreasBlockEditorProvider( {
blockEditorSettings,
children,
Expand Down

0 comments on commit 7b9bf8f

Please sign in to comment.