[Mozile] New to Mozile - attempting javascript integration
James A. Overton
james at overton.ca
Wed Nov 22 07:06:40 PST 2006
Hi Henrik,
I'm happy to help you get Mozile working with your system.
I hadn't heard of Orbeon before now. It looks like an interesting
project. I expect that it will be possible to make it work with
Mozile, although it will take a bit of work.
Mozile makes changes directly to the page using standard DOM methods.
The mozile.save module just provides some tools for cleaning up the
DOM, removing changes that Mozile has made, and returning a string
version of the content.
Yes, there is one Mozile instance for the whole page, although
multiple areas of the page may be editable.
I've looked at the /ops/ops/javascript/xhtml.js file that is loaded
in the Orberon HTMLArea demo (http://www.orbeon.com/ops/goto-example/
xforms-html-area). There are only a few mentions of FCKeditorAPI in
that file, and the trick will be to replace that functionality. You
will probably want to use your own modified version of the xhtml.js
file.
Here is what you need to do (in broad strokes):
1. Get Mozile into the page (as described in the Mozile README)
2. Load the data into the target DIV
3. Attach replacements for ORBEON.xforms.Events.focus and
ORBEON.xforms.Events.blur.
4. Tell Mozile to start editing the target DIV
For (2) you can load the data into the target DIV by using innerHTML
or an equivalent.
For (3) key is ORBEON.xforms.Events.blur, which stores the value of
the FCKEditor, like this:
var editorInstance = FCKeditorAPI.GetInstance(target.name);
target.value = editorInstance.GetXHTML();
xformsValueChanged(target, null);
You can get the "value" out of Mozile using mozile.save.getContent(),
so this should work.
target.value = mozile.save.getContent() ;
xformsValueChanged(target, null);
The other thing is that Mozile doesn't fire "focus" and "blur" events
like FCKEditor does. This isn't a hard thing to do, the question is
whether you really want to store the editor's content on blur, or at
some other time. You could create a trivial mozile.save.Module (like
mozile.dave.display) which just has these two lines, and will be run
when the user presses the "save" button.
I'm sure that doesn't answer all your questions. But it should give
you an idea of how to solve your problems, and you can ask more
specific question either here or in IRC (irc://irc.freenode.net/
#mozile).
James
More information about the Mozile
mailing list