6
votes

I've currently got TinyMCE incorporated into the backend editor of a simple blogging/page-editing app, but I'm extremely unhappy with the HTML code it creates. It does all sorts of messy things like:

  • Adding inline style information to span tags that you can't ever find to get rid of without editing the HTML directly.
  • Nesting tags in nonsense ways (e.g. <p><strong><p><span>some text</span></p><strong></p> just to make something bold.)
  • Adding empty <p>&nbsp;</p> lines where they don't belong and I'm not trying to create blank lines.

EDIT: I've looked at lists of the other editors out there (including on SO), but I want to know if people firsthand have had better luck getting clean code out of their wysiwyg editors.

Any recommendations for one that outputs better code behind the scenes?

3
There are lots of posts about this. Search SO for wysiwyg or tinymce or fckeditorJohn Sheehan

3 Answers

4
votes

How about a rather drastic alternative, and using a WYMIWYG (What You Mean is What You Get) editor rather that another WYSIWYG editor. That way the author is in full control of the schematic markup as well as the content he/she is entering.

Unfortunately I haven't found one that is as feature rich and usable as tinyMCE, but it seems to have come a long way - see http://www.wymeditor.org/demo/

2
votes

Use HTML purifier before saving the content into the database.

HTML Purifier

1
votes

I found JoomlaFCK to be a very good alternative to Tiny MCE. Hope you like it. bye

BTW I know it is an old thread but someone might use it. ;)