diff --git a/packages/editor/src/components/editor-canvas/index.js b/packages/editor/src/components/editor-canvas/index.js index f011f285644c0e..bc7d54583afbda 100644 --- a/packages/editor/src/components/editor-canvas/index.js +++ b/packages/editor/src/components/editor-canvas/index.js @@ -40,6 +40,17 @@ const { const noop = () => {}; +/** + * These post types have a special editor where they don't allow you to fill the title + * and they don't apply the layout styles. + */ +const DESIGN_POST_TYPES = [ + 'wp_block', + 'wp_template', + 'wp_navigation', + 'wp_template_part', +]; + /** * Given an array of nested blocks, find the first Post Content * block inside it, recursing through any nesting levels, @@ -93,6 +104,7 @@ function EditorCanvas( { wrapperUniqueId, deviceType, showEditorPadding, + isDesignPostType, } = useSelect( ( select ) => { const { getCurrentPostId, @@ -130,6 +142,7 @@ function EditorCanvas( { return { renderingMode: _renderingMode, postContentAttributes: editorSettings.postContentAttributes, + isDesignPostType: DESIGN_POST_TYPES.includes( postTypeSlug ), // Post template fetch returns a 404 on classic themes, which // messes with e2e tests, so check it's a block theme first. editedPostTemplate: @@ -164,7 +177,7 @@ function EditorCanvas( { // fallbackLayout is used if there is no Post Content, // and for Post Title. const fallbackLayout = useMemo( () => { - if ( renderingMode !== 'post-only' ) { + if ( renderingMode !== 'post-only' || isDesignPostType ) { return { type: 'default' }; } @@ -175,7 +188,12 @@ function EditorCanvas( { } // Set default layout for classic themes so all alignments are supported. return { type: 'default' }; - }, [ renderingMode, themeSupportsLayout, globalLayoutSettings ] ); + }, [ + renderingMode, + themeSupportsLayout, + globalLayoutSettings, + isDesignPostType, + ] ); const newestPostContentAttributes = useMemo( () => { if ( @@ -318,7 +336,8 @@ function EditorCanvas( { > { themeSupportsLayout && ! themeHasDisabledLayoutStyles && - renderingMode === 'post-only' && ( + renderingMode === 'post-only' && + ! isDesignPostType && ( <> ) } - { renderingMode === 'post-only' && ( + { renderingMode === 'post-only' && ! isDesignPostType && (