DITA Storm browser-based DITA XML Editor
by Inmedius Inc.
 

Customizing the Editor

DITA Storm provides a number of extension points that allow to plug into editor functionality. Extensions get registered with a JavaScript call before the instance of editor gets rendered. You can do it by calling

ditaStorm.registerExtension(...)
method and providing necessary parameters. Depending on type of extension parameters could be different. See description of particular extension point for parameter details.

Facilitating Conref/Href Lookup

You can extend the editor by defining custom action executed when user edits href/conref attributes and clicks related browse button.

This can be achived by registering 'ditastorm.conref' extension.
Tip: To see how it might look if implemented for local files visit Online Editor section.
You would need to provide JavaScript method that would be called when the corresponded button is clicked. This method should accept one parameter - a reference to property form control which value should be set as a result (HRef on the picture above). Here is the sample code:
<SCRIPT>
  function onBrowse(control)
  {
    var hrefValue = ...; // lookup the value
    control.value = hrefValue; // assign value back to the form
  }
</SCRIPT>
...
<SCRIPT>
  ditaStorm.registerExtension('ditastorm.conref',onBrowse);
  ditaStorm.render(...);
</SCRIPT>

Please remember, as with all extensions your function will be executed in the context of the DITA Storm frame, not in the page context. There is no way to avoid it. For this reason if you want to refer to external resources (such as when opening a popup window or loading data from server), you would need to either provide URL related to DITA Storm location or use utility method that would automatically calculate absolute URL:

ditaStorm.getAbsoluteUrl(<base_url>,<relative_url>)
for example
ditaStorm.getAbsoluteUrl(
    window.location.href,'../../editMyConref.php');

top
Copyright © 2007
Inmedius Inc.