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.
Constructor Attributes | Constructor Name and Description |
---|---|
ops.OdtCursor(memberId, document)
|
Field Attributes | Field Name and Description |
---|---|
<static> |
ops.OdtCursor.RangeSelection
|
<static> |
ops.OdtCursor.RegionSelection
|
<static> |
ops.OdtCursor.signalCursorUpdated
|
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.
|
|
getNode()
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
|
|
setSelectionType(value)
Sets the current selection type to the given value.
|
|
subscribe(eventid, cb)
Subscribe to cursor update events.
|
|
unsubscribe(eventid, cb)
Unsubscribe from cursor events
|
- Parameters:
- {!string} memberId
- The memberid this cursor is assigned to
- {!ops.Document} document
- The document in which the cursor is placed
- Returns:
- {!Element}
- Returns:
- {!ops.Document}
- Returns:
- {string}
- Returns:
- {!Element}
- Returns:
- {!Range}
- Returns:
- {!string}
- Returns:
- {boolean}
- Returns:
- {undefined}
- Returns:
- {undefined}
- Parameters:
- {!Range} range,
- {boolean} isForwardSelection
- Returns:
- {undefined}
- Parameters:
- {!string} value
- Returns:
- {undefined}
- Parameters:
- {!string} eventid
- {!Function} cb
- Parameters:
- {!string} eventid
- {!Function} cb