First of all this is a brilliant solution, finally something that makes valid code and not a mess of font and style tags, thank you! However I do have one little question.
I've successfully integrated the editor into an app I'm making. When the replaced textarea has text set (in between the textarea tags, not in the JS) everything works fine. However if nothing is set then I get a blank form (as one would expect), yet if I try and type into it I get no p tags or anything, only if I make the text bold etc does it add any p tags to my text.
Is this a bug of the code or is this intentional?
Other than this it is a truly brilliant app!