Jump to content


How I could create a WYSIWYG editor that produces the same code on various browsers


  • You cannot reply to this topic
No replies to this topic

#1 Sanva

    Young Padawan

  • Members
  • Pip
  • 15 posts

Posted 05 March 2008 - 05:48 AM

I want to create a WYSIWYG editor for a personal project (and to know how to create it, because it could be a good idea to implement it in a professional project in the future).

I'm using the typical method that consists of an iframe whit designMode='on', but I have an issue: Each browser creates different code.

For example, if you starts to write whit no previous text in the field, Firefox writes plain text but adding a "<br />" instead of newlines. However, if you are in a previously created paragraph and you press Intro, Firefox will create a new paragraph (a new set of <p> and </p> wrapping the new line). IE and Opera will do the same, but also whit a field contains no text you'll obtain a paragraph to each line. But IE and Opera will create the HTML tags in upper-case.

You can see all of this in http://spaweditor.com/en/disp.php/en...w/en_spaw_demo, for example, swapping design and source modes.

I hope you understand me. The differences between browsers will make necessary an extra work (a part of the security checks) in the server to formatting the text, because I want the same code irrespective of the user's browser.

Well, I've been looking for editors and I found one that is diferent: FCKEditor. I think this editor is really good because it creates the same code in IE and Firefox. You can see it in action in http://www.fckeditor.net/demo. Writing whit no text in the field it creates paragraphs (even using Firefox), and it creates HTML tags in lower-case (even using IE).

And this is the moment to request for your help, because even the project is Open Source, I have not the necessary level in JavaScript to look for in the code for that functionality, because the project is too big.

Any idea about how I could implement this behaviour?

Best wishes, thanks for your time and sorry about my poor English.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users