locked
RTE: Adding a "class" to a hyperlink RRS feed

  • Question

  • Hi everyone

    we have a public facing website we're migrating to sharepoint 2013. And we're trying to migrate from Telerik Radeditor to the out of the box Rich Text Editor. We have different kind of "Hyperlinks" so we would like to offer them as "Styles" or "Elements". We have made our own "prefix" and our own CSS. None of them are actually really satisfying.

    Example 1:

    a.myprefix-rteElement-HyperlinkStyle1 {
        -ms-name: "HyperlinkStyle1";
    background: url(img/arrow10.gif) no-repeat 0px 3px;
    }

    Problem:

    If i select a word in a paragraph, create a hyperlink, select the hyperlink and select the style, the <p>-tag will be replace with an <a> tag. I end with a hyperlink around the whole sentence. Clearly not what i wanted: I end with the following code:

    <a class="myprefix-rteElement-HyperlinkStyle1">some text<a href="http://www.bing.com">Search on Bing</a>some text</a>

    Example 2:

    a.myprefix-rteStyle-HyperlinkStyle1 {
        -ms-name: "HyperlinkStyle1";
    background: url(img/arrow10.gif) no-repeat 0px 3px;
    }

    Problem:
    Better, but not good enough. If i do the same as described before, I'll end with the following source-code

    <a href="http://www.bing.com"><span class="myprefix-rteElement-HyperlinkStyle1">Search on Bing</span></a>

    it's still not what i wanted. I wanted the class applied to the hyperlink, not to create a <span> tag and assign a class to it.

    so, is there a way to actually assign a class to an <a>-tag using the out of the box RTE that we're not aware of? (Editing the HTML-Source-Code is not an option)

    Thank you very much in advance.

    Carlos




    • Edited by CarlosCl Thursday, January 24, 2013 5:33 PM
    Thursday, January 24, 2013 5:30 PM

All replies