Created
January 23, 2020 00:19
-
-
Save laras126/a675ea589002ac9b8c3e7d3ceea5b334 to your computer and use it in GitHub Desktop.
Add a panel to block inspector
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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