From dfda4b683b3956c18b6d86b2747baa6d2980cddc Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Mon, 18 Dec 2023 13:29:34 +0100 Subject: [PATCH] Site Editor: Add the Discussion panel (#57150) --- .../sidebar/settings-sidebar/index.js | 4 ++-- .../sidebar-edit-mode/page-panels/index.js | 2 ++ .../sidebar-edit-mode/template-panel/index.js | 2 ++ packages/editor/src/components/index.js | 1 + .../src/components/post-discussion/panel.js} | 17 ++++++++--------- 5 files changed, 15 insertions(+), 11 deletions(-) rename packages/{edit-post/src/components/sidebar/discussion-panel/index.js => editor/src/components/post-discussion/panel.js} (79%) diff --git a/packages/edit-post/src/components/sidebar/settings-sidebar/index.js b/packages/edit-post/src/components/sidebar/settings-sidebar/index.js index 76d1f1b63ad63..8f71b3908d584 100644 --- a/packages/edit-post/src/components/sidebar/settings-sidebar/index.js +++ b/packages/edit-post/src/components/sidebar/settings-sidebar/index.js @@ -13,6 +13,7 @@ import { store as interfaceStore } from '@wordpress/interface'; import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts'; import { store as editorStore, + PostDiscussionPanel, PostExcerptPanel, PostFeaturedImagePanel, PostLastRevisionPanel, @@ -24,7 +25,6 @@ import { */ import SettingsHeader from '../settings-header'; import PostStatus from '../post-status'; -import DiscussionPanel from '../discussion-panel'; import PageAttributes from '../page-attributes'; import MetaBoxes from '../../meta-boxes'; import PluginDocumentSettingPanel from '../plugin-document-setting-panel'; @@ -85,7 +85,7 @@ const SidebarContent = ( { - + diff --git a/packages/edit-site/src/components/sidebar-edit-mode/page-panels/index.js b/packages/edit-site/src/components/sidebar-edit-mode/page-panels/index.js index e350225a1212a..87be48220ec95 100644 --- a/packages/edit-site/src/components/sidebar-edit-mode/page-panels/index.js +++ b/packages/edit-site/src/components/sidebar-edit-mode/page-panels/index.js @@ -13,6 +13,7 @@ import { useSelect } from '@wordpress/data'; import { store as coreStore } from '@wordpress/core-data'; import { decodeEntities } from '@wordpress/html-entities'; import { + PostDiscussionPanel, PostExcerptPanel, PostFeaturedImagePanel, PostLastRevisionPanel, @@ -104,6 +105,7 @@ export default function PagePanels() { + ); } diff --git a/packages/edit-site/src/components/sidebar-edit-mode/template-panel/index.js b/packages/edit-site/src/components/sidebar-edit-mode/template-panel/index.js index 157a56b246171..21903f0066767 100644 --- a/packages/edit-site/src/components/sidebar-edit-mode/template-panel/index.js +++ b/packages/edit-site/src/components/sidebar-edit-mode/template-panel/index.js @@ -4,6 +4,7 @@ import { useSelect } from '@wordpress/data'; import { PanelBody } from '@wordpress/components'; import { + PostDiscussionPanel, PostExcerptPanel, PostFeaturedImagePanel, PostLastRevisionPanel, @@ -68,6 +69,7 @@ export default function TemplatePanel() { + ); } diff --git a/packages/editor/src/components/index.js b/packages/editor/src/components/index.js index 0ae7ac0824a7f..d20ba59215b9b 100644 --- a/packages/editor/src/components/index.js +++ b/packages/editor/src/components/index.js @@ -30,6 +30,7 @@ export { default as PostAuthor } from './post-author'; export { default as PostAuthorCheck } from './post-author/check'; export { default as PostAuthorPanel } from './post-author/panel'; export { default as PostComments } from './post-comments'; +export { default as PostDiscussionPanel } from './post-discussion/panel'; export { default as PostExcerpt } from './post-excerpt'; export { default as PostExcerptCheck } from './post-excerpt/check'; export { default as PostExcerptPanel } from './post-excerpt/panel'; diff --git a/packages/edit-post/src/components/sidebar/discussion-panel/index.js b/packages/editor/src/components/post-discussion/panel.js similarity index 79% rename from packages/edit-post/src/components/sidebar/discussion-panel/index.js rename to packages/editor/src/components/post-discussion/panel.js index 3ed175ca66e1e..8d9a6a691ac90 100644 --- a/packages/edit-post/src/components/sidebar/discussion-panel/index.js +++ b/packages/editor/src/components/post-discussion/panel.js @@ -3,20 +3,19 @@ */ import { __ } from '@wordpress/i18n'; import { PanelBody, PanelRow } from '@wordpress/components'; -import { - PostComments, - PostPingbacks, - PostTypeSupportCheck, - store as editorStore, -} from '@wordpress/editor'; import { useDispatch, useSelect } from '@wordpress/data'; /** - * Module Constants + * Internal dependencies */ +import { store as editorStore } from '../../store'; +import PostTypeSupportCheck from '../post-type-support-check'; +import PostComments from '../post-comments'; +import PostPingbacks from '../post-pingbacks'; + const PANEL_NAME = 'discussion-panel'; -function DiscussionPanel() { +function PostDiscussionPanel() { const { isEnabled, isOpened } = useSelect( ( select ) => { const { isEditorPanelEnabled, isEditorPanelOpened } = select( editorStore ); @@ -55,4 +54,4 @@ function DiscussionPanel() { ); } -export default DiscussionPanel; +export default PostDiscussionPanel;