I'm a newbie in Mozilla Development and I need some tips to extend the composer with a XHTML non-conform tag called <meta:element>.
The main goal is to allow user insert that tag around the HTML tag selected in the structToolbar.
To achieve this, I need to add a <menuitem> in the <popup id="structToolbarContext"> and to associate it a treatment that consists in adding a father element to the selected HTML tag.
What are the important files to look in ?
editor/ui/composer/content/editorContextMenuOverlay.xul editor/ui/composer/content/StructBarContextMenu.js
and how to easily manipulate the DOM object representing the loaded HTML document ?
Trivial. Really trivial. The editor provides anything you need to make that insertion doable/undoable/redoable.
Create a node, then insert the element highlighted in the struct toolbar in that one using GetCurrentEditor().insertNode().
See http://lxr.mozilla.org/seamonkey/source/editor/idl/nsIEditor.idl#401
You should be able to write a new XUL overlay similar to the one mentioned above and adding the menu item you want, and even encapsulate it into a downloadable XPI. That way, you don't hack to the code and build it, you only have to donwload an add-on in your Mozilla/Netscape.
Are there good references about that specific topic ?
Hmmm. About the struct toolbar, myself ?-) (nick 'glazou' on irc://irc.mozilla.org/#composer)
About overlays and XUL, www.xulplanet.com.
</Daniel>
