element.d.ts 1.1 KB

12345678910111213141516171819202122232425
  1. import { Path, Descendant, ExtendedType, Ancestor } from '..';
  2. /**
  3. * `Element` objects are a type of node in a Slate document that contain other
  4. * element nodes or text nodes. They can be either "blocks" or "inlines"
  5. * depending on the Slate editor's configuration.
  6. */
  7. export interface BaseElement {
  8. children: Descendant[];
  9. }
  10. export declare type Element = ExtendedType<'Element', BaseElement>;
  11. export interface ElementInterface {
  12. isAncestor: (value: any) => value is Ancestor;
  13. isElement: (value: any) => value is Element;
  14. isElementList: (value: any) => value is Element[];
  15. isElementProps: (props: any) => props is Partial<Element>;
  16. isElementType: <T extends Element>(value: any, elementVal: string, elementKey?: string) => value is T;
  17. matches: (element: Element, props: Partial<Element>) => boolean;
  18. }
  19. export declare const Element: ElementInterface;
  20. /**
  21. * `ElementEntry` objects refer to an `Element` and the `Path` where it can be
  22. * found inside a root node.
  23. */
  24. export declare type ElementEntry = [Element, Path];
  25. //# sourceMappingURL=element.d.ts.map