History | Edit

The Content Completion Assistant can be customized for Oxygen XML Web Author using similar methods that you would use to customize this feature in standalone distributions of Oxygen XML Editor/Author. There are several methods that you can use, including the following:

Customizing Content Completion in the Document Type Configuration Dialog Box

You can use the Document Type configuration dialog box to specify which elements or actions should be proposed in the Content Completion Assistant. To use this method, follow this procedure:
  1. Open the Preferences dialog box (Options > Preferences) and go to Document Type Associations.
  2. Select your document type and click the Extend button. For more information about extending a framework, see Extending and Sharing a Framework (Document Type).
  3. Go to the Author tab and Content Completion subtab. In this subtab, you can specify:
    • Elements to remove from the proposals listed in the Content Completion Assistant.
    • Actions to be added to the proposals listed in the Content Completion Assistant.

Customizing Content Completion Using a Configuration File

You can use a cc_config.xml configuration file that is specific to each document type (framework) to configure the values that are proposed in certain contexts, to customize the attributes or elements that are proposed, or to customize how certain aspects of the proposals are rendered in the interface.

Changing the Keyboard Shortcut for Invoking the Content Completion Assistant

By default, the Content Completion Assistant is invoked automatically when you press Enter. For non-technical users, it may be helpful to disable this feature and use the default behavior of typical word processors where pressing Enter will insert a new paragraph. This can be achieved by using the following code in a plugin or a framework:
// If 'splitOnEnter' url parameter is set to 'true',
//    the split is executed automatically when pressing 'Enter'. 
// In this case the content completion window can be accessed
//    when pressing 'CTRL + Enter'.
   
(function() {
 var splitOnEnter =  decodeURIComponent(sync.util.getURLParameter("splitOnEnter"));
 if (splitOnEnter === 'true') {
   goog.events.listen(workspace, sync.api.Workspace.EventType.EDITOR_LOADED, function(e) {
    var actionsManager = e.editor.getActionsManager();
    
// Change the shortcut of "Enter" action to ctrl enter
actionsManager.setActionShortcut('Author/Enter', 'ctrl enter');
   
// Create "Split Element" action
var splitElementAction = new sync.actions.SplitElementAtCaretAction
                         ('enter', e.editor.readOnlyStatus, e.editor.controller);

// Create compound action that splits the element at cursor when
//    there is no selection, and surrounds the selection.

// with the element chosen by the user otherwise
var newEnterAction = new sync.actions.CompoundAction('enter',
      splitElementAction, actionsManager.getActionById('Author/SurroundWithElement'));

// Register the new action to be executed on enter
      actionsManager.registerAction('Author/SplitOnEnter', newEnterAction);
    });

/**
 * Action that splits the element at caret.
 *
 * @param {sync.model.ReadOnlyStatus} readOnlyStatus The read-only status of the file.
 * @param {string} keystrokeStr The string representation of the shortcut of the action.
 * @param {sync.ctrl.Controller} controller The document controller.
 * @constructor
 */
sync.actions.SplitElementAtCaretAction = function(keystroke, readOnlyStatus, controller) {
sync.actions.AbstractAction.call(this, keystroke);
   this.readOnlyStatus = readOnlyStatus;
   this.controller = controller;
  };
goog.inherits(sync.actions.SplitElementAtCaretAction, sync.actions.AbstractAction);

/**
 * The actual action execution.
 *
 * @param {function} callback The method to call after the action has completed.
 */
sync.actions.SplitElementAtCaretAction.prototype.actionPerformed = function(opt_callback){
  var params = { docId: this.controller.docId };
  sync.select.getSelection().extend(params);
  var controller = this.controller;
  RESTContentCompletionManager.splitElement(sync.util.extend(params, {
    $callback: function (httpCode, xmlHttpRequest, newDocumentUpdate) {
      try {
        controller.applyUpdate_(newDocumentUpdate);
      } finally {
        if (typeof opt_callback === 'function') {
         opt_callback();
       }
     }
   }
 }));
};

/** @override */
 sync.actions.SplitElementAtCaretAction.prototype.isEnabled = function() {
   return !this.readOnlyStatus.isReadOnly();
 };
}
})();