import { Range } from '..'; import { ExtendedType } from '../types/custom-types'; /** * `Text` objects represent the nodes that contain the actual text content of a * Slate document along with any formatting properties. They are always leaf * nodes in the document tree as they cannot contain any children. */ export interface BaseText { text: string; } export type Text = ExtendedType<'Text', BaseText>; export interface TextEqualsOptions { loose?: boolean; } export type DecoratedRange = Range & { /** * Customize how another decoration is merged into a text node. If not specified, `Object.assign` would be used. * It is useful for overlapping decorations with the same key but different values. */ merge?: (leaf: Text, decoration: object) => void; }; export interface TextInterface { /** * Check if two text nodes are equal. * * When loose is set, the text is not compared. This is * used to check whether sibling text nodes can be merged. */ equals: (text: Text, another: Text, options?: TextEqualsOptions) => boolean; /** * Check if a value implements the `Text` interface. */ isText: (value: any) => value is Text; /** * Check if a value is a list of `Text` objects. */ isTextList: (value: any) => value is Text[]; /** * Check if some props are a partial of Text. */ isTextProps: (props: any) => props is Partial; /** * Check if an text matches set of properties. * * Note: this is for matching custom properties, and it does not ensure that * the `text` property are two nodes equal. */ matches: (text: Text, props: Partial) => boolean; /** * Get the leaves for a text node given decorations. */ decorations: (node: Text, decorations: DecoratedRange[]) => Text[]; } export declare const Text: TextInterface; //# sourceMappingURL=text.d.ts.map