forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jquery.cleditor.d.ts
98 lines (90 loc) · 2.83 KB
/
jquery.cleditor.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// Type definitions for jQuery CLEditor Plugin 1.4.3
// Project: http://premiumsoftware.net/CLEditor
// Definitions by: Jeffery Grajkowski <https://github.com/pushplay/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
///<reference path="../jquery/jquery.d.ts" />
/**
* An editor is composed of a main div element used to hold a toolbar,
* a text area and an iframe. The toolbar can hold multiple groups
* which in turn hold multiple buttons.
*/
interface CLEditor {
$area: JQuery;
$frame: JQuery;
$main: JQuery;
$toolbar: JQuery;
disabled: boolean;
doc: Document;
options: JQueryCLEditorOptions;
change(handler: Function): CLEditor;
clear(): CLEditor;
disable(disabled: boolean): CLEditor;
execCommand(commands: string, value: any, useCSS?: boolean, button?: any): CLEditor;
focus(): CLEditor;
hidePopups(): CLEditor;
refresh(): CLEditor;
select(): CLEditor;
selectedHTML(): string;
selectedText(): string;
showMessage(message: string, button?: any): CLEditor;
sourceMode(): boolean;
updateFrame(): CLEditor;
updateTextArea(): CLEditor;
}
interface JQueryCLEditorOptions {
width?: number;
height?: number;
controls?: string;
colors?: string;
fonts?: string;
sizes?: string;
styles?: string[][];
useCSS?: boolean;
docType?: string;
docCSSFile?: string;
bodyStyle?: string;
}
interface JQueryCLEditorButtonDefinition {
name: string;
title: string;
css?: any;
image?: string;
stripIndex?: number;
command?: string;
popupName?: string;
popupContent?: string;
getEnabled?: (data: JQueryCLEditorButtonDefinitionEventData) => boolean;
getPressed?: (data: JQueryCLEditorButtonDefinitionEventData) => boolean;
buttonClick?: (event: Event, data: JQueryCLEditorButtonDefinitionEventData) => boolean;
popupClick?: (event: Event, data: JQueryCLEditorButtonDefinitionEventData) => boolean;
}
interface JQueryCLEditorButtonDefinitionEventData {
editor: CLEditor;
button: HTMLElement;
buttonName: string;
popup: HTMLElement;
popupName: string;
command: string;
value: any;
useCSS: boolean;
}
/**
* This object contains global properties and methods used to create
* custom plugins and override built in functionality.
*/
interface JQueryCLEditorStatic {
defaultOptions: JQueryCLEditorOptions;
buttons: JQueryCLEditorButtonDefinition[];
imagesPath: () => string;
}
interface JQueryStatic {
cleditor: JQueryCLEditorStatic;
}
interface JQuery {
/**
* If the cleditor object does not exist for a matched textarea element,
* it will be created using the default options combined with the supplied options.
* This is the core method for creating and selecting cleditor objects.
*/
cleditor(options?: JQueryCLEditorOptions): CLEditor;
}