Class: Editor

sync.api.Editor

new Editor()

A visual editor for an XML document.
Source:

Extends

  • goog.events.EventTarget

Classes

ActionsLoadedEvent
DirtyStatusChangedEvent
LinkOpenedEvent
WebappMessageReceived

Members

(static) EditorTypes :string

Event types generated by this editor.
Type:
  • string
Properties:
Name Type Description
AUTHOR string The editor is of type author.
XML string The editor is of type XML.
MARKDOWN string The editor is of type markdown.
TEXT string The editor is of type text.
IMAGE string The editor is of type text.
Source:

(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.
See sync.api.Editor.LinkOpenedEvent for more details.
CUSTOM_MESSAGE_RECEIVED string Generated when an WebappMessage whose type is not handled by the webapp itself was reported on the server-side.
See sync.api.Editor.WebappMessageReceived for more details.
ACTIONS_LOADED string Generated when some editor-related actions were loaded.
See sync.api.Editor.ActionsLoadedEvent for more details.
DIRTY_STATUS_CHANGED string Generated the editor changes its dirty status.
See sync.api.Editor.DirtyStatusChangedEvent for more details.
Source:

getContent

Retrieves the content of the document asynchronously.
Source:

getEditorType

Source:

getReadOnlyState

Source:

setReadOnlyState

Sets the editor as read-only.
Source:

setReadOnlyStripeRenderer

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

getEditingSupport() → {sync.support.EditingSupport|*}

Source:
Returns:
Type
sync.support.EditingSupport | *

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 editor is marked as dirty.
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:

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: