Class Index | File Index

Classes


Class core.Cursor

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: Cursor.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
core.Cursor(document, memberId)
Method Summary
Method Attributes Method Name and Description
 
Obtain the node representing the selection start point.
<inner>  
Gets the latest selection node in the document
 
Obtain the node representing the cursor.
 
Obtain the selection to which the cursor corresponds.
<inner>  
Gets the earliest selection node in the document
 
Returns if the selection of this cursor has the same direction as the direction of the range
<inner>  
putIntoTextNode(node, container, offset)
Split a text node and put the cursor into it.
<inner>  
putNode(node, container, offset)
Put the cursor at a particular position.
 
Remove the cursor from the document tree.
<inner>  
removeNode(node)
Remove the cursor from the tree.
 
setSelectedRange(range, isForwardSelection)
Synchronize the cursor to a specific range If there is a single collapsed selection range, the cursor will be placed there.
Class Detail
core.Cursor(document, memberId)
Parameters:
{!Document} document
The DOM document in which the cursor is placed
{!string} memberId
The memberid this cursor is assigned to
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}

<inner> {!Node} getEndNode()
Gets the latest selection node in the document
Returns:
{!Node}

{!Element} getNode()
Obtain the node representing the cursor. This is the selection end point
Returns:
{!Element}

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

<inner> {!Node} getStartNode()
Gets the earliest selection node in the document
Returns:
{!Node}

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

<inner> {undefined} putIntoTextNode(node, container, offset)
Split a text node and put the cursor into it.
Parameters:
{!Node} node
{!Text} container
{!number} offset
Returns:
{undefined}

<inner> {undefined} putNode(node, container, offset)
Put the cursor at a particular position.
Parameters:
{!Node} node
{!Node} container
{!number} offset
Returns:
{undefined}

{undefined} remove()
Remove the cursor from the document tree.
Returns:
{undefined}

<inner> removeNode(node)
Remove the cursor from the tree.
Parameters:
{!Element} node

{undefined} setSelectedRange(range, isForwardSelection)
Synchronize the cursor to a specific range If there is a single collapsed selection range, the cursor will be placed there. If not, the cursor will be removed from the document tree.
Parameters:
{!Range} range
{boolean=} isForwardSelection
Set to true to indicate the direction of the range is startContainer => endContainer. This should be false if the user creates a selection that ends before it starts in the document (i.e., drags the range backwards from the start point)
Returns:
{undefined}

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