Class: Editor

Editor

new Editor()

A visual editor for an XML document.
Source:

Classes

ActionsLoadedEvent
DirtyStatusChangedEvent
LinkOpenedEvent
WebappMessageReceived

Members

(static) EventTypes :string

Event types generated by this editor.
Type:
  • string
Properties:
Name Type Description
LINK_OPENED string Generated when a link is about to be opened.
CUSTOM_MESSAGE_RECEIVED string Generated when an WebappMessage whose type is not handled by the webapp itself was reported on the server-side.
ACTIONS_LOADED string Generated when some editor-related actions were loaded.
DIRTY_STATUS_CHANGED string Generated the editor changes its dirty status.
Source:

Methods

enableKeepalives(interval)

Notifies the server that the client is still alive.

When it receives the keep-alive message, the server makes sure to:

  • extend the document lifetime in memory
  • extend the license for the current user
  • keep the edited documents locked (if the URLStreamHandler supports locking).
Parameters:
Name Type Description
interval number The interval between two keepalive requests (in seconds).
Source:

getActionsManager() → {sync.api.ActionsManager}

Returns the actions manager for the current editor.
Source:
Returns:
the actions manager of this editor.
Type
sync.api.ActionsManager

getSelectionManager() → {sync.api.SelectionModel}

Returns the selection method of the editor.
Source:
Returns:
The selection model.
Type
sync.api.SelectionModel

getXmlContent(callback)

Retrieves the content of the XML document asynchronously.
Parameters:
Name Type Description
callback sync.api.Editor~onXmlContentReceived The callback that will be called once the XML content is retrieved.
Source:

isDirty() → {boolean}

Source:
Returns:
true if the document is read-only.
Type
boolean

load(options)

Loads an editor with the given options. Should not be called if the editor was not already loaded
Parameters:
Name Type Description
options sync.api.Workspace.LoadingOptions The options used to open the editor.
Source:

registerAttributeActionsProvider(attributeActionsProvider)

Register a provider that is used to determine a custom interface used to edit an attribute.
Parameters:
Name Type Description
attributeActionsProvider sync.actions.AttributeEditingActionsProvider The actions provider.
Source:

registerEnhancer(name, enhancer)

Registers an enhancer for a type of form controls.

This registration should be performed before the editor is loaded, so that the enhancer can be used for the initial rendering of the document.

Parameters:
Name Type Description
name string The type of the form-control, which is the fully qualified name of the Java WebappFormControlRenderer class.
enhancer function The constructor for an instance of sync.formctrls.Enhancer that will be used to enhance form controls rendered by the specified Java renderer.
Source:

setDirty(dirty)

Sets the editor status as modified or not. If the editor is modified, when the user leaves the page, we warn them that there are unsaved changes.
Parameters:
Name Type Description
dirty boolean Whether the editor should be marked as dirty or not.
Source:

Type Definitions

onXmlContentReceived(error, content)

A callback invoked when the asynchronous request for the XML content finishes. If the operation is successful, the first parameter is null and the second one is a string that represents the content. If case of an error, the first parameter is an object describing the error.
Parameters:
Name Type Description
error object The error object, or null if the request was successful.
content string The serialized XML content.
Source: