Edit online

It is possible to configure the Content Completion Assistant to insert a certain XML structure instead of an element. For example, suppose that whenever a DITA <change-completed> element is inserted with the Content Completion Assistant, you want the current date to be inserted as the text content of the <change-completed> element.

This can be achieved by defining a custom Author mode action in your custom framework:
  1. In Oxygen XML Editor/Author, go to Options > Preferences > Document Type Association and edit the document type configuration for your framework.
  2. Go to the Author tab, then the Actions subtab, and click the New button.
  3. Define the custom action and include the following details:
    • For Operation, choose ro.sync.ecss.extensions.commons.operations.InsertFragmentOperation. For information about the InsertFragmentOperation, see https://www.oxygenxml.com/doc/ug-editor/topics/dg-author-op-InsertFragmentOperation-arguments.html.
    • In the Arguments table, double-click fragment and for its value, enter <change-completed>${date('YYYY-MM-DD')}</change-completed>.
      Note: When the schemaAware argument is set to true and the user tries to execute the action in a position where the change-completed element is not valid, Oxygen XML Web Author will try to insert the fragment in a nearby position or insert additional ancestor elements to make the document valid.
  4. Go to the Content Completion subtab and add the action to the content completion menu:
    1. In the Available actions section, select your custom action and use the Add as sibling button to add it as a sibling of the currently selected action in the Current actions section, or use the Add as child button to add it as a child of the currently selected action in the Current actions section.
    2. Use the Replacement for section to specify an element to be replaced by the configured action.
    Note: If the action is implemented in JavaScript, you will need to also create a dummy action with the same ID in the framework and insert it in the content completion menu. The dummy action should have an operation but it is not important which one.
  5. Save the changes to your custom framework.
  6. Create an archive that only contains your custom framework folder and upload your framework to Web Author.
Tip: Another possibility to achieve this specific example is to use a custom form control when the <change-completed> element is empty.