Class Index | File Index

Classes


Class ops.OdtCursor

A cursor is a dom node that visually represents a cursor in a DOM tree. It should stay synchronized with the selection in the document. When there is only one collapsed selection range, a cursor should be shown at that point. Putting the cursor in the DOM tree modifies the DOM, so care should be taken to keep the selection consistent. If e.g. a selection is drawn over the cursor, and the cursor is updated to the selection, the cursor is removed from the DOM because the selection is not collapsed. This means that the offsets of the selection may have to be changed. When the selection is collapsed, the cursor is placed after the point of the selection and the selection will stay valid. However, if the cursor was placed in the DOM tree and was counted in the offset, the offset in the selection should be decreased by one. Even when the selection allows for a cursor, it might be desireable to hide the cursor by not letting it be part of the DOM.
Defined in: OdtCursor.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
ops.OdtCursor(memberId, document)
Field Summary
Field Attributes Field Name and Description
<static>  
ops.OdtCursor.RangeSelection
<static>  
ops.OdtCursor.RegionSelection
<static>  
ops.OdtCursor.signalCursorUpdated
Method Summary
Method Attributes Method Name and Description
 
Obtain the node representing the selection start point.
 
Obtain the document to which the cursor corresponds.
 
Obtain the memberid the cursor is assigned to.
 
Obtain the node representing the cursor.
 
Obtain the currently selected range to which the cursor corresponds.
 
Gets the current selection type.
 
Returns if the selection of this cursor has the same direction as the direction of the range
 
Remove the cursor from the document
 
Reset selection type to default.
 
setSelectedRange(range,, isForwardSelection)
Set the given range as the selected range for this cursor
 
Sets the current selection type to the given value.
 
subscribe(eventid, cb)
Subscribe to cursor update events.
 
unsubscribe(eventid, cb)
Unsubscribe from cursor events
Class Detail
ops.OdtCursor(memberId, document)
Parameters:
{!string} memberId
The memberid this cursor is assigned to
{!ops.Document} document
The document in which the cursor is placed
Field Detail
<static> ops.OdtCursor.RangeSelection

<static> ops.OdtCursor.RegionSelection

<static> ops.OdtCursor.signalCursorUpdated
Method Detail
{!Element} getAnchorNode()
Obtain the node representing the selection start point. If a 0-length range is selected (e.g., by clicking without dragging),, this will return the exact same node as getNode
Returns:
{!Element}

{!ops.Document} getDocument()
Obtain the document to which the cursor corresponds.
Returns:
{!ops.Document}

{string} getMemberId()
Obtain the memberid the cursor is assigned to.
Returns:
{string}

{!Element} getNode()
Obtain the node representing the cursor.
Returns:
{!Element}

{!Range} getSelectedRange()
Obtain the currently selected range to which the cursor corresponds.
Returns:
{!Range}

{!string} getSelectionType()
Gets the current selection type.
Returns:
{!string}

{boolean} hasForwardSelection()
Returns if the selection of this cursor has the same direction as the direction of the range
Returns:
{boolean}

{undefined} removeFromDocument()
Remove the cursor from the document
Returns:
{undefined}

{undefined} resetSelectionType()
Reset selection type to default.
Returns:
{undefined}

{undefined} setSelectedRange(range,, isForwardSelection)
Set the given range as the selected range for this cursor
Parameters:
{!Range} range,
{boolean} isForwardSelection
Returns:
{undefined}

{undefined} setSelectionType(value)
Sets the current selection type to the given value.
Parameters:
{!string} value
Returns:
{undefined}

subscribe(eventid, cb)
Subscribe to cursor update events. The update event called whenever the cursor is moved around manually.
Parameters:
{!string} eventid
{!Function} cb

unsubscribe(eventid, cb)
Unsubscribe from cursor events
Parameters:
{!string} eventid
{!Function} cb

Documentation generated by JsDoc Toolkit 2.4.0 on Thu Aug 06 2015 04:10:41 GMT+0200 (MESZ)