@djsp/utils
Advanced tools
Comparing version 0.1.4 to 0.1.5
{ | ||
"name": "@djsp/utils", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "Utilities for draft js", | ||
@@ -25,3 +25,2 @@ "author": "juliankrispel", | ||
"devDependencies": { | ||
"@babel/preset-flow": "^7.0.0", | ||
"cross-env": "^5.1.4", | ||
@@ -42,6 +41,3 @@ "flow-bin": "^0.81.0", | ||
"draft-js": "^0.10.5" | ||
}, | ||
"dependencies": { | ||
"draft-js": "^0.10.5" | ||
} | ||
} |
120
README.md
@@ -14,20 +14,118 @@ # @djsp/utils | ||
## Usage | ||
## Static Methods | ||
```jsx | ||
import React, { Component } from 'react' | ||
### replaceWithAtomicBlock | ||
import MyComponent from '@djsp/utils' | ||
```javascript | ||
replaceWithAtomicBlock( | ||
editorState: EditorState, | ||
entityType: string, | ||
data: Object | ||
): EditorState | ||
``` | ||
class Example extends Component { | ||
render () { | ||
return ( | ||
<MyComponent /> | ||
) | ||
} | ||
} | ||
### insertEntityBlock | ||
```javascript | ||
insertEntityBlock( | ||
editorState: EditorState, | ||
entityType: string, | ||
data: Object | ||
): EditorState | ||
``` | ||
### createEntityDecorator | ||
```javascript | ||
createEntityDecorator( | ||
entityName: string, | ||
component: Function, | ||
props?: Object | ||
): DraftDecorator | ||
``` | ||
### insertTextWithEntity | ||
```javascript | ||
insertTextWithEntity( | ||
contentState: ContentState, | ||
selection: SelectionState, | ||
entityType: string, | ||
text: string, | ||
mutability?: 'IMMUTABLE' | 'MUTABLE' | 'SEGMENTED', | ||
entityData?: Object | ||
): ContentState | ||
``` | ||
### createLinkAtSelection | ||
```javascript | ||
createLinkAtSelection( | ||
editorState: EditorState, | ||
url: string | ||
): EditorState | ||
``` | ||
### removeLinkAtSelection | ||
```javascript | ||
removeLinkAtSelection(editorState: EditorState): EditorState | ||
``` | ||
### collapseToEnd | ||
```javascript | ||
collapseToEnd(editorState: EditorState): EditorState | ||
``` | ||
### getCurrentEntityKey | ||
```javascript | ||
getCurrentEntityKey(editorState: EditorState): ?string | ||
``` | ||
### createEntityStrategy | ||
```javascript | ||
createEntityStrategy(entityType: string): ( | ||
contentBlock: ContentBlock, | ||
callback: (start: number, end: number) => void, | ||
contentState: ContentState | ||
) => void | ||
``` | ||
### getCurrentEntity | ||
```javascript | ||
getCurrentEntity( | ||
editorState: EditorState | ||
): ?DraftEntityInstance | ||
``` | ||
### getBlockEntityKey | ||
```javascript | ||
getBlockEntityKey( | ||
contentState: ContentState, | ||
key: string | ||
): ?string | ||
``` | ||
### hasEntity | ||
```javascript | ||
hasEntity( | ||
editorState: EditorState, | ||
entityType: string | ||
): boolean | ||
``` | ||
### insertNewLine | ||
```javascript | ||
insertNewLine(editorState: EditorState): EditorState | ||
``` | ||
## License | ||
MIT © [juliankrispel](https://github.com/juliankrispel) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15430
1
9
131
- Removeddraft-js@^0.10.5