PointRef API

PreviousNext

PointRef objects keep a specific point synced over time as operations are applied. They are low-level location values used by Slate internals and advanced runtime code. Read current for the up-to-date Point value. Call unref() when you no longer need to track the point. affinity controls which side the point follows when content is inserted at the current position.

interface PointRef {
  current: Point | null
  affinity: 'forward' | 'backward' | null
  unref(): Point | null
}
interface PointRef {
  current: Point | null
  affinity: 'forward' | 'backward' | null
  unref(): Point | null
}

Instance methods

unref() => Point | null

Call this when you no longer need to sync this point. It also returns the current value.

Static methods

Transform methods

PointRefApi.transform(ref: PointRef, op: Operation)

Transform the point ref's current value by an op. The editor calls this as needed, so normally you won't need to.