forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add types for html-to-draftjs (DefinitelyTyped#38592)
- Loading branch information
1 parent
3c9854f
commit 05ce01b
Showing
4 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import htmlToDraft from 'html-to-draftjs'; | ||
import { ContentBlock } from 'draft-js'; | ||
|
||
const blocksFromHtml = htmlToDraft('<p>test</p>'); | ||
|
||
// $ExpectType ContentBlock[] | ||
const contentBlocks = blocksFromHtml.contentBlocks; | ||
// $ExpectType any | ||
const entityMap = blocksFromHtml.entityMap; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Type definitions for html-to-draftjs 1.4 | ||
// Project: https://github.com/jpuri/html-to-draftjs#readme | ||
// Definitions by: Ivan Zverev <https://github.com/1cheese> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// TypeScript Version: 2.9 | ||
|
||
import { ContentBlock, RawDraftEntity } from 'draft-js'; | ||
|
||
export default function htmlToDraft( | ||
text: string, | ||
customChunkRenderer?: ( | ||
nodeName: string, node: HTMLElement | ||
) => RawDraftEntity | undefined, | ||
): { | ||
contentBlocks: ContentBlock[]; | ||
entityMap?: any; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"lib": [ | ||
"es6", | ||
"dom" | ||
], | ||
"noImplicitAny": true, | ||
"noImplicitThis": true, | ||
"strictFunctionTypes": true, | ||
"strictNullChecks": true, | ||
"baseUrl": "../", | ||
"typeRoots": [ | ||
"../" | ||
], | ||
"types": [], | ||
"noEmit": true, | ||
"forceConsistentCasingInFileNames": true | ||
}, | ||
"files": [ | ||
"index.d.ts", | ||
"html-to-draftjs-tests.ts" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ "extends": "dtslint/dt.json" } |