+1-888-365-2779
Try Now
More in this section

Forums / Designing & Styling / Rich Text editor - selecting

Rich Text editor - selecting <a>

10 posts, 0 answered
  1. Amanda Shafer
    Amanda Shafer avatar
    198 posts
    Registered:
    12 Oct 2012
    12 May 2014
    Link to this post

    Hi-

    My content editors want to be able to create "buttons". I have a css class set for these buttons. However, whenever they attempt to select the link and apply the class, the editor adds a span tag around the anchor tag. This makes it so that I cannot remove the text-decoration style because it is on the <a> not the <span>.

    Is there a way to get the editor to apply the class to the link rather than add a span tag inside the anchor tag?

  2. Arno
    Arno avatar
    249 posts
    Registered:
    08 Sep 2010
    13 May 2014 in reply to Amanda Shafer
    Link to this post

    Hi Amanda,

    I guess it would work as well if you could remove the span tag. I overwrite RenderBeginTag and RenderEndTag in my widgets to get rid of the span tag:

    Public Overrides Sub RenderBeginTag(writer As HtmlTextWriter)
        ' This empty method prevents that the default RenderBeginTag renders a <span> tag wrapping around the control.
    End Sub
     
    Public Overrides Sub RenderEndTag(writer As HtmlTextWriter)
        ' This empty method prevents that the default RenderBeginTag renders a <span> tag wrapping around the control.
    End Sub

  3. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    13 May 2014
    Link to this post

    @Amanda

      The RadEditor is amazingly fantastic...at ruining markup.  The only way to do it safely is to have them dump into HTML mode and edit it directly.

    - OR -

    Create a new thunder control that will render the button as you need it, and maybe contain a page selector and\or external url field.  This way they can just drop it on the page and set the place it goes to...and not screw anything up.

     @Arno
      ...do you mean around the entire simpleview control?  There is an easier way...

    protected override void Render(System.Web.UI.HtmlTextWriter writer)
    {
        this.RenderContents(writer);
    }

  4. Ivan D. Dimitrov
    Ivan D. Dimitrov avatar
    310 posts
    Registered:
    26 Mar 2015
    13 May 2014
    Link to this post
    Hi all,

    The insertion of additional HTML elements is not caused by the Rad Editor itself, but by the filters applied to it in Sitefinity. You have the freedom of disabling them in order to preserve the markup you intend to. Simply go to Administration->Settings->Advanced->Appearance and replace the values of RadEditor filters for Content Block widget and RadEditor's filters for content from DefaultFilters to None. Make sure you restart your application in order for the changes to take effect.

    Regards,
    Ivan D. Dimitrov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  5. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    13 May 2014 in reply to Ivan D. Dimitrov
    Link to this post

    @Ivan

    ...well I mean...it's still the RadEditor DOING it

     You can't deny its ability to epically ruin content, it's been doing it since SF4 was released.  Hell even your telerik.com backend ticket system goes all to hell if you try to paste in something or undo

  6. Ivan D. Dimitrov
    Ivan D. Dimitrov avatar
    310 posts
    Registered:
    26 Mar 2015
    16 May 2014
    Link to this post
    @Steve

    No argument there Steve. The editor does alter the markup and I imagine this is not desired by all of our customers. However this is useful when protecting against malicious users ( script injections for example)

    Regards,
    Ivan D. Dimitrov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  7. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    16 May 2014 in reply to Ivan D. Dimitrov
    Link to this post

    Well the only public facing RadEditor is this one in the forums...right?  So in that case I can see your point.  However it's primarily used literally everywhere in the backend, and I'd like to see anyone whos happy with it.  Undo barely works, and if you get caught in borked content hell (like it nests a <h2> in a list or something) unless the user knows html to jump into that mode...you might as well just start from scratch.

     Remember this classic post?: http://www.sitefinity.com/developer-network/forums/general-discussions-/radeditor-has-issues-when-i

    I'm not knocking the engineering marvel OF the radeditor, I can't even fathom how complex it is to work with and maintain cross-browser...but I think it's now become TOO complex where it's borking more than it's helping.

  8. Arno
    Arno avatar
    249 posts
    Registered:
    08 Sep 2010
    16 May 2014
    Link to this post

    I agree with Steve on this. The best feature of the editor is HTML mode, as that allows us to fix what has been damaged by the editor: span tags nobody asks for, text in a bullet list and no way to get it out of the list, no way (that I know of) to automatically convert URLs to actual a tags, etc, etc. We do use the forums module and I regularly have to edit posts of others because the markup is unacceptable. If they have copied text from somewhere it is a mess. In the backend we always use HTML mode. Sadly that saves us time. I do appreciate its complexity but there is a lot of room for improvement.

  9. Amanda Shafer
    Amanda Shafer avatar
    198 posts
    Registered:
    12 Oct 2012
    16 May 2014
    Link to this post

    Ivan - Thank you for that suggestion, but I'm not sure I want to disable all filters just to take care of this one particular issue. I just wish there was an easy way to apply the CSS Class to the anchor tag instead of adding a new span.

    Steve - I might just do your second suggestion. I'll show them how to do it in the code as well, but I can imagine they are going to complain about that. It's just too complex for some of our users. Thanks.

  10. Ivan D. Dimitrov
    Ivan D. Dimitrov avatar
    310 posts
    Registered:
    26 Mar 2015
    21 May 2014
    Link to this post
    Hello all,

    @Amanda,

    The easiest way you can achieve this is by either adding inline style to your anchor tags or by setting style rules for all <a> tags in your page. These methods will not produce any additional markup in the RadEditor.

    Regards,
    Ivan D. Dimitrov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
10 posts, 0 answered