Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigation: Move the ALLOWED_BLOCKS const to a shared location #50323

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions packages/block-library/src/navigation/edit/allowed-blocks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export const ALLOWED_BLOCKS = [
'core/navigation-link',
'core/search',
'core/social-links',
'core/page-list',
'core/spacer',
'core/home-link',
'core/site-title',
'core/site-logo',
'core/navigation-submenu',
];
13 changes: 1 addition & 12 deletions packages/block-library/src/navigation/edit/inner-blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,7 @@ import { useMemo } from '@wordpress/element';
* Internal dependencies
*/
import PlaceholderPreview from './placeholder/placeholder-preview';

const ALLOWED_BLOCKS = [
'core/navigation-link',
'core/search',
'core/social-links',
'core/page-list',
'core/spacer',
'core/home-link',
'core/site-title',
'core/site-logo',
'core/navigation-submenu',
];
import { ALLOWED_BLOCKS } from './allowed-blocks';

const DEFAULT_BLOCK = {
name: 'core/navigation-link',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { useContext, useEffect, useRef, useMemo } from '@wordpress/element';
*/
import useNavigationMenu from '../use-navigation-menu';
import { areBlocksDirty } from './are-blocks-dirty';
import { ALLOWED_BLOCKS } from './allowed-blocks';

const EMPTY_OBJECT = {};
const DRAFT_MENU_PARAMS = [
Expand All @@ -24,18 +25,6 @@ const DEFAULT_BLOCK = {
name: 'core/navigation-link',
};

const ALLOWED_BLOCKS = [
'core/navigation-link',
'core/search',
'core/social-links',
'core/page-list',
'core/spacer',
'core/home-link',
'core/site-title',
'core/site-logo',
'core/navigation-submenu',
];

export default function UnsavedInnerBlocks( {
blocks,
createNavigationMenu,
Expand Down