diff --git a/packages/edit-site/src/components/block-editor/use-site-editor-settings.js b/packages/edit-site/src/components/block-editor/use-site-editor-settings.js index 6f6d74d8f49cb..b89ed6075a4bd 100644 --- a/packages/edit-site/src/components/block-editor/use-site-editor-settings.js +++ b/packages/edit-site/src/components/block-editor/use-site-editor-settings.js @@ -114,38 +114,40 @@ function useNavigateToPreviousEntityRecord() { export function useSpecificEditorSettings() { const onNavigateToEntityRecord = useNavigateToEntityRecord(); - const { templateSlug, canvasMode, settings, postWithTemplate } = useSelect( - ( select ) => { - const { - getEditedPostType, - getEditedPostId, - getEditedPostContext, - getCanvasMode, - getSettings, - } = unlock( select( editSiteStore ) ); - const { getEditedEntityRecord } = select( coreStore ); - const usedPostType = getEditedPostType(); - const usedPostId = getEditedPostId(); - const _record = getEditedEntityRecord( - 'postType', - usedPostType, - usedPostId - ); - const _context = getEditedPostContext(); - return { - templateSlug: _record.slug, - canvasMode: getCanvasMode(), - settings: getSettings(), - postWithTemplate: - // TODO: The `postType` check should be removed when the default rendering mode per post type is merged. - // @see https://github.com/WordPress/gutenberg/pull/62304/ - _context?.postId && _context?.postType !== 'post', - }; - }, - [] - ); + const { + templateSlug, + canvasMode, + settings, + shouldUseTemplateAsDefaultRenderingMode, + } = useSelect( ( select ) => { + const { + getEditedPostType, + getEditedPostId, + getEditedPostContext, + getCanvasMode, + getSettings, + } = unlock( select( editSiteStore ) ); + const { getEditedEntityRecord } = select( coreStore ); + const usedPostType = getEditedPostType(); + const usedPostId = getEditedPostId(); + const _record = getEditedEntityRecord( + 'postType', + usedPostType, + usedPostId + ); + const _context = getEditedPostContext(); + return { + templateSlug: _record.slug, + canvasMode: getCanvasMode(), + settings: getSettings(), + // TODO: The `postType` check should be removed when the default rendering mode per post type is merged. + // @see https://github.com/WordPress/gutenberg/pull/62304/ + shouldUseTemplateAsDefaultRenderingMode: + _context?.postId && _context?.postType !== 'post', + }; + }, [] ); const archiveLabels = useArchiveLabel( templateSlug ); - const defaultRenderingMode = postWithTemplate + const defaultRenderingMode = shouldUseTemplateAsDefaultRenderingMode ? 'template-locked' : 'post-only'; const onNavigateToPreviousEntityRecord = diff --git a/packages/edit-site/src/components/editor/index.js b/packages/edit-site/src/components/editor/index.js index 300dcda3d6943..8615b3355b835 100644 --- a/packages/edit-site/src/components/editor/index.js +++ b/packages/edit-site/src/components/editor/index.js @@ -221,7 +221,7 @@ export default function EditSiteEditor( { isPostsList = false } ) { onClick={ () => { setCanvasMode( 'view' ); // TODO: this is a temporary solution to navigate to the posts list if we are - // come here throught `posts list` and are in focus mode editing a template or template part. + // come here through `posts list` and are in focus mode editing a template, template part etc.. if ( isPostsList && params?.focusMode