Problem with invalid pasted HTML

4 posts, 0 answers
  1. Gavin
    Gavin avatar
    31 posts
    Member since:
    Sep 2012

    Posted 20 Apr 2015 Link to this post

    Hi,

    I have an issue with users pasting invalid HTML into the editor (usually from an email client).  The HTML comes in with no closing tags, which then causes issues when we render the saved content onto a web page.

    Example

    <span style>some text<span style>more text <span style> some more text

    Is there any way to either strip the invalid tags out or add the closing tags when the user pastes the data?

    Thanks

    Gavin.

  2. Ianko
    Admin
    Ianko avatar
    1535 posts

    Posted 23 Apr 2015 Link to this post

    Hello Gavin,

    You can create your own custom content filter that strips the undesired HTML content. This demo—http://demos.telerik.com/aspnet-ajax/editor/examples/contentfilters/defaultcs.aspx—showcases how to implement one.

    Regards,
    Ianko
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Gavin
    Gavin avatar
    31 posts
    Member since:
    Sep 2012

    Posted 23 Apr 2015 in reply to Ianko Link to this post

    Hi Ianko,

    We don't give the option to see the HTML, only design view.  Can you do this on paste?

    I was hoping that there was some was of validating or repairing when the data is added.

     

    Cheers

    Gavin.

  5. Ianko
    Admin
    Ianko avatar
    1535 posts

    Posted 24 Apr 2015 Link to this post

    Hi Gavin,

    The content filters also execute on submit, therefore, you can  use them even if the HTML mode is not enabled.

    However, you can interact with the pasting by handling the OnClientPasteHtml event.

    Regards,
    Ianko
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
Back to Top