Library (API) Example

Loading last updated info...
This example content is a random page taken from the PlateJS documentation.

Location references are objects that keep specific locations (paths, points, or ranges) in a document synced over time as new operations are applied to the editor.

You can access their current property at any time for the up-to-date location value. You can access their current property at any time for the up-to-date location value.

Types


PathRef

Path reference objects keep a specific path in a document synced over time. Created using editor.api.pathRef.

current

REQUIRED

Path | null

The current path value, updated as operations are applied.


affinity
'forward' | 'backward' | null

The direction to prefer when transforming the path:

  • 'forward': Prefer the position after inserted content
  • 'backward': Prefer the position before inserted content
  • null: No preference

unref( )
( ) => Path | null

Call this when you no longer need to sync this path. Returns the final path value.

All properties marked as REQUIRED must be specified for the field to work properly.

PointRef

Point reference objects keep a specific point in a document synced over time. Created using editor.api.pointRef.

current

REQUIRED

Point | null

The current point value, updated as operations are applied.


affinity
'forward' | 'backward' | null

The direction to prefer when transforming the point:

  • 'forward': Prefer the position after inserted content
  • 'backward': Prefer the position before inserted content
  • null: No preference

unref( )
( ) => Point | null

Call this when you no longer need to sync this point. Returns the final point value.

All properties marked as REQUIRED must be specified for the field to work properly.

RangeRef

Range reference objects keep a specific range in a document synced over time. Created using editor.api.rangeRef.

current

REQUIRED

TRange | null

The current range value, updated as operations are applied.


affinity
'forward' | 'backward' | 'inward' | 'outward' | null

The direction to prefer when transforming the range:

  • 'forward': Both points prefer after inserted content
  • 'backward': Both points prefer before inserted content
  • 'inward': Range tends to stay same size when content is inserted at edges
  • 'outward': Range tends to grow when content is inserted at edges
  • null: No preference

unref( )
( ) => TRange | null

Call this when you no longer need to sync this range. Returns the final range value.

All properties marked as REQUIRED must be specified for the field to work properly.

Example usage of a RangeRef:

PathRefApi


transform

Transform a path reference by an operation.

ref

REQUIRED

PathRef

The path reference to transform.


op

REQUIRED

Operation

The operation to apply. The editor calls this automatically as needed.

All properties marked as REQUIRED must be specified for the field to work properly.

PointRefApi


transform

Transform a point reference by an operation.

ref

REQUIRED

PointRef

The point reference to transform.


op

REQUIRED

Operation

The operation to apply. The editor calls this automatically as needed.

All properties marked as REQUIRED must be specified for the field to work properly.

RangeRefApi


transform

Transform a range reference by an operation.

ref

REQUIRED

RangeRef

The range reference to transform.


op

REQUIRED

Operation

The operation to apply. The editor calls this automatically as needed.

All properties marked as REQUIRED must be specified for the field to work properly.

Last Edited: July 15, 2025