Skip to content

LinkControl: Add CSS class to improve styling for external links #61056

Open

Description

What problem does this address?

I am using css to add an icon after any link that is external simple example:

a[target="_blank"]

The problem is for button blocks (maybe other blocks?) the link is a div in gutenberg. So my css does not style the link to match the frontend of the site. Ok, not a problem, I can target it, however there is no way to target the div based on if its an external link.

What is your proposed solution?

If the link within the button has "Open in new tab" checked, we add a class such as "external-link" or "blank-target" or "link-target-blank". With this new class I can target it via custom css for the editor.

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

Metadata

Assignees

No one assigned

    Labels

    [Feature] Link EditingLink components (LinkControl, URLInput) and integrations (RichText link formatting)Link components (LinkControl, URLInput) and integrations (RichText link formatting)[Type] EnhancementA suggestion for improvement.A suggestion for improvement.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions