diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 000000000..097b7caac --- /dev/null +++ b/index.d.ts @@ -0,0 +1,984 @@ +// Type definitions for medium-editor 5.0.0 +// Project: https://yabwe.github.io/medium-editor +// Definitions by: Ashinze Ekene + +export as namespace MediumEditor; + +export = MediumEditor; + +declare class MediumEditor implements Partial { + constructor( + element: string|HTMLElement|Element|string[]|NodeList|HTMLCollection, + options?: Partial + ); + + /** + * Given an editor element, retrieves the instance of `MediumEditor` which created/is monitoring the element + */ + static getEditorFromElement: (element: HTMLElement|Element) => MediumEditor + + /** + * Object containing data about the version of the current MediumEditor library + */ + static version: MediumEditor.VersionObject + + static Extension: { + extend(extension: Partial): void + } +} + +interface IMediumEditor { + /** + * Tear down the editor if already setup + * - Calling the destroy() method on each extension within the editor. + * This should allow all extension to be torn down and cleaned up, including the toolbar and its elements + * - Detaching all event listeners from the DOM + * - Detaching all references to custom event listeners + * - Remove any custom attributes from the editor **elements** + * - Unhide any `