views:

42

answers:

1

Hello,

I'am currently developing a WYSIWYG editor for my CMS and got serious bugs here. After switching from IFRAME to DIV contenteditable the behavior changed dramatically.

Using execCommand('formatBlock') to create headlines causes unwanted BR tags to the source code, but only in Mozilla. I thought the reason could be < br _moz_dirty=""> but I could be wrong and did not find a way to fix it.

See demo here: http://jsfiddle.net/Kj9Rp/

A: 

Definitely a bug. I've noticed that the relatively recently added contenteditable functionality in Mozilla has a number of quirks not present with designMode. I would stick with the <iframe> and designMode for now and file a bug at Mozilla's Bugzilla.

Your other option is to write your own DOM manipulation code that surrounds selected text within an <h1> element, but that will be relatively involved to get absolutely right.

Tim Down
I gonna write my own manipulation because old IEs and Safari also seem to be buggy / unsupported.
Franky