Customising the Editor using Loading Options

You can toggle certain editor features on or off or customise them using loading options.

Using loading options, you can control things such as:

  • title - The title of the document. If not specified, it is inferred from the URL.
  • userName - The name of the user who will edit the document. It is used as the author for comments and displayed in the top-right corner. If not specified, it is inferred from the author URL variable.
  • content - The content of the document. If not specified, the server will load the content from the given URL.
  • ccOnEnter - A flag that controls whether or not the content completion list is presented when the user presses 'Enter', etc.

You can find all the available loading options here: sync.api.Workspace.LoadingOptions.

To set the loading option values, you can listen for the sync.api.Workspace.BeforeEditorOpenedEvent event:

workspace.listen(sync.api.Workspace.EventType.BEFORE_EDITOR_LOADED, function(e) {
  // e is of type sync.api.Workspace.BeforeEditorOpenedEvent
  e.options.expandTopicRefs = true;
});