forked from sstur/draft-js-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
32 lines (25 loc) · 998 Bytes
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/// <reference types="draft-js" />
declare module 'draft-js-import-html' {
import draftjs = require('draft-js');
export type CustomBlockFn = (element: Element) => undefined | null | CustomBlockObject;
export type CustomInlineFn = (element: Element, inlineCreators: InlineCreators) => undefined | null | Style | draftjs.EntityInstance;
export type CustomBlockObject = {
type?: string;
data?: Object;
};
export type InlineCreators = {
Style: (style: string) => Style;
Entity: (type: string, data?: Object) => draftjs.EntityInstance;
};
export type Style = {
type: 'STYLE';
style: string;
};
export interface Options {
parser?: (html: string) => HTMLBodyElement;
elementStyles?: { [styleName: string]: string };
customBlockFn?: CustomBlockFn;
customInlineFn?: CustomInlineFn;
}
export function stateFromHTML(html: string, options?: Options): draftjs.ContentState;
}