Skip to content

Commit

Permalink
Limit __experimentalMetadata to Core blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
getdave committed Feb 6, 2023
1 parent d26d3a0 commit 3f9e6cc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/block-editor/src/hooks/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import { getBlockSupport } from '@wordpress/blocks';
const META_ATTRIBUTE_NAME = 'metadata';

export function hasBlockMetadataSupport( blockType, feature = '' ) {
// Only core blocks are allowed to use __experimentalMetadata until the fetaure is stablised.
if ( ! blockType.startsWith( 'core/' ) ) {
return false;
}
const support = getBlockSupport( blockType, '__experimentalMetadata' );
return !! ( true === support || support?.[ feature ] );
}
Expand Down

0 comments on commit 3f9e6cc

Please sign in to comment.