Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add new panel under "document" in Gutenberg

Tags:

I am trying to add a new component panel under document tab, like categories, featured image etc.

enter image description here

like image 875
daniyalahmad Avatar asked Aug 14 '18 15:08

daniyalahmad


People also ask

How do I add widgets to Gutenberg?

Click on Blocks, then scroll down the list until you see Widgets. Select one of the three widgets that you wish to add. Note that if you want to use a widget type that is not available, you can still add them through the Administrator Menu – Widgets section.

How do you create a table of contents in Gutenberg?

Scroll down to the “Ultimate Addons Block” section and look for the “Table of Contents” block. Click on it to add it to your post or page. The block will automatically be added into your editor, and from here, you can start editing and building the table of contents block. That's it!


1 Answers

They've added the PluginDocumentSettingPanel SlotFill now.

const { registerPlugin } = wp.plugins
const { PluginDocumentSettingPanel } = wp.editPost
 
const PluginDocumentSettingPanelDemo = () => (
    <PluginDocumentSettingPanel
        name="custom-panel"
        title="Custom Panel"
        className="custom-panel"
    >
        Custom Panel Contents
    </PluginDocumentSettingPanel>
)
registerPlugin('plugin-document-setting-panel-demo', {
    render: PluginDocumentSettingPanelDemo
})
like image 53
Rice_Crisp Avatar answered Sep 23 '22 03:09

Rice_Crisp