{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "api-slate-location-ref-docs",
  "title": "Location Ref",
  "description": "API reference for location references in Plate.",
  "files": [
    {
      "path": "../../content/docs/api/slate/location-ref.mdx",
      "content": "---\ntitle: Location Ref\ndescription: API reference for location references in Plate.\n---\n\nLocation 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.\n\n## Types\n\n### `PathRef`\n\nPath reference objects keep a specific path in a document synced over time. Created using `editor.api.pathRef`.\n\n<API name=\"PathRef\">\n<APIAttributes>\n  <APIItem name=\"current\" type=\"Path | null\">\n    The current path value, updated as operations are applied.\n  </APIItem>\n  <APIItem name=\"affinity\" type=\"'forward' | 'backward' | null\">\n    The direction to prefer when transforming the path:\n    - `'forward'`: Prefer the position after inserted content\n    - `'backward'`: Prefer the position before inserted content\n    - `null`: No preference\n  </APIItem>\n  <APIItem name=\"unref()\" type=\"() => Path | null\">\n    Call this when you no longer need to sync this path. Returns the final path value.\n  </APIItem>\n</APIAttributes>\n</API>\n\n### `PointRef`\n\nPoint reference objects keep a specific point in a document synced over time. Created using `editor.api.pointRef`.\n\n<API name=\"PointRef\">\n<APIAttributes>\n  <APIItem name=\"current\" type=\"Point | null\">\n    The current point value, updated as operations are applied.\n  </APIItem>\n  <APIItem name=\"affinity\" type=\"'forward' | 'backward' | null\">\n    The direction to prefer when transforming the point:\n    - `'forward'`: Prefer the position after inserted content\n    - `'backward'`: Prefer the position before inserted content\n    - `null`: No preference\n  </APIItem>\n  <APIItem name=\"unref()\" type=\"() => Point | null\">\n    Call this when you no longer need to sync this point. Returns the final point value.\n  </APIItem>\n</APIAttributes>\n</API>\n\n### `RangeRef`\n\nRange reference objects keep a specific range in a document synced over time. Created using `editor.api.rangeRef`.\n\n<API name=\"RangeRef\">\n<APIAttributes>\n  <APIItem name=\"current\" type=\"TRange | null\">\n    The current range value, updated as operations are applied.\n  </APIItem>\n  <APIItem name=\"affinity\" type=\"'forward' | 'backward' | 'inward' | 'outward' | null\">\n    The direction to prefer when transforming the range:\n    - `'forward'`: Both points prefer after inserted content\n    - `'backward'`: Both points prefer before inserted content\n    - `'inward'`: Range tends to stay same size when content is inserted at edges\n    - `'outward'`: Range tends to grow when content is inserted at edges\n    - `null`: No preference\n  </APIItem>\n  <APIItem name=\"unref()\" type=\"() => TRange | null\">\n    Call this when you no longer need to sync this range. Returns the final range value.\n  </APIItem>\n</APIAttributes>\n</API>\n\nExample usage of a RangeRef:\n\n```typescript\nconst selectionRef = editor.api.rangeRef(editor.selection, {\n  affinity: 'inward',\n})\n// Operations that might change the selection\nTransforms.unwrapNodes(editor)\n// Restore the selection using the ref\nTransforms.select(editor, selectionRef.unref())\n```\n\n\n## `PathRefApi`\n\n### `transform`\n\nTransform a path reference by an operation.\n\n<API name=\"transform\">\n<APIParameters>\n  <APIItem name=\"ref\" type=\"PathRef\">\n    The path reference to transform.\n  </APIItem>\n  <APIItem name=\"op\" type=\"Operation\">\n    The operation to apply. The editor calls this automatically as needed.\n  </APIItem>\n</APIParameters>\n</API>\n\n## `PointRefApi`\n\n### `transform`\n\nTransform a point reference by an operation.\n\n<API name=\"transform\">\n<APIParameters>\n  <APIItem name=\"ref\" type=\"PointRef\">\n    The point reference to transform.\n  </APIItem>\n  <APIItem name=\"op\" type=\"Operation\">\n    The operation to apply. The editor calls this automatically as needed.\n  </APIItem>\n</APIParameters>\n</API>\n\n## `RangeRefApi`\n\n### `transform`\n\nTransform a range reference by an operation.\n\n<API name=\"transform\">\n<APIParameters>\n  <APIItem name=\"ref\" type=\"RangeRef\">\n    The range reference to transform.\n  </APIItem>\n  <APIItem name=\"op\" type=\"Operation\">\n    The operation to apply. The editor calls this automatically as needed.\n  </APIItem>\n</APIParameters>\n</API>\n",
      "type": "registry:file",
      "target": "content/docs/plate/api/slate/location-ref.mdx"
    }
  ],
  "type": "registry:file"
}