Inserting text into Firefox rich text editor
I'm trying to build a light-weight rich text editor that works in Firefox. So far so good, as I have the usual bold, URL, image, etc., stuff working. Where I'm stuck is inserting text. For example, if you want to insert "forum tags" for quotes, which we don't put in as HTML, how is that done? In IE, you can do it like this...
var box = document.getElementById(ctrl).contentWindow;
box.document.designMode = "on";
...
function makeQuote(cmd)
{
var edittext = box.document.selection.createRange();
var original = edittext.htmlText;
edittext.pasteHTML('['+cmd+']'+original+'[/'+cmd+']');
So in this case, selecting text in the editor then triggering the event would yield something like:
[quote]this is a quote[/quote]
How is this done in Firefox?