Edit online

Handling When URLs or XHTML Fragments are Dropped or Pasted in Author Mode

The AuthorExternalObjectInsertionHandler extension can be used to configure how URLs or XHTML fragments from external applications are handled when they are dropped or pasted in Author mode.

How to Implement an AuthorExternalObjectInsertionHandler

To implement your own AuthorExternalObjectInsertionHandler, follow this procedure:
  1. Implement the ro.sync.ecss.extensions.api.AuthorExternalObjectInsertionHandler interface.
  2. To instruct Oxygen XML Author Eclipse plugin to use this newly created implementation, use either of the following methods:
    1. If your framework is an extension of DITA, DocBook, TEI, or XHTML, you can specify the AuthorExternalObjectInsertionHandler in the Author extern object Insertion handler individual extension in the Extensions tab of the Document Type configuration dialog box for your particular document type.
    2. Otherwise, you can configure an extensions bundle, then return the AuthorExternalObjectInsertionHandler implementation using the ro.sync.ecss.extensions.api.ExtensionsBundle.createAuthorExternalObjectInsertionHandler() method.
  3. You can use a stylesheet to convert the pasted XHTML to your own XML vocabulary by overwriting the following method:

    ro.sync.ecss.extensions.api.AuthorExternalObjectInsertionHandler.getImporterStylesheetFileName(AuthorAccess)

    and return the file name of the stylesheet that will be applied. The path to the importer stylesheet must also be added in the Classpath tab in the Document Type configuration dialog box for your particular document type.

Example

The following example illustrates an implementation for the DITA framework:
  /**
   * @see ro.sync.ecss.extensions.api.ExtensionsBundle#
createExternalObjectInsertionHandler()
   */
  @Override
  public AuthorExternalObjectInsertionHandler createExternalObjectInsertionHandler() {
    return new DITAExternalObjectInsertionHandler();
  }
  /**
   * @see ro.sync.ecss.extensions.api.AuthorExternalObjectInsertionHandler#
getImporterStylesheetFileName(ro.sync.ecss.extensions.api.AuthorAccess)
   */
  @Override
  protected String getImporterStylesheetFileName(AuthorAccess authorAccess) {
    return "xhtml2ditaDriver.xsl";
  }
Tip: For XHTML fragments, there is another method that you could use to configure how they are handled when they are pasted in Author mode. For more information, see Customizing Smart Paste Support.