Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ const StylesTab = ( {
contentClientIds={ contentClientIds }
/>
) }
{ ! isSectionBlock && (
{
// Extenders have in the past always been allowed to add controls to group
// the restrictions are lessened for that block.
}
Comment thread
talldan marked this conversation as resolved.
{ ( ! isSectionBlock || blockName === 'core/template-part' ) && (
<>
<InspectorControls.Slot
group="color"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import {
import { ListViewContentFill } from './list-view-content-popover';

const PATTERN_EDITING_GROUPS = [ 'content', 'list' ];
const TEMPLATE_PART_GROUPS = [ 'default', 'settings', 'advanced' ];

export default function InspectorControlsFill( {
children,
Expand Down Expand Up @@ -56,17 +55,16 @@ export default function InspectorControlsFill( {

// During pattern editing:
// - All blocks can show pattern editing groups (content, list).
// - Template parts can show a settings tab (default, settings, advanced groups).
// - Template parts can show any inspector group.
// - Other blocks cannot show a settings tab.
if ( context[ mayDisplayPatternEditingControlsKey ] ) {
// Template parts are allowed to show a settings tab to allow access to the
// 'Design' and 'Advanced' panels.
// Template parts have also historically supported
// any block inspector groups for extenders. The settings
// tab is also used by core for the 'Design' panel. Specifically
// for that block the restrictions on allowed groups are lessened.
const isTemplatePart = context.name === 'core/template-part';
const isTemplatePartGroup = TEMPLATE_PART_GROUPS.includes( group );
const isPatternEditingGroup = PATTERN_EDITING_GROUPS.includes( group );

const canShowGroup =
( isTemplatePart && isTemplatePartGroup ) || isPatternEditingGroup;
const canShowGroup = isTemplatePart || isPatternEditingGroup;

if ( ! canShowGroup ) {
return null;
Expand Down
Loading