Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* global externalPermalinksReduxConfig */
import { compose } from '@wordpress/compose';
import { withSelect } from '@wordpress/data';
import { PluginDocumentSettingPanel } from '@wordpress/edit-post';
import { link } from '@wordpress/icons';
import { registerPlugin } from '@wordpress/plugins';
const { postTypes } = externalPermalinksReduxConfig;
const slug = 'external-permalinks-redux';
const View = ( { postType } ) => {
if ( ! postType ) {
return null;
}
return (
<PluginDocumentSettingPanel
name={ slug }
title={ postTypes[ postType ] }
className={ slug }
>
Hi
</PluginDocumentSettingPanel>
);
};
const Panel = compose( [
withSelect( ( select ) => {
const { type: postType } = select( 'core/editor' ).getCurrentPost();
return {
postType,
};
} ),
] )( View );
registerPlugin( slug, {
icon: link,
render: Panel,
} );