Skip to content

Commit

Permalink
Reverted changed code back to inline with master.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeryj committed Jan 21, 2020
1 parent cc5cd14 commit 6154fd7
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions packages/block-library/src/navigation-link/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,17 +200,25 @@ function NavigationLinkEdit( {
title: newTitle = '',
url: newURL = '',
opensInNewTab: newOpensInNewTab,
} = {} ) => {
setAttributes( {
title: escape( newTitle ),
url: newURL,
label: label || escape( newTitle ),
opensInNewTab: newOpensInNewTab,
} );
} }
onClose={ () => {
setIsLinkOpen( false );
} }
id,
} = {} ) => setAttributes( {
title: escape( newTitle ),
url: encodeURI( newURL ),
label: ( () => {
const normalizedTitle = newTitle.replace( /http(s?):\/\//gi, '' );
const normalizedURL = newURL.replace( /http(s?):\/\//gi, '' );
if (
newTitle !== '' &&
normalizedTitle !== normalizedURL &&
label !== newTitle ) {
return escape( newTitle );
}
return label;
} )(),
opensInNewTab: newOpensInNewTab,
id,
} ) }
onClose={ () => setIsLinkOpen( false ) }
/>
</Popover>
) }
Expand Down

0 comments on commit 6154fd7

Please sign in to comment.