diff --git a/ckeditor/ckeditor.d.ts b/ckeditor/ckeditor.d.ts index dd61e57d3..ac036be5d 100644 --- a/ckeditor/ckeditor.d.ts +++ b/ckeditor/ckeditor.d.ts @@ -1,4 +1,4 @@ -// Type definitions for CKEditor +// Type definitions for CKEditor // Project: http://ckeditor.com/ // Definitions by: Ondrej Sevcik // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -83,8 +83,7 @@ declare module CKEDITOR { function inline(element: HTMLElement, instanceConfig?: config): editor; function inlineAll(): void; function loadFullCore(): void; - function replace(element: string, config?: config): editor; - function replace(element: HTMLTextAreaElement, config?: config): editor; + function replace(element: string | HTMLTextAreaElement, config?: config): editor; function replaceAll(className?: string): void; function replaceAll(assertionFunction: (textarea: HTMLTextAreaElement, config: config) => boolean): void; @@ -168,7 +167,7 @@ declare module CKEDITOR { // Properties type: number; - // Methods + // Methods constructor(element: string, ownerDocument?: document); constructor(element: HTMLElement, ownerDocument?: document); addClass(className: string): void; @@ -292,7 +291,7 @@ declare module CKEDITOR { document: document; root: element; clone(): range; - collapse(toStart?: boolean): Boolean; + collapse(toStart?: boolean): boolean; cloneContents(): documentFragment; deleteContents(mergeThen?: boolean): void; extractContents(mergeThen?: boolean): documentFragment; @@ -391,8 +390,8 @@ declare module CKEDITOR { constructor(range: range); getNextParagraph(blockTag?: string): element; activeFilter: filter; - enforceRealBlocks: Boolean; - enlargeBr: Boolean; + enforceRealBlocks: boolean; + enlargeBr: boolean; filter: filter; } @@ -557,37 +556,264 @@ declare module CKEDITOR { groups?: string[]; } - // Currently very incomplete. See here for all options that should be included: - // http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-fileTools_defaultFileName + module config { + interface styleObject { + name?: string; + element: string; + attributes?: Object; + styles?: Object; + overrides?: Object; + } + } + + // Currently very incomplete. See here for all options that should be included: + // http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-fileTools_defaultFileName interface config { - allowedContent?: string | boolean; - colorButton_enableMore?: boolean; + allowedContent?: boolean | string | Object | CKEDITOR.style; + autoEmbed_widget?: string | Function; + autoGrow_bottomSpace?: number; + autoGrow_maxHeight?: number; + autoGrow_minHeight?: number; + autoGrow_onStartup?: boolean; + autoUpdateElement?: boolean; + + baseFloatZIndex?: number; + baseHref?: string; + basicEntities?: boolean; + blockedKeystrokes?: number[]; + bodyClass?: string; + bodyId?: string; + browserContextMenuOnCtrl?: boolean; + + clipboard_defaultContentType?: string; // html | text + codeSnippet_codeClass?: string; + codeSnippet_languages?: Object; + coceSnippet_theme?: string; + colorButton_backStyle?: config.styleObject; colorButton_colors?: string; + colorButton_enableMore?: boolean; + colorButton_foreStyle?: config.styleObject; contentsCss?: string | string[]; contentsLangDirection?: string; + contentsLanguage?: string; + coreStyles_bold?: config.styleObject; + coreStyles_italic?: config.styleObject; + coreStyles_strike?: config.styleObject; + coreStyles_subscript?: config.styleObject; + coreStyles_superscript?: config.styleObject; + coreStyles_underline?: config.styleObject; customConfig?: string; + + dataIndentationChars?: string; + defaultLanguage?: string; + devtools_styles?: string; + devtools_textCallback?: Function; + dialog_backgroundCoverColor?: string; + dialog_backgroundCoverOpacity?: number; + dialog_buttonsOrder?: string; + dialog_magnetDistance?: number; + dialog_noConfirmCancel?: boolean; + dialog_startupFocusTab?: boolean; + disableNativeSpellChecker?: boolean; + disableNativeTableHandles?: boolean; + disableNativeObjectResizing?: boolean; + disableNativeReadonlySTyling?: boolean; + disallowedContent?: string | Object; // Documentation calls it CKEDITOR.filter.disallowedContentRules, but it is just a non-governed object or string. + div_wrapTable?: boolean; + docType?: string; + + emailProtection?: string; + embed_provider?: string; + enableTabKeyTools?: boolean; enterMode?: number; + entities?: boolean; + entities_additional?: string; + entities_greek?: boolean; + entities_latin?: boolean; + entities_processNumerical?: boolean | string; + extraAllowedContent?: string | Object; extraPlugins?: string; - font_names?: string; - font_defaultLabel?: string; - fontSize_sizes?: string; + + fileTools_defaultFileName?: string; + filebrowserBrowseUrl?: string; + filebrowserFlashBrowseUrl?: string; + filebrowserFlashUploadUrl?: string; + filebrowserImageBrowseLinkUrl?: string; + filebrowserImageBrowseUrl?: string; + filebrowserImageUploadUrl?: string; + filebrowserUploadUr?: string; + filebrowserWindowFeatures?: string; + filebrowserWindowHeight?: number | string; + filebrowserWindowWidth?: number | string; + fillEmptyBlocks?: boolean | Function; + find_highlight?: config.styleObject; + flashAddEmbedTag?: boolean; + flashConvertOnEdit?: boolean; + flashEmbedTagOnly?: boolean; + floatSpaceDockedOffsetX?: number; + floatSpaceDockedOffsetY?: number; + floatSpacePinnedOffsetX?: number; + floatSpacePinnedOffsetY?: number; + floatSpacePreferRight?: boolean; fontSize_defaultLabel?: string; + fontSize_sizes?: string; + fontSize_style?: config.styleObject; + font_defaultLabel?: string; + font_names?: string; + font_style?: config.styleObject; + forceEnterMode?: boolean; + forcePasteAsPlainText?: boolean; + forceSimpleAmpersand?: boolean; + format_address?: config.styleObject; + format_div?: config.styleObject; + format_h1?: config.styleObject; + format_h2?: config.styleObject; + format_h3?: config.styleObject; + format_h4?: config.styleObject; + format_h5?: config.styleObject; + format_h6?: config.styleObject; + format_p?: config.styleObject; + format_pre?: config.styleObject; + format_tags?: string; + fullPage?: boolean; + + grayt_autoStartup?: boolean; + height?: string | number; htmlEncodeOutput?: boolean; + + ignoreEmptyParagraph?: boolean; + image2_alignClasses?: string[]; + image2_captionedClass?: string; + image2_disableResizer?: boolean; + image2_prefillDimensions?: boolean; + imageUploadUrl?: string; + image_prefillDimensions?: boolean; + image_previewText?: string; + image_removeLinkByEmptyUrl?: boolean; + indentClasses?: string[]; + indentOffset?: number; + indentUnit?: string; + + jqueryOverrideVal?: boolean; + justifyClasses?: string[]; + + keystrokes?: any[]; // Number, string pair really... silly structure... they should fix this. + language?: string; - on?: any; + language_list?: string[]; + linkJavaScriptLinksAllowed?: boolean; + linkShowAdvancedTab?: boolean; + linkShowTargetTab?: boolean; + + magicline_color?: string + magicline_everywhere?: boolean; + magicline_holdDistance?: number; + magicline_keystrokeNext?: number; + magicline_keystrokePrevious?: number; + magicline_tabuList?: number; + magicline_triggerOffset?: number; + mathJaxLib?: string; + menu_groups?: string; + menu_subMenuDelay?: string; + + newpage_html?: string; + notification_duration?: number; + + on?: editor.eventObject; + + pasteFilter?: string; + pasteFromWordCleanupFile?: string; + pasteFromWordNumberedHeadingToList?: boolean; + pasteFromWordPromptCleanup?: boolean; + pasteFromWordRemoveFontStyles?: boolean; + pasteFromWorkRemoveStyles?: boolean; plugins?: string; - startupFocus?: boolean; - startupMode?: string; - removeButtons?: string; - removePlugins?: string; - toolbar?: any; - toolbarGroups?: toolbarGroups[]; - toolbarLocation?: string; + protectedSource?: RegExp[]; + readOnly?: boolean; + removeButtons?: string; + removeDialogTabs?: string; + removeFormatAttributes?: string; + removeFormatTags?: string; + removePlugins?: string; + resize_dir?: string; + resize_enabled?: boolean; + resize_maxHeight?: number; + resize_maxWidth?: number; + resize_minHeight?: number; + resize_minWidth?: number; + + scayt_autoStartup?: boolean; + scayt_contextCommands?: string; + scayt_contextMenuItemsOrder?: string; + scayt_customDictionaryIds?: string; + scayt_customerId?: string; + scayt_disableOptionsStorage?: string | string[]; + scayt_elementsToIgnore?: string; + scayt_handleCheckDirty?: string; + scayt_handleUndoRedo?: string; + scayt_ignoreAllCapsWords?: boolean; + scayt_ignoreDomainNames?: boolean; + scayt_ignoreWordsWithMixedCases?: boolean; + scayt_ignoreWordsWithNumbers?: boolean; + scayt_inlineModeImmediateMarkup?: boolean; + scayt_maxSuggestions?: number; + scayt_minWordLength?: number; + scayt_moreSuggestions?: string; + scayt_multiLanguageMode?: boolean; + scayt_multiLanguageStyles?: Object; + scayt_sLang?: string; + scayt_serviceHost?: string; + scayt_servicePath?: string; + scayt_servicePort?: string; + scayt_serviceProtocol?: string; + scayt_srcUrl?: string; + scayt_uiTabs?: string; + scayt_userDictionaryName?: string; + + sharedSpaces?: Object; shiftEnterMode?: number; skin?: string; + smiley_columns?: number; + smiley_descriptions?: string[]; + smiley_images?: string[]; + smiley_path?: string; + sourceAreaTabSize?: number; + specialChars?: any[]; // Seems to be an array of a string, or a two-element string-array + startupFocus?: boolean; + startupMode?: string; + startupOutlineBlocks?: boolean; + startupShowBorders?: boolean; + stylesSet?: string | boolean | config.styleObject[]; + stylesheetParser_skipSelectors?: RegExp; + stylesheetParser_validSelectors?: RegExp; + + tabIndex?: number; + tabSpaces?: number; + templates?: string; + templates_files?: Object; + templates_replaceContent?: boolean; + title?: string | boolean; + toolbar?: string | (string[])[]; + toolbarCanCollapse?: boolean; + toolbarGroupCycling?: boolean; + toolbarGroups?: toolbarGroups[]; + toolbarLocation?: string; + toolbarStartupExpanded?: boolean; + + uiColor?: string; + undoStackSize?: number; + uploadUrl?: string; + useComputedState?: boolean; + width?: string | number; + wsc_cmd?: string; + wsc_customDictionaryIds?: string; + wsc_customLoaderScript?: string; + wsc_customerId?: string; + wsc_lang?: string; + wsc_userDictionaryName?: string; } @@ -636,116 +862,152 @@ declare module CKEDITOR { module widget { - interface IWidget { - allowedContent: any; - button: string; - contentForms: Object; - contentTransformations: Object; - data: Function; - defaults: Object; - dialog: String; - downcast: 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: 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: string | {}, value?: Object): IWidget; - setFocused(selected: boolean): IWidget; - setSelected(selected: boolean): IWidget; - toFeature(): any; // should be CKEDITOR.feature - updateDragHandlerPosition(): void; + module nestedEditable { + interface definition { + allowedContent?: any; + pathName?: string; + selector?: string; + } } - interface IWidgetDefinition { + class nestedEditable extends CKEDITOR.dom.element { + editor: CKEDITOR.editor; + enterMode: number; + filter: CKEDITOR.filter; + shiftEnterMode: number; + + constructor(editor: CKEDITOR.editor, element: CKEDITOR.dom.element, config: { filter?: CKEDITOR.filter }); + getData(): string; + setData(data: string): void; + } + + + interface definition { allowedContent?: any; button?: string; contentForms?: Object; contentTransformations?: Object; - data?: Function; + data?: Object | Function; defaults?: Object; - dialog?: String; + dialog?: string; downcast?: string | Function; downcasts?: Object; draggable?: boolean; edit?: Function; editables?: Object; init?: Function; - inline?: Boolean; + inline?: boolean; insert?: Function; - mask?: Boolean; - name?: String; + mask?: boolean; + name?: string; parts?: Object; pathName?: string; - requiredContent?: any; + requiredContent?: string | CKEDITOR.style; styleToAllowedContentRules?: Function; styleableElements?: string; - template?: string; + template?: string | CKEDITOR.template; upcast?: string | Function; + upcastPriority?: number; upcasts?: Object; - toFeature?(): any; // should be CKEDITOR.feature + + toFeature?(): CKEDITOR.feature; } class repository { - add(name: string, widgetDef: IWidgetDefinition): void; + add(name: string, widgetDef: CKEDITOR.plugins.widget.definition): 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; + checkWidgets(options?: { initOnlyNew?: boolean; focusInited?: boolean }): void; + define(name: string, meta?: { errorProof?: boolean }): void; + del(widget: CKEDITOR.plugins.widget): void; + destroy(widget: CKEDITOR.plugins.widget, 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; + getByElement(element: any, checkWrapperOnly: boolean): CKEDITOR.plugins.widget; 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; + initOn(element: any, widgetDef?: CKEDITOR.plugins.widget.definition, startupData?: Object): CKEDITOR.plugins.widget; + initOnAll(container?: any): CKEDITOR.plugins.widget[]; + on(eventName: string, listenerFunction: Function, scopeObj?: Object, listenerData?: Object, priority?: number): any; once(): void; - parseElementClasses(classes: string): Object; + parseElementClasses(classes: string): any; removeAllListeners(eventName: string, listenerFunction: Function): void; wrapElement(element: any, widgetName?: string): any; } } + class widget implements CKEDITOR.plugins.widget.definition { + allowedContent: any; + button: string; + contentForms: any; + contentTransformations: any; + data: any; + dataReady: boolean; + defaults: any; + definition: CKEDITOR.plugins.widget.definition; + dialog: string; + downcast: string | Function; + downcasts: any; + draggable: boolean; + editables: any; + editor: CKEDITOR.editor; + element: CKEDITOR.dom.element; + focusedEditable: CKEDITOR.plugins.widget.nestedEditable + id: number; + init: Function; + inited: boolean; + inline: boolean; + insert: Function; + mask: boolean; + name: string; + parts: any; + pathName: string; + ready: boolean; + repository: CKEDITOR.plugins.widget.repository; + requiredContent: string | CKEDITOR.style; + styleToAllowedContentRules: Function; + styleableElements: string; + template: CKEDITOR.template; + upcast: string | Function; + upcastPriority: number; + upcasts: any; + wrapper: CKEDITOR.dom.element; + + constructor(widgetsRepo: CKEDITOR.plugins.widget.repository, id: number, element: CKEDITOR.dom.element, widgetDef: CKEDITOR.plugins.widget.definition, starupData?: Object); + + addClass(className: string): void; + applyStyle(style: CKEDITOR.style): void; + capture(): void; + checkStyleActive(style: CKEDITOR.style): boolean; + 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?: CKEDITOR.editor): any; + fireOnce(eventName: string, data?: Object, editor?: CKEDITOR.editor): any; + focus(): void; + getClasses(): any; + hasClass(className: string, Whether: boolean): void; + hasListeners(eventName: string): boolean; + initEditable(editableName: string, definition: CKEDITOR.plugins.widget.nestedEditable.definition): boolean; + isInited(): boolean; + isReady(): boolean; + on(eventName: string, listenerFunction: Function, + scopeObj?: Object, listenerData?: Object, priority?: number): any; + once(): void; + removeAllListeners(): void; + removeClass(className: string): void; + removeListener(eventName: string, listenerFunction: Function): void; + removeStyle(style: CKEDITOR.style): void; + setData(keyOrData: string | Object, value: Object): CKEDITOR.plugins.widget; + setFocused(selected: boolean): CKEDITOR.plugins.widget; + setSelected(selected: boolean): CKEDITOR.plugins.widget; + toFeature(): CKEDITOR.feature; + updateDragHandlerPosition(): void; + } + interface IPluginDefinition { hidpi?: boolean; lang?: string | string[]; @@ -789,14 +1051,14 @@ declare module CKEDITOR { langCode: string; mode: string; name: string; - plugins: Object; + plugins: any; readOnly: boolean; shiftEnterMode: number; status: string; tabIndex: number; - templates: Object; + templates: any; title: any; - toolbar: Object; + toolbar: any; ui: ui; widgets: plugins.widget.repository; window: dom.window; @@ -865,6 +1127,97 @@ declare module CKEDITOR { updateElement(): void; } + module editor { + interface eventObject { + activeEnterModeChange?: (evt: CKEDITOR.eventInfo) => void; + activeFilterChange?: (evt: CKEDITOR.eventInfo) => void; + afterCommandExec?: (evt: CKEDITOR.eventInfo) => void; + afterInsertHtml?: (evt: CKEDITOR.eventInfo) => void; + afterPaste?: (evt: CKEDITOR.eventInfo) => void; + afterSetData?: (evt: CKEDITOR.eventInfo) => void; + afterUndoImage?: (evt: CKEDITOR.eventInfo) => void; + ariaEditorHelpLabel?: (evt: CKEDITOR.eventInfo) => void; + ariaWidget?: (evt: CKEDITOR.eventInfo) => void; + autogrow?: (evt: CKEDITOR.eventInfo) => void; + + beforeCommandExec?: (evt: CKEDITOR.eventInfo) => void; + beforeGetData?: (evt: CKEDITOR.eventInfo) => void; + beforeModuleUnload?: (evt: CKEDITOR.eventInfo) => void; + beforeSetMode?: (evt: CKEDITOR.eventInfo) => void; + blur?: (evt: CKEDITOR.eventInfo) => void; + + change?: (evt: CKEDITOR.eventInfo) => void; + configLoaded?: (evt: CKEDITOR.eventInfo) => void; + contentDirChanged?: (evt: CKEDITOR.eventInfo) => void; + contentDom?: (evt: CKEDITOR.eventInfo) => void; + contentDomInvalidated?: (evt: CKEDITOR.eventInfo) => void; + contentDomUnload?: (evt: CKEDITOR.eventInfo) => void; + customConfigLoaded?: (evt: CKEDITOR.eventInfo) => void; + + dataFiltered?: (evt: CKEDITOR.eventInfo) => void; + dataReady?: (evt: CKEDITOR.eventInfo) => void; + destroy?: (evt: CKEDITOR.eventInfo) => void; + dialogHide?: (evt: CKEDITOR.eventInfo) => void; + dialogShow?: (evt: CKEDITOR.eventInfo) => void; + dirChanged?: (evt: CKEDITOR.eventInfo) => void; + doubleckick?: (evt: CKEDITOR.eventInfo) => void; + dragend?: (evt: CKEDITOR.eventInfo) => void; + dragstart?: (evt: CKEDITOR.eventInfo) => void; + drop?: (evt: CKEDITOR.eventInfo) => void; + + elementsPathUpdate?: (evt: CKEDITOR.eventInfo) => void; + + fileUploadRequest?: (evt: CKEDITOR.eventInfo) => void; + fileUploadResponse?: (evt: CKEDITOR.eventInfo) => void; + floatingSpaceLayout?: (evt: CKEDITOR.eventInfo) => void; + focus?: (evt: CKEDITOR.eventInfo) => void; + + getData?: (evt: CKEDITOR.eventInfo) => void; + getSnapshot?: (evt: CKEDITOR.eventInfo) => void; + + insertElement?: (evt: CKEDITOR.eventInfo) => void; + insertHtml?: (evt: CKEDITOR.eventInfo) => void; + insertText?: (evt: CKEDITOR.eventInfo) => void; + insanceReady?: (evt: CKEDITOR.eventInfo) => void; + + key?: (evt: CKEDITOR.eventInfo) => void; + + langLoaded?: (evt: CKEDITOR.eventInfo) => void; + loadSnapshot?: (evt: CKEDITOR.eventInfo) => void; + loaded?: (evt: CKEDITOR.eventInfo) => void; + lockSnapshot?: (evt: CKEDITOR.eventInfo) => void; + maximize?: (evt: CKEDITOR.eventInfo) => void; + menuShow?: (evt: CKEDITOR.eventInfo) => void; + mode?: (evt: CKEDITOR.eventInfo) => void; + + notificationHide?: (evt: CKEDITOR.eventInfo) => void; + notificationShow?: (evt: CKEDITOR.eventInfo) => void; + notificationUpdate?: (evt: CKEDITOR.eventInfo) => void; + + paste?: (evt: CKEDITOR.eventInfo) => void; + pluginsLoaded?: (evt: CKEDITOR.eventInfo) => void; + + readOnly?: (evt: CKEDITOR.eventInfo) => void; + removeFormatCleanup?: (evt: CKEDITOR.eventInfo) => void; + required?: (evt: CKEDITOR.eventInfo) => void; + resize?: (evt: CKEDITOR.eventInfo) => void; + + save?: (evt: CKEDITOR.eventInfo) => void; + saveSnapshot?: (evt: CKEDITOR.eventInfo) => void; + selectionChange?: (evt: CKEDITOR.eventInfo) => void; + setData?: (evt: CKEDITOR.eventInfo) => void; + stylesSet?: (evt: CKEDITOR.eventInfo) => void; + + template?: (evt: CKEDITOR.eventInfo) => void; + toDataFormat?: (evt: CKEDITOR.eventInfo) => void; + toHtml?: (evt: CKEDITOR.eventInfo) => void; + + unlockSnapshot?: (evt: CKEDITOR.eventInfo) => void; + updateSnapshot?: (evt: CKEDITOR.eventInfo) => void; + + widgetDefinition?: (evt: CKEDITOR.eventInfo) => void; + } + } interface eventInfo { data: any; @@ -919,7 +1272,7 @@ declare module CKEDITOR { modes?: Object; startDisabled?: boolean; exec(editor: editor, data?: Object): boolean; - refresh? (editor: editor, path: dom.elementPath): void; + refresh?(editor: editor, path: dom.elementPath): void; } @@ -935,6 +1288,182 @@ declare module CKEDITOR { addHandler(type: Object, handler: Object): void; } + module ui { + module dialog { + class uiElement { + eventProcessors: any; + + constructor(dialog: CKEDITOR.dialog, elementDefinition: CKEDITOR.dialog.definition.uiElement, htmlList: any[], nodeNameArg?: Function | string, stylesArg?: Function | Object, attributesArg?: Function | Object, contentsArg?: Function | string); // Not sure that the htmlList array type is right. + + accessKeyDown(dialog: CKEDITOR.dialog, key: string): void; + accessKeyUp(dialog: CKEDITOR.dialog, key: string): void; + disable(): void; + enable(): void; + focus(): CKEDITOR.ui.dialog.uiElement; + getDialog(): CKEDITOR.dialog; + getElement(): CKEDITOR.dom.element; + getInputElement(): CKEDITOR.dom.element; + getValue(): any; + isChanged(): boolean; + isEnabled(): boolean; + isFocusable(): boolean; + isVisible(): boolean; + registerEvents(definition: CKEDITOR.dialog.definition.uiElement): CKEDITOR.ui.dialog.uiElement; + selectParentTab(): CKEDITOR.ui.dialog.uiElement; + setValue(value: Object, noChangeEvent: boolean): CKEDITOR.ui.dialog.uiElement; + + // Change event? + } + + + class button extends uiElement { + constructor(dialog: CKEDITOR.dialog, elementDefinition: CKEDITOR.dialog.definition.uiElement, htmlList: any[]); + + accessKeyDown(): void; + accessKeyUp(): void; + click(): any; + } + + + class checkbox extends uiElement { + constructor(dialog: CKEDITOR.dialog, elementDefinition: CKEDITOR.dialog.definition.uiElement, htmlList: any[]); + + accessKeyUp(): void; + getInputElement(): CKEDITOR.dom.element; + getValue(): boolean; + setValue(checked: boolean, noChangeEvent: boolean): any; // returns void according to doc, but cannot override base class like that + } + + + class fieldset extends uiElement { + constructor(dialog: CKEDITOR.dialog, childObjList: any[], childHtmlList: any[], htmlList: any[], elementDefinition: CKEDITOR.dialog.definition.uiElement); + } + + + class file extends CKEDITOR.ui.dialog.labeledElement { + constructor(dialog: CKEDITOR.dialog, elementDefinition: CKEDITOR.dialog.definition.uiElement, htmlList: any[]); + + getAction(): string; + getInputElement(): CKEDITOR.dom.element; + registerEvents(definition: Object): CKEDITOR.ui.dialog.file; + reset(): void; + setInitValue(): void; + submit(): CKEDITOR.ui.dialog.file; + } + + + class fileButton extends CKEDITOR.ui.dialog.button { + constructor(dialog: CKEDITOR.dialog, elementDefinition: CKEDITOR.dialog.definition.uiElement, htmlList: any[]); + + // formLoaded event ?? + } + + + class hbox extends uiElement { + constructor(dialog: CKEDITOR.dialog, childObjList: any[], childHtmlList: any[], htmlList: any[], elementDefinition: CKEDITOR.dialog.definition.uiElement); + + getChild(indices: number): CKEDITOR.ui.dialog.uiElement; + getChild(indices: number[]): CKEDITOR.ui.dialog.uiElement[]; + } + + + class html extends uiElement { + constructor(dialog: CKEDITOR.dialog, elementDefinition: CKEDITOR.dialog.definition.uiElement, htmlList: any[]); + + } + + + class iframeElement extends uiElement { + + } + + + class labeledElement extends uiElement { + constructor(dialog: CKEDITOR.dialog, elementDefinition: CKEDITOR.dialog.definition.uiElement, htmlList: any[], contentHtml: Function); + + getLabel(): string; + setlabel(label: string): CKEDITOR.ui.dialog.labeledElement; + } + + + class radio extends CKEDITOR.ui.dialog.labeledElement { + constructor(dialog: CKEDITOR.dialog, elementDefinition: CKEDITOR.dialog.definition.uiElement, htmlList: any[]); + + accessKeyUp(): void; + getValue(): string; + setValue(value: string, noChangeEvent: boolean): any; // returns void according to doc, but cannot override base class like that + } + + + class select extends uiElement { + constructor(dialog: CKEDITOR.dialog, elementDefinition: CKEDITOR.dialog.definition.uiElement, htmlList: any[]); + + add(label: string, value?: string, indexedDB?: number): CKEDITOR.ui.dialog.select; + clear(): CKEDITOR.ui.dialog.select; + getInputElement(): CKEDITOR.dom.element; + remove(index: number): CKEDITOR.ui.dialog.select; + } + + + class textarea extends CKEDITOR.ui.dialog.labeledElement { + constructor(dialog: CKEDITOR.dialog, elementDefinition: CKEDITOR.dialog.definition.uiElement, htmlList: any[]); + } + + + class textInput extends CKEDITOR.ui.dialog.labeledElement { + constructor(dialog: CKEDITOR.dialog, elementDefinition: CKEDITOR.dialog.definition.uiElement, htmlList: any[]); + + accessKeyUp(): void; + focus(): any; // returns void according to doc, but cannot override base class like that + getDirectionMarker(): string; + getInputElement(): CKEDITOR.dom.element; + getValue(): string; + select(): void; + setDirectionMarker(dir: string): void; + setValue(value: string, noChangeEvent: boolean): CKEDITOR.ui.dialog.textInput; + } + } + } + + class dialog { + state: number; + + constructor(editor: Object, dialogName: string); + + addFocusable(element: CKEDITOR.dom.element, index?: number): void; + addPage(contents: Object): void; + click(id: string): Object; + commitContent(): void; + diableButton(id: string): void; + enableButton(id: string): void; + foreach(fn: Function): CKEDITOR.dialog; + getButton(id: string): CKEDITOR.ui.dialog.button; + getContentElement(pageId: string, elementId: string): CKEDITOR.ui.dialog.uiElement; + getElement(): CKEDITOR.dom.element; + getName(): string; + getPageCount(): number; + getParentEditor(): CKEDITOR.editor; + getPosition(): Object; + getSelectedElement(): CKEDITOR.dom.element; + getSize(): Object; + getValueOf(pageId: string, elementId: string): Object; + hide(): void; + hidePage(id: string): void; + layout(): void; + move(x: number, y: number, save: boolean): void; + reset(): CKEDITOR.dialog; + resize(width: number, height: number): void; + selectPage(id: string): void; + setState(state: number): void; + setValueOf(pageId: string, elementId: string, value: Object): void; + setupContent(): void; + show(): void; + showPage(id: string): void; + updateStyle(): void; + + // NOTE: Static methods are added to dialog module + } + module dialog { @@ -943,27 +1472,150 @@ declare module CKEDITOR { interface button extends uiElement { disabled?: boolean; label?: string; - command?: string; - toolbar?: string; + } + + + interface checkbox extends uiElement { + default?: string; + label?: string; + validate?: Function; + } + + + interface content { + accessKey?: string; + elements?: CKEDITOR.dialog.definition.uiElement[]; + id?: string; + label?: string; + title?: string; + } + + + interface file extends labeledElement { + action?: string; + size?: string; + validate?: Function; + } + + + interface fileButton extends uiElement { + filebrowser?: string; + for?: string; + label?: string; + styles?: string; + } + + + interface hbox extends uiElement { + children?: CKEDITOR.ui.dialog.uiElement[]; + height?: number; + padding?: number; + validate?: Function; + widths?: number[]; + } + + + interface html extends uiElement { + html?: string; + } + + + interface labeledElement extends uiElement { + controlStyle?: string; + inputStyle?: string; + label?: string; + labelLayout?: string; + labelStyle?: string; + widths?: number[]; + } + + + interface radio extends labeledElement { + default?: string; + items?: string[] | (string[])[]; + validate?: Function; + } + + + + interface select extends labeledElement { + default?: string; + items?: string[] | (string[])[]; + multiple?: boolean; + size?: number; + validate?: Function; + } + + + + interface textarea extends labeledElement { + bidi?: boolean; + cols?: number; + default?: string; + rows?: number; + validate?: Function; + } + + + interface textInput extends labeledElement { + bidi?: boolean; + default?: string; + maxLength?: number; + size?: number; + validate?: Function; } interface uiElement { align?: string; className?: string; - commit?: Function; + commit?: (widget: CKEDITOR.plugins.widget) => void; id?: string; - onHide?: Function; - onLoad?: Function; - requiredcontent?: any; - setup?: Function; + onHide?: (elem: CKEDITOR.ui.dialog.uiElement) => void; + onLoad?: (elem: CKEDITOR.ui.dialog.uiElement) => void; + onShow?: (elem: CKEDITOR.ui.dialog.uiElement) => void; + requiredcontent?: string | Object | CKEDITOR.style; + setup?: (widget: CKEDITOR.plugins.widget) => void; style?: string; title?: string; type?: string; } + + interface vbox extends uiElement { + children?: CKEDITOR.ui.dialog.uiElement[]; + expand?: boolean; + heights?: number[]; + padding?: number; + styles?: string; + width?: number[]; + } } + interface IDialogDefinition { + buttons?: CKEDITOR.dialog.definition.button[]; + contents?: CKEDITOR.dialog.definition.content[]; + 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: (editor: CKEDITOR.editor) => IDialogDefinition): void; + function addIframe(name: string, title: string, minWidth: number, minHeight: number, onContentLoad?: Function, userDefinition?: Object): void; + function addUIElement(typeName: string, builder: Function): void; + function cancelButton(): void; + function exists(name: string | number): void; // NOTE: documentation says object, but it's an array accessor, so really a string or number will work + function getCurrent(): void; + function isTabEnabled(editor: CKEDITOR.editor, dialogName: string, tabName: string): boolean; + function okButton(): void; } @@ -1002,8 +1654,8 @@ declare module CKEDITOR { id: number; elementNameRules: filterRulesGroup; attributeNameRules: filterRulesGroup; - elementsRules: Object; - attributesRules: Object; + elementsRules: any; + attributesRules: any; textRules: filterRulesGroup; commentRules: filterRulesGroup; rootRules: filterRulesGroup; @@ -1024,7 +1676,7 @@ declare module CKEDITOR { add(rule: Object[], priority: number, options: Object): void; addMany(rules: Object[], priority: number, options: Object): void; findIndex(priority: number): number; - exec(currentValue: Object): Object; + exec(currentValue: Object): any; execOnName(currentName: string): string; } @@ -1047,8 +1699,8 @@ declare module CKEDITOR { class element extends node { constructor(name: string, attributes: Object); name: string; - attributes: Object; - children: Object[]; + attributes: any; + children: any[]; type: number; add(node: node): number; clone(): element; @@ -1072,8 +1724,8 @@ declare module CKEDITOR { class fragment { constructor(); - children: Object[]; - parent: Object; + children: any[]; + parent: any; type: number; fromHtml(fragmentHtml: string, parent?: element, fixingBlock?: string): void; fromHtml(fragmentHtml: string, parent?: string, fixingBlock?: string): void; @@ -1107,41 +1759,10 @@ declare module CKEDITOR { } - interface dialog { - 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; - } module lang { var languages: any; @@ -1150,4 +1771,4 @@ declare module CKEDITOR { function load(languageCode: string, defaultLanguage: string, callback: Function): void; function detect(defaultLanguage: string, probeLanguage: string): string; } -} +} \ No newline at end of file