PathRef API

PreviousNext

PathRef objects keep a specific path 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 Path value. Call unref() when you no longer need to track the path. affinity controls which side the path follows when content is inserted at the current position.

interface PathRef {
  current: Path | null
  affinity: 'forward' | 'backward' | null
  unref(): Path | null
}
interface PathRef {
  current: Path | null
  affinity: 'forward' | 'backward' | null
  unref(): Path | null
}

Instance methods

unref() => Path | null

Stop tracking this path and return the final path value, or null when the path is already invalid.

Static methods

Transform methods

PathRefApi.transform(ref: PathRef, op: Operation)

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