HTML Cleanup

2 posts, 1 answers
  1. Stephen
    Stephen avatar
    38 posts
    Member since:
    Mar 2008

    Posted 09 Jan 2009 Link to this post

    Does anyone know if I can get direct access to the HTML cleanup code that is used in the editor. I need to take a small portion of text blocks for a preview mode; but those blocks sometime have HTML in them and I don't have time to parse the HTML to find a safe spot to chop it. I've noticed that the editor always cleans up open or partial tags but I'm much rather do this server side or worse case do it directly in javascript instead of needed to create an editor just for this purpose.

    Thanks,
    Stephen
  2. Answer
    Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 13 Jan 2009 Link to this post

    Hello Stephen,

    RadEditor uses the browser's rich-text editing (RTE) engine, which works with HTML objects and when some tag is not well formed, i.e. the tag is not properly closed (there is only opening tag for example <DIV>) or the opening tag is missing (there is only a closing tag </DIV>), then the browser automatically correct this by closing the tag or adding the opener tag (<DIV></DIV>).

    The RTE engine is used by the editable DIV and IFRAME elements and you can achieve your scenario by pasting the content directly in an editable IFRAME or DIV elements, the browser will correct the non well formed content and you will be able to obtain it cleaned from the IFRAME and set it to your Preview mode.

    You can obtain the content of the editable iframe with the following code:

    iframe.contentWindow.document.body.innerHTML

    Best regards,
    Rumen
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top