Mangling TinyMCE (again)

Published on 15 March 2007

I thought I was done with tinyMCE when I ditched it from Flock's code months ago. But I've just installed a Wordpress blog for my dear, and she's having some problems with TinyMCE - the default editor for Wordpress. When she writes in Japanese, she makes paragraphs of one sentence per line. So she separates each line with a <br> tag, then either wrap each paragraph in <p> tags or add an extra <br/> to mark paragraphs (doesn't matter). But TinyMCE is trying to be smart, WYSIWYG and to create XHTML code meant to be read by a human. It's creating <p> everywhere, forget the good old <br>. I usually get into trolls with hardcore bloggers when I say that we should just put <br/> tags if the user want WYSIWYG. One <br> tag for line break, two for a paragraph break, and here we go! Intensive, advanced bloggers usually want a <p> tag because (1) visually it looks slightly different from two <br/> tags and (2) for some religious reason they think <br/> tags are ugly. But many bloggers don't care about HTML and just want something easy: one press of "enter" inserts a line break, and they just put two if they want to separate paragraph. They would even not complain is the generated code is tag soup, but let's generate valid XHTML anyway :). Flock is working exactly the way I want (guess why) and from Cormorant, I think it will also content people who were fighting with me in this highly controversial subject (thank you to Stéphanie, who gave me insights to get to this solution when she was in Flock HQ). So here is how I'm doing in Flock now (Cormorant), it's very simple:
  • In the blog editor, you're working with line breaks. It's not <br> tags, not <p> tags, but good old \p like in text files.
  • The code is sent to the server "as it", with line breaks
And the server will convert to whatever it wants! Wordpress, for example, replaces double line breaks by paragraph breaks (close a <p> and open an other one) and simple line breaks by <br/> tags. Back to my wife's problem... I fixed TinyMCE's behavior by editing the configuration from a javascript file. I think it's working fine now, but I'm not very sure. We'll see.

Blogged with Flock

TAGS: Misc