Skip to content

Add new, simpler link control for use by core extenders #65092

Open

Description

@markhowellsmead

What problem does this address?

The amount of React code required to make a link control is quite considerable. Developers would find it much easier to implement if this were available as a reusable component. See https://github.com/ndiego/enable-linked-groups/blob/main/src/index.js for an example.

What is your proposed solution?

Take the code which has been written here for the control, make it into a simpler reusable wrapped component, and add to one of the core component packages.

Activity

  1. added
    [Type] Enhancement
    on Sep 5, 2024
  2. ndiego commented on Sep 5, 2024

    @ndiego
    Member

    Take the code which has been written here for the control, make it into a simpler reusable wrapped component, and add to one of the core component packages.

    I am not 100% convinced by this solution, or maybe I just can't quite conceptualize it. While creating a wrapper component would definitely be possible, if you wanted to add custom functionality, you would still need to compose your own component.

    That said, the LinkControl itself is primarily used to link text within blocks. So perhaps some sort of LinkButtonControl would add the UI similar to the Image block and what I built, and then have some sort of extensibility mechanism to define the menu options presented. 🤔

    Image block
    linked-group-image-link
  3. added
    [Feature] UI Components
    [Feature] Extensibility
    on Sep 5, 2024
  4. Mamaduka commented on Sep 5, 2024

    @Mamaduka
    Member

    Somewhat related #56384.

  5. markhowellsmead commented on Sep 5, 2024

    @markhowellsmead
    Author

    My intention and hope is that the entire component would be available as a complete React component, including a standardised popover, link targeting, rel etc, data/attribute handling and visual commonality with core blocks. I'd also note that the editorial linking experience is different across various blocks, which should also be standardised. Right now, it's a fairly large amount of work to add a control like this one to the toolbar, when it should be simple, as a very common use-case on custom blocks / custom core block extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Extensibility[Feature] UI Components[Type] Enhancement

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions