From 4ee2a16c775c7ba0d69ce919ac968749bd0e57b5 Mon Sep 17 00:00:00 2001 From: stuartlo Date: Mon, 21 May 2018 17:56:18 -0700 Subject: [PATCH 1/8] Update typings to CKEditor v4.9.2 --- types/ckeditor/ckeditor-tests.ts | 12 +- types/ckeditor/index.d.ts | 3510 ++++++++++++++++++------------ 2 files changed, 2172 insertions(+), 1350 deletions(-) diff --git a/types/ckeditor/ckeditor-tests.ts b/types/ckeditor/ckeditor-tests.ts index 1a906bc26e..21288c1f93 100644 --- a/types/ckeditor/ckeditor-tests.ts +++ b/types/ckeditor/ckeditor-tests.ts @@ -6,9 +6,9 @@ function test_CKEDITOR() { CKEDITOR.skinName = 'moono'; CKEDITOR.skinName = 'myskin,/customstuff/myskin/'; var editor = new CKEDITOR.editor(); - if (editor.getSelection().getType() == CKEDITOR.SELECTION_ELEMENT) - if (editor.getSelection().getType() == CKEDITOR.SELECTION_NONE) - if (editor.getSelection().getType() == CKEDITOR.SELECTION_TEXT) + if (editor.getSelection(true).getType() == CKEDITOR.SELECTION_ELEMENT) + if (editor.getSelection(false).getType() == CKEDITOR.SELECTION_NONE) + if (editor.getSelection(true).getType() == CKEDITOR.SELECTION_TEXT) alert(CKEDITOR.basePath); if (CKEDITOR.currentInstance) alert(CKEDITOR.currentInstance.name); @@ -268,11 +268,11 @@ function test_dom_range() { alert(range.collapsed); range.selectNodeContents(range.document.getBody()); range.selectNodeContents(editor.document.getBody()); - alert(range.endContainer.getName()); + alert(range.endContainer.getPrivate()); range.selectNodeContents(editor.document.getBody()); alert(range.endOffset); range.selectNodeContents(editor.document.getBody()); - alert(range.startContainer.getName()); + alert(range.startContainer.getDocument()); range.selectNodeContents(editor.document.getBody()); alert(range.startOffset); } @@ -558,7 +558,7 @@ function test_selection() { var editor = new CKEDITOR.editor(); var testNode = CKEDITOR.document.getById('myElement'); - var selection = editor.getSelection(); + var selection = editor.getSelection(true); var ranges = selection.getRanges(); for (var i = 0, c = ranges.length; i < c; i++) { var range = ranges[i]; diff --git a/types/ckeditor/index.d.ts b/types/ckeditor/index.d.ts index 3370479bff..b6cef62744 100644 --- a/types/ckeditor/index.d.ts +++ b/types/ckeditor/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for CKEditor -// Project: http://ckeditor.com/ +// Type definitions for CKEditor 4.9.2 +// Project: https://ckeditor.com/ckeditor-4/ // Definitions by: Thomas Wittwer +// Stuart Long // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // WORK-IN-PROGRESS: Any contribution support welcomed. @@ -13,101 +14,120 @@ declare namespace CKEDITOR { // Config options var disableAutoInline: boolean; - var disableObjectResizing: boolean; var replaceClass: string; var skinName: string; // Properties - var ALT: number; - var CTRL: number; - var DIALOG_RESIZE_BOTH: number; - var DIALOG_RESIZE_HEIGHT: number; - var DIALOG_RESIZE_NONE: number; - var DIALOG_RESIZE_WIDTH: number; - var DIALOG_STATE_IDLE: number; - var DIALOG_STATE_BUSY: number; - var ELEMENT_MODE_APPENDTO: number; - var ELEMENT_MODE_INLINE: number; - var ELEMENT_MODE_NONE: number; - var ELEMENT_MODE_REPLACE: number; - var END: number; - var ENTER_BR: number; - var ENTER_P: number; - var EVENT_PHASE_AT_TARGET: number; - var EVENT_PHASE_BUBBLING: number; - var EVENT_PHASE_CAPTURING: number; - var LINEUTILS_AFTER: number; - var LINEUTILS_BEFORE: number; - var LINEUTIS_INSIDE: number; - var NODE_COMMENT: number; - var NODE_DOCUMENT: number; - var NODE_DOCUMENT_FRAGMENT: number; - var NODE_ELEMENT: number; - var NODE_TEXT: number; - var POSITION_BEFORE_START: number; - var POSITION_BEFORE_END: number; - var POSITION_AFTER_START: number; - var POSITION_AFTER_END: number; - var SELECTION_ELEMENT: number; - var SELECTION_NONE: number; - var SELECTION_TEXT: number; - var SHIFT: number; - var SHRINK_ELEMENT: number; - var SHRINK_TEXT: number; - var START: number; - var STYLE_BLOCK: string; - var STYLE_INLINE: string; - var STYLE_OBJECT: string; - var TRISTATE_DISABLED: number; - var TRISTATE_OFF: number; - var TRISTATE_ON: number; - var UI_BUTTON: string; - var UI_MENUBUTTON: string; - var UI_PANEL: string; - var UI_PANELBUTTON: string; - var UI_RICHCOMBO: string; - var UI_SEPARATOR: string; + const ALT: number; + const CTRL: number; + const DATA_TRANSFER_CROSS_EDITORS: number; + const DATA_TRANSFER_EXTERNAL: number; + const DATA_TRANSFER_INTERNAL: number; + const DIALOG_RESIZE_BOTH: number; + const DIALOG_RESIZE_HEIGHT: number; + const DIALOG_RESIZE_NONE: number; + const DIALOG_RESIZE_WIDTH: number; + const DIALOG_STATE_BUSY: number; + const DIALOG_STATE_IDLE: number; + const ELEMENT_MODE_APPENDTO: number; + const ELEMENT_MODE_INLINE: number; + const ELEMENT_MODE_NONE: number; + const ELEMENT_MODE_REPLACE: number; + const END: number; + const ENLARGE_BLOCK_CONTENTS: number; + const ENLARGE_ELEMENT: number; + const ENLARGE_INLINE: number; + const ENLARGE_LIST_ITEM_CONTENTS: number; + const ENTER_BR: number; + const ENTER_DIV: number; + const ENTER_P: number; + const EVENT_PHASE_AT_TARGET: number; + const EVENT_PHASE_BUBBLING: number; + const EVENT_PHASE_CAPTURING: number; + const FILTER_SKIP_TREE: number; + const LINEUTILS_AFTER: number; + const LINEUTILS_BEFORE: number; + const LINEUTIS_INSIDE: number; + const MOUSE_BUTTON_LEFT: number; + const MOUSE_BUTTON_MIDDLE: number; + const MOUSE_BUTTON_RIGHT: number; + const NODE_COMMENT: number; + const NODE_DOCUMENT: number; + const NODE_DOCUMENT_FRAGMENT: number; + const NODE_ELEMENT: number; + const NODE_TEXT: number; + const POSITION_AFTER_END: number; + const POSITION_AFTER_START: number; + const POSITION_BEFORE_END: number; + const POSITION_BEFORE_START: number; + const POSITION_CONTAINS: number; + const POSITION_DISCONNECTED: number; + const POSITION_FOLLOWING: number; + const POSITION_IDENTICAL: number; + const POSITION_IS_CONTAINED: number; + const POSITION_PRECEDING: number; + const SELECTION_ELEMENT: number; + const SELECTION_NONE: number; + const SELECTION_TEXT: number; + const SHIFT: number; + const SHRINK_ELEMENT: number; + const SHRINK_TEXT: number; + const START: number; + const STYLE_BLOCK: string; + const STYLE_INLINE: string; + const STYLE_OBJECT: string; + const TRISTATE_DISABLED: number; + const TRISTATE_OFF: number; + const TRISTATE_ON: number; + const UI_BUTTON: string; + const UI_MENUBUTTON: string; + const UI_PANEL: string; + const UI_PANELBUTTON: string; + const UI_RICHCOMBO: string; + const UI_SEPARATOR: string; + const VERBOSITY_ERROR: number; + const VERBOSITY_WARN: number; + var basePath: string; var currentInstance: editor; var document: dom.document; - var env: environmentConfig; - var instances: { [id: string]: editor | undefined }; + var instances: { [id: string]: editor }; var loadFullCoreTimeout: number; var revision: string; var rnd: number; var status: string; var timestamp: string; + var verbosity: number; var version: string; - var config: config; + const config: config; // Methods function add(editor: editor): void; function addCss(css: string): void; function addTemplate(name: string, source: string): template; - function appendTo(element: string, config?: config, data?: string): editor; - function appendTo(element: HTMLElement, config?: config, data?: string): editor; + function appendTo(element: string | HTMLElement, config?: config, data?: string): editor; function domReady(): void; - function dialogCommand(dialogName: string): void; function editorConfig(config: config): void; + function error(errorCode: string, additionalData?: any): void; function getCss(): string; function getTemplate(name: string): template; function getUrl(resource: string): string; - function inline(element: string, instanceConfig?: config): editor; - function inline(element: HTMLElement, instanceConfig?: config): editor; + function inline(element: string | HTMLElement, instanceConfig?: config): editor; function inlineAll(): void; function loadFullCore(): void; function replace(element: string | HTMLTextAreaElement, config?: config): editor; function replaceAll(className?: string): void; function replaceAll(assertionFunction: (textarea: HTMLTextAreaElement, config: config) => boolean): void; + function warn(errorCode: string, additionalData?: any): void; // Event interface function capture(): void; - function define(name: string, meta: Object): void; - function fire(eventName: string, data?: Object, editor?: editor): any; - function fireOnce(eventName: string, data?: Object, editor?: editor): any; + function define(name: string, meta: { [key: string]: any }): void; + function fire(eventName: string, data?: { [key: string]: any }, editor?: editor): any; + function fireOnce(eventName: string, data?: { [key: string]: any }, editor?: editor): any; function hasListeners(eventName: string): boolean; - function on(eventName: string, listenerFunction: (eventInfo: eventInfo) => void, scopeObj?: Object, listenerData?: Object, priority?: number): void; - function once(eventName: string, listenerFunction: (eventInfo: eventInfo) => void, scopeObj?: Object, listenerData?: Object, priority?: number): void; + function on(eventName: string, listenerFunction: (eventInfo: eventInfo) => void, scopeObj?: { [key: string]: any }, listenerData?: { [key: string]: any }, priority?: number): void; + function once(eventName: string, listenerFunction: (eventInfo: eventInfo) => void, scopeObj?: { [key: string]: any }, listenerData?: { [key: string]: any }, priority?: number): void; function removeAllListeners(): void; function removeListener(eventName: string, listenerFunction: (eventInfo: eventInfo) => void): void; @@ -124,29 +144,31 @@ declare namespace CKEDITOR { collapsed: boolean; } - class comment { - - // Properties - type: number; - - // Methods - constructor(comment: string, ownerDocument?: document); - constructor(comment: Object, ownerDocument?: document); - getOuterHtml(): string; - + interface bookmark2 { + start: number[]; + end: number[]; + startOffset: number; + endOffset: number; + collapsed: boolean; + normalized: boolean; + is2: boolean; } + class comment extends node { + readonly type: number; + + constructor(comment: string | Node, ownerDocument?: document); + getOuterHtml(): string; + } class document extends domObject { + readonly $: Document; + readonly type: number; - // Properties - type: number; - - // Methods - constructor(domDocument: Object); + constructor(domDocument: { [key: string]: any }); appendStyleSheet(cssFileUrl: string): void; - appendStyleText(cssStyleText: string): Object; - createElement(name: string, attribsAndStyles?: { attributes: Object; styles: Object; }): element; + appendStyleText(cssStyleText: string): CSSStyleSheet; + createElement(name: string, attribsAndStyles?: { attributes: { [key: string]: any }; styles: { [key: string]: any }; }): element; createText(text: string): element; find(selector: string): nodeList; findOne(selector: string): element; @@ -161,61 +183,45 @@ declare namespace CKEDITOR { getSelection(): selection; getWindow(): window; write(html: string): void; - } + class documentFragment extends node { + readonly type: number; - class documentFragment { - - // Properties - type: number; - - // Methods - constructor(nodeOrDoc: Object); + constructor(nodeOrDoc: { [key: string]: any }); insertAfterNode(node: node): void; - } - class domObject extends event { + readonly $: any; - // Properties - $: HTMLElement; - - // Methods - constructor(nativeDomObject: Object); + constructor(nativeDomObject: { [key: string]: any }); clearCustomData(): void; equals(object: any): boolean; + fire(eventName: string, data?: any, editor?: editor): any; getCustomData(key: string): any; getPrivate(): any; getUniqueId(): number; removeAllListeners(): void; - removeCustomData(key: string): Object; - setCustomData(key: string, value: Object): domObject; - + removeCustomData(key: string): any; + setCustomData(key: string, value: any): domObject; } - class element extends node { + readonly $: HTMLElement; + readonly type: number; - // Properties - type: number; - - // Methods constructor(element: string, ownerDocument?: document); constructor(element: HTMLElement, ownerDocument?: document); addClass(className: string): void; - append(node: node, toStart?: boolean): node; - append(node: string, toStart?: boolean): node; + append(node: node | string, toStart?: boolean): node; appendBogus(force: boolean): void; appendHtml(html: string): void; appendText(text: string): node; breakParent(parent: element): void; contains(node: node): boolean; - copyAttributes(dest: element, skipAttributes: Object): void; - data(name: string): string; - data(name: string, value: string): void; - data(name: string, value: boolean): void; + copyAttributes(dest: element, skipAttributes: { [key: string]: string }): void; + data(name: string, value?: string | false): string; disableContextMenu(): void; find(selector: string): nodeList; findOne(selector: string): element; @@ -224,23 +230,22 @@ declare namespace CKEDITOR { focusPrevious(ignoreChildren?: boolean, indexToUse?: number): void; forEach(callback: (node: node) => void, type?: number, skipRoot?: boolean): void; getAttribute(name: string): string; - getBogus(): Object; - getChild(indices: number): node; - getChild(indices: number[]): node; + getBogus(): node | boolean; + getChild(indices: number | number[]): node; getChildCount(): number; getChildren(): nodeList; - getClientRect(): any; + getClientRect(): ClientRect; getComputedStyle(propertyName: string): string; getDirection(useComputed: boolean): string; getDocumentPosition(refDocument: document): position; - getDtd(): any; + getDtd(): dtdDefinition; getEditor(): editor; getElementsByTag(tagName: string): nodeList; - getFirst(evaluator?: Function): node; + getFirst(evaluator?: (node: node) => boolean): node; getFrameDocument(): document; getHtml(): string; getId(): string; - getLast(evaluator?: Function): node; + getLast(evaluator?: (node: node) => boolean): node; getName(): string; getNameAtt(): string; getOuterHtml(): string; @@ -257,7 +262,7 @@ declare namespace CKEDITOR { hide(): void; is(...name: string[]): boolean; is(name: any): boolean; - isBlockBoundary(customNodeNames: Object): boolean; + isBlockBoundary(customNodeNames: { [tagName: string]: 1 }): boolean; isEditable(textCursor?: boolean): boolean; isEmptyInlineRemoveable(): boolean; isIdentical(otherElement: element): boolean; @@ -273,205 +278,40 @@ declare namespace CKEDITOR { scrollIntoParent(parent: window, alignToTop: boolean, hscroll: boolean): void; scrollIntoView(alignToTop?: boolean): void; setAttribute(name: string, value: string): element; - setAttributes(attributesPairs: Object): element; + setAttributes(attributesPairs: { [key: string]: string }): element; setHtml(html: string): string; setOpacity(opacity: number): void; setSize(type: string, size: number, isBorderBox: boolean): void; - setState(state: number, base?: Object, useAria?: Object): void; + setState(state: number, base?: string, useAria?: boolean): void; setStyle(name: string, value: string): element; - setStyles(stylesPair: Object): element; + setStyles(stylesPair: { [key: string]: string }): element; setText(text: string): string; setValue(value: string): element; show(): void; unselectable(): void; //static method - static clearAllMarkers(database: Object): Object; - static clearMarkers(database: Object, element: Object, removeFromDatabase: Object): void; + static clearAllMarkers(database: any): any; + static clearMarkers(database: any, element: dom.element, removeFromDatabase: boolean): void; static createFromHtml(html: string): element; - static get(element: string): element; - static get(element: any): element; - static setMarker(database: Object, element: Object, name: Object, value: Object): domObject; - + static get(element: string | HTMLElement | element): element; + static setMarker(database: any, element: dom.element, name: string, value: any): dom.element; } - class elementPath { - constructor(startNode: element, root: element); - constructor(startNode: element); - block: element; - blockLimit: element; - root: element; - elements: element[]; + readonly block: element; + readonly blockLimit: element; + readonly elements: element[]; + readonly lastElement: element; + readonly root: element; + + constructor(startNode: element, root?: element); compare(otherPath: elementPath): boolean; - contains(query: string, excludeRoot?: boolean, fromTop?: boolean): element; - contains(query: string[], excludeRoot?: boolean, fromTop?: boolean): element; - contains(query: (element: element) => boolean, excludeRoot?: boolean, fromTop?: boolean): element; - contains(query: Object, excludeRoot?: boolean, fromTop?: boolean): element; - contains(query: element, excludeRoot?: boolean, fromTop?: boolean): element; + contains(query: string | string[] | ((element: element) => boolean) | { [key: string]: any } | element, excludeRoot?: boolean, fromTop?: boolean): element; + direction(): 'ltr' | 'rtl'; isContextFor(tag: string): boolean; - direction(): string; } - - class range { - constructor(root: element); - constructor(root: document); - startContainer: any; - startOffset: number; - endContainer: any; - endOffset: number; - collapsed: boolean; - isDocRoot: boolean; - document: document; - root: element; - clone(): range; - collapse(toStart?: boolean): boolean; - cloneContents(): documentFragment; - deleteContents(mergeThen?: boolean): void; - extractContents(mergeThen?: boolean): documentFragment; - createBookmark(serializable?: boolean): bookmark; - createBookmark2(normalized?: boolean): Object; - createIterator(): iterator; - moveToBookmark(bookmark: Object): void; - getBoundaryNodes(): { startNode: node; endNode: node; }; - getCommonAncestor(includeSelf?: boolean, ignoreTextNode?: boolean): element; - optimize(): void; - optimizeBookmark(): void; - trim(ignoreStart?: boolean, ignoreEnd?: boolean): void; - enlarge(unit: number, excludeBrs?: boolean): void; - shrink(mode: number, selectContents: boolean): void; - insertNode(node: node): void; - moveToPosition(node: node, position: Object): void; - moveToRange(range: range): void; - selectNodeContents(node: node): void; - setStart(startNode: node, startOffset: number): void; - setEnd(endNode: node, endOffset: number): void; - setEndAfter(node: node): void; - setEndBefore(node: node): void; - setStartAfter(node: node): void; - setStartBefore(node: node): void; - setStartAt(node: node, position: number): void; - setEndAt(node: node, position: number): void; - fixBlock(isStart: boolean, blockTag: Object): Object; - select(): selection; - splitBlock(blockTag: Object): Object; - splitElement(toSplit: element): element; - removeEmptyBlocksAtEnd(atEnd: boolean): void; - startPath(): elementPath; - endPath(): elementPath; - checkBoundaryOfElement(element: element, checkType: number): boolean; - checkStartOfBlock(): boolean; - checkEndOfBlock(): boolean; - getPreviousNode(evaluator: Function, guard: Function, boundary: element): element; - getNextNode(evaluator: Function, guard: Function, boundary: element): element; - checkReadOnly(): boolean; - moveToElementEditablePosition(element: element, isMoveToEnd: boolean): boolean; - movetoClosestEditablePosition(element: element, isMoveToEnd: boolean): boolean; - moveToElementEditStart(target: Object): boolean; - moveToElementEditEnd(target: Object): boolean; - getEnclosedNode(): node; - getTouchedStartNode(): node; - getTouchedEndNode(): node; - getNextEditableNode(): Object; - getPreviousEditableNode(): Object; - scrollIntoView(): void; - } - - - interface rangeListIterator { - - } - - class selection { - document: document; - isFake: boolean; - isLocked: boolean; - rev: number; - root: element; - constructor(target: document); - constructor(target: element); - constructor(target: selection); - createBookmarks(serializable: Object): bookmark[]; - createBookmarks2(normalized: Object): Object[]; - fake(element: element): void; - getCommonAncestor(): element; - getNative(): Object; - getRanges(onlyEditables?: boolean): any[]; - getSelectedElement(): element; - getSelectedText(): string; - getStartElement(): element; - getType(): number; - isHidden(): boolean; - lock(): void; - removeAllRanges(): void; - reset(): void; - scrollIntoView(): void; - selectBookmarks(bookmarks: any[]): selection; - selectElement(element: element): void; - selectRanges(ranges: any[]): void; - unlock(restore: Object): void; - } - - - class rangeList { - constructor(ranges: range[]); - constructor(range: range); - createIterator(): rangeListIterator; - createBokmarks(serializable?: boolean): bookmark[]; - createBookmarks2(normalized?: boolean): Object[]; - moveToBookmark(bookmarks: Object[]): void; - } - - - class iterator { - constructor(range: range); - getNextParagraph(blockTag?: string): element; - activeFilter: filter; - enforceRealBlocks: boolean; - enlargeBr: boolean; - filter: filter; - } - - - class node extends domObject { - constructor(domNode: Node); - appendTo(element: element): element; - clone(includeChildren: boolean, cloneId: boolean): node; - hasPrevious(): boolean; - hasNext(): boolean; - insertAfter(node: node): node; - insertBefore(node: node): node; - insertBeforeMe(node: node): node; - getAddress(normalized?: boolean): Object[]; - getDocument(): document; - getIndex(normalized?: boolean): number; - getNextSourceNode(startFromSibling: Object, nodeType: Object, guard: Object): void; - getPreviousSourceNode(startFromSibling: Object, nodeType: Object, guard: Object): void; - getPrevious(evaluator?: Function): node; - getNext(evaluator?: Function): node; - getParent(allowFragmentParent?: boolean): element; - getParents(closerFirst?: boolean): node[]; - getCommonAncestor(node: Object): void; - getPosition(otherNode: Object): void; - getAscendant(reference: string, includeSelf?: boolean): node; - hasAscendant(name: Object, includeSelf: any): boolean; - remove(preserveChildren?: boolean): node; - replace(nodeToReplace: node): void; - trim(): void; - ltrim(): void; - rtrim(): void; - isReadOnly(): boolean; - } - - - class nodeList { - constructor(nativeList: Object); - count(): number; - getItem(index: number): node; - } - - class event { constructor(domEvent: Event); getKey(): number; @@ -481,89 +321,243 @@ declare namespace CKEDITOR { getTarget(): node; getPhase(): number; getPhaseOffset(): position; - on(eventName: string, listenerFunction: (eventInfo: eventInfo) => void, scopeObj?: Object, listenerData?: Object, priority?: number): Object; + on(eventName: string, listenerFunction: (eventInfo: eventInfo) => void, scopeObj?: any, listenerData?: any, priority?: number): { removeListener: () => void }; } + class iterator { + readonly activeFilter: filter; + enforceRealBlocks: boolean; + enlargeBr: boolean; + readonly filter: filter; + forceBrBreak: boolean; + readonly range: range; + constructor(range: range); + getNextParagraph(blockTag?: string): element; + } + + class node extends domObject { + constructor(domNode: Node); + appendTo(element: element): element; + clone(includeChildren: boolean, cloneId: boolean): node; + hasPrevious(): boolean; + hasNext(): boolean; + insertAfter(node: node): node; + insertBefore(node: node): node; + insertBeforeMe(node: node): node; + getAddress(normalized?: boolean): number[]; + getAscendant(reference: string, includeSelf?: boolean): node; + getCommonAncestor(node: node): void; + getDocument(): document; + getIndex(normalized?: boolean): number; + getNext(evaluator?: (node: node) => boolean): node; + getNextSourceNode(startFromSibling: boolean, nodeType: number, guard: node | ((node: node) => boolean)): void; + getParent(allowFragmentParent?: boolean): element; + getParents(closerFirst?: boolean): node[]; + getPosition(otherNode: node): void; + getPrevious(evaluator?: (node: node) => boolean): node; + getPreviousSourceNode(startFromSibling: boolean, nodeType: number, guard: node | ((node: node) => boolean)): void; + hasAscendant(name: string, includeSelf: boolean): boolean; + remove(preserveChildren?: boolean): node; + replace(nodeToReplace: node): void; + trim(): void; + ltrim(): void; + rtrim(): void; + isReadOnly(): boolean; + } + + class nodeList { + constructor(nativeList: NodeList); + count(): number; + getItem(index: number): node; + toArray(): node[]; + } + + class range { + readonly collapsed: boolean; + readonly document: document; + readonly endContainer: element | text; + readonly endOffset: number; + readonly root: element; + readonly startContainer: element | text; + readonly startOffset: number; + + constructor(root: element | document); + checkBoundaryOfElement(element: element, checkType: number): boolean; + checkEndOfBlock(): boolean; + checkReadOnly(): boolean; + checkStartOfBlock(): boolean; + clone(cloneId?: boolean): range; + cloneContents(): documentFragment; + collapse(toStart?: boolean): boolean; + createBookmark(serializable?: boolean): bookmark; + createBookmark2(normalized?: boolean): bookmark2; + createIterator(): iterator; + deleteContents(mergeThen?: boolean): void; + endPath(): elementPath; + enlarge(unit: number, excludeBrs?: boolean): void; + extractContents(mergeThen?: boolean, cloneId?: boolean): documentFragment; + fixBlock(isStart: boolean, blockTag: string): element; + getBoundaryNodes(): { startNode: node; endNode: node; }; + getCommonAncestor(includeSelf?: boolean, ignoreTextNode?: boolean): element; + getEnclosedNode(): node; + getNextEditableNode(): element | text; + getNextNode(evaluator: (element: dom.element) => boolean, guard?: (element: dom.element) => boolean, boundary?: element): element; + getPreviousEditableNode(): element | text; + getPreviousNode(evaluator: (element: dom.element) => boolean, guard?: (element: dom.element) => boolean, boundary?: element): element; + getTouchedEndNode(): node; + getTouchedStartNode(): node; + insertNode(node: node): void; + moveToBookmark(bookmark: bookmark | bookmark2): void; + moveToClosestEditablePosition(element?: element, isMoveForward?: boolean): boolean; + moveToElementEditEnd(target: element): boolean; + moveToElementEditStart(target: element): boolean; + moveToElementEditablePosition(element: element, isMoveToEnd: boolean): boolean; + moveToPosition(node: node, position: number): void; + moveToRange(range: range): void; + optimize(): void; + optimizeBookmark(): void; + removeEmptyBlocksAtEnd(atEnd: boolean): void; + scrollIntoView(): void; + select(): selection; + selectNodeContents(node: node): void; + setEnd(endNode: node, endOffset: number): void; + setEndAfter(node: node): void; + setEndAt(node: node, position: number): void; + setEndBefore(node: node): void; + setStart(startNode: node, startOffset: number): void; + setStartAfter(node: node): void; + setStartAt(node: node, position: number): void; + setStartBefore(node: node): void; + shrink(mode: number, selectContents?: boolean, options?: boolean | shrinkOptions): void; + splitBlock(cloneId?: boolean): void; + splitElement(toSplit: element, cloneId?: boolean): element; + startPath(): elementPath; + trim(ignoreStart?: boolean, ignoreEnd?: boolean): void; + + static mergeRanges(ranges: range[]): range[]; + } + + interface shrinkOptions { + shrinkOnBlockBoundary?: boolean, + skipBogus?: boolean + } + + class rangeList { + constructor(ranges?: range | range[]); + createBokmarks(serializable?: boolean): bookmark[]; + createBookmarks2(normalized?: boolean): bookmark2[]; + createIterator(): rangeListIterator; + moveToBookmarks(bookmarks: bookmark[]): void; + } + + + interface rangeListIterator { + getNextRange(mergeConsequent?: boolean): range; + } + + // see https://docs.com/ckeditor4/latest/api/CKEDITOR_dom_selection.html + class selection { + readonly FILLING_CHAR_SEQUENCE: string; + readonly document: document; + readonly isFake: boolean; + readonly isLocked: boolean; + readonly rev: number; + readonly root: element; + + constructor(target: document | element | selection); + createBookmarks(serializable: any): bookmark[]; + createBookmarks2(normalized: any): bookmark2[]; + fake(element: element, ariaLabel?: boolean): void; + getCommonAncestor(): element; + getNative(): Selection; + getRanges(onlyEditables?: boolean): range[]; + getSelectedElement(): element; + getSelectedText(): string; + getStartElement(): element; + getType(): number; + isCollapsed(): boolean; + isHidden(): boolean; + isInTable(allowPartialSelection?: boolean): boolean; + lock(): void; + removeAllRanges(): void; + reset(): void; + scrollIntoView(): void; + selectBookmarks(bookmarks: (bookmark | bookmark2)[]): selection; + selectElement(element: element): void; + selectRanges(ranges: range[]): void; + unlock(restore: boolean): void; + } + + class text extends node { + readonly $: Text; + readonly type: number; + + constructor(text: Text | string, ownerDocument?: document); + getLength(): number; + getText(): string; + setText(text: string): void; + split(offset: number): text; + substring(indexA: number, indexB?: number): void; + } + + class walker { + evaluator: (node: node) => boolean; + guard: (node: node) => boolean; + + static validEmptyBlockContainers: { [key: string]: any }; + + constructor(range: range); + checkBackward(): boolean; + checkForward(): boolean; + end(): void; + lastBackward(): node; + lastForward(): node; + next(): node; + previous(): node; + reset(): void; + + static blockBoundary(customNodeNames: any): (node: node) => boolean; + static bogus(isReject?: boolean): (node: node) => boolean; + static bookmark(contentOnly?: boolean, isReject?: boolean): (node: node) => boolean; + static editable(isReject?: boolean): (node: node) => boolean; + static empty(isReject?: boolean): (node: node) => boolean; + static ignored(isReject?: boolean): (node: node) => boolean; + static invisible(isReject?: boolean): (node: node) => boolean; + static listItemBoundary(): (node: node) => boolean; + static nodeType(type: number, isReject?: boolean): (node: node) => boolean; + static temp(isReject?: boolean): (node: node) => boolean; + static whitespaces(isReject?: boolean): (node: node) => boolean; + } interface position { x: number; y: number; } - interface widthAndHeight { width: number; height: number; } - - class text extends node { - constructor(text: Text, ownerDocument?: document); - constructor(text: string, ownerDocument?: document); - type: number; - getLength(): number; - getText(): string; - setText(text: string): void; - split(offset: number): text; - substring(indexA: number, indexB: number): void; - } - - class window extends domObject { - constructor(domWindow: Object); + constructor(domWindow: Window); focus(): void; getViewPaneSize(): widthAndHeight; getScrollPosition(): position; getFrame(): element; } - - - class walker { - constructor(range: range); - end(): void; - next(): node; - previous(): node; - checkForward(): boolean; - checkBackward(): boolean; - lastForward(): node; - lastBackward(): node; - reset(): void; - //static methods till the end - blockBoundary(customNodeNames: Object): Function; - listItemBoundary(): Function; - bookmark(contentOnly?: boolean, isReject?: boolean): Function; - whitespaces(isReject?: boolean): Function; - invisible(isReject?: boolean): Function; - nodeType(type: number, isReject?: boolean): Function; - bogus(isReject?: boolean): Function; - temp(isReject?: boolean): Function; - ignored(isReject?: boolean): Function; - editable(isReject?: boolean): Function; - } - } namespace ajax { - - // Methods - function load(url: string, callback?: Function): string; - function loadXml(url: string, callback?: Function): xml; - + function load(url: string, callback?: (data: any) => void): string; + function loadXml(url: string, callback?: (data: any) => void): xml; + function post(url: string, data: any, contentType?: string, callback?: (data: any) => void): void; } - interface xml { - - } - - - class command extends event { - - // Properties - contextSensitive: boolean; - editorFocus: boolean; - modes: any; + class command extends event implements commandDefinition { + fakeKeystroke: number; previousState: number; state: number; uiItems: any[]; @@ -573,53 +567,31 @@ declare namespace CKEDITOR { checkAllowed(noCache: boolean): boolean; disable(): void; enable(): void; - exec(data?: Object): boolean; + exec(data?: { [key: string]: any }): boolean; refresh(editor: editor, path: dom.elementPath): void; setState(newState: number): boolean; toggleState(): void; } - - class focusManager { - // Properties - currentActive: dom.domObject; - hasFocus: boolean; - - // Methods - constructor(editor: editor); - focus(currentActive?: dom.element): void; - lock(): void; - unlock(): void; - blur(noDelay?: boolean): void; - add(element: dom.element, isCapture: boolean): void; - remove(element: dom.element): void; + interface commandDefinition { + async?: boolean; + canUndo?: boolean; + context?: boolean; + contextSensitive?: boolean; + editorFocus?: boolean; + fakeKeystroke?: number; + modes?: { [key: string]: any }; + startDisabled?: boolean; + readOnly?: boolean; + exec(editor: editor, data?: any): boolean; + refresh?(editor: editor, path: dom.elementPath): void; } - interface keystrokeHandler { - - } - - interface toolbarGroups { - name?: string; - groups?: string[]; - } - - namespace 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 + // https://docs.com/ckeditor4/latest/api/CKEDITOR_config.html interface config { - allowedContent?: boolean | string | Object | CKEDITOR.style; - autoEmbed_widget?: string | Function; + allowedContent?: boolean | filter.allowedContentRules; + autoEmbed_widget?: string | ((url: string) => string); autoGrow_bottomSpace?: number; autoGrow_maxHeight?: number; autoGrow_minHeight?: number; @@ -634,10 +606,13 @@ declare namespace CKEDITOR { bodyId?: string; browserContextMenuOnCtrl?: boolean; - clipboard_defaultContentType?: string; // html | text + clipboard_defaultContentType?: 'html' | 'text'; clipboard_notificationDuration?: number; + cloudServices_tokenUrl?: string; + cloudServices_uploadUrl?: string; + codeSnippetGeshi_url?: string; codeSnippet_codeClass?: string; - codeSnippet_languages?: Object; + codeSnippet_languages?: { [key: string]: any }; coceSnippet_theme?: string; colorButton_backStyle?: config.styleObject; colorButton_colors?: string; @@ -649,6 +624,11 @@ declare namespace CKEDITOR { contentsCss?: string | string[]; contentsLangDirection?: string; contentsLanguage?: string; + copyFormatting_allowRules?: string; + copyFormatting_allowedContexts?: boolean | string[]; + copyFormatting_keystrokeCopy?: number; + copyFormatting_keystrokePaste?: number; + copyFormatting_outerCursor?: boolean; coreStyles_bold?: config.styleObject; coreStyles_italic?: config.styleObject; coreStyles_strike?: config.styleObject; @@ -660,7 +640,7 @@ declare namespace CKEDITOR { dataIndentationChars?: string; defaultLanguage?: string; devtools_styles?: string; - devtools_textCallback?: Function; + devtools_textCallback?: (editor: editor, dialog: dialog, element: dom.element, tabName: string) => string; dialog_backgroundCoverColor?: string; dialog_backgroundCoverOpacity?: number; dialog_buttonsOrder?: string; @@ -670,11 +650,15 @@ declare namespace CKEDITOR { 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. + disableNativeReadonlyStyling?: boolean; + disallowedContent?: filter.disallowedContentRules; div_wrapTable?: boolean; docType?: string; + easyimage_class?: string; + easyimage_defaultStyle?: string; + easyimage_styles?: { [key: string]: any }; + easyimage_toolbar?: string[] | string; emailProtection?: string; embed_provider?: string; enableTabKeyTools?: boolean; @@ -684,21 +668,23 @@ declare namespace CKEDITOR { entities_greek?: boolean; entities_latin?: boolean; entities_processNumerical?: boolean | string; - extraAllowedContent?: string | Object; + extraAllowedContent?: filter.allowedContentRules; extraPlugins?: string; fileTools_defaultFileName?: string; + fileTools_requestHeaders?: { [key: string]: any }; filebrowserBrowseUrl?: string; filebrowserFlashBrowseUrl?: string; filebrowserFlashUploadUrl?: string; filebrowserImageBrowseLinkUrl?: string; filebrowserImageBrowseUrl?: string; filebrowserImageUploadUrl?: string; + filebrowserUploadMethod?: string; filebrowserUploadUrl?: string; filebrowserWindowFeatures?: string; filebrowserWindowHeight?: number | string; filebrowserWindowWidth?: number | string; - fillEmptyBlocks?: boolean | Function; + fillEmptyBlocks?: boolean | ((element: htmlParser.element) => boolean); find_highlight?: config.styleObject; flashAddEmbedTag?: boolean; flashConvertOnEdit?: boolean; @@ -737,6 +723,7 @@ declare namespace CKEDITOR { ignoreEmptyParagraph?: boolean; image2_alignClasses?: string[]; + image2_altRequired?: boolean; image2_captionedClass?: string; image2_disableResizer?: boolean; image2_prefillDimensions?: boolean; @@ -751,7 +738,7 @@ declare namespace CKEDITOR { jqueryOverrideVal?: boolean; justifyClasses?: string[]; - keystrokes?: any[]; // Number, string pair really... silly structure... they should fix this. + keystrokes?: [number, string][]; language?: string; language_list?: string[]; @@ -766,9 +753,10 @@ declare namespace CKEDITOR { magicline_keystrokePrevious?: number; magicline_tabuList?: string[]; magicline_triggerOffset?: number; + mathJaxClass?: string; mathJaxLib?: string; menu_groups?: string; - menu_subMenuDelay?: string; + menu_subMenuDelay?: number; newpage_html?: string; notification_duration?: number; @@ -781,6 +769,8 @@ declare namespace CKEDITOR { pasteFromWordPromptCleanup?: boolean; pasteFromWordRemoveFontStyles?: boolean; pasteFromWorkRemoveStyles?: boolean; + pasteFromWord_heuristicsEdgeList?: boolean; + pasteFromWord_inlineImages?: boolean; plugins?: string; protectedSource?: RegExp[]; @@ -815,7 +805,7 @@ declare namespace CKEDITOR { scayt_minWordLength?: number; scayt_moreSuggestions?: string; scayt_multiLanguageMode?: boolean; - scayt_multiLanguageStyles?: Object; + scayt_multiLanguageStyles?: { [key: string]: any }; scayt_sLang?: string; scayt_serviceHost?: string; scayt_servicePath?: string; @@ -825,7 +815,7 @@ declare namespace CKEDITOR { scayt_uiTabs?: string; scayt_userDictionaryName?: string; - sharedSpaces?: CKEDITOR.sharedSpace; + sharedSpaces?: sharedSpace; shiftEnterMode?: number; skin?: string; smiley_columns?: number; @@ -833,8 +823,8 @@ declare namespace CKEDITOR { 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; + specialChars?: (string | [string, string])[]; + startupFocus?: string | boolean; startupMode?: string; startupOutlineBlocks?: boolean; startupShowBorders?: boolean; @@ -845,7 +835,7 @@ declare namespace CKEDITOR { tabIndex?: number; tabSpaces?: number; templates?: string; - templates_files?: Object; + templates_files?: { [key: string]: any }; templates_replaceContent?: boolean; title?: string | boolean; toolbar?: string | (string | string[] | { name: string, items?: string[], groups?: string[] })[] | null; @@ -865,527 +855,197 @@ declare namespace CKEDITOR { wsc_customDictionaryIds?: string; wsc_customLoaderScript?: string; wsc_customerId?: string; + wsc_height?: string; wsc_lang?: string; + wsc_left?: string; + wsc_top?: string; wsc_userDictionaryName?: string; + wsc_width?: string; } - - interface feature { - - } - - - interface sharedSpace { - top?: string | HTMLElement; - bottom?: string | HTMLElement; - } - - module skin { - var icons: { [name: string]: { path: string } }; - function addIcon(name: string, path: string, offset?: number, bgsize?: string): void; - } - - class style { - constructor(something: { element: string, attributes: { [att: string]: string } }); - applyToRange(range: Range, editor: editor): void; - } - - class editable extends dom.element { - constructor(editor: editor, element: HTMLElement | dom.element); - hasFocus: boolean; - attachListener(obj: event | editable, eventName: string, listenerFunction: (ei: eventInfo) => void, - scopeobj?: {}, listenerData?: any, priority?: number): listenerRegistration; - } - - - class menu { - constructor(); - add(item: any): void; - addListener(listenerFn: (startElement: dom.element, selection: dom.selection, path: dom.elementPath) => any): void; - hide(returnFocus?: boolean): void; - removeAll(): void; - show(offsetParent: dom.element, corner?: number, offsetX?: number, offsetY?: number): void; - } - - - namespace plugins { - - class contextMenu extends menu { - constructor(editor: editor); - addTarget(element: dom.element, nativeContextMenuOnCtrl?: boolean): void; - open(offsetParent: dom.element, corner?: number, offsetX?: number, offsetY?: number): void; - } - - - namespace link { - var emptyAnchorFix: boolean; - var fakeAnchor: boolean; - var synAnchorSelector: boolean; - function getEditorAnchors(editor: editor): dom.element[]; - function getSelectedLink(editor: editor): dom.elementPath; - function tryRestoreFakeAnchor(editor: editor, element: dom.element): dom.element; - } - - - namespace widget { - - namespace nestedEditable { - interface definition { - allowedContent?: any; - pathName?: string; - selector?: string; - } - } - - 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?: Object | Function; - defaults?: Object; - dialog?: string; - downcast?: 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?: string | CKEDITOR.style; - styleToAllowedContentRules?: Function; - styleableElements?: string; - template?: string | CKEDITOR.template; - upcast?: string | Function; - upcastPriority?: number; - upcasts?: Object; - - toFeature?(): CKEDITOR.feature; - } - - class repository { - 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: CKEDITOR.plugins.widget): void; - destroy(widget: CKEDITOR.plugins.widget, offline?: boolean): void; - destroyAll(offline?: boolean): void; - finalizeCreation(container: any): void; - focused: widget; - fire(eventName: string, data: Object, editor: editor): any; // should be boolean | Object - getByElement(element: any, checkWrapperOnly: boolean): CKEDITOR.plugins.widget; - hasListeners(eventName: string): boolean; - initOn(element: dom.element, widgetDef?: CKEDITOR.plugins.widget.definition, startupData?: Object): CKEDITOR.plugins.widget; - initOn(element: dom.element, widgetDef?: string, startupData?: Object): CKEDITOR.plugins.widget; - initOnAll(container?: dom.element): CKEDITOR.plugins.widget[]; - instances: { [id: string]: widget }; - on(eventName: string, listenerFunction: Function, scopeObj?: Object, listenerData?: Object, priority?: number): any; - once(): void; - 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[]; - requires?: string | string[]; - afterInit?(editor: editor): any; - beforeInit?(editor: editor): any; - init?(editor: editor): void; - onLoad?(): any; - icons?: string; - } - - function add(name: string, definition: IPluginDefinition): void; - function add(name: string): 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: Function, scope?: Object): void; - function setLang(pluginName: string, languageCode: string, languageEntries: any): void; - var registered: {[key: string]: IPluginDefinition}; - } - - interface IMenuItemDefinition { - label:string, - command:string, - icon: string - group:string, - order:number - } - - class editor extends event { - activeEnterMode: number; - activeFilter: filter; - activeShiftEnterMode: number; - blockless: boolean; - config: config; - container: dom.element; - contextMenu: plugins.contextMenu; - dataProcessor: dataProcessor; - document: dom.document; - element: dom.element; - elementMode: number; - enterMode: number; - filter: filter; - focusManager: focusManager; - id: string; - keystrokeHandler: keystrokeHandler; - lang: any; - langCode: string; - mode: string; - name: string; - plugins: any; - readOnly: boolean; - shiftEnterMode: number; - status: string; - tabIndex: number; - templates: any; - title: any; - toolbar: any; - ui: ui; - widgets: plugins.widget.repository; - window: dom.window; - constructor(instanceConfig?: Object, element?: dom.element, mode?: number); - addCommand(commandName: string, commandDefinition: commandDefinition): void; - addFeature(feature: feature): boolean; - addMenuGroup(name: string, order?: number): void; - addMenuItem(name: string, definition?: IMenuItemDefinition): void; - addMenuItems(definitions: {[id:string]:IMenuItemDefinition}): void; - addMode(mode: string, exec: () => void): void; - addRemoveFormatFilter(func: Function): void; - applyStyle(style: style): void; - attachStyleStateChange(style: style, callback: Function): void; - checkDirty(): boolean; - commands:any; - createFakeElement(realElement: Object, className: Object, realElementType: Object, isResizable: Object): void; - createFakeParserElement(realElement: Object, className: Object, realElementType: Object, isResizable: Object): void; - createRange(): dom.range; - destroy(noUpdate?: boolean): void; - editable(): editable | null; - editable(elementOrEditable: dom.element): void; - editable(elementOrEditable: editable): void; - elementPath(startNode?: dom.node): dom.elementPath; - execCommand(commandName: string, data?: Object): boolean; - focus(): void; - forceNextSelectionCheck(): void; - getClipboardData(options: Object, callback: Function): void; - getColorFromDialog(callback: Function, scope?: Object): void; - getCommand(commandName: string): command; - getData(noEvents?: Object): string; - getMenuItem(name: string): Object; - getResizable(forContents: boolean): dom.element; - getSelectedHtml(toString?: false): dom.documentFragment; - getSelectedHtml(toString: true): string; - getSelectedHtml(toString?: boolean): CKEDITOR.dom.documentFragment | string; - getSelection(forceRealSelection?: boolean): dom.selection; - getSnapshot(): string; - getStylesSet(callback: Function): void; - getUiColor(): string; - insertElement(element: dom.element): void; - insertHtml(html: string, mode?: string): void; - insertText(text: string): void; - loadSnapshot(snapshot: Object): void; - lockSelection(sel?: dom.selection): boolean; - openDialog(dialogName: string, callback: Function): dialog; - popup(url: string, width?: number, height?: number, options?: string): void; - popup(url: string, width?: string, height?: number, options?: string): void; - popup(url: string, width?: number, height?: string, options?: string): void; - popup(url: string, width?: string, height?: string, options?: string): void; - removeMenuItem(name: string): void; - removeStyle(style: style): void; - resetDirty(): void; - resetUndo(): void; - resize(width: number, height: number, isContentHeight?: boolean, resizeInner?: boolean): void; - resize(width: string, height: number, isContentHeight?: boolean, resizeInner?: boolean): void; - resize(width: number, height: string, isContentHeight?: boolean, resizeInner?: boolean): void; - resize(width: string, height: string, isContentHeight?: boolean, resizeInner?: boolean): void; - restoreRealElement(fakeElement: Object): dom.element; - selectionChange(checkNow?: boolean): void; - setActiveEnterMode(enterMode: number, shiftEnterMode: number): void; - setActiveFilter(filter: filter): void; - setData(data: string, options?: { internal?: boolean; callback?: Function; noSnapshot?: boolean; }): void; - setKeystroke(keystroke: number, behavior?: string): void; - setKeystroke(keystroke: any[], behavior?: string): void; - setKeystroke(keystroke: number, behavior?: boolean): void; - setKeystroke(keystroke: any[], behavior?: boolean): void; - setMode(newMode: string, callback: Function): void; - setReadOnly(isReadOnly?: boolean): void; - setUiColor(color: string): void; - unlockSelection(restore?: boolean): void; - updateElement(): void; - } - - namespace 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; - afterPasteFromWord?: (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; - beforeDestroy?: (evt: CKEDITOR.eventInfo) => void; - beforeGetData?: (evt: CKEDITOR.eventInfo) => void; - beforeModeUnload?: (evt: CKEDITOR.eventInfo) => void; - beforeSetMode?: (evt: CKEDITOR.eventInfo) => void; - beforeUndoImage?: (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; - doubleclick?: (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; - instanceReady?: (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; - pasteFromWord?: (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; - editor: editor; - listenerData: any; - name: string; - sender: any; - cancel(): void; - removeListener(): void; - stop(): void; - } - - module filter { - interface allowedContentRules { - - } - } - - class filter { - allow(newRules: CKEDITOR.filter.allowedContentRules, featureName?: string, overrideCustom?: boolean): boolean; - - } - - interface buttonDefinition { - icon?: string; - iconOffset?: number; - label : string; - command : string; - toolbar : string; - } - - interface template { - - } - - interface dataProcessor { toDataFormat(html: string, fixForBody: string): void; toHtml(data: string, fixForBody?: string): void; } - class htmlDataProcessor { - dataFilter: htmlParser.filter; - htmlFilter: htmlParser.filter; - writer: htmlParser.basicWriter; + class dialog { + readonly state: number; - constructor(editor: editor); - toDataFormat(html: string, options?: Object): string; - toHtml(data: string, options?: Object): string; + constructor(editor: editor, dialogName: string); + + addFocusable(element: dom.element, index?: number): void; + addPage(contents: { [key: string]: any }): void; + click(id: string): any; + commitContent(): void; + diableButton(id: string): void; + enableButton(id: string): void; + foreach(fn: () => void): dialog; + getButton(id: string): ui.dialog.button; + getContentElement(pageId: string, elementId: string): ui.dialog.uiElement; + getElement(): dom.element; + getName(): string; + getPageCount(): number; + getParentEditor(): editor; + getPosition(): { [key: string]: any }; + getSelectedElement(): dom.element; + getSize(): { [key: string]: any }; + getValueOf(pageId: string, elementId: string): any; + hide(): void; + hidePage(id: string): void; + layout(): void; + move(x: number, y: number, save: boolean): void; + reset(): dialog; + resize(width: number, height: number): void; + selectPage(id: string): void; + setState(state: number): void; + setValueOf(pageId: string, elementId: string, value: any): void; + setupContent(): void; + show(): void; + showPage(id: string): void; + updateStyle(): void; + + static add(name: string, dialogDefinition: string | ((editor: editor) => dialog.IDialogDefinition)): void; + static addIframe(name: string, title: string, minWidth: number, minHeight: number, onContentLoad?: () => void, userDefinition?: { [key: string]: any }): void; + static addUIElement(typeName: string, builder: () => void): void; + static cancelButton(): void; + static exists(name: string | number): void; // NOTE: documentation says object, but it's an array accessor, so really a string or number will work + static getCurrent(): dialog; + static isTabEnabled(editor: editor, dialogName: string, tabName: string): boolean; + static okButton(): void; } + namespace dialog { - class event { - constructor(); - useCapture: boolean; - capture(): void; - define(name: string, meta: Object): void; - fire(eventName: string, data?: Object, editor?: editor): any; - fireOnce(eventName: string, data?: Object, editor?: editor): any; - hasListeners(eventName: string): boolean; - on(eventName: string, listenerFunction: (eventInfo: eventInfo) => void, scopeObj?: Object | null, listenerData?: Object | null, priority?: number): listenerRegistration; - once(eventName: string, listenerFunction: (eventInfo: eventInfo) => void, scopeObj?: Object | null, listenerData?: Object | null, priority?: number): listenerRegistration; - removeAllListeners(): void; - removeListener(eventName: string, listenerFunction: (eventInfo: eventInfo) => void): void; - static implementOn(targetObject: Object): void; + namespace definition { + + interface button extends uiElement { + disabled?: boolean; + } + + interface checkbox extends uiElement { + default?: string; + validate?: () => boolean; + } + + interface content { + accessKey?: string; + elements?: dialog.definition.uiElement[]; + id?: string; + label?: string; + title?: string; + } + + interface file extends labeledElement { + action?: string; + size?: string; + validate?: () => boolean; + } + + interface fileButton extends uiElement { + filebrowser?: string; + for?: string; + validate?: () => boolean; + } + + interface hbox extends uiElement { + children?: ui.dialog.uiElement[]; + height?: number; + padding?: number; + validate?: () => boolean; + widths?: number[]; + } + + interface html extends uiElement { + html?: string; + } + + interface labeledElement extends uiElement { + controlStyle?: string; + inputStyle?: string; + labelLayout?: string; + labelStyle?: string; + widths?: number[]; + } + + interface radio extends labeledElement { + default?: string; + items?: string[] | (string[])[]; + validate?: () => boolean; + } + + interface select extends labeledElement { + default?: string; + items?: string[] | (string[])[]; + multiple?: boolean; + size?: number; + validate?: () => boolean; + } + + interface textarea extends labeledElement { + bidi?: boolean; + cols?: number; + default?: string; + rows?: number; + validate?: () => boolean; + } + + interface textInput extends labeledElement { + bidi?: boolean; + default?: string; + maxLength?: number; + size?: number; + validate?: () => boolean; + } + + interface uiElement { + align?: string; + className?: string; + commit?: (widget: plugins.widget) => void; + id?: string; + label?: string; + onHide?: (elem: ui.dialog.uiElement) => void; + onLoad?: (elem: ui.dialog.uiElement) => void; + onShow?: (elem: ui.dialog.uiElement) => void; + requiredContent?: string | { [key: string]: any } | style; + setup?: (widget: plugins.widget) => void; + style?: string; + title?: string; + type?: string; + } + + interface vbox extends uiElement { + children?: ui.dialog.uiElement[]; + expand?: boolean; + heights?: number[]; + padding?: number; + styles?: string; + width?: number[]; + } + } + + interface IDialogDefinition { + buttons?: dialog.definition.button[]; + contents?: dialog.definition.content[]; + height?: number; + minHeight?: number; + minWidth?: number; + onCancel?: () => void; + onLoad?: () => void; + onOk?: () => void; + onShow?: () => void; + onHide?: () => void; + resizable?: number; + title?: string; + width?: number; + } } + class dialogCommand { + value: any; - interface commandDefinition { - async?: boolean; - canUndo?: boolean; - context?: boolean; - contextSensitive?: boolean; - editorFocus?: boolean; - modes?: Object; - startDisabled?: boolean; - exec(editor: editor, data?: Object): boolean; - readOnly?: boolean; - refresh?(editor: editor, path: dom.elementPath): void; + constructor(dialogName: string, ext?: { tabId?: string }); } - interface dtdDefinition { [outerTagName: string]: {[innerTagName: string]: 1}; $block: {[tagName: string]: 1}; @@ -1407,117 +1067,1429 @@ declare namespace CKEDITOR { } var dtd: dtdDefinition; + + class editable extends dom.element { + hasFocus: boolean; + readonly status: string; + constructor(editor: editor, element: HTMLElement | dom.element); + attachClass(className: string): void; + attachListener(obj: event | editable, eventName: string, listenerFunction: (ei: eventInfo) => void, scopeobj?: {}, listenerData?: any, priority?: number): listenerRegistration; + changeAttr(attr: string, val: string): void; + detach(): void; + insertElement(element: dom.element, range?: dom.range): void; + insertHtml(data: string, mode?: string, range?: dom.range): void; + insertText(text: dom.text): void; + isInline(): boolean; + setReadOnly(isReadOnly: boolean): void; + } + + class editor extends event { + readonly activeEnterMode: number; + readonly activeFilter: filter; + readonly activeShiftEnterMode: number; + readonly blockless: boolean; + readonly config: config; + readonly container: dom.element; + readonly contextMenu: plugins.contextMenu; + copyFormatting: plugins.copyformatting.state; + dataProcessor: dataProcessor; + readonly document: dom.document; + readonly element: dom.element; + readonly elementMode: number; + readonly enterMode: number; + readonly filter: filter; + readonly focusManager: focusManager; + readonly id: string; + readonly keystrokeHandler: keystrokeHandler; + readonly lang: any; + readonly langCode: string; + readonly mode: string; + readonly name: string; + readonly pasteFilter: filter; + readonly plugins: any; + readonly readOnly: boolean; + readonly shiftEnterMode: number; + readonly status: string; + readonly tabIndex: number; + readonly templates: any; + readonly title: any; + readonly toolbar: any; + readonly ui: ui; + readonly widgets: plugins.widget.repository; + readonly window: dom.window; + + constructor(instanceConfig?: config, element?: dom.element, mode?: number); + addCommand(commandName: string, commandDefinition: commandDefinition): void; + addContentsCss(cssPath: string): void; + addFeature(feature: feature): boolean; + addMenuGroup(name: string, order?: number): void; + addMenuItem(name: string, definition?: IMenuItemDefinition): void; + addMenuItems(definitions: { [id:string]: IMenuItemDefinition }): void; + addMode(mode: string, exec: () => void): void; + addRemoveFormatFilter(func: (element: dom.element) => boolean): void; + applyStyle(style: style): void; + attachStyleStateChange(style: style, callback: (state: number) => void): void; + checkDirty(): boolean; + createFakeElement(realElement: dom.element, className: string, realElementType: string, isResizable: boolean): void; + createFakeParserElement(realElement: dom.element, className: string, realElementType: string, isResizable: boolean): void; + createRange(): dom.range; + destroy(noUpdate?: boolean): void; + editable(elementOrEditable?: dom.element | editable): editable; + elementPath(startNode?: dom.node): dom.elementPath; + execCommand(commandName: string, data?: any): boolean; + extractSelectedHtml(toString?: boolean, removeEmptyBlock?: boolean): dom.documentFragment | string | void; + focus(): void; + forceNextSelectionCheck(): void; + getClipboardData(callbackOrOptions: { title: string } | ((data: any) => void), callback: (data: any) => void): void; + getColorFromDialog(callback: (color: string) => void, scope?: { [key: string]: any }): void; + getCommand(commandName: string): command; + getCommandKeystroke(command: command | string): number | null; + getData(internal: boolean): string; + getMenuItem(name: string): IMenuItemDefinition; + getResizable(forContents: boolean): dom.element; + getSelectedHtml(toString?: false): dom.documentFragment; + getSelectedHtml(toString: true): string; + getSelectedHtml(toString?: boolean): dom.documentFragment | string; + getSelection(forceRealSelection: boolean): dom.selection; + getSnapshot(): string; + getStylesSet(callback: (stylesDefinitions: style.definition[]) => void): void; + getUiColor(): string; + insertElement(element: dom.element): void; + insertHtml(html: string, mode?: string, range?: dom.range): void; + insertText(text: string): void; + loadSnapshot(snapshot: any): void; + lockSelection(sel?: dom.selection): boolean; + openDialog(dialogName: string, callback: () => void): dialog; + popup(url: string, width?: number | string, height?: number | string, options?: string): void; + removeMenuItem(name: string): void; + removeStyle(style: style): void; + resetDirty(): void; + resetUndo(): void; + resize(width: number | string, height: number | string, isContentHeight?: boolean, resizeInner?: boolean): void; + restoreRealElement(fakeElement: dom.element): dom.element; + selectionChange(checkNow?: boolean): void; + setActiveEnterMode(enterMode: number, shiftEnterMode: number): void; + setActiveFilter(filter: filter): void; + setData(data: string, options?: { internal?: boolean; callback?: () => void; noSnapshot?: boolean; }): void; + setKeystroke(keystroke: number, behavior: string | boolean): void; + setKeystroke(keystroke: [number, string | boolean][]): void; + setMode(newMode: string, callback: () => void): void; + setReadOnly(isReadOnly?: boolean): void; + setUiColor(color: string): void; + showNotification(message: string, type: plugins.notification.type, progressOrDuration: number): plugins.notification; + unlockSelection(restore?: boolean): void; + updateElement(): void; + } + + namespace editor { + interface eventObject { + activeEnterModeChange?: (evt: eventInfo) => void; + activeFilterChange?: (evt: eventInfo) => void; + afterCommandExec?: (evt: eventInfo) => void; + afterInsertHtml?: (evt: eventInfo) => void; + afterPaste?: (evt: eventInfo) => void; + afterPasteFromWord?: (evt: eventInfo) => void; + afterSetData?: (evt: eventInfo) => void; + afterUndoImage?: (evt: eventInfo) => void; + ariaEditorHelpLabel?: (evt: eventInfo) => void; + ariaWidget?: (evt: eventInfo) => void; + autogrow?: (evt: eventInfo) => void; + + beforeCommandExec?: (evt: eventInfo) => void; + beforeDestroy?: (evt: eventInfo) => void; + beforeGetData?: (evt: eventInfo) => void; + beforeModeUnload?: (evt: eventInfo) => void; + beforeSetMode?: (evt: eventInfo) => void; + beforeUndoImage?: (evt: eventInfo) => void; + blur?: (evt: eventInfo) => void; + + change?: (evt: eventInfo) => void; + configLoaded?: (evt: eventInfo) => void; + contentDirChanged?: (evt: eventInfo) => void; + contentDom?: (evt: eventInfo) => void; + contentDomInvalidated?: (evt: eventInfo) => void; + contentDomUnload?: (evt: eventInfo) => void; + customConfigLoaded?: (evt: eventInfo) => void; + + dataFiltered?: (evt: eventInfo) => void; + dataReady?: (evt: eventInfo) => void; + destroy?: (evt: eventInfo) => void; + dialogHide?: (evt: eventInfo) => void; + dialogShow?: (evt: eventInfo) => void; + dirChanged?: (evt: eventInfo) => void; + doubleclick?: (evt: eventInfo) => void; + dragend?: (evt: eventInfo) => void; + dragstart?: (evt: eventInfo) => void; + drop?: (evt: eventInfo) => void; + + elementsPathUpdate?: (evt: eventInfo) => void; + + fileUploadRequest?: (evt: eventInfo) => void; + fileUploadResponse?: (evt: eventInfo) => void; + floatingSpaceLayout?: (evt: eventInfo) => void; + focus?: (evt: eventInfo) => void; + + getData?: (evt: eventInfo) => void; + getSnapshot?: (evt: eventInfo) => void; + + insertElement?: (evt: eventInfo) => void; + insertHtml?: (evt: eventInfo) => void; + insertText?: (evt: eventInfo) => void; + instanceReady?: (evt: eventInfo) => void; + + key?: (evt: eventInfo) => void; + + langLoaded?: (evt: eventInfo) => void; + loadSnapshot?: (evt: eventInfo) => void; + loaded?: (evt: eventInfo) => void; + lockSnapshot?: (evt: eventInfo) => void; + maximize?: (evt: eventInfo) => void; + menuShow?: (evt: eventInfo) => void; + mode?: (evt: eventInfo) => void; + + notificationHide?: (evt: eventInfo) => void; + notificationShow?: (evt: eventInfo) => void; + notificationUpdate?: (evt: eventInfo) => void; + + paste?: (evt: eventInfo) => void; + pasteFromWord?: (evt: eventInfo) => void; + pluginsLoaded?: (evt: eventInfo) => void; + + readOnly?: (evt: eventInfo) => void; + removeFormatCleanup?: (evt: eventInfo) => void; + required?: (evt: eventInfo) => void; + resize?: (evt: eventInfo) => void; + + save?: (evt: eventInfo) => void; + saveSnapshot?: (evt: eventInfo) => void; + selectionChange?: (evt: eventInfo) => void; + setData?: (evt: eventInfo) => void; + stylesSet?: (evt: eventInfo) => void; + + template?: (evt: eventInfo) => void; + toDataFormat?: (evt: eventInfo) => void; + toHtml?: (evt: eventInfo) => void; + + unlockSnapshot?: (evt: eventInfo) => void; + updateSnapshot?: (evt: eventInfo) => void; + + widgetDefinition?: (evt: eventInfo) => void; + } + } + + namespace env { + var air: boolean; + var chrome: boolean; + var cssClass: string; + var edge: boolean; + var gecko: boolean; + var hc: boolean; + var hidpi: boolean; + var iOS: boolean; + var ie: boolean; + var isCompatible: boolean; + var mac: boolean; + var needsBrFiller: boolean; + var needsNbspFiller: boolean; + var quirks: boolean; + var safari: boolean; + var version: number; + var webkit: boolean; + + function secure(): boolean; + } + + class event { + static useCapture: boolean; + + constructor(); + capture(): void; + define(name: string, meta: { [key: string]: any }): void; + fire(eventName: string, data?: { [key: string]: any }, editor?: editor): any; + fireOnce(eventName: string, data?: { [key: string]: any }, editor?: editor): any; + hasListeners(eventName: string): boolean; + on(eventName: string, listenerFunction: (eventInfo: eventInfo) => void, scopeObj?: { [key: string]: any } | null, listenerData?: any, priority?: number): listenerRegistration; + once(eventName: string, listenerFunction: (eventInfo: eventInfo) => void, scopeObj?: { [key: string]: any } | null, listenerData?: any, priority?: number): listenerRegistration; + removeAllListeners(): void; + removeListener(eventName: string, listenerFunction: (eventInfo: eventInfo) => void): void; + + static implementOn(targetObject: { [key: string]: any }): void; + } + + interface eventInfo { + data: any; + editor: editor; + listenerData: any; + name: string; + sender: { [key: string]: any }; + + cancel(): void; + removeListener(): void; + stop(): void; + } + + interface feature { + allowedContent?: filter.allowedContentRules; + contentForms?: any; + contentTransformations?: any; + name?: string; + requiredContent?: string | style; + toFeature?: () => feature; + } + + namespace fileTools { + var isFileUploadSupported: boolean; + + function addUploadWidget(editor: editor, name: string, def: uploadWidgetDefinition): void; + function bindNotification(editor: editor, fileLoader: fileLoader): void; + function getUploadUrl(config: { [key: string]: any }, type?: string): string; + function isTypeSupported(file: Blob, supportedTypes: RegExp): boolean; + function markElement(element: dom.element, widgetName: string, loaderId: number): void; + + class fileLoader extends event { + readonly data: string; + readonly file: Blob; + readonly fileName: string; + readonly id: number; + readonly loaded: number; + readonly message: string; + readonly reader: FileReader; + readonly responseData: any; + status: string; + readonly total: number; + readonly uploadTotal: number; + readonly uploadUrl: string; + readonly uploaded: string; + readonly url: string; + readonly xhr: XMLHttpRequest; + + constructor(editor: editor, fileOrData: Blob | string, fileName?: string); + abort(): void; + isFinished(): boolean; + load(): void; + loadAndUpload(url: string, additionalRequestParameters?: any): void; + update(): void; + upload(url: string, additionalRequestParameters?: any): void; + } + + class uploadRepository extends event { + readonly loaders: fileLoader[]; + + constructor(editor: editor); + create(fileOrData: Blob | string, fileName: string, loaderType?: any): fileLoader; + isFinished(): boolean; + } + + interface uploadWidgetDefinition extends plugins.widget.definition { + additionalRequestParameters: any; + fileToElement: (pastedFile: any) => HTMLElement; + loadMethod: string; + loaderType: any; + onAbort: () => boolean; + onError: () => boolean; + onLoaded: () => boolean; + onUploaded: () => boolean; + onUploading: () => boolean; + replaceWith: () => any; + skipNotifications: boolean; + supportedTypes: string; + uploadUrl: string; + } + } + + module filter { + type allowedContentRule = string | style | { [key: string]: any}; + type allowedContentRules = allowedContentRule | allowedContentRule[]; + type contentRule = string | style; + type disallowedContentRules = string | { [key: string]: any}; + + interface transformation { + check?: string; + element?: string | style; + left?: (element: htmlParser.element | style) => boolean; + right: (element: htmlParser.element, tools: string | filter.transformationTools) => boolean; + } + + var transformationTools: transformationTools; + + interface transformationTools { + alignmentToAttribute(element: htmlParser.element): void; + alignmentToStyle(element: htmlParser.element): void; + lengthToAttribute(element: htmlParser.element, styleName: string, attrName?: string): void; + lengthToStyle(element: htmlParser.element, styleName: string, attrName?: string): void; + matchesTyle(element: htmlParser.element, style: style): void; + sizeToAttribute(element: htmlParser.element): void; + sizeToStyle(element: htmlParser.element): void; + splitBorderShorthand(element: htmlParser.element): void; + splitMarginShorthand(element: htmlParser.element): void; + transform(element: htmlParser.element, form: style | string): void; + } + } + + class filter { + readonly allowedContent: filter.allowedContentRules[]; + readonly customConfig: boolean; + readonly disabled: boolean; + readonly disallowedContent: any[]; + readonly editor: editor; + readonly elementCallbacks:((element: htmlParser.element) => number)[]; + readonly id: number; + + static instances: { [id: string]: filter }; + + constructor(editorOrRules: editor | filter.allowedContentRules); + addContentForms(forms: any[]): void; + addElementCallback(callback: (element: htmlParser.element) => number): void; + addFeature(feature: feature): boolean; + addTransformations(transformations: (string | filter.transformation)[][]): void; + allow(newRules: filter.allowedContentRules, featureName?: string, overrideCustom?: boolean): boolean; + applyTo(fragment: htmlParser.fragment | htmlParser.element, toHrml: boolean, transformOnly: boolean, enterMode: number): boolean; + check(test: filter.contentRule, applyTransformations?: boolean, strictCheck?: boolean): boolean; + checkFeature(feature: feature): boolean; + clone(): filter; + destroy(): void; + disable(): void; + disallow(newRules: filter.disallowedContentRules): void; + getAllowedEnterMode(defaultMode: number, reverse?: boolean): number; + } + + class focusManager { + currentActive: dom.domObject; + hasFocus: boolean; + + constructor(editor: editor); + add(element: dom.element, isCapture: boolean): void; + blur(noDelay?: boolean): void; + focus(currentActive?: dom.element): void; + lock(): void; + remove(element: dom.element): void; + unlock(): void; + } + + class htmlDataProcessor implements dataProcessor { + dataFilter: htmlParser.filter; + htmlFilter: htmlParser.filter; + writer: htmlParser.basicWriter; + + constructor(editor: editor); + toDataFormat(html: string, options?: string | { context?: string, filter?: filter, enterMode?: number }): string; + toHtml(data: string, options?: string | htmlDataProcessorOptions): string; + } + + interface htmlDataProcessorOptions { + context?: string; + fixForBody?: boolean; + filter?: filter; + dontFilter?: boolean; + enterMode?: number; + protectedWhitespaces?: boolean; + } + + namespace htmlParser { + class basicWriter { + constructor(); + attribute(attName: string, attValue: string): void; + closeTag(tagName: string): void; + comment(comment: string): void; + getHtml(reset: boolean): string; + openTag(tagName: string, attributes: { [key: string]: string }): void; + openTagClose(tagName: string, isSelfClose: boolean): void; + reset(): void; + text(text: string): void; + write(data: string): void; + } + + class cdata extends node { + constructor(value: string); + type: number; + writeHtml(writer: htmlParser.basicWriter): void; + } + + class comment extends node { + type: number; + value: string; + + constructor(value: string); + filter(filter: filter): boolean; + writeHtml(writer: htmlParser.basicWriter, filter?: htmlParser.filter): void; + } + + class cssStyle { + constructor(elementOrStyleText: htmlParser.element | string); + populate(obj: htmlParser.element | dom.element | { [key: string]: any}): void; + } + + class element extends node { + attributes: { [name: string]: string }; + children: htmlParser.node[]; + name: string; + type: number; + + constructor(name: string, attributes: { [name: string]: string }); + add(node: node, index?: number): void; + addClass(className: string): void; + clone(): element; + filter(filter: htmlParser.filter): boolean; + filterChildren(filter: htmlParser.filter): void; + find(criteria: string | ((el: htmlParser.node) => boolean), recursive?: boolean): htmlParser.node[]; + forEach(callback: (node: htmlParser.node) => void | false, type?: number, skipRoot?: boolean): void; + getFirst(condition: string | { [key: string]: string } | ((node: htmlParser.node) => boolean)): htmlParser.node; + getHtml(): string; + getOuterHtml(): string; + hasClass(className: string): boolean; + removeClass(className: string): void; + replaceWithChildren(): void; + setHtml(html: string): void; + split(index: number): htmlParser.element; + writeChildrenHtml(writer: htmlParser.basicWriter, filter?: htmlParser.filter): void; + writeHtml(writer: basicWriter, filter?: htmlParser.filter): void; + } + + class filter { + attributeNameRules: filterRulesGroup; + attributesRules: { [name: string]: filterRulesGroup }; + commentRules: filterRulesGroup; + elementNameRules: filterRulesGroup; + elementsRules: { [name: string]: filterRulesGroup }; + id: number; + rootRules: filterRulesGroup; + textRules: filterRulesGroup; + + constructor(rules?: filterRulesDefinition); + addRules(rules: filterRulesDefinition, options?: number | { priority?: number; applyToAll?: boolean; }): void; + applyTo(node: node): void; + } + + interface filterRulesDefinition { + elementNames: any; + attributeNames: any; + elements: any; + attributes: any; + text: any; + comment: any; + root: any; + } + + class filterRulesGroup { + rules: { value: rule, priority: number, option: ruleOptions }[]; + + add(rule: rule, priority: number, options: ruleOptions): void; + addMany(rules: { [key: string]: any }[], priority: number, options: ruleOptions): void; + exec(currentValue: htmlParser.node | htmlParser.fragment | string): htmlParser.node | htmlParser.fragment | string; + execOnName(currentName: string): string; + findIndex(priority: number): number; + } + + class fragment { + children: htmlParser.node[]; + parent: htmlParser.fragment; + readonly type: number; + + constructor(); + + add(node: htmlParser.node, index?: number): void; + filter(filter: htmlParser.filter): void; + filterChildren(filter: htmlParser.filter, filterRoot?: boolean): void; + forEach(callback: (node: htmlParser.node,) => void | false, type?: number, skipRoot?: boolean): void; + writeChildrenHtml(writer: basicWriter, filter?: htmlParser.filter, filterRoot?: boolean): void; + writeHtml(writer: basicWriter, filter?: htmlParser.filter): void; + + static fromBBCode(source: string): htmlParser.fragment; + static fromHtml(fragmentHtml: string, parent?: htmlParser.element | string, fixingBlock?: string | boolean): fragment | htmlParser.element; + } + + class node { + constructor(); + getAscendant(condition: string | { [name: string]: string | ((node: htmlParser.element) => boolean)}): element; + getIndex(): number; + insertAfter(node: node): void; + insertBefore(node: node): void; + remove(): node; + replaceWith(node: node): void; + wrapWith(wrapper: element): element; + } + + type rule = ((value: htmlParser.node | htmlParser.fragment | string) => boolean) | [ string, string ]; + + interface ruleOptions { + applyToAll?: boolean, + excludeNestedEditable?: boolean + } + + class text extends node { + constructor(value: string); + type: number; + filter(filter: filter): boolean; + writeHtml(writer: basicWriter, filter?: filter): void; + } + } + + class htmlWriter extends htmlParser.basicWriter { + indentationChars: string; + lineBreakChars: string; + selfClosingEnd: string; + + indentation(): void; + lineBreak(): void; + setRules(tagName: string, rules: { [key: string]: any }): void; + } + + class keystrokeHandler { + blockedKeystrokes: { [key: number]: string | boolean }; + keystrokes: { [key: number]: string | boolean }; + + constructor(editor: editor); + + attach(domObject: dom.domObject): void; + } + + namespace lang { + var languages: { [code: string]: number }; + var rtl: { [code: string]: number }; + + function detect(defaultLanguage: string, probeLanguage?: string): string; + function load(languageCode: string, defaultLanguage: string, callback: (code: string, entries: any) => void): void; + } + + namespace loader { + var loadedScripts: string[]; + var scripts: string[]; + + function load(scriptName: string, defer?: boolean): void; + function loadPending(): void; + } + + class menu { + constructor(); + + add(item: any): void; + addListener(listenerFn: (startElement: dom.element, selection: dom.selection, path: dom.elementPath) => any): void; + findItemByCommandName(commandName: string): { item: any, element: dom.element }; + hide(returnFocus?: boolean): void; + removeAll(): void; + show(offsetParent: dom.element, corner?: number, offsetX?: number, offsetY?: number): void; + } + + interface pluginDefinition { + hidpi?: boolean; + lang?: string | string[]; + requires?: string | string[]; + + afterInit?(editor: editor): any; + beforeInit?(editor: editor): any; + init?(editor: editor): void; + onLoad?(): any; + } + + namespace plugins { + + namespace cloudservices { + class cloudServicesLoader extends fileTools.fileLoader { + customToken: string; + + constructor(editor: editor, fileOrData: Blob | string, fileName?: string, token?: string); + loadAndUpload(url?: string, additionalRequestParameters?: any): void; + upload(url?: string, additionalRequestParameters?: any): void; + } + } + + class autoEmbed { + getWidgetDefinition(editor: editor, url: string): widget.definition; + } + + namespace balloontoolbar { + const PRIORITY: { [pri: string]: number }; + + class context { + editor: editor; + options: contextDefinition; + toolbar: ui.balloonToolbar; + + constructor(editor: editor, options: contextDefinition); + destroy(): void; + hide(): void; + refresh(): void; + show(pointedElement?: dom.element): void; + } + + interface contextDefinition { + cssSelector?: string; + priority?: number; + widgets?: string[] | string; + + refresh?: (editor: editor, path: dom.elementPath, selection: dom.selection) => dom.element; + } + + class contextManager { + editor: editor; + + constructor(editor: editor); + add(context: context): void; + check(selection?: dom.selection): void; + create(options: contextDefinition): context; + destroy(): void; + hide(): void; + } + } + + namespace clipboard { + const isCustomCopyCutSupported: boolean; + const isCustomDataTypesSupported: boolean; + const isFileApiSupported: boolean; + const mainPasteEvent: string; + + function addPasteButton(editor: editor, name: string, definition: { [key: string]: any}): void; + function canClipboardApiBeTrusted(dataTransfer: dataTransfer, editor: editor): boolean; + function getDropTarget(editor: editor): dom.domObject; + function getRangeAtDropPosition(domEvent: Event, editor: editor): dom.range; + function initDragDataTransfer(evt?: dom.event, editor?: editor): void; + function initPasteDataTransfer(evt?: dom.event, sourceEditor?: editor): void; + function preventDefaultDropOnElement(element: dom.element): void; + function resetDragDataTransfer(): void; + + class dataTransfer { + readonly $: DataTransfer; + readonly id: string; + readonly sourceEditor: editor; + + constructor(nativeDataTransfer?: DataTransfer, editor?: editor); + cacheData(): void; + getData(type: string, getNative?: boolean): string; + getFile(i: number): File; + getFilesCount(): number; + getTransferType(targetEditor: editor): number; + isEmpty(): boolean; + setData(type: string, value: string): void; + storeId(): void; + } + + class fallbackDataTransfer { + constructor(dataTransfer: dataTransfer); + getData(type: string, getNative?: boolean): string; + isRequired(): boolean; + setData(type: string, value: string): string; + } + } + + namespace condesnippet { + function setHighlighter(highlighter: highlighter): void; + + class highlighter { + highlighter: (code: string, lang: string, callback: (highlightedCode: string) => void) => void; + init: (ready: () => void) => void; + languages: { [lang: string]: string }; + readonly queue: ((code: string, lang: string, callback: (highlightedCode: string) => void) => void)[]; + readonly ready: boolean; + + highlight(code: string, lang: string, callback: (highlightedCode: string) => void): void; + } + } + + class contextMenu extends menu { + constructor(editor: editor); + addTarget(element: dom.element, nativeContextMenuOnCtrl?: boolean): void; + open(offsetParent: dom.element, corner?: number, offsetX?: number, offsetY?: number): void; + } + + namespace copyformatting { + var breakOnElements: string[]; + var elementsForInlineTransform: string[]; + var excludedAttributes: string[]; + var excludedAttributesFromInlineTransform: string[]; + var inlineBoundary: string[]; + var preservedElements: string[]; + + class state extends event { + editor: editor; + filter: filter; + sticky: boolean; + styles: style[]; + + constructor(editor: editor); + } + } + + namespace easyimage { + + } + + namespace embedBase { + function createWidgetBaseDefinition(editor: editor): baseDefinition; + + interface baseDefinition extends widget.definition { + providerUrl: template; + urlRegExp: RegExp; + + getErrorMessage(messageTypeOrMessage: string, url?: string, suffix?: string): string; + isUrlValid(url: string): boolean; + loadContent(url: string, callback?: () => void, errorCallback?: (error: string) => void, noNotifications?: boolean): request; + } + + interface request { + callback: () => void; + errorCallback: (error: string) => void; + response: { [key: string]: string }; + task: notificationAggregator.task; + url: string; + + cancel(): void; + } + } + + namespace image2 { + function checkHasNaturalRatio(image: dom.element): boolean; + function getLinkAttributesGetter(): (editor: editor, data: { [key: string]: string }) => { set: { [tag: string]: string }, removed: string[] }; + function getLinkAttributesParser(): (editor: editor, element: dom.element) => { [key: string]: string }; + function getNatural(image: dom.element): { [key: string]: string }; + } + + namespace imagebase { + var featuresDefinitions: { [key: string]: string }; + + function addFeature(editor: editor, name: string, definition: imageWidgetDefinition): imageWidgetDefinition; + function addImageWidget(editor: editor, name: string, definition: imageWidgetDefinition): void; + + interface imageWidgetDefinition extends widget.definition { + features: string[]; + upcast: string; + } + + class progressBar extends progressReporter { + bar: dom.element; + + constructor(); + + } + + class progressReporter { + wrapper: dom.element; + + constructor(wrapperHtml?: string); + aborted(): void; + bindLoader(loader: fileTools.fileLoader): void; + done(): void; + failed(): void; + remove(): void; + updated(progress: number): void; + } + } + + namespace indent { + function registerCommands(editor: editor, commands: { [key: string]: command} ): void; + + class genericDefinition implements commandDefinition { + async: boolean; + canUndo: boolean; + context: boolean; + contextSensitive: boolean; + editorFocus: boolean; + fakeKeystroke: number; + readonly isIndent: boolean; + modes: { [key: string]: any }; + readOnly: boolean; + startDisabled: boolean; + + exec(editor: editor, data?: any): boolean; + refresh?(editor: editor, path: dom.elementPath): void; + } + + class specificDefinition { + database: { [key: string]: any }; + readonly enterBr: boolean; + readonly indentKey: { [key: string]: any }; + readonly isIndent: boolean; + readonly jobs: { [priority: string]: { refresh: (editor: editor, path: dom.elementPath) => number, exec: (editor: editor) => boolean } }; + readonly relatedGlobal: { [key: string]: any }; + + execJob(editor: editor, priority: number): boolean; + getContext(node: dom.elementPath): dom.element; + refreshJob(editor: editor, priority: number): number; + } + } + + namespace indentList { + function firstItemInPath(query: string | string[] | { [tagName: string]: any} | dom.element | ((element: dom.element) => boolean)): boolean; + } + + namespace link { + // DEPRECATED 4.3.3 + const emptyAnchorFix: boolean; + + // DEPRECATED 4.3.3 + const fakeAnchor: boolean; + + // DEPRECATED 4.3.3 + const synAnchorSelector: boolean; + + function getEditorAnchors(editor: editor): dom.element[]; + function getLinkAttributes(editor: editor, data: { [key: string]: any}): { set: { [key: string]: string }, removed: string[] } + function getSelectedLink(editor: editor, returnMultiple?: boolean): dom.element | dom.element[]; + function parseLinkAttributes(editor: editor, element: dom.element): { [key: string]: any }; + function showDisplayTextForElement(element: dom.element, editor: editor): boolean; + function tryRestoreFakeAnchor(editor: editor, element: dom.element): dom.element; + } + + class list { + arrayToList(listArray: any, database: any, paragraphMode: any, dir: any): void; + listToArray(listNode: any, database: any, baseArray: any, baseIndentLevel: any, grandparentNode: any): void; + } + + class notification { + readonly area: notification.area; + readonly duration: number; + readonly editor: editor; + readonly element: dom.element; + readonly id: number; + readonly message: string; + readonly progress: number; + readonly type: notification.type; + + constructor(editor: editor, options: notification.options); + hide(): void; + isVisible(): boolean; + show(): void; + update(options: notification.updateOptions): void; + } + + namespace notification { + interface area { + readonly editor: editor; + readonly element: dom.element; + readonly notifications: notification[]; + + add(notification: notification): void; + remove(notification: notification): void; + } + + interface optionsBase { + duration?: number; + progress?: number; + type?: type; + } + + interface options extends optionsBase { + message: string; + } + + interface updateOptions extends optionsBase { + message?: string; + important?: boolean; + } + + type type = 'info' | 'warning' | 'success' | 'progress'; + } + + class notificationAggregator extends event { + readonly editor: editor; + readonly notification: notification; + + constructor(editor: editor, message: string, singularMessage?: string); + createTask(options?: { weight?: number }): notificationAggregator.task; + getDoneTaskCount(): number; + getPercentage(): number; + getTaskCount(): number; + isFinished(): boolean; + update(): void; + } + + namespace notificationAggregator { + class task extends event { + constructor(weight?: number); + cancel(): void; + done(): void; + isCanceled(): boolean; + isDone(): boolean; + update(weight: number): void; + } + } + + namespace pastefromword { + class lists { + numbering: lists.numbering; + } + + namespace lists { + class numbering { + getStyle(marker: string): string; + toNumber(marker: string, markerType: string): number; + } + } + + class styles { + pushStylesLower(element: htmlParser.element, exceptions: { [style: string]: boolean }, wrapText?: boolean ): boolean; + } + } + + namespace tableselection { + function getCellsBetween(first: dom.element, last: dom.element): dom.element[]; + } + + namespace widget { + var WRAPPER_CLASS_PREFIX: string; + + function getNestedEditable(guard: dom.element, node: dom.node): dom.element; + function isDomDragHandler(node: dom.node): boolean; + function isDomDragHandlerContainer(node: dom.node): boolean; + function isDomNestedEditable(node: dom.node): boolean; + function isDomWidget(node: dom.node): boolean; + function isDomWidgetElement(node: dom.node): boolean; + function isDomWidgetWrapper(node: dom.node): boolean; + function isParserWidgetElement(node: dom.node): boolean; + function isParserWidgetWrapper(node: dom.node): boolean; + + namespace nestedEditable { + interface definition { + allowedContent?: filter.allowedContentRules; + disallowedContent?: filter.disallowedContentRules; + pathName?: string; + selector?: string; + } + } + + class nestedEditable extends dom.element { + readonly editor: editor; + readonly enterMode: number; + readonly filter: filter; + readonly shiftEnterMode: number; + + constructor(editor: editor, element: dom.element, config: { filter?: filter }); + getData(): string; + setData(data: string): void; + } + + + interface definition extends feature { + button?: string; + data?: (evt: eventInfo) => void; + defaults?: { [key: string]: any }; + dialog?: string; + downcast?: string | ((element: htmlParser.element) => void); + downcasts?: { [key: string]: any }; + draggable?: boolean; + edit?: () => void; + editables?: { [key: string]: any }; + getLabel?: () => any; + init?: () => void; + inline?: boolean; + insert?: () => void; + mask?: boolean; + parts?: { [key: string]: any }; + pathName?: string; + styleToAllowedContentRules?: (style: style) => filter.allowedContentRules; + styleableElements?: string; + template?: string | template; + upcast?: string | ((element: htmlParser.element, data: any) => boolean); + upcastPriority?: number; + upcasts?: { [key: string]: any }; + } + + class repository extends event { + readonly editor: editor; + readonly focused: widget; + readonly instances: { [id: string]: widget }; + readonly registered: { [name: string]: definition }; + readonly selected: widget[]; + readonly widgetHoldingFocusedEditable: widget; + + add(name: string, widgetDef: plugins.widget.definition): void; + addUpcastCallback(callback: (element: htmlParser.element, data: any) => boolean): void; + checkSelection(): void; + checkWidgets(options?: { initOnlyNew?: boolean; focusInited?: boolean }): void; + del(widget: plugins.widget): void; + destroy(widget: plugins.widget, offline?: boolean): void; + destroyAll(offline?: boolean): void; + finalizeCreation(container: any): void; + getByElement(element: any, checkWrapperOnly: boolean): plugins.widget; + initOn(element: dom.element, widgetDef?: plugins.widget.definition, startupData?: { [key: string]: any }): plugins.widget; + initOn(element: dom.element, widgetDef?: string, startupData?: { [key: string]: any }): plugins.widget; + initOnAll(container?: dom.element): plugins.widget[]; + parseElementClasses(classes: string): any; + wrapElement(element: any, widgetName?: string): any; + } + + class widgetselection { + addFillers(editable: editable): boolean; + removeFillers(editable: editable): void; + } + } + + class widget extends event implements widget.definition { + readonly dataReady: boolean; + readonly definition: plugins.widget.definition; + readonly editor: editor; + readonly element: dom.element; + readonly focusedEditable: plugins.widget.nestedEditable + readonly id: number; + readonly inited: boolean; + readonly ready: boolean; + readonly repository: plugins.widget.repository; + readonly wrapper: dom.element; + + constructor(widgetsRepo: plugins.widget.repository, id: number, element: dom.element, widgetDef: plugins.widget.definition, starupData?: any); + + addClass(className: string): void; + applyStyle(style: style): void; + checkStyleActive(style: style): boolean; + destroy(offline?: boolean): void; + destroyEditable(editableName: string, offline?: boolean): void; + edit(): boolean; + focus(): void; + getClasses(): any; + hasClass(className: string, Whether: boolean): void; + initEditable(editableName: string, definition: plugins.widget.nestedEditable.definition): boolean; + isInited(): boolean; + isReady(): boolean; + removeClass(className: string): void; + removeStyle(style: style): void; + setData(keyOrData: any, value: any): plugins.widget; + setFocused(selected: boolean): plugins.widget; + setSelected(selected: boolean): plugins.widget; + updateDragHandlerPosition(): void; + } + + function add(name: string, definition: pluginDefinition): void; + function add(name: string): 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: (plugins: string[]) => void, scope?: { [key: string]: any }): void; + function setLang(pluginName: string, languageCode: string, languageEntries: any): void; + var registered: {[key: string]: pluginDefinition}; + } + + class resourceManager { + basePath: string; + externals: { [key: string]: any }; + fileName: string; + loaded: { [key: string]: any }; + registered: { [key: string]: any }; + + constructor(basePath: string, fileName: string); + add(name: string, definition?: pluginDefinition): void; + addExternal(names: string, path: string, fileName?: string): void; + get(name: string): pluginDefinition; + getFilePath(name: string): string; + getPath(name: string): string; + load(name: string | string[], callback: (loaded: string[]) => void, scope?: { [key: string]: any }): void; + } + + // see https://docs.com/ckeditor4/latest/api/CKEDITOR_scriptLoader.html + namespace scriptLoader { + function load(scriptUrls: string | string[], callback: (succeededUrls: boolean | string[], failedUrls?: string[]) => void, scope?: any, showBusy?: boolean): void; + function queue(scriptUrl: string, callback?: (succeeded: boolean) => void): void; + } + + namespace skin { + var icons: { [name: string]: { path: string } }; + var name: string; + var ua: { [name: string]: any }; + + function addIcon(name: string, path: string, offset?: number, bgsize?: string): void; + function chameleon(editor: string, part: string): void; + function getIconStyle(name: string, rtl?: boolean, overridePath?: number, overrideBgsize?: string): any; + function getPath(part: string): any; + function loadPart(part: string, fn: () => void): void; + function path(): string; + } + + namespace style { + function addCustomHandler(defintion: customHandler): style; + function getStyleText(style: definition): string; + + namespace customHandlers { + class widget extends style { + group: any[]; + widget: string; + checkElement(element: dom.element): boolean; + getClassesArray(): string[]; + getDefintion(): definition; + removeStylesFromSameGroup(editor: editor): boolean; + } + } + + interface definition { + attributes?: { [att: string]: string }, + element: string, + name?: string, + styles?: { [att: string]: string }, + type?: string | number + } + + interface customHandler { + type: string | number; + setup?: (style: definition) => void; + assignedTo?: number; + } + } + + class style { + alwaysRemoveElement: boolean; + includeReadonly: boolean; + constructor(styleDefinition: style.definition, variableValues: any); + apply(editor: editor): void; + applyToObject(element: dom.element, editor: editor): void; + applyToRange(range: Range, editor: editor): void; + buildPreview(label?: string): string; + checkActive(elementPath: dom.elementPath, editor: editor): boolean; + checkApplicable(elementPath: dom.elementPath, editor: editor, filter?: filter): boolean; + checkElementMatch(element: dom.element, fullMatch: boolean, editor: editor): boolean; + checkElementRemovable(element: dom.element, fullMatch: boolean, editor: editor): boolean; + getDefintion(): style.definition; + remove(editor: editor): void; + removeFromRange(range: Range, editor: editor): void; + toAllowedContentRules(editor?: editor): filter.allowedContentRules; + } + + class styleCommand { + constructor(style: style, ext?: any); + exec(editor: editor): void; + } + + var stylesSet: resourceManager; + + class template { + readonly source: string; + + constructor(source: string); + output(data: any, buffer?: any[]): string | number; + } + + namespace tools { + function addFunction(fn: () => any, scope?: any): number; + function arrayCompare(arrayA: any[], arrayB: any[]): boolean; + function clone(source: { [key: string]: any }): { [key: string]: any }; + function copy(source: { [key: string]: any }): { [key: string]: any }; + function createClass(definition: { [key: string]: any }): any; + function cssStyleToDomStyle(cssName: string): string; + function cssVendorPrefix(property: string, value: string, asString?: boolean): { [cssClass: string]: string | number }; + function defer(fn: T): T; + function enableHtml5Elements(doc: Document | DocumentFragment, withAppend?: boolean): void; + function escapeCss(selector: string): string; + function eventsBuffer(minInterval: number, output: () => void, scopeObj: any): { input: () => void, reset: () => void }; + function extend(target: { [key: string]: any }, source: { [key: string]: any }, overwrite: boolean, properties: { [key: string]: any }): { [key: string]: any }; + function fixDomain(): boolean; + function genKey(subKey: string): string; + function getCookie(name: string): string; + function getCsrfToken(): string; + function getIndex(array: T[], compareFunction: (element: T) => boolean): number; + function getMouseButton(evt: dom.event): boolean; + function getNextId(): string; + function getNextNumber(): number; + function getUniqueId(): string; + function htmlDecode(text: string): string; + function htmlDecodeAttr(text: string): string; + function htmlEncode(text: string): string; + function htmlEncodeAttr(text: string): string; + function indexOf(array: T[], value: T | ((el: T) => boolean)): number; + function isArray(object: any): object is T[]; + function isEmpty(object: { [key: string]: any }): boolean; + function keystrokeToArray(lang: { [key: string]: any }, keystroke: number): { display: string[], aria: string[] }; + function keystrokeToString(lang: { [key: string]: any }, keystroke: number): { display: string, aria: string }; + function ltrim(str: string): string; + function normalizeCssText(styleText: string, nativeNormalize: boolean): string; + function normalizeHex(styleText: string): string; + function objectCompare(left: { [key: string]: any }, right: { [key: string]: any }, onlyLef?: boolean): boolean; + function objectKeys(obj: { [key: string]: any }): string[]; + function override(originalFunction: T, functionBuilder: (originalFunction: T) => T): T; + function parseCssText(styleText: string, normalize?: boolean, nativeNormalize?: boolean): { [key: string]: any }; + function prototypedCopy(source: { [key: string]: any }): { [key: string]: any }; + function removeFunction(ref: number): void; + function repeat(str: string, times: number): string; + function rtrim(str: string): string; + function search(array: T[], value: T | ((element: T) => boolean)): T; + function setCookie(name: string, value: string): void; + function setTimeout(func: Function, milliseconds?: number, scope?: { [key: string]: any }, args?: any, ownerWindow?: Window): number; + function transformPlainTextToHtml(text: string, etnerMode: number): string; + function trim(str: string): string; + function tryThese(fn: Function[]): any; + function writeCssText(styles: { [key: string]: any }, sort?: boolean): string; + + namespace array { + function every(array: T[], fn: (value: T, index: number, array: T[]) => boolean, thisArg?: { [key: string]: any }): boolean; + function filter(array: T[], fn: (value: T, index: number, array: T[]) => boolean, thisArg?: { [key: string]: any }): T[]; + function forEach(array: T[], fn: (value: T, index: number, array: T[]) => void, thisArg?: { [key: string]: any }): void; + function isArray(object: any): boolean; + function map(array: T[], fn: (value: T) => K, thisArg?: { [key: string]: any }): K[]; + function reduce(array: T[], fn: (accumulator: K, a: T, index: number, array: T[]) => K, initial: K, thisArg?: { [key: string]: any }): K; + } + + namespace object { + function findKey(obj: { [key: string]: any }, value: any): string; + function merge(obj1: { [key: string]: any }, obj2: { [key: string]: any }): { [key: string]: any }; + } + + namespace style { + namespace parse { + function background(value: string): { color: string, unprocessed: string}; + function border(value: string): { width: string, style: string, color: string }; + function margin(value: string): { top: number, right: number, bottom: number, left: number }; + } + } + } class ui extends event { constructor(editor: editor); - add(name: string, type: Object, definition: Object): void; + add(name: string, type: { [key: string]: any }, definition: { [key: string]: any }): void; addButton(name: string, definition: buttonDefinition): void; - addHandler(type: Object, handler: Object): void; - } - - class environmentConfig { - air : boolean; - chrome : boolean; - cssClass : string; - edge : boolean; - gecko : boolean; - hc : boolean; - hidpi : boolean; - iOS : boolean; - ie : boolean; - isCompatible : boolean; - mac : boolean; - needsBrFiller : boolean; - needsNbspFiller : boolean; - quirks : boolean; - safari : boolean; - version : number; - webkit : boolean; - secure( ) : boolean; + addHandler(type: { [key: string]: any }, handler: { [key: string]: any }): void; + addRichCombo(name: string, definition: { [key: string]: any }): void; + addToolbarGroup(name: string, previous: number | string, subgroupOf?: string): void; + create(name: string): { [key: string]: any }; + get(name: string): { [key: string]: any }; + space(name: string): dom.element; + spaceId(name: string): string; } namespace ui { namespace 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[]); + constructor(dialog: dialog, elementDefinition: definitions.button, htmlList: any[]); accessKeyDown(): void; accessKeyUp(): void; click(): any; } - class checkbox extends uiElement { - constructor(dialog: CKEDITOR.dialog, elementDefinition: CKEDITOR.dialog.definition.uiElement, htmlList: any[]); + constructor(dialog: dialog, elementDefinition: definitions.checkbox, 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 + setValue(checked: boolean, noChangeEvent: boolean): undefined; } + namespace definitions { + interface button { + label: string; + disabled?: boolean; + } + + interface checkbox { + checked?: boolean; + validate?: () => boolean; + label?: string; + } + + interface fieldSet { + label?: string; + children: any[]; + } + + interface file { + validate?: () => boolean; + } + + interface fileButton { + for: string; + validate?: () => boolean; + } + + interface hbox { + widths?: string[]; + height?: string; + padding?: string; + align?: string; + } + + interface html { + html: string; + } + + interface iframeElement { + src: string; + width: string; + height: string; + onContentLoad?: () => void; + } + + interface labeledElement { + label: string; + labelLayout?: 'horizontal' | 'vertical'; + widths?: [ string, string ]; + role?: string; + includeLabel?: boolean; + } + + interface radio { + default: any; + validate?: () => boolean; + items: ([string, string] | [string])[]; + } + + interface select { + default: any; + validate?: () => boolean; + items: ([string, string] | [string])[]; + multiple?: boolean; + size?: number; + } + + interface textarea { + rows?: number; + cols?: number; + default?: string; + validate?: () => boolean; + } + + interface textInput { + default?: string; + validate?: () => boolean; + maxLength?: number; + size?: string; + } + + interface uiElement { + id: string; + type: number; + title?: string; + hidden?: boolean; + className?: string; + style?: string; + accessKey?: string; + } + + interface vbox { + width?: string; + heights?: string[]; + align?: string; + padding?: string; + expand?: boolean; + } + } class fieldset extends uiElement { - constructor(dialog: CKEDITOR.dialog, childObjList: any[], childHtmlList: any[], htmlList: any[], elementDefinition: CKEDITOR.dialog.definition.uiElement); + constructor(dialog: dialog, childObjList: any[], childHtmlList: any[], htmlList: any[], elementDefinition: definitions.fieldSet); } - class file extends CKEDITOR.ui.dialog.labeledElement { - constructor(dialog: CKEDITOR.dialog, elementDefinition: CKEDITOR.dialog.definition.uiElement, htmlList: any[]); + class file extends ui.dialog.labeledElement { + constructor(dialog: dialog, elementDefinition: definitions.file, htmlList: any[]); getAction(): string; - getInputElement(): CKEDITOR.dom.element; - registerEvents(definition: Object): CKEDITOR.ui.dialog.file; + registerEvents(definition: { [key: string]: any }): file; reset(): void; setInitValue(): void; - submit(): CKEDITOR.ui.dialog.file; + submit(): file; } - class fileButton extends CKEDITOR.ui.dialog.button { - constructor(dialog: CKEDITOR.dialog, elementDefinition: CKEDITOR.dialog.definition.uiElement, htmlList: any[]); - - // formLoaded event ?? + class fileButton extends button { + constructor(dialog: dialog, elementDefinition: definitions.fileButton, htmlList: any[]); } class hbox extends uiElement { - constructor(dialog: CKEDITOR.dialog, childObjList: any[], childHtmlList: any[], htmlList: any[], elementDefinition: CKEDITOR.dialog.definition.uiElement); + constructor(dialog: dialog, childObjList: any[], childHtmlList: any[], htmlList: any[], elementDefinition: definitions.hbox); - getChild(indices: number): CKEDITOR.ui.dialog.uiElement; - getChild(indices: number[]): CKEDITOR.ui.dialog.uiElement[]; + getChild(indices: number): ui.dialog.uiElement; + getChild(indices: number[]): ui.dialog.uiElement[]; } class html extends uiElement { - constructor(dialog: CKEDITOR.dialog, elementDefinition: CKEDITOR.dialog.definition.uiElement, htmlList: any[]); + constructor(dialog: dialog, elementDefinition: definitions.html, htmlList: any[]); } @@ -1528,422 +2500,272 @@ declare namespace CKEDITOR { class labeledElement extends uiElement { - constructor(dialog: CKEDITOR.dialog, elementDefinition: CKEDITOR.dialog.definition.uiElement, htmlList: any[], contentHtml: Function); + constructor(dialog: dialog, elementDefinition: definitions.labeledElement, htmlList: any[], contentHtml: () => string); getLabel(): string; - setlabel(label: string): CKEDITOR.ui.dialog.labeledElement; + setlabel(label: string): ui.dialog.labeledElement; } - class radio extends CKEDITOR.ui.dialog.labeledElement { - constructor(dialog: CKEDITOR.dialog, elementDefinition: CKEDITOR.dialog.definition.uiElement, htmlList: any[]); + class radio extends ui.dialog.labeledElement { + constructor(dialog: dialog, elementDefinition: definitions.radio, htmlList: any[]); accessKeyUp(): void; getValue(): string; - setValue(value: string, noChangeEvent: boolean): any; // returns void according to doc, but cannot override base class like that + setValue(value: string, noChangeEvent: boolean): undefined; } class select extends uiElement { - constructor(dialog: CKEDITOR.dialog, elementDefinition: CKEDITOR.dialog.definition.uiElement, htmlList: any[]); + constructor(dialog: dialog, elementDefinition: definitions.select, 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; + add(label: string, value?: string, indexedDB?: number): select; + clear(): select; + remove(index: number): select; } - class textarea extends CKEDITOR.ui.dialog.labeledElement { - constructor(dialog: CKEDITOR.dialog, elementDefinition: CKEDITOR.dialog.definition.uiElement, htmlList: any[]); + class textarea extends labeledElement { + constructor(dialog: dialog, elementDefinition: definitions.textarea, htmlList: any[]); } - class textInput extends CKEDITOR.ui.dialog.labeledElement { - constructor(dialog: CKEDITOR.dialog, elementDefinition: CKEDITOR.dialog.definition.uiElement, htmlList: any[]); + class textInput extends ui.dialog.labeledElement { + constructor(dialog: dialog, elementDefinition: definitions.textInput, htmlList: any[]); accessKeyUp(): void; - focus(): any; // returns void according to doc, but cannot override base class like that + focus(): undefined; getDirectionMarker(): string; - getInputElement(): CKEDITOR.dom.element; getValue(): string; select(): void; setDirectionMarker(dir: string): void; - setValue(value: string, noChangeEvent: boolean): CKEDITOR.ui.dialog.textInput; + setValue(value: string, noChangeEvent: boolean): textInput; + } + + class uiElement { + eventProcessors: any; + + constructor(dialog: dialog, elementDefinition: definitions.uiElement, htmlList: any[], nodeNameArg?: () => string | string, stylesArg?: () => { [key: string]: any } | { [key: string]: any }, attributesArg?: () => { [key: string]: any } | { [key: string]: any }, contentsArg?: () => { [key: string]: any } | string); // Not sure that the htmlList array type is right. + + accessKeyDown(dialog: dialog, key: string): void; + accessKeyUp(dialog: dialog, key: string): void; + disable(): void; + enable(): void; + focus(): ui.dialog.uiElement; + getDialog(): dialog; + getElement(): dom.element; + getInputElement(): dom.element; + getValue(): any; + isChanged(): boolean; + isEnabled(): boolean; + isFocusable(): boolean; + isVisible(): boolean; + registerEvents(definition: CKEDITOR.dialog.definition.uiElement): ui.dialog.uiElement; + selectParentTab(): ui.dialog.uiElement; + setValue(value: any, noChangeEvent: boolean): ui.dialog.uiElement; + } + + class vbox extends hbox { + constructor(dialog: dialog, childObjList: any[], childHtmlList: any[], htmlList: any[], elementDefinition: definitions.vbox); } } - } - class dialog { - state: number; + class balloonPanel { + activeShowListeners: { [id: number]: { removeListener: listenerRegistration }}; + editor: editor; + focusables: { [id: number]: dom.element }; + height: string; + parts: balloonPanel.parts; + rect: balloonPanel.rect; + showListeners: { [id: number]: () => listenerRegistration }; + templateDefinitions: balloonPanel.templateDefinitions; + templates: balloonPanel.templates; + triangleHeight: number; + triangleMinDistance: number; + triangleWidth: number; + width: number; - constructor(editor: Object, dialogName: string); + activeShowListener(id: number): void; + activateShowListeners(): void; + addShowListener(listener: () => listenerRegistration): listenerRegistration; + attach(element: dom.element, options?: dom.element | boolean | { focusElement?: dom.element | boolean, show?: boolean }): void; + blur(): void; + build(): void; + deactivateShowListener(id: number): void; + deregisterFocusable(element: dom.element): void; + destroy(): void; + getHeight(): number; + getWidth(): number; + hide(): void; + move(top: number, left: number): void; + registerFocusable(element: dom.element): void; + removeShowListener(id: number): void; + resize(width: number, height: number): void; + setTitle(title: string): void; + setTriangle(side: 'left' | 'right' | 'top' | 'bottom'): void; + show(): void; + } - 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 - } - - - namespace dialog { - - namespace definition { - - interface button extends uiElement { - disabled?: boolean; - label?: string; - } - - - interface checkbox extends uiElement { - default?: string; - label?: string; - validate?: Function; - } - - - interface content { - accessKey?: string; - elements?: CKEDITOR.dialog.definition.uiElement[]; - id?: string; - label?: string; + namespace balloonPanel { + interface definition { + content?: string; title?: string; } - - interface file extends labeledElement { - action?: string; - size?: string; - validate?: Function; + interface templates { + close?: template; + content?: template; + panel?: template; + title?: template; + triangle?: template; + triangleInner?: template; + triangleOuter?: template; } - - - interface fileButton extends uiElement { - filebrowser?: string; - for?: string; - label?: string; - styles?: string; + + interface templateDefinitions { + close?: string; + content?: string; + panel?: string; + title?: string; + triangle?: string; + triangleInner?: string; + triangleOuter?: string; } - - - interface hbox extends uiElement { - children?: CKEDITOR.ui.dialog.uiElement[]; + + interface rect { height?: number; - padding?: number; - validate?: Function; - widths?: number[]; + left?: number; + top?: number; + visible?: boolean; + width?: 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?: (widget: CKEDITOR.plugins.widget) => void; - id?: string; - 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 parts { + close?: dom.element; + content?: dom.element; + panel?: dom.element; + title?: dom.element; + triangle?: dom.element; + triangleInner?: dom.element; + triangleOuter?: dom.element; } } - 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; - onHide?: Function; - resizable?: number; - title?: string; - width?: number; + class balloonToolbar { + constructor(editor: editor, definition: { [key: string]: any }); + addItem(name: string, element: button | richCombo): void; + addItems(elements: { [itemName: string]: button | richCombo }): void; + deleteItem(name: string): void; + destroy(): void; + getItem(name: string): button | richCombo; + hide(): void; + refresh(): void; + show(): void; } - 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(): CKEDITOR.dialog; - function isTabEnabled(editor: CKEDITOR.editor, dialogName: string, tabName: string): boolean; - function okButton(): void; + class button { + static readonly handler: handlerDefinition