Skip to content

Commit

Permalink
adding stored URL back
Browse files Browse the repository at this point in the history
removing the URL from the navigation item caused LinkControl to not load in edit mode when a link is present. it also messes the look of the navigation items.

It is rather weird that we store a potentially outdated link but we can address that separately.
  • Loading branch information
draganescu committed May 7, 2020
1 parent aa1ee6a commit fc82193
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
3 changes: 0 additions & 3 deletions packages/block-library/src/navigation-link/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,6 @@ function NavigationLinkEdit( {
} = {} ) =>
setAttributes( {
url: ( () => {
if ( id ) {
return undefined;
}
return encodeURI( newURL );
} )(),
label: ( () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/block-library/src/navigation/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ function Navigation( {
return null;
}

return pages.map( ( { title, id } ) =>
return pages.map( ( { title, link: url, id } ) =>
createBlock( 'core/navigation-link', {
id,
url,
label: ! title.rendered
? __( '(no title)' )
: escape( title.rendered ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ exports[`Navigation allows a navigation menu to be created using existing pages
exports[`Navigation allows pages to be created from the navigation block and their links added to menu 1`] = `
"<!-- wp:navigation {\\"orientation\\":\\"horizontal\\"} -->
<!-- wp:navigation-link {\\"label\\":\\"A really long page name that will not exist\\",\\"id\\":1} /-->
<!-- wp:navigation-link {\\"label\\":\\"A really long page name that will not exist\\",\\"id\\":1,\\"url\\":\\"https://this/is/a/test/create/page/my-new-page\\"} /-->
<!-- /wp:navigation -->"
`;

0 comments on commit fc82193

Please sign in to comment.