Class ops.OdtStepsTranslator
Defined in: OdtStepsTranslator.js.
Constructor Attributes | Constructor Name and Description |
---|---|
ops.OdtStepsTranslator(getRootNode, newIterator, filter, bucketSize)
|
Method Attributes | Method Name and Description |
---|---|
convertDomPointToSteps(node, offset, roundDirection)
Convert the supplied DOM node & offset pair into it's equivalent steps from root
If the node & offset is not in an accepted location, the
roundDirection delegate is used to choose between rounding up or
rounding down to the nearest step.
|
|
convertStepsToDomPoint(steps)
Convert the requested steps from root into the equivalent DOM node & offset pair.
|
|
handleStepsInserted(eventArgs)
|
|
handleStepsRemoved(eventArgs)
|
|
prime()
Iterates over all available positions starting at the root node and primes the cache
|
|
<inner> |
roundToPreferredStep(iterator, roundDirection)
Uses the provided delegate to choose between rounding up or rounding down to the nearest step.
|
<inner> |
roundUpToStep(steps, iterator)
Saved bookmarks always represent the first step inside the corresponding paragraph or node.
|
<inner> |
updateCache(steps, iterator, isStep)
Update the steps cache based on the current iterator position.
|
<inner> |
This evil little check is necessary because someone, not mentioning any names *cough*
added an extremely hacky undo manager that replaces the root node in order to go back
to a prior document state.
|
Class Detail
ops.OdtStepsTranslator(getRootNode, newIterator, filter, bucketSize)
- Parameters:
- {!function():!Element} getRootNode
- {!function(!Node):!core.PositionIterator} newIterator
- {!core.PositionFilter} filter
- {!number} bucketSize
- Minimum number of steps between cache points
Method Detail
{!number}
convertDomPointToSteps(node, offset, roundDirection)
Convert the supplied DOM node & offset pair into it's equivalent steps from root
If the node & offset is not in an accepted location, the
roundDirection delegate is used to choose between rounding up or
rounding down to the nearest step. If not provided, the default
behaviour is to round down.
- Parameters:
- {!Node} node
- {!number} offset
- {function(!core.StepDirection|!Node|!number):!boolean=} roundDirection
- Returns:
- {!number}
{!{node: !Node|offset: !number}}
convertStepsToDomPoint(steps)
Convert the requested steps from root into the equivalent DOM node & offset pair. If the
requested step is before the start or past the end of the document, a RangeError will be thrown.
- Parameters:
- {!number} steps
- Returns:
- {!{node: !Node|offset: !number}}
{undefined}
handleStepsInserted(eventArgs)
- Parameters:
- {!{position: !number}} eventArgs
- Returns:
- {undefined}
{undefined}
handleStepsRemoved(eventArgs)
- Parameters:
- {!{position: !number}} eventArgs
- Returns:
- {undefined}
{undefined}
prime()
Iterates over all available positions starting at the root node and primes the cache
- Returns:
- {undefined}
<inner>
{!boolean}
roundToPreferredStep(iterator, roundDirection)
Uses the provided delegate to choose between rounding up or rounding down to the nearest step.
- Parameters:
- {!core.PositionIterator} iterator
- {function(!core.StepDirection|!Node|!number):boolean=} roundDirection
- Returns:
- {!boolean} Returns true if an accepted position is found, otherwise returns false.
<inner>
{undefined}
roundUpToStep(steps, iterator)
Saved bookmarks always represent the first step inside the corresponding paragraph or node. Based on the
current TextPositionFilter impl, this means rounding up if the current iterator position is not on a step.
- Parameters:
- {!number} steps
- {!core.PositionIterator} iterator
- Returns:
- {undefined}
<inner>
{undefined}
updateCache(steps, iterator, isStep)
Update the steps cache based on the current iterator position. This can either add new
bookmarks or update existing references and repair damaged regions of the cache.
- Parameters:
- {!number} steps
- {!core.PositionIterator} iterator
- {!boolean} isStep
- Returns:
- {undefined}
<inner>
{undefined}
verifyRootNode()
This evil little check is necessary because someone, not mentioning any names *cough*
added an extremely hacky undo manager that replaces the root node in order to go back
to a prior document state.
This makes things very sad, and kills baby kittens.
Unfortunately, no-one has had time yet to write a *real* undo stack... so we just need
to cope with it for now.
- Returns:
- {undefined}