Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@djsp/utils

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@djsp/utils - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

6

package.json
{
"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)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc