Implementing a WYSIWYG Editor in Blite
It's easy isn't it? Just copy 'n' paste some code into the sub_post.tpl template and you're done. WYSIWYG editing!
But really it's not that easy. At least for me. Essentially there's three issues...
- Markup style. I like to format my blog posts with paragraphs and CSS styling. But most WYSIWYG editors will implement logical tags like
<H1>which make no (logical) sense within a blog post, and the dreaded, deprecated
<font>tag. I have no use for either. The markup style used by an editor relates to the DOM model it implements. Simple, small editors leverage the DOM of user's browser. This is efficient but is limiting and sometimes produces different results on different browsers. Large editors like tinyMCE implement their own DOM and provide much great control and customization of the HTML & CSS output.
- Ability to customize. Simple, small editors are (relatively) easy to customize, usually by hacking the source js or by providing a stylesheet at runtime. But "hacking the source js" isn't something I expect you to do. Instead, I want to provide something that you can easily customize without delving into source code. Large editors (again, like tinyMCE) offer skins and themes and myriad opportunities for customization. But it's too much of a good thing. "Skinning" one of these big editors is a nightmare. I just want to blog, not spend a week trying to get it look right!
- Code handling. I want to be able to post raw HTML and programming code and not have it munged by a WYSIWYG editor. Stuff like
<?php echo "Hello World!"; ?>.
Put that snippet into any WYSIWYG editor and it'll get munged. Unless you use a big editor with the right plugin and get it exactly right -- Uh huh.
So what's the solution? Use a small editor and live with the crappy markup? Or a heavy editor that gets the markup right but is a bitch to customize? And what to do about that code munging issue?
Look for Blite 0.2 betas coming soon(ish)!