Skip to content

Commit

Permalink
Only hide when parent is widget-area
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin940726 committed Oct 12, 2020
1 parent 15b7cbb commit 35b7367
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
8 changes: 4 additions & 4 deletions lib/widgets-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,9 @@ function gutenberg_widgets_init( $hook ) {

$settings = array_merge(
array(
'imageSizes' => $available_image_sizes,
'isRTL' => is_rtl(),
'maxUploadFileSize' => $max_upload_size,
'hideParentSelector' => true,
'imageSizes' => $available_image_sizes,
'isRTL' => is_rtl(),
'maxUploadFileSize' => $max_upload_size,
),
gutenberg_get_legacy_widget_settings()
);
Expand Down Expand Up @@ -142,3 +141,4 @@ function gutenberg_widgets_editor_load_block_editor_scripts_and_styles( $is_bloc
}

add_filter( 'should_load_block_editor_scripts_and_styles', 'gutenberg_widgets_editor_load_block_editor_scripts_and_styles' );

Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ export default function BlockParentSelector() {
};
}, [] );

if ( parentBlockType.hideParentSelector ) {
return null;
}

if ( firstParentClientId !== undefined ) {
return (
<div
Expand Down
4 changes: 1 addition & 3 deletions packages/block-editor/src/components/block-toolbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export default function BlockToolbar( {
blockType,
hasFixedToolbar,
hasReducedUI,
hideParentSelector,
isValid,
isVisual,
} = useSelect( ( select ) => {
Expand All @@ -59,7 +58,6 @@ export default function BlockToolbar( {
getBlockType( getBlockName( selectedBlockClientId ) ),
hasFixedToolbar: settings.hasFixedToolbar,
hasReducedUI: settings.hasReducedUI,
hideParentSelector: !! settings.hideParentSelector,
rootClientId: blockRootClientId,
isValid: selectedBlockClientIds.every( ( id ) =>
isBlockValid( id )
Expand Down Expand Up @@ -115,7 +113,7 @@ export default function BlockToolbar( {
return (
<Wrapper className={ classes }>
<div ref={ nodeRef } { ...showMoversGestures }>
{ ! hideParentSelector && ! isMultiToolbar && (
{ ! isMultiToolbar && (
<div className="block-editor-block-toolbar__block-parent-selector-wrapper">
<BlockParentSelector clientIds={ blockClientIds } />
</div>
Expand Down
1 change: 1 addition & 0 deletions packages/edit-widgets/src/blocks/widget-area/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ export const settings = {
title: __( 'Widget Area' ),
description: __( 'A widget area container.' ),
__experimentalLabel: ( { name: label } ) => label,
hideParentSelector: true,
edit,
};

0 comments on commit 35b7367

Please sign in to comment.