This is a migrated thread and some comments may be shown as answers.

Problem with invalid pasted HTML

3 Answers 37 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Gavin
Top achievements
Rank 1
Gavin asked on 21 Apr 2015, 02:03 AM

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.

3 Answers, 1 is accepted

Sort by
0
Ianko
Telerik team
answered on 23 Apr 2015, 06:50 AM
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.

 
0
Gavin
Top achievements
Rank 1
answered on 23 Apr 2015, 06:55 AM

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.

0
Ianko
Telerik team
answered on 24 Apr 2015, 06:09 AM
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.

 
Tags
Editor
Asked by
Gavin
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Gavin
Top achievements
Rank 1
Share this question
or