-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathindex.d.ts
69 lines (48 loc) · 1.54 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
59
60
61
62
63
64
65
66
67
68
69
declare namespace Mark {
export interface IData {
content: string
startOffset: number
endOffset: number
length: number
}
export interface IMarkData extends IData {
points: number[]
key: string
type: string
}
export interface IOptions {
points?: number[]
}
export interface ISearchOptions {
afterEach?(data: IMarkData): void
after?(): void
}
export interface IRangeData {
startRange: { node: Node, offset: number },
endRange: { node: Node, offset: number }
}
export interface ConstructorOptions {
tagName?: string
debug?: boolean
}
export interface CreateOptions {
selection?: Selection
}
}
declare class Mark {
constructor(textareaElem: HTMLElement | null, options?: Mark.ConstructorOptions)
public getContent(): string
public innerText(): string
public mark(type: string, options?: Mark.IOptions): Mark.IMarkData
public automark(list: Array<Mark.IMarkData>, options?: Mark.ISearchOptions): void
public create(tagName?: string, options?: Mark.CreateOptions): NodeListOf<HTMLElement>
private textareaElem: HTMLElement
private innerData: Mark.IOptions
private _mark(type: string): Mark.IMarkData
private _getElems(): NodeListOf<HTMLElement>
private _setElems(elems: NodeListOf<HTMLElement>, data: Mark.IMarkData): void
private _drawExchange(data: Mark.IMarkData): void
private _getData(startElem: HTMLElement, endElem: HTMLElement): Mark.IData
private _getRangeData(startOffset: number, endOffset: number): Mark.IRangeData
}
export = Mark