Customizing the Content Completion Assistant
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
- Open the Preferences dialog box and go to Document Type Associations.
- Select your document type and click the Extend button.
- 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.Note: To add an action that is implemented in JavaScript, you need to define a stub action with the same ID in the Actions subtab and add it in the Content Completion subtab.The stub action will be automatically registered in the JavaScript code in the
sync.api.ActionsManager
object with the ID you specified. Make sure that when your JavaScript action implementation is registered in thesync.api.ActionsManager
, it overwrites the stub action. A sample code to do this:goog.events.listen(editor, sync.api.Editor.EventTypes.ACTIONS_LOADED, function(e) { if (actionsManager.getActionById('my_id') != null) { actionsManager.registerAction('my_id', new MyCustomAction()); } }); ...
- Create an archive that only contains your custom framework folder and upload the changes to your framework to Web Author.
Customizing Content Completion Using a Configuration File
- To configure the possible elements or attributes that are proposed in the Content Completion Assistant, see Configuring the Proposals for Elements and Attributes.
- To configure the possible values for attributes or elements that are proposed in the Content Completion Assistant, see Configuring the Proposals for Attribute and Element Values.
- To configure how the elements are rendered in the Content Completion Assistant, see Customizing the Rendering of Elements.
Customizing the Elements Order in the Content Completion Assistant
You can customize the order of the elements presented by the Content Completion Assistant by increasing their priority values. To do this, you should implement the methods exposed in the ContentCompletionSortPriorityAssigner API.
Filtering Content Completion Assistant Entries using JavaScript
You can remove entries from the Content Completion Assistant using JavaScript
by adding them to the filterCCItems
list of the
sync.api.Editor.ActionsLoadedEvent
. The initial content of the
filterCCItems
list is composed of entries configured in the Document Type Configuration dialog
box.
abbreviated-form
DITA
element:goog.events.listen(workspace, sync.api.Workspace.EventType.EDITOR_LOADED, function(e) {
var editor = e.editor;
goog.events.listen(editor, sync.api.Editor.EventTypes.ACTIONS_LOADED, function(e) {
if (e.actionsConfiguration.filterCCItems) {
e.actionsConfiguration.filterCCItems.push('abbreviated-form');
}
});
});
Customizing the Behavior for Invalid Elements
When an invalid element is selected in the content completion list, Oxygen XML Web Author tries to apply some strategies to keep the document valid after inserting the element.
One of these strategies is to split the element's ancestors and insert the element in the
newly created position. To avoid splitting an element, you can remove the <SPLIT>
element
entry from the content completion configuration dialog box. For
example, in the DITA framework, the table
element is configured so that it
is never split to accommodate invalid elements.
Another strategy is to insert required ancestors of the element to make the document valid.
However, sometimes there are multiple valid ways to choose the ancestors. To control this
choice, you can implement the ro.sync.ecss.extensions.api.AuthorSchemaAwareEditingHandlerAdapter.getAncestorDetectionOptions()
API.
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. For information about how to achieve this, see Control the Behavior of the Enter Key.