19.8.08

xul:editor

I just stated a project creating a HTML editor using XULRunner. The trick is to make a HTML document editable - not the most difficult task, as described in Midas. To display a HTML document there are different possibilities - in a html:iframe, xul:browser or xul:editor (and I'm sure a lot of other ways). I thougth the editor element would be the obvious choice - but not at all...

It seams that there are some problems with the xul:editor element as you can see in this bug.

A solution:

Insted af using xul:editor use xul:browser


var HTMLEditor;
function initEditor(){
   HTMLEditor = document.getElementById("editor");
   HTMLEditor.contentDocument.designMode = 'on';
}
function exec(select){
   HTMLEditor.contentWindow.document.execCommand(select, false, null);
}
Post a Comment