Beverley, I'll post as I have updates. Glad to see this might help others as well.
Bernie, thanks for the links. I will be using primarily Javascript for this, then of course sending it to the PHP to do other things there (actually, mostly the same things). So I'll need to have a JS and a PHP version of my code. I can work out the PHP, so now I actually am trying to figure out the Javascript.
Some updates on what I've learned:
1. Using code like below, we can actually just utilize the browser's built in editing functions. It's almost no work at all and very simple Javascript (see the video tutorial in my first post):
Code:
richTextField.document.designMode = 'On'; //turn on design mode for the page, allow editing
richTextField.document.execCommand('bold',false,null); //make the active text bold
That's it-- then you can type and so forth, which is what I was originally trying to figure out.
2. This unfortunately generates whatever HTML the browser likes. For example, firefox seems to use <font> tags to color text if you set the color. More than that, I don't want HTML; I want bbcode. This means I'll need to actually split the system and somehow work with bbcode and html at the same time.
3. http://wysiwygbbcode.codeplex.com/
This is a great example of a "bbcode wysiwyg editor"-- that is, it uses the same approach as the others, but it then translates between bbcode and html as it goes.
4. For my personal requirements, I'd rather not do a translation function-- at least not as it is there. It just translates from html to bbcode and that's how it generates the bbcode. I'd prefer that the bbcode is the default. (I also have my own custom bbcode for this project, so I'll need to work that out.)
That's where I am at the moment. I'll post again when I have an update!
Bernie, the first link you posted is helpful and is almost what I want-- it uses (customizable) bbcode and then shows a preview. But what I'd love is to actually use the preview as the input, such as allowing typing. That's where I'm a little less certain. Somehow I think I'll get there.
Unfortunately the website for it appears to be down at the moment, but I'll check again later: http://wmd-editor.com/
Bookmarks