-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheditor.d.ts
More file actions
78 lines (65 loc) · 1.88 KB
/
editor.d.ts
File metadata and controls
78 lines (65 loc) · 1.88 KB
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
70
71
72
73
74
75
76
77
78
/// <reference types="codemirror" />
declare function Editor(options: Editor.Options): void
declare class Editor<TElement = HTMLElement> {
constructor(options: Editor.Options<TElement>)
element: TElement
options: Editor.Options<TElement>
codemirror: CodeMirror.Editor
toolbar: Record<string, HTMLAnchorElement | HTMLElement>
private _rendered: TElement
/**
* Render editor to the given element.
*/
render(el?: TElement): void
createToolbar(items: Toolbar[]): HTMLDivElement
createStatusbar(items: string[]): HTMLDivElement
/**
* Get or set the text content.
*/
value(val?: any): any
/**
* Bind instance methods for exports.
*/
toggleBold(): void
toggleItalic(): void
toggleBlockquote(): void
toggleUnOrderedList(): void
toggleOrderedList(): void
drawLink(): void
drawImage(): void
undo(): void
redo(): void
togglePreview(): void
toggleFullScreen(): void
}
declare namespace Editor {
interface Toolbar {
name: string
action: any
}
type Toolbars = (string | Toolbar)[]
interface Options<TElement> {
element: TElement
toolbar?: false | Toolbar[]
status?: false | string[]
actions?: CodeMirror.CommandActions
shortcuts?: Record<string, (editor: Editor) => void>
}
let toolbar: Toolbars
/**
* Default markdown render.
*/
function markdown(text: any): any
function toggleBold(editor: Editor): void
function toggleItalic(editor: Editor): void
function toggleBlockquote(editor: Editor): void
function toggleUnOrderedList(editor: Editor): void
function toggleOrderedList(editor: Editor): void
function drawLink(editor: Editor): void
function drawImage(editor: Editor): void
function undo(editor: Editor): void
function redo(editor: Editor): void
function togglePreview(editor: Editor): void
function toggleFullScreen(editor: Editor): void
}
declare let toolbar: Editor.Toolbars