Customizing the Web Author User Interface
It is possible to customize the Oxygen XML Web Author user interface (including the side views, toolbars, contextual menu actions, and theme).
Customizing the Toolbar and Contextual Menu Actions
The Oxygen XML Web Author toolbar and contextual menu structure includes standard actions (such as Undo, Redo, Cut, etc.) as well as actions that are dictated by the framework configuration.
- Document Type Configuration in Oxygen XML Editor/Author
- You can use the Document Type configuration dialog box in Oxygen XML
Editor/Author (Note: If the framework contains Author mode operations (Java implementations of the
ro.sync.ecss.extensions.api.AuthorOperation
interface), they can be enabled to be used by Oxygen XML Web Author using thero.sync.ecss.extensions.api.WebappCompatible
annotation. Author mode operations that use Java Swing components to display a graphical interface are not compatible with the Oxygen XML Web Author and they should not be annotated. If you want to prompt the user for input, you can use the ${ask} editor variable or use the JavaScript API.
). This approach is entirely GUI-based and controls only the
framework-specific configuration. You can add and remove actions, create drop-down
sub-menus, or add separators. - Web Author JavaScript API
-
You can use the Web Author JavaScript API to add custom actions or remove actions from the toolbar and contextual menu.
The advantages of using this approach include:- You can remove any action, even standard ones.
- You can remove actions from all the places where they appear in the GUI.
- You can dynamically remove actions (for example, based on the user role).
- You can add actions that have a web-based GUI.
- Some actions are added using JavaScript code in the framework. They are present in the Oxygen XML Web Author toolbar but not visible in the Document Type Configuration dialog box.
- Some actions use an
AuthorOperation
that is not compatible with Oxygen XML Web Author. They are visible in the Document Type Configuration dialog box but they are not present in the Oxygen XML Web Author toolbar. - Some actions are not compatible with Oxygen XML Web Author as in the previous case, but they are replaced with another action using JavaScript code in the framework, which is compatible. They will appear both in Oxygen XML Web Author and in the Document Type Configuration dialog box.
Customizing the Header Bar
If you embed Web Author in a web page, you may want to remove the header bar that displays
the logo, the name of the file, and the name of the author. You can hide it using the hideAppBar()
JavaScript API.
Customizing the Side Views
You can customize the side-views that appear in the editor by using the JavaScript API as described in the Customizing the Side Views tutorial.
Customizing the Theme
Although Web Author has a neutral theme, to better match the theme of your application, you
can customize it by injecting a custom CSS file using JavaScript code from a plugin. The CSS
file should also be served by your plugin using the WebappStaticResourcesFolder
extension type.
Control Change Tracking State
You can control whether or not the Change Tracking feature is enabled when a documented is opened in Oxygen XML Web Author by using a trackChanges flag set in a plugin.
- default - The status of the Change Tracking feature is determined by the server's global options.
- enabled - The Change Tracking feature is enabled but the user can disable it using the Toggle Change Tracking toolbar button.
- forced - The Change Tracking feature is enabled and the user cannot disable it. The user can reject their own changes, but cannot accept or reject changes made by others.
goog.events.listen(workspace, sync.api.Workspace.EventType.BEFORE_EDITOR_LOADED, function(e) { if(forced_track_changes_condition) { e.options.trackChanges = 'forced'; } else if(track_changes_enabled_condition) { e.options.trackChanges = 'enabled'; } else if(track_changes_default_condition) { e.options.trackChanges = 'enabled'; } });
Changing the Change Tracking State Programmatically
// Assuming you have an 'editor' variable of type sync.api.Editor var editingSupport = editor.getEditingSupport(); if (editingSupport.getType() === sync.api.Editor.EditorTypes.AUTHOR) { var manager = editingSupport.getChangeTrackingManager(); if (!manager.isTrackingChanges()) { var am = editingSupport.getActionsManager(); am.getActionById("Author/TrackChanges").actionPerformed(function(){ am.refreshActionsStatus("Author/TrackChanges"); }); } }
Control the Behavior of the Enter Key
You can control the behavior of the Enter key. Normally the Enter key opens the content completion list, but you can set an option to make the Enter key work similar to the behavior in a normal word processor. The user can still open the content completion list by pressing CTRL+Enter.
- The Show content completion list when pressing Enter option in the General tab of the Administration page.
-
Set the ccOnEnter property in a plugin (using the LoadingOptions type definition from the Workspace API).
Possible values for the ccOnEnter property:- true - When the user presses the Enter key, the content completion list will be displayed.
- false - When the user presses the Enter key, it will work similar to the behavior in a normal word processor. For example, a new paragraph will be inserted, or the element will be spilt, or the same element will be inserted.
You can set this property in your plugin's JavaScript code like this:
goog.events.listen(workspace,
sync.api.Workspace.EventType.BEFORE_EDITOR_LOADED, function(e) {
if(non-technical-user) {
e.options.ccOnEnter = 'false';
}
});
Hiding the Breadcrumb
The main editing pane includes a breadcrumb stripe at the bottom of the pane that shows the hierarchical XML structure of the current document. It is a helpful tool for users that want to be able to visualize or navigate the XML element structure within a document. If your users do not have a need for this breadcrumb, it is possible to hide it in the interface.
To hide the breadcrumb, set the hideBreadcrumb property in a plugin (using the LoadingOptions type definition from the Workspace API).
- false - The breadcrumb is visible in the interface.
- true - The breadcrumb is not displayed in the interface.
goog.events.listen(workspace,
sync.api.Workspace.EventType.BEFORE_EDITOR_LOADED, function(e) {
e.options.hideBreadcrumb = 'true';
});
Controlling the Behavior of Drag/Drop Operations
By default, dragging a valid URL string and dropping it into the editor in Oxygen XML Web Author will automatically insert it as a link element for the particular
document type you are working with. For example, in DITA it would insert an
xref
element.
If an HTML element that represents a file from a side-view or a CMS window is dragged, you can make Oxygen XML Web Author insert links to that file when the element is dropped in the editor. This can be done by writing JavaScript code that lets Oxygen XML Web Author know that the dropped element represents a reference to a file.
dragstart
event for the type of items
that can be dragged. On the handler for the dragstart
event, you can set the
application/oxy-reference custom type to the event's dataTransfer
object.The value of this custom type needs to be a string before being added to
dataTransfer
.
- type - The reference type to insert.
- url - The OXY-URL that the reference points to.
dragstart
event handler should look
like
this:// type needs to be set to 'text' for IE only. var type = 'application/oxy-reference'; e.dataTransfer.setData(type, JSON.stringify({ url: 'http://example_url.com', type: 'xml_reference' }));
To customize what element gets inserted when a link is dropped, one can use the
ro.sync.ecss.extensions.api.AuthorExternalObjectInsertionHandler
Java
API.