Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link interface unification using one in navigation block #18833

Closed
karmatosed opened this issue Nov 29, 2019 · 6 comments
Closed

Link interface unification using one in navigation block #18833

karmatosed opened this issue Nov 29, 2019 · 6 comments
Labels
Needs Dev Ready for, and needs developer efforts
Milestone

Comments

@karmatosed
Copy link
Member

There is a new link interface being used for navigation:

image

Whilst the #17557 was closed this only brought it into navigation. I would like to see it replacing the one also used anywhere else. Unfortunately, right now we have 2 ways to add links so let's fix that.

@karmatosed karmatosed added the Needs Dev Ready for, and needs developer efforts label Nov 29, 2019
@karmatosed karmatosed added this to the Gutenberg 7.1 milestone Nov 29, 2019
@noisysocks
Copy link
Member

Unfortunately, right now we have 2 ways to add links so let's fix that.

We have four by my count! 😀 Soon to be five if #18139 is merged.

Paragraph block:

Screen Shot 2019-12-05 at 16 39 56

Image block:

Screen Shot 2019-12-05 at 16 40 29

Navigation block:

Screen Shot 2019-12-05 at 16 41 04

Button block:

Screen Shot 2019-12-05 at 16 42 05

@phpbits
Copy link
Contributor

phpbits commented Dec 5, 2019

Do you have any link for the documentation on how to extend the new interface? Thanks!

@noisysocks
Copy link
Member

@phpbits:

There is a little documentation on the LinkControl component (which is what the Navigation block uses) here:

https://github.com/WordPress/gutenberg/blob/master/packages/block-editor/src/components/link-control/README.md

@noisysocks
Copy link
Member

Just thinking through what might be involved here:

  • Need to update the built-in link format (format-library/src/link/index.js) to use LinkControl.
  • Need to update the Image block to use LinkControl.
  • Potentially should also update the Button block to use LinkControl.
  • Potentially should deprecate the old components (URLInput, URLPopover, etc.)

There's no need to do everything at once. We can start small and iterate.

LinkControl will also need to be updated to support more than just checkbox settings so that the Image block can show the Link Rel and Link CSS Class settings. For this I would suggest replacing the currentSettings prop with an API designed around composition, e.g:

<LinkControl currentLink={ ... } onLinkChange={ ... }>
	<LinkControl.ToggleSetting title="Open in new tab" onToggle={ ... } />
	<LinkControl.TextSetting title="Link rel" value="" onToggle={ ... } />
	<LinkControl.TextSetting title="Link CSS class" value="" onToggle={ ... } />
</LinkControl>

@karmatosed
Copy link
Member Author

Closing this one as making individual issues for each area that needs this.

@phpbits
Copy link
Contributor

phpbits commented May 31, 2020

@noisysocks Any updates on how we can add extra controls on the Link popover? Planning to add extra 'trash' icon at the bottom to remove link. Thanks!

Screen Shot 2020-05-31 at 11 33 08 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Dev Ready for, and needs developer efforts
Projects
None yet
Development

No branches or pull requests

3 participants