Tuesday, October 11, 2011

Blogger WYSIWYG editor - A bit of complaints

As some might have noticed, I blogged a little lately. And found some problems with the editor for blogger. Maybe I should go write a wrapper for the editor.

To the actual problem.

How on earth do you expect me to respect an editor for HTML that instead of treating a double line break as a new paragraph just makes another line break. HTML has fine markup to make things just a bit semantic, why ruin them?
The editor start by inserting a div-element, fine enough, but no paragraph element. And where did headings go? I can chose between 5 different text sizes, and yes you guessed correct, it doesn't use the heading-tags.
Another thing I noticed, while writing this post, when putting angle-brackets into the editor, while in compose-view, switching to HTML-view, and back again, it converted my angle-brackets to real html code instead of maintining the brackets as < and > that made me sad, said another way, the composer, doesn't convert characters to HTML-entities, if needed.

My solution:

As a good person, instead of just rambling about how things are wrong. I hereby suggest some improvements, that I believe will be enough.

When pressing the enter button, a line break(<br />) should be inserted. Then a check should occur, checking to see if the text before the cursor is a line break. If it is a line break,  then replace, the old and the new line break with paragraph-end followed by paragraph-start. This would cause the first occurence of a double line break to break HTML-validity. This is simply solved by assuming paragraphs, and the clean post would looks something like the following:

<div ...="">
<p>
|Cursor|
</p>
</div>

Furthermore, it should convert characters that needs it to their respective HTML entities, the only place, where this would cause problems is in between pre-tags, but that is a rare case, and probably could be fixed by having a boolean value expressing whether you are inside pre tags or not.

Post a Comment

Choose a month: