1 | import { BaseEditor, Editor, Node, Path, Point, Range } from 'slate';
|
2 | import { TextDiff } from '../utils/diff-text';
|
3 | import { DOMNode, DOMPoint, DOMRange, DOMSelection, DOMStaticRange } from '../utils/dom';
|
4 | import { Key } from '../utils/key';
|
5 |
|
6 |
|
7 |
|
8 | export interface ReactEditor extends BaseEditor {
|
9 | hasEditableTarget: (editor: ReactEditor, target: EventTarget | null) => target is DOMNode;
|
10 | hasRange: (editor: ReactEditor, range: Range) => boolean;
|
11 | hasSelectableTarget: (editor: ReactEditor, target: EventTarget | null) => boolean;
|
12 | hasTarget: (editor: ReactEditor, target: EventTarget | null) => target is DOMNode;
|
13 | insertData: (data: DataTransfer) => void;
|
14 | insertFragmentData: (data: DataTransfer) => boolean;
|
15 | insertTextData: (data: DataTransfer) => boolean;
|
16 | isTargetInsideNonReadonlyVoid: (editor: ReactEditor, target: EventTarget | null) => boolean;
|
17 | setFragmentData: (data: DataTransfer, originEvent?: 'drag' | 'copy' | 'cut') => void;
|
18 | }
|
19 | export interface ReactEditorInterface {
|
20 | |
21 |
|
22 |
|
23 | androidPendingDiffs: (editor: Editor) => TextDiff[] | undefined;
|
24 | |
25 |
|
26 |
|
27 | androidScheduleFlush: (editor: Editor) => void;
|
28 | |
29 |
|
30 |
|
31 | blur: (editor: ReactEditor) => void;
|
32 | |
33 |
|
34 |
|
35 | deselect: (editor: ReactEditor) => void;
|
36 | |
37 |
|
38 |
|
39 | findDocumentOrShadowRoot: (editor: ReactEditor) => Document | ShadowRoot;
|
40 | |
41 |
|
42 |
|
43 | findEventRange: (editor: ReactEditor, event: any) => Range;
|
44 | |
45 |
|
46 |
|
47 | findKey: (editor: ReactEditor, node: Node) => Key;
|
48 | |
49 |
|
50 |
|
51 | findPath: (editor: ReactEditor, node: Node) => Path;
|
52 | |
53 |
|
54 |
|
55 | focus: (editor: ReactEditor, options?: {
|
56 | retries: number;
|
57 | }) => void;
|
58 | |
59 |
|
60 |
|
61 | getWindow: (editor: ReactEditor) => Window;
|
62 | |
63 |
|
64 |
|
65 | hasDOMNode: (editor: ReactEditor, target: DOMNode, options?: {
|
66 | editable?: boolean;
|
67 | }) => boolean;
|
68 | |
69 |
|
70 |
|
71 | hasEditableTarget: (editor: ReactEditor, target: EventTarget | null) => target is DOMNode;
|
72 | |
73 |
|
74 |
|
75 | hasRange: (editor: ReactEditor, range: Range) => boolean;
|
76 | |
77 |
|
78 |
|
79 | hasSelectableTarget: (editor: ReactEditor, target: EventTarget | null) => boolean;
|
80 | |
81 |
|
82 |
|
83 | hasTarget: (editor: ReactEditor, target: EventTarget | null) => target is DOMNode;
|
84 | |
85 |
|
86 |
|
87 | insertData: (editor: ReactEditor, data: DataTransfer) => void;
|
88 | |
89 |
|
90 |
|
91 | insertFragmentData: (editor: ReactEditor, data: DataTransfer) => boolean;
|
92 | |
93 |
|
94 |
|
95 | insertTextData: (editor: ReactEditor, data: DataTransfer) => boolean;
|
96 | |
97 |
|
98 |
|
99 | isComposing: (editor: ReactEditor) => boolean;
|
100 | |
101 |
|
102 |
|
103 | isFocused: (editor: ReactEditor) => boolean;
|
104 | |
105 |
|
106 |
|
107 | isReadOnly: (editor: ReactEditor) => boolean;
|
108 | |
109 |
|
110 |
|
111 | isTargetInsideNonReadonlyVoid: (editor: ReactEditor, target: EventTarget | null) => boolean;
|
112 | |
113 |
|
114 |
|
115 | setFragmentData: (editor: ReactEditor, data: DataTransfer, originEvent?: 'drag' | 'copy' | 'cut') => void;
|
116 | |
117 |
|
118 |
|
119 | toDOMNode: (editor: ReactEditor, node: Node) => HTMLElement;
|
120 | |
121 |
|
122 |
|
123 | toDOMPoint: (editor: ReactEditor, point: Point) => DOMPoint;
|
124 | |
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 | toDOMRange: (editor: ReactEditor, range: Range) => DOMRange;
|
133 | |
134 |
|
135 |
|
136 | toSlateNode: (editor: ReactEditor, domNode: DOMNode) => Node;
|
137 | |
138 |
|
139 |
|
140 | toSlatePoint: <T extends boolean>(editor: ReactEditor, domPoint: DOMPoint, options: {
|
141 | exactMatch: boolean;
|
142 | suppressThrow: T;
|
143 | }) => T extends true ? Point | null : Point;
|
144 | |
145 |
|
146 |
|
147 | toSlateRange: <T extends boolean>(editor: ReactEditor, domRange: DOMRange | DOMStaticRange | DOMSelection, options: {
|
148 | exactMatch: boolean;
|
149 | suppressThrow: T;
|
150 | }) => T extends true ? Range | null : Range;
|
151 | }
|
152 | export declare const ReactEditor: ReactEditorInterface;
|
153 |
|
\ | No newline at end of file |