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

[Solved] Invalid HTML after copy from Outlook email

6 Answers 124 Views
Editor
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Pieter
Top achievements
Rank 1
Pieter asked on 28 Sep 2011, 03:01 PM
A user copy-n-pasted the contents from an Outlook email to the editor and saved the result. The text was correctly saved to our database, but upon showing the contents again, it messed up the entire page.
It turned out that the HTML saved to the database was invalid and contained even some partial tags and only part of an HTML-table, e.g. we found "<img src='foo" and that was all (so no closing "/>").

Is it possible to sanitize the HTML before saving it to the database? The radeditor has some support for this, but I cannot find this for the MVC-editor.

6 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Tunev
Telerik team
answered on 03 Oct 2011, 12:57 PM
Hi Pieter,

You could use the OnPaste event and strip the unwanted content. The event argument provide the raw HTML so you can manipulate it before adding it in the content area.


 Regards,
Georgi Tunev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Pieter
Top achievements
Rank 1
answered on 17 Oct 2011, 08:34 AM
Georgi, I'm trying to do that now, but something is going wrong. I've posted a new question describing my problem:
Editor doesn't work when using ClientEvents
0
Atanas Korchev
Telerik team
answered on 17 Oct 2011, 08:46 AM
Hi Pieter,

Is the JavaScript function which handles the client-side event defined at all? If it is not the editor will trigger a JavaScript error when it tries to call it.

If you still have trouble you can check our client-side events example which shows how to subscribe to editor events.

All the best,
Atanas Korchev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Pieter
Top achievements
Rank 1
answered on 17 Oct 2011, 08:48 AM
Atanas, the javascript is defined on the same page and I don't get any errors. Not in my Firebug window when debugging and not in the Firefox error console.
0
Atanas Korchev
Telerik team
answered on 18 Oct 2011, 04:51 PM
Hi Pieter,

 We are out of ideas then. Does the client-events demo work at your side? It shows how to subscribe to editor events. Is there a chance to provide a sample project which shows the problem you are facing?

Kind regards,
Atanas Korchev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Pieter
Top achievements
Rank 1
answered on 19 Oct 2011, 02:38 PM
Digging a bit deeper, it turned out the editor was working fine. There was a problem in the function which strips the HTML which caused the editor to not work as expected.
Tags
Editor
Asked by
Pieter
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Pieter
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or