This question is locked. New answers and comments are not allowed.
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.
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
0
Accepted
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
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
Editor doesn't work when using ClientEvents
0
Hi Pieter,
Atanas Korchev
the Telerik team
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.
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
Hi Pieter,
Atanas Korchev
the Telerik team
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.