Skip to content

Commit

Permalink
Omit meta boxes on “design” type posts (WordPress#64990)
Browse files Browse the repository at this point in the history
Unlinked contributors: smerriman, ericdye, laurelfulford.

Co-authored-by: t-hamano <[email protected]>
Co-authored-by: carolinan <[email protected]>
Co-authored-by: youknowriad <[email protected]>
Co-authored-by: lgladdy <[email protected]>
Co-authored-by: MadtownLems <[email protected]>
  • Loading branch information
6 people authored and huubl committed Oct 2, 2024
1 parent 35d2718 commit fe5a931
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions packages/edit-post/src/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,14 +398,15 @@ function Layout( {
const shouldIframe = useShouldIframe();
const { createErrorNotice } = useDispatch( noticesStore );
const {
currentPost,
currentPost: { postId: currentPostId, postType: currentPostType },
onNavigateToEntityRecord,
onNavigateToPreviousEntityRecord,
} = useNavigateToEntityRecord(
initialPostId,
initialPostType,
'post-only'
);
const isEditingTemplate = currentPostType === 'wp_template';
const {
mode,
isFullscreenActive,
Expand All @@ -415,7 +416,6 @@ function Layout( {
isDistractionFree,
showMetaBoxes,
hasHistory,
isEditingTemplate,
isWelcomeGuideVisible,
templateId,
} = useSelect(
Expand All @@ -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',
Expand All @@ -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
Expand Down Expand Up @@ -568,12 +566,12 @@ function Layout( {
<SlotFillProvider>
<ErrorBoundary>
<CommandMenu />
<WelcomeGuide postType={ currentPost.postType } />
<WelcomeGuide postType={ currentPostType } />
<Editor
settings={ editorSettings }
initialEdits={ initialEdits }
postType={ currentPost.postType }
postId={ currentPost.postId }
postType={ currentPostType }
postId={ currentPostId }
templateId={ templateId }
className={ className }
styles={ styles }
Expand All @@ -585,7 +583,7 @@ function Layout( {
autoFocus={ ! isWelcomeGuideVisible }
onActionPerformed={ onActionPerformed }
extraSidebarPanels={
! isEditingTemplate && <MetaBoxes location="side" />
showMetaBoxes && <MetaBoxes location="side" />
}
extraContent={
! isDistractionFree &&
Expand Down

0 comments on commit fe5a931

Please sign in to comment.