Skip to content

Instantly share code, notes, and snippets.

@laras126
Created January 23, 2020 00:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laras126/a675ea589002ac9b8c3e7d3ceea5b334 to your computer and use it in GitHub Desktop.
Save laras126/a675ea589002ac9b8c3e7d3ceea5b334 to your computer and use it in GitHub Desktop.
Add a panel to block inspector
import{ createHigherOrderComponent } from '@wordpress/compose';
import { Fragment } from '@wordpress/element';
import { InspectorControls } from '@wordpress/editor';
import { PanelBody } from '@wordpress/components';
const withInspectorControls = createHigherOrderComponent( ( BlockEdit ) => {
return ( props ) => {
return (
<Fragment>
<BlockEdit { ...props } />
<InspectorControls>
<PanelBody>
Heyy whassup
</PanelBody>
</InspectorControls>
</Fragment>
);
};
}, "withInspectorControl" );
wp.hooks.addFilter( 'editor.BlockEdit', 'storytime/panel', withInspectorControls );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment