In my current application I have created a custom BBCode editor - I use a number of BBCode extensions and have other integration requirements that make it imperative that I use my own editor rahter than an off-the-shelf one.
Creating this, ensuring that the generated BBCode is always valid, gets translated to good HTML etc was a great deal of work but I am very pleased with the results. However... as things stand I am obliging the end user to view and edit BBCode. It would be nicer to have WYSIWYG. I note that SCEditor has a WYSIWYG interface. Looking under the covers with Chrome's excellent debugger I noted the following
- The original text area is hidden
- A div containing an iframe is inserted
- The document in the iframe contains a contenteditable div and a hidden textarea control
I could continue my explorations and figure out just how all of this is done. However, I am hoping that someone here might be able to give me a few pointers on what is required here. I imagine that the entered BBCode is somehow "diverted" into the hidden textarea, gets parsed to HTML on the fly and the results are shown in the content-editable div or something along those lines? There would also be the issue of correctly dealing with mouse clicks and selections.