From a88b994f1361f8ef2dbbdef0f88de8443d0d9bf8 Mon Sep 17 00:00:00 2001 From: retrofox Date: Mon, 28 Oct 2019 17:18:13 -0300 Subject: [PATCH] navigation-menu-item: anchor LinkControl at item text --- .../src/navigation-menu-item/edit.js | 45 ++++++++++--------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/packages/block-library/src/navigation-menu-item/edit.js b/packages/block-library/src/navigation-menu-item/edit.js index 7273bb8cb8a0fe..2ac9556be26b85 100644 --- a/packages/block-library/src/navigation-menu-item/edit.js +++ b/packages/block-library/src/navigation-menu-item/edit.js @@ -93,15 +93,31 @@ function NavigationMenuItemEdit( { let content; if ( isSelected ) { content = ( - setIsLinkOpen( false ) } - label={ __( 'Navigation Label' ) } - hideLabelFromVision={ true } - /> +
+ setIsLinkOpen( false ) } + label={ __( 'Navigation Label' ) } + hideLabelFromVision={ true } + /> + { isLinkOpen && + event.stopPropagation() } + currentLink={ link } + onLinkChange={ updateLink } + onClose={ () => setIsLinkOpen( false ) } + currentSettings={ linkSettings } + onSettingsChange={ updateLinkSetting } + fetchSearchSuggestions={ fetchSearchSuggestions } + /> + } +
); + } else { content =
{ label } @@ -118,19 +134,6 @@ function NavigationMenuItemEdit( { title={ __( 'Link' ) } onClick={ () => setIsLinkOpen( ! isLinkOpen ) } /> - { isLinkOpen && - event.stopPropagation() } - currentLink={ link } - onLinkChange={ updateLink } - onClose={ () => setIsLinkOpen( false ) } - currentSettings={ linkSettings } - onSettingsChange={ updateLinkSetting } - fetchSearchSuggestions={ fetchSearchSuggestions } - /> - }