Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Unregister reusable block by its capability
  • Loading branch information
fluiddot committed May 11, 2021
commit 5c190b78bcc55bc45ca936b47df595bbd8d83ca2
6 changes: 6 additions & 0 deletions packages/react-native-editor/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
validateThemeGradients,
} from '@wordpress/block-editor';
import { dispatch } from '@wordpress/data';
import { unregisterBlockType } from '@wordpress/blocks';

const reactNativeSetup = () => {
// Disable warnings as they disrupt the user experience in dev mode
Expand Down Expand Up @@ -56,6 +57,11 @@ const setupInitHooks = () => {
'core/react-native-editor',
( props ) => {
setupLocale( props.locale, props.translations );

const capabilities = props.capabilities ?? {};
if ( capabilities.reusableBlock !== true ) {
unregisterBlockType( 'core/block' );
}
}
);

Expand Down