Class: Position

Position

new Position()

A position is a logical location (zero-width, or "collapsed") in a post, typically between two characters in a section. Two positions (a head and a tail) make up a Range.

Source:

Members

offset

Properties:
Name Type Description
offset number
Source:

section

Properties:
Name Type Description
section Section
Source:

Methods

(static) atPoint(x, y, editor) → {Position|null}

Parameters:
Name Type Description
x integer

x-position in current viewport

y integer

y-position in current viewport

editor Editor
Source:
Returns:
Type
Position | null

move(direction) → {Position|null}

Move the position 1 unit in direction.

Parameters:
Name Type Description
direction Direction

to move

Source:
Returns:

Return a new position one unit in the given direction or null if it is not possible to move that direction

Type
Position | null

moveLeft() → {Position}

The position to the left of this position. If this position is the post's headPosition it returns itself.

Source:
Returns:
Type
Position

moveRight() → {Position}

The position to the right of this position. If this position is the post's tailPosition it returns itself.

Source:
Returns:
Type
Position