I have a problem with contenteditable
line breaks on SAFARI/CHROME. When I press \"return\" on a contentEditable
Listening to keystrokes seems like a lot of work. Would something as simple as this be feasible:
var html = $('.content').html().replace(//gi,'
').replace(/<\/div>/gi,'');
JSFiddle demo here.
Also, it looks like sanitize.js allows a custom configuration. Have you tried adding div
as an allowed element?
Allowing HTML/CSS is dangerous, so ensure you are being extra cautious.
EDIT: Removed server side comments. Sanitising occurs at time of usage- if the client wants to bypass this locally it can be done so at their own risk. Thanks Vincent McNabb for pointing this out.