XUL editor Tag, or: Performing Moz Voodoo
Ok, so you’ve got your editor tag in XUL, looks nice, works ok. How do you get the data out?
Well, it’s INCREDIBLY simple, and hard as hell to find. I’m posting this so there’s at least 1 more place to find it.
So I’ve got this:
<pre>
<editor src="about:blank" id="testeditor" editortype="html" type="content-primary" flex="6" />
<button label="Edit" oncommand="document.getElementById('testeditor').makeEditable('html',false);"/>
<button label="Source" oncommand="alert(document.getElementById('testeditor').contentWindow.document.body.innerHTML)/>
<button label="Bold" oncommand="document.getElementById('testeditor').contentWindow.document.execCommand('Bold', false, null);"/>
</pre>
What a fun hour and a half it took me to figure that out! Argh.
Enjoy!
Want to see more on this magic? Check out the very cool online demo.
Schweet.
Comments
Comment from Rich Dougherty
Time: September 23, 2006, 11:34 pm
Hi - Thanks for putting this together. Just letting you know that you need to close the quotes for the source button’s oncommand attribute.

Write a comment