Jump to content

Recommended Posts

Posted

Greetings all,

Trying to figure out how I add extra attributes to an element in TinyMCE.

When I make a piece of text a link, I get the PW popup asking for the URL etc, but there's no way to specify custom attributes for this tag such as a title attribute or even a data-* attribute.

I've edited TinyMCE to allow the title attribute for <a> tags and they're not getting stripped out on save, but it is incredibly cumbersome to have to manually add these extra attributes to an element through the HTML source editor in TinyMCE.

I need this functionality as I am using the title attribute to display a tooltip on hover for the <a> tag.

Does anyone know of a plugin, module or anything really that would help resolve this issue?

Cheers.

Posted

You could replace PW's link dialog with TinyMCE's native link dialog, as I believe it provides the option of more attributes. I think this can be done by replacing references to "pwlink" with "link" in the TinyMCE settings, though have not tried it recently. 

Posted

Maybe a repeater with 2 fields in it can do it's job here.

The first field is the key field, the second the tooltip value.

Then you could do a str_replace on your $page->body

  • 4 weeks later...
Posted

@Ryan

most of my clients require to have sites W3C validated and it is considered good practice anyways. Thus it is essential to have the title attribute in <a> tags.

Would you perhaps consider to make this standard for PW's link dialogue with TinyMCE (and CKEditor)?

I couldn't find instances of "pwlink" in the TinyMCE settings on both, 2.3 and 2.4 installs.

When I switch to CKEditor, there are references "PWLink" in CKEditor Toolbar settings and "pwlink" in Extra Plugins.

When I change PWLink to "Link" and remove the extra plugin pwlink, I get the standard CKEditor Link dialogue where I can enter a title attribute in the Advanced tab.

Cheers

Gerhard

Posted

I never get error free validation - css3 tends to fail all over the place. I was amused to notice that even stackoverflow is full of errors :)

Thankfully, none of my low value clients even know what wc3 is. 

Interesting blog posts, SiNNut

Posted

@SiNNuT

thank you for the links. With my limited knowledge of the subject I wasn't aware of the facts mentioned there.

Very interesting, indeed and good points for discussion with my clients.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...