Stop editor from focing valid HTML

6 posts, 0 answers
  1. Kevin Warnke
    Kevin Warnke avatar
    98 posts
    Member since:
    Dec 2005

    Posted 15 Mar 2010 Link to this post

    If I edit the HTML directly in the editor and intentially leave it invalid the editor automatically completes things.  Can I turn this [usually great] feature OFF?

    Thanks,
    Kevin
  2. robertw102
    robertw102 avatar
    265 posts
    Member since:
    Jul 2007

    Posted 15 Mar 2010 Link to this post

    I believe removing the ConvertToXhtml from the ContentFilters of the RadEditor should do the trick.

    I hope that helps.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kevin Warnke
    Kevin Warnke avatar
    98 posts
    Member since:
    Dec 2005

    Posted 15 Mar 2010 Link to this post

    Any example of how to remove that filter?  I've never done that before.

    Thanks!
    Kevin
  5. Lini
    Admin
    Lini avatar
    2144 posts

    Posted 16 Mar 2010 Link to this post

    Hi Kevin,

    You can disable specific filters from the code. For example:

    protected void Page_Load(object sender, EventArgs e)
    {
        RadEditor1.DisableFilter(EditorFilters.ConvertToXhtml);
    }

    Unfortunately, some of the "bad" HTML is corrected by the browser engine even before it gets to the editor filters and there is nothing you can do about it. For example, if you forget to close a <div> tag, it will be closed regardless of what filters you have enabled in the editor. Each browser has its own HTML engine but they all share the "auto-correcting" feature for invalid content.

    If you need to change the content of the editor and be sure that the changes won't be reversed, the only place you can do that is on the server, before saving the editor content:

    string content = RadEditor1.Content;
    MakeChanges(content);
    Save(content);


    All the best,
    Lini
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  6. Kevin Warnke
    Kevin Warnke avatar
    98 posts
    Member since:
    Dec 2005

    Posted 16 Mar 2010 Link to this post

    So it sounds like what I am after is not possible then.

    I want to be able to put in "<table><tr><td>" but it gets converted to an entire table definition.

    I'm not sure how this is a "browser" thing given that if I were to use a textarea this would work fine.

    Are you sure this is tied to the browser???  And not something the editor is causing to occur?

    Thanks,
    Kevin
  7. Rumen
    Admin
    Rumen avatar
    12846 posts

    Posted 16 Mar 2010 Link to this post

    Hello Kevin,

    The content area of RadEditor is an editable IFRAME which uses the Rich Text Editing engine of the browser in which it operates. Every tag is a node in the DOM and it should have an opening and closing tag, in other case the content will be invalid HTML. The browser Rich Text Editing engine checks for unclosed and non well formed tags and corrects them. You can check my words by testing the attached HTML page with an editable IFRAME element in it. You will reproduce the same behavior with an editable DIV element as well as with our competitors' editors.

    The content inside a textbox is just a plain text string and it is not correct to compare a standard textarea with an editable div / iframe elements, which are used to edit HTML content.

    Kind regards,
    Rumen
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017