From 8fcd7441e512890820583f70ad21c882668e4472 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Mon, 18 Dec 2023 11:39:25 +0100 Subject: [PATCH] Site Editor: Add Page Attributes panel --- .../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/page-attributes/panel.js} | 18 +++++++++--------- 5 files changed, 16 insertions(+), 11 deletions(-) rename packages/{edit-post/src/components/sidebar/page-attributes/index.js => editor/src/components/page-attributes/panel.js} (81%) 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 8f71b3908d584d..0cd69cb11538c6 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, + PageAttributesPanel, PostDiscussionPanel, PostExcerptPanel, PostFeaturedImagePanel, @@ -25,7 +26,6 @@ import { */ import SettingsHeader from '../settings-header'; import PostStatus from '../post-status'; -import PageAttributes from '../page-attributes'; import MetaBoxes from '../../meta-boxes'; import PluginDocumentSettingPanel from '../plugin-document-setting-panel'; import PluginSidebarEditPost from '../plugin-sidebar'; @@ -86,7 +86,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 87be48220ec95e..0d4dee97aad984 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 { + PageAttributesPanel, PostDiscussionPanel, PostExcerptPanel, PostFeaturedImagePanel, @@ -106,6 +107,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 21903f0066767f..21df325ee34c20 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 { + PageAttributesPanel, PostDiscussionPanel, PostExcerptPanel, PostFeaturedImagePanel, @@ -70,6 +71,7 @@ export default function TemplatePanel() { + ); } diff --git a/packages/editor/src/components/index.js b/packages/editor/src/components/index.js index d20ba59215b9b1..33a18e6f9a6ad2 100644 --- a/packages/editor/src/components/index.js +++ b/packages/editor/src/components/index.js @@ -23,6 +23,7 @@ export { default as ErrorBoundary } from './error-boundary'; export { default as LocalAutosaveMonitor } from './local-autosave-monitor'; export { default as PageAttributesCheck } from './page-attributes/check'; export { default as PageAttributesOrder } from './page-attributes/order'; +export { default as PageAttributesPanel } from './page-attributes/panel'; export { default as PageAttributesParent } from './page-attributes/parent'; export { default as PageTemplate } from './post-template/classic-theme'; export { default as PostTemplatePanel } from './post-template/panel'; diff --git a/packages/edit-post/src/components/sidebar/page-attributes/index.js b/packages/editor/src/components/page-attributes/panel.js similarity index 81% rename from packages/edit-post/src/components/sidebar/page-attributes/index.js rename to packages/editor/src/components/page-attributes/panel.js index 7a5d6222e11fcd..63d5bbb5a87048 100644 --- a/packages/edit-post/src/components/sidebar/page-attributes/index.js +++ b/packages/editor/src/components/page-attributes/panel.js @@ -3,21 +3,21 @@ */ import { __ } from '@wordpress/i18n'; import { PanelBody, PanelRow } from '@wordpress/components'; -import { - store as editorStore, - PageAttributesCheck, - PageAttributesOrder, - PageAttributesParent, -} from '@wordpress/editor'; + import { useSelect, useDispatch } from '@wordpress/data'; import { store as coreStore } from '@wordpress/core-data'; /** - * Module Constants + * Internal dependencies */ +import { store as editorStore } from '../../store'; +import PageAttributesCheck from './check'; +import PageAttributesOrder from './order'; +import PageAttributesParent from './parent'; + const PANEL_NAME = 'page-attributes'; -export function PageAttributes() { +export function PageAttributesPanel() { const { isEnabled, isOpened, postType } = useSelect( ( select ) => { const { getEditedPostAttribute, @@ -59,4 +59,4 @@ export function PageAttributes() { ); } -export default PageAttributes; +export default PageAttributesPanel;