Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Felix 46 posts 67 karma points
    Jul 28, 2010 @ 08:42
    Felix
    0

    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.

     

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Jul 28, 2010 @ 12:14
    Ismail Mayat
    0

    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

  • Felix 46 posts 67 karma points
    Jul 29, 2010 @ 02:23
    Felix
    0

    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.

     

     

  • Felix 46 posts 67 karma points
    Jul 29, 2010 @ 10:22
    Felix
    0

    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

     

     

  • Casey Neehouse 1339 posts 483 karma points MVP 2x admin
    May 29, 2014 @ 18:26
    Casey Neehouse
    0

    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.

  • James Jackson-South 489 posts 1747 karma points c-trib
    May 29, 2014 @ 18:32
    James Jackson-South
    0

    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

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    May 29, 2014 @ 18:55
    Matt Brailsford
    0

    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 calling getSelectValue at the very least.

    Hope this helps guide you in the right direction.

    Matt

  • James Jackson-South 489 posts 1747 karma points c-trib
    May 29, 2014 @ 19:02
    James Jackson-South
    0

    Thanks :)

    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.

  • Phillip Turner 98 posts 412 karma points
    May 29, 2014 @ 22:17
    Phillip Turner
    0

    Same issue here! Removes class if I select a link from the content picker. class attrib staying if I hard code it.

Please Sign in or register to post replies

Write your reply to:

Draft