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

[Feature Request]: Support for classes for LINKS in posts/pages editors #1675

Open
bjazmoore opened this issue Sep 7, 2024 · 5 comments
Open

Comments

@bjazmoore
Copy link

Feature Description

It would be nice to be able to give a class to links that are added to a page or post through the Insert/Edit link dialog. This would allow some links to be styled if desired (perhaps as a button) in the post/page. Ideally it would be an extra field on the Insert/Edit link dialog:
1

@bjazmoore
Copy link
Author

I found I can target these links using the Link "title" attribute, so this is not a super high priority need for me.

For those who want to use CSS and the "title" attribute to target a link for styling try the following:

  1. Give the link a unique title - I used "make_btn"
  2. In my case the link was also an H2 element
  3. Add come custom CSS

`a[title="make_btn"] {
/* Basic button styling /
display: inline-block;
padding: 20px 80px;
text-decoration: none !important;
border-radius: 40px; /
Large value for pill shape */

/* Color and text styling */
background-color: royalblue;
color: white !important;
font-weight: bold;

/* Transition for smooth hover effect */
transition: background-color 0.3s ease;
}

a[title="make_btn"]:hover {
/* Lighter shade of blue on hover /
background-color: navy; /
Cornflower Blue, a lighter shade */
}`

It looks like this:

1

@bjazmoore
Copy link
Author

There is still a problem with the approach shown above. The tooltip for the link says "make_btn" which is less than optimal.

So there is still a need to be able to add a class to style a link as a button.

Thanks

@dziudek
Copy link
Collaborator

dziudek commented Sep 28, 2024

@bjazmoore - sounds like a good idea - I will add it in v.0.46.2 or in v.0.47

@bjazmoore
Copy link
Author

@bjazmoore - sounds like a good idea - I will add it in v.0.46.2 or in v.0.47

Thank you.

@gpsblues
Copy link

gpsblues commented Nov 7, 2024

Hi,

Currently, you can use a small hack in the title field to speed up adding a class, but it can only be modified later through code:

my-title" class="my-class
The result is:

<a href="#" title="my-title" class="my-class">

A class field would be a great feature addition, as adding custom classes directly in the TinyMCE editor is a bit more tedious and less flexible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants