Skip to content

Commit

Permalink
Rendering mode should be 'all' in post editor when editing a template…
Browse files Browse the repository at this point in the history
… or template part
  • Loading branch information
noisysocks committed Mar 21, 2024
1 parent 34e9348 commit 348889e
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions packages/edit-post/src/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function Editor( {
onNavigateToPreviousEntityRecord,
} = useNavigateToEntityRecord( initialPostId, initialPostType );

const { post, template } = useSelect(
const { post, template, defaultRenderingMode } = useSelect(
( select ) => {
const { getEditedPostTemplate } = select( editPostStore );
const { getEntityRecord, getPostType, canUser } =
Expand All @@ -65,6 +65,11 @@ function Editor( {
? getEditedPostTemplate()
: null,
post: postObject,
defaultRenderingMode:
currentPost.postType === 'wp_template' ||
currentPost.postType === 'wp_template_part'
? 'all'
: 'post-only',
};
},
[ currentPost.postType, currentPost.postId ]
Expand All @@ -75,9 +80,14 @@ function Editor( {
...settings,
onNavigateToEntityRecord,
onNavigateToPreviousEntityRecord,
defaultRenderingMode: 'post-only',
defaultRenderingMode,
} ),
[ settings, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord ]
[
settings,
onNavigateToEntityRecord,
onNavigateToPreviousEntityRecord,
defaultRenderingMode,
]
);

if ( ! post ) {
Expand Down

0 comments on commit 348889e

Please sign in to comment.