UNPKG

jodit

Version:

Jodit is awesome and usefully wysiwyg editor with filebrowser

82 lines (71 loc) 2.06 kB
/*! * Jodit Editor (https://xdsoft.net/jodit/) * Licensed under GNU General Public License version 2 or later or a commercial license or MIT; * For GPL see LICENSE-GPL.txt in the project root for license information. * For MIT see LICENSE-MIT.txt in the project root for license information. * For commercial licenses see https://xdsoft.net/jodit/commercial/ * Copyright (c) 2013-2019 Valeriy Chupurnov. All rights reserved. https://xdsoft.net */ import { IDictionary } from './types'; export type Attributes = IDictionary< string | number | boolean | IDictionary<string | number | boolean> >; export type Children = string | Array<string | Node> | Node; interface ICreate { inside: ICreate; setDocument(doc: Document): void; element<K extends keyof HTMLElementTagNameMap>( tagName: K, childrenOrAttributes?: Children ): HTMLElementTagNameMap[K]; element<K extends keyof HTMLElementTagNameMap>( tagName: K, childrenOrAttributes?: Attributes, children?: Children ): HTMLElementTagNameMap[K]; element( tagName: string, childrenOrAttributes?: Attributes | Children, children?: Children ): HTMLElement; div(className?: string, childrenOrAttributes?: Children): HTMLDivElement; div( className?: string, childrenOrAttributes?: Attributes, children?: Children ): HTMLDivElement; div( className?: string, childrenOrAttributes?: Attributes | Children, children?: Children ): HTMLDivElement; span(className?: string, childrenOrAttributes?: Children): HTMLSpanElement; span( className?: string, childrenOrAttributes?: Attributes, children?: Children ): HTMLSpanElement; span( className?: string, childrenOrAttributes?: Attributes | Children, children?: Children ): HTMLSpanElement; /** * Create text node * * @param value */ text(value: string): Text; /** * Create HTML Document fragment element */ fragment(): DocumentFragment; /** * Create DOM element from HTML text * * @param {string} html * * @return HTMLElement */ fromHTML(html: string): HTMLElement; }