I implemented the YUI rich text editor and I would like to get rid of the <html>
, <body>
and DOCTYPE
tags as soon as I save the content from the editor. I know I could do this afterwards by parsing the HTML, but there must be a better solution.
Right now this is saved when I edit a text in the YUI editor:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<body>
<p>foo</p>
</body>
</html>
...but I would like to just save this:
<p>foo</p>
Any idea?
P.S.: I implemented the YUI editor using the yui_editor plugin for ruby on rails, but a YUI editor generic answer would be welcome too!