From fe5a93149950d2edb338fa71b79a48ed9abf6e9b Mon Sep 17 00:00:00 2001 From: Mitchell Austin Date: Sun, 29 Sep 2024 09:05:58 -0700 Subject: [PATCH] =?UTF-8?q?Omit=20meta=20boxes=20on=20=E2=80=9Cdesign?= =?UTF-8?q?=E2=80=9D=20type=20posts=20(#64990)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unlinked contributors: smerriman, ericdye, laurelfulford. Co-authored-by: t-hamano Co-authored-by: carolinan Co-authored-by: youknowriad Co-authored-by: lgladdy Co-authored-by: MadtownLems --- .../edit-post/src/components/layout/index.js | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/packages/edit-post/src/components/layout/index.js b/packages/edit-post/src/components/layout/index.js index e6451c6a4a4082..66fa9dd5d93b8a 100644 --- a/packages/edit-post/src/components/layout/index.js +++ b/packages/edit-post/src/components/layout/index.js @@ -398,7 +398,7 @@ function Layout( { const shouldIframe = useShouldIframe(); const { createErrorNotice } = useDispatch( noticesStore ); const { - currentPost, + currentPost: { postId: currentPostId, postType: currentPostType }, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord, } = useNavigateToEntityRecord( @@ -406,6 +406,7 @@ function Layout( { initialPostType, 'post-only' ); + const isEditingTemplate = currentPostType === 'wp_template'; const { mode, isFullscreenActive, @@ -415,7 +416,6 @@ function Layout( { isDistractionFree, showMetaBoxes, hasHistory, - isEditingTemplate, isWelcomeGuideVisible, templateId, } = useSelect( @@ -428,7 +428,7 @@ function Layout( { const supportsTemplateMode = settings.supportsTemplateMode; const isViewable = - getPostType( currentPost.postType )?.viewable ?? false; + getPostType( currentPostType )?.viewable ?? false; const canViewTemplate = canUser( 'read', { kind: 'postType', name: 'wp_template', @@ -444,21 +444,19 @@ function Layout( { showIconLabels: get( 'core', 'showIconLabels' ), isDistractionFree: get( 'core', 'distractionFree' ), showMetaBoxes: + ! DESIGN_POST_TYPES.includes( currentPostType ) && select( editorStore ).getRenderingMode() === 'post-only', - isEditingTemplate: - select( editorStore ).getCurrentPostType() === - 'wp_template', isWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ), templateId: supportsTemplateMode && isViewable && canViewTemplate && - currentPost.postType !== 'wp_template' + ! isEditingTemplate ? getEditedPostTemplateId() : null, }; }, - [ settings.supportsTemplateMode, currentPost.postType ] + [ currentPostType, isEditingTemplate, settings.supportsTemplateMode ] ); // Set the right context for the command palette @@ -568,12 +566,12 @@ function Layout( { - + + showMetaBoxes && } extraContent={ ! isDistractionFree &&