From 09a387491d67f5299b91b07cfe8709a2902ca2be Mon Sep 17 00:00:00 2001 From: Antoine Rey Date: Sat, 11 Mar 2017 02:13:32 +0100 Subject: [PATCH] fix(draft-js): Update definitions for draft-js@0.10.0 (#14651) * fix(draft-js): Update definitions for draft-js@0.10.0 * fix(draft-js): Update header version * fix(draft-js): Add contentState#getLastCreatedEntityKey() --- draft-js/index.d.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/draft-js/index.d.ts b/draft-js/index.d.ts index 1805a17ab0..a79de31e70 100644 --- a/draft-js/index.d.ts +++ b/draft-js/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Draft.js v0.9.0 +// Type definitions for Draft.js v0.10.0 // Project: https://facebook.github.io/draft-js/ // Definitions by: Dmitry Rogozhny , Eelco Lempsink // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -357,7 +357,7 @@ declare namespace Draft { * - "props": Props to be passed into the React component that will be used. */ interface DraftDecorator { - strategy: (block: ContentBlock, callback: (start: number, end: number) => void) => void; + strategy: (block: ContentBlock, callback: (start: number, end: number) => void, contentState: ContentState) => void; component: Function; props?: Object; } @@ -564,6 +564,9 @@ declare namespace Draft { import DraftBlockType = Draft.Model.Constants.DraftBlockType; import DraftDecoratorType = Draft.Model.Decorators.DraftDecoratorType; + import DraftEntityType = Draft.Model.Entity.DraftEntityType; + import DraftEntityMutability = Draft.Model.Entity.DraftEntityMutability; + type DraftInlineStyle = Immutable.OrderedSet; type BlockMap = Immutable.OrderedMap; @@ -701,6 +704,10 @@ declare namespace Draft { static createFromBlockArray(blocks: Array): ContentState; static createFromText(text: string, delimiter?: string): ContentState; + createEntity(type: DraftEntityType, mutability: DraftEntityMutability, data?: Object): ContentState; + getEntity(key: string): EntityInstance; + getLastCreatedEntityKey(): string; + getBlockMap(): BlockMap; getSelectionBefore(): SelectionState; getSelectionAfter(): SelectionState;