-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Closed
Labels
[Block] HeadingAffects the Headings BlockAffects the Headings Block[Feature] ExtensibilityThe ability to extend blocks or the editing experienceThe ability to extend blocks or the editing experience[Type] EnhancementA suggestion for improvement.A suggestion for improvement.
Description
Hey,
I need to remove the heading settings for a project, I assume that is best done using filters?
Using this guide here: https://developer.wordpress.org/block-editor/developers/filters/block-filters/#editor-blockedit it's clear how to add panels to the existing settings, however, it doesn't say anything about removing an existing panel from the inspector.
I have tried something like that to see if existing settings can be changed:
const { createHigherOrderComponent } = wp.compose;
const { Fragment } = wp.element;
const withInspectorControls = createHigherOrderComponent( ( BlockEdit, HeadingToolbar ) => {
return ( level, setAttributes, props ) => {
return (
<Fragment>
<BlockEdit { ...props }>
<HeadingToolbar
minLevel={ 1 }
maxLevel={ 1 }
selectedLevel={ level }
onChange={ ( newLevel ) =>
setAttributes( { level: newLevel } )
} />
</BlockEdit>
</Fragment>
);
};
}, 'withInspectorControl' );
wp.hooks.addFilter( 'editor.BlockEdit', 'core/heading', withInspectorControls );
However, this just gives me a blank block.
I would really appreciate some help with this.
Thanks!
skorasaurus, vincentorback and netopolit
Metadata
Metadata
Assignees
Labels
[Block] HeadingAffects the Headings BlockAffects the Headings Block[Feature] ExtensibilityThe ability to extend blocks or the editing experienceThe ability to extend blocks or the editing experience[Type] EnhancementA suggestion for improvement.A suggestion for improvement.