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 block: Add core/buttons to the allowed blocks. #53966

Merged
merged 2 commits into from
Sep 6, 2023
Merged
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
22 changes: 22 additions & 0 deletions packages/block-library/src/navigation-link/transforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ const transforms = {
return createBlock( 'core/navigation-link' );
},
},
{
type: 'block',
blocks: [ 'core/buttons' ],
transform: () => {
return createBlock( 'core/navigation-link' );
},
},
],
to: [
{
Expand Down Expand Up @@ -105,6 +112,21 @@ const transforms = {
return createBlock( 'core/page-list' );
},
},
{
type: 'block',
blocks: [ 'core/buttons' ],
transform: ( { label, url, rel, title, opensInNewTab } ) => {
return createBlock( 'core/buttons', {}, [
createBlock( 'core/button', {
text: label,
url,
rel,
title,
linkTarget: opensInNewTab ? '_blank' : undefined,
} ),
] );
},
},
],
};

Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/navigation/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const ALLOWED_BLOCKS = [
'core/site-logo',
'core/navigation-submenu',
'core/loginout',
'core/buttons',
];

export const PRIORITIZED_INSERTER_BLOCKS = [
Expand Down
Loading