mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge pull request #3052 from kalibrr/ckeditor
Add methods for CKEDITOR.{plugins, dialog, widgets.repository}
This commit is contained in:
@@ -251,4 +251,53 @@ function test_dom_window() {
|
||||
var size = win.getViewPaneSize();
|
||||
alert(size.width);
|
||||
alert(size.height);
|
||||
}
|
||||
}
|
||||
|
||||
function test_adding_dialog_by_path() {
|
||||
CKEDITOR.dialog.add( 'abbrDialog', this.path + 'dialogs/abbr.js' );
|
||||
}
|
||||
|
||||
function test_adding_dialog_by_definition() {
|
||||
CKEDITOR.dialog.add( 'abbrDialog', function ( editor: CKEDITOR.editor ) {
|
||||
return {
|
||||
title: 'Abbreviation Properties',
|
||||
minWidth: 400,
|
||||
minHeight: 200,
|
||||
|
||||
contents: [
|
||||
{
|
||||
id: 'tab-basic',
|
||||
label: 'Basic Settings',
|
||||
elements: <any[]>[]
|
||||
},
|
||||
{
|
||||
id: 'tab-adv',
|
||||
label: 'Advanced Settings',
|
||||
elements: []
|
||||
}
|
||||
]
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function test_adding_plugin() {
|
||||
CKEDITOR.plugins.add( 'abbr', {
|
||||
icons: 'abbr',
|
||||
init: function( editor: CKEDITOR.editor ) {
|
||||
// empty logic
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function test_adding_widget() {
|
||||
function wrapper(editor: CKEDITOR.editor) {
|
||||
editor.widgets.add("widgetty", {
|
||||
button: "Activate widgetty",
|
||||
template: "<imaginary-element>",
|
||||
dialog: "widgetty",
|
||||
init: function() {
|
||||
// no logic
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+155
-1
@@ -614,11 +614,134 @@ declare module CKEDITOR {
|
||||
|
||||
|
||||
module widget {
|
||||
class repository {
|
||||
interface IWidget {
|
||||
allowedContent: any;
|
||||
button: string;
|
||||
contentForms: Object;
|
||||
contentTransformations: Object;
|
||||
data: Function;
|
||||
defaults: Object;
|
||||
dialog: String;
|
||||
downcast: any; // should be string | Function
|
||||
downcasts: Object;
|
||||
draggable: boolean;
|
||||
editables: Object;
|
||||
init: Function;
|
||||
inline: Boolean;
|
||||
insert: Function;
|
||||
mask: Boolean;
|
||||
name: String;
|
||||
parts: Object;
|
||||
pathName: string;
|
||||
requiredContent: any;
|
||||
styleToAllowedContentRules: Function;
|
||||
styleableElements: string;
|
||||
template: string;
|
||||
upcast: any; // should be string | Function
|
||||
upcasts: Object;
|
||||
|
||||
addClass(className: string): void;
|
||||
applyStyle(style: any): void; // any should be CKEDITOR.style
|
||||
capture(): void;
|
||||
checkStyleActive(style: any): boolean; // any should be CKEDITOR.style
|
||||
define(name: string, meta: {errorProof?: boolean}): void;
|
||||
destroy(offline?: boolean): void;
|
||||
destroyEditable(editableName:string, offline?: boolean): void;
|
||||
edit(): boolean;
|
||||
fire(eventName: string, data?: Object, editor?: editor): any; // should be boolean | Object
|
||||
fireOnce(eventName: string, data?: Object, editor?: editor): any; // should be boolean | Object
|
||||
focus(): void;
|
||||
getClasses(): Object;
|
||||
hasClass(className: string, Whether: boolean): void;
|
||||
hasListeners(eventName: string): boolean;
|
||||
initEditable(editableName: string, definition: any): boolean; // any should be CKEDITOR.plugins.widget.nestedEditable.definition
|
||||
isInited(): boolean;
|
||||
isReady(): boolean;
|
||||
on(eventName: string, listenerFunction: Function,
|
||||
scopeObj: Object, listenerData: Object, priority: number): Object;
|
||||
once(): void;
|
||||
removeAllListeners(): void;
|
||||
removeClass(className: string): void;
|
||||
removeListener(evnetName: string, listenerFunction: Function): void;
|
||||
removeStyle(style: any): void; // any should be CKEDITOR.style
|
||||
setData(keyOrData: any, value?: Object): IWidget; // any should be string | Object
|
||||
setFocused(selected: boolean): IWidget;
|
||||
setSelected(selected: boolean): IWidget;
|
||||
toFeature(): any; // should be CKEDITOR.feature
|
||||
updateDragHandlerPosition(): void;
|
||||
}
|
||||
|
||||
interface IWidgetDefinition {
|
||||
allowedContent?: any;
|
||||
button?: string;
|
||||
contentForms?: Object;
|
||||
contentTransformations?: Object;
|
||||
data?: Function;
|
||||
defaults?: Object;
|
||||
dialog?: String;
|
||||
downcast?: any; // should be string | Function
|
||||
downcasts?: Object;
|
||||
draggable?: boolean;
|
||||
edit?: Function;
|
||||
editables?: Object;
|
||||
init?: Function;
|
||||
inline?: Boolean;
|
||||
insert?: Function;
|
||||
mask?: Boolean;
|
||||
name?: String;
|
||||
parts?: Object;
|
||||
pathName?: string;
|
||||
requiredContent?: any;
|
||||
styleToAllowedContentRules?: Function;
|
||||
styleableElements?: string;
|
||||
template?: string;
|
||||
upcast?: any; // should be string | Function
|
||||
upcasts?: Object;
|
||||
toFeature?(): any; // should be CKEDITOR.feature
|
||||
}
|
||||
|
||||
class repository {
|
||||
add(name: string, widgetDef: IWidgetDefinition): void;
|
||||
addUpcastCallback(callback: Function): void;
|
||||
capture(): void;
|
||||
checkSelection(): void;
|
||||
checkWidgets(options?: {initOnlyNew?: boolean; focusInited?: boolean}): void;
|
||||
define(name: string, meta?: {errorProof?: boolean}): void;
|
||||
del(widget: IWidget): void;
|
||||
destroy(widget: IWidget, offline?: boolean): void;
|
||||
destroyAll(offline?: boolean): void;
|
||||
finalizeCreation(container: any): void;
|
||||
fire(eventName: string, data: Object, editor: editor): any; // should be boolean | Object
|
||||
getByElement(element: any, checkWrapperOnly: boolean): IWidget;
|
||||
hasListeners(eventName: string): boolean;
|
||||
initOn(element: any, widgetDef?: IWidgetDefinition, startupData?: Object): IWidget;
|
||||
initOnAll(container?: any): IWidget[];
|
||||
on(eventName: string, listenerFunction: Function, scopeObj?: Object, listenerData?: Object, priority?: number): Object;
|
||||
once(): void;
|
||||
parseElementClasses(classes: string): Object;
|
||||
removeAllListeners(eventName: string, listenerFunction: Function): void;
|
||||
wrapElement(element: any, widgetName?: string): any;
|
||||
}
|
||||
}
|
||||
|
||||
interface IPluginDefinition {
|
||||
hidpi?: boolean;
|
||||
lang?: any; // should be string | string[]
|
||||
requires?: any; // should be string | string[]a
|
||||
afterInit?(editor: editor): any;
|
||||
beforeInit?(editor: editor): any;
|
||||
init?(editor: editor): any;
|
||||
onLoad?(): any;
|
||||
}
|
||||
|
||||
function add(name: string, definition?: IPluginDefinition): void;
|
||||
function addExternal(name: string, path: string, fileName: string): void;
|
||||
function get(name: string): any;
|
||||
function getFilePath(name: string): string;
|
||||
function getPath(name: string): string;
|
||||
function load(name: string, callback: string, scope: any): void;
|
||||
function setLang(pluginName: string, languageCode: string, languageEntries: any): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -963,4 +1086,35 @@ declare module CKEDITOR {
|
||||
addFocusable(element: CKEDITOR.dom.element, index: number): void;
|
||||
}
|
||||
|
||||
module tools {
|
||||
var callFunction: Function;
|
||||
}
|
||||
|
||||
module dialog {
|
||||
interface IDialogDefinition {
|
||||
buttons?: any[];
|
||||
contents?: any[];
|
||||
height?: number;
|
||||
minHeight?: number;
|
||||
minWidth?: number;
|
||||
onCancel?: Function;
|
||||
onLoad?: Function;
|
||||
onOk?: Function;
|
||||
onShow?: Function;
|
||||
resizable?: number;
|
||||
title?: string;
|
||||
width?: number;
|
||||
}
|
||||
|
||||
function add(name: string, path: string): void;
|
||||
function add(name: string, dialogDefinition: IDialogDefinition): void;
|
||||
function addIframe(name: string, title: string, minWidth: number,
|
||||
minHeight: number, onContentLoad: Function, userDefinition: any): void;
|
||||
function addUIElement(typeName: string, builder: Function): void;
|
||||
function cancelButton(): void;
|
||||
function exists(name: string): void;
|
||||
function getCurrent(): void;
|
||||
function isTabEnabled(editor: editor, dialogName: string, tabName: string): boolean;
|
||||
function okButton(): void;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user