If i then select the text "testing" in the editor and click the edit link button, and change the link to an internal umbraco page, and then click ok, it strips out the class attribute on the a. This causes problems for obvious reasons as it means the user needs to then go and edit the source and manually type in the class name.
Does it strip out class when you do it for external link? The allowed tags/attributes are set in the tinyMceConfig.config file cant remember exact directory where that is stored but its worth looking in there to see what is set for a tags.
Yes it does it for external links too. I think the problem is that, when you change the link it reconstructs the entire a tag, but fails to keep other attributes already existing on the a tag.
and yep i did have a look at allowed tags/attributes, thats all setup fine.
had a dig around, think the easiest way to fix it is if a class box is added to the dialog that pops up, i noticed the Title attribute exists within the dialog, so if you modify an a tag with the title in it, it keeps the title.
any idea on how we might go about adding a class box to the dialog? the dilaogs located in the /umbraco/plugins/tinymce3/insertlink.aspx
The bug is still affecting the editor 4 years later in v6.2.
There seems to be no alternative either. Trying to add a CSS class to an anchor results in a span being created with the class added instead. If spans are disabled via the config then it will add it to any surrounding tags.
I'm not sure if this code actually replaces all those tags with empty values or not, but given that the class one at least looks to be doing some special lookup (that will yield no value as the Umbraco link pinker doesn't support a class input field) my guess is that this will be the reason for stripping.
You'd need to look at setAttrib in more detail, but I don't think we would need to be calling getSelectValue at the very least.
I did have a look at that. I think the issue might be within setAttrib as I un-commented the getSelectValue function related to class with no success. I don't know whether the cache was completely cleared though. I'll investigate further once I get a moment and feedback.
tinyMCE - classes on a tags
hi all,
the issue im having is the following:
I've created a template within TINY MCE, that has one line of code as below, so i select the template to insert into Tiny MCE.
<a href="/test" class="someclass"><span>testing</span></a>
If i then select the text "testing" in the editor and click the edit link button, and change the link to an internal umbraco page, and then click ok, it strips out the class attribute on the a. This causes problems for obvious reasons as it means the user needs to then go and edit the source and manually type in the class name.
Felix,
Does it strip out class when you do it for external link? The allowed tags/attributes are set in the tinyMceConfig.config file cant remember exact directory where that is stored but its worth looking in there to see what is set for a tags.
Regards
Ismail
Hi Ismail,
Yes it does it for external links too. I think the problem is that, when you change the link it reconstructs the entire a tag, but fails to keep other attributes already existing on the a tag.
and yep i did have a look at allowed tags/attributes, thats all setup fine.
had a dig around, think the easiest way to fix it is if a class box is added to the dialog that pops up, i noticed the Title attribute exists within the dialog, so if you modify an a tag with the title in it, it keeps the title.
any idea on how we might go about adding a class box to the dialog? the dilaogs located in the /umbraco/plugins/tinymce3/insertlink.aspx
One of my users reported the same issue.
The dialog should maintain markup and only update the attributes that is affecting. Likely just an oversite in the link dialog logic.
Have you reported an issue on http://issues.umbraco.org? If so, link it here and we can vote it up.
Has anyone ever found a solution to this?
The bug is still affecting the editor 4 years later in v6.2.
There seems to be no alternative either. Trying to add a CSS class to an anchor results in a span being created with the class added instead. If spans are disabled via the config then it will add it to any surrounding tags.
I've raised the issue here http://issues.umbraco.org/issue/U4-5016
My guess would be this:
https://github.com/umbraco/Umbraco-CMS/blob/6.2.1/src/Umbraco.Web.UI/umbraco_client/tinymce3/plugins/umbracolink/js/umbracolink.js#L470-496
I'm not sure if this code actually replaces all those tags with empty values or not, but given that the
class
one at least looks to be doing some special lookup (that will yield no value as the Umbraco link pinker doesn't support a class input field) my guess is that this will be the reason for stripping.You'd need to look at
setAttrib
in more detail, but I don't think we would need to be callinggetSelectValue
at the very least.Hope this helps guide you in the right direction.
Matt
Thanks :)
I did have a look at that. I think the issue might be within
setAttrib
as I un-commented thegetSelectValue
function related to class with no success. I don't know whether the cache was completely cleared though. I'll investigate further once I get a moment and feedback.Same issue here! Removes class if I select a link from the content picker. class attrib staying if I hard code it.
is working on a reply...