|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object | +--mozile.edit.InsertionPoint
Defined in InsertionPoint.js
Constructor Summary | |
mozile.edit.InsertionPoint
()
An insertion point is the pair of either a) a text node and an offset within the text, or b) an element and an offset among its child nodes. |
Method Summary | |
Void
|
extend()
Extends the selection to the IP. |
Node
|
getNode()
Gets the current node. |
Integer
|
getOffset()
Gets the offset in the current node. |
Void
|
next()
Sets the node and offset to the next insertion point. |
Void
|
previous()
Sets the node and offset to the previous insertion point. |
Void
|
seek(<Integer> direction)
Sets the node and offset to the next insertion point. |
Void
|
seekNode(<Integer> direction, <Boolean> extraStep)
Seeks the next node which allows text to be inserted. |
Void
|
select()
Collapses the selection to the current IP. |
Integer
|
toString()
Returns a string representation of the IP. |
Constructor Detail |
mozile.edit.InsertionPoint()
node
-
offset
- The offset within the node.
Method Detail |
Void extend()
Node getNode()
Integer getOffset()
Void next()
Void previous()
Void seek(<Integer> direction)
If the node is not a text node, or the offset and direction will mean that the IP leaves the node, then seekNode is returned instead.
Otherwise we are inside a text node and have to worry about the XML white space rules. We want to treat adjacent whitespace as a single character. So we measure the length of the whitespace after the offset (if any). Then "moveBy" is set based on the length of the result and the CSS white-space mode. If the length takes the offset to the end of the node, seekNode is called.
direction
- A coded integer. Can be NEXT (1) or PREVIOUS (-1).
Void seekNode(<Integer> direction, <Boolean> extraStep)
The method involves a treeWalker, but unfortunately the setup section is complicated. The chief cause of the complexity is that, if the node is a first child, then we do not want the parentNode but the parentNode's previousNode.
The method is to build a treeWalker, set the currentNode to this.getNode(), and move through the tree working as follows:
direction
- A coded integer. Can be NEXT (1) or PREVIOUS (-1).
extraStep
- Optional. Defaults to "true". When "false" the method will not move an extra offset step.
Void select()
Integer toString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |