path.d.ts 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { Operation } from '..';
  2. /**
  3. * `Path` arrays are a list of indexes that describe a node's exact position in
  4. * a Slate node tree. Although they are usually relative to the root `Editor`
  5. * object, they can be relative to any `Node` object.
  6. */
  7. export declare type Path = number[];
  8. export interface PathInterface {
  9. ancestors: (path: Path, options?: {
  10. reverse?: boolean;
  11. }) => Path[];
  12. common: (path: Path, another: Path) => Path;
  13. compare: (path: Path, another: Path) => -1 | 0 | 1;
  14. endsAfter: (path: Path, another: Path) => boolean;
  15. endsAt: (path: Path, another: Path) => boolean;
  16. endsBefore: (path: Path, another: Path) => boolean;
  17. equals: (path: Path, another: Path) => boolean;
  18. hasPrevious: (path: Path) => boolean;
  19. isAfter: (path: Path, another: Path) => boolean;
  20. isAncestor: (path: Path, another: Path) => boolean;
  21. isBefore: (path: Path, another: Path) => boolean;
  22. isChild: (path: Path, another: Path) => boolean;
  23. isCommon: (path: Path, another: Path) => boolean;
  24. isDescendant: (path: Path, another: Path) => boolean;
  25. isParent: (path: Path, another: Path) => boolean;
  26. isPath: (value: any) => value is Path;
  27. isSibling: (path: Path, another: Path) => boolean;
  28. levels: (path: Path, options?: {
  29. reverse?: boolean;
  30. }) => Path[];
  31. next: (path: Path) => Path;
  32. operationCanTransformPath: (operation: Operation) => boolean;
  33. parent: (path: Path) => Path;
  34. previous: (path: Path) => Path;
  35. relative: (path: Path, ancestor: Path) => Path;
  36. transform: (path: Path, operation: Operation, options?: {
  37. affinity?: 'forward' | 'backward' | null;
  38. }) => Path | null;
  39. }
  40. export declare const Path: PathInterface;
  41. //# sourceMappingURL=path.d.ts.map