-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.d.ts
58 lines (53 loc) · 2.58 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
export type DeltaOperation = ({ insert: any } | { delete: number } | { retain: number }) & OptionalAttributes;
export interface StringMap {
[key: string]: any;
}
export interface OptionalAttributes {
attributes?: StringMap;
}
export interface DeltaStatic {
ops?: DeltaOperation[];
retain(length: number, attributes?: StringMap): DeltaStatic;
delete(length: number): DeltaStatic;
filter(predicate: (op: DeltaOperation) => boolean): DeltaOperation[];
forEach(predicate: (op: DeltaOperation) => void): void;
insert(text: any, attributes?: StringMap): DeltaStatic;
map<T>(predicate: (op: DeltaOperation) => T): T[];
partition(predicate: (op: DeltaOperation) => boolean): [DeltaOperation[], DeltaOperation[]];
reduce<T>(predicate: (acc: T, curr: DeltaOperation, idx: number, arr: DeltaOperation[]) => T, initial: T): T;
chop(): DeltaStatic;
length(): number;
slice(start?: number, end?: number): DeltaStatic;
compose(other: DeltaStatic): DeltaStatic;
concat(other: DeltaStatic): DeltaStatic;
diff(other: DeltaStatic, index?: number): DeltaStatic;
eachLine(predicate: (line: DeltaStatic, attributes: StringMap, idx: number) => any, newline?: string): DeltaStatic;
transform(index: number): number;
transform(other: DeltaStatic, priority: boolean): DeltaStatic;
transformPosition(index: number): number;
}
declare namespace QuillDelta {
export class Delta implements DeltaStatic {
constructor(ops?: DeltaOperation[] | { ops: DeltaOperation[] });
ops?: DeltaOperation[];
retain(length: number, attributes?: StringMap): DeltaStatic;
delete(length: number): DeltaStatic;
filter(predicate: (op: DeltaOperation) => boolean): DeltaOperation[];
forEach(predicate: (op: DeltaOperation) => void): void;
insert(text: any, attributes?: StringMap): DeltaStatic;
map<T>(predicate: (op: DeltaOperation) => T): T[];
partition(predicate: (op: DeltaOperation) => boolean): [DeltaOperation[], DeltaOperation[]];
reduce<T>(predicate: (acc: T, curr: DeltaOperation, idx: number, arr: DeltaOperation[]) => T, initial: T): T;
chop(): DeltaStatic;
length(): number;
slice(start?: number, end?: number): DeltaStatic;
compose(other: DeltaStatic): DeltaStatic;
concat(other: DeltaStatic): DeltaStatic;
diff(other: DeltaStatic, index?: number): DeltaStatic;
eachLine(predicate: (line: DeltaStatic, attributes: StringMap, idx: number) => any, newline?: string): DeltaStatic;
transform(index: number): number;
transform(other: DeltaStatic, priority: boolean): DeltaStatic;
transformPosition(index: number): number;
}
}
export default QuillDelta.Delta;