Class: DocumentView

DocumentView()

The document view.

Constructor

new DocumentView()

Source:

Members

bindings :array

Get the bindings property of this document view: an array of Bindings currently used for the document being edited; null if no document is currently being edited.
Type:
  • array
Source:

button2PastesText :boolean

Get/Set the button2PastesText property of document view: same as XMLEditor#button2PastesText.
Type:
  • boolean
Source:

dot :Element

Get the dot property of this document view: the text node view containing dot if any; null otherwise.
Type:
  • Element
Source:

dotOffset :number

Get the dotOffset property of this document view: the character offset of dot if any; -1 otherwise.
Type:
  • number
Source:

mark :Element

Get the mark property of this document view: the text node view containing mark if any; null otherwise.
Type:
  • Element
Source:

markOffset :number

Get the markOffset property of this document view: the character offset of mark if any; -1 otherwise.
Type:
  • number
Source:

namespacePrefixes :array

Get the namespacePrefixes property of this document view: a (possibly empty) array containing namespace prefix/URI pairs; null if no document is currently being edited.

The default namespace (having an empty prefix), if any, is always the last pair of returned array.

Type:
  • array
Source:

selected :Element

Get the selected property of this document view: the selected node view if any; null otherwise.
Type:
  • Element
Source:

selected2 :Element

Get the selected2 property of this document view: the selected2 node view if any; null otherwise.
Type:
  • Element
Source:

viewContainer :Element

Get the viewContainer property of this document view: the descendant element of this document view which contains all the node views.
Type:
  • Element
Source:

xmlEditor :XMLEditor

Get/Set the xmlEditor property of document view: the XMLEditor containing this document view.
Type:
Source:

Methods

canEdit()

Tests wether this document view is editable. Returns false either because no document is currently opened or opened document is marked read-only or the peer document view configured as not editable.
Source:

ensureDotIsInside()

If needed to, adds dotdotOffsetmarksview.

Does nothing if this is not possible for specified view.

Source:

executeCommand(mode, commandName, commandParams, eventopt) → {Promise}

Tests wether specified command can be executed or actually executes specified command, whether this command is remote or local.
Parameters:
Name Type Attributes Default Description
mode number specifies how this command is to be executed.
commandName string the command name.
commandParams string parameterizes the command. May be null.
event UIEvent <optional>
null the keyboard or event which triggered this command. May be null.
Source:
See:
Returns:
A Promise containing:
  • If mode is EXECUTE_TEST, true if the command can be executed, false otherwise.
  • In the other modes, a CommandResult.
  • null if this command has not been executed or if an error of any kind occurs.
Type
Promise

getAppEventBinding()

Returns the Binding which associates the application event having specified name (e.g. "resize-image", "rescale-image") to a command. Returns null if no document is currently being edited or if there is no such binding.
Source:

getBindingForCommand()

Returns the Binding used to invoke specified command. Returns null if no document is currently being edited or if there is no such binding.
Source:

getCommand()

Return the instance of command having specified name.

If specified command is not a local command, a new instance of RemoteCommand is returned.

Source:

getCommandState()

Source:

getSelectedText()

Returns text selection if any; null otherwise.
Source:

hasNodeSelection()

Tests whether there is a node selection.
Source:

hasTextSelection()

Tests whether there is a text selection.
Source:

makeSelectionVisible(expandopt)

Scrolls the selection, if any, to center it in this document view.
Parameters:
Name Type Attributes Default Description
expand boolean <optional>
false expand - if true, when needed to, expand the views of the ancestors of the nodes comprising the selection to really make the selection visible.
Source:

pickTextualView(mouseEvent, pickedTextopt) → {array}

Find the text node view and the text offset corresponding to specified coordinates.
Parameters:
Name Type Attributes Default Description
mouseEvent MouseEvent specifies the coordinates where the search begins.
pickedText array <optional>
null if not null, the result is stored there.
Source:
Returns:
An array containing two items. First item is a text node view or null (if the search has failed). Second item is a text offset or -1 (if the search has failed). The returned array is pickedText if specified and a newly created array otherwise.
Type
array

requestFocus()

Ensures that this document view has the keyboard focus and that the caret is blinking (if the dot mark exists).
Source:

selectionContains()

Tests whether specified mouse click is contained in text or node selection (if any).
Source:

selectNode(view, showopt) → {Promise}

Select the node having specified view.

Automatically invokes DocumentView#ensureDotIsInside.

Parameters:
Name Type Attributes Default Description
view specifies the node to be selected by its view.
show boolean <optional>
false show - if true, when needed to, expand the views of the ancestors of specified node to really make the node visible.
Source:
Returns:
A Promise containing true if the selection has been successfully changed; false otherwise (even when an error occurs).
Type
Promise

selectNodeRange(view1, view2) → {Promise}

Select the node range specified using the view of first node of the range and the view of last node of the range.

Specified views must have a common parent view to make sure that corresponding nodes are siblings.

Automatically invokes DocumentView#ensureDotIsInside.

Parameters:
Name Type Description
view1 specifies the first node of the range.
view2 specifies the last node of the range.
Source:
Returns:
A Promise containing true if the selection has been successfully changed; false otherwise (even when an error occurs).
Type
Promise

sendExecuteCommand(mode, commandName, commandParams) → {Promise}

Tests wether specified remote command can be executed or actually executes specified remote command.
Parameters:
Name Type Description
mode number specifies how this command is to be executed.
commandName string the command name.
commandParams string parameterizes the command. May be null.
Source:
See:
Returns:
A Promise containing:
  • If mode is EXECUTE_TEST, true if the command can be executed, false otherwise.
  • In the other modes, a CommandResult.
  • null if this command has not been executed (for example, an unknown command) or if an error of any kind occurs.
Type
Promise

sendSetClipboard(copied) → {Promise}

Copy a string in to clipboard on the server side.
Parameters:
Name Type Description
copied string String to be copied.
Source:
Returns:
A Promise containing true if the server-side clipboard has been successfully updated; false otherwise (even when an error occurs).
Type
Promise

sendSetMarks(marks) → {Promise}

Change node marks on the server side.
Parameters:
Name Type Description
marks object an object containing one or more of the following keys:
  • dot: UID or "", dotOffset: integer,
  • mark: UID or "", markOffset: integer,
  • selected: UID or "",
  • selected2: UID or "".
  • reason: "dragging", "showing" or null.

    "dragging": if a quick sequence of change marks requests is being sent to the server.

    "showing": if the goal is to show the selection to the user, in which case, the MarkManager may have to expand some collapsed node views after receiving the marks changed event.

Use "" to clear a mark, UID to set it. Value null is ignored.

Source:
Returns:
A Promise containing true if specified marks were successfully changed; false otherwise (even when an error occurs).

Note that DocumentMarksChangedEvents and EditingContextChangedEvents are received before this Promise is fulfilled.

Type
Promise

sendSetPrimarySelection(copied) → {Promise}

Copy a string as the primary selection on the server side.
Parameters:
Name Type Description
copied string String to be copied.
Source:
Returns:
A Promise containing true if the server-side primary selection has been successfully updated; false otherwise (even when an error occurs).
Type
Promise

showStatus()

Source:

sync() → {Promise}

Update server-side text node content and dot to match the state of currently used (focused) contenteditable.
Source:
Returns:
A Promise containing true if sync was successful; false otherwise (an internal error which should not happen).
Type
Promise

updatePrimarySelection()

When DocumentView#button2PastesText is true, update the (emulated) primary selection by copying selected text to it.
Source: