I left the ability to type in your own bbcode intact for a couple of reasons:
- If a user has never seen that the site uses BBCode then when they go to a machine without Javascript enabled they will be faced with a white box and no hope to format.
- My friend always moans when I take away his ability to write the code himeslf
So the problem then became "How do you un-obtrusively add a preview of the content without having the developer modify loads of files?"
My Solution to this was to have a generator make a tbbce_controller with an index.js.erb view.
When the user presses the preview button the contents of the text area is sent to this view. This view then parses the bbcode and places the output into the div that holds the preview.
My Blog