diff --git a/edit-post/README.md b/edit-post/README.md index b6ce382fea42c..46c94847ed114 100644 --- a/edit-post/README.md +++ b/edit-post/README.md @@ -127,3 +127,28 @@ const MyPluginPostStatusInfo = () => ( ``` +### PluginPrePublishPanel +**Experimental** + +Renders provided content to the pre-publish side panel in the publish flow (side panel that opens when user first pushes "Publish" from main editor). + +#### Usage + +```jsx + +
My plugin content
+
+``` + +### PluginPostPublishPanel +**Experimental** + +Renders provided content to the post-publish panel in the publish flow (panel that opens after user publishes the post) + +#### Usage + +```jsx + +
My plugin content
+
+``` diff --git a/edit-post/components/layout/index.js b/edit-post/components/layout/index.js index cef9eacf5e7a2..7be3107e3d3e8 100644 --- a/edit-post/components/layout/index.js +++ b/edit-post/components/layout/index.js @@ -35,6 +35,8 @@ import EditorModeKeyboardShortcuts from '../keyboard-shortcuts'; import MetaBoxes from '../meta-boxes'; import { getMetaBoxContainer } from '../../utils/meta-boxes'; import Sidebar from '../sidebar'; +import PluginPostPublishPanel from '../plugin-post-publish-panel'; +import PluginPrePublishPanel from '../plugin-pre-publish-panel'; function Layout( { mode, @@ -84,7 +86,11 @@ function Layout( { onClose={ closePublishSidebar } forceIsDirty={ hasActiveMetaboxes } forceIsSaving={ isSaving } - /> + prePublishExtension={ } + postPublishExtension={ } + > + + ) } diff --git a/edit-post/components/plugin-post-publish-panel/index.js b/edit-post/components/plugin-post-publish-panel/index.js new file mode 100644 index 0000000000000..9660191545677 --- /dev/null +++ b/edit-post/components/plugin-post-publish-panel/index.js @@ -0,0 +1,16 @@ +/** + * Defines extensibility slot for post-publish sidebar. + * + * Defines slot to be used by plugins to insert content in the post-publish sidebar + * (which appears after a user fully publishes a post). + * + * @file This files defines the PluginPostPublishPanel extension + * @since 2.7.0 + */ + +/** + * Internal dependencies + */ +import { createSlotFill } from '../../../components/slot-fill'; + +export default createSlotFill( 'PluginPostPublishPanel' ); diff --git a/edit-post/components/plugin-pre-publish-panel/index.js b/edit-post/components/plugin-pre-publish-panel/index.js new file mode 100644 index 0000000000000..b0248e8b8c340 --- /dev/null +++ b/edit-post/components/plugin-pre-publish-panel/index.js @@ -0,0 +1,16 @@ +/** + * Defines extensibility slot for pre-publish sidebar. + * + * Defines slot to be used by plugins to insert content in the pre-publish sidebar + * (which appears when a user pushes "Publish" from the main editor). + * + * @file This files defines the PluginPrePublishPanel extension + * @since 2.7.0 + */ + +/** + * Internal dependencies + */ +import { createSlotFill } from '../../../components/slot-fill'; + +export default createSlotFill( 'PluginPrePublishPanel' ); diff --git a/edit-post/index.js b/edit-post/index.js index 5be366c714454..20ea4079ccffd 100644 --- a/edit-post/index.js +++ b/edit-post/index.js @@ -80,6 +80,8 @@ export function initializeEditor( id, post, settings ) { }; } +export { default as PluginPostPublishPanel } from './components/sidebar/plugin-post-status-info'; export { default as PluginPostStatusInfo } from './components/sidebar/plugin-post-status-info'; +export { default as PluginPrePublishPanel } from './components/sidebar/plugin-post-status-info'; export { default as PluginSidebar } from './components/sidebar/plugin-sidebar'; export { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item'; diff --git a/editor/components/post-publish-panel/index.js b/editor/components/post-publish-panel/index.js index b248c57e1b96d..2d32e815ffd2e 100644 --- a/editor/components/post-publish-panel/index.js +++ b/editor/components/post-publish-panel/index.js @@ -60,7 +60,7 @@ class PostPublishPanel extends Component { } render() { - const { isScheduled, onClose, forceIsDirty, forceIsSaving } = this.props; + const { isScheduled, onClose, forceIsDirty, forceIsSaving, prePublishExtension, postPublishExtension } = this.props; const { loading, submitted } = this.state; return (
@@ -82,9 +82,9 @@ class PostPublishPanel extends Component { />
- { ! loading && ! submitted && } + { ! loading && ! submitted && { prePublishExtension } } { loading && ! submitted && } - { submitted && } + { submitted && { postPublishExtension } }
); diff --git a/editor/components/post-publish-panel/postpublish.js b/editor/components/post-publish-panel/postpublish.js index 98976eb75d57b..2d7ccfac9a9b6 100644 --- a/editor/components/post-publish-panel/postpublish.js +++ b/editor/components/post-publish-panel/postpublish.js @@ -84,6 +84,7 @@ class PostPublishPanelPostpublish extends Component { + { this.props.children } ); } diff --git a/editor/components/post-publish-panel/prepublish.js b/editor/components/post-publish-panel/prepublish.js index ec48a249e0e3f..a1d4769e91ad4 100644 --- a/editor/components/post-publish-panel/prepublish.js +++ b/editor/components/post-publish-panel/prepublish.js @@ -12,7 +12,7 @@ import PostVisibilityLabel from '../post-visibility/label'; import PostSchedule from '../post-schedule'; import PostScheduleLabel from '../post-schedule/label'; -function PostPublishPanelPrepublish() { +function PostPublishPanelPrepublish( props ) { return (
{ __( 'Are you ready to publish?' ) }
@@ -29,6 +29,7 @@ function PostPublishPanelPrepublish() { ] }> + { props.children }
); }