What version of the framework are you using? When I try to create a duplicate of your linked example using 3.2, I get well-formed HTML.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:HBox width="100%" height="100%">
<mx:RichTextEditor id="rte" />
<mx:TextArea height="{rte.height}" width="{rte.width}" text="{rte.htmlText}" />
</mx:HBox>
</mx:Application>
My Flex 3.2 output looks like this, ugly but well-formed:
<TEXTFORMAT LEADING="2"><P ALIGN="CENTER"><FONT FACE="Verdana" SIZE="12" COLOR="#009900" LETTERSPACING="0" KERNING="1"><B>This is the way the world ends</B></FONT></P></TEXTFORMAT>
The same text in your example site gives the badly formed:
<P text-align:CENTER;><span style="font-family:Verdana; font-size:12px; color:#009900; "><strong>This is the way the world ends</strong></span>
(You might post the source for your example; you have "View source" enabled but it's not actually available.)
EDIT:
The external code you're using does the following, among other modifications:
pattern = /<\/P>/g;
str = str.replace(pattern, “”);
So that explains the missing </p>
tags.
I'm not sure what their use case was, but it appears different from what you want. If you want to clean up the default htmlText
returned by the RichTextEditor, you might consider revamping the blog code to suit your needs.