PDA

View Full Version : Rich Text Editor customized --> Partial Rich HTML output without textformat and font


303 maddec
12-19-2007, 02:07 PM
Hi there,

Using a custom version of the Adobe Rich Text Editor, I try to obtain a simplified version of the html content.
It is a rich text editor with only features: bold, italic, underlined, paragraph alignement and list (bullets).

The rte (rich text editor) is used to let the user edit text content which is used in another part of the application.
The problem is that the rte adds automatically text format information which I needn't and which makes interferences whith the final context where this text is used (css styled).

For example: <TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0">content texttext</FONT></P></TEXTFORMAT><TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0">ss</FONT></P></TEXTFORMAT>

I would like to obtain the same content without textformat and fonts tags.

Is there a simple way of doing it?
I'm thinking about two approaches:
- using regular expressions to filter what I need in this text
- subclassing the RichTextEditor to prevent font and textformat automatic addition.

What's your piece of advice on this?

Thank you in advance for your help.

twall
01-09-2008, 08:39 PM
have you done this, I have the same problem bad results when text from the editor is e-mailed in a html email

303 maddec
01-10-2008, 08:08 AM
Hi there,

I have currently postponed the addressing of this problem. I will keep track about it here.

Sorry for that, by the way do not hesitate to post any suggestion ;)

Best regards.

seanhess
01-19-2008, 03:42 PM
put
global { leading:0 }

in your stylesheet and it will get rid of all the textformat tags. The only way to get rid of the rest is by stripping them out with regex, as far as I know.

303 maddec
03-19-2008, 04:35 PM
Hi there,

it seems that finally somebody made some further research on Regex ;)
Grant Skinner who had surely used deeply RegEx for his Spelling plus Library, provided on his blog a Regex that returns raw text from html text.
I'm sure it will be useful to somebody else:
http://www.gskinner.com/blog/archives/2008/03/parsing_tags_an.html
This one may be also related if you are wondering around this kind of problematics:
http://www.gskinner.com/blog/archives/2008/03/adding_css_supp.html

:D