liusuyi
2023-04-24 4737f1e038743ced243c9e52423404d9034d6107
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
59
60
61
62
63
import LinkedList from '../../collection/linked-list';
import LinkedNode from '../../collection/linked-node';
export interface Blot extends LinkedNode {
    scroll: Parent;
    parent: Parent;
    prev: Blot;
    next: Blot;
    domNode: Node;
    attach(): void;
    clone(): Blot;
    detach(): void;
    insertInto(parentBlot: Parent, refBlot?: Blot): void;
    isolate(index: number, length: number): Blot;
    offset(root?: Blot): number;
    remove(): void;
    replace(target: Blot): void;
    replaceWith(name: string, value: any): Blot;
    replaceWith(replacement: Blot): Blot;
    split(index: number, force?: boolean): Blot;
    wrap(name: string, value: any): Parent;
    wrap(wrapper: Parent): Parent;
    deleteAt(index: number, length: number): void;
    formatAt(index: number, length: number, name: string, value: any): void;
    insertAt(index: number, value: string, def?: any): void;
    optimize(context: {
        [key: string]: any;
    }): void;
    optimize(mutations: MutationRecord[], context: {
        [key: string]: any;
    }): void;
    update(mutations: MutationRecord[], context: {
        [key: string]: any;
    }): void;
}
export interface Parent extends Blot {
    children: LinkedList<Blot>;
    domNode: HTMLElement;
    appendChild(child: Blot): void;
    descendant<T>(type: {
        new (): T;
    }, index: number): [T, number];
    descendant<T>(matcher: (blot: Blot) => boolean, index: number): [T, number];
    descendants<T>(type: {
        new (): T;
    }, index: number, length: number): T[];
    descendants<T>(matcher: (blot: Blot) => boolean, index: number, length: number): T[];
    insertBefore(child: Blot, refNode?: Blot): void;
    moveChildren(parent: Parent, refNode?: Blot): void;
    path(index: number, inclusive?: boolean): [Blot, number][];
    removeChild(child: Blot): void;
    unwrap(): void;
}
export interface Formattable extends Blot {
    format(name: string, value: any): void;
    formats(): {
        [index: string]: any;
    };
}
export interface Leaf extends Blot {
    index(node: Node, offset: number): number;
    position(index: number, inclusive: boolean): [Node, number];
    value(): any;
}