1 | import { Range } from '..';
|
2 | import { ExtendedType } from '../types/custom-types';
|
3 | /**
|
4 | * `Text` objects represent the nodes that contain the actual text content of a
|
5 | * Slate document along with any formatting properties. They are always leaf
|
6 | * nodes in the document tree as they cannot contain any children.
|
7 | */
|
8 | export interface BaseText {
|
9 | text: string;
|
10 | }
|
11 | export type Text = ExtendedType<'Text', BaseText>;
|
12 | export interface TextEqualsOptions {
|
13 | loose?: boolean;
|
14 | }
|
15 | export interface TextInterface {
|
16 | /**
|
17 | * Check if two text nodes are equal.
|
18 | *
|
19 | * When loose is set, the text is not compared. This is
|
20 | * used to check whether sibling text nodes can be merged.
|
21 | */
|
22 | equals: (text: Text, another: Text, options?: TextEqualsOptions) => boolean;
|
23 | /**
|
24 | * Check if a value implements the `Text` interface.
|
25 | */
|
26 | isText: (value: any) => value is Text;
|
27 | /**
|
28 | * Check if a value is a list of `Text` objects.
|
29 | */
|
30 | isTextList: (value: any) => value is Text[];
|
31 | /**
|
32 | * Check if some props are a partial of Text.
|
33 | */
|
34 | isTextProps: (props: any) => props is Partial<Text>;
|
35 | /**
|
36 | * Check if an text matches set of properties.
|
37 | *
|
38 | * Note: this is for matching custom properties, and it does not ensure that
|
39 | * the `text` property are two nodes equal.
|
40 | */
|
41 | matches: (text: Text, props: Partial<Text>) => boolean;
|
42 | /**
|
43 | * Get the leaves for a text node given decorations.
|
44 | */
|
45 | decorations: (node: Text, decorations: Range[]) => Text[];
|
46 | }
|
47 | export declare const Text: TextInterface;
|
48 | //# sourceMappingURL=text.d.ts.map |
\ | No newline at end of file |